From e95c7ac563720fea854e3c91adb0da9ecc6834ec Mon Sep 17 00:00:00 2001 From: Aalavandhan <6264334+aalavandhan@users.noreply.github.com> Date: Mon, 31 Mar 2025 08:26:48 -0400 Subject: [PATCH 01/18] upgraded fee policy impl without bounds on rollover fees (#248) --- spot-contracts/.openzeppelin/mainnet.json | 185 ++++++++++++++++++++++ spot-contracts/contracts/FeePolicy.sol | 8 +- spot-contracts/tasks/scripts/mainnet.sh | 3 +- spot-contracts/test/FeePolicy.ts | 19 --- 4 files changed, 188 insertions(+), 27 deletions(-) diff --git a/spot-contracts/.openzeppelin/mainnet.json b/spot-contracts/.openzeppelin/mainnet.json index e139eb59..7bbb2880 100644 --- a/spot-contracts/.openzeppelin/mainnet.json +++ b/spot-contracts/.openzeppelin/mainnet.json @@ -2840,6 +2840,191 @@ }, "namespaces": {} } + }, + "a0651b4cbe00a1624a6fc2c5b84c09b23347cbff34f3e4103c29fce3da7b9030": { + "address": "0xFad454b578a54c0602FB6D711F26fd701235FaB6", + "txHash": "0x6b08759f0988cf344fc4394829e8035a3427d2d166f58dc75bb7cc65fbac8ba6", + "layout": { + "solcVersion": "0.8.20", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:63", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:68" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:40" + }, + { + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22" + }, + { + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:94" + }, + { + "label": "targetSubscriptionRatio", + "offset": 0, + "slot": "101", + "type": "t_uint256", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:80" + }, + { + "label": "deviationRatioBoundLower", + "offset": 0, + "slot": "102", + "type": "t_uint256", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:83" + }, + { + "label": "deviationRatioBoundUpper", + "offset": 0, + "slot": "103", + "type": "t_uint256", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:86" + }, + { + "label": "perpMintFeePerc", + "offset": 0, + "slot": "104", + "type": "t_uint256", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:94" + }, + { + "label": "perpBurnFeePerc", + "offset": 0, + "slot": "105", + "type": "t_uint256", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:97" + }, + { + "label": "perpRolloverFee", + "offset": 0, + "slot": "106", + "type": "t_struct(RolloverFeeSigmoidParams)5758_storage", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:109" + }, + { + "label": "vaultMintFeePerc", + "offset": 0, + "slot": "109", + "type": "t_uint256", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:117" + }, + { + "label": "vaultBurnFeePerc", + "offset": 0, + "slot": "110", + "type": "t_uint256", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:120" + }, + { + "label": "vaultUnderlyingToPerpSwapFeePerc", + "offset": 0, + "slot": "111", + "type": "t_uint256", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:123" + }, + { + "label": "vaultPerpToUnderlyingSwapFeePerc", + "offset": 0, + "slot": "112", + "type": "t_uint256", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:126" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_int256": { + "label": "int256", + "numberOfBytes": "32" + }, + "t_struct(RolloverFeeSigmoidParams)5758_storage": { + "label": "struct FeePolicy.RolloverFeeSigmoidParams", + "members": [ + { + "label": "lower", + "type": "t_int256", + "offset": 0, + "slot": "0" + }, + { + "label": "upper", + "type": "t_int256", + "offset": 0, + "slot": "1" + }, + { + "label": "growth", + "type": "t_int256", + "offset": 0, + "slot": "2" + } + ], + "numberOfBytes": "96" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + }, + "namespaces": {} + } } } } diff --git a/spot-contracts/contracts/FeePolicy.sol b/spot-contracts/contracts/FeePolicy.sol index 7376e105..42b5a497 100644 --- a/spot-contracts/contracts/FeePolicy.sol +++ b/spot-contracts/contracts/FeePolicy.sol @@ -67,10 +67,6 @@ contract FeePolicy is IFeePolicy, OwnableUpgradeable { /// @notice Fixed point representation of 1.0 or 100%. uint256 public constant ONE = (1 * 10 ** DECIMALS); - /// @notice Sigmoid asymptote bound. - /// @dev Set to 0.05 or 5%, i.e) the rollover fee can be at most 5% on either direction. - uint256 public constant SIGMOID_BOUND = ONE / 20; - /// @notice Target subscription ratio lower bound, 0.75 or 75%. uint256 public constant TARGET_SR_LOWER_BOUND = (ONE * 75) / 100; @@ -209,9 +205,7 @@ contract FeePolicy is IFeePolicy, OwnableUpgradeable { /// @notice Update the parameters determining the slope and asymptotes of the sigmoid fee curve. /// @param p Lower, Upper and Growth sigmoid paramters are fixed point numbers with {DECIMALS} places. function updatePerpRolloverFees(RolloverFeeSigmoidParams calldata p) external onlyOwner { - // If the bond duration is 28 days and 13 rollovers happen per year, - // perp can be inflated or enriched up to ~65% annually. - if (p.lower < -int256(SIGMOID_BOUND) || p.upper > int256(SIGMOID_BOUND) || p.lower > p.upper) { + if (p.lower > p.upper) { revert InvalidSigmoidAsymptotes(); } perpRolloverFee.lower = p.lower; diff --git a/spot-contracts/tasks/scripts/mainnet.sh b/spot-contracts/tasks/scripts/mainnet.sh index 1b6107cf..ef3ab9be 100644 --- a/spot-contracts/tasks/scripts/mainnet.sh +++ b/spot-contracts/tasks/scripts/mainnet.sh @@ -115,4 +115,5 @@ yarn hardhat --network mainnet validate_upgrade PerpetualTranche 0xC1f33e0cf7e40 yarn hardhat --network mainnet validate_upgrade RolloverVault 0x82A91a0D599A45d8E9Af781D67f695d7C72869Bd yarn hardhat --network mainnet prepare_upgrade PerpetualTranche 0xC1f33e0cf7e40a67375007104B929E49a581bafE -yarn hardhat --network mainnet prepare_upgrade RolloverVault 0x82A91a0D599A45d8E9Af781D67f695d7C72869Bd \ No newline at end of file +yarn hardhat --network mainnet prepare_upgrade RolloverVault 0x82A91a0D599A45d8E9Af781D67f695d7C72869Bd +yarn hardhat --network mainnet prepare_upgrade FeePolicy 0xE22977381506bF094CB3ed50CB8834E358F7ef6c \ No newline at end of file diff --git a/spot-contracts/test/FeePolicy.ts b/spot-contracts/test/FeePolicy.ts index b3eea137..8a3e5a86 100644 --- a/spot-contracts/test/FeePolicy.ts +++ b/spot-contracts/test/FeePolicy.ts @@ -174,25 +174,6 @@ describe("FeePolicy", function () { }); describe("when parameters are invalid", function () { - it("should revert", async function () { - await expect( - feePolicy.connect(deployer).updatePerpRolloverFees({ - lower: toPerc("-0.051"), - upper: toPerc("0.01"), - growth: toPerc("3"), - }), - ).to.be.revertedWithCustomError(feePolicy, "InvalidSigmoidAsymptotes"); - }); - it("should revert", async function () { - await expect( - feePolicy.connect(deployer).updatePerpRolloverFees({ - lower: toPerc("-0.01"), - upper: toPerc("0.051"), - growth: toPerc("3"), - }), - ).to.be.revertedWithCustomError(feePolicy, "InvalidSigmoidAsymptotes"); - }); - it("should revert", async function () { await expect( feePolicy.connect(deployer).updatePerpRolloverFees({ From 25a454415c36bb9056dee54c86971ead44ba3e38 Mon Sep 17 00:00:00 2001 From: Aalavandhan <6264334+aalavandhan@users.noreply.github.com> Date: Thu, 8 May 2025 12:39:28 -0400 Subject: [PATCH 02/18] Release V5.0.0 (#244) * Bump coverallsapp/github-action from 2.3.0 to 2.3.3 (#228) Bumps [coverallsapp/github-action](https://github.com/coverallsapp/github-action) from 2.3.0 to 2.3.3. - [Release notes](https://github.com/coverallsapp/github-action/releases) - [Commits](https://github.com/coverallsapp/github-action/compare/v2.3.0...v2.3.3) --- updated-dependencies: - dependency-name: coverallsapp/github-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * updated cdr pricer (#229) * Deployed v4.1.0 implementations * Bump coverallsapp/github-action from 2.3.3 to 2.3.4 (#230) Bumps [coverallsapp/github-action](https://github.com/coverallsapp/github-action) from 2.3.3 to 2.3.4. - [Release notes](https://github.com/coverallsapp/github-action/releases) - [Commits](https://github.com/coverallsapp/github-action/compare/v2.3.3...v2.3.4) --- updated-dependencies: - dependency-name: coverallsapp/github-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * updated spot subgraph to keep track of vault swap volume * Vault Refactor & Meta Oracle (#224) * removed pricing strategies in favor of meta oracle * Bill broker refactor, using new meta oracle * Charm vault refactor, using new meta oracle * Updated Interfaces and Errors * updated unit tests * code review changes * Scalable usdc spot strategy (#231) Apply suggestions from code review Co-authored-by: Brandon Iles review fix caching bool instead of prev deviation * billy subgraph (#234) * Deployed new oracle contract and managers (#233) * deployed new oracle and managers * updated readme * Staking subgraph (#235) * staking subgraph, refreshing store on rebase * charm wampl vault subgraph * adds timestamp to swap events subgraph (#236) * adds timestamp to swap events subgraph Signed-off-by: nms-7 * linting Signed-off-by: nms-7 * fixed null swap creation with 0 timestamp Signed-off-by: nms-7 --------- Signed-off-by: nms-7 * Bump coverallsapp/github-action from 2.3.4 to 2.3.6 (#238) Bumps [coverallsapp/github-action](https://github.com/coverallsapp/github-action) from 2.3.4 to 2.3.6. - [Release notes](https://github.com/coverallsapp/github-action/releases) - [Commits](https://github.com/coverallsapp/github-action/compare/v2.3.4...v2.3.6) --- updated-dependencies: - dependency-name: coverallsapp/github-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bill broker fee curve change (#237) * using fee factor instead of percentages to support -ve fees * unit tests * code review * convergent fee curve * updated charm fee yield logic (#239) * Fee curve update (#232) * fee curve update * code review fixes * Rollover fee curve update (#240) * rollover fee handles undersubscribed vault * bumped up hardhat * code review comments * DR based flash swap fees * comment updates * updated unit tests to use ethers v6, using custom mocking library * updated tasks and deps * updated perp mint fees to be paid to the vault * removed perp share of fees from flash swaps, all fees go to the vault * added configurable dr soft bounds (curve cutoff point) to flash swap fees * updated unit tests * removed rollover fees from perp * Daily Rebalance * updated unit tests * constant rate enrichment/debasement * mint2, redeem2 * added linked library to limit contract size * unit tests * melding perps immediately after rebalance * Apply suggestions from code review Suggestions Co-authored-by: Brandon Iles * Update spot-contracts/contracts/FeePolicy.sol Co-authored-by: Brandon Iles * code review fixes * code review fixes v2 * code review fixes v3 * code review v4 * during rebalance, vault pays perps by transferring tranches into perp's reserve * rebalance eql * configurable rebalance freq * code review v5 * Apply suggestions from code review Co-authored-by: Brandon Iles * code review fixes * Code review fixes Co-authored-by: Brandon Iles * bill broker single sided deposit fix (#253) * Dev Audit Changes (#252) * fee policy restructure * updated perp fee and rebalance handling, audit cleanup * updated vault fee and rebalance handling, audit cleanup * interface and lib updates * updated unit tests * code review fixes #1 * code review fixes #2 * code review fix #3 * Removed subscription ratio for a global vault:perp tvl (or system ratio) (#254) * Using a system ratio target * using system state to calculate fees * using system state for fees and removed subscription liquidity check * interface updates * unit test updates * rename * updated deps --------- Signed-off-by: dependabot[bot] Signed-off-by: nms-7 Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: nms-7 <57442379+nms-7@users.noreply.github.com> Co-authored-by: Brandon Iles --- .github/workflows/nightly.yml | 4 +- .gitignore | 3 +- README.md | 1 + spot-contracts/.openzeppelin/mainnet.json | 321 +- spot-contracts/contracts/FeePolicy.sol | 432 +- spot-contracts/contracts/PerpetualTranche.sol | 216 +- spot-contracts/contracts/RolloverVault.sol | 533 +- spot-contracts/contracts/RouterV2.sol | 14 +- .../contracts/_interfaces/CommonTypes.sol | 26 +- .../contracts/_interfaces/IFeePolicy.sol | 59 +- .../_interfaces/IPerpetualTranche.sol | 13 + .../contracts/_interfaces/IRolloverVault.sol | 33 +- .../contracts/_interfaces/IVault.sol | 16 - .../contracts/_interfaces/ProtocolErrors.sol | 18 +- .../contracts/_test/LineHelpersTester.sol | 20 + .../contracts/_test/mocks/DMock.sol | 52 + .../contracts/_utils/BondHelpers.sol | 15 + .../contracts/_utils/ERC20Helpers.sol | 23 + .../contracts/_utils/LineHelpers.sol | 85 + .../contracts/_utils/MathHelpers.sol | 19 + .../contracts/_utils/TrancheManager.sol | 72 + .../external-artifacts/BondController.json | 45 +- spot-contracts/hardhat.config.ts | 4 +- spot-contracts/package.json | 28 +- spot-contracts/tasks/deploy/ampl.ts | 5 +- spot-contracts/tasks/deploy/buttonwood.ts | 34 +- spot-contracts/tasks/deploy/perp.ts | 39 +- spot-contracts/tasks/deploy/vaults.ts | 5 +- spot-contracts/tasks/ops/perp.ts | 109 +- spot-contracts/tasks/ops/tranche.ts | 14 +- spot-contracts/tasks/ops/vaults.ts | 193 +- spot-contracts/test/BondIssuer.ts | 136 +- spot-contracts/test/FeePolicy.ts | 651 +- spot-contracts/test/RouterV2.ts | 70 +- spot-contracts/test/_utils/HelpersTester.ts | 238 +- spot-contracts/test/_utils/LineHelpers.ts | 97 + spot-contracts/test/_utils/Sigmoid.ts | 68 +- spot-contracts/test/helpers.ts | 215 +- spot-contracts/test/perp/PerpetualTranche.ts | 478 +- .../test/perp/PerpetualTranche_deposit.ts | 245 +- .../test/perp/PerpetualTranche_redeem.ts | 196 +- .../test/perp/PerpetualTranche_rollover.ts | 447 +- .../test/rollover-vault/RolloverVault.ts | 229 +- .../rollover-vault/RolloverVault_deploy.ts | 222 +- .../RolloverVault_deposit_redeem.ts | 442 +- .../rollover-vault/RolloverVault_pair_ops.ts | 532 + .../rollover-vault/RolloverVault_rebalance.ts | 373 + .../rollover-vault/RolloverVault_recover.ts | 275 +- .../test/rollover-vault/RolloverVault_swap.ts | 658 +- spot-staking-subgraph/README.md | 6 +- spot-staking-subgraph/abis/BillBroker.json | 1691 +++ spot-staking-subgraph/abis/Wrapper.json | 28 + spot-staking-subgraph/package.json | 1 + spot-staking-subgraph/schema.graphql | 71 +- spot-staking-subgraph/src/billBroker.ts | 284 + spot-staking-subgraph/src/charmVault.ts | 153 + spot-staking-subgraph/src/mappings.ts | 214 - spot-staking-subgraph/src/rebasingToken.ts | 34 + spot-staking-subgraph/src/utils.ts | 70 + spot-staking-subgraph/subgraph.yaml | 121 +- spot-subgraph/schema.graphql | 6 + spot-subgraph/scripts/deploy.sh | 3 +- spot-subgraph/src/data/rolloverVault.ts | 8 +- spot-subgraph/src/mappings/rolloverVault.ts | 6 + spot-vaults/.openzeppelin/mainnet.json | 319 + spot-vaults/README.md | 9 +- spot-vaults/contracts/BillBroker.sol | 506 +- spot-vaults/contracts/UsdcSpotManager.sol | 231 - spot-vaults/contracts/WethWamplManager.sol | 431 - .../contracts/_interfaces/IMetaOracle.sol | 46 + .../contracts/_interfaces/IPerpPricer.sol | 24 + .../_interfaces/ISpotPricingStrategy.sol | 22 - .../_interfaces/errors/BillBrokerErrors.sol | 8 + .../CommonErrors.sol} | 17 +- .../contracts/_interfaces/external/IAMPL.sol | 7 +- .../_interfaces/external/IAlphaProVault.sol | 3 +- .../_interfaces/external/IAmpleforth.sol | 7 +- .../_interfaces/external/IBondController.sol | 5 + .../contracts/_interfaces/external/IERC20.sol | 14 + .../_interfaces/external/IPerpFeePolicy.sol | 7 + .../external/IPerpetualTranche.sol | 13 + .../_interfaces/external/ITranche.sol | 6 + .../contracts/_interfaces/external/IWAMPL.sol | 2 - .../{ => types}/BillBrokerTypes.sol | 29 +- .../_interfaces/types/CommonTypes.sol | 22 + .../contracts/_strategies/SpotAppraiser.sol | 217 - .../contracts/_strategies/SpotCDRPricer.sol | 126 - .../contracts/_strategies/SpotPricer.sol | 255 + .../contracts/_test/LineHelpersTester.sol | 31 + .../contracts/_utils/AlphaVaultHelpers.sol | 93 + spot-vaults/contracts/_utils/LineHelpers.sol | 124 + spot-vaults/contracts/_utils/MathHelpers.sol | 26 + .../contracts/_utils/UniswapV3PoolHelpers.sol | 48 + .../contracts/charm/UsdcSpotManager.sol | 243 + .../contracts/charm/WethWamplManager.sol | 238 + spot-vaults/hardhat.config.ts | 1 + spot-vaults/package.json | 2 +- spot-vaults/tasks/deploy.ts | 133 +- spot-vaults/tasks/info.ts | 113 +- spot-vaults/tasks/scripts/mainnet.sh | 43 +- spot-vaults/tasks/upgrade.ts | 119 + spot-vaults/test/BillBroker.ts | 567 +- spot-vaults/test/BillBroker_deposit_redeem.ts | 372 +- spot-vaults/test/BillBroker_swap.ts | 549 +- spot-vaults/test/LineHelpers.ts | 310 + spot-vaults/test/SpotAppraiser.ts | 277 - spot-vaults/test/SpotCDRPricer.ts | 167 - spot-vaults/test/SpotPricer.ts | 379 + spot-vaults/test/UsdcSpotManager.ts | 592 +- spot-vaults/test/WethWamplManager.ts | 885 +- spot-vaults/test/helpers.ts | 15 +- yarn.lock | 11965 +++++----------- 112 files changed, 14961 insertions(+), 15376 deletions(-) create mode 100644 spot-contracts/contracts/_test/LineHelpersTester.sol create mode 100644 spot-contracts/contracts/_test/mocks/DMock.sol create mode 100644 spot-contracts/contracts/_utils/ERC20Helpers.sol create mode 100644 spot-contracts/contracts/_utils/LineHelpers.sol create mode 100644 spot-contracts/contracts/_utils/MathHelpers.sol create mode 100644 spot-contracts/contracts/_utils/TrancheManager.sol create mode 100644 spot-contracts/test/_utils/LineHelpers.ts create mode 100644 spot-contracts/test/rollover-vault/RolloverVault_pair_ops.ts create mode 100644 spot-contracts/test/rollover-vault/RolloverVault_rebalance.ts create mode 100644 spot-staking-subgraph/abis/BillBroker.json create mode 100644 spot-staking-subgraph/abis/Wrapper.json create mode 100644 spot-staking-subgraph/src/billBroker.ts create mode 100644 spot-staking-subgraph/src/charmVault.ts delete mode 100644 spot-staking-subgraph/src/mappings.ts create mode 100644 spot-staking-subgraph/src/rebasingToken.ts create mode 100644 spot-staking-subgraph/src/utils.ts delete mode 100644 spot-vaults/contracts/UsdcSpotManager.sol delete mode 100644 spot-vaults/contracts/WethWamplManager.sol create mode 100644 spot-vaults/contracts/_interfaces/IMetaOracle.sol create mode 100644 spot-vaults/contracts/_interfaces/IPerpPricer.sol delete mode 100644 spot-vaults/contracts/_interfaces/ISpotPricingStrategy.sol create mode 100644 spot-vaults/contracts/_interfaces/errors/BillBrokerErrors.sol rename spot-vaults/contracts/_interfaces/{BillBrokerErrors.sol => errors/CommonErrors.sol} (63%) create mode 100644 spot-vaults/contracts/_interfaces/external/IBondController.sol create mode 100644 spot-vaults/contracts/_interfaces/external/IERC20.sol create mode 100644 spot-vaults/contracts/_interfaces/external/IPerpFeePolicy.sol create mode 100644 spot-vaults/contracts/_interfaces/external/IPerpetualTranche.sol create mode 100644 spot-vaults/contracts/_interfaces/external/ITranche.sol rename spot-vaults/contracts/_interfaces/{ => types}/BillBrokerTypes.sol (55%) create mode 100644 spot-vaults/contracts/_interfaces/types/CommonTypes.sol delete mode 100644 spot-vaults/contracts/_strategies/SpotAppraiser.sol delete mode 100644 spot-vaults/contracts/_strategies/SpotCDRPricer.sol create mode 100644 spot-vaults/contracts/_strategies/SpotPricer.sol create mode 100644 spot-vaults/contracts/_test/LineHelpersTester.sol create mode 100644 spot-vaults/contracts/_utils/AlphaVaultHelpers.sol create mode 100644 spot-vaults/contracts/_utils/LineHelpers.sol create mode 100644 spot-vaults/contracts/_utils/MathHelpers.sol create mode 100644 spot-vaults/contracts/_utils/UniswapV3PoolHelpers.sol create mode 100644 spot-vaults/contracts/charm/UsdcSpotManager.sol create mode 100644 spot-vaults/contracts/charm/WethWamplManager.sol create mode 100644 spot-vaults/tasks/upgrade.ts create mode 100644 spot-vaults/test/LineHelpers.ts delete mode 100644 spot-vaults/test/SpotAppraiser.ts delete mode 100644 spot-vaults/test/SpotCDRPricer.ts create mode 100644 spot-vaults/test/SpotPricer.ts diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index ca5e494f..7d04bb2f 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -30,7 +30,7 @@ jobs: run: yarn workspace @ampleforthorg/spot-contracts run coverage - name: spot-contracts report coverage - uses: coverallsapp/github-action@v2.3.0 + uses: coverallsapp/github-action@v2.3.6 with: github-token: ${{ secrets.GITHUB_TOKEN }} path-to-lcov: "./spot-contracts/coverage/lcov.info" @@ -39,7 +39,7 @@ jobs: run: yarn workspace @ampleforthorg/spot-vaults run coverage - name: spot-vaults report coverage - uses: coverallsapp/github-action@v2.3.0 + uses: coverallsapp/github-action@v2.3.6 with: github-token: ${{ secrets.GITHUB_TOKEN }} path-to-lcov: "./spot-vaults/coverage/lcov.info" diff --git a/.gitignore b/.gitignore index 8261c8d3..48cb62f1 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ node_modules coverage coverage.json typechain +typechain-types #Hardhat files cache @@ -21,4 +22,4 @@ artifacts #Generated files RolloverBatch.json -RedeemBatch.json \ No newline at end of file +RedeemBatch.json diff --git a/README.md b/README.md index 9e759317..56eacafb 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ Security contact: [dev-support@ampleforth.org](mailto:dev-support@ampleforth.org ### Package organization * [spot-contracts](./spot-contracts): SPOT protocol smart contracts. +* [spot-vaults](./spot-vaults): Vault strategies leveraging the SPOT system. * [spot-subgraph](./spot-subgraph): Subgraph to index SPOT protocol on-chain data. ## Licensing diff --git a/spot-contracts/.openzeppelin/mainnet.json b/spot-contracts/.openzeppelin/mainnet.json index 7bbb2880..420a385c 100644 --- a/spot-contracts/.openzeppelin/mainnet.json +++ b/spot-contracts/.openzeppelin/mainnet.json @@ -2605,7 +2605,7 @@ "label": "feePolicy", "offset": 0, "slot": "302", - "type": "t_contract(IFeePolicy)11570", + "type": "t_contract(IFeePolicy)11619", "contract": "PerpetualTranche", "src": "contracts/PerpetualTranche.sol:132" }, @@ -2629,7 +2629,7 @@ "label": "bondIssuer", "offset": 0, "slot": "305", - "type": "t_contract(IBondIssuer)11490", + "type": "t_contract(IBondIssuer)11539", "contract": "PerpetualTranche", "src": "contracts/PerpetualTranche.sol:150" }, @@ -2637,7 +2637,7 @@ "label": "_depositBond", "offset": 0, "slot": "306", - "type": "t_contract(IBondController)12129", + "type": "t_contract(IBondController)12178", "contract": "PerpetualTranche", "src": "contracts/PerpetualTranche.sol:153" }, @@ -2685,7 +2685,7 @@ "label": "_mintedSupplyPerTranche_DEPRECATED", "offset": 0, "slot": "312", - "type": "t_mapping(t_contract(ITranche)12156,t_uint256)", + "type": "t_mapping(t_contract(ITranche)12205,t_uint256)", "contract": "PerpetualTranche", "src": "contracts/PerpetualTranche.sol:182" }, @@ -2717,7 +2717,7 @@ "label": "vault", "offset": 0, "slot": "317", - "type": "t_contract(IRolloverVault)11853", + "type": "t_contract(IRolloverVault)11902", "contract": "PerpetualTranche", "src": "contracts/PerpetualTranche.sol:209" } @@ -2751,11 +2751,11 @@ "label": "bytes32", "numberOfBytes": "32" }, - "t_contract(IBondController)12129": { + "t_contract(IBondController)12178": { "label": "contract IBondController", "numberOfBytes": "20" }, - "t_contract(IBondIssuer)11490": { + "t_contract(IBondIssuer)11539": { "label": "contract IBondIssuer", "numberOfBytes": "20" }, @@ -2763,15 +2763,15 @@ "label": "contract IERC20Upgradeable", "numberOfBytes": "20" }, - "t_contract(IFeePolicy)11570": { + "t_contract(IFeePolicy)11619": { "label": "contract IFeePolicy", "numberOfBytes": "20" }, - "t_contract(IRolloverVault)11853": { + "t_contract(IRolloverVault)11902": { "label": "contract IRolloverVault", "numberOfBytes": "20" }, - "t_contract(ITranche)12156": { + "t_contract(ITranche)12205": { "label": "contract ITranche", "numberOfBytes": "20" }, @@ -2791,7 +2791,7 @@ "label": "mapping(contract IERC20Upgradeable => uint256)", "numberOfBytes": "32" }, - "t_mapping(t_contract(ITranche)12156,t_uint256)": { + "t_mapping(t_contract(ITranche)12205,t_uint256)": { "label": "mapping(contract ITranche => uint256)", "numberOfBytes": "32" }, @@ -3025,6 +3025,305 @@ }, "namespaces": {} } + }, + "da4c4261b05e9c48f821bf11eb12a2eeae529c35a2152ca2e4794ad6729b13d6": { + "address": "0xA85Be82083E032EdF32a19028DF558484b399196", + "txHash": "0xa4c0c32b4a5756ea10e89753679d3d3485dae0e8ada42fc7cc26633b0f934ec5", + "layout": { + "solcVersion": "0.8.20", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:63", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:68" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:40" + }, + { + "label": "_balances", + "offset": 0, + "slot": "51", + "type": "t_mapping(t_address,t_uint256)", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:40" + }, + { + "label": "_allowances", + "offset": 0, + "slot": "52", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:42" + }, + { + "label": "_totalSupply", + "offset": 0, + "slot": "53", + "type": "t_uint256", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:44" + }, + { + "label": "_name", + "offset": 0, + "slot": "54", + "type": "t_string_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:46" + }, + { + "label": "_symbol", + "offset": 0, + "slot": "55", + "type": "t_string_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:47" + }, + { + "label": "__gap", + "offset": 0, + "slot": "56", + "type": "t_array(t_uint256)45_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:376" + }, + { + "label": "__gap", + "offset": 0, + "slot": "101", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC20BurnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol:51" + }, + { + "label": "_owner", + "offset": 0, + "slot": "151", + "type": "t_address", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22" + }, + { + "label": "__gap", + "offset": 0, + "slot": "152", + "type": "t_array(t_uint256)49_storage", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:94" + }, + { + "label": "_paused", + "offset": 0, + "slot": "201", + "type": "t_bool", + "contract": "PausableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:29" + }, + { + "label": "__gap", + "offset": 0, + "slot": "202", + "type": "t_array(t_uint256)49_storage", + "contract": "PausableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:116" + }, + { + "label": "_status", + "offset": 0, + "slot": "251", + "type": "t_uint256", + "contract": "ReentrancyGuardUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol:38" + }, + { + "label": "__gap", + "offset": 0, + "slot": "252", + "type": "t_array(t_uint256)49_storage", + "contract": "ReentrancyGuardUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol:88" + }, + { + "label": "underlying", + "offset": 0, + "slot": "301", + "type": "t_contract(IERC20Upgradeable)1205", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:107" + }, + { + "label": "_deployed", + "offset": 0, + "slot": "302", + "type": "t_struct(AddressSet)4926_storage", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:111" + }, + { + "label": "minDeploymentAmt", + "offset": 0, + "slot": "304", + "type": "t_uint256", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:119" + }, + { + "label": "perp", + "offset": 0, + "slot": "305", + "type": "t_contract(IPerpetualTranche)11845", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:122" + }, + { + "label": "feePolicy", + "offset": 0, + "slot": "306", + "type": "t_contract(IFeePolicy)11619", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:128" + }, + { + "label": "keeper", + "offset": 0, + "slot": "307", + "type": "t_address", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:133" + }, + { + "label": "reservedUnderlyingBal", + "offset": 0, + "slot": "308", + "type": "t_uint256", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:144" + }, + { + "label": "reservedSubscriptionPerc", + "offset": 0, + "slot": "309", + "type": "t_uint256", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:152" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_bytes32)dyn_storage": { + "label": "bytes32[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)45_storage": { + "label": "uint256[45]", + "numberOfBytes": "1440" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(IERC20Upgradeable)1205": { + "label": "contract IERC20Upgradeable", + "numberOfBytes": "20" + }, + "t_contract(IFeePolicy)11619": { + "label": "contract IFeePolicy", + "numberOfBytes": "20" + }, + "t_contract(IPerpetualTranche)11845": { + "label": "contract IPerpetualTranche", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "label": "mapping(address => mapping(address => uint256))", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes32,t_uint256)": { + "label": "mapping(bytes32 => uint256)", + "numberOfBytes": "32" + }, + "t_string_storage": { + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(AddressSet)4926_storage": { + "label": "struct EnumerableSetUpgradeable.AddressSet", + "members": [ + { + "label": "_inner", + "type": "t_struct(Set)4611_storage", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "64" + }, + "t_struct(Set)4611_storage": { + "label": "struct EnumerableSetUpgradeable.Set", + "members": [ + { + "label": "_values", + "type": "t_array(t_bytes32)dyn_storage", + "offset": 0, + "slot": "0" + }, + { + "label": "_indexes", + "type": "t_mapping(t_bytes32,t_uint256)", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + }, + "namespaces": {} + } } } } diff --git a/spot-contracts/contracts/FeePolicy.sol b/spot-contracts/contracts/FeePolicy.sol index 42b5a497..323aad74 100644 --- a/spot-contracts/contracts/FeePolicy.sol +++ b/spot-contracts/contracts/FeePolicy.sol @@ -2,62 +2,57 @@ pragma solidity ^0.8.20; import { IFeePolicy } from "./_interfaces/IFeePolicy.sol"; -import { SubscriptionParams } from "./_interfaces/CommonTypes.sol"; -import { InvalidPerc, InvalidTargetSRBounds, InvalidDRBounds, InvalidSigmoidAsymptotes } from "./_interfaces/ProtocolErrors.sol"; +import { SystemTVL, Range, Line } from "./_interfaces/CommonTypes.sol"; +import { InvalidPerc, InvalidRange, InvalidFees } from "./_interfaces/ProtocolErrors.sol"; +import { LineHelpers } from "./_utils/LineHelpers.sol"; import { MathUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol"; +import { SignedMathUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol"; import { SafeCastUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol"; import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; -import { Sigmoid } from "./_utils/Sigmoid.sol"; +import { MathHelpers } from "./_utils/MathHelpers.sol"; /** * @title FeePolicy * - * @notice This contract determines fees for interacting with the perp and vault systems. + * @notice This contract determines fees and incentives for interacting with the perp and vault systems. * * The fee policy attempts to balance the demand for holding perp tokens with * the demand for holding vault tokens; such that the total collateral in the vault * supports rolling over all mature collateral backing perps. * - * Fees are computed based on the deviation between the system's current subscription ratio - * and the target subscription ratio. - * - `subscriptionRatio` = (vaultTVL * seniorTR) / (perpTVL * 1-seniorTR) - * - `deviationRatio` (dr) = subscriptionRatio / targetSubscriptionRatio + * The system's balance is defined by it's `deviationRatio` which is defined as follows. + * - `systemRatio` = vaultTVL / perpTVL + * - `deviationRatio` (dr) = systemRatio / targetSystemRatio * - * When the system is "under-subscribed" (dr <= 1): - * - Rollover fees flow from perp holders to vault note holders. - * - Fees are charged for minting new perps. - * - No fees are charged for redeeming perps. + * When the dr = 1, the system is considered perfectly balanced. + * When the dr < 1, the vault is considered "under-subscribed". + * When the dr > 1, the vault is considered "over-subscribed". * - * When the system is "over-subscribed" (dr > 1): - * - Rollover fees flow from vault note holders to perp holders. - * - No fees are charged for minting new perps. - * - Fees are charged for redeeming perps. + * Fees: + * - The system charges a greater fee for operations that move it away from the balance point. + * - If an operation moves the system back to the balance point, it charges a lower fee (or no fee). * - * Regardless of the `deviationRatio`, the system charges a fixed percentage fee - * for minting and redeeming vault notes. + * Incentives: + * - When the vault is "under-subscribed", value is transferred from perp to the vault at the computed rate. + * This debases perp tokens gradually and enriches the rollover vault. + * - When the vault is "over-subscribed", value is transferred from the vault to perp at the computed rate. + * This enriches perp tokens gradually and debases the rollover vault. + * - This transfer is implemented through a periodic "rebalance" operation, executed by the vault, and + * gradually nudges the system back into balance. On rebalance, the vault queries this policy + * to compute the magnitude and direction of value transfer. * - * - * The rollover fees are signed and can flow in either direction based on the `deviationRatio`. - * The fee is a percentage is computed through a sigmoid function. - * The slope and asymptotes are set by the owner. - * - * CRITICAL: The rollover fee percentage is NOT annualized, the fee percentage is applied per rollover. - * The number of rollovers per year changes based on the duration of perp's minting bond. - * - * We consider a `deviationRatio` of greater than 1.0 healthy (or "over-subscribed"). - * In general, the system favors an elastic perp supply and an inelastic vault note supply. + * NOTE: All parameters are stored as fixed point numbers with {DECIMALS} decimal places. * * */ contract FeePolicy is IFeePolicy, OwnableUpgradeable { // Libraries using MathUpgradeable for uint256; + using MathHelpers for uint256; + using SignedMathUpgradeable for int256; using SafeCastUpgradeable for uint256; - - // Replicating value used here: - // https://github.com/buttonwood-protocol/tranche/blob/main/contracts/BondController.sol - uint256 private constant TRANCHE_RATIO_GRANULARITY = 1000; + using SafeCastUpgradeable for int256; /// @notice The returned fee percentages are fixed point numbers with {DECIMALS} places. /// @dev The decimals should line up with value expected by consumer (perp, vault). @@ -65,65 +60,46 @@ contract FeePolicy is IFeePolicy, OwnableUpgradeable { uint8 public constant DECIMALS = 8; /// @notice Fixed point representation of 1.0 or 100%. - uint256 public constant ONE = (1 * 10 ** DECIMALS); - - /// @notice Target subscription ratio lower bound, 0.75 or 75%. - uint256 public constant TARGET_SR_LOWER_BOUND = (ONE * 75) / 100; - - /// @notice Target subscription ratio higher bound, 2.0 or 200%. - uint256 public constant TARGET_SR_UPPER_BOUND = 2 * ONE; - - //----------------------------------------------------------------------------- - /// @notice The target subscription ratio i.e) the normalization factor. - /// @dev The ratio under which the system is considered "under-subscribed". - /// Adds a safety buffer to ensure that rollovers are better sustained. - uint256 public targetSubscriptionRatio; - - /// @notice The lower bound of deviation ratio, below which some operations (which decrease the dr) are disabled. - uint256 public deviationRatioBoundLower; - - /// @notice The upper bound of deviation ratio, above which some operations (which increase the dr) are disabled. - uint256 public deviationRatioBoundUpper; + uint256 public constant ONE = (10 ** DECIMALS); //----------------------------------------------------------------------------- + /// @notice The target system ratio i.e) the normalization factor. + /// @dev The target system ratio, the target vault tvl to perp tvl ratio and + /// is *different* from button-wood's tranche ratios. + uint256 public override targetSystemRatio; //----------------------------------------------------------------------------- - // Perp fee parameters + // Fee parameters - /// @notice The percentage fee charged on minting perp tokens. - uint256 public perpMintFeePerc; + /// @notice Linear fee function used for operations that decrease DR (x-axis dr, y-axis fees). + Line public feeFnDRDown; - /// @notice The percentage fee charged on burning perp tokens. - uint256 public perpBurnFeePerc; + /// @notice Linear fee function used for operations that increase DR (x-axis dr, y-axis fees). + Line public feeFnDRUp; - struct RolloverFeeSigmoidParams { - /// @notice Lower asymptote - int256 lower; - /// @notice Upper asymptote - int256 upper; - /// @notice sigmoid slope - int256 growth; - } + //----------------------------------------------------------------------------- + // Rebalance parameters - /// @notice Parameters which control the asymptotes and the slope of the perp token's rollover fee. - RolloverFeeSigmoidParams public perpRolloverFee; + /// @notice Reaction lag factor applied to rebalancing on perp debasement. + uint256 public perpDebasementLag; - //----------------------------------------------------------------------------- + /// @notice Reaction lag factor applied to rebalancing on perp enrichment. + uint256 public perpEnrichmentLag; - //----------------------------------------------------------------------------- - // Vault fee parameters + /// @notice Lower and upper percentage limits on perp debasement. + Range public perpDebasementPercLimits; - /// @notice The percentage fee charged on minting vault notes. - uint256 public vaultMintFeePerc; + /// @notice Lower and upper percentage limits on perp enrichment. + Range public perpEnrichmentPercLimits; - /// @notice The percentage fee charged on burning vault notes. - uint256 public vaultBurnFeePerc; + /// @notice Minimum number of seconds between subsequent rebalances. + uint256 public override rebalanceFreqSec; - /// @notice The percentage fee charged by the vault to swap underlying tokens for perp tokens. - uint256 public vaultUnderlyingToPerpSwapFeePerc; + /// @notice The percentage of system tvl charged as protocol fees on every rebalance. + uint256 public override protocolSharePerc; - /// @notice The percentage fee charged by the vault to swap perp tokens for underlying tokens. - uint256 public vaultPerpToUnderlyingSwapFeePerc; + /// @notice The address to which the protocol fees are streamed to. + address public override protocolFeeCollector; //----------------------------------------------------------------------------- @@ -136,190 +112,204 @@ contract FeePolicy is IFeePolicy, OwnableUpgradeable { function init() external initializer { __Ownable_init(); - // initializing mint/burn fees to zero - perpMintFeePerc = 0; - perpBurnFeePerc = 0; - vaultMintFeePerc = 0; - vaultBurnFeePerc = 0; - - // initializing swap fees to 100%, to disable swapping initially - vaultUnderlyingToPerpSwapFeePerc = ONE; - vaultPerpToUnderlyingSwapFeePerc = ONE; - - // NOTE: With the current bond length of 28 days, rollover rate is annualized by dividing by: 365/28 ~= 13 - perpRolloverFee.lower = -int256(ONE) / (30 * 13); // -0.033/13 = -0.00253 (3.3% annualized) - perpRolloverFee.upper = int256(ONE) / (10 * 13); // 0.1/13 = 0.00769 (10% annualized) - perpRolloverFee.growth = 5 * int256(ONE); // 5.0 - - targetSubscriptionRatio = (ONE * 133) / 100; // 1.33 - deviationRatioBoundLower = (ONE * 75) / 100; // 0.75 - deviationRatioBoundUpper = 2 * ONE; // 2.0 + targetSystemRatio = 3 * ONE; // 3.0 + + // initializing fees + feeFnDRDown = Line({ + x1: (ONE * 66) / 100, // 0.66 + y1: ONE / 4, // 25% + x2: (ONE * 95) / 100, // 0.95 + y2: 0 // 0% + }); + feeFnDRUp = Line({ + x1: (ONE * 105) / 100, // 1.05 + y1: 0, // 0% + x2: (ONE * 150) / 100, // 1.5 + y2: ONE / 4 // 25% + }); + + // initializing rebalancing parameters + perpDebasementLag = 30; + perpEnrichmentLag = 30; + perpDebasementPercLimits = Range({ + lower: (ONE) / 200, // 0.5% or 50 bps + upper: ONE / 40 // 2.5% or 250 bps + }); + perpEnrichmentPercLimits = Range({ + lower: (ONE) / 200, // 0.5% or 50 bps + upper: ONE / 40 // 2.5% or 250 bps + }); + rebalanceFreqSec = 86400; // 1 day + protocolSharePerc = ONE / 100; // or 1% + protocolFeeCollector = owner(); } //----------------------------------------------------------------------------- // Owner only - /// @notice Updates the target subscription ratio. - /// @param targetSubscriptionRatio_ The new target subscription ratio as a fixed point number with {DECIMALS} places. - function updateTargetSubscriptionRatio(uint256 targetSubscriptionRatio_) external onlyOwner { - if (targetSubscriptionRatio_ < TARGET_SR_LOWER_BOUND || targetSubscriptionRatio_ > TARGET_SR_UPPER_BOUND) { - revert InvalidTargetSRBounds(); - } - targetSubscriptionRatio = targetSubscriptionRatio_; + /// @notice Updates the target system ratio. + /// @param targetSystemRatio_ The new target system ratio as a fixed point number with {DECIMALS} places. + function updateTargetSystemRatio(uint256 targetSystemRatio_) external onlyOwner { + targetSystemRatio = targetSystemRatio_; } - /// @notice Updates the deviation ratio bounds. - /// @param deviationRatioBoundLower_ The new lower deviation ratio bound as fixed point number with {DECIMALS} places. - /// @param deviationRatioBoundUpper_ The new upper deviation ratio bound as fixed point number with {DECIMALS} places. - function updateDeviationRatioBounds( - uint256 deviationRatioBoundLower_, - uint256 deviationRatioBoundUpper_ - ) external onlyOwner { - if (deviationRatioBoundLower_ > ONE || deviationRatioBoundUpper_ < ONE) { - revert InvalidDRBounds(); - } - deviationRatioBoundLower = deviationRatioBoundLower_; - deviationRatioBoundUpper = deviationRatioBoundUpper_; - } + /// @notice Updates the system fee functions. + /// @param feeFnDRDown_ The new fee function for operations that decrease DR. + /// @param feeFnDRUp_ The new fee function for operations that increase DR. + function updateFees(Line memory feeFnDRDown_, Line memory feeFnDRUp_) external onlyOwner { + // Expect DR to be non-decreasing, x1 <= x2 + bool validFees = ((feeFnDRDown_.x1 <= feeFnDRDown_.x2) && (feeFnDRUp_.x1 <= feeFnDRUp_.x2)); - /// @notice Updates the perp mint fee parameters. - /// @param perpMintFeePerc_ The new perp mint fee ceiling percentage - /// as a fixed point number with {DECIMALS} places. - function updatePerpMintFees(uint256 perpMintFeePerc_) external onlyOwner { - if (perpMintFeePerc_ > ONE) { - revert InvalidPerc(); - } - perpMintFeePerc = perpMintFeePerc_; - } + // Expect equilibrium zone to be valid + validFees = ((feeFnDRDown_.x2 <= ONE) && (feeFnDRUp_.x1 >= ONE)) && validFees; - /// @notice Updates the perp burn fee parameters. - /// @param perpBurnFeePerc_ The new perp burn fee ceiling percentage - /// as a fixed point number with {DECIMALS} places. - function updatePerpBurnFees(uint256 perpBurnFeePerc_) external onlyOwner { - if (perpBurnFeePerc_ > ONE) { - revert InvalidPerc(); - } - perpBurnFeePerc = perpBurnFeePerc_; - } + // Expect fees to be non-decreasing when dr moves away from 1.0 + validFees = ((feeFnDRDown_.y1 >= feeFnDRDown_.y2) && (feeFnDRUp_.y1 <= feeFnDRUp_.y2)) && validFees; - /// @notice Update the parameters determining the slope and asymptotes of the sigmoid fee curve. - /// @param p Lower, Upper and Growth sigmoid paramters are fixed point numbers with {DECIMALS} places. - function updatePerpRolloverFees(RolloverFeeSigmoidParams calldata p) external onlyOwner { - if (p.lower > p.upper) { - revert InvalidSigmoidAsymptotes(); - } - perpRolloverFee.lower = p.lower; - perpRolloverFee.upper = p.upper; - perpRolloverFee.growth = p.growth; - } + // Expect fee percentages to be valid + validFees = + (feeFnDRDown_.y1 <= ONE) && + (feeFnDRDown_.y2 <= ONE) && + (feeFnDRUp_.y1 <= ONE) && + ((feeFnDRUp_.y2 <= ONE) && validFees); - /// @notice Updates the vault mint fee parameters. - /// @param vaultMintFeePerc_ The new vault mint fee ceiling percentage - /// as a fixed point number with {DECIMALS} places. - function updateVaultMintFees(uint256 vaultMintFeePerc_) external onlyOwner { - if (vaultMintFeePerc_ > ONE) { - revert InvalidPerc(); + if (!validFees) { + revert InvalidFees(); } - vaultMintFeePerc = vaultMintFeePerc_; - } - /// @notice Updates the vault burn fee parameters. - /// @param vaultBurnFeePerc_ The new vault burn fee ceiling percentage - /// as a fixed point number with {DECIMALS} places. - function updateVaultBurnFees(uint256 vaultBurnFeePerc_) external onlyOwner { - if (vaultBurnFeePerc_ > ONE) { - revert InvalidPerc(); - } - vaultBurnFeePerc = vaultBurnFeePerc_; + feeFnDRDown = feeFnDRDown_; + feeFnDRUp = feeFnDRUp_; } - /// @notice Updates the vault's share of the underlying to perp swap fee. - /// @param feePerc The new fee percentage. - function updateVaultUnderlyingToPerpSwapFeePerc(uint256 feePerc) external onlyOwner { - if (feePerc > ONE) { - revert InvalidPerc(); + /// @notice Updates the all the parameters which control magnitude and frequency of the rebalance. + /// @param perpDebasementLag_ The new perp debasement lag factor. + /// @param perpEnrichmentLag_ The new perp enrichment lag factor. + /// @param perpDebasementPercLimits_ The new lower and upper percentage limits on perp debasement. + /// @param perpEnrichmentPercLimits_ The new lower and upper percentage limits on perp enrichment. + /// @param rebalanceFreqSec_ The new rebalance frequency in seconds. + function updateRebalanceConfig( + uint256 perpDebasementLag_, + uint256 perpEnrichmentLag_, + Range memory perpDebasementPercLimits_, + Range memory perpEnrichmentPercLimits_, + uint256 rebalanceFreqSec_ + ) external onlyOwner { + if ( + perpDebasementPercLimits_.lower > perpDebasementPercLimits_.upper || + perpEnrichmentPercLimits_.lower > perpEnrichmentPercLimits_.upper + ) { + revert InvalidRange(); } - vaultUnderlyingToPerpSwapFeePerc = feePerc; + + perpDebasementLag = perpDebasementLag_; + perpEnrichmentLag = perpEnrichmentLag_; + perpDebasementPercLimits = perpDebasementPercLimits_; + perpEnrichmentPercLimits = perpEnrichmentPercLimits_; + rebalanceFreqSec = rebalanceFreqSec_; } - /// @notice Updates the vault's share of the perp to underlying swap fee. - /// @param feePerc The new fee percentage. - function updateVaultPerpToUnderlyingSwapFeePerc(uint256 feePerc) external onlyOwner { - if (feePerc > ONE) { + /// @notice Updates the protocol share of tvl extracted on every rebalance. + /// @param protocolSharePerc_ The share of the tvl which goes to the protocol as a percentage. + /// @param protocolFeeCollector_ The new fee collector address. + function updateProtocolFeeConfig(uint256 protocolSharePerc_, address protocolFeeCollector_) external onlyOwner { + if (protocolSharePerc_ > ONE) { revert InvalidPerc(); } - vaultPerpToUnderlyingSwapFeePerc = feePerc; + protocolSharePerc = protocolSharePerc_; + protocolFeeCollector = protocolFeeCollector_; } //----------------------------------------------------------------------------- // Public methods /// @inheritdoc IFeePolicy - /// @dev Minting perps reduces system dr, i.e) drPost < drPre. - function computePerpMintFeePerc() public view override returns (uint256) { - return perpMintFeePerc; + function computeFeePerc(uint256 drPre, uint256 drPost) public view override returns (uint256) { + // DR is decreasing, we use feeFnDRDown + if (drPre > drPost) { + Line memory fee = feeFnDRDown; + return + LineHelpers + .computePiecewiseAvgY( + fee, + Line({ x1: fee.x2, y1: fee.y2, x2: ONE, y2: fee.y2 }), + Range({ lower: drPost, upper: drPre }), + fee.x2 + ) + .toUint256(); + } + // DR is increasing, we use feeFnDRUp + else { + Line memory fee = feeFnDRUp; + return + LineHelpers + .computePiecewiseAvgY( + Line({ x1: ONE, y1: fee.y1, x2: fee.x1, y2: fee.y1 }), + fee, + Range({ lower: drPre, upper: drPost }), + fee.x1 + ) + .toUint256(); + } } /// @inheritdoc IFeePolicy - /// @dev Burning perps increases system dr, i.e) drPost > drPre. - function computePerpBurnFeePerc() public view override returns (uint256) { - return perpBurnFeePerc; + function decimals() external pure override returns (uint8) { + return DECIMALS; } /// @inheritdoc IFeePolicy - function computePerpRolloverFeePerc(uint256 dr) external view override returns (int256) { - return - Sigmoid.compute( - dr.toInt256(), - perpRolloverFee.lower, - perpRolloverFee.upper, - perpRolloverFee.growth, - ONE.toInt256() - ); - } + function computeRebalanceAmount(SystemTVL memory s) external view override returns (int256 underlyingAmtIntoPerp) { + // We skip rebalancing if dr is close to 1.0 + uint256 dr = computeDeviationRatio(s); + Range memory drEq = drEqZone(); + if (dr >= drEq.lower && dr <= drEq.upper) { + return 0; + } - /// @inheritdoc IFeePolicy - /// @dev Minting vault notes increases system dr, i.e) drPost > drPre. - function computeVaultMintFeePerc() external view override returns (uint256) { - return vaultMintFeePerc; - } + // We compute the total value that should flow into perp to push the system into equilibrium. + uint256 reqPerpTVL = (s.perpTVL + s.vaultTVL).mulDiv(ONE, targetSystemRatio + ONE); + int256 reqUnderlyingAmtIntoPerp = reqPerpTVL.toInt256() - s.perpTVL.toInt256(); - /// @inheritdoc IFeePolicy - function computeVaultBurnFeePerc() external view override returns (uint256) { - return vaultBurnFeePerc; - } + // Perp debasement, value needs to flow from perp into the vault + if (reqUnderlyingAmtIntoPerp < 0) { + // We calculate the 'clipped' lag adjusted rebalance amount + uint256 underlyingAmtTransferred = (reqUnderlyingAmtIntoPerp.abs() / perpDebasementLag).clip( + s.perpTVL.mulDiv(perpDebasementPercLimits.lower, ONE), + s.perpTVL.mulDiv(perpDebasementPercLimits.upper, ONE) + ); - /// @inheritdoc IFeePolicy - /// @dev Swapping by minting perps reduces system dr, i.e) drPost < drPre. - function computeUnderlyingToPerpVaultSwapFeePerc( - uint256 /*drPre*/, - uint256 drPost - ) external view override returns (uint256) { - // When the after op deviation ratio is below the bound, - // swapping is disabled. (fees are set to 100%) - return (drPost < deviationRatioBoundLower ? ONE : vaultUnderlyingToPerpSwapFeePerc); - } + // We ensure that the rebalance doesn't overshoot equilibrium + underlyingAmtIntoPerp = SignedMathUpgradeable.max( + -underlyingAmtTransferred.toInt256(), + reqUnderlyingAmtIntoPerp + ); + } + // Perp enrichment, from the vault into perp + else if (reqUnderlyingAmtIntoPerp > 0) { + // We calculate the 'clipped' lag adjusted rebalance amount + uint256 underlyingAmtTransferred = (reqUnderlyingAmtIntoPerp.toUint256() / perpEnrichmentLag).clip( + s.perpTVL.mulDiv(perpEnrichmentPercLimits.lower, ONE), + s.perpTVL.mulDiv(perpEnrichmentPercLimits.upper, ONE) + ); - /// @inheritdoc IFeePolicy - /// @dev Swapping by burning perps increases system dr, i.e) drPost > drPre. - function computePerpToUnderlyingVaultSwapFeePerc( - uint256 /*drPre*/, - uint256 drPost - ) external view override returns (uint256) { - // When the after op deviation ratio is above the bound, - // swapping is disabled. (fees are set to 100%) - return (drPost > deviationRatioBoundUpper ? ONE : vaultPerpToUnderlyingSwapFeePerc); + // We ensure that the rebalance doesn't overshoot equilibrium + underlyingAmtIntoPerp = SignedMathUpgradeable.min( + underlyingAmtTransferred.toInt256(), + reqUnderlyingAmtIntoPerp + ); + } } /// @inheritdoc IFeePolicy - function decimals() external pure override returns (uint8) { - return DECIMALS; + function computeDeviationRatio(SystemTVL memory s) public view override returns (uint256) { + // NOTE: We assume that perp's TVL and vault's TVL values have the same base denomination. + return s.vaultTVL.mulDiv(ONE, s.perpTVL).mulDiv(ONE, targetSystemRatio); } - /// @inheritdoc IFeePolicy - function computeDeviationRatio(SubscriptionParams memory s) public view returns (uint256) { - // NOTE: We assume that perp's TVL and vault's TVL values have the same base denomination. - uint256 juniorTR = TRANCHE_RATIO_GRANULARITY - s.seniorTR; - return (s.vaultTVL * s.seniorTR).mulDiv(ONE, (s.perpTVL * juniorTR)).mulDiv(ONE, targetSubscriptionRatio); + /// @return The range of deviation ratios which define the equilibrium zone. + /// @dev We infer the equilibrium from the fee function definitions, i.e) the upperDR in `feeFnDRDown` + /// and lowerDR in `feeFnDRUp`. + function drEqZone() public view returns (Range memory) { + return Range({ lower: feeFnDRDown.x2, upper: feeFnDRUp.x1 }); } } diff --git a/spot-contracts/contracts/PerpetualTranche.sol b/spot-contracts/contracts/PerpetualTranche.sol index 960dfc8e..6aee433c 100644 --- a/spot-contracts/contracts/PerpetualTranche.sol +++ b/spot-contracts/contracts/PerpetualTranche.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.20; import { IERC20MetadataUpgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol"; import { IERC20Upgradeable, IPerpetualTranche, IBondIssuer, IFeePolicy, IBondController, ITranche } from "./_interfaces/IPerpetualTranche.sol"; import { IRolloverVault } from "./_interfaces/IRolloverVault.sol"; -import { TokenAmount, RolloverData, SubscriptionParams } from "./_interfaces/CommonTypes.sol"; +import { TokenAmount, RolloverData, SystemTVL } from "./_interfaces/CommonTypes.sol"; import { UnauthorizedCall, UnauthorizedTransferOut, UnexpectedDecimals, UnexpectedAsset, UnacceptableParams, UnacceptableRollover, ExceededMaxSupply, ExceededMaxMintPerTranche, ReserveCountOverLimit, InvalidPerc } from "./_interfaces/ProtocolErrors.sol"; import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; @@ -35,7 +35,7 @@ import { BondHelpers } from "./_utils/BondHelpers.sol"; * into the reserve. At any time, the reserve holds at most 2 classes of tokens * i.e) the seniors and the underlying collateral. * - * Incentivized parties can "rollover" tranches approaching maturity or the underlying collateral, + * The rollover vault can "rollover" tranches approaching maturity or the underlying collateral, * for newer seniors (which expire further out in the future) that belong to the updated "depositBond". * * @@ -45,6 +45,8 @@ import { BondHelpers } from "./_utils/BondHelpers.sol"; * This brings the system storage state up to date. * * CRITICAL: On the 3 main system operations: deposit, redeem and rollover; + * + * The system charges a fee for minting and burning perp tokens, which are paid to the vault. * We first compute fees before executing any transfers in or out of the system. * The ordering of operations is very important as the fee computation logic, * requires the system TVL as an input and which should be recorded prior to any value @@ -57,6 +59,12 @@ import { BondHelpers } from "./_utils/BondHelpers.sol"; * When computing the value of assets in the system, the code always over-values by * rounding up. When computing the value of incoming assets, the code rounds down. * + * @dev Demand imbalance between perp and the vault + * is restored through a "rebalancing" mechanism similar to a funding rate. When value needs to flow from perp to the vault, + * the system debases the value of perp tokens by minting perp tokens to the vault. + * When value needs to flow from the vault to perp, the fresh senior tranches are + * transferred from the vault into perp's reserve thereby enriching the value of perp tokens. + * */ contract PerpetualTranche is ERC20BurnableUpgradeable, @@ -113,7 +121,7 @@ contract PerpetualTranche is uint256 public constant ONE = (10 ** PERC_DECIMALS); // 1.0 or 100% /// @dev The maximum number of reserve assets that can be held by perp. - uint8 public constant MAX_RESERVE_COUNT = 11; + uint8 public constant MAX_RESERVE_COUNT = 21; //------------------------------------------------------------------------- // Storage @@ -247,6 +255,7 @@ contract PerpetualTranche is /// @param collateral_ Address of the underlying collateral token. /// @param bondIssuer_ Address of the bond issuer contract. /// @param feePolicy_ Address of the fee policy contract. + /// @dev Call `updateVault` with reference to the rollover vault after initialization. function init( string memory name, string memory symbol, @@ -270,7 +279,7 @@ contract PerpetualTranche is updateFeePolicy(feePolicy_); updateBondIssuer(bondIssuer_); - updateTolerableTrancheMaturity(1, type(uint256).max); + updateTolerableTrancheMaturity(86400 * 7, 86400 * 31); updateMaxSupply(type(uint256).max); updateMaxDepositTrancheValuePerc(ONE); } @@ -347,7 +356,6 @@ contract PerpetualTranche is } /// @notice Unpauses deposits, withdrawals and rollovers. - /// @dev ERC-20 functions, like transfers will always remain operational. function unpause() external onlyKeeper { _unpause(); } @@ -380,9 +388,10 @@ contract PerpetualTranche is revert UnexpectedAsset(); } - // Calculates the fee adjusted amount of perp tokens minted when depositing `trancheInAmt` of tranche tokens - // NOTE: This operation should precede any token transfers. - uint256 perpAmtMint = _computeMintAmt(trancheIn, trancheInAmt); + // Calculates the amount of perp tokens minted when depositing `trancheInAmt` of tranche tokens + // and the perp tokens paid as fees. + // NOTE: This calculation should precede any token transfers. + (uint256 perpAmtMint, uint256 perpFeeAmt) = _computeMintAmt(trancheIn, trancheInAmt); if (trancheInAmt <= 0 || perpAmtMint <= 0) { return 0; } @@ -393,6 +402,9 @@ contract PerpetualTranche is // mints perp tokens to the sender _mint(msg.sender, perpAmtMint); + // Mint fees are collected self-minting perp tokens. + _mint(address(this), perpFeeAmt); + // post-deposit checks _enforceMintCaps(trancheIn); @@ -401,19 +413,22 @@ contract PerpetualTranche is /// @inheritdoc IPerpetualTranche function redeem( - uint256 perpAmtBurnt + uint256 perpAmt ) external override afterStateUpdate nonReentrant whenNotPaused returns (TokenAmount[] memory) { // verifies if burn amount is acceptable - if (perpAmtBurnt <= 0) { + if (perpAmt <= 0) { return new TokenAmount[](0); } // Calculates the fee adjusted share of reserve tokens to be redeemed - // NOTE: This operation should precede any token transfers. - TokenAmount[] memory tokensOut = _computeRedemptionAmts(perpAmtBurnt); + // NOTE: This calculation should precede any token transfers. + (TokenAmount[] memory tokensOut, uint256 perpFeeAmt) = _computeRedemptionAmts(perpAmt); // burns perp tokens from the sender - _burn(msg.sender, perpAmtBurnt); + _burn(msg.sender, perpAmt - perpFeeAmt); + + // Redemption fees are collected by transferring some perp tokens from the user. + transfer(address(this), perpFeeAmt); // transfers reserve tokens out uint8 tokensOutCount = uint8(tokensOut.length); @@ -437,8 +452,8 @@ contract PerpetualTranche is revert UnacceptableRollover(); } - // Calculates the fee adjusted amount of tranches exchanged during a rolled over - // NOTE: This operation should precede any token transfers. + // Calculates the amount of tranches exchanged during a rolled over + // NOTE: This calculation should precede any token transfers. RolloverData memory r = _computeRolloverAmt(trancheIn, tokenOut, trancheInAmtAvailable); // Verifies if rollover amount is acceptable @@ -455,6 +470,45 @@ contract PerpetualTranche is return r; } + /// @inheritdoc IPerpetualTranche + /// @dev Only the whitelisted vault can call this function. + function claimFees(address to) external override onlyVault nonReentrant whenNotPaused { + IERC20Upgradeable perp_ = IERC20Upgradeable(address(this)); + uint256 collectedBal = perp_.balanceOf(address(perp_)); + if (collectedBal > 0) { + perp_.safeTransfer(to, collectedBal); + } + } + + /// @inheritdoc IPerpetualTranche + /// @dev Only the whitelisted vault can call this function. + function payProtocolFee( + address collector, + uint256 protocolSharePerc + ) external override onlyVault nonReentrant whenNotPaused { + if (protocolSharePerc > 0) { + _mint(collector, protocolSharePerc.mulDiv(totalSupply(), ONE - protocolSharePerc)); + } + } + + /// @inheritdoc IPerpetualTranche + /// @dev Only the whitelisted vault can call this function. + /// The logic controlling the frequency and magnitude of debasement should be vetted. + function rebalanceToVault( + uint256 underlyingAmtToTransfer + ) external override onlyVault afterStateUpdate nonReentrant whenNotPaused { + // When value is flowing out of perp to the vault, + // we mint the vault perp tokens. + if (underlyingAmtToTransfer > 0) { + uint256 perpAmtToVault = underlyingAmtToTransfer.mulDiv( + totalSupply(), + _reserveValue() - underlyingAmtToTransfer, + MathUpgradeable.Rounding.Up + ); + _mint(address(vault), perpAmtToVault); + } + } + /// @inheritdoc IPerpetualTranche function getDepositBond() external override afterStateUpdate returns (IBondController) { return _depositBond; @@ -564,14 +618,14 @@ contract PerpetualTranche is if (!_isDepositTranche(trancheIn)) { revert UnexpectedAsset(); } - return _computeMintAmt(trancheIn, trancheInAmt); + (uint256 perpAmtMint, ) = _computeMintAmt(trancheIn, trancheInAmt); + return perpAmtMint; } /// @inheritdoc IPerpetualTranche - function computeRedemptionAmts( - uint256 perpAmtBurnt - ) external override afterStateUpdate returns (TokenAmount[] memory) { - return _computeRedemptionAmts(perpAmtBurnt); + function computeRedemptionAmts(uint256 perpAmt) external override afterStateUpdate returns (TokenAmount[] memory) { + (TokenAmount[] memory tokensOut, ) = _computeRedemptionAmts(perpAmt); + return tokensOut; } /// @inheritdoc IPerpetualTranche @@ -588,14 +642,7 @@ contract PerpetualTranche is /// @inheritdoc IPerpetualTranche function deviationRatio() external override afterStateUpdate nonReentrant returns (uint256) { - return - feePolicy.computeDeviationRatio( - SubscriptionParams({ - perpTVL: _reserveValue(), - vaultTVL: vault.getTVL(), - seniorTR: _depositBond.getSeniorTrancheRatio() - }) - ); + return feePolicy.computeDeviationRatio(_querySystemTVL()); } //-------------------------------------------------------------------------- @@ -724,7 +771,10 @@ contract PerpetualTranche is } /// @dev Computes the fee adjusted perp mint amount for given amount of tranche tokens deposited into the reserve. - function _computeMintAmt(ITranche trancheIn, uint256 trancheInAmt) private view returns (uint256) { + function _computeMintAmt( + ITranche trancheIn, + uint256 trancheInAmt + ) private view returns (uint256 perpAmtMint, uint256 perpFeeAmt) { uint256 valueIn = _computeReserveTrancheValue( trancheIn, _depositBond, @@ -735,72 +785,74 @@ contract PerpetualTranche is //----------------------------------------------------------------------------- // We charge no mint fee when interacting with other callers within the system. - uint256 feePerc = _isProtocolCaller() ? 0 : feePolicy.computePerpMintFeePerc(); + SystemTVL memory s = _querySystemTVL(); + uint256 feePerc = _isProtocolCaller() + ? 0 + : feePolicy.computeFeePerc( + feePolicy.computeDeviationRatio(s), + feePolicy.computeDeviationRatio(SystemTVL({ perpTVL: s.perpTVL + valueIn, vaultTVL: s.vaultTVL })) + ); //----------------------------------------------------------------------------- // Compute mint amt uint256 perpSupply = totalSupply(); - uint256 perpAmtMint = valueIn; + perpAmtMint = valueIn; if (perpSupply > 0) { perpAmtMint = perpAmtMint.mulDiv(perpSupply, _reserveValue()); } - // The mint fees are settled by simply minting fewer perps. + // Compute the fee amount if (feePerc > 0) { - perpAmtMint = perpAmtMint.mulDiv(ONE - feePerc, ONE); + perpFeeAmt = perpAmtMint.mulDiv(feePerc, ONE, MathUpgradeable.Rounding.Up); + perpAmtMint -= perpFeeAmt; } - - return perpAmtMint; } /// @dev Computes the reserve token amounts redeemed when a given number of perps are burnt. - function _computeRedemptionAmts(uint256 perpAmtBurnt) private view returns (TokenAmount[] memory) { + function _computeRedemptionAmts( + uint256 perpAmt + ) private view returns (TokenAmount[] memory reserveTokens, uint256 perpFeeAmt) { uint256 perpSupply = totalSupply(); //----------------------------------------------------------------------------- // We charge no burn fee when interacting with other parts of the system. - uint256 feePerc = _isProtocolCaller() ? 0 : feePolicy.computePerpBurnFeePerc(); + SystemTVL memory s = _querySystemTVL(); + uint256 feePerc = _isProtocolCaller() + ? 0 + : feePolicy.computeFeePerc( + feePolicy.computeDeviationRatio(s), + feePolicy.computeDeviationRatio( + SystemTVL({ perpTVL: s.perpTVL.mulDiv(perpSupply - perpAmt, perpSupply), vaultTVL: s.vaultTVL }) + ) + ); //----------------------------------------------------------------------------- + // Compute the fee amount + if (feePerc > 0) { + perpFeeAmt = perpAmt.mulDiv(feePerc, ONE, MathUpgradeable.Rounding.Up); + perpAmt -= perpFeeAmt; + } + // Compute redemption amounts uint8 reserveCount = uint8(_reserves.length()); - TokenAmount[] memory reserveTokens = new TokenAmount[](reserveCount); + reserveTokens = new TokenAmount[](reserveCount); for (uint8 i = 0; i < reserveCount; ++i) { IERC20Upgradeable tokenOut = _reserveAt(i); reserveTokens[i] = TokenAmount({ token: tokenOut, - amount: tokenOut.balanceOf(address(this)).mulDiv(perpAmtBurnt, perpSupply) + amount: tokenOut.balanceOf(address(this)).mulDiv(perpAmt, perpSupply) }); - - // The burn fees are settled by simply redeeming for fewer tranches. - if (feePerc > 0) { - reserveTokens[i].amount = reserveTokens[i].amount.mulDiv(ONE - feePerc, ONE); - } } - return (reserveTokens); + return (reserveTokens, perpFeeAmt); } /// @dev Computes the amount of reserve tokens that can be rolled out for the given amount of tranches deposited. - /// The relative ratios of tokens In/Out are adjusted based on the current rollover fee perc. function _computeRolloverAmt( ITranche trancheIn, IERC20Upgradeable tokenOut, uint256 trancheInAmtAvailable - ) private view returns (RolloverData memory) { - //----------------------------------------------------------------------------- - // The rollover fees are settled by, adjusting the exchange rate - // between `trancheInAmt` and `tokenOutAmt`. - // - int256 feePerc = feePolicy.computePerpRolloverFeePerc( - feePolicy.computeDeviationRatio( - SubscriptionParams({ - perpTVL: _reserveValue(), - vaultTVL: vault.getTVL(), - seniorTR: _depositBond.getSeniorTrancheRatio() - }) - ) - ); + ) private view returns (RolloverData memory r) { //----------------------------------------------------------------------------- // We compute "price" as the value of a unit token. @@ -829,54 +881,27 @@ contract PerpetualTranche is uint256 tokenOutBalance = tokenOut.balanceOf(address(this)); if (trancheInAmtAvailable <= 0 || tokenOutBalance <= 0 || trancheInPrice <= 0 || tokenOutPrice <= 0) { - return RolloverData({ trancheInAmt: 0, tokenOutAmt: 0 }); + return r; } + //----------------------------------------------------------------------------- - // Basic rollover with fees: - // (1 +/- f) . (trancheInAmt . trancheInPrice) = (tokenOutAmt . tokenOutPrice) + // Basic rollover: + // (trancheInAmt . trancheInPrice) = (tokenOutAmt . tokenOutPrice) //----------------------------------------------------------------------------- // Using perp's tokenOutBalance, we calculate the amount of tokens in to rollover // the entire balance. - - RolloverData memory r = RolloverData({ - tokenOutAmt: tokenOutBalance, - trancheInAmt: tokenOutBalance.mulDiv(tokenOutPrice, trancheInPrice, MathUpgradeable.Rounding.Up) - }); - - // A positive fee percentage implies that perp charges rotators by - // offering tranchesOut for a premium, i.e) more tranches in. - if (feePerc > 0) { - r.trancheInAmt = r.trancheInAmt.mulDiv(ONE, ONE - feePerc.toUint256(), MathUpgradeable.Rounding.Up); - } - // A negative fee percentage (or a reward) implies that perp pays the rotators by - // offering tranchesOut at a discount, i.e) fewer tranches in. - else if (feePerc < 0) { - r.trancheInAmt = r.trancheInAmt.mulDiv(ONE, ONE + feePerc.abs(), MathUpgradeable.Rounding.Up); - } + r.tokenOutAmt = tokenOutBalance; + r.trancheInAmt = tokenOutBalance.mulDiv(tokenOutPrice, trancheInPrice, MathUpgradeable.Rounding.Up); //----------------------------------------------------------------------------- // When the trancheInAmt exceeds trancheInAmtAvailable: // we fix trancheInAmt = trancheInAmtAvailable and re-calculate tokenOutAmt - if (r.trancheInAmt > trancheInAmtAvailable) { // Given the amount of tranches In, we compute the amount of tokens out r.trancheInAmt = trancheInAmtAvailable; r.tokenOutAmt = trancheInAmtAvailable.mulDiv(trancheInPrice, tokenOutPrice); - - // A positive fee percentage implies that perp charges rotators by - // accepting tranchesIn at a discount, i.e) fewer tokens out. - // This results in perp enrichment. - if (feePerc > 0) { - r.tokenOutAmt = r.tokenOutAmt.mulDiv(ONE - feePerc.abs(), ONE); - } - // A negative fee percentage (or a reward) implies that perp pays the rotators by - // accepting tranchesIn at a premium, i.e) more tokens out. - // This results in perp debasement. - else if (feePerc < 0) { - r.tokenOutAmt = r.tokenOutAmt.mulDiv(ONE + feePerc.abs(), ONE); - } } return r; @@ -1020,6 +1045,11 @@ contract PerpetualTranche is return (trancheSupply > 0) ? trancheClaim.mulDiv(trancheAmt, trancheSupply, rounding) : trancheAmt; } + /// @dev Queries the current TVL of the perp and vault systems. + function _querySystemTVL() private view returns (SystemTVL memory) { + return SystemTVL({ perpTVL: _reserveValue(), vaultTVL: vault.getTVL() }); + } + /// @dev Checks if the given token is the underlying collateral token. function _isUnderlying(IERC20Upgradeable token) private view returns (bool) { return (token == _reserveAt(0)); diff --git a/spot-contracts/contracts/RolloverVault.sol b/spot-contracts/contracts/RolloverVault.sol index c17c8478..96c9d3fe 100644 --- a/spot-contracts/contracts/RolloverVault.sol +++ b/spot-contracts/contracts/RolloverVault.sol @@ -5,13 +5,15 @@ import { IERC20Upgradeable, IPerpetualTranche, IBondController, ITranche, IFeePo import { IVault } from "./_interfaces/IVault.sol"; import { IRolloverVault } from "./_interfaces/IRolloverVault.sol"; import { IERC20Burnable } from "./_interfaces/IERC20Burnable.sol"; -import { TokenAmount, RolloverData, SubscriptionParams } from "./_interfaces/CommonTypes.sol"; -import { UnauthorizedCall, UnauthorizedTransferOut, UnexpectedDecimals, UnexpectedAsset, OutOfBounds, UnacceptableSwap, InsufficientDeployment, DeployedCountOverLimit, InsufficientLiquidity } from "./_interfaces/ProtocolErrors.sol"; +import { TokenAmount, RolloverData, SystemTVL } from "./_interfaces/CommonTypes.sol"; +import { UnauthorizedCall, UnauthorizedTransferOut, UnexpectedDecimals, UnexpectedAsset, OutOfBounds, UnacceptableSwap, InsufficientDeployment, DeployedCountOverLimit, InsufficientLiquidity, LastRebalanceTooRecent } from "./_interfaces/ProtocolErrors.sol"; import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import { PausableUpgradeable } from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import { MathUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol"; +import { SafeCastUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol"; +import { SignedMathUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol"; import { ERC20BurnableUpgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol"; import { EnumerableSetUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol"; import { SafeERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; @@ -19,12 +21,17 @@ import { BondTranches, BondTranchesHelpers } from "./_utils/BondTranchesHelpers. import { TrancheHelpers } from "./_utils/TrancheHelpers.sol"; import { BondHelpers } from "./_utils/BondHelpers.sol"; import { PerpHelpers } from "./_utils/PerpHelpers.sol"; +import { ERC20Helpers } from "./_utils/ERC20Helpers.sol"; +import { TrancheManager } from "./_utils/TrancheManager.sol"; /* * @title RolloverVault * - * @notice A vault which generates yield (from fees) by performing rollovers on PerpetualTranche (or perp). + * @notice A vault which performs rollovers on PerpetualTranche (or perp). After rolling over, + * it holds the junior tranches to maturity, effectively becoming a perpetual junior tranche. + * * The vault takes in AMPL or any other rebasing collateral as the "underlying" asset. + * It also generates a yield (from entry/exit fees, flash swap liquidity, and rebalancing incentives). * * Vault strategy: * 1) deploy: The vault deposits the underlying asset into perp's current deposit bond @@ -33,9 +40,14 @@ import { PerpHelpers } from "./_utils/PerpHelpers.sol"; * 2) recover: The vault redeems the tranches it holds for the underlying asset. * NOTE: It performs both mature and immature redemption. Read more: https://bit.ly/3tuN6OC * - * With v2.0, vault provides perp<>underlying swap liquidity and charges a fee. + * The vault provides perp<>underlying swap liquidity and charges a fee. * The swap fees are an additional source of yield for vault note holders. * + * The vault has a "rebalance" operation (which can be executed at most once a day). + * This is intended to balance demand for holding perp tokens with + * the demand for holding vault notes, such that the vault is always sufficiently capitalized. + * + * * @dev When new tranches are added into the system, always double check if they are not malicious * by only accepting one whitelisted by perp (ones part of perp's deposit bond or ones part of the perp reserve). * @@ -59,9 +71,16 @@ contract RolloverVault is // ERC20 operations using SafeERC20Upgradeable for IERC20Upgradeable; + using SafeERC20Upgradeable for ITranche; + using ERC20Helpers for IERC20Upgradeable; // math using MathUpgradeable for uint256; + using SignedMathUpgradeable for int256; + using SafeCastUpgradeable for int256; + + /// Allow linking TrancheManager + /// @custom:oz-upgrades-unsafe-allow external-library-linking //------------------------------------------------------------------------- // Events @@ -84,15 +103,12 @@ contract RolloverVault is /// @dev The maximum number of deployed assets that can be held in this vault at any given time. uint8 public constant MAX_DEPLOYED_COUNT = 47; - // Replicating value used here: - // https://github.com/buttonwood-protocol/tranche/blob/main/contracts/BondController.sol - uint256 private constant TRANCHE_RATIO_GRANULARITY = 1000; - /// @dev Immature redemption may result in some dust tranches when balances are not perfectly divisible by the tranche ratio. /// Based on current the implementation of `computeRedeemableTrancheAmounts`, /// the dust balances which remain after immature redemption will be *at most* {TRANCHE_RATIO_GRANULARITY} or 1000. /// We exclude the vault's dust tranche balances from TVL computation, note redemption and /// during recovery (through recurrent immature redemption). + /// https://github.com/buttonwood-protocol/tranche/blob/main/contracts/BondController.sol uint256 public constant TRANCHE_DUST_AMT = 10000000; //-------------------------------------------------------------------------- @@ -102,7 +118,6 @@ contract RolloverVault is // => { [underlying] U _deployed } // // - /// @notice The ERC20 token that can be deposited into this vault. IERC20Upgradeable public underlying; @@ -111,7 +126,7 @@ contract RolloverVault is EnumerableSetUpgradeable.AddressSet private _deployed; //------------------------------------------------------------------------- - // Storage + // Parameters /// @notice Minimum amount of underlying assets that must be deployed, for a deploy operation to succeed. /// @dev The deployment transaction reverts, if the vaults does not have sufficient underlying tokens @@ -143,13 +158,15 @@ contract RolloverVault is /// @custom:oz-upgrades-renamed-from minUnderlyingBal uint256 public reservedUnderlyingBal; - /// @notice The percentage of the vault's "neutrally" subscribed TVL, reserved. - /// @dev A neutral subscription state implies the vault's TVL is exactly enough to - /// rollover over the entire supply of perp tokens. - /// NOTE: A neutral subscription ratio of 1.0 is distinct from a deviation ratio (dr) of 1.0. - /// For more details, refer to the fee policy documentation. - /// @custom:oz-upgrades-renamed-from minUnderlyingPerc - uint256 public reservedSubscriptionPerc; + /// @notice The amount of underlying tokens as percentage of the vault's TVL, reserved. + /// @custom:oz-upgrades-renamed-from reservedSubscriptionPerc + uint256 public reservedUnderlyingPerc; + + //-------------------------------------------------------------------------- + // v3.0.0 STORAGE ADDITION + + /// @notice Recorded timestamp of the last successful rebalance. + uint256 public lastRebalanceTimestampSec; //-------------------------------------------------------------------------- // Modifiers @@ -203,7 +220,8 @@ contract RolloverVault is // setting initial parameter values minDeploymentAmt = 0; reservedUnderlyingBal = 0; - reservedSubscriptionPerc = 0; + reservedUnderlyingPerc = 0; + lastRebalanceTimestampSec = block.timestamp; // sync underlying _syncAsset(underlying); @@ -253,27 +271,42 @@ contract RolloverVault is _unpause(); } - /// @notice Updates the minimum deployment amount requirement. - /// @param minDeploymentAmt_ The new minimum deployment amount, denominated in underlying tokens. - function updateMinDeploymentAmt(uint256 minDeploymentAmt_) external onlyKeeper { - minDeploymentAmt = minDeploymentAmt_; + /// @notice Pauses the rebalance operation. + function pauseRebalance() external onlyKeeper { + lastRebalanceTimestampSec = type(uint64).max; } - /// @notice Updates absolute reserved underlying balance. - /// @param reservedUnderlyingBal_ The new reserved underlying balance. - function updateReservedUnderlyingBal(uint256 reservedUnderlyingBal_) external onlyKeeper { - reservedUnderlyingBal = reservedUnderlyingBal_; + /// @notice Unpauses the rebalance operation. + function unpauseRebalance() external onlyKeeper { + lastRebalanceTimestampSec = block.timestamp; } - /// @notice Updates the reserved subscription percentage. - /// @param reservedSubscriptionPerc_ The new reserved subscription percentage. - function updateReservedSubscriptionPerc(uint256 reservedSubscriptionPerc_) external onlyKeeper { - reservedSubscriptionPerc = reservedSubscriptionPerc_; + /// @notice Updates the vault's minimum liquidity requirements. + /// @param minDeploymentAmt_ The new minimum deployment amount, denominated in underlying tokens. + /// @param reservedUnderlyingBal_ The new reserved underlying balance. + /// @param reservedUnderlyingPerc_ The new reserved subscription percentage. + function updateLiquidityLimits( + uint256 minDeploymentAmt_, + uint256 reservedUnderlyingBal_, + uint256 reservedUnderlyingPerc_ + ) external onlyKeeper { + minDeploymentAmt = minDeploymentAmt_; + reservedUnderlyingBal = reservedUnderlyingBal_; + reservedUnderlyingPerc = reservedUnderlyingPerc_; } //-------------------------------------------------------------------------- // External & Public write methods + /// @inheritdoc IRolloverVault + function rebalance() external override nonReentrant whenNotPaused { + if (block.timestamp <= lastRebalanceTimestampSec + feePolicy.rebalanceFreqSec()) { + revert LastRebalanceTooRecent(); + } + _rebalance(perp, underlying); + lastRebalanceTimestampSec = block.timestamp; + } + /// @inheritdoc IVault /// @dev Simply batches the `recover` and `deploy` functions. Reverts if there are no funds to deploy. function recoverAndRedeploy() external override { @@ -291,7 +324,7 @@ contract RolloverVault is // We calculate the usable underlying balance. uint256 underlyingBal = underlying_.balanceOf(address(this)); - uint256 reservedBal = _totalReservedBalance(perp_.getTVL(), perp_.getDepositTrancheRatio()); + uint256 reservedBal = _totalReservedBalance(getTVL()); uint256 usableBal = (underlyingBal > reservedBal) ? underlyingBal - reservedBal : 0; // We ensure that at-least `minDeploymentAmt` amount of underlying tokens are deployed @@ -316,11 +349,6 @@ contract RolloverVault is function recover() public override nonReentrant whenNotPaused { // Redeem deployed tranches uint8 deployedCount_ = uint8(_deployed.length()); - if (deployedCount_ <= 0) { - return; - } - - // execute redemption on each deployed asset for (uint8 i = 0; i < deployedCount_; ++i) { ITranche tranche = ITranche(_deployed.at(i)); uint256 trancheBalance = tranche.balanceOf(address(this)); @@ -338,7 +366,7 @@ contract RolloverVault is // if bond has matured, redeem the tranche token if (bond.secondsToMaturity() <= 0) { // execute redemption - _execMatureTrancheRedemption(bond, tranche, trancheBalance); + TrancheManager.execMatureTrancheRedemption(bond, tranche, trancheBalance); } // if not redeem using proportional balances // redeems this tranche and it's siblings if the vault holds balances. @@ -347,7 +375,7 @@ contract RolloverVault is // We also skip if the tranche balance is too low as immature redemption will be a no-op. else if (tranche == bt.tranches[0] && trancheBalance > TRANCHE_DUST_AMT) { // execute redemption - _execImmatureTrancheRedemption(bond, bt); + TrancheManager.execImmatureTrancheRedemption(bond, bt); } } @@ -373,49 +401,160 @@ contract RolloverVault is IPerpetualTranche perp_ = perp; if (address(token) == address(perp_)) { - // In case the vault holds perp tokens after swaps or if transferred in erroneously, - // anyone can execute this function to recover perps into tranches. - // This is not part of the regular recovery flow. _meldPerps(perp_); _syncAsset(perp_); _syncAsset(underlying); return; } + revert UnexpectedAsset(); } + /// @inheritdoc IRolloverVault + /// @dev This operation pushes the system back into balance, we thus charge no fees. + function mint2( + uint256 underlyingAmtIn + ) external override nonReentrant whenNotPaused returns (uint256 perpAmt, uint256 vaultNoteAmt) { + IPerpetualTranche perp_ = perp; + IERC20Upgradeable underlying_ = underlying; + + // Compute perp vault asset split. + SystemTVL memory s = _querySystemTVL(perp_); + uint256 underlyingAmtIntoPerp = underlyingAmtIn.mulDiv(ONE, ONE + feePolicy.targetSystemRatio()); + uint256 underlyingAmtIntoVault = underlyingAmtIn - underlyingAmtIntoPerp; + + // Compute perp amount and vault note amount to mint + perpAmt = underlyingAmtIntoPerp.mulDiv(perp_.totalSupply(), s.perpTVL); + vaultNoteAmt = computeMintAmt(underlyingAmtIntoVault, 0); + + // Transfer underlying tokens from user + underlying_.safeTransferFrom(msg.sender, address(this), underlyingAmtIn); + + // Mint perps to user + _trancheAndMintPerps(perp_, underlying_, s.perpTVL, perp_.getDepositTrancheRatio(), perpAmt); + IERC20Upgradeable(address(perp_)).safeTransfer(msg.sender, perpAmt); + + // Mint vault notes to user + _mint(msg.sender, vaultNoteAmt); + + // Sync underlying + _syncAsset(underlying_); + } + + /// @inheritdoc IRolloverVault + /// @dev This operation maintains the system's balance, we thus charge no fees. + function redeem2( + uint256 perpAmtAvailable, + uint256 vaultNoteAmtAvailable + ) + external + override + nonReentrant + whenNotPaused + returns (uint256 perpAmt, uint256 vaultNoteAmt, TokenAmount[] memory returnedTokens) + { + IPerpetualTranche perp_ = perp; + + // Compute perp vault split + { + uint256 perpSupply = perp_.totalSupply(); + uint256 vaultNoteSupply = totalSupply(); + perpAmt = perpAmtAvailable; + vaultNoteAmt = vaultNoteSupply.mulDiv(perpAmtAvailable, perpSupply); + if (vaultNoteAmt > vaultNoteAmtAvailable) { + vaultNoteAmt = vaultNoteAmtAvailable; + perpAmt = perpSupply.mulDiv(vaultNoteAmtAvailable, vaultNoteSupply); + } + } + + // Redeem vault notes + TokenAmount[] memory vaultTokens = computeRedemptionAmts(vaultNoteAmt, 0); + _burn(msg.sender, vaultNoteAmt); + + // Transfer perps from user and redeem + IERC20Upgradeable(address(perp_)).safeTransferFrom(msg.sender, address(this), perpAmt); + TokenAmount[] memory perpTokens = perp.redeem(perpAmt); + + // Compute final list of tokens to return to the user + // assert(underlying == perpTokens[0].token && underlying == vaultTokens[0].token); + returnedTokens = new TokenAmount[](perpTokens.length + vaultTokens.length - 1); + returnedTokens[0] = TokenAmount({ + token: perpTokens[0].token, + amount: (perpTokens[0].amount + vaultTokens[0].amount) + }); + returnedTokens[0].token.safeTransfer(msg.sender, returnedTokens[0].amount); + + // perp tokens + for (uint8 i = 1; i < uint8(perpTokens.length); i++) { + returnedTokens[i] = perpTokens[i]; + perpTokens[i].token.safeTransfer(msg.sender, returnedTokens[i].amount); + } + + // vault tokens + for (uint8 i = 1; i < uint8(vaultTokens.length); i++) { + returnedTokens[i - 1 + perpTokens.length] = vaultTokens[i]; + vaultTokens[i].token.safeTransfer(msg.sender, vaultTokens[i].amount); + + // sync balances + _syncDeployedAsset(vaultTokens[i].token); + } + + // sync underlying + _syncAsset(returnedTokens[0].token); + } + /// @inheritdoc IVault function deposit(uint256 underlyingAmtIn) external override nonReentrant whenNotPaused returns (uint256) { - // Calculates the fee adjusted amount of notes minted when depositing `underlyingAmtIn` of underlying tokens. + // Compute the mint fees + SystemTVL memory s = _querySystemTVL(perp); + uint256 feePerc = feePolicy.computeFeePerc( + feePolicy.computeDeviationRatio(s), + feePolicy.computeDeviationRatio(SystemTVL({ perpTVL: s.perpTVL, vaultTVL: s.vaultTVL + underlyingAmtIn })) + ); + + // Calculates the fee adjusted amount of vault notes minted when depositing `underlyingAmtIn` of underlying tokens. // NOTE: This operation should precede any token transfers. - uint256 notes = computeMintAmt(underlyingAmtIn); - if (underlyingAmtIn <= 0 || notes <= 0) { + uint256 vaultNoteAmt = computeMintAmt(underlyingAmtIn, feePerc); + if (underlyingAmtIn <= 0 || vaultNoteAmt <= 0) { return 0; } // transfer user assets in underlying.safeTransferFrom(msg.sender, address(this), underlyingAmtIn); - // mint notes - _mint(msg.sender, notes); + // mint vault notes + _mint(msg.sender, vaultNoteAmt); // sync underlying _syncAsset(underlying); - return notes; + return vaultNoteAmt; } /// @inheritdoc IVault - function redeem(uint256 notes) public override nonReentrant whenNotPaused returns (TokenAmount[] memory) { - if (notes <= 0) { + function redeem(uint256 vaultNoteAmt) public override nonReentrant whenNotPaused returns (TokenAmount[] memory) { + if (vaultNoteAmt <= 0) { return new TokenAmount[](0); } + // Compute the redemption fees + SystemTVL memory s = _querySystemTVL(perp); + uint256 vaultNoteSupply = totalSupply(); + uint256 feePerc = feePolicy.computeFeePerc( + feePolicy.computeDeviationRatio(s), + feePolicy.computeDeviationRatio( + SystemTVL({ + perpTVL: s.perpTVL, + vaultTVL: s.vaultTVL.mulDiv(vaultNoteSupply - vaultNoteAmt, vaultNoteSupply) + }) + ) + ); + // Calculates the fee adjusted share of vault tokens to be redeemed // NOTE: This operation should precede any token transfers. - TokenAmount[] memory redemptions = computeRedemptionAmts(notes); + TokenAmount[] memory redemptions = computeRedemptionAmts(vaultNoteAmt, feePerc); - // burn notes - _burn(msg.sender, notes); + // burn vault notes + _burn(msg.sender, vaultNoteAmt); // transfer assets out uint8 redemptionsCount = uint8(redemptions.length); @@ -437,12 +576,6 @@ contract RolloverVault is return redemptions; } - /// @inheritdoc IVault - function recoverAndRedeem(uint256 notes) external override returns (TokenAmount[] memory) { - recover(); - return redeem(notes); - } - /// @inheritdoc IRolloverVault /// @dev Callers should call `recover` before executing `swapUnderlyingForPerps` to maximize vault liquidity. function swapUnderlyingForPerps(uint256 underlyingAmtIn) external nonReentrant whenNotPaused returns (uint256) { @@ -451,9 +584,7 @@ contract RolloverVault is IPerpetualTranche perp_ = perp; IERC20Upgradeable underlying_ = underlying; uint256 underlyingBalPre = underlying_.balanceOf(address(this)); - (uint256 perpAmtOut, uint256 perpFeeAmtToBurn, SubscriptionParams memory s) = computeUnderlyingToPerpSwapAmt( - underlyingAmtIn - ); + (uint256 perpAmtOut, , SystemTVL memory s) = computeUnderlyingToPerpSwapAmt(underlyingAmtIn); // Revert if insufficient tokens are swapped in or out if (perpAmtOut <= 0 || underlyingAmtIn <= 0) { @@ -464,12 +595,7 @@ contract RolloverVault is underlying_.safeTransferFrom(msg.sender, address(this), underlyingAmtIn); // tranche and mint perps as needed - _trancheAndMintPerps(perp_, underlying_, s.perpTVL, s.seniorTR, perpAmtOut + perpFeeAmtToBurn); - - // Pay perp's fee share by burning some of the minted perps - if (perpFeeAmtToBurn > 0) { - IERC20Burnable(address(perp_)).burn(perpFeeAmtToBurn); - } + _trancheAndMintPerps(perp_, underlying_, s.perpTVL, perp_.getDepositTrancheRatio(), perpAmtOut); // transfer remaining perps out to the user IERC20Upgradeable(address(perp_)).safeTransfer(msg.sender, perpAmtOut); @@ -480,10 +606,7 @@ contract RolloverVault is // We ensure that the vault's underlying token liquidity // remains above the reserved level after swap. uint256 underlyingBalPost = underlying_.balanceOf(address(this)); - if ( - (underlyingBalPost < underlyingBalPre) && - (underlyingBalPost <= _totalReservedBalance((s.perpTVL + underlyingAmtIn), s.seniorTR)) - ) { + if ((underlyingBalPost < underlyingBalPre) && (underlyingBalPost <= _totalReservedBalance(s.vaultTVL))) { revert InsufficientLiquidity(); } @@ -499,7 +622,7 @@ contract RolloverVault is IPerpetualTranche perp_ = perp; IERC20Upgradeable underlying_ = underlying; uint256 underlyingBalPre = underlying_.balanceOf(address(this)); - (uint256 underlyingAmtOut, uint256 perpFeeAmtToBurn, ) = computePerpToUnderlyingSwapAmt(perpAmtIn); + (uint256 underlyingAmtOut, , ) = computePerpToUnderlyingSwapAmt(perpAmtIn); // Revert if insufficient tokens are swapped in or out if (underlyingAmtOut <= 0 || perpAmtIn <= 0) { @@ -509,11 +632,6 @@ contract RolloverVault is // transfer perps in IERC20Upgradeable(perp_).safeTransferFrom(msg.sender, address(this), perpAmtIn); - // Pay perp's fee share by burning some of the transferred perps - if (perpFeeAmtToBurn > 0) { - IERC20Burnable(address(perp_)).burn(perpFeeAmtToBurn); - } - // Meld incoming perps _meldPerps(perp_); @@ -537,131 +655,116 @@ contract RolloverVault is /// @inheritdoc IRolloverVault function deviationRatio() external override nonReentrant returns (uint256) { - return feePolicy.computeDeviationRatio(_querySubscriptionState(perp)); + return feePolicy.computeDeviationRatio(_querySystemTVL(perp)); } /// @inheritdoc IRolloverVault function computeUnderlyingToPerpSwapAmt( uint256 underlyingAmtIn - ) public returns (uint256, uint256, SubscriptionParams memory) { + ) public returns (uint256, uint256, SystemTVL memory) { IPerpetualTranche perp_ = perp; // Compute equal value perps to swap out to the user - SubscriptionParams memory s = _querySubscriptionState(perp_); + SystemTVL memory s = _querySystemTVL(perp_); uint256 perpAmtOut = underlyingAmtIn.mulDiv(perp_.totalSupply(), s.perpTVL); //----------------------------------------------------------------------------- // When user swaps underlying for vault's perps -> perps are minted by the vault - // We thus compute fees based on the post-mint subscription state. - uint256 perpFeePerc = feePolicy.computePerpMintFeePerc(); - uint256 vaultFeePerc = feePolicy.computeUnderlyingToPerpVaultSwapFeePerc( + // We thus compute fees based on the post-mint system tvl. + uint256 feePerc = feePolicy.computeFeePerc( feePolicy.computeDeviationRatio(s), - feePolicy.computeDeviationRatio( - SubscriptionParams({ perpTVL: s.perpTVL + underlyingAmtIn, vaultTVL: s.vaultTVL, seniorTR: s.seniorTR }) - ) + feePolicy.computeDeviationRatio(SystemTVL({ perpTVL: s.perpTVL + underlyingAmtIn, vaultTVL: s.vaultTVL })) ); //----------------------------------------------------------------------------- - // Calculate perp fee share to be paid by the vault - uint256 perpFeeAmtToBurn = perpAmtOut.mulDiv(perpFeePerc, ONE, MathUpgradeable.Rounding.Up); - // We deduct fees by transferring out fewer perp tokens - perpAmtOut = perpAmtOut.mulDiv(ONE - (perpFeePerc + vaultFeePerc), ONE); + perpAmtOut = perpAmtOut.mulDiv(ONE - feePerc, ONE); - return (perpAmtOut, perpFeeAmtToBurn, s); + return (perpAmtOut, 0, s); } /// @inheritdoc IRolloverVault - function computePerpToUnderlyingSwapAmt( - uint256 perpAmtIn - ) public returns (uint256, uint256, SubscriptionParams memory) { + function computePerpToUnderlyingSwapAmt(uint256 perpAmtIn) public returns (uint256, uint256, SystemTVL memory) { IPerpetualTranche perp_ = perp; // Compute equal value underlying tokens to swap out - SubscriptionParams memory s = _querySubscriptionState(perp_); + SystemTVL memory s = _querySystemTVL(perp_); uint256 underlyingAmtOut = perpAmtIn.mulDiv(s.perpTVL, perp_.totalSupply()); //----------------------------------------------------------------------------- // When user swaps perps for vault's underlying -> perps are redeemed by the vault - // We thus compute fees based on the post-burn subscription state. - uint256 perpFeePerc = feePolicy.computePerpBurnFeePerc(); - uint256 vaultFeePerc = feePolicy.computePerpToUnderlyingVaultSwapFeePerc( + // We thus compute fees based on the post-burn system tvl. + uint256 feePerc = feePolicy.computeFeePerc( feePolicy.computeDeviationRatio(s), - feePolicy.computeDeviationRatio( - SubscriptionParams({ - perpTVL: s.perpTVL - underlyingAmtOut, - vaultTVL: s.vaultTVL, - seniorTR: s.seniorTR - }) - ) + feePolicy.computeDeviationRatio(SystemTVL({ perpTVL: s.perpTVL - underlyingAmtOut, vaultTVL: s.vaultTVL })) ); //----------------------------------------------------------------------------- - // Calculate perp fee share to be paid by the vault - uint256 perpFeeAmtToBurn = perpAmtIn.mulDiv(perpFeePerc, ONE, MathUpgradeable.Rounding.Up); - // We deduct fees by transferring out fewer underlying tokens - underlyingAmtOut = underlyingAmtOut.mulDiv(ONE - (perpFeePerc + vaultFeePerc), ONE); + underlyingAmtOut = underlyingAmtOut.mulDiv(ONE - feePerc, ONE); - return (underlyingAmtOut, perpFeeAmtToBurn, s); + return (underlyingAmtOut, 0, s); } //-------------------------------------------------------------------------- // External & Public read methods - /// @inheritdoc IVault - function computeMintAmt(uint256 underlyingAmtIn) public view returns (uint256) { - //----------------------------------------------------------------------------- - uint256 feePerc = feePolicy.computeVaultMintFeePerc(); - //----------------------------------------------------------------------------- + /// @notice Computes the amount of vault notes minted when given amount of underlying asset tokens + /// are deposited into the system. + /// @param underlyingAmtIn The amount underlying tokens to be deposited into the vault. + /// @param feePerc The percentage of minted vault notes paid as fees. + /// @return vaultNoteAmtMint The amount of vault notes to be minted. + function computeMintAmt(uint256 underlyingAmtIn, uint256 feePerc) public view returns (uint256 vaultNoteAmtMint) { + uint256 vaultNoteSupply = totalSupply(); + //----------------------------------------------------------------------------- // Compute mint amt - uint256 noteSupply = totalSupply(); - uint256 notes = (noteSupply > 0) - ? noteSupply.mulDiv(underlyingAmtIn, getTVL()) + vaultNoteAmtMint = (vaultNoteSupply > 0) + ? vaultNoteSupply.mulDiv(underlyingAmtIn, getTVL()) : (underlyingAmtIn * INITIAL_RATE); // The mint fees are settled by simply minting fewer vault notes. - notes = notes.mulDiv(ONE - feePerc, ONE); - return notes; + vaultNoteAmtMint = vaultNoteAmtMint.mulDiv(ONE - feePerc, ONE); } - /// @inheritdoc IVault - function computeRedemptionAmts(uint256 noteAmtBurnt) public view returns (TokenAmount[] memory) { - uint256 noteSupply = totalSupply(); + /// @notice Computes the amount of asset tokens returned for redeeming vault notes. + /// @param vaultNoteAmtRedeemed The amount of vault notes to be redeemed. + /// @param feePerc The percentage of redeemed vault notes paid as fees. + /// @return returnedTokens The list of asset tokens and amounts returned. + function computeRedemptionAmts( + uint256 vaultNoteAmtRedeemed, + uint256 feePerc + ) public view returns (TokenAmount[] memory returnedTokens) { + uint256 vaultNoteSupply = totalSupply(); - //----------------------------------------------------------------------------- - uint256 feePerc = feePolicy.computeVaultBurnFeePerc(); //----------------------------------------------------------------------------- uint8 assetCount_ = 1 + uint8(_deployed.length()); // aggregating vault assets to be redeemed - TokenAmount[] memory redemptions = new TokenAmount[](assetCount_); + returnedTokens = new TokenAmount[](assetCount_); // underlying share to be redeemed IERC20Upgradeable underlying_ = underlying; - redemptions[0] = TokenAmount({ + returnedTokens[0] = TokenAmount({ token: underlying_, - amount: underlying_.balanceOf(address(this)).mulDiv(noteAmtBurnt, noteSupply) + amount: underlying_.balanceOf(address(this)).mulDiv(vaultNoteAmtRedeemed, vaultNoteSupply) }); - redemptions[0].amount = redemptions[0].amount.mulDiv(ONE - feePerc, ONE); + returnedTokens[0].amount = returnedTokens[0].amount.mulDiv(ONE - feePerc, ONE); for (uint8 i = 1; i < assetCount_; ++i) { // tranche token share to be redeemed IERC20Upgradeable token = IERC20Upgradeable(_deployed.at(i - 1)); - redemptions[i] = TokenAmount({ + returnedTokens[i] = TokenAmount({ token: token, - amount: token.balanceOf(address(this)).mulDiv(noteAmtBurnt, noteSupply) + amount: token.balanceOf(address(this)).mulDiv(vaultNoteAmtRedeemed, vaultNoteSupply) }); // deduct redemption fee - redemptions[i].amount = redemptions[i].amount.mulDiv(ONE - feePerc, ONE); + returnedTokens[i].amount = returnedTokens[i].amount.mulDiv(ONE - feePerc, ONE); // in case the redemption amount is just dust, we skip - if (redemptions[i].amount < TRANCHE_DUST_AMT) { - redemptions[i].amount = 0; + if (returnedTokens[i].amount < TRANCHE_DUST_AMT) { + returnedTokens[i].amount = 0; } } - - return redemptions; } /// @inheritdoc IVault @@ -676,7 +779,7 @@ contract RolloverVault is ITranche tranche = ITranche(_deployed.at(i)); uint256 balance = tranche.balanceOf(address(this)); if (balance > TRANCHE_DUST_AMT) { - totalValue += _computeVaultTrancheValue(tranche, underlying, balance); + totalValue += TrancheManager.computeTrancheValue(address(tranche), address(underlying), balance); } } @@ -695,7 +798,10 @@ contract RolloverVault is // Deployed asset else if (_deployed.contains(address(token))) { ITranche tranche = ITranche(address(token)); - return (balance > TRANCHE_DUST_AMT) ? _computeVaultTrancheValue(tranche, underlying, balance) : 0; + return + (balance > TRANCHE_DUST_AMT) + ? TrancheManager.computeTrancheValue(address(tranche), address(underlying), balance) + : 0; } // Not a vault asset, so returning zero @@ -730,6 +836,46 @@ contract RolloverVault is //-------------------------------------------------------------------------- // Private write methods + /// @dev Executes a system-level rebalance. This operation transfers value between + /// the perp reserve and the vault such that the system moves toward balance. + /// Performs some book-keeping to keep track of the vault and perp's assets. + function _rebalance(IPerpetualTranche perp_, IERC20Upgradeable underlying_) private { + // Claim mint/burn fees collected by perp. + perp_.claimFees(address(this)); + _meldPerps(perp_); + + SystemTVL memory s = _querySystemTVL(perp_); + int256 underlyingAmtIntoPerp = feePolicy.computeRebalanceAmount(s); + + // When value is flowing from perp to the vault. + // We rebalance from perp to the vault. + if (underlyingAmtIntoPerp < 0) { + perp_.rebalanceToVault(underlyingAmtIntoPerp.abs()); + _meldPerps(perp_); // Meld residual perps, if any. + } + // When value is flowing from the vault to perp. + // We rebalance from the vault to perp. + else if (underlyingAmtIntoPerp > 0) { + // We transfer value by minting the perp tokens (after making required deposit) + // and then simply burning the newly minted perp tokens. + uint256 perpAmtToTransfer = (underlyingAmtIntoPerp.toUint256()).mulDiv(perp_.totalSupply(), s.perpTVL); + _trancheAndMintPerps(perp_, underlying_, s.perpTVL, perp_.getDepositTrancheRatio(), perpAmtToTransfer); + IERC20Burnable(address(perp_)).burn(perpAmtToTransfer); + } + + // We pay the protocol fee on every rebalance. + uint256 protocolSharePerc = feePolicy.protocolSharePerc(); + if (protocolSharePerc > 0) { + address collector = feePolicy.protocolFeeCollector(); + perp.payProtocolFee(collector, protocolSharePerc); + _mint(collector, protocolSharePerc.mulDiv(totalSupply(), ONE - protocolSharePerc)); + } + + // Sync token balances. + _syncAsset(perp_); + _syncAsset(underlying_); + } + /// @dev Redeems tranche tokens held by the vault, for underlying. /// In the case of immature redemption, this method will recover other sibling tranches as well. /// Performs some book-keeping to keep track of the vault's assets. @@ -749,7 +895,7 @@ contract RolloverVault is // if bond has matured, redeem the tranche token if (bond.secondsToMaturity() <= 0) { // execute redemption - _execMatureTrancheRedemption(bond, tranche, trancheBalance); + TrancheManager.execMatureTrancheRedemption(bond, tranche, trancheBalance); // sync deployed asset _syncDeployedAsset(tranche); @@ -760,7 +906,7 @@ contract RolloverVault is else if (trancheBalance > TRANCHE_DUST_AMT) { // execute redemption BondTranches memory bt = bond.getTranches(); - _execImmatureTrancheRedemption(bond, bt); + TrancheManager.execImmatureTrancheRedemption(bond, bt); // sync deployed asset, i.e) current tranche and its sibling. _syncDeployedAsset(bt.tranches[0]); @@ -792,13 +938,13 @@ contract RolloverVault is } } - /// @dev Tranches the vault's underlying to mint perps.. + /// @dev Tranches the vault's underlying to mint perps. /// Performs some book-keeping to keep track of the vault's assets. function _trancheAndMintPerps( IPerpetualTranche perp_, IERC20Upgradeable underlying_, uint256 perpTVL, - uint256 seniorTR, + uint256 depositTrancheTR, uint256 perpAmtToMint ) private { // Tranche as needed @@ -811,36 +957,20 @@ contract RolloverVault is depositBondCollateralBalance: underlying_.balanceOf(address(depositBond)), depositBondTotalDebt: depositBond.totalDebt(), depositTrancheSupply: trancheIntoPerp.totalSupply(), - depositTrancheTR: seniorTR + depositTrancheTR: depositTrancheTR }), perpAmtToMint ); _tranche(depositBond, underlying_, underylingAmtToTranche); // Mint perps - _checkAndApproveMax(trancheIntoPerp, address(perp_), seniorAmtToDeposit); + IERC20Upgradeable(trancheIntoPerp).checkAndApproveMax(address(perp_), seniorAmtToDeposit); perp_.deposit(trancheIntoPerp, seniorAmtToDeposit); // sync holdings _syncDeployedAsset(trancheIntoPerp); } - /// @dev Given a bond and its tranche data, deposits the provided amount into the bond - /// and receives tranche tokens in return. - /// Performs some book-keeping to keep track of the vault's assets. - function _tranche(IBondController bond, IERC20Upgradeable underlying_, uint256 underlyingAmt) private { - // Get bond tranches - BondTranches memory bt = bond.getTranches(); - - // amount is tranched - _checkAndApproveMax(underlying_, address(bond), underlyingAmt); - bond.deposit(underlyingAmt); - - // sync holdings - _syncDeployedAsset(bt.tranches[0]); - _syncDeployedAsset(bt.tranches[1]); - } - /// @dev Rolls over freshly tranched tokens from the given bond for older tranches (close to maturity) from perp. /// Redeems intermediate tranches for underlying if possible. /// Performs some book-keeping to keep track of the vault's assets. @@ -860,7 +990,7 @@ contract RolloverVault is uint256 trancheInAmtAvailable = trancheIntoPerp.balanceOf(address(this)); // Approve once for all rollovers - _checkAndApproveMax(trancheIntoPerp, address(perp_), trancheInAmtAvailable); + IERC20Upgradeable(trancheIntoPerp).checkAndApproveMax(address(perp_), trancheInAmtAvailable); // We pair the senior tranche token held by the vault (from the deposit bond) // with each of the perp's tokens available for rollovers and execute a rollover. @@ -899,37 +1029,21 @@ contract RolloverVault is return (rollover); } - /// @dev Low level method that redeems the given mature tranche for the underlying asset. - /// It interacts with the button-wood bond contract. - /// This function should NOT be called directly, use `recover()` or `_redeemTranche(tranche)` - /// which wrap this function with the internal book-keeping necessary, - /// to keep track of the vault's assets. - function _execMatureTrancheRedemption(IBondController bond, ITranche tranche, uint256 amount) private { - if (!bond.isMature()) { - bond.mature(); - } - bond.redeemMature(address(tranche), amount); - } - - /// @dev Low level method that redeems the given tranche for the underlying asset, before maturity. - /// If the vault holds sibling tranches with proportional balances, those will also get redeemed. - /// It interacts with the button-wood bond contract. - /// This function should NOT be called directly, use `recover()` or `recover(tranche)` - /// which wrap this function with the internal book-keeping necessary, - /// to keep track of the vault's assets. - function _execImmatureTrancheRedemption(IBondController bond, BondTranches memory bt) private { - uint256[] memory trancheAmts = bt.computeRedeemableTrancheAmounts(address(this)); + /// @dev Given a bond, deposits the provided amount into the bond + /// and receives tranche tokens in return. + /// Performs some book-keeping to keep track of the vault's assets. + function _tranche(IBondController bond, IERC20Upgradeable underlying_, uint256 underlyingAmt) private { + // Tranche + ITranche[2] memory t = bond.approveAndDeposit(underlying_, underlyingAmt); - // NOTE: It is guaranteed that if one tranche amount is zero, all amounts are zeros. - if (trancheAmts[0] > 0) { - bond.redeem(trancheAmts); - } + // sync holdings + _syncDeployedAsset(t[0]); + _syncDeployedAsset(t[1]); } /// @dev Syncs balance and updates the deployed list based on the vault's token balance. function _syncDeployedAsset(IERC20Upgradeable token) private { - uint256 balance = token.balanceOf(address(this)); - emit AssetSynced(token, balance); + uint256 balance = _syncAsset(token); bool inVault = _deployed.contains(address(token)); if (balance > 0 && !inVault) { @@ -945,48 +1059,21 @@ contract RolloverVault is } /// @dev Logs the token balance held by the vault. - function _syncAsset(IERC20Upgradeable token) private { - emit AssetSynced(token, token.balanceOf(address(this))); + function _syncAsset(IERC20Upgradeable token) private returns (uint256 balance) { + balance = token.balanceOf(address(this)); + emit AssetSynced(token, balance); } - /// @dev Checks if the spender has sufficient allowance. If not, approves the maximum possible amount. - function _checkAndApproveMax(IERC20Upgradeable token, address spender, uint256 amount) private { - uint256 allowance = token.allowance(address(this), spender); - if (allowance < amount) { - token.safeApprove(spender, type(uint256).max); - } - } - - /// @dev Queries the current subscription state of the perp and vault systems. - function _querySubscriptionState(IPerpetualTranche perp_) private returns (SubscriptionParams memory) { - return - SubscriptionParams({ - perpTVL: perp_.getTVL(), - vaultTVL: getTVL(), - seniorTR: perp_.getDepositTrancheRatio() - }); + /// @dev Queries the current TVL of the perp and vault systems. + function _querySystemTVL(IPerpetualTranche perp_) private returns (SystemTVL memory) { + return SystemTVL({ perpTVL: perp_.getTVL(), vaultTVL: getTVL() }); } //-------------------------------------------------------------------------- - // Private methods - - /// @dev Computes the value of the given amount of tranche tokens, based on it's current CDR. - /// Value is denominated in the underlying collateral. - function _computeVaultTrancheValue( - ITranche tranche, - IERC20Upgradeable collateralToken, - uint256 trancheAmt - ) private view returns (uint256) { - (uint256 trancheClaim, uint256 trancheSupply) = tranche.getTrancheCollateralization(collateralToken); - return trancheClaim.mulDiv(trancheAmt, trancheSupply, MathUpgradeable.Rounding.Up); - } + // Private view methods /// @dev Computes the balance of underlying tokens to NOT be used for any operation. - function _totalReservedBalance(uint256 perpTVL, uint256 seniorTR) private view returns (uint256) { - return - MathUpgradeable.max( - reservedUnderlyingBal, - perpTVL.mulDiv(TRANCHE_RATIO_GRANULARITY - seniorTR, seniorTR).mulDiv(reservedSubscriptionPerc, ONE) - ); + function _totalReservedBalance(uint256 vaultTVL) private view returns (uint256) { + return MathUpgradeable.max(reservedUnderlyingBal, vaultTVL.mulDiv(reservedUnderlyingPerc, ONE)); } } diff --git a/spot-contracts/contracts/RouterV2.sol b/spot-contracts/contracts/RouterV2.sol index a81ea85e..23b305d8 100644 --- a/spot-contracts/contracts/RouterV2.sol +++ b/spot-contracts/contracts/RouterV2.sol @@ -11,6 +11,7 @@ import { SafeERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ import { SafeCastUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol"; import { BondTranches, BondTranchesHelpers } from "./_utils/BondTranchesHelpers.sol"; import { BondHelpers } from "./_utils/BondHelpers.sol"; +import { ERC20Helpers } from "./_utils/ERC20Helpers.sol"; /** * @title RouterV2 @@ -30,6 +31,7 @@ contract RouterV2 { using SafeERC20Upgradeable for IERC20Upgradeable; using SafeERC20Upgradeable for ITranche; using SafeERC20Upgradeable for IPerpetualTranche; + using ERC20Helpers for IERC20Upgradeable; /// @notice Calculates the amount of tranche tokens minted after depositing into the deposit bond. /// @dev Used by off-chain services to preview a tranche operation. @@ -64,14 +66,14 @@ contract RouterV2 { collateralToken.safeTransferFrom(msg.sender, address(this), collateralAmount); // approves collateral to be tranched - _checkAndApproveMax(collateralToken, address(bond), collateralAmount); + collateralToken.checkAndApproveMax(address(bond), collateralAmount); // tranches collateral bond.deposit(collateralAmount); // uses senior tranches to mint perps uint256 trancheAmt = bt.tranches[0].balanceOf(address(this)); - _checkAndApproveMax(bt.tranches[0], address(perp), trancheAmt); + IERC20Upgradeable(bt.tranches[0]).checkAndApproveMax(address(perp), trancheAmt); perp.deposit(bt.tranches[0], trancheAmt); // transfers remaining junior tranches back @@ -86,12 +88,4 @@ contract RouterV2 { // transfers perp tokens back perp.safeTransfer(msg.sender, perp.balanceOf(address(this))); } - - /// @dev Checks if the spender has sufficient allowance. If not, approves the maximum possible amount. - function _checkAndApproveMax(IERC20Upgradeable token, address spender, uint256 amount) private { - uint256 allowance = token.allowance(address(this), spender); - if (allowance < amount) { - token.safeApprove(spender, type(uint256).max); - } - } } diff --git a/spot-contracts/contracts/_interfaces/CommonTypes.sol b/spot-contracts/contracts/_interfaces/CommonTypes.sol index 52fbacf4..cd344c85 100644 --- a/spot-contracts/contracts/_interfaces/CommonTypes.sol +++ b/spot-contracts/contracts/_interfaces/CommonTypes.sol @@ -10,14 +10,12 @@ struct TokenAmount { uint256 amount; } -/// @notice The system subscription parameters. -struct SubscriptionParams { +/// @notice The system TVL parameters. +struct SystemTVL { /// @notice The current TVL of perp denominated in the underlying. uint256 perpTVL; /// @notice The current TVL of the vault denominated in the underlying. uint256 vaultTVL; - /// @notice The tranche ratio of seniors accepted by perp. - uint256 seniorTR; } struct RolloverData { @@ -26,3 +24,23 @@ struct RolloverData { /// @notice The amount of trancheIn tokens rolled in. uint256 trancheInAmt; } + +/// @notice A data structure to define a numeric Range. +struct Range { + // @dev Lower bound of the range. + uint256 lower; + // @dev Upper bound of the range. + uint256 upper; +} + +/// @notice A data structure to define a geometric Line with two points. +struct Line { + // @dev x-coordinate of the first point. + uint256 x1; + // @dev y-coordinate of the first point. + uint256 y1; + // @dev x-coordinate of the second point. + uint256 x2; + // @dev y-coordinate of the second point. + uint256 y2; +} diff --git a/spot-contracts/contracts/_interfaces/IFeePolicy.sol b/spot-contracts/contracts/_interfaces/IFeePolicy.sol index 5699611e..f0a24db4 100644 --- a/spot-contracts/contracts/_interfaces/IFeePolicy.sol +++ b/spot-contracts/contracts/_interfaces/IFeePolicy.sol @@ -1,53 +1,36 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; -import { SubscriptionParams } from "./CommonTypes.sol"; +import { SystemTVL } from "./CommonTypes.sol"; interface IFeePolicy { /// @return The percentage of the mint perp tokens to be charged as fees, /// as a fixed-point number with {DECIMALS} decimal places. - function computePerpMintFeePerc() external view returns (uint256); + /// @dev Perp mint fees are paid to the vault. + function computeFeePerc(uint256 drPre, uint256 drPost) external view returns (uint256); - /// @return The percentage of the burnt perp tokens to be charged as fees, - /// as a fixed-point number with {DECIMALS} decimal places. - function computePerpBurnFeePerc() external view returns (uint256); + /// @return Number of decimals representing a multiplier of 1.0. So, 100% = 1*10**decimals. + function decimals() external view returns (uint8); - /// @param dr The current system deviation ratio. - /// @return The applied exchange rate adjustment between tranches into perp and - /// tokens out of perp during a rollover, - /// as a fixed-point number with {DECIMALS} decimal places. - /// @dev - A fee of 0%, implies the rollover exchange rate is unaltered. - /// example) 100 tranchesIn for 100 tranchesOut - /// - A fee of 1%, implies the exchange rate is adjusted in favor of tranchesIn. - /// example) 100 tranchesIn for 99 tranchesOut; i.e) perp enrichment - /// - A fee of -1%, implies the exchange rate is adjusted in favor of tranchesOut. - /// example) 99 tranchesIn for 100 tranchesOut - function computePerpRolloverFeePerc(uint256 dr) external view returns (int256); - - /// @return The percentage of the mint vault note amount to be charged as fees, - /// as a fixed-point number with {DECIMALS} decimal places. - function computeVaultMintFeePerc() external view returns (uint256); + /// @param s The TVL of both the perp and vault systems. + /// @return The deviation ratio given the system TVL. + function computeDeviationRatio(SystemTVL memory s) external view returns (uint256); - /// @return The percentage of the burnt vault note amount to be charged as fees, - /// as a fixed-point number with {DECIMALS} decimal places. - function computeVaultBurnFeePerc() external view returns (uint256); + /// @return The target system ratio as a fixed-point number with {DECIMALS} decimal places. + function targetSystemRatio() external view returns (uint256); - /// @param dr The current system deviation ratio. - /// @param dr_ The deviation ratio of the system after the operation is complete. - /// @return The percentage of perp tokens out to be charged as swap fees by the vault, - /// as a fixed-point numbers with {DECIMALS} decimal places. - function computeUnderlyingToPerpVaultSwapFeePerc(uint256 dr, uint256 dr_) external view returns (uint256); + /// @notice Computes magnitude and direction of value flow between perp and the rollover vault + /// expressed in underlying tokens. + /// @param s The TVL of both the perp and vault systems. + /// @return underlyingAmtIntoPerp The value in underlying tokens, that need to flow from the vault into perp. + function computeRebalanceAmount(SystemTVL memory s) external view returns (int256 underlyingAmtIntoPerp); - /// @param dr The current system deviation ratio. - /// @param dr_ The deviation ratio of the system after the operation is complete. - /// @return The percentage of underlying tokens out to be charged as swap fees by the vault, - /// as a fixed-point numbers with {DECIMALS} decimal places. - function computePerpToUnderlyingVaultSwapFeePerc(uint256 dr, uint256 dr_) external view returns (uint256); + /// @return The share of the system tvl paid to the protocol owner as fees per rebalance. + function protocolSharePerc() external view returns (uint256); - /// @return Number of decimals representing a multiplier of 1.0. So, 100% = 1*10**decimals. - function decimals() external view returns (uint8); + /// @return Frequency of the periodic rebalance operation. + function rebalanceFreqSec() external view returns (uint256); - /// @param s The subscription parameters of both the perp and vault systems. - /// @return The deviation ratio given the system subscription parameters. - function computeDeviationRatio(SubscriptionParams memory s) external view returns (uint256); + /// @return The fee collector address. + function protocolFeeCollector() external view returns (address); } diff --git a/spot-contracts/contracts/_interfaces/IPerpetualTranche.sol b/spot-contracts/contracts/_interfaces/IPerpetualTranche.sol index 4b64fc01..8bc0951d 100644 --- a/spot-contracts/contracts/_interfaces/IPerpetualTranche.sol +++ b/spot-contracts/contracts/_interfaces/IPerpetualTranche.sol @@ -48,6 +48,19 @@ interface IPerpetualTranche is IERC20Upgradeable { uint256 trancheInAmt ) external returns (RolloverData memory r); + /// @notice Sends the collected mint/burn fees to the provided recipient address. + /// @param to The recipient address. + function claimFees(address to) external; + + /// @notice Pays the protocol fee collector a share of the TVL. + /// @param to The recipient address. + /// @param protocolSharePerc The share of tvl to be paid to the protocol as fees. + function payProtocolFee(address to, uint256 protocolSharePerc) external; + + /// @notice Debases the value of perp tokens, by transferring value to the vault. + /// @param underlyingAmtToTransfer The value in underlying tokens to be transferred to the vault. + function rebalanceToVault(uint256 underlyingAmtToTransfer) external; + /// @notice External contract that stores a predefined bond config and frequency, /// and issues new bonds when poked. /// @return The address of the bond issuer. diff --git a/spot-contracts/contracts/_interfaces/IRolloverVault.sol b/spot-contracts/contracts/_interfaces/IRolloverVault.sol index 0b6c4742..1a11d119 100644 --- a/spot-contracts/contracts/_interfaces/IRolloverVault.sol +++ b/spot-contracts/contracts/_interfaces/IRolloverVault.sol @@ -2,9 +2,30 @@ pragma solidity ^0.8.0; import { IVault } from "./IVault.sol"; -import { SubscriptionParams } from "./CommonTypes.sol"; +import { SystemTVL, TokenAmount } from "./CommonTypes.sol"; interface IRolloverVault is IVault { + /// @notice Gradually transfers value between the perp and vault, to bring the system back into balance. + /// @dev The rebalance function can be executed at-most once a day. + function rebalance() external; + + /// @notice Batch operation to mint both perp and rollover vault tokens. + /// @param underlyingAmtIn The amount of underlying tokens to be tranched. + /// @return perpAmt The amount of perp tokens minted. + /// @return vaultNoteAmt The amount of vault notes minted. + function mint2(uint256 underlyingAmtIn) external returns (uint256 perpAmt, uint256 vaultNoteAmt); + + /// @notice Batch operation to redeem both perp and rollover vault tokens for the underlying collateral and tranches. + /// @param perpAmtAvailable The amount of perp tokens available to redeem. + /// @param vaultNoteAmtAvailable The amount of vault notes available to redeem. + /// @return perpAmtBurnt The amount of perp tokens redeemed. + /// @return vaultNoteAmtBurnt The amount of vault notes redeemed. + /// @return returnedTokens The list of asset tokens and amounts returned. + function redeem2( + uint256 perpAmtAvailable, + uint256 vaultNoteAmtAvailable + ) external returns (uint256 perpAmtBurnt, uint256 vaultNoteAmtBurnt, TokenAmount[] memory returnedTokens); + /// @notice Allows users to swap their underlying tokens for perps held by the vault. /// @param underlyingAmtIn The amount of underlying tokens swapped in. /// @return The amount of perp tokens swapped out. @@ -19,19 +40,17 @@ interface IRolloverVault is IVault { /// @param underlyingAmtIn The number of underlying tokens the user swaps in. /// @return perpAmtOut The number of perp tokens returned to the user. /// @return perpFeeAmtToBurn The amount of perp tokens to be paid to the perp contract as mint fees. - /// @return s The pre-swap perp and vault subscription state. + /// @return s The pre-swap perp and vault TVL. function computeUnderlyingToPerpSwapAmt( uint256 underlyingAmtIn - ) external returns (uint256, uint256, SubscriptionParams memory); + ) external returns (uint256, uint256, SystemTVL memory); /// @notice Computes the amount of underlying tokens that are returned when user swaps a given number of perp tokens. /// @param perpAmtIn The number of perp tokens the user swaps in. /// @return underlyingAmtOut The number of underlying tokens returned to the user. /// @return perpFeeAmtToBurn The amount of perp tokens to be paid to the perp contract as burn fees. - /// @return s The pre-swap perp and vault subscription state. - function computePerpToUnderlyingSwapAmt( - uint256 perpAmtIn - ) external returns (uint256, uint256, SubscriptionParams memory); + /// @return s The pre-swap perp and vault TVL. + function computePerpToUnderlyingSwapAmt(uint256 perpAmtIn) external returns (uint256, uint256, SystemTVL memory); /// @return The system's current deviation ratio. function deviationRatio() external returns (uint256); diff --git a/spot-contracts/contracts/_interfaces/IVault.sol b/spot-contracts/contracts/_interfaces/IVault.sol index 28cd8258..5c7d8093 100644 --- a/spot-contracts/contracts/_interfaces/IVault.sol +++ b/spot-contracts/contracts/_interfaces/IVault.sol @@ -53,11 +53,6 @@ interface IVault is IERC20Upgradeable { /// @return The list of asset tokens and amounts redeemed. function redeem(uint256 notes) external returns (TokenAmount[] memory); - /// @notice Batches the recover and redeem functions. - /// @param notes The amount of notes to be burnt. - /// @return The list of asset tokens and amounts redeemed. - function recoverAndRedeem(uint256 notes) external returns (TokenAmount[] memory); - /// @return The total value of assets currently held by the vault, denominated in a standard unit of account. function getTVL() external view returns (uint256); @@ -82,15 +77,4 @@ interface IVault is IERC20Upgradeable { /// @param token The address of a token to check. /// @return If the given token is held by the vault. function isVaultAsset(IERC20Upgradeable token) external view returns (bool); - - /// @notice Computes the amount of notes minted when given amount of underlying asset tokens - /// are deposited into the system. - /// @param amount The amount tokens to be deposited into the vault. - /// @return The amount of notes to be minted. - function computeMintAmt(uint256 amount) external returns (uint256); - - /// @notice Computes the amount of asset tokens redeemed when burning given number of vault notes. - /// @param notes The amount of notes to be burnt. - /// @return The list of asset tokens and amounts redeemed. - function computeRedemptionAmts(uint256 notes) external returns (TokenAmount[] memory); } diff --git a/spot-contracts/contracts/_interfaces/ProtocolErrors.sol b/spot-contracts/contracts/_interfaces/ProtocolErrors.sol index 9015f188..e766f62b 100644 --- a/spot-contracts/contracts/_interfaces/ProtocolErrors.sol +++ b/spot-contracts/contracts/_interfaces/ProtocolErrors.sol @@ -34,6 +34,9 @@ error OutOfBounds(); /// @notice Expected the number of reserve assets to be under the limit. error ReserveCountOverLimit(); +/// @notice Expected range to be non-decreasing. +error InvalidRange(); + //------------------------------------------------------------------------- // Perp @@ -64,17 +67,14 @@ error DeployedCountOverLimit(); /// @notice Expected parent bond to have only 2 children tranches. error UnacceptableTrancheLength(); +/// @notice Not enough time has elapsed since last successful rebalance. +error LastRebalanceTooRecent(); + //------------------------------------------------------------------------- -// Fee Policy +// FeePolicy /// @notice Expected perc value to be at most (1 * 10**DECIMALS), i.e) 1.0 or 100%. error InvalidPerc(); -/// @notice Expected target subscription ratio to be within defined bounds. -error InvalidTargetSRBounds(); - -/// @notice Expected deviation ratio bounds to be valid. -error InvalidDRBounds(); - -/// @notice Expected sigmoid asymptotes to be within defined bounds. -error InvalidSigmoidAsymptotes(); +/// @notice Expected valid fee function definitions. +error InvalidFees(); diff --git a/spot-contracts/contracts/_test/LineHelpersTester.sol b/spot-contracts/contracts/_test/LineHelpersTester.sol new file mode 100644 index 00000000..9cb75c1c --- /dev/null +++ b/spot-contracts/contracts/_test/LineHelpersTester.sol @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +pragma solidity ^0.8.20; + +import { LineHelpers } from "../_utils/LineHelpers.sol"; +import { Line, Range } from "../_interfaces/CommonTypes.sol"; + +contract LineHelpersTester { + function computePiecewiseAvgY( + Line memory fn1, + Line memory fn2, + Range memory xRange, + uint256 xBreakPt + ) public pure returns (int256) { + return LineHelpers.computePiecewiseAvgY(fn1, fn2, xRange, xBreakPt); + } + + function avgY(Line memory fn, uint256 xL, uint256 xU) public pure returns (int256) { + return LineHelpers.avgY(fn, xL, xU); + } +} diff --git a/spot-contracts/contracts/_test/mocks/DMock.sol b/spot-contracts/contracts/_test/mocks/DMock.sol new file mode 100644 index 00000000..ff0cac3b --- /dev/null +++ b/spot-contracts/contracts/_test/mocks/DMock.sol @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; + +contract DMock { + struct MockCall { + bytes data; + bytes returnValue; + } + + // Maps a method signature to its mock call definition + mapping(bytes32 => MockCall) public mockCalls; + + // Fallback function to handle all calls + // solhint-disable-next-line + fallback(bytes calldata) external returns (bytes memory) { + // Check if mock has been defined based on {sig,param} pair + MockCall storage mockCall_ = mockCalls[keccak256(msg.data)]; + + // else check if generic mock has been defined based on sig + if (mockCall_.data.length <= 0) { + mockCall_ = mockCalls[keccak256(abi.encodePacked(bytes4(msg.data)))]; + } + + // solhint-disable-next-line custom-errors + require(mockCall_.data.length > 0, "DMock: method not mocked"); + + // Return the mocked return value + return mockCall_.returnValue; + } + + // Function to set up a mock call, given method sig and parameters + function mockCall(bytes memory data, bytes memory returnValue) public { + mockCalls[keccak256(data)] = MockCall(data, returnValue); + } + + // Function to set up a mock call, given just method sig + function mockMethod(bytes4 sig, bytes memory returnValue) public { + bytes memory data = abi.encodePacked(sig); + mockCalls[keccak256(data)] = MockCall(data, returnValue); + } + + // Function to clear mocked call + function clearMockCall(bytes memory data) public { + delete mockCalls[keccak256(data)]; + } + + // Function to clear mocked method call + function clearMockMethodSig(bytes4 sig) public { + bytes memory data = abi.encodePacked(sig); + delete mockCalls[keccak256(data)]; + } +} diff --git a/spot-contracts/contracts/_utils/BondHelpers.sol b/spot-contracts/contracts/_utils/BondHelpers.sol index b9aefc14..3903fef9 100644 --- a/spot-contracts/contracts/_utils/BondHelpers.sol +++ b/spot-contracts/contracts/_utils/BondHelpers.sol @@ -10,6 +10,7 @@ import { UnacceptableDeposit, UnacceptableTrancheLength } from "../_interfaces/P import { SafeCastUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol"; import { MathUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol"; import { BondTranches } from "./BondTranchesHelpers.sol"; +import { ERC20Helpers } from "./ERC20Helpers.sol"; /** * @title BondHelpers @@ -20,6 +21,7 @@ import { BondTranches } from "./BondTranchesHelpers.sol"; library BondHelpers { using SafeCastUpgradeable for uint256; using MathUpgradeable for uint256; + using ERC20Helpers for IERC20Upgradeable; // Replicating value used here: // https://github.com/buttonwood-protocol/tranche/blob/main/contracts/BondController.sol @@ -97,4 +99,17 @@ library BondHelpers { return tranchesOut; } + + /// @notice Helper function which approves underlying tokens and mints tranche tokens by depositing into the provided bond contract. + /// @return The array of tranche tokens minted. + function approveAndDeposit( + IBondController b, + IERC20Upgradeable underlying_, + uint256 underlyingAmt + ) internal returns (ITranche[2] memory) { + BondTranches memory bt = getTranches(b); + underlying_.checkAndApproveMax(address(b), underlyingAmt); + b.deposit(underlyingAmt); + return bt.tranches; + } } diff --git a/spot-contracts/contracts/_utils/ERC20Helpers.sol b/spot-contracts/contracts/_utils/ERC20Helpers.sol new file mode 100644 index 00000000..d73becbc --- /dev/null +++ b/spot-contracts/contracts/_utils/ERC20Helpers.sol @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: BUSL-1.1 +pragma solidity ^0.8.20; + +import { IERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; +import { SafeERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; + +/** + * @title ERC20Helpers + * + * @notice Library with helper functions for ERC20 Tokens. + * + */ +library ERC20Helpers { + using SafeERC20Upgradeable for IERC20Upgradeable; + + /// @notice Checks if the spender has sufficient allowance. If not, approves the maximum possible amount. + function checkAndApproveMax(IERC20Upgradeable token, address spender, uint256 amount) internal { + uint256 allowance = token.allowance(address(this), spender); + if (allowance < amount) { + token.safeApprove(spender, type(uint256).max); + } + } +} diff --git a/spot-contracts/contracts/_utils/LineHelpers.sol b/spot-contracts/contracts/_utils/LineHelpers.sol new file mode 100644 index 00000000..69b0e603 --- /dev/null +++ b/spot-contracts/contracts/_utils/LineHelpers.sol @@ -0,0 +1,85 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +pragma solidity ^0.8.20; + +import { MathUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol"; +import { SafeCastUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol"; +import { Line, Range } from "../_interfaces/CommonTypes.sol"; +import { InvalidRange } from "../_interfaces/ProtocolErrors.sol"; + +/** + * @title LineHelpers + * @notice Provides helper functions for working with linear functions and computing piecewise averages. + */ +library LineHelpers { + using MathUpgradeable for uint256; + using SafeCastUpgradeable for uint256; + using SafeCastUpgradeable for int256; + + /** + * @notice Computes the weighted average y-value over a specified x-range for a piecewise linear function. + * @dev This function considers two linear segments—`fn1` for x-values below the breakpoint (`xBreakPt`) + * and `fn2` for x-values above or equal to the breakpoint. If the entire x-range lies on one side of + * `xBreakPt`, it returns the average y-value computed over that range using the appropriate function. + * If the x-range spans `xBreakPt`, it computes a weighted average of the two sub-ranges, weighted by their lengths. + * @param fn1 The linear function used for x-values below `xBreakPt`. + * @param fn2 The linear function used for x-values above or equal to `xBreakPt`. + * @param xRange The x-range over which to compute the average. + * @param xBreakPt The x-coordinate where the piecewise function transitions from `fn1` to `fn2`. + * @return yVal The computed weighted average y-value over the x-range. + */ + function computePiecewiseAvgY( + Line memory fn1, + Line memory fn2, + Range memory xRange, + uint256 xBreakPt + ) internal pure returns (int256 yVal) { + if (xRange.lower > xRange.upper) { + revert InvalidRange(); + } + + if (xRange.upper <= xBreakPt) { + // Entire range is below the breakpoint. + yVal = avgY(fn1, xRange.lower, xRange.upper); + } else if (xRange.lower >= xBreakPt) { + // Entire range is above or equal to the breakpoint. + yVal = avgY(fn2, xRange.lower, xRange.upper); + } else { + // Range spans the breakpoint, so compute weighted average of both segments. + uint256 len1 = xBreakPt - xRange.lower; + uint256 len2 = xRange.upper - xBreakPt; + int256 avg1 = avgY(fn1, xRange.lower, xBreakPt); + int256 avg2 = avgY(fn2, xBreakPt, xRange.upper); + yVal = (avg1 * int256(len1) + avg2 * int256(len2)) / int256(xRange.upper - xRange.lower); + } + } + + /** + * @notice Computes the average y-value of a linear function over the interval [xL, xU]. + * @dev For a linear function defined as f(x) = m*x + c, the average value over [xL, xU] is: + * (f(xL) + f(xU)) / 2, which can be rewritten as m*((xL + xU)/2) + c. + * This function calculates the slope m using the two endpoints of the line and then computes + * the y-intercept c (using c = y2 - m*x2). If the line is horizontal (zero slope), it returns the + * constant y-value. Note that precision loss may occur due to integer division and type casting. + * Also, it is assumed that fn.x1 and fn.x2 are distinct to avoid division by zero. + * @param fn The linear function defined by two points (with properties x1, y1, x2, y2). + * @param xL The lower bound of the x-interval. + * @param xU The upper bound of the x-interval. + * @return The average y-value over the interval [xL, xU]. + */ + function avgY(Line memory fn, uint256 xL, uint256 xU) internal pure returns (int256) { + // If the line is horizontal, return the constant y-value. + if (fn.y1 == fn.y2) { + return fn.y2.toInt256(); + } + + // Calculate the slope (m = deltaY / deltaX). + int256 deltaY = fn.y2.toInt256() - fn.y1.toInt256(); + int256 deltaX = fn.x2.toInt256() - fn.x1.toInt256(); + + // Calculate the y-intercept using one of the endpoints: c = y2 - m * x2. + int256 c = fn.y2.toInt256() - ((fn.x2.toInt256() * deltaY) / deltaX); + + // Compute the average value over [xL, xU] as m*((xL + xU)/2) + c. + return ((((xL + xU).toInt256() * deltaY) / (2 * deltaX)) + c); + } +} diff --git a/spot-contracts/contracts/_utils/MathHelpers.sol b/spot-contracts/contracts/_utils/MathHelpers.sol new file mode 100644 index 00000000..c3c9ada3 --- /dev/null +++ b/spot-contracts/contracts/_utils/MathHelpers.sol @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +pragma solidity ^0.8.20; + +import { MathUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol"; + +/** + * @title MathHelpers + * + * @notice Library with helper functions for math operations. + * + */ +library MathHelpers { + using MathUpgradeable for uint256; + + /// @dev Clips a given unsigned integer between provided min and max unsigned integer. + function clip(uint256 n, uint256 min, uint256 max) internal pure returns (uint256) { + return MathUpgradeable.min(MathUpgradeable.max(n, min), max); + } +} diff --git a/spot-contracts/contracts/_utils/TrancheManager.sol b/spot-contracts/contracts/_utils/TrancheManager.sol new file mode 100644 index 00000000..e4035999 --- /dev/null +++ b/spot-contracts/contracts/_utils/TrancheManager.sol @@ -0,0 +1,72 @@ +// SPDX-License-Identifier: BUSL-1.1 +pragma solidity ^0.8.20; + +import { IERC20Upgradeable, IBondController, ITranche } from "../_interfaces/IPerpetualTranche.sol"; + +import { SafeERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; +import { MathUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol"; +import { BondTranches, BondTranchesHelpers } from "./BondTranchesHelpers.sol"; +import { TrancheHelpers } from "./TrancheHelpers.sol"; +import { BondHelpers } from "./BondHelpers.sol"; +import { ERC20Helpers } from "./ERC20Helpers.sol"; + +/** + * @title TrancheManager + * + * @notice Linked external library with helper functions for tranche management. + * + * @dev Proxies which use external libraries are by default NOT upgrade safe. + * We guarantee that this linked external library will never trigger selfdestruct, + * and this one is. + * + */ +library TrancheManager { + // data handling + using BondHelpers for IBondController; + using TrancheHelpers for ITranche; + using BondTranchesHelpers for BondTranches; + + // ERC20 operations + using SafeERC20Upgradeable for IERC20Upgradeable; + using ERC20Helpers for IERC20Upgradeable; + + // math + using MathUpgradeable for uint256; + + //-------------------------------------------------------------------------- + // Helper methods + + /// @notice Low level method that redeems the given mature tranche for the underlying asset. + /// It interacts with the button-wood bond contract. + function execMatureTrancheRedemption(IBondController bond, ITranche tranche, uint256 amount) external { + if (!bond.isMature()) { + bond.mature(); + } + bond.redeemMature(address(tranche), amount); + } + + /// @notice Low level method that redeems the given tranche for the underlying asset, before maturity. + /// If the contract holds sibling tranches with proportional balances, those will also get redeemed. + /// It interacts with the button-wood bond contract. + function execImmatureTrancheRedemption(IBondController bond, BondTranches memory bt) external { + uint256[] memory trancheAmts = bt.computeRedeemableTrancheAmounts(address(this)); + + // NOTE: It is guaranteed that if one tranche amount is zero, all amounts are zeros. + if (trancheAmts[0] > 0) { + bond.redeem(trancheAmts); + } + } + + /// @notice Computes the value of the given amount of tranche tokens, based on it's current CDR. + /// Value is denominated in the underlying collateral. + function computeTrancheValue( + address tranche, + address collateralToken, + uint256 trancheAmt + ) external view returns (uint256) { + (uint256 trancheClaim, uint256 trancheSupply) = ITranche(tranche).getTrancheCollateralization( + IERC20Upgradeable(collateralToken) + ); + return trancheClaim.mulDiv(trancheAmt, trancheSupply, MathUpgradeable.Rounding.Up); + } +} diff --git a/spot-contracts/external-artifacts/BondController.json b/spot-contracts/external-artifacts/BondController.json index 990e7666..7233f0ab 100644 --- a/spot-contracts/external-artifacts/BondController.json +++ b/spot-contracts/external-artifacts/BondController.json @@ -1,7 +1,7 @@ { "_format": "hh-sol-artifact-1", "contractName": "BondController", - "sourceName": "button-tranche/contracts/BondController.sol", + "sourceName": "contracts/BondController.sol", "abi": [ { "anonymous": false, @@ -41,19 +41,6 @@ "name": "FeeUpdate", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -130,6 +117,19 @@ "name": "RedeemMature", "type": "event" }, + { + "inputs": [], + "name": "collateralBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "collateralToken", @@ -246,6 +246,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "lastScaledCollateralBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "mature", @@ -413,8 +426,8 @@ "type": "function" } ], - "bytecode": "0x608060405234801561001057600080fd5b50612652806100206000396000f3fe608060405234801561001057600080fd5b50600436106101215760003560e01c806387b65207116100ad578063d59624b411610071578063d59624b41461025c578063ecf7085814610265578063f2fde38b1461026e578063f9afb26a14610281578063fc7b9c181461029457610121565b806387b65207146101fc5780638da5cb5b14610204578063ae4e7fdf14610229578063b2016bd414610236578063b6b55f251461024957610121565b80632a76ef31116100f45780632a76ef31146101b057806333d20e34146101c557806359eb8224146101d857806369fe0e2d146101e1578063715018a6146101f457610121565b806305b344101461012657806320e8e89e1461014257806324a9d8531461017557806326c259621461017e575b600080fd5b61012f60695481565b6040519081526020015b60405180910390f35b610165610150366004612082565b60686020526000908152604090205460ff1681565b6040519015158152602001610139565b61012f606e5481565b61019161018c36600461224d565b61029d565b604080516001600160a01b039093168352602083019190915201610139565b6101c36101be3660046120ba565b6102d5565b005b6101c36101d336600461213f565b610865565b61012f60675481565b6101c36101ef36600461224d565b6109f3565b6101c3610b0b565b6101c3610b41565b6033546001600160a01b03165b6040516001600160a01b039091168152602001610139565b606b546101659060ff1681565b606554610211906001600160a01b031681565b6101c361025736600461224d565b611073565b61012f606a5481565b61012f606d5481565b6101c361027c366004612082565b61161c565b6101c361028f36600461216a565b6116b7565b61012f606c5481565b606681815481106102ad57600080fd5b6000918252602090912060029091020180546001909101546001600160a01b03909116915082565b60006102e16001611aff565b905080156102f9576000805461ff0019166101001790555b6001600160a01b03871661036b5760405162461bcd60e51b815260206004820152602e60248201527f426f6e64436f6e74726f6c6c65723a20696e76616c6964207472616e6368654660448201526d6163746f7279206164647265737360901b60648201526084015b60405180910390fd5b6001600160a01b0386166103d95760405162461bcd60e51b815260206004820152602f60248201527f426f6e64436f6e74726f6c6c65723a20696e76616c696420636f6c6c6174657260448201526e616c546f6b656e206164647265737360881b6064820152608401610362565b6001600160a01b03851661043d5760405162461bcd60e51b815260206004820152602560248201527f426f6e64436f6e74726f6c6c65723a20696e76616c69642061646d696e206164604482015264647265737360d81b6064820152608401610362565b601a8451111561049d5760405162461bcd60e51b815260206004820152602560248201527f426f6e64436f6e74726f6c6c65723a20696e76616c6964207472616e6368652060448201526418dbdd5b9d60da1b6064820152608401610362565b6104a5611b85565b6104ae8561161c565b8351606755606580546001600160a01b0319166001600160a01b038816908117909155604080516395d89b4160e01b81529051600092916395d89b419160048083019286929190829003018186803b15801561050957600080fd5b505afa15801561051d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261054591908101906121bd565b90506000805b865181101561074757600087828151811061057657634e487b7160e01b600052603260045260246000fd5b602002602001015190506103e88111156105e05760405162461bcd60e51b815260206004820152602560248201527f426f6e64436f6e74726f6c6c65723a20496e76616c6964207472616e63686520604482015264726174696f60d81b6064820152608401610362565b6105ea8184612522565b925060008b6001600160a01b031663ef55207c61060987868d51611bb4565b61061588878e51611bea565b8e6040518463ffffffff1660e01b8152600401610634939291906123e5565b602060405180830381600087803b15801561064e57600080fd5b505af1158015610662573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610686919061209e565b6040805180820182526001600160a01b0392831680825260208083019687526066805460018082018355600092835294517f46501879b8ca8525e8c2fd519e2fbfcfa2ebea26501294aa02cbfcfb12e94354600290920291820180546001600160a01b031916919098161790965596517f46501879b8ca8525e8c2fd519e2fbfcfa2ebea26501294aa02cbfcfb12e943559095019490945585526068909252909220805460ff1916909217909155508061073f816125c0565b91505061054b565b506103e881146107a85760405162461bcd60e51b815260206004820152602660248201527f426f6e64436f6e74726f6c6c65723a20496e76616c6964207472616e63686520604482015265726174696f7360d01b6064820152608401610362565b4285116108055760405162461bcd60e51b815260206004820152602560248201527f426f6e64436f6e74726f6c6c65723a20496e76616c6964206d61747572697479604482015264206461746560d81b6064820152608401610362565b505042606955606a839055606d829055801561085c576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a15b50505050505050565b606b5460ff166108c25760405162461bcd60e51b815260206004820152602260248201527f426f6e64436f6e74726f6c6c65723a20426f6e64206973206e6f74206d617475604482015261726560f01b6064820152608401610362565b6001600160a01b03821660009081526068602052604090205460ff1661093a5760405162461bcd60e51b815260206004820152602760248201527f426f6e64436f6e74726f6c6c65723a20496e76616c6964207472616e636865206044820152666164647265737360c81b6064820152608401610362565b604051630e6dfcd560e01b81526001600160a01b03831690630e6dfcd59061096a9033908190869060040161236b565b600060405180830381600087803b15801561098457600080fd5b505af1158015610998573d6000803e3d6000fd5b5050505080606c60008282546109ae9190612579565b909155507f5e9473a427344c9398fd27f132e093a6582e7177334cb912336f3c17af206edb90503383836040516109e79392919061236b565b60405180910390a15050565b6033546001600160a01b03163314610a1d5760405162461bcd60e51b815260040161036290612471565b606b5460ff1615610a7f5760405162461bcd60e51b815260206004820152602660248201527f426f6e64436f6e74726f6c6c65723a20496e76616c69642063616c6c20746f2060448201526573657446656560d01b6064820152608401610362565b6032811115610ad05760405162461bcd60e51b815260206004820181905260248201527f426f6e64436f6e74726f6c6c65723a204e65772066656520746f6f20686967686044820152606401610362565b606e8190556040518181527f88258d7c1f0510045362f22cdeb36a2c501ef80d7a06168881189fb8480cfe2f9060200160405180910390a150565b6033546001600160a01b03163314610b355760405162461bcd60e51b815260040161036290612471565b610b3f6000611c08565b565b606b5460ff1615610b945760405162461bcd60e51b815260206004820152601e60248201527f426f6e64436f6e74726f6c6c65723a20416c7265616479206d617475726500006044820152606401610362565b6033546001600160a01b0316331480610bae575042606a54105b610c095760405162461bcd60e51b815260206004820152602660248201527f426f6e64436f6e74726f6c6c65723a20496e76616c69642063616c6c20746f206044820152656d617475726560d01b6064820152608401610362565b606b805460ff19166001179055606680546040805160208084028201810190925282815260009390929091849084015b82821015610c81576000848152602090819020604080518082019091526002850290910180546001600160a01b03168252600190810154828401529083529092019101610c39565b50506065546040516370a0823160e01b81523060048201529394506000936001600160a01b0390911692506370a08231915060240160206040518083038186803b158015610cce57600080fd5b505afa158015610ce2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d069190612265565b905060005b60018351610d199190612579565b81108015610d275750600082115b15610efc576000838281518110610d4e57634e487b7160e01b600052603260045260246000fd5b60200260200101516000015190506000610dd8826001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610d9a57600080fd5b505afa158015610dae573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd29190612265565b85611c5a565b9050610de48185612579565b606554909450610dfe906001600160a01b03168383611c72565b816001600160a01b0316630e6dfcd530610e206033546001600160a01b031690565b6040516370a0823160e01b81523060048201526001600160a01b038716906370a082319060240160206040518083038186803b158015610e5f57600080fd5b505afa158015610e73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e979190612265565b6040518463ffffffff1660e01b8152600401610eb59392919061236b565b600060405180830381600087803b158015610ecf57600080fd5b505af1158015610ee3573d6000803e3d6000fd5b5050505050508080610ef4906125c0565b915050610d0b565b5080156110435760008260018451610f149190612579565b81518110610f3257634e487b7160e01b600052603260045260246000fd5b602090810291909101015151606554909150610f58906001600160a01b03168284611c72565b806001600160a01b0316630e6dfcd530610f7a6033546001600160a01b031690565b6040516370a0823160e01b81523060048201526001600160a01b038616906370a082319060240160206040518083038186803b158015610fb957600080fd5b505afa158015610fcd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff19190612265565b6040518463ffffffff1660e01b815260040161100f9392919061236b565b600060405180830381600087803b15801561102957600080fd5b505af115801561103d573d6000803e3d6000fd5b50505050505b6040513381527f2eb828fdc16ef5c267a7b18c3f8edf180aaff1a8921c4fe994fef55ddc8abe60906020016109e7565b600081116110c35760405162461bcd60e51b815260206004820152601e60248201527f426f6e64436f6e74726f6c6c65723a20696e76616c696420616d6f756e7400006044820152606401610362565b606c54801515806110d957506402540be4008210155b6111345760405162461bcd60e51b815260206004820152602660248201527f426f6e64436f6e74726f6c6c65723a20696e76616c696420696e697469616c20604482015265185b5bdd5b9d60d21b6064820152608401610362565b606b5460ff16156111875760405162461bcd60e51b815260206004820152601e60248201527f426f6e64436f6e74726f6c6c65723a20416c7265616479206d617475726500006044820152606401610362565b6065546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b1580156111cb57600080fd5b505afa1580156111df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112039190612265565b9050606d54600014806112215750606d5461121e8483612522565b11155b61126d5760405162461bcd60e51b815260206004820152601d60248201527f426f6e64436f6e74726f6c6c65723a204465706f736974206c696d69740000006044820152606401610362565b60006066805480602002602001604051908101604052809291908181526020016000905b828210156112d9576000848152602090819020604080518082019091526002850290910180546001600160a01b03168252600190810154828401529083529092019101611291565b50505050905060008060675467ffffffffffffffff81111561130b57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611334578160200160208202803683370190505b50905060005b83518110156114035760006103e885838151811061136857634e487b7160e01b600052603260045260246000fd5b6020026020010151602001518961137f919061255a565b611389919061253a565b905060008611801561139b5750600087115b156113b857856113ab888361255a565b6113b5919061253a565b90505b6113c28185612522565b9350808383815181106113e557634e487b7160e01b600052603260045260246000fd5b602090810291909101015250806113fb816125c0565b91505061133a565b5081606c60008282546114169190612522565b9091555050606554611433906001600160a01b0316333089611d8d565b606e5460005b82518110156115dd57600083828151811061146457634e487b7160e01b600052603260045260246000fd5b602002602001015190506000612710848361147f919061255a565b611489919061253a565b9050801561151f578683815181106114b157634e487b7160e01b600052603260045260246000fd5b6020908102919091010151516040516340c10f1960e01b8152306004820152602481018390526001600160a01b03909116906340c10f1990604401600060405180830381600087803b15801561150657600080fd5b505af115801561151a573d6000803e3d6000fd5b505050505b86838151811061153f57634e487b7160e01b600052603260045260246000fd5b6020026020010151600001516001600160a01b03166340c10f196115603390565b61156a8486612579565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b1580156115b057600080fd5b505af11580156115c4573d6000803e3d6000fd5b50505050505080806115d5906125c0565b915050611439565b5060408051338152602081018990529081018290527f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a1590606001610853565b6033546001600160a01b031633146116465760405162461bcd60e51b815260040161036290612471565b6001600160a01b0381166116ab5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610362565b6116b481611c08565b50565b606b5460ff16156117195760405162461bcd60e51b815260206004820152602660248201527f426f6e64436f6e74726f6c6c65723a20426f6e6420697320616c7265616479206044820152656d617475726560d01b6064820152608401610362565b60006066805480602002602001604051908101604052809291908181526020016000905b82821015611785576000848152602090819020604080518082019091526002850290910180546001600160a01b0316825260019081015482840152908352909201910161173d565b50505050905080518251146117eb5760405162461bcd60e51b815260206004820152602660248201527f426f6e64436f6e74726f6c6c65723a20496e76616c69642072656465656d20616044820152656d6f756e747360d01b6064820152608401610362565b6000805b835181101561183f5783818151811061181857634e487b7160e01b600052603260045260246000fd5b60200260200101518261182b9190612522565b915080611837816125c0565b9150506117ef565b5060005b83518110156119f55782818151811061186c57634e487b7160e01b600052603260045260246000fd5b602002602001015160200151826103e886848151811061189c57634e487b7160e01b600052603260045260246000fd5b60200260200101516118ae919061255a565b6118b8919061253a565b146119165760405162461bcd60e51b815260206004820152602860248201527f426f6e64436f6e74726f6c6c65723a20496e76616c696420726564656d7074696044820152676f6e20726174696f60c01b6064820152608401610362565b82818151811061193657634e487b7160e01b600052603260045260246000fd5b6020026020010151600001516001600160a01b0316639dc29fac6119573390565b86848151811061197757634e487b7160e01b600052603260045260246000fd5b60200260200101516040518363ffffffff1660e01b81526004016119b09291906001600160a01b03929092168252602082015260400190565b600060405180830381600087803b1580156119ca57600080fd5b505af11580156119de573d6000803e3d6000fd5b5050505080806119ed906125c0565b915050611843565b506065546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b158015611a3a57600080fd5b505afa158015611a4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a729190612265565b90506000606c548284611a85919061255a565b611a8f919061253a565b905082606c6000828254611aa39190612579565b9091555050606554611abf906001600160a01b03163383611c72565b7f95a8789c26436cc55b5951f117195be05dfa3022c619a84c1449f83f9cf870683386604051611af092919061238f565b60405180910390a15050505050565b60008054610100900460ff1615611b46578160ff166001148015611b225750303b155b611b3e5760405162461bcd60e51b815260040161036290612423565b506000611b80565b60005460ff808416911610611b6d5760405162461bcd60e51b815260040161036290612423565b506000805460ff191660ff831617905560015b919050565b600054610100900460ff16611bac5760405162461bcd60e51b8152600401610362906124a6565b610b3f611eb9565b606083611bc18484611ee9565b604051602001611bd29291906122c5565b60405160208183030381529060405290509392505050565b606083611bf78484611ee9565b604051602001611bd292919061231b565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000818310611c695781611c6b565b825b9392505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1790529151600092839290871691611cce91906122a9565b6000604051808303816000865af19150503d8060008114611d0b576040519150601f19603f3d011682016040523d82523d6000602084013e611d10565b606091505b5091509150818015611d3a575080511580611d3a575080806020019051810190611d3a919061219d565b611d865760405162461bcd60e51b815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c4544006044820152606401610362565b5050505050565b600080856001600160a01b03166323b872dd868686604051602401611db49392919061236b565b6040516020818303038152906040529060e01b6020820180516001600160e01b038381831617835250505050604051611ded91906122a9565b6000604051808303816000865af19150503d8060008114611e2a576040519150601f19603f3d011682016040523d82523d6000602084013e611e2f565b606091505b5091509150818015611e59575080511580611e59575080806020019051810190611e59919061219d565b611eb15760405162461bcd60e51b8152602060048201526024808201527f5472616e7366657248656c7065723a205452414e534645525f46524f4d5f46416044820152631253115160e21b6064820152608401610362565b505050505050565b600054610100900460ff16611ee05760405162461bcd60e51b8152600401610362906124a6565b610b3f33611c08565b604080518082018252601981527f4142434445464748494a4b4c4d4e4f505152535455565758590000000000000060208201528151600180825281840190935260609260009190602082018180368337019050509050611f4a600185612579565b851415611f9357602d60f91b81600081518110611f7757634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350611ff7565b818581518110611fb357634e487b7160e01b600052603260045260246000fd5b602001015160f81c60f81b81600081518110611fdf57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053505b949350505050565b600082601f83011261200f578081fd5b8135602067ffffffffffffffff82111561202b5761202b6125f1565b8160051b61203a8282016124f1565b838152828101908684018388018501891015612054578687fd5b8693505b85841015612076578035835260019390930192918401918401612058565b50979650505050505050565b600060208284031215612093578081fd5b8135611c6b81612607565b6000602082840312156120af578081fd5b8151611c6b81612607565b60008060008060008060c087890312156120d2578182fd5b86356120dd81612607565b955060208701356120ed81612607565b945060408701356120fd81612607565b9350606087013567ffffffffffffffff811115612118578283fd5b61212489828a01611fff565b9350506080870135915060a087013590509295509295509295565b60008060408385031215612151578182fd5b823561215c81612607565b946020939093013593505050565b60006020828403121561217b578081fd5b813567ffffffffffffffff811115612191578182fd5b611ff784828501611fff565b6000602082840312156121ae578081fd5b81518015158114611c6b578182fd5b6000602082840312156121ce578081fd5b815167ffffffffffffffff808211156121e5578283fd5b818401915084601f8301126121f8578283fd5b81518181111561220a5761220a6125f1565b61221d601f8201601f19166020016124f1565b9150808252856020828501011115612233578384fd5b612244816020840160208601612590565b50949350505050565b60006020828403121561225e578081fd5b5035919050565b600060208284031215612276578081fd5b5051919050565b60008151808452612295816020860160208601612590565b601f01601f19169290920160200192915050565b600082516122bb818460208701612590565b9190910192915050565b60006d0213aba3a37b72a3930b731b432960951b825283516122ee81600e850160208801612590565b600160fd1b600e91840191820152835161230f81600f840160208801612590565b01600f01949350505050565b6000675452414e4348452d60c01b8252835161233e816008850160208801612590565b602d60f81b600891840191820152835161235f816009840160208801612590565b01600901949350505050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b038316815260406020808301829052835191830182905260009184820191906060850190845b818110156123d8578451835293830193918301916001016123bc565b5090979650505050505050565b6000606082526123f8606083018661227d565b828103602084015261240a818661227d565b91505060018060a01b0383166040830152949350505050565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b604051601f8201601f1916810167ffffffffffffffff8111828210171561251a5761251a6125f1565b604052919050565b60008219821115612535576125356125db565b500190565b60008261255557634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615612574576125746125db565b500290565b60008282101561258b5761258b6125db565b500390565b60005b838110156125ab578181015183820152602001612593565b838111156125ba576000848401525b50505050565b60006000198214156125d4576125d46125db565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146116b457600080fdfea26469706673582212204cabe8b296de4f5427a09b2b5306e8f086792d973fe69323cf400e4df44f87f764736f6c63430008030033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101215760003560e01c806387b65207116100ad578063d59624b411610071578063d59624b41461025c578063ecf7085814610265578063f2fde38b1461026e578063f9afb26a14610281578063fc7b9c181461029457610121565b806387b65207146101fc5780638da5cb5b14610204578063ae4e7fdf14610229578063b2016bd414610236578063b6b55f251461024957610121565b80632a76ef31116100f45780632a76ef31146101b057806333d20e34146101c557806359eb8224146101d857806369fe0e2d146101e1578063715018a6146101f457610121565b806305b344101461012657806320e8e89e1461014257806324a9d8531461017557806326c259621461017e575b600080fd5b61012f60695481565b6040519081526020015b60405180910390f35b610165610150366004612082565b60686020526000908152604090205460ff1681565b6040519015158152602001610139565b61012f606e5481565b61019161018c36600461224d565b61029d565b604080516001600160a01b039093168352602083019190915201610139565b6101c36101be3660046120ba565b6102d5565b005b6101c36101d336600461213f565b610865565b61012f60675481565b6101c36101ef36600461224d565b6109f3565b6101c3610b0b565b6101c3610b41565b6033546001600160a01b03165b6040516001600160a01b039091168152602001610139565b606b546101659060ff1681565b606554610211906001600160a01b031681565b6101c361025736600461224d565b611073565b61012f606a5481565b61012f606d5481565b6101c361027c366004612082565b61161c565b6101c361028f36600461216a565b6116b7565b61012f606c5481565b606681815481106102ad57600080fd5b6000918252602090912060029091020180546001909101546001600160a01b03909116915082565b60006102e16001611aff565b905080156102f9576000805461ff0019166101001790555b6001600160a01b03871661036b5760405162461bcd60e51b815260206004820152602e60248201527f426f6e64436f6e74726f6c6c65723a20696e76616c6964207472616e6368654660448201526d6163746f7279206164647265737360901b60648201526084015b60405180910390fd5b6001600160a01b0386166103d95760405162461bcd60e51b815260206004820152602f60248201527f426f6e64436f6e74726f6c6c65723a20696e76616c696420636f6c6c6174657260448201526e616c546f6b656e206164647265737360881b6064820152608401610362565b6001600160a01b03851661043d5760405162461bcd60e51b815260206004820152602560248201527f426f6e64436f6e74726f6c6c65723a20696e76616c69642061646d696e206164604482015264647265737360d81b6064820152608401610362565b601a8451111561049d5760405162461bcd60e51b815260206004820152602560248201527f426f6e64436f6e74726f6c6c65723a20696e76616c6964207472616e6368652060448201526418dbdd5b9d60da1b6064820152608401610362565b6104a5611b85565b6104ae8561161c565b8351606755606580546001600160a01b0319166001600160a01b038816908117909155604080516395d89b4160e01b81529051600092916395d89b419160048083019286929190829003018186803b15801561050957600080fd5b505afa15801561051d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261054591908101906121bd565b90506000805b865181101561074757600087828151811061057657634e487b7160e01b600052603260045260246000fd5b602002602001015190506103e88111156105e05760405162461bcd60e51b815260206004820152602560248201527f426f6e64436f6e74726f6c6c65723a20496e76616c6964207472616e63686520604482015264726174696f60d81b6064820152608401610362565b6105ea8184612522565b925060008b6001600160a01b031663ef55207c61060987868d51611bb4565b61061588878e51611bea565b8e6040518463ffffffff1660e01b8152600401610634939291906123e5565b602060405180830381600087803b15801561064e57600080fd5b505af1158015610662573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610686919061209e565b6040805180820182526001600160a01b0392831680825260208083019687526066805460018082018355600092835294517f46501879b8ca8525e8c2fd519e2fbfcfa2ebea26501294aa02cbfcfb12e94354600290920291820180546001600160a01b031916919098161790965596517f46501879b8ca8525e8c2fd519e2fbfcfa2ebea26501294aa02cbfcfb12e943559095019490945585526068909252909220805460ff1916909217909155508061073f816125c0565b91505061054b565b506103e881146107a85760405162461bcd60e51b815260206004820152602660248201527f426f6e64436f6e74726f6c6c65723a20496e76616c6964207472616e63686520604482015265726174696f7360d01b6064820152608401610362565b4285116108055760405162461bcd60e51b815260206004820152602560248201527f426f6e64436f6e74726f6c6c65723a20496e76616c6964206d61747572697479604482015264206461746560d81b6064820152608401610362565b505042606955606a839055606d829055801561085c576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a15b50505050505050565b606b5460ff166108c25760405162461bcd60e51b815260206004820152602260248201527f426f6e64436f6e74726f6c6c65723a20426f6e64206973206e6f74206d617475604482015261726560f01b6064820152608401610362565b6001600160a01b03821660009081526068602052604090205460ff1661093a5760405162461bcd60e51b815260206004820152602760248201527f426f6e64436f6e74726f6c6c65723a20496e76616c6964207472616e636865206044820152666164647265737360c81b6064820152608401610362565b604051630e6dfcd560e01b81526001600160a01b03831690630e6dfcd59061096a9033908190869060040161236b565b600060405180830381600087803b15801561098457600080fd5b505af1158015610998573d6000803e3d6000fd5b5050505080606c60008282546109ae9190612579565b909155507f5e9473a427344c9398fd27f132e093a6582e7177334cb912336f3c17af206edb90503383836040516109e79392919061236b565b60405180910390a15050565b6033546001600160a01b03163314610a1d5760405162461bcd60e51b815260040161036290612471565b606b5460ff1615610a7f5760405162461bcd60e51b815260206004820152602660248201527f426f6e64436f6e74726f6c6c65723a20496e76616c69642063616c6c20746f2060448201526573657446656560d01b6064820152608401610362565b6032811115610ad05760405162461bcd60e51b815260206004820181905260248201527f426f6e64436f6e74726f6c6c65723a204e65772066656520746f6f20686967686044820152606401610362565b606e8190556040518181527f88258d7c1f0510045362f22cdeb36a2c501ef80d7a06168881189fb8480cfe2f9060200160405180910390a150565b6033546001600160a01b03163314610b355760405162461bcd60e51b815260040161036290612471565b610b3f6000611c08565b565b606b5460ff1615610b945760405162461bcd60e51b815260206004820152601e60248201527f426f6e64436f6e74726f6c6c65723a20416c7265616479206d617475726500006044820152606401610362565b6033546001600160a01b0316331480610bae575042606a54105b610c095760405162461bcd60e51b815260206004820152602660248201527f426f6e64436f6e74726f6c6c65723a20496e76616c69642063616c6c20746f206044820152656d617475726560d01b6064820152608401610362565b606b805460ff19166001179055606680546040805160208084028201810190925282815260009390929091849084015b82821015610c81576000848152602090819020604080518082019091526002850290910180546001600160a01b03168252600190810154828401529083529092019101610c39565b50506065546040516370a0823160e01b81523060048201529394506000936001600160a01b0390911692506370a08231915060240160206040518083038186803b158015610cce57600080fd5b505afa158015610ce2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d069190612265565b905060005b60018351610d199190612579565b81108015610d275750600082115b15610efc576000838281518110610d4e57634e487b7160e01b600052603260045260246000fd5b60200260200101516000015190506000610dd8826001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610d9a57600080fd5b505afa158015610dae573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd29190612265565b85611c5a565b9050610de48185612579565b606554909450610dfe906001600160a01b03168383611c72565b816001600160a01b0316630e6dfcd530610e206033546001600160a01b031690565b6040516370a0823160e01b81523060048201526001600160a01b038716906370a082319060240160206040518083038186803b158015610e5f57600080fd5b505afa158015610e73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e979190612265565b6040518463ffffffff1660e01b8152600401610eb59392919061236b565b600060405180830381600087803b158015610ecf57600080fd5b505af1158015610ee3573d6000803e3d6000fd5b5050505050508080610ef4906125c0565b915050610d0b565b5080156110435760008260018451610f149190612579565b81518110610f3257634e487b7160e01b600052603260045260246000fd5b602090810291909101015151606554909150610f58906001600160a01b03168284611c72565b806001600160a01b0316630e6dfcd530610f7a6033546001600160a01b031690565b6040516370a0823160e01b81523060048201526001600160a01b038616906370a082319060240160206040518083038186803b158015610fb957600080fd5b505afa158015610fcd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff19190612265565b6040518463ffffffff1660e01b815260040161100f9392919061236b565b600060405180830381600087803b15801561102957600080fd5b505af115801561103d573d6000803e3d6000fd5b50505050505b6040513381527f2eb828fdc16ef5c267a7b18c3f8edf180aaff1a8921c4fe994fef55ddc8abe60906020016109e7565b600081116110c35760405162461bcd60e51b815260206004820152601e60248201527f426f6e64436f6e74726f6c6c65723a20696e76616c696420616d6f756e7400006044820152606401610362565b606c54801515806110d957506402540be4008210155b6111345760405162461bcd60e51b815260206004820152602660248201527f426f6e64436f6e74726f6c6c65723a20696e76616c696420696e697469616c20604482015265185b5bdd5b9d60d21b6064820152608401610362565b606b5460ff16156111875760405162461bcd60e51b815260206004820152601e60248201527f426f6e64436f6e74726f6c6c65723a20416c7265616479206d617475726500006044820152606401610362565b6065546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b1580156111cb57600080fd5b505afa1580156111df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112039190612265565b9050606d54600014806112215750606d5461121e8483612522565b11155b61126d5760405162461bcd60e51b815260206004820152601d60248201527f426f6e64436f6e74726f6c6c65723a204465706f736974206c696d69740000006044820152606401610362565b60006066805480602002602001604051908101604052809291908181526020016000905b828210156112d9576000848152602090819020604080518082019091526002850290910180546001600160a01b03168252600190810154828401529083529092019101611291565b50505050905060008060675467ffffffffffffffff81111561130b57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611334578160200160208202803683370190505b50905060005b83518110156114035760006103e885838151811061136857634e487b7160e01b600052603260045260246000fd5b6020026020010151602001518961137f919061255a565b611389919061253a565b905060008611801561139b5750600087115b156113b857856113ab888361255a565b6113b5919061253a565b90505b6113c28185612522565b9350808383815181106113e557634e487b7160e01b600052603260045260246000fd5b602090810291909101015250806113fb816125c0565b91505061133a565b5081606c60008282546114169190612522565b9091555050606554611433906001600160a01b0316333089611d8d565b606e5460005b82518110156115dd57600083828151811061146457634e487b7160e01b600052603260045260246000fd5b602002602001015190506000612710848361147f919061255a565b611489919061253a565b9050801561151f578683815181106114b157634e487b7160e01b600052603260045260246000fd5b6020908102919091010151516040516340c10f1960e01b8152306004820152602481018390526001600160a01b03909116906340c10f1990604401600060405180830381600087803b15801561150657600080fd5b505af115801561151a573d6000803e3d6000fd5b505050505b86838151811061153f57634e487b7160e01b600052603260045260246000fd5b6020026020010151600001516001600160a01b03166340c10f196115603390565b61156a8486612579565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b1580156115b057600080fd5b505af11580156115c4573d6000803e3d6000fd5b50505050505080806115d5906125c0565b915050611439565b5060408051338152602081018990529081018290527f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a1590606001610853565b6033546001600160a01b031633146116465760405162461bcd60e51b815260040161036290612471565b6001600160a01b0381166116ab5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610362565b6116b481611c08565b50565b606b5460ff16156117195760405162461bcd60e51b815260206004820152602660248201527f426f6e64436f6e74726f6c6c65723a20426f6e6420697320616c7265616479206044820152656d617475726560d01b6064820152608401610362565b60006066805480602002602001604051908101604052809291908181526020016000905b82821015611785576000848152602090819020604080518082019091526002850290910180546001600160a01b0316825260019081015482840152908352909201910161173d565b50505050905080518251146117eb5760405162461bcd60e51b815260206004820152602660248201527f426f6e64436f6e74726f6c6c65723a20496e76616c69642072656465656d20616044820152656d6f756e747360d01b6064820152608401610362565b6000805b835181101561183f5783818151811061181857634e487b7160e01b600052603260045260246000fd5b60200260200101518261182b9190612522565b915080611837816125c0565b9150506117ef565b5060005b83518110156119f55782818151811061186c57634e487b7160e01b600052603260045260246000fd5b602002602001015160200151826103e886848151811061189c57634e487b7160e01b600052603260045260246000fd5b60200260200101516118ae919061255a565b6118b8919061253a565b146119165760405162461bcd60e51b815260206004820152602860248201527f426f6e64436f6e74726f6c6c65723a20496e76616c696420726564656d7074696044820152676f6e20726174696f60c01b6064820152608401610362565b82818151811061193657634e487b7160e01b600052603260045260246000fd5b6020026020010151600001516001600160a01b0316639dc29fac6119573390565b86848151811061197757634e487b7160e01b600052603260045260246000fd5b60200260200101516040518363ffffffff1660e01b81526004016119b09291906001600160a01b03929092168252602082015260400190565b600060405180830381600087803b1580156119ca57600080fd5b505af11580156119de573d6000803e3d6000fd5b5050505080806119ed906125c0565b915050611843565b506065546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b158015611a3a57600080fd5b505afa158015611a4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a729190612265565b90506000606c548284611a85919061255a565b611a8f919061253a565b905082606c6000828254611aa39190612579565b9091555050606554611abf906001600160a01b03163383611c72565b7f95a8789c26436cc55b5951f117195be05dfa3022c619a84c1449f83f9cf870683386604051611af092919061238f565b60405180910390a15050505050565b60008054610100900460ff1615611b46578160ff166001148015611b225750303b155b611b3e5760405162461bcd60e51b815260040161036290612423565b506000611b80565b60005460ff808416911610611b6d5760405162461bcd60e51b815260040161036290612423565b506000805460ff191660ff831617905560015b919050565b600054610100900460ff16611bac5760405162461bcd60e51b8152600401610362906124a6565b610b3f611eb9565b606083611bc18484611ee9565b604051602001611bd29291906122c5565b60405160208183030381529060405290509392505050565b606083611bf78484611ee9565b604051602001611bd292919061231b565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000818310611c695781611c6b565b825b9392505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1790529151600092839290871691611cce91906122a9565b6000604051808303816000865af19150503d8060008114611d0b576040519150601f19603f3d011682016040523d82523d6000602084013e611d10565b606091505b5091509150818015611d3a575080511580611d3a575080806020019051810190611d3a919061219d565b611d865760405162461bcd60e51b815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c4544006044820152606401610362565b5050505050565b600080856001600160a01b03166323b872dd868686604051602401611db49392919061236b565b6040516020818303038152906040529060e01b6020820180516001600160e01b038381831617835250505050604051611ded91906122a9565b6000604051808303816000865af19150503d8060008114611e2a576040519150601f19603f3d011682016040523d82523d6000602084013e611e2f565b606091505b5091509150818015611e59575080511580611e59575080806020019051810190611e59919061219d565b611eb15760405162461bcd60e51b8152602060048201526024808201527f5472616e7366657248656c7065723a205452414e534645525f46524f4d5f46416044820152631253115160e21b6064820152608401610362565b505050505050565b600054610100900460ff16611ee05760405162461bcd60e51b8152600401610362906124a6565b610b3f33611c08565b604080518082018252601981527f4142434445464748494a4b4c4d4e4f505152535455565758590000000000000060208201528151600180825281840190935260609260009190602082018180368337019050509050611f4a600185612579565b851415611f9357602d60f91b81600081518110611f7757634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350611ff7565b818581518110611fb357634e487b7160e01b600052603260045260246000fd5b602001015160f81c60f81b81600081518110611fdf57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053505b949350505050565b600082601f83011261200f578081fd5b8135602067ffffffffffffffff82111561202b5761202b6125f1565b8160051b61203a8282016124f1565b838152828101908684018388018501891015612054578687fd5b8693505b85841015612076578035835260019390930192918401918401612058565b50979650505050505050565b600060208284031215612093578081fd5b8135611c6b81612607565b6000602082840312156120af578081fd5b8151611c6b81612607565b60008060008060008060c087890312156120d2578182fd5b86356120dd81612607565b955060208701356120ed81612607565b945060408701356120fd81612607565b9350606087013567ffffffffffffffff811115612118578283fd5b61212489828a01611fff565b9350506080870135915060a087013590509295509295509295565b60008060408385031215612151578182fd5b823561215c81612607565b946020939093013593505050565b60006020828403121561217b578081fd5b813567ffffffffffffffff811115612191578182fd5b611ff784828501611fff565b6000602082840312156121ae578081fd5b81518015158114611c6b578182fd5b6000602082840312156121ce578081fd5b815167ffffffffffffffff808211156121e5578283fd5b818401915084601f8301126121f8578283fd5b81518181111561220a5761220a6125f1565b61221d601f8201601f19166020016124f1565b9150808252856020828501011115612233578384fd5b612244816020840160208601612590565b50949350505050565b60006020828403121561225e578081fd5b5035919050565b600060208284031215612276578081fd5b5051919050565b60008151808452612295816020860160208601612590565b601f01601f19169290920160200192915050565b600082516122bb818460208701612590565b9190910192915050565b60006d0213aba3a37b72a3930b731b432960951b825283516122ee81600e850160208801612590565b600160fd1b600e91840191820152835161230f81600f840160208801612590565b01600f01949350505050565b6000675452414e4348452d60c01b8252835161233e816008850160208801612590565b602d60f81b600891840191820152835161235f816009840160208801612590565b01600901949350505050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b038316815260406020808301829052835191830182905260009184820191906060850190845b818110156123d8578451835293830193918301916001016123bc565b5090979650505050505050565b6000606082526123f8606083018661227d565b828103602084015261240a818661227d565b91505060018060a01b0383166040830152949350505050565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b604051601f8201601f1916810167ffffffffffffffff8111828210171561251a5761251a6125f1565b604052919050565b60008219821115612535576125356125db565b500190565b60008261255557634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615612574576125746125db565b500290565b60008282101561258b5761258b6125db565b500390565b60005b838110156125ab578181015183820152602001612593565b838111156125ba576000848401525b50505050565b60006000198214156125d4576125d46125db565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146116b457600080fdfea26469706673582212204cabe8b296de4f5427a09b2b5306e8f086792d973fe69323cf400e4df44f87f764736f6c63430008030033", + "bytecode": "0x608060405234801561001057600080fd5b50613e7e806100206000396000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c80638da5cb5b116100d8578063c98c05b71161008c578063f2fde38b11610066578063f2fde38b14610309578063f9afb26a1461031c578063fc7b9c181461032f57610177565b8063c98c05b7146102ef578063d59624b4146102f7578063ecf708581461030057610177565b8063ae4e7fdf116100bd578063ae4e7fdf146102af578063b2016bd4146102bc578063b6b55f25146102dc57610177565b80638da5cb5b146102675780639f0205c7146102a657610177565b806333d20e341161012f57806369fe0e2d1161011457806369fe0e2d14610244578063715018a61461025757806387b652071461025f57610177565b806333d20e341461022857806359eb82241461023b57610177565b806324a9d8531161016057806324a9d853146101cb57806326c25962146101d45780632a76ef311461021357610177565b806305b344101461017c57806320e8e89e14610198575b600080fd5b61018560695481565b6040519081526020015b60405180910390f35b6101bb6101a6366004613864565b60686020526000908152604090205460ff1681565b604051901515815260200161018f565b610185606f5481565b6101e76101e2366004613a4d565b610338565b6040805173ffffffffffffffffffffffffffffffffffffffff909316835260208301919091520161018f565b61022661022136600461389c565b61037d565b005b610226610236366004613921565b610beb565b61018560675481565b610226610252366004613a4d565b610e4c565b610226611006565b610226611093565b60335473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161018f565b610185606d5481565b606b546101bb9060ff1681565b6065546102819073ffffffffffffffffffffffffffffffffffffffff1681565b6102266102ea366004613a4d565b611a1d565b610185612327565b610185606a5481565b610185606e5481565b610226610317366004613864565b612499565b61022661032a36600461394c565b6125c9565b610185606c5481565b6066818154811061034857600080fd5b60009182526020909120600290910201805460019091015473ffffffffffffffffffffffffffffffffffffffff909116915082565b600054610100900460ff1680610396575060005460ff16155b610427576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600054610100900460ff1615801561046657600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000166101011790555b73ffffffffffffffffffffffffffffffffffffffff8716610509576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f426f6e64436f6e74726f6c6c65723a20696e76616c6964207472616e6368654660448201527f6163746f72792061646472657373000000000000000000000000000000000000606482015260840161041e565b73ffffffffffffffffffffffffffffffffffffffff86166105ac576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f426f6e64436f6e74726f6c6c65723a20696e76616c696420636f6c6c6174657260448201527f616c546f6b656e20616464726573730000000000000000000000000000000000606482015260840161041e565b73ffffffffffffffffffffffffffffffffffffffff851661064f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f426f6e64436f6e74726f6c6c65723a20696e76616c69642061646d696e20616460448201527f6472657373000000000000000000000000000000000000000000000000000000606482015260840161041e565b601a845111156106e1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f426f6e64436f6e74726f6c6c65723a20696e76616c6964207472616e6368652060448201527f636f756e74000000000000000000000000000000000000000000000000000000606482015260840161041e565b6106e9612d6b565b6106f285612499565b8351606755606580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8816908117909155604080517f95d89b410000000000000000000000000000000000000000000000000000000081529051600092916395d89b419160048083019286929190829003018186803b15801561078b57600080fd5b505afa15801561079f573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526107e5919081019061399f565b90506000805b8651811015610a8257600087828151811061082f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015190506103e88111156108cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f426f6e64436f6e74726f6c6c65723a20496e76616c6964207472616e6368652060448201527f726174696f000000000000000000000000000000000000000000000000000000606482015260840161041e565b6108d58184613ce3565b925060008b73ffffffffffffffffffffffffffffffffffffffff1663ef55207c61090187868d51612e90565b61090d88878e51612ec7565b8e6040518463ffffffff1660e01b815260040161092c93929190613c48565b602060405180830381600087803b15801561094657600080fd5b505af115801561095a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097e9190613880565b60408051808201825273ffffffffffffffffffffffffffffffffffffffff92831680825260208083019687526066805460018082018355600092835294517f46501879b8ca8525e8c2fd519e2fbfcfa2ebea26501294aa02cbfcfb12e94354600290920291820180547fffffffffffffffffffffffff000000000000000000000000000000000000000016919098161790965596517f46501879b8ca8525e8c2fd519e2fbfcfa2ebea26501294aa02cbfcfb12e94355909501949094558552606890925290922080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169092179091555080610a7a81613db8565b9150506107eb565b506103e88114610b14576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f426f6e64436f6e74726f6c6c65723a20496e76616c6964207472616e6368652060448201527f726174696f730000000000000000000000000000000000000000000000000000606482015260840161041e565b428511610ba3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f426f6e64436f6e74726f6c6c65723a20496e76616c6964206d6174757269747960448201527f2064617465000000000000000000000000000000000000000000000000000000606482015260840161041e565b505042606955606a839055606e8290558015610be257600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff1690555b50505050505050565b606b5460ff16610c7d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f426f6e64436f6e74726f6c6c65723a20426f6e64206973206e6f74206d61747560448201527f7265000000000000000000000000000000000000000000000000000000000000606482015260840161041e565b73ffffffffffffffffffffffffffffffffffffffff821660009081526068602052604090205460ff16610d32576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f426f6e64436f6e74726f6c6c65723a20496e76616c6964207472616e6368652060448201527f6164647265737300000000000000000000000000000000000000000000000000606482015260840161041e565b73ffffffffffffffffffffffffffffffffffffffff8216630e6dfcd533336040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff92831660048201529116602482015260448101849052606401600060405180830381600087803b158015610dc457600080fd5b505af1158015610dd8573d6000803e3d6000fd5b5050505080606c6000828254610dee9190613d71565b90915550506040805133815273ffffffffffffffffffffffffffffffffffffffff8416602082015280820183905290517f5e9473a427344c9398fd27f132e093a6582e7177334cb912336f3c17af206edb9181900360600190a15050565b60335473ffffffffffffffffffffffffffffffffffffffff163314610ecd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161041e565b606b5460ff1615610f60576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f426f6e64436f6e74726f6c6c65723a20496e76616c69642063616c6c20746f2060448201527f7365744665650000000000000000000000000000000000000000000000000000606482015260840161041e565b6032811115610fcb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f426f6e64436f6e74726f6c6c65723a204e65772066656520746f6f2068696768604482015260640161041e565b606f8190556040518181527f88258d7c1f0510045362f22cdeb36a2c501ef80d7a06168881189fb8480cfe2f9060200160405180910390a150565b60335473ffffffffffffffffffffffffffffffffffffffff163314611087576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161041e565b6110916000612ee5565b565b6065546040517f1da24f3e00000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff1690631da24f3e9060240160206040518083038186803b1580156110fd57600080fd5b505afa158015611111573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111359190613a65565b9050606d54811115611245576065546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b1580156111ab57600080fd5b505afa1580156111bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111e39190613a65565b905060006111f4606d548385612f5c565b6065549091506112429073ffffffffffffffffffffffffffffffffffffffff1661123360335473ffffffffffffffffffffffffffffffffffffffff1690565b61123d8486613d71565b613051565b50505b606b5460ff16156112b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f426f6e64436f6e74726f6c6c65723a20416c7265616479206d61747572650000604482015260640161041e565b60335473ffffffffffffffffffffffffffffffffffffffff163314806112d9575042606a54105b611365576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f426f6e64436f6e74726f6c6c65723a20496e76616c69642063616c6c20746f2060448201527f6d61747572650000000000000000000000000000000000000000000000000000606482015260840161041e565b606b80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055606680546040805160208084028201810190925282815260009390929091849084015b828210156114085760008481526020908190206040805180820190915260028502909101805473ffffffffffffffffffffffffffffffffffffffff1682526001908101548284015290835290920191016113b3565b50506065546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015293945060009373ffffffffffffffffffffffffffffffffffffffff90911692506370a08231915060240160206040518083038186803b15801561147b57600080fd5b505afa15801561148f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114b39190613a65565b905060005b600183516114c69190613d71565b811080156114d45750600082115b15611758576000838281518110611514577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015160000151905060006115ab8273ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561156d57600080fd5b505afa158015611581573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a59190613a65565b856131e7565b90506115b78185613d71565b6065549094506115de9073ffffffffffffffffffffffffffffffffffffffff168383613051565b8173ffffffffffffffffffffffffffffffffffffffff16630e6dfcd53061161a60335473ffffffffffffffffffffffffffffffffffffffff1690565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8716906370a082319060240160206040518083038186803b15801561167f57600080fd5b505afa158015611693573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b79190613a65565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b16815273ffffffffffffffffffffffffffffffffffffffff93841660048201529290911660248301526044820152606401600060405180830381600087803b15801561172b57600080fd5b505af115801561173f573d6000803e3d6000fd5b505050505050808061175090613db8565b9150506114b8565b50801561194157600082600184516117709190613d71565b815181106117a7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020908102919091010151516065549091506117da9073ffffffffffffffffffffffffffffffffffffffff168284613051565b8073ffffffffffffffffffffffffffffffffffffffff16630e6dfcd53061181660335473ffffffffffffffffffffffffffffffffffffffff1690565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8616906370a082319060240160206040518083038186803b15801561187b57600080fd5b505afa15801561188f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118b39190613a65565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b16815273ffffffffffffffffffffffffffffffffffffffff93841660048201529290911660248301526044820152606401600060405180830381600087803b15801561192757600080fd5b505af115801561193b573d6000803e3d6000fd5b50505050505b6040805133815290517f2eb828fdc16ef5c267a7b18c3f8edf180aaff1a8921c4fe994fef55ddc8abe609181900360200190a150506065546040517f1da24f3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff90911690631da24f3e9060240160206040518083038186803b1580156119df57600080fd5b505afa1580156119f3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a179190613a65565b606d5550565b6065546040517f1da24f3e00000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff1690631da24f3e9060240160206040518083038186803b158015611a8757600080fd5b505afa158015611a9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611abf9190613a65565b9050606d54811115611bc0576065546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b158015611b3557600080fd5b505afa158015611b49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b6d9190613a65565b90506000611b7e606d548385612f5c565b606554909150611bbd9073ffffffffffffffffffffffffffffffffffffffff1661123360335473ffffffffffffffffffffffffffffffffffffffff1690565b50505b60008211611c2a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f426f6e64436f6e74726f6c6c65723a20696e76616c696420616d6f756e740000604482015260640161041e565b606b5460ff1615611c97576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f426f6e64436f6e74726f6c6c65723a20416c7265616479206d61747572650000604482015260640161041e565b6065546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b158015611d0157600080fd5b505afa158015611d15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d399190613a65565b9050606e5460001480611d575750606e54611d548483613ce3565b11155b611dbd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f426f6e64436f6e74726f6c6c65723a204465706f736974206c696d6974000000604482015260640161041e565b60006066805480602002602001604051908101604052809291908181526020016000905b82821015611e365760008481526020908190206040805180820190915260028502909101805473ffffffffffffffffffffffffffffffffffffffff168252600190810154828401529083529092019101611de1565b50505050905060008060675467ffffffffffffffff811115611e81577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611eaa578160200160208202803683370190505b50905060005b8351811015611fa55760006103e8858381518110611ef7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101516020015189611f0e9190613d34565b611f189190613cfb565b9050600086118015611f2c57506000606c54115b15611f4157611f3e81606c5488612f5c565b90505b611f4b8185613ce3565b935080838381518110611f87577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60209081029190910101525080611f9d81613db8565b915050611eb0565b5081606c6000828254611fb89190613ce3565b9091555050606554611fe29073ffffffffffffffffffffffffffffffffffffffff163330896131fd565b606f5460005b825181101561222f57600083828151811061202c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101519050600061271084836120479190613d34565b6120519190613cfb565b9050801561212657868381518110612092577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020908102919091010151516040517f40c10f190000000000000000000000000000000000000000000000000000000081523060048201526024810183905273ffffffffffffffffffffffffffffffffffffffff909116906340c10f1990604401600060405180830381600087803b15801561210d57600080fd5b505af1158015612121573d6000803e3d6000fd5b505050505b86838151811061215f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff166340c10f1961218d3390565b6121978486613d71565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff90921660048301526024820152604401600060405180830381600087803b15801561220257600080fd5b505af1158015612216573d6000803e3d6000fd5b505050505050808061222790613db8565b915050611fe8565b50604080513381526020810189905280820183905290517f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159181900360600190a161227861339c565b50506065546040517f1da24f3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff9091169350631da24f3e925060240190505b60206040518083038186803b1580156122e857600080fd5b505afa1580156122fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123209190613a65565b606d555050565b6065546040517f1da24f3e000000000000000000000000000000000000000000000000000000008152306004820152600091829173ffffffffffffffffffffffffffffffffffffffff90911690631da24f3e9060240160206040518083038186803b15801561239557600080fd5b505afa1580156123a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123cd9190613a65565b6065546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015291925060009173ffffffffffffffffffffffffffffffffffffffff909116906370a082319060240160206040518083038186803b15801561243c57600080fd5b505afa158015612450573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124749190613a65565b9050606d5482116124855780612492565b612492606d548284612f5c565b9250505090565b60335473ffffffffffffffffffffffffffffffffffffffff16331461251a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161041e565b73ffffffffffffffffffffffffffffffffffffffff81166125bd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161041e565b6125c681612ee5565b50565b6065546040517f1da24f3e00000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff1690631da24f3e9060240160206040518083038186803b15801561263357600080fd5b505afa158015612647573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061266b9190613a65565b9050606d5481111561276c576065546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b1580156126e157600080fd5b505afa1580156126f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127199190613a65565b9050600061272a606d548385612f5c565b6065549091506127699073ffffffffffffffffffffffffffffffffffffffff1661123360335473ffffffffffffffffffffffffffffffffffffffff1690565b50505b606b5460ff16156127ff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f426f6e64436f6e74726f6c6c65723a20426f6e6420697320616c72656164792060448201527f6d61747572650000000000000000000000000000000000000000000000000000606482015260840161041e565b60006066805480602002602001604051908101604052809291908181526020016000905b828210156128785760008481526020908190206040805180820190915260028502909101805473ffffffffffffffffffffffffffffffffffffffff168252600190810154828401529083529092019101612823565b505050509050805183511461290f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f426f6e64436f6e74726f6c6c65723a20496e76616c69642072656465656d206160448201527f6d6f756e74730000000000000000000000000000000000000000000000000000606482015260840161041e565b6000805b845181101561297c57848181518110612955577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151826129689190613ce3565b91508061297481613db8565b915050612913565b5060005b8451811015612bdf578281815181106129c2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015160200151826103e8878481518110612a0b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151612a1d9190613d34565b612a279190613cfb565b14612ab4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f426f6e64436f6e74726f6c6c65723a20496e76616c696420726564656d70746960448201527f6f6e20726174696f000000000000000000000000000000000000000000000000606482015260840161041e565b828181518110612aed577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff16639dc29fac612b1b3390565b878481518110612b54577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101516040518363ffffffff1660e01b8152600401612b9a92919073ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b600060405180830381600087803b158015612bb457600080fd5b505af1158015612bc8573d6000803e3d6000fd5b505050508080612bd790613db8565b915050612980565b506065546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b158015612c4a57600080fd5b505afa158015612c5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c829190613a65565b90506000612c938383606c54612f5c565b905082606c6000828254612ca79190613d71565b9091555050606554612cd09073ffffffffffffffffffffffffffffffffffffffff163383613051565b7f95a8789c26436cc55b5951f117195be05dfa3022c619a84c1449f83f9cf870683387604051612d01929190613be5565b60405180910390a1612d1161339c565b50506065546040517f1da24f3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff9091169250631da24f3e91506024016122d0565b600054610100900460ff1680612d84575060005460ff16155b612e10576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a6564000000000000000000000000000000000000606482015260840161041e565b600054610100900460ff16158015612e4f57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000166101011790555b612e57613433565b612e5f613547565b80156125c657600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff16905550565b606083612e9d8484613634565b604051602001612eae929190613ae3565b60405160208183030381529060405290505b9392505050565b606083612ed48484613634565b604051602001612eae929190613b64565b6033805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600080807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8587098587029250828110838203039150508060001415612fdc57838281612fd2577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b0492505050612ec0565b808411612fe857600080fd5b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905291516000928392908716916130e89190613ac7565b6000604051808303816000865af19150503d8060008114613125576040519150601f19603f3d011682016040523d82523d6000602084013e61312a565b606091505b5091509150818015613154575080511580613154575080806020019051810190613154919061397f565b6131e0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f5472616e7366657248656c7065723a3a736166655472616e736665723a20747260448201527f616e73666572206661696c656400000000000000000000000000000000000000606482015260840161041e565b5050505050565b60008183106131f65781612ec0565b5090919050565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052915160009283929088169161329c9190613ac7565b6000604051808303816000865af19150503d80600081146132d9576040519150601f19603f3d011682016040523d82523d6000602084013e6132de565b606091505b5091509150818015613308575080511580613308575080806020019051810190613308919061397f565b613394576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f5472616e7366657248656c7065723a3a7472616e7366657246726f6d3a20747260448201527f616e7366657246726f6d206661696c6564000000000000000000000000000000606482015260840161041e565b505050505050565b6402540be400606c541015611091576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f426f6e64436f6e74726f6c6c65723a204578706563746564206d696e696d756d60448201527f2076616c69642064656274000000000000000000000000000000000000000000606482015260840161041e565b600054610100900460ff168061344c575060005460ff16155b6134d8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a6564000000000000000000000000000000000000606482015260840161041e565b600054610100900460ff16158015612e5f57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661010117905580156125c657600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff16905550565b600054610100900460ff1680613560575060005460ff16155b6135ec576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a6564000000000000000000000000000000000000606482015260840161041e565b600054610100900460ff1615801561362b57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000166101011790555b612e5f33612ee5565b604080518082018252601981527f4142434445464748494a4b4c4d4e4f505152535455565758590000000000000060208201528151600180825281840190935260609260009190602082018180368337019050509050613695600185613d71565b85141561372b577f5a00000000000000000000000000000000000000000000000000000000000000816000815181106136f7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506137d9565b818581518110613764577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602001015160f81c60f81b816000815181106137a9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053505b949350505050565b600082601f8301126137f1578081fd5b8135602067ffffffffffffffff82111561380d5761380d613e20565b8160051b61381c828201613c94565b838152828101908684018388018501891015613836578687fd5b8693505b8584101561385857803583526001939093019291840191840161383a565b50979650505050505050565b600060208284031215613875578081fd5b8135612ec081613e4f565b600060208284031215613891578081fd5b8151612ec081613e4f565b60008060008060008060c087890312156138b4578182fd5b86356138bf81613e4f565b955060208701356138cf81613e4f565b945060408701356138df81613e4f565b9350606087013567ffffffffffffffff8111156138fa578283fd5b61390689828a016137e1565b9350506080870135915060a087013590509295509295509295565b60008060408385031215613933578182fd5b823561393e81613e4f565b946020939093013593505050565b60006020828403121561395d578081fd5b813567ffffffffffffffff811115613973578182fd5b6137d9848285016137e1565b600060208284031215613990578081fd5b81518015158114612ec0578182fd5b6000602082840312156139b0578081fd5b815167ffffffffffffffff808211156139c7578283fd5b818401915084601f8301126139da578283fd5b8151818111156139ec576139ec613e20565b613a1d60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601613c94565b9150808252856020828501011115613a33578384fd5b613a44816020840160208601613d88565b50949350505050565b600060208284031215613a5e578081fd5b5035919050565b600060208284031215613a76578081fd5b5051919050565b60008151808452613a95816020860160208601613d88565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60008251613ad9818460208701613d88565b9190910192915050565b60007f427574746f6e5472616e6368652000000000000000000000000000000000000082528351613b1b81600e850160208801613d88565b7f2000000000000000000000000000000000000000000000000000000000000000600e918401918201528351613b5881600f840160208801613d88565b01600f01949350505050565b60007f5452414e4348452d00000000000000000000000000000000000000000000000082528351613b9c816008850160208801613d88565b7f2d000000000000000000000000000000000000000000000000000000000000006008918401918201528351613bd9816009840160208801613d88565b01600901949350505050565b60006040820173ffffffffffffffffffffffffffffffffffffffff8516835260206040818501528185518084526060860191508287019350845b81811015613c3b57845183529383019391830191600101613c1f565b5090979650505050505050565b600060608252613c5b6060830186613a7d565b8281036020840152613c6d8186613a7d565b91505073ffffffffffffffffffffffffffffffffffffffff83166040830152949350505050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715613cdb57613cdb613e20565b604052919050565b60008219821115613cf657613cf6613df1565b500190565b600082613d2f577f4e487b710000000000000000000000000000000000000000000000000000000081526012600452602481fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613d6c57613d6c613df1565b500290565b600082821015613d8357613d83613df1565b500390565b60005b83811015613da3578181015183820152602001613d8b565b83811115613db2576000848401525b50505050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613dea57613dea613df1565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff811681146125c657600080fdfea164736f6c6343000803000a", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101775760003560e01c80638da5cb5b116100d8578063c98c05b71161008c578063f2fde38b11610066578063f2fde38b14610309578063f9afb26a1461031c578063fc7b9c181461032f57610177565b8063c98c05b7146102ef578063d59624b4146102f7578063ecf708581461030057610177565b8063ae4e7fdf116100bd578063ae4e7fdf146102af578063b2016bd4146102bc578063b6b55f25146102dc57610177565b80638da5cb5b146102675780639f0205c7146102a657610177565b806333d20e341161012f57806369fe0e2d1161011457806369fe0e2d14610244578063715018a61461025757806387b652071461025f57610177565b806333d20e341461022857806359eb82241461023b57610177565b806324a9d8531161016057806324a9d853146101cb57806326c25962146101d45780632a76ef311461021357610177565b806305b344101461017c57806320e8e89e14610198575b600080fd5b61018560695481565b6040519081526020015b60405180910390f35b6101bb6101a6366004613864565b60686020526000908152604090205460ff1681565b604051901515815260200161018f565b610185606f5481565b6101e76101e2366004613a4d565b610338565b6040805173ffffffffffffffffffffffffffffffffffffffff909316835260208301919091520161018f565b61022661022136600461389c565b61037d565b005b610226610236366004613921565b610beb565b61018560675481565b610226610252366004613a4d565b610e4c565b610226611006565b610226611093565b60335473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161018f565b610185606d5481565b606b546101bb9060ff1681565b6065546102819073ffffffffffffffffffffffffffffffffffffffff1681565b6102266102ea366004613a4d565b611a1d565b610185612327565b610185606a5481565b610185606e5481565b610226610317366004613864565b612499565b61022661032a36600461394c565b6125c9565b610185606c5481565b6066818154811061034857600080fd5b60009182526020909120600290910201805460019091015473ffffffffffffffffffffffffffffffffffffffff909116915082565b600054610100900460ff1680610396575060005460ff16155b610427576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600054610100900460ff1615801561046657600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000166101011790555b73ffffffffffffffffffffffffffffffffffffffff8716610509576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f426f6e64436f6e74726f6c6c65723a20696e76616c6964207472616e6368654660448201527f6163746f72792061646472657373000000000000000000000000000000000000606482015260840161041e565b73ffffffffffffffffffffffffffffffffffffffff86166105ac576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f426f6e64436f6e74726f6c6c65723a20696e76616c696420636f6c6c6174657260448201527f616c546f6b656e20616464726573730000000000000000000000000000000000606482015260840161041e565b73ffffffffffffffffffffffffffffffffffffffff851661064f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f426f6e64436f6e74726f6c6c65723a20696e76616c69642061646d696e20616460448201527f6472657373000000000000000000000000000000000000000000000000000000606482015260840161041e565b601a845111156106e1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f426f6e64436f6e74726f6c6c65723a20696e76616c6964207472616e6368652060448201527f636f756e74000000000000000000000000000000000000000000000000000000606482015260840161041e565b6106e9612d6b565b6106f285612499565b8351606755606580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8816908117909155604080517f95d89b410000000000000000000000000000000000000000000000000000000081529051600092916395d89b419160048083019286929190829003018186803b15801561078b57600080fd5b505afa15801561079f573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526107e5919081019061399f565b90506000805b8651811015610a8257600087828151811061082f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015190506103e88111156108cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f426f6e64436f6e74726f6c6c65723a20496e76616c6964207472616e6368652060448201527f726174696f000000000000000000000000000000000000000000000000000000606482015260840161041e565b6108d58184613ce3565b925060008b73ffffffffffffffffffffffffffffffffffffffff1663ef55207c61090187868d51612e90565b61090d88878e51612ec7565b8e6040518463ffffffff1660e01b815260040161092c93929190613c48565b602060405180830381600087803b15801561094657600080fd5b505af115801561095a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097e9190613880565b60408051808201825273ffffffffffffffffffffffffffffffffffffffff92831680825260208083019687526066805460018082018355600092835294517f46501879b8ca8525e8c2fd519e2fbfcfa2ebea26501294aa02cbfcfb12e94354600290920291820180547fffffffffffffffffffffffff000000000000000000000000000000000000000016919098161790965596517f46501879b8ca8525e8c2fd519e2fbfcfa2ebea26501294aa02cbfcfb12e94355909501949094558552606890925290922080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169092179091555080610a7a81613db8565b9150506107eb565b506103e88114610b14576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f426f6e64436f6e74726f6c6c65723a20496e76616c6964207472616e6368652060448201527f726174696f730000000000000000000000000000000000000000000000000000606482015260840161041e565b428511610ba3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f426f6e64436f6e74726f6c6c65723a20496e76616c6964206d6174757269747960448201527f2064617465000000000000000000000000000000000000000000000000000000606482015260840161041e565b505042606955606a839055606e8290558015610be257600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff1690555b50505050505050565b606b5460ff16610c7d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f426f6e64436f6e74726f6c6c65723a20426f6e64206973206e6f74206d61747560448201527f7265000000000000000000000000000000000000000000000000000000000000606482015260840161041e565b73ffffffffffffffffffffffffffffffffffffffff821660009081526068602052604090205460ff16610d32576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f426f6e64436f6e74726f6c6c65723a20496e76616c6964207472616e6368652060448201527f6164647265737300000000000000000000000000000000000000000000000000606482015260840161041e565b73ffffffffffffffffffffffffffffffffffffffff8216630e6dfcd533336040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff92831660048201529116602482015260448101849052606401600060405180830381600087803b158015610dc457600080fd5b505af1158015610dd8573d6000803e3d6000fd5b5050505080606c6000828254610dee9190613d71565b90915550506040805133815273ffffffffffffffffffffffffffffffffffffffff8416602082015280820183905290517f5e9473a427344c9398fd27f132e093a6582e7177334cb912336f3c17af206edb9181900360600190a15050565b60335473ffffffffffffffffffffffffffffffffffffffff163314610ecd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161041e565b606b5460ff1615610f60576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f426f6e64436f6e74726f6c6c65723a20496e76616c69642063616c6c20746f2060448201527f7365744665650000000000000000000000000000000000000000000000000000606482015260840161041e565b6032811115610fcb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f426f6e64436f6e74726f6c6c65723a204e65772066656520746f6f2068696768604482015260640161041e565b606f8190556040518181527f88258d7c1f0510045362f22cdeb36a2c501ef80d7a06168881189fb8480cfe2f9060200160405180910390a150565b60335473ffffffffffffffffffffffffffffffffffffffff163314611087576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161041e565b6110916000612ee5565b565b6065546040517f1da24f3e00000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff1690631da24f3e9060240160206040518083038186803b1580156110fd57600080fd5b505afa158015611111573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111359190613a65565b9050606d54811115611245576065546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b1580156111ab57600080fd5b505afa1580156111bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111e39190613a65565b905060006111f4606d548385612f5c565b6065549091506112429073ffffffffffffffffffffffffffffffffffffffff1661123360335473ffffffffffffffffffffffffffffffffffffffff1690565b61123d8486613d71565b613051565b50505b606b5460ff16156112b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f426f6e64436f6e74726f6c6c65723a20416c7265616479206d61747572650000604482015260640161041e565b60335473ffffffffffffffffffffffffffffffffffffffff163314806112d9575042606a54105b611365576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f426f6e64436f6e74726f6c6c65723a20496e76616c69642063616c6c20746f2060448201527f6d61747572650000000000000000000000000000000000000000000000000000606482015260840161041e565b606b80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055606680546040805160208084028201810190925282815260009390929091849084015b828210156114085760008481526020908190206040805180820190915260028502909101805473ffffffffffffffffffffffffffffffffffffffff1682526001908101548284015290835290920191016113b3565b50506065546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015293945060009373ffffffffffffffffffffffffffffffffffffffff90911692506370a08231915060240160206040518083038186803b15801561147b57600080fd5b505afa15801561148f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114b39190613a65565b905060005b600183516114c69190613d71565b811080156114d45750600082115b15611758576000838281518110611514577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015160000151905060006115ab8273ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561156d57600080fd5b505afa158015611581573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a59190613a65565b856131e7565b90506115b78185613d71565b6065549094506115de9073ffffffffffffffffffffffffffffffffffffffff168383613051565b8173ffffffffffffffffffffffffffffffffffffffff16630e6dfcd53061161a60335473ffffffffffffffffffffffffffffffffffffffff1690565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8716906370a082319060240160206040518083038186803b15801561167f57600080fd5b505afa158015611693573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b79190613a65565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b16815273ffffffffffffffffffffffffffffffffffffffff93841660048201529290911660248301526044820152606401600060405180830381600087803b15801561172b57600080fd5b505af115801561173f573d6000803e3d6000fd5b505050505050808061175090613db8565b9150506114b8565b50801561194157600082600184516117709190613d71565b815181106117a7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020908102919091010151516065549091506117da9073ffffffffffffffffffffffffffffffffffffffff168284613051565b8073ffffffffffffffffffffffffffffffffffffffff16630e6dfcd53061181660335473ffffffffffffffffffffffffffffffffffffffff1690565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8616906370a082319060240160206040518083038186803b15801561187b57600080fd5b505afa15801561188f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118b39190613a65565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b16815273ffffffffffffffffffffffffffffffffffffffff93841660048201529290911660248301526044820152606401600060405180830381600087803b15801561192757600080fd5b505af115801561193b573d6000803e3d6000fd5b50505050505b6040805133815290517f2eb828fdc16ef5c267a7b18c3f8edf180aaff1a8921c4fe994fef55ddc8abe609181900360200190a150506065546040517f1da24f3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff90911690631da24f3e9060240160206040518083038186803b1580156119df57600080fd5b505afa1580156119f3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a179190613a65565b606d5550565b6065546040517f1da24f3e00000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff1690631da24f3e9060240160206040518083038186803b158015611a8757600080fd5b505afa158015611a9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611abf9190613a65565b9050606d54811115611bc0576065546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b158015611b3557600080fd5b505afa158015611b49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b6d9190613a65565b90506000611b7e606d548385612f5c565b606554909150611bbd9073ffffffffffffffffffffffffffffffffffffffff1661123360335473ffffffffffffffffffffffffffffffffffffffff1690565b50505b60008211611c2a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f426f6e64436f6e74726f6c6c65723a20696e76616c696420616d6f756e740000604482015260640161041e565b606b5460ff1615611c97576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f426f6e64436f6e74726f6c6c65723a20416c7265616479206d61747572650000604482015260640161041e565b6065546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b158015611d0157600080fd5b505afa158015611d15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d399190613a65565b9050606e5460001480611d575750606e54611d548483613ce3565b11155b611dbd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f426f6e64436f6e74726f6c6c65723a204465706f736974206c696d6974000000604482015260640161041e565b60006066805480602002602001604051908101604052809291908181526020016000905b82821015611e365760008481526020908190206040805180820190915260028502909101805473ffffffffffffffffffffffffffffffffffffffff168252600190810154828401529083529092019101611de1565b50505050905060008060675467ffffffffffffffff811115611e81577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611eaa578160200160208202803683370190505b50905060005b8351811015611fa55760006103e8858381518110611ef7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101516020015189611f0e9190613d34565b611f189190613cfb565b9050600086118015611f2c57506000606c54115b15611f4157611f3e81606c5488612f5c565b90505b611f4b8185613ce3565b935080838381518110611f87577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60209081029190910101525080611f9d81613db8565b915050611eb0565b5081606c6000828254611fb89190613ce3565b9091555050606554611fe29073ffffffffffffffffffffffffffffffffffffffff163330896131fd565b606f5460005b825181101561222f57600083828151811061202c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101519050600061271084836120479190613d34565b6120519190613cfb565b9050801561212657868381518110612092577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020908102919091010151516040517f40c10f190000000000000000000000000000000000000000000000000000000081523060048201526024810183905273ffffffffffffffffffffffffffffffffffffffff909116906340c10f1990604401600060405180830381600087803b15801561210d57600080fd5b505af1158015612121573d6000803e3d6000fd5b505050505b86838151811061215f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff166340c10f1961218d3390565b6121978486613d71565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff90921660048301526024820152604401600060405180830381600087803b15801561220257600080fd5b505af1158015612216573d6000803e3d6000fd5b505050505050808061222790613db8565b915050611fe8565b50604080513381526020810189905280820183905290517f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159181900360600190a161227861339c565b50506065546040517f1da24f3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff9091169350631da24f3e925060240190505b60206040518083038186803b1580156122e857600080fd5b505afa1580156122fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123209190613a65565b606d555050565b6065546040517f1da24f3e000000000000000000000000000000000000000000000000000000008152306004820152600091829173ffffffffffffffffffffffffffffffffffffffff90911690631da24f3e9060240160206040518083038186803b15801561239557600080fd5b505afa1580156123a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123cd9190613a65565b6065546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015291925060009173ffffffffffffffffffffffffffffffffffffffff909116906370a082319060240160206040518083038186803b15801561243c57600080fd5b505afa158015612450573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124749190613a65565b9050606d5482116124855780612492565b612492606d548284612f5c565b9250505090565b60335473ffffffffffffffffffffffffffffffffffffffff16331461251a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161041e565b73ffffffffffffffffffffffffffffffffffffffff81166125bd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161041e565b6125c681612ee5565b50565b6065546040517f1da24f3e00000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff1690631da24f3e9060240160206040518083038186803b15801561263357600080fd5b505afa158015612647573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061266b9190613a65565b9050606d5481111561276c576065546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b1580156126e157600080fd5b505afa1580156126f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127199190613a65565b9050600061272a606d548385612f5c565b6065549091506127699073ffffffffffffffffffffffffffffffffffffffff1661123360335473ffffffffffffffffffffffffffffffffffffffff1690565b50505b606b5460ff16156127ff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f426f6e64436f6e74726f6c6c65723a20426f6e6420697320616c72656164792060448201527f6d61747572650000000000000000000000000000000000000000000000000000606482015260840161041e565b60006066805480602002602001604051908101604052809291908181526020016000905b828210156128785760008481526020908190206040805180820190915260028502909101805473ffffffffffffffffffffffffffffffffffffffff168252600190810154828401529083529092019101612823565b505050509050805183511461290f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f426f6e64436f6e74726f6c6c65723a20496e76616c69642072656465656d206160448201527f6d6f756e74730000000000000000000000000000000000000000000000000000606482015260840161041e565b6000805b845181101561297c57848181518110612955577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151826129689190613ce3565b91508061297481613db8565b915050612913565b5060005b8451811015612bdf578281815181106129c2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015160200151826103e8878481518110612a0b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151612a1d9190613d34565b612a279190613cfb565b14612ab4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f426f6e64436f6e74726f6c6c65723a20496e76616c696420726564656d70746960448201527f6f6e20726174696f000000000000000000000000000000000000000000000000606482015260840161041e565b828181518110612aed577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff16639dc29fac612b1b3390565b878481518110612b54577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101516040518363ffffffff1660e01b8152600401612b9a92919073ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b600060405180830381600087803b158015612bb457600080fd5b505af1158015612bc8573d6000803e3d6000fd5b505050508080612bd790613db8565b915050612980565b506065546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b158015612c4a57600080fd5b505afa158015612c5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c829190613a65565b90506000612c938383606c54612f5c565b905082606c6000828254612ca79190613d71565b9091555050606554612cd09073ffffffffffffffffffffffffffffffffffffffff163383613051565b7f95a8789c26436cc55b5951f117195be05dfa3022c619a84c1449f83f9cf870683387604051612d01929190613be5565b60405180910390a1612d1161339c565b50506065546040517f1da24f3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff9091169250631da24f3e91506024016122d0565b600054610100900460ff1680612d84575060005460ff16155b612e10576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a6564000000000000000000000000000000000000606482015260840161041e565b600054610100900460ff16158015612e4f57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000166101011790555b612e57613433565b612e5f613547565b80156125c657600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff16905550565b606083612e9d8484613634565b604051602001612eae929190613ae3565b60405160208183030381529060405290505b9392505050565b606083612ed48484613634565b604051602001612eae929190613b64565b6033805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600080807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8587098587029250828110838203039150508060001415612fdc57838281612fd2577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b0492505050612ec0565b808411612fe857600080fd5b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905291516000928392908716916130e89190613ac7565b6000604051808303816000865af19150503d8060008114613125576040519150601f19603f3d011682016040523d82523d6000602084013e61312a565b606091505b5091509150818015613154575080511580613154575080806020019051810190613154919061397f565b6131e0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f5472616e7366657248656c7065723a3a736166655472616e736665723a20747260448201527f616e73666572206661696c656400000000000000000000000000000000000000606482015260840161041e565b5050505050565b60008183106131f65781612ec0565b5090919050565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052915160009283929088169161329c9190613ac7565b6000604051808303816000865af19150503d80600081146132d9576040519150601f19603f3d011682016040523d82523d6000602084013e6132de565b606091505b5091509150818015613308575080511580613308575080806020019051810190613308919061397f565b613394576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f5472616e7366657248656c7065723a3a7472616e7366657246726f6d3a20747260448201527f616e7366657246726f6d206661696c6564000000000000000000000000000000606482015260840161041e565b505050505050565b6402540be400606c541015611091576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f426f6e64436f6e74726f6c6c65723a204578706563746564206d696e696d756d60448201527f2076616c69642064656274000000000000000000000000000000000000000000606482015260840161041e565b600054610100900460ff168061344c575060005460ff16155b6134d8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a6564000000000000000000000000000000000000606482015260840161041e565b600054610100900460ff16158015612e5f57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661010117905580156125c657600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff16905550565b600054610100900460ff1680613560575060005460ff16155b6135ec576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a6564000000000000000000000000000000000000606482015260840161041e565b600054610100900460ff1615801561362b57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000166101011790555b612e5f33612ee5565b604080518082018252601981527f4142434445464748494a4b4c4d4e4f505152535455565758590000000000000060208201528151600180825281840190935260609260009190602082018180368337019050509050613695600185613d71565b85141561372b577f5a00000000000000000000000000000000000000000000000000000000000000816000815181106136f7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506137d9565b818581518110613764577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602001015160f81c60f81b816000815181106137a9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053505b949350505050565b600082601f8301126137f1578081fd5b8135602067ffffffffffffffff82111561380d5761380d613e20565b8160051b61381c828201613c94565b838152828101908684018388018501891015613836578687fd5b8693505b8584101561385857803583526001939093019291840191840161383a565b50979650505050505050565b600060208284031215613875578081fd5b8135612ec081613e4f565b600060208284031215613891578081fd5b8151612ec081613e4f565b60008060008060008060c087890312156138b4578182fd5b86356138bf81613e4f565b955060208701356138cf81613e4f565b945060408701356138df81613e4f565b9350606087013567ffffffffffffffff8111156138fa578283fd5b61390689828a016137e1565b9350506080870135915060a087013590509295509295509295565b60008060408385031215613933578182fd5b823561393e81613e4f565b946020939093013593505050565b60006020828403121561395d578081fd5b813567ffffffffffffffff811115613973578182fd5b6137d9848285016137e1565b600060208284031215613990578081fd5b81518015158114612ec0578182fd5b6000602082840312156139b0578081fd5b815167ffffffffffffffff808211156139c7578283fd5b818401915084601f8301126139da578283fd5b8151818111156139ec576139ec613e20565b613a1d60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601613c94565b9150808252856020828501011115613a33578384fd5b613a44816020840160208601613d88565b50949350505050565b600060208284031215613a5e578081fd5b5035919050565b600060208284031215613a76578081fd5b5051919050565b60008151808452613a95816020860160208601613d88565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60008251613ad9818460208701613d88565b9190910192915050565b60007f427574746f6e5472616e6368652000000000000000000000000000000000000082528351613b1b81600e850160208801613d88565b7f2000000000000000000000000000000000000000000000000000000000000000600e918401918201528351613b5881600f840160208801613d88565b01600f01949350505050565b60007f5452414e4348452d00000000000000000000000000000000000000000000000082528351613b9c816008850160208801613d88565b7f2d000000000000000000000000000000000000000000000000000000000000006008918401918201528351613bd9816009840160208801613d88565b01600901949350505050565b60006040820173ffffffffffffffffffffffffffffffffffffffff8516835260206040818501528185518084526060860191508287019350845b81811015613c3b57845183529383019391830191600101613c1f565b5090979650505050505050565b600060608252613c5b6060830186613a7d565b8281036020840152613c6d8186613a7d565b91505073ffffffffffffffffffffffffffffffffffffffff83166040830152949350505050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715613cdb57613cdb613e20565b604052919050565b60008219821115613cf657613cf6613df1565b500190565b600082613d2f577f4e487b710000000000000000000000000000000000000000000000000000000081526012600452602481fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613d6c57613d6c613df1565b500290565b600082821015613d8357613d83613df1565b500390565b60005b83811015613da3578181015183820152602001613d8b565b83811115613db2576000848401525b50505050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613dea57613dea613df1565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff811681146125c657600080fdfea164736f6c6343000803000a", "linkReferences": {}, "deployedLinkReferences": {} } diff --git a/spot-contracts/hardhat.config.ts b/spot-contracts/hardhat.config.ts index e0f1fb42..45427cc3 100644 --- a/spot-contracts/hardhat.config.ts +++ b/spot-contracts/hardhat.config.ts @@ -1,7 +1,7 @@ import { HardhatUserConfig } from "hardhat/config"; import { Wallet } from "ethers"; -import "@nomiclabs/hardhat-ethers"; +import "@nomicfoundation/hardhat-ethers"; import "@nomicfoundation/hardhat-chai-matchers"; import "@nomicfoundation/hardhat-verify"; import "@openzeppelin/hardhat-upgrades"; @@ -53,7 +53,7 @@ export default { settings: { optimizer: { enabled: true, - runs: 750, + runs: 50, }, }, }, diff --git a/spot-contracts/package.json b/spot-contracts/package.json index 28a57f1d..5e4483df 100644 --- a/spot-contracts/package.json +++ b/spot-contracts/package.json @@ -16,22 +16,21 @@ "test": "yarn hardhat test test/*.ts test/**/*.ts" }, "dependencies": { - "@openzeppelin/contracts-upgradeable": "^4.7.3" + "@openzeppelin/contracts-upgradeable": "4.7.3" }, "devDependencies": { - "@defi-wonderland/smock": "^2.3.4", "@ethersproject/abi": "^5.6.4", "@ethersproject/abstract-provider": "^5.7.0", "@ethersproject/abstract-signer": "^5.7.0", "@ethersproject/bytes": "^5.6.1", "@ethersproject/providers": "^5.6.8", - "@nomicfoundation/hardhat-chai-matchers": "^1.0.6", - "@nomicfoundation/hardhat-verify": "^1.1.0", - "@nomiclabs/hardhat-ethers": "^2.2.1", - "@nomiclabs/hardhat-waffle": "^2.0.3", - "@openzeppelin/hardhat-upgrades": "^1.19.0", + "@nomicfoundation/hardhat-chai-matchers": "latest", + "@nomicfoundation/hardhat-ethers": "^3.0.0", + "@nomicfoundation/hardhat-verify": "latest", + "@nomiclabs/hardhat-waffle": "^2.0.6", + "@openzeppelin/hardhat-upgrades": "^3.0.4", "@openzeppelin/upgrades-core": "latest", - "@typechain/ethers-v5": "^10.1.0", + "@typechain/ethers-v6": "^0.5.1", "@typechain/hardhat": "^6.1.2", "@types/chai": "^4.3.1", "@types/mocha": "^9.1.1", @@ -51,11 +50,12 @@ "eslint-plugin-prettier": "^4.2.1", "eslint-plugin-promise": "^6.0.0", "eslint-plugin-unused-imports": "^3.0.0", - "ethereum-waffle": "^3.4.4", - "ethers": "^5.6.9", - "ganache-cli": "^6.12.2", - "hardhat": "^2.19.4", - "hardhat-gas-reporter": "^1.0.9", + "ethereum-waffle": "latest", + "ethers": "^6.6.0", + "ethers-v5": "npm:ethers@^5.7.0", + "ganache-cli": "latest", + "hardhat": "^2.23.0", + "hardhat-gas-reporter": "latest", "lodash": "^4.17.21", "prettier": "^2.7.1", "prettier-plugin-solidity": "^1.0.0-dev.23", @@ -66,6 +66,6 @@ "typescript": "^4.7.4" }, "engines": { - "node": ">=16.0.0" + "node": ">=20.0.0" } } diff --git a/spot-contracts/tasks/deploy/ampl.ts b/spot-contracts/tasks/deploy/ampl.ts index ffa00829..df245c3b 100644 --- a/spot-contracts/tasks/deploy/ampl.ts +++ b/spot-contracts/tasks/deploy/ampl.ts @@ -12,7 +12,6 @@ task("deploy:MockAMPL") const UFragments = await getContractFactoryFromExternalArtifacts(hre.ethers, "UFragments"); const ampl = (await UFragments.connect(signer).deploy()).connect(signer); - await ampl.deployed(); const tx1 = await ampl["initialize(address)"](signerAddress); await tx1.wait(); @@ -23,7 +22,7 @@ task("deploy:MockAMPL") if (args.verify) { try { await hre.run("verify:contract", { - address: ampl.address, + address: ampl.target, }); } catch (e) { console.log("Unable to verify on etherscan", e); @@ -32,5 +31,5 @@ task("deploy:MockAMPL") console.log("Skipping verification"); } - console.log("AMPL", ampl.address); + console.log("AMPL", ampl.target); }); diff --git a/spot-contracts/tasks/deploy/buttonwood.ts b/spot-contracts/tasks/deploy/buttonwood.ts index c2e1693b..55cf8220 100644 --- a/spot-contracts/tasks/deploy/buttonwood.ts +++ b/spot-contracts/tasks/deploy/buttonwood.ts @@ -11,23 +11,20 @@ task("deploy:BondFactory") console.log("Signer", await (await hre.ethers.getSigners())[0].getAddress()); const BondController = await getContractFactoryFromExternalArtifacts(hre.ethers, "BondController"); const bondController = await BondController.deploy(); - await bondController.deployed(); - console.log("Bond controller", bondController.address); + console.log("Bond controller", bondController.target); const Tranche = await getContractFactoryFromExternalArtifacts(hre.ethers, "Tranche"); const tranche = await Tranche.deploy(); - await tranche.deployed(); - console.log("Tranche", tranche.address); + console.log("Tranche", tranche.target); const TrancheFactory = await getContractFactoryFromExternalArtifacts(hre.ethers, "TrancheFactory"); - const trancheFactory = await TrancheFactory.deploy(tranche.address); - await trancheFactory.deployed(); - console.log("Tranche Factory", trancheFactory.address); + const trancheFactory = await TrancheFactory.deploy(tranche.target); + console.log("Tranche Factory", trancheFactory.target); await tranche["init(string,string,address,address)"]("IMPLEMENTATION", "IMPL", DUMMY_ADDRESS, DUMMY_ADDRESS); await bondController.init( - trancheFactory.address, - tranche.address, + trancheFactory.target, + tranche.target, DUMMY_ADDRESS, [200, 300, 500], hre.ethers.constants.MaxUint256, @@ -35,22 +32,21 @@ task("deploy:BondFactory") ); const BondFactory = await getContractFactoryFromExternalArtifacts(hre.ethers, "BondFactory"); - const bondFactory = await BondFactory.deploy(bondController.address, trancheFactory.address); - await bondFactory.deployed(); - console.log("Bond Factory", bondFactory.address); + const bondFactory = await BondFactory.deploy(bondController.target, trancheFactory.target); + console.log("Bond Factory", bondFactory.target); if (args.verify) { try { - await hre.run("verify:Template", { address: bondController.address }); - await hre.run("verify:Template", { address: tranche.address }); + await hre.run("verify:Template", { address: bondController.target }); + await hre.run("verify:Template", { address: tranche.target }); await hre.run("verify:TrancheFactory", { - address: trancheFactory.address, - template: tranche.address, + address: trancheFactory.target, + template: tranche.target, }); await hre.run("verify:BondFactory", { - address: bondFactory.address, - template: bondController.address, - trancheFactory: trancheFactory.address, + address: bondFactory.target, + template: bondController.target, + trancheFactory: trancheFactory.target, }); } catch (e) { console.log("Unable to verify on etherscan", e); diff --git a/spot-contracts/tasks/deploy/perp.ts b/spot-contracts/tasks/deploy/perp.ts index b6e3f5c6..b6a83251 100644 --- a/spot-contracts/tasks/deploy/perp.ts +++ b/spot-contracts/tasks/deploy/perp.ts @@ -42,14 +42,14 @@ task("deploy:BondIssuer") if (verify) { await sleep(30); await hre.run("verify:contract", { - address: bondIssuer.address, + address: bondIssuer.target, constructorArguments: [bondFactoryAddress, collateralTokenAddress], }); } else { console.log("Skipping verification"); } - console.log("Bond issuer", bondIssuer.address); + console.log("Bond issuer", bondIssuer.target); }); task("deploy:PerpSystem") @@ -67,19 +67,16 @@ task("deploy:PerpSystem") const FeePolicy = await hre.ethers.getContractFactory("FeePolicy"); const feePolicy = await hre.upgrades.deployProxy(FeePolicy.connect(deployer)); - await feePolicy.deployed(); const PerpetualTranche = await hre.ethers.getContractFactory("PerpetualTranche"); const perp = await hre.upgrades.deployProxy(PerpetualTranche.connect(deployer)); - await perp.deployed(); const RolloverVault = await hre.ethers.getContractFactory("RolloverVault"); const vault = await hre.upgrades.deployProxy(RolloverVault.connect(deployer)); - await vault.deployed(); - console.log("perp", perp.address); - console.log("vault", vault.address); - console.log("feePolicy", feePolicy.address); + console.log("perp", perp.target); + console.log("vault", vault.target); + console.log("feePolicy", feePolicy.target); console.log("fee policy init"); await (await feePolicy.init()).wait(); @@ -90,32 +87,32 @@ task("deploy:PerpSystem") perpSymbol, collateralTokenAddress, bondIssuerAddress, - feePolicy.address, + feePolicy.target, ); await perpInitTx.wait(); console.log("vault init"); - const vaultInitTx = await vault.init(vaultName, vaultSymbol, perp.address, feePolicy.address); + const vaultInitTx = await vault.init(vaultName, vaultSymbol, perp.target, feePolicy.target); await vaultInitTx.wait(); console.log("point perp to vault"); - await (await perp.updateVault(vault.address)).wait(); + await (await perp.updateVault(vault.target)).wait(); if (verify) { await sleep(30); // We just need to verify the proxy once await hre.run("verify:contract", { - address: feePolicy.address, + address: feePolicy.target, }); // Verifying implementations await hre.run("verify:contract", { - address: await getImplementationAddress(hre.ethers.provider, feePolicy.address), + address: await getImplementationAddress(hre.ethers.provider, feePolicy.target), }); await hre.run("verify:contract", { - address: await getImplementationAddress(hre.ethers.provider, perp.address), + address: await getImplementationAddress(hre.ethers.provider, perp.target), }); await hre.run("verify:contract", { - address: await getImplementationAddress(hre.ethers.provider, vault.address), + address: await getImplementationAddress(hre.ethers.provider, vault.target), }); } else { console.log("Skipping verification"); @@ -129,13 +126,12 @@ task("deploy:Router") const RouterV2 = await hre.ethers.getContractFactory("RouterV2"); const router = await RouterV2.deploy(); - await router.deployed(); - console.log("RouterV2", router.address); + console.log("RouterV2", router.target); if (args.verify) { await sleep(30); await hre.run("verify:contract", { - address: router.address, + address: router.target, }); } else { console.log("Skipping verification"); @@ -152,16 +148,15 @@ task("deploy:FeePolicy") const feePolicy = await hre.upgrades.deployProxy(FeePolicy.connect(deployer), [], { initializer: "init()", }); - await feePolicy.deployed(); - console.log("feePolicy", feePolicy.address); + console.log("feePolicy", feePolicy.target); if (args.verify) { await sleep(30); await hre.run("verify:contract", { - address: feePolicy.address, + address: feePolicy.target, }); await hre.run("verify:contract", { - address: await getImplementationAddress(hre.ethers.provider, feePolicy.address), + address: await getImplementationAddress(hre.ethers.provider, feePolicy.target), }); } else { console.log("Skipping verification"); diff --git a/spot-contracts/tasks/deploy/vaults.ts b/spot-contracts/tasks/deploy/vaults.ts index 436d80bc..c3fa503e 100644 --- a/spot-contracts/tasks/deploy/vaults.ts +++ b/spot-contracts/tasks/deploy/vaults.ts @@ -15,12 +15,11 @@ task("deploy:RolloverVault") const RolloverVault = await hre.ethers.getContractFactory("RolloverVault"); const vault = await hre.upgrades.deployProxy(RolloverVault.connect(deployer)); - await vault.deployed(); - const implAddress = await getImplementationAddress(hre.ethers.provider, vault.address); + const implAddress = await getImplementationAddress(hre.ethers.provider, vault.target); console.log("perp", perpAddress); - console.log("vault", vault.address); + console.log("vault", vault.target); console.log("vaultImpl", implAddress); const initTx = await vault.init(name, symbol, perpAddress); diff --git a/spot-contracts/tasks/ops/perp.ts b/spot-contracts/tasks/ops/perp.ts index b3fc6569..f9a85970 100644 --- a/spot-contracts/tasks/ops/perp.ts +++ b/spot-contracts/tasks/ops/perp.ts @@ -1,7 +1,6 @@ import { getAdminAddress, getImplementationAddress } from "@openzeppelin/upgrades-core"; import { task, types } from "hardhat/config"; import { TaskArguments } from "hardhat/types"; -import { utils } from "ethers"; task("ops:perp:info") .addPositionalParam("perpAddress", "the address of the perp contract", undefined, types.string, false) @@ -13,90 +12,90 @@ task("ops:perp:info") const percDecimals = await perp.PERC_DECIMALS(); const bondIssuer = await hre.ethers.getContractAt("BondIssuer", await perp.bondIssuer()); - const latestBond = await hre.ethers.getContractAt("IBondController", await bondIssuer.callStatic.getLatestBond()); + const latestBond = await hre.ethers.getContractAt("IBondController", await bondIssuer.getLatestBond.staticCall()); const collateralToken = await hre.ethers.getContractAt("MockERC20", await perp.underlying()); const feePolicy = await hre.ethers.getContractAt("FeePolicy", await perp.feePolicy()); - const depositBond = await hre.ethers.getContractAt("IBondController", await perp.callStatic.getDepositBond()); - const issued = (await hre.ethers.provider.getCode(depositBond.address)) !== "0x"; + const depositBond = await hre.ethers.getContractAt("IBondController", await perp.getDepositBond.staticCall()); + const issued = (await hre.ethers.provider.getCode(depositBond.target)) !== "0x"; const perpSupply = await perp.totalSupply(); - const perpTVL = await perp.callStatic.getTVL(); - const perpPrice = perpSupply.gt("0") ? perpTVL.mul(1000).div(perpSupply) : 0; + const perpTVL = await perp.getTVL.staticCall(); + const perpPrice = perpSupply > 0n ? (perpTVL * 1000n) / perpSupply : 0; const proxyAdminAddress = await getAdminAddress(hre.ethers.provider, perpAddress); const implAddress = await getImplementationAddress(hre.ethers.provider, perpAddress); console.log("---------------------------------------------------------------"); - console.log("BondIssuer:", bondIssuer.address); + console.log("BondIssuer:", bondIssuer.target); console.log("bondFactory:", await bondIssuer.bondFactory()); console.log("collateral:", await bondIssuer.collateral()); - console.log("issuedCount:", utils.formatUnits(await bondIssuer.issuedCount()), 0); - console.log("maxMaturityDuration:", utils.formatUnits(await bondIssuer.maxMaturityDuration(), 0)); - console.log("minIssueTimeIntervalSec:", utils.formatUnits(await bondIssuer.minIssueTimeIntervalSec(), 0)); - console.log("issueWindowOffsetSec:", utils.formatUnits(await bondIssuer.issueWindowOffsetSec(), 0)); + console.log("issuedCount:", hre.ethers.formatUnits(await bondIssuer.issuedCount()), 0); + console.log("maxMaturityDuration:", hre.ethers.formatUnits(await bondIssuer.maxMaturityDuration(), 0)); + console.log("minIssueTimeIntervalSec:", hre.ethers.formatUnits(await bondIssuer.minIssueTimeIntervalSec(), 0)); + console.log("issueWindowOffsetSec:", hre.ethers.formatUnits(await bondIssuer.issueWindowOffsetSec(), 0)); let i = 0; while (true) { try { - console.log(`trancheRatios(${i}):`, utils.formatUnits(await bondIssuer.trancheRatios(i), 3)); + console.log(`trancheRatios(${i}):`, hre.ethers.formatUnits(await bondIssuer.trancheRatios(i), 3)); i++; } catch (e) { break; } } - console.log("lastIssueWindowTimestamp:", utils.formatUnits(await bondIssuer.lastIssueWindowTimestamp(), 0)); - console.log("latestBond:", latestBond.address); + console.log("lastIssueWindowTimestamp:", hre.ethers.formatUnits(await bondIssuer.lastIssueWindowTimestamp(), 0)); + console.log("latestBond:", latestBond.target); console.log("---------------------------------------------------------------"); - console.log("feePolicy:", feePolicy.address); + console.log("feePolicy:", feePolicy.target); console.log("owner", await feePolicy.owner()); - console.log("perpMintFeePerc:", utils.formatUnits(await feePolicy.perpMintFeePerc(), percDecimals)); - console.log("perpBurnFeePerc:", utils.formatUnits(await feePolicy.perpBurnFeePerc(), percDecimals)); + console.log("perpMintFeePerc:", hre.ethers.formatUnits(await feePolicy.perpMintFeePerc(), percDecimals)); + console.log("perpBurnFeePerc:", hre.ethers.formatUnits(await feePolicy.perpBurnFeePerc(), percDecimals)); const r = await feePolicy.perpRolloverFee(); - console.log("perpRolloverFeeLower:", utils.formatUnits(r.lower, percDecimals)); - console.log("perpRolloverFeeUpper:", utils.formatUnits(r.upper, percDecimals)); - console.log("perpRolloverFeeGrowth:", utils.formatUnits(r.growth, percDecimals)); + console.log("minRolloverFeePerc:", hre.ethers.formatUnits(r.minRolloverFeePerc, percDecimals)); + console.log("perpDebasementSlope:", hre.ethers.formatUnits(r.perpDebasementSlope, percDecimals)); + console.log("perpEnrichmentSlope:", hre.ethers.formatUnits(r.perpEnrichmentSlope, percDecimals)); console.log("---------------------------------------------------------------"); - console.log("PerpetualTranche:", perp.address); + console.log("PerpetualTranche:", perp.target); console.log("proxyAdmin:", proxyAdminAddress); console.log("implementation:", implAddress); console.log("owner:", await perp.owner()); console.log("keeper:", await perp.keeper()); console.log("paused:", await perp.paused()); - console.log("collateralToken:", collateralToken.address); + console.log("collateralToken:", collateralToken.target); console.log("---------------------------------------------------------------"); console.log(`maturityTolarance: [${await perp.minTrancheMaturitySec()}, ${await perp.maxTrancheMaturitySec()}]`); - console.log("maxSupply:", utils.formatUnits(await perp.maxSupply(), await perp.decimals())); + console.log("maxSupply:", hre.ethers.formatUnits(await perp.maxSupply(), await perp.decimals())); console.log( "maxDepositTrancheValuePerc:", - utils.formatUnits(await perp.maxDepositTrancheValuePerc(), percDecimals), + hre.ethers.formatUnits(await perp.maxDepositTrancheValuePerc(), percDecimals), ); console.log("---------------------------------------------------------------"); - console.log("depositBond:", depositBond.address); + console.log("depositBond:", depositBond.target); console.log("issued:", issued); - console.log("TotalSupply:", utils.formatUnits(perpSupply, perpDecimals)); - console.log("TVL:", utils.formatUnits(perpTVL, perpDecimals)); - console.log("deviationRatio:", utils.formatUnits(await perp.callStatic.deviationRatio(), percDecimals)); + console.log("TotalSupply:", hre.ethers.formatUnits(perpSupply, perpDecimals)); + console.log("TVL:", hre.ethers.formatUnits(perpTVL, perpDecimals)); + console.log("deviationRatio:", hre.ethers.formatUnits(await perp.deviationRatio.staticCall(), percDecimals)); console.log("---------------------------------------------------------------"); console.log("Reserve:"); - const reserveCount = (await perp.callStatic.getReserveCount()).toNumber(); - const upForRollover = await perp.callStatic.getReserveTokensUpForRollover(); + const reserveCount = await perp.getReserveCount.staticCall(); + const upForRollover = await perp.getReserveTokensUpForRollover.staticCall(); const data = []; for (let i = 0; i < reserveCount; i++) { - const tokenAddress = await perp.callStatic.getReserveAt(i); - const balance = await perp.callStatic.getReserveTokenBalance(tokenAddress); - const value = await perp.callStatic.getReserveTokenValue(tokenAddress); - const price = balance.gt("0") ? value.mul(1000).div(balance) : 0; + const tokenAddress = await perp.getReserveAt.staticCall(i); + const balance = await perp.getReserveTokenBalance.staticCall(tokenAddress); + const value = await perp.getReserveTokenValue.staticCall(tokenAddress); + const price = balance > 0n ? (value * balance * 1000) / 10n ** perpDecimals / 10n ** percDecimals : 0n; data.push({ token: tokenAddress, - balance: utils.formatUnits(balance, await perp.decimals()), - price: utils.formatUnits(price, 3), - upForRollover: balance.gt("0") && upForRollover.find(t => t === tokenAddress) !== undefined, + balance: hre.ethers.formatUnits(balance, await perp.decimals()), + price: hre.ethers.formatUnits(price, 3), + upForRollover: balance > 0n && upForRollover.find(t => t === tokenAddress) !== undefined, }); } console.table(data); console.log("reserveCount:", reserveCount); - console.log("price:", utils.formatUnits(perpPrice, 3)); + console.log("price:", hre.ethers.formatUnits(perpPrice, 3)); console.log("---------------------------------------------------------------"); }); @@ -190,9 +189,9 @@ task("ops:perp:trancheAndDeposit") const bondIssuer = await hre.ethers.getContractAt("BondIssuer", await perp.bondIssuer()); const collateralToken = await hre.ethers.getContractAt("MockERC20", await bondIssuer.collateral()); - const fixedPtCollateralAmount = utils.parseUnits(collateralAmount, await collateralToken.decimals()); - const [depositBondAddress, depositTranches] = await router.callStatic.previewTranche( - perp.address, + const fixedPtCollateralAmount = hre.ethers.parseUnits(collateralAmount, await collateralToken.decimals()); + const [depositBondAddress, depositTranches] = await router.previewTranche.staticCall( + perp.target, fixedPtCollateralAmount, ); console.log(depositBondAddress, depositTranches); @@ -202,18 +201,18 @@ task("ops:perp:trancheAndDeposit") console.log( "tranches(0):", depositTranches[0].token, - utils.formatUnits(depositTranches[0].amount.toString(), await collateralToken.decimals()), + hre.ethers.formatUnits(depositTranches[0].amount.toString(), await collateralToken.decimals()), ); console.log( "tranches(1):", depositTranches[1].token, - utils.formatUnits(depositTranches[1].amount.toString(), await collateralToken.decimals()), + hre.ethers.formatUnits(depositTranches[1].amount.toString(), await collateralToken.decimals()), ); console.log("---------------------------------------------------------------"); console.log("Preview mint:", collateralAmount); - const totalMintAmt = await perp.callStatic.computeMintAmt(depositTranches[0].token, depositTranches[0].amount); - console.log("mintAmt", utils.formatUnits(totalMintAmt, await perp.decimals())); + const totalMintAmt = await perp.computeMintAmt.staticCall(depositTranches[0].token, depositTranches[0].amount); + console.log("mintAmt", hre.ethers.formatUnits(totalMintAmt, await perp.decimals())); if (totalMintAmt.eq("0")) { throw Error("No perp minted"); } @@ -225,9 +224,9 @@ task("ops:perp:trancheAndDeposit") console.log("Signer", signerAddress); console.log("Approving router to spend tokens:"); - const allowance = await collateralToken.allowance(signerAddress, router.address); + const allowance = await collateralToken.allowance(signerAddress, router.target); if (allowance.lt(fixedPtCollateralAmount)) { - const tx1 = await collateralToken.connect(signer).approve(router.address, fixedPtCollateralAmount); + const tx1 = await collateralToken.connect(signer).approve(router.target, fixedPtCollateralAmount); await tx1.wait(); console.log("Tx", tx1.hash); } @@ -235,11 +234,11 @@ task("ops:perp:trancheAndDeposit") console.log("Tranche and deposit:"); const tx2 = await router .connect(signer) - .trancheAndDeposit(perp.address, depositBondAddress, fixedPtCollateralAmount); + .trancheAndDeposit(perp.target, depositBondAddress, fixedPtCollateralAmount); await tx2.wait(); console.log("Tx", tx2.hash); - console.log("Signer balance", utils.formatUnits(await perp.balanceOf(signerAddress), await perp.decimals())); + console.log("Signer balance", hre.ethers.formatUnits(await perp.balanceOf(signerAddress), await perp.decimals())); }); task("ops:perp:redeem") @@ -252,18 +251,18 @@ task("ops:perp:redeem") const router = await hre.ethers.getContractAt("RouterV2", routerAddress); const perp = await hre.ethers.getContractAt("PerpetualTranche", perpAddress); - const fixedPtAmount = utils.parseUnits(amount, await perp.decimals()); + const fixedPtAmount = hre.ethers.parseUnits(amount, await perp.decimals()); console.log("---------------------------------------------------------------"); console.log("Preview redeem:", amount); - const reserveTokens = await perp.callStatic.computeRedemptionAmts(fixedPtAmount); + const reserveTokens = await perp.computeRedemptionAmts.staticCall(fixedPtAmount); console.log("burnAmt", amount); console.log("reserve token redeemed"); for (let i = 0; i < reserveTokens.length; i++) { console.log( `reserve(${i}):`, reserveTokens[i].token, - utils.formatUnits(reserveTokens[i].amount.toString(), await perp.decimals()), + hre.ethers.formatUnits(reserveTokens[i].amount.toString(), await perp.decimals()), ); } @@ -274,8 +273,8 @@ task("ops:perp:redeem") console.log("Signer", signerAddress); console.log("Approving router to spend tokens:"); - if ((await perp.allowance(signerAddress, router.address)).lt(fixedPtAmount)) { - const tx1 = await perp.connect(signer).approve(router.address, fixedPtAmount); + if ((await perp.allowance(signerAddress, router.target)).lt(fixedPtAmount)) { + const tx1 = await perp.connect(signer).approve(router.target, fixedPtAmount); await tx1.wait(); console.log("Tx", tx1.hash); } @@ -285,5 +284,5 @@ task("ops:perp:redeem") await tx2.wait(); console.log("Tx", tx2.hash); - console.log("Signer balance", utils.formatUnits(await perp.balanceOf(signerAddress), await perp.decimals())); + console.log("Signer balance", hre.ethers.formatUnits(await perp.balanceOf(signerAddress), await perp.decimals())); }); diff --git a/spot-contracts/tasks/ops/tranche.ts b/spot-contracts/tasks/ops/tranche.ts index ecbc5880..0db1d67f 100644 --- a/spot-contracts/tasks/ops/tranche.ts +++ b/spot-contracts/tasks/ops/tranche.ts @@ -10,7 +10,7 @@ async function matureBond(bond: Contract, signer: Signer) { } try { console.log("Invoking Mature"); - await bond.connect(signer).callStatic.mature(); + await bond.connect(signer).mature.staticCall(); const tx = await bond.connect(signer).mature(); await tx.wait(); console.log("Tx:", tx.hash); @@ -103,8 +103,8 @@ task("ops:redeemTranches") for (let j = 0; j < bt.length; j++) { const b = await bt[j][0].balanceOf(signerAddress); if (b.gt(0)) { - console.log("Redeeming mature tranche", bt[j][0].address); - const tx = await bond.connect(signer).redeemMature(bt[j][0].address, b); + console.log("Redeeming mature tranche", bt[j][0].target); + const tx = await bond.connect(signer).redeemMature(bt[j][0].target, b); await tx.wait(); console.log("Tx:", tx.hash); } @@ -133,9 +133,9 @@ task("ops:preview_tx:redeemTranches") const txs: ProposedTransaction[] = []; const bondIssuer = await hre.ethers.getContractAt("BondIssuer", bondIssuerAddress); - const issuedCount = await bondIssuer.callStatic.issuedCount(); + const issuedCount = await bondIssuer.issuedCount.staticCall(); for (let i = issuedCount - 1; i > 0 && issuedCount - 1 - i < depth; i--) { - const bondAddress = await bondIssuer.callStatic.issuedBondAt(i); + const bondAddress = await bondIssuer.issuedBondAt.staticCall(i); const bond = await hre.ethers.getContractAt("IBondController", bondAddress); const bt = await getTranches(hre, bond); @@ -148,7 +148,7 @@ task("ops:preview_tx:redeemTranches") txs.push({ contract: bond, method: "redeemMature", - args: [bt[j][0].address, b.toString()], + args: [bt[j][0].target, b.toString()], }); } } @@ -168,7 +168,7 @@ task("ops:preview_tx:redeemTranches") console.log("Execute the following transactions"); for (let i = 0; i < txs.length; i++) { - console.log({ to: txs[i].contract.address, method: txs[i].method, args: txs[i].args }); + console.log({ to: txs[i].contract.target, method: txs[i].method, args: txs[i].args }); } console.log("Wrote tx batch to file:", "RedeemBatch.json"); diff --git a/spot-contracts/tasks/ops/vaults.ts b/spot-contracts/tasks/ops/vaults.ts index d54ceac6..4c547e8b 100644 --- a/spot-contracts/tasks/ops/vaults.ts +++ b/spot-contracts/tasks/ops/vaults.ts @@ -1,7 +1,6 @@ import { getAdminAddress, getImplementationAddress } from "@openzeppelin/upgrades-core"; import { task, types } from "hardhat/config"; import { TaskArguments } from "hardhat/types"; -import { BigNumber, utils } from "ethers"; task("ops:vault:info") .addPositionalParam("vaultAddress", "the address of the vault contract", undefined, types.string, false) @@ -23,116 +22,114 @@ task("ops:vault:info") let pokeAvailable = true; try { - await vault.callStatic.recoverAndRedeploy(); + await vault.recoverAndRedeploy.staticCall(); } catch (e) { pokeAvailable = false; } console.log("---------------------------------------------------------------"); - console.log("RolloverVault:", vault.address); + console.log("RolloverVault:", vault.target); console.log("proxyAdmin:", proxyAdminAddress); console.log("implementation:", implAddress); console.log("owner:", await vault.owner()); console.log("paused:", await vault.paused()); - console.log("perp:", perp.address); - console.log("underlying:", underlying.address); - console.log("minDeploymentAmt:", utils.formatUnits(await vault.minDeploymentAmt(), underlyingDecimals)); - console.log("totalSupply:", utils.formatUnits(vaultSupply, vaultDecimals)); + console.log("perp:", perp.target); + console.log("underlying:", underlying.target); + console.log("minDeploymentAmt:", hre.ethers.formatUnits(await vault.minDeploymentAmt(), underlyingDecimals)); + console.log("totalSupply:", hre.ethers.formatUnits(vaultSupply, vaultDecimals)); console.log("pokeAvailable:", pokeAvailable); console.log("---------------------------------------------------------------"); const data = []; - const underlyingBalance = await vault.vaultAssetBalance(underlying.address); + const underlyingBalance = await vault.vaultAssetBalance(underlying.target); data.push({ asset: await underlying.symbol(), - balance: utils.formatUnits(underlyingBalance, underlyingDecimals), + balance: hre.ethers.formatUnits(underlyingBalance, underlyingDecimals), price: "1", }); - const assetCount = (await vault.assetCount()).toNumber(); + const assetCount = Number(await vault.assetCount()); for (let i = 1; i < assetCount; i++) { - const tokenAddress = await vault.callStatic.assetAt(i); + const tokenAddress = await vault.assetAt.staticCall(i); const balance = await vault.vaultAssetBalance(tokenAddress); - const value = await vault.callStatic.getVaultAssetValue(tokenAddress); - const price = value.mul(BigNumber.from(10 ** perpDecimals)).div(balance); + const value = await vault.getVaultAssetValue.staticCall(tokenAddress); + const price = (value * 10n ** perpDecimals) / balance; const token = await hre.ethers.getContractAt("MockERC20", tokenAddress); data.push({ asset: await token.symbol(), - balance: utils.formatUnits(balance, underlyingDecimals), - price: utils.formatUnits(price, perpDecimals), + balance: hre.ethers.formatUnits(balance, underlyingDecimals), + price: hre.ethers.formatUnits(price, perpDecimals), }); } - const perpBalance = await perp.balanceOf(vault.address); + const perpBalance = await perp.balanceOf(vault.target); const perpSupply = await perp.totalSupply(); - const perpTVL = await perp.callStatic.getTVL(); - const perpPrice = perpSupply.gt("0") ? perpTVL.mul(1000).div(perpSupply) : 0; + const perpTVL = await perp.getTVL.staticCall(); + const perpPrice = perpSupply > 0n ? (perpTVL * 1000n) / perpSupply : 0n; data.push({ asset: await perp.symbol(), - balance: utils.formatUnits(perpBalance, perpDecimals), - price: utils.formatUnits(perpPrice, 3), + balance: hre.ethers.formatUnits(perpBalance, perpDecimals), + price: hre.ethers.formatUnits(perpPrice, 3), }); console.table(data); console.log("---------------------------------------------------------------"); const feeOne = await feePolicy.ONE(); const feeDecimals = await feePolicy.decimals(); - const vaultTVL = await vault.callStatic.getTVL(); - const seniorTR = await perp.callStatic.getDepositTrancheRatio(); - const juniorTR = BigNumber.from("1000").sub(seniorTR); - const subscriptionRatio = vaultTVL.mul(seniorTR).mul(feeOne).div(perpTVL).div(juniorTR); + const vaultTVL = await vault.getTVL.staticCall(); + const seniorTR = await perp.getDepositTrancheRatio.staticCall(); + const juniorTR = 1000n - seniorTR; + const subscriptionRatio = (vaultTVL * seniorTR * feeOne) / perpTVL / juniorTR; const targetSubscriptionRatio = await feePolicy.targetSubscriptionRatio(); - const expectedVaultTVL = targetSubscriptionRatio.mul(perpTVL).mul(juniorTR).div(seniorTR).div(feeOne); - const deviationRatio = await feePolicy["computeDeviationRatio((uint256,uint256,uint256))"]([ - perpTVL, - vaultTVL, - seniorTR, - ]); - console.log("perpTVL:", utils.formatUnits(perpTVL, underlyingDecimals)); - console.log("vaultTVL:", utils.formatUnits(vaultTVL, underlyingDecimals)); - console.log("expectedVaultTVL:", utils.formatUnits(expectedVaultTVL, underlyingDecimals)); - console.log("seniorTR:", utils.formatUnits(seniorTR, 3)); - console.log("juniorTR:", utils.formatUnits(juniorTR, 3)); - console.log("subscriptionRatio:", utils.formatUnits(subscriptionRatio, feeDecimals)); - console.log("targetSubscriptionRatio:", utils.formatUnits(targetSubscriptionRatio, feeDecimals)); - console.log("targetDeviationRatio:", utils.formatUnits(feeOne, feeDecimals)); - console.log( - "deviationRatioBoundLower:", - utils.formatUnits(await feePolicy.deviationRatioBoundLower(), feeDecimals), - ); - console.log( - "deviationRatioBoundUpper:", - utils.formatUnits(await feePolicy.deviationRatioBoundUpper(), feeDecimals), - ); - console.log("deviationRatio:", utils.formatUnits(deviationRatio, feeDecimals)); + const expectedVaultTVL = (targetSubscriptionRatio * perpTVL * juniorTR) / seniorTR / feeOne; + const deviationRatio = await feePolicy["computeDeviationRatio((uint256,uint256))"]([perpTVL, vaultTVL, seniorTR]); + console.log("perpTVL:", hre.ethers.formatUnits(perpTVL, underlyingDecimals)); + console.log("vaultTVL:", hre.ethers.formatUnits(vaultTVL, underlyingDecimals)); + console.log("expectedVaultTVL:", hre.ethers.formatUnits(expectedVaultTVL, underlyingDecimals)); + console.log("seniorTR:", hre.ethers.formatUnits(seniorTR, 3)); + console.log("juniorTR:", hre.ethers.formatUnits(juniorTR, 3)); + console.log("subscriptionRatio:", hre.ethers.formatUnits(subscriptionRatio, feeDecimals)); + console.log("targetSubscriptionRatio:", hre.ethers.formatUnits(targetSubscriptionRatio, feeDecimals)); + console.log("targetDeviationRatio:", hre.ethers.formatUnits(feeOne, feeDecimals)); + + const drHardBound = await feePolicy.drHardBound(); + console.log("deviationRatioBoundLower:", hre.ethers.formatUnits(drHardBound.lower, feeDecimals)); + console.log("deviationRatioBoundUpper:", hre.ethers.formatUnits(drHardBound.upper, feeDecimals)); + console.log("deviationRatio:", hre.ethers.formatUnits(deviationRatio, feeDecimals)); console.log("---------------------------------------------------------------"); - console.log("feePolicy:", feePolicy.address); + console.log("feePolicy:", feePolicy.target); console.log("owner", await feePolicy.owner()); - console.log("computeVaultMintFeePerc:", utils.formatUnits(await feePolicy.computeVaultMintFeePerc(), 8)); - console.log("computeVaultBurnFeePerc:", utils.formatUnits(await feePolicy.computeVaultBurnFeePerc(), 8)); + console.log("computeVaultMintFeePerc:", hre.ethers.formatUnits(await feePolicy.computeVaultMintFeePerc(), 8)); + console.log("computeVaultBurnFeePerc:", hre.ethers.formatUnits(await feePolicy.computeVaultBurnFeePerc(), 8)); console.log( "computeUnderlyingToPerpVaultSwapFeePerc:", - utils.formatUnits(await feePolicy.computeUnderlyingToPerpVaultSwapFeePerc(deviationRatio, deviationRatio), 8), + hre.ethers.formatUnits( + await feePolicy.computeUnderlyingToPerpVaultSwapFeePerc(deviationRatio, deviationRatio), + 8, + ), ); console.log( "computePerpToUnderlyingVaultSwapFeePerc:", - utils.formatUnits(await feePolicy.computePerpToUnderlyingVaultSwapFeePerc(deviationRatio, deviationRatio), 8), + hre.ethers.formatUnits( + await feePolicy.computePerpToUnderlyingVaultSwapFeePerc(deviationRatio, deviationRatio), + 8, + ), ); console.log("---------------------------------------------------------------"); console.log("Swap slippage"); try { - const buy1000Perps = await vault.callStatic.computeUnderlyingToPerpSwapAmt( - utils.parseUnits("1000", perpDecimals), + const buy1000Perps = await vault.computeUnderlyingToPerpSwapAmt.staticCall( + hre.ethers.parseUnits("1000", perpDecimals), ); - console.log("Swap 1000 underlying for perps: ", utils.formatUnits(buy1000Perps[0], perpDecimals)); + console.log("Swap 1000 underlying for perps: ", hre.ethers.formatUnits(buy1000Perps[0], perpDecimals)); } catch { console.log("Swap underlying for perps disabled"); } try { - const sell1000Perps = await vault.callStatic.computePerpToUnderlyingSwapAmt( - utils.parseUnits("1000", perpDecimals), + const sell1000Perps = await vault.computePerpToUnderlyingSwapAmt.staticCall( + hre.ethers.parseUnits("1000", perpDecimals), ); - console.log("PerpPrice:", utils.formatUnits(perpPrice, 3)); - console.log("Sell 1000 perps for underlying", utils.formatUnits(sell1000Perps[0], perpDecimals)); + console.log("PerpPrice:", hre.ethers.formatUnits(perpPrice, 3)); + console.log("Sell 1000 perps for underlying", hre.ethers.formatUnits(sell1000Perps[0], perpDecimals)); } catch { console.log("Swap perps for underlying disabled"); } @@ -154,23 +151,26 @@ task("ops:vault:deposit") const vault = await hre.ethers.getContractAt("RolloverVault", vaultAddress); const underlying = await hre.ethers.getContractAt("MockERC20", await vault.underlying()); - const fixedPtAmount = utils.parseUnits(underlyingAmount, await underlying.decimals()); + const fixedPtAmount = hre.ethers.parseUnits(underlyingAmount, await underlying.decimals()); const signer = (await hre.ethers.getSigners())[args.fromIdx]; const signerAddress = await signer.getAddress(); console.log("Signer", signerAddress); - console.log("Signer note balance", utils.formatUnits(await vault.balanceOf(signerAddress), await vault.decimals())); + console.log( + "Signer note balance", + hre.ethers.formatUnits(await vault.balanceOf(signerAddress), await vault.decimals()), + ); console.log( "Signer underlying balance", - utils.formatUnits(await underlying.balanceOf(signerAddress), await underlying.decimals()), + hre.ethers.formatUnits(await underlying.balanceOf(signerAddress), await underlying.decimals()), ); console.log("---------------------------------------------------------------"); console.log("Execution:"); console.log("Approving router to spend tokens:"); - if ((await underlying.allowance(signerAddress, vault.address)).lt(fixedPtAmount)) { - const tx1 = await underlying.connect(signer).approve(vault.address, fixedPtAmount); + if ((await underlying.allowance(signerAddress, vault.target)).lt(fixedPtAmount)) { + const tx1 = await underlying.connect(signer).approve(vault.target, fixedPtAmount); await tx1.wait(); console.log("Tx", tx1.hash); } @@ -180,10 +180,13 @@ task("ops:vault:deposit") await tx3.wait(); console.log("Tx", tx3.hash); - console.log("Signer note balance", utils.formatUnits(await vault.balanceOf(signerAddress), await vault.decimals())); + console.log( + "Signer note balance", + hre.ethers.formatUnits(await vault.balanceOf(signerAddress), await vault.decimals()), + ); console.log( "Signer underlying balance", - utils.formatUnits(await underlying.balanceOf(signerAddress), await underlying.decimals()), + hre.ethers.formatUnits(await underlying.balanceOf(signerAddress), await underlying.decimals()), ); }); @@ -197,22 +200,25 @@ task("ops:vault:redeem") const vault = await hre.ethers.getContractAt("RolloverVault", vaultAddress); const underlying = await hre.ethers.getContractAt("MockERC20", await vault.underlying()); const underlyingDecimals = await underlying.decimals(); - const fixedPtAmount = utils.parseUnits(amount, await vault.decimals()); + const fixedPtAmount = hre.ethers.parseUnits(amount, await vault.decimals()); const signer = (await hre.ethers.getSigners())[args.fromIdx]; const signerAddress = await signer.getAddress(); console.log("Signer", signerAddress); - console.log("Signer note balance", utils.formatUnits(await vault.balanceOf(signerAddress), await vault.decimals())); + console.log( + "Signer note balance", + hre.ethers.formatUnits(await vault.balanceOf(signerAddress), await vault.decimals()), + ); console.log("---------------------------------------------------------------"); console.log("Preview redeem:", amount); - const redemptions = await vault.callStatic.redeem(fixedPtAmount); + const redemptions = await vault.redeem.staticCall(fixedPtAmount); const redemptionData = []; for (let i = 0; i < redemptions.length; i++) { const token = await hre.ethers.getContractAt("MockERC20", redemptions[i].token); redemptionData.push({ asset: await token.symbol(), - amount: utils.formatUnits(redemptions[i].amount, underlyingDecimals), + amount: hre.ethers.formatUnits(redemptions[i].amount, underlyingDecimals), }); } console.table(redemptionData); @@ -223,7 +229,10 @@ task("ops:vault:redeem") const tx = await vault.connect(signer).redeem(fixedPtAmount); await tx.wait(); console.log("Tx", tx.hash); - console.log("Signer note balance", utils.formatUnits(await vault.balanceOf(signerAddress), await vault.decimals())); + console.log( + "Signer note balance", + hre.ethers.formatUnits(await vault.balanceOf(signerAddress), await vault.decimals()), + ); }); task("ops:vault:recoverAndRedeploy") @@ -296,7 +305,7 @@ task("ops:fee:setSwapFees", "Updates swap fees in fee policy") console.log("Signer", signerAddress); const feePolicy = await hre.ethers.getContractAt("FeePolicy", address); console.log(`Updating both swap fees to ${feePerc}`); - const feeAmtFixedPt = utils.parseUnits(feePerc, await feePolicy.decimals()); + const feeAmtFixedPt = hre.ethers.parseUnits(feePerc, await feePolicy.decimals()); const tx1 = await feePolicy.updateVaultUnderlyingToPerpSwapFeePerc(feeAmtFixedPt); console.log(tx1.hash); @@ -323,23 +332,26 @@ task("ops:vault:swapUnderlyingForPerps") const vault = await hre.ethers.getContractAt("RolloverVault", vaultAddress); const perp = await hre.ethers.getContractAt("PerpetualTranche", await vault.perp()); const underlying = await hre.ethers.getContractAt("MockERC20", await vault.underlying()); - const fixedPtAmount = utils.parseUnits(underlyingAmount, await underlying.decimals()); + const fixedPtAmount = hre.ethers.parseUnits(underlyingAmount, await underlying.decimals()); const signer = (await hre.ethers.getSigners())[args.fromIdx]; const signerAddress = await signer.getAddress(); console.log("Signer", signerAddress); - console.log("Signer perp balance", utils.formatUnits(await perp.balanceOf(signerAddress), await perp.decimals())); + console.log( + "Signer perp balance", + hre.ethers.formatUnits(await perp.balanceOf(signerAddress), await perp.decimals()), + ); console.log( "Signer underlying balance", - utils.formatUnits(await underlying.balanceOf(signerAddress), await underlying.decimals()), + hre.ethers.formatUnits(await underlying.balanceOf(signerAddress), await underlying.decimals()), ); console.log("---------------------------------------------------------------"); console.log("Execution:"); console.log("Approving router to spend tokens:"); - if ((await underlying.allowance(signerAddress, vault.address)).lt(fixedPtAmount)) { - const tx1 = await underlying.connect(signer).approve(vault.address, fixedPtAmount); + if ((await underlying.allowance(signerAddress, vault.target)).lt(fixedPtAmount)) { + const tx1 = await underlying.connect(signer).approve(vault.target, fixedPtAmount); await tx1.wait(); console.log("Tx", tx1.hash); } @@ -349,10 +361,13 @@ task("ops:vault:swapUnderlyingForPerps") await tx2.wait(); console.log("Tx", tx2.hash); - console.log("Signer perp balance", utils.formatUnits(await perp.balanceOf(signerAddress), await perp.decimals())); + console.log( + "Signer perp balance", + hre.ethers.formatUnits(await perp.balanceOf(signerAddress), await perp.decimals()), + ); console.log( "Signer underlying balance", - utils.formatUnits(await underlying.balanceOf(signerAddress), await underlying.decimals()), + hre.ethers.formatUnits(await underlying.balanceOf(signerAddress), await underlying.decimals()), ); }); @@ -366,7 +381,7 @@ task("ops:vault:swapPerpsForUnderlying") const vault = await hre.ethers.getContractAt("RolloverVault", vaultAddress); const perp = await hre.ethers.getContractAt("PerpetualTranche", await vault.perp()); const underlying = await hre.ethers.getContractAt("MockERC20", await vault.underlying()); - const fixedPtAmount = utils.parseUnits(perpAmount, await perp.decimals()); + const fixedPtAmount = hre.ethers.parseUnits(perpAmount, await perp.decimals()); const signer = (await hre.ethers.getSigners())[args.fromIdx]; const signerAddress = await signer.getAddress(); @@ -374,15 +389,18 @@ task("ops:vault:swapPerpsForUnderlying") console.log( "Signer underlying balance", - utils.formatUnits(await underlying.balanceOf(signerAddress), await underlying.decimals()), + hre.ethers.formatUnits(await underlying.balanceOf(signerAddress), await underlying.decimals()), + ); + console.log( + "Signer perp balance", + hre.ethers.formatUnits(await perp.balanceOf(signerAddress), await perp.decimals()), ); - console.log("Signer perp balance", utils.formatUnits(await perp.balanceOf(signerAddress), await perp.decimals())); console.log("---------------------------------------------------------------"); console.log("Execution:"); console.log("Approving router to spend tokens:"); - if ((await perp.allowance(signerAddress, vault.address)).lt(fixedPtAmount)) { - const tx1 = await perp.connect(signer).approve(vault.address, fixedPtAmount); + if ((await perp.allowance(signerAddress, vault.target)).lt(fixedPtAmount)) { + const tx1 = await perp.connect(signer).approve(vault.target, fixedPtAmount); await tx1.wait(); console.log("Tx", tx1.hash); } @@ -394,7 +412,10 @@ task("ops:vault:swapPerpsForUnderlying") console.log( "Signer underlying balance", - utils.formatUnits(await underlying.balanceOf(signerAddress), await underlying.decimals()), + hre.ethers.formatUnits(await underlying.balanceOf(signerAddress), await underlying.decimals()), + ); + console.log( + "Signer perp balance", + hre.ethers.formatUnits(await perp.balanceOf(signerAddress), await perp.decimals()), ); - console.log("Signer perp balance", utils.formatUnits(await perp.balanceOf(signerAddress), await perp.decimals())); }); diff --git a/spot-contracts/test/BondIssuer.ts b/spot-contracts/test/BondIssuer.ts index f27497b1..5d4fbcba 100644 --- a/spot-contracts/test/BondIssuer.ts +++ b/spot-contracts/test/BondIssuer.ts @@ -2,7 +2,7 @@ import { expect } from "chai"; import { ethers, network, upgrades } from "hardhat"; import { Contract, Transaction, Signer } from "ethers"; -import { TimeHelpers, setupBondFactory, bondAt } from "./helpers"; +import { TimeHelpers, setupBondFactory, bondAt, setupCollateralToken } from "./helpers"; const START_TIME = 2499998400; const mockTime = (x: number) => START_TIME + x; @@ -13,14 +13,14 @@ describe("BondIssuer", function () { const accounts = await ethers.getSigners(); deployer = accounts[0]; otherUser = accounts[1]; + bondFactory = await setupBondFactory(); - const Token = await ethers.getContractFactory("MockERC20"); - token = await Token.deploy(); - await token.init("Test token", "TEST"); + ({ collateralToken: token } = await setupCollateralToken("Test token", "TEST")); + const BondIssuer = await ethers.getContractFactory("BondIssuer"); issuer = await upgrades.deployProxy( BondIssuer.connect(deployer), - [bondFactory.address, token.address, 86400, [200, 300, 500], 3600, 900], + [bondFactory.target, token.target, 86400, [200, 300, 500], 3600, 900], { initializer: "init(address,address,uint256,uint256[],uint256,uint256)", }, @@ -29,17 +29,17 @@ describe("BondIssuer", function () { }); afterEach(async function () { - await network.provider.send("hardhat_reset"); + await network.provider.request({ method: "hardhat_reset" }); }); describe("#setup", function () { it("should set storage parameters", async function () { expect(await issuer.owner()).to.eq(await deployer.getAddress()); - expect(await issuer.bondFactory()).to.eq(bondFactory.address); + expect(await issuer.bondFactory()).to.eq(bondFactory.target); expect(await issuer.minIssueTimeIntervalSec()).to.eq(3600); expect(await issuer.issueWindowOffsetSec()).to.eq(900); expect(await issuer.maxMaturityDuration()).to.eq(86400); - expect(await issuer.collateral()).to.eq(token.address); + expect(await issuer.collateral()).to.eq(token.target); expect(await issuer.trancheRatios(0)).to.eq(200); expect(await issuer.trancheRatios(1)).to.eq(300); expect(await issuer.trancheRatios(2)).to.eq(500); @@ -117,12 +117,12 @@ describe("BondIssuer", function () { await TimeHelpers.setNextBlockTimestamp(mockTime(901)); const tx = await issuer.issue(); const txR = await tx.wait(); - const bondIssuedEvent = txR.events[txR.events.length - 1]; - const bond = bondIssuedEvent.args.bond; + const bondIssuedLog = txR.logs[txR.logs.length - 1]; + const bond = bondIssuedLog.args.bond; expect(tx).to.emit(issuer, "BondIssued"); expect(await issuer.isInstance(bond)).to.eq(true); - expect(await issuer.callStatic.getLatestBond()).to.eq(bond); + expect(await issuer.getLatestBond.staticCall()).to.eq(bond); expect(await issuer.lastIssueWindowTimestamp()).to.eq(mockTime(900)); expect(await issuer.issuedCount()).to.eq(1); @@ -204,7 +204,7 @@ describe("BondIssuer", function () { describe("#getLatestBond", function () { describe("when a new bond is up to be issued", function () { it("should issue a new bond and return the new bond", async function () { - const bond = await issuer.callStatic.getLatestBond(); + const bond = await issuer.getLatestBond.staticCall(); await expect(issuer.getLatestBond()).to.emit(issuer, "BondIssued").withArgs(bond); }); }); @@ -213,9 +213,9 @@ describe("BondIssuer", function () { it("should return the last bond", async function () { const tx = await issuer.issue(); const txR = await tx.wait(); - const bondIssuedEvent = txR.events[txR.events.length - 1]; - const bond = bondIssuedEvent.args.bond; - expect(await issuer.callStatic.getLatestBond()).to.eq(bond); + const bondIssuedLog = txR.logs[txR.logs.length - 1]; + const bond = bondIssuedLog.args.bond; + expect(await issuer.getLatestBond.staticCall()).to.eq(bond); await expect(issuer.getLatestBond()).to.not.emit(issuer, "BondIssued"); }); }); @@ -239,23 +239,23 @@ describe("BondIssuer", function () { beforeEach(async function () { await TimeHelpers.setNextBlockTimestamp(mockTime(900)); await issuer.issue(); - lastBond = await bondAt(await issuer.callStatic.getLatestBond()); + lastBond = await bondAt(await issuer.getLatestBond.staticCall()); expect(await issuer.issuedCount()).to.eq(1); - expect(await issuer.issuedBondAt(0)).to.eq(lastBond.address); + expect(await issuer.issuedBondAt(0)).to.eq(lastBond.target); expect(await issuer.activeCount()).to.eq(1); - expect(await issuer.activeBondAt(0)).to.eq(lastBond.address); + expect(await issuer.activeBondAt(0)).to.eq(lastBond.target); await TimeHelpers.setNextBlockTimestamp(mockTime(87301)); tx = issuer.matureActive(); await tx; }); it("should emit mature", async function () { - await expect(tx).to.emit(issuer, "BondMature").withArgs(lastBond.address); + await expect(tx).to.emit(issuer, "BondMature").withArgs(lastBond.target); await expect(tx).to.emit(lastBond, "Mature"); }); it("should keep track of active and mature bonds", async function () { expect(await issuer.issuedCount()).to.eq(1); - expect(await issuer.issuedBondAt(0)).to.eq(lastBond.address); + expect(await issuer.issuedBondAt(0)).to.eq(lastBond.target); expect(await issuer.activeCount()).to.eq(0); await expect(issuer.activeBondAt(0)).to.be.reverted; }); @@ -266,9 +266,9 @@ describe("BondIssuer", function () { beforeEach(async function () { await TimeHelpers.setNextBlockTimestamp(mockTime(900)); await issuer.issue(); - lastBond = await bondAt(await issuer.callStatic.getLatestBond()); + lastBond = await bondAt(await issuer.getLatestBond.staticCall()); expect(await issuer.issuedCount()).to.eq(1); - expect(await issuer.issuedBondAt(0)).to.eq(lastBond.address); + expect(await issuer.issuedBondAt(0)).to.eq(lastBond.target); await TimeHelpers.setNextBlockTimestamp(mockTime(87301)); await lastBond.mature(); @@ -281,7 +281,7 @@ describe("BondIssuer", function () { }); it("should keep track of active and mature bonds", async function () { expect(await issuer.issuedCount()).to.eq(1); - expect(await issuer.issuedBondAt(0)).to.eq(lastBond.address); + expect(await issuer.issuedBondAt(0)).to.eq(lastBond.target); expect(await issuer.activeCount()).to.eq(0); await expect(issuer.activeBondAt(0)).to.be.reverted; }); @@ -292,41 +292,41 @@ describe("BondIssuer", function () { beforeEach(async function () { await TimeHelpers.setNextBlockTimestamp(mockTime(900)); await issuer.issue(); - b1 = await bondAt(await issuer.callStatic.getLatestBond()); + b1 = await bondAt(await issuer.getLatestBond.staticCall()); await TimeHelpers.setNextBlockTimestamp(mockTime(83700)); await issuer.issue(); - b2 = await bondAt(await issuer.callStatic.getLatestBond()); + b2 = await bondAt(await issuer.getLatestBond.staticCall()); await TimeHelpers.setNextBlockTimestamp(mockTime(87300)); await issuer.issue(); - b3 = await bondAt(await issuer.callStatic.getLatestBond()); + b3 = await bondAt(await issuer.getLatestBond.staticCall()); expect(await issuer.issuedCount()).to.eq(3); - expect(await issuer.issuedBondAt(0)).to.eq(b1.address); - expect(await issuer.issuedBondAt(1)).to.eq(b2.address); - expect(await issuer.issuedBondAt(2)).to.eq(b3.address); + expect(await issuer.issuedBondAt(0)).to.eq(b1.target); + expect(await issuer.issuedBondAt(1)).to.eq(b2.target); + expect(await issuer.issuedBondAt(2)).to.eq(b3.target); expect(await issuer.activeCount()).to.eq(3); - expect(await issuer.activeBondAt(0)).to.eq(b1.address); - expect(await issuer.activeBondAt(1)).to.eq(b2.address); - expect(await issuer.activeBondAt(2)).to.eq(b3.address); + expect(await issuer.activeBondAt(0)).to.eq(b1.target); + expect(await issuer.activeBondAt(1)).to.eq(b2.target); + expect(await issuer.activeBondAt(2)).to.eq(b3.target); tx = issuer.matureActive(); await tx; }); it("should emit mature on the oldest bond", async function () { await expect(tx).to.emit(b1, "Mature"); - await expect(tx).to.emit(issuer, "BondMature").withArgs(b1.address); + await expect(tx).to.emit(issuer, "BondMature").withArgs(b1.target); }); it("should keep track of active and mature bonds", async function () { expect(await issuer.issuedCount()).to.eq(3); - expect(await issuer.issuedBondAt(0)).to.eq(b1.address); - expect(await issuer.issuedBondAt(1)).to.eq(b2.address); - expect(await issuer.issuedBondAt(2)).to.eq(b3.address); + expect(await issuer.issuedBondAt(0)).to.eq(b1.target); + expect(await issuer.issuedBondAt(1)).to.eq(b2.target); + expect(await issuer.issuedBondAt(2)).to.eq(b3.target); expect(await issuer.activeCount()).to.eq(2); - expect(await issuer.activeBondAt(0)).to.eq(b3.address); - expect(await issuer.activeBondAt(1)).to.eq(b2.address); + expect(await issuer.activeBondAt(0)).to.eq(b3.target); + expect(await issuer.activeBondAt(1)).to.eq(b2.target); await expect(issuer.activeBondAt(2)).to.be.reverted; }); }); @@ -336,44 +336,44 @@ describe("BondIssuer", function () { beforeEach(async function () { await TimeHelpers.setNextBlockTimestamp(mockTime(900)); await issuer.issue(); - b1 = await bondAt(await issuer.callStatic.getLatestBond()); + b1 = await bondAt(await issuer.getLatestBond.staticCall()); await TimeHelpers.setNextBlockTimestamp(mockTime(83700)); await issuer.issue(); - b2 = await bondAt(await issuer.callStatic.getLatestBond()); + b2 = await bondAt(await issuer.getLatestBond.staticCall()); await TimeHelpers.setNextBlockTimestamp(mockTime(87300)); await issuer.issue(); - b3 = await bondAt(await issuer.callStatic.getLatestBond()); + b3 = await bondAt(await issuer.getLatestBond.staticCall()); await TimeHelpers.setNextBlockTimestamp(mockTime(170100)); expect(await issuer.issuedCount()).to.eq(3); - expect(await issuer.issuedBondAt(0)).to.eq(b1.address); - expect(await issuer.issuedBondAt(1)).to.eq(b2.address); - expect(await issuer.issuedBondAt(2)).to.eq(b3.address); + expect(await issuer.issuedBondAt(0)).to.eq(b1.target); + expect(await issuer.issuedBondAt(1)).to.eq(b2.target); + expect(await issuer.issuedBondAt(2)).to.eq(b3.target); expect(await issuer.activeCount()).to.eq(3); - expect(await issuer.activeBondAt(0)).to.eq(b1.address); - expect(await issuer.activeBondAt(1)).to.eq(b2.address); - expect(await issuer.activeBondAt(2)).to.eq(b3.address); + expect(await issuer.activeBondAt(0)).to.eq(b1.target); + expect(await issuer.activeBondAt(1)).to.eq(b2.target); + expect(await issuer.activeBondAt(2)).to.eq(b3.target); tx = issuer.matureActive(); await tx; }); it("should emit mature", async function () { await expect(tx).to.emit(b1, "Mature"); - await expect(tx).to.emit(issuer, "BondMature").withArgs(b1.address); + await expect(tx).to.emit(issuer, "BondMature").withArgs(b1.target); await expect(tx).to.emit(b2, "Mature"); - await expect(tx).to.emit(issuer, "BondMature").withArgs(b2.address); + await expect(tx).to.emit(issuer, "BondMature").withArgs(b2.target); }); it("should keep track of active and mature bonds", async function () { expect(await issuer.issuedCount()).to.eq(3); - expect(await issuer.issuedBondAt(0)).to.eq(b1.address); - expect(await issuer.issuedBondAt(1)).to.eq(b2.address); - expect(await issuer.issuedBondAt(2)).to.eq(b3.address); + expect(await issuer.issuedBondAt(0)).to.eq(b1.target); + expect(await issuer.issuedBondAt(1)).to.eq(b2.target); + expect(await issuer.issuedBondAt(2)).to.eq(b3.target); expect(await issuer.activeCount()).to.eq(1); - expect(await issuer.activeBondAt(0)).to.eq(b3.address); + expect(await issuer.activeBondAt(0)).to.eq(b3.target); await expect(issuer.activeBondAt(1)).to.be.reverted; }); }); @@ -383,44 +383,44 @@ describe("BondIssuer", function () { beforeEach(async function () { await TimeHelpers.setNextBlockTimestamp(mockTime(900)); await issuer.issue(); - b1 = await bondAt(await issuer.callStatic.getLatestBond()); + b1 = await bondAt(await issuer.getLatestBond.staticCall()); await TimeHelpers.setNextBlockTimestamp(mockTime(83700)); await issuer.issue(); - b2 = await bondAt(await issuer.callStatic.getLatestBond()); + b2 = await bondAt(await issuer.getLatestBond.staticCall()); await TimeHelpers.setNextBlockTimestamp(mockTime(87300)); await issuer.issue(); - b3 = await bondAt(await issuer.callStatic.getLatestBond()); + b3 = await bondAt(await issuer.getLatestBond.staticCall()); await TimeHelpers.setNextBlockTimestamp(mockTime(260100)); expect(await issuer.issuedCount()).to.eq(3); - expect(await issuer.issuedBondAt(0)).to.eq(b1.address); - expect(await issuer.issuedBondAt(1)).to.eq(b2.address); - expect(await issuer.issuedBondAt(2)).to.eq(b3.address); + expect(await issuer.issuedBondAt(0)).to.eq(b1.target); + expect(await issuer.issuedBondAt(1)).to.eq(b2.target); + expect(await issuer.issuedBondAt(2)).to.eq(b3.target); expect(await issuer.activeCount()).to.eq(3); - expect(await issuer.activeBondAt(0)).to.eq(b1.address); - expect(await issuer.activeBondAt(1)).to.eq(b2.address); - expect(await issuer.activeBondAt(2)).to.eq(b3.address); + expect(await issuer.activeBondAt(0)).to.eq(b1.target); + expect(await issuer.activeBondAt(1)).to.eq(b2.target); + expect(await issuer.activeBondAt(2)).to.eq(b3.target); tx = issuer.matureActive(); await tx; }); it("should emit mature", async function () { await expect(tx).to.emit(b1, "Mature"); - await expect(tx).to.emit(issuer, "BondMature").withArgs(b1.address); + await expect(tx).to.emit(issuer, "BondMature").withArgs(b1.target); await expect(tx).to.emit(b2, "Mature"); - await expect(tx).to.emit(issuer, "BondMature").withArgs(b2.address); + await expect(tx).to.emit(issuer, "BondMature").withArgs(b2.target); await expect(tx).to.emit(b3, "Mature"); - await expect(tx).to.emit(issuer, "BondMature").withArgs(b3.address); + await expect(tx).to.emit(issuer, "BondMature").withArgs(b3.target); }); it("should keep track of active and mature bonds", async function () { expect(await issuer.issuedCount()).to.eq(3); - expect(await issuer.issuedBondAt(0)).to.eq(b1.address); - expect(await issuer.issuedBondAt(1)).to.eq(b2.address); - expect(await issuer.issuedBondAt(2)).to.eq(b3.address); + expect(await issuer.issuedBondAt(0)).to.eq(b1.target); + expect(await issuer.issuedBondAt(1)).to.eq(b2.target); + expect(await issuer.issuedBondAt(2)).to.eq(b3.target); expect(await issuer.activeCount()).to.eq(0); await expect(issuer.activeBondAt(0)).to.be.reverted; }); diff --git a/spot-contracts/test/FeePolicy.ts b/spot-contracts/test/FeePolicy.ts index 8a3e5a86..8793edef 100644 --- a/spot-contracts/test/FeePolicy.ts +++ b/spot-contracts/test/FeePolicy.ts @@ -1,14 +1,22 @@ -import { expect, use } from "chai"; +import { expect } from "chai"; import { ethers, upgrades } from "hardhat"; import { Contract, Signer } from "ethers"; -import { smock } from "@defi-wonderland/smock"; import { toPercFixedPtAmt, toFixedPtAmt } from "./helpers"; -use(smock.matchers); let feePolicy: Contract, deployer: Signer, otherUser: Signer; const toPerc = toPercFixedPtAmt; const toAmt = toFixedPtAmt; +const toLine = (x1: string, y1: string, x2: string, y2: string) => ({ + x1: toPerc(x1), + y1: toPerc(y1), + x2: toPerc(x2), + y2: toPerc(y2), +}); +const toRange = (lower: string, upper: string) => ({ + lower: toPerc(lower), + upper: toPerc(upper), +}); describe("FeePolicy", function () { beforeEach(async function () { @@ -24,9 +32,38 @@ describe("FeePolicy", function () { describe("#init", function () { it("should return the initial parameters", async function () { - expect(await feePolicy.targetSubscriptionRatio()).to.eq(toPerc("1.33")); - expect(await feePolicy.deviationRatioBoundLower()).to.eq(toPerc("0.75")); - expect(await feePolicy.deviationRatioBoundUpper()).to.eq(toPerc("2")); + expect(await feePolicy.targetSystemRatio()).to.eq(toPerc("3")); + + const f1 = await feePolicy.feeFnDRDown(); + expect(f1[0]).to.eq(toPerc("0.66")); + expect(f1[1]).to.eq(toPerc("0.25")); + expect(f1[2]).to.eq(toPerc("0.95")); + expect(f1[3]).to.eq(toPerc("0")); + + const f2 = await feePolicy.feeFnDRUp(); + expect(f2[0]).to.eq(toPerc("1.05")); + expect(f2[1]).to.eq(toPerc("0")); + expect(f2[2]).to.eq(toPerc("1.5")); + expect(f2[3]).to.eq(toPerc("0.25")); + + const drEq = await feePolicy.drEqZone(); + expect(drEq[0]).to.eq(toPerc("0.95")); + expect(drEq[1]).to.eq(toPerc("1.05")); + + expect(await feePolicy.perpDebasementLag()).to.eq(30); + expect(await feePolicy.perpEnrichmentLag()).to.eq(30); + + const l1 = await feePolicy.perpDebasementPercLimits(); + expect(l1[0]).to.eq(toPerc("0.005")); + expect(l1[1]).to.eq(toPerc("0.025")); + + const l2 = await feePolicy.perpEnrichmentPercLimits(); + expect(l2[0]).to.eq(toPerc("0.005")); + expect(l2[1]).to.eq(toPerc("0.025")); + + expect(await feePolicy.rebalanceFreqSec()).to.eq(86400); + expect(await feePolicy.protocolSharePerc()).to.eq(toPerc("0.01")); + expect(await feePolicy.protocolFeeCollector()).to.eq(await deployer.getAddress()); }); it("should return owner", async function () { expect(await feePolicy.owner()).to.eq(await deployer.getAddress()); @@ -36,487 +73,401 @@ describe("FeePolicy", function () { }); }); - describe("#updateTargetSubscriptionRatio", function () { + describe("#updateTargetSystemRatio", function () { describe("when triggered by non-owner", function () { it("should revert", async function () { - await expect(feePolicy.connect(otherUser).updateTargetSubscriptionRatio(toPerc("1.25"))).to.be.revertedWith( + await expect(feePolicy.connect(otherUser).updateTargetSystemRatio(toPerc("2"))).to.be.revertedWith( "Ownable: caller is not the owner", ); }); }); - describe("when parameters are invalid", function () { - it("should revert", async function () { - await expect( - feePolicy.connect(deployer).updateTargetSubscriptionRatio(toPerc("0.5")), - ).to.be.revertedWithCustomError(feePolicy, "InvalidTargetSRBounds"); - }); - }); - - describe("when parameters are invalid", function () { - it("should revert", async function () { - await expect( - feePolicy.connect(deployer).updateTargetSubscriptionRatio(toPerc("2.1")), - ).to.be.revertedWithCustomError(feePolicy, "InvalidTargetSRBounds"); - }); - }); - describe("when triggered by owner", function () { - it("should update the target sr", async function () { - expect(await feePolicy.targetSubscriptionRatio()).to.eq(toPerc("1.33")); - await feePolicy.connect(deployer).updateTargetSubscriptionRatio(toPerc("1.25")); - expect(await feePolicy.targetSubscriptionRatio()).to.eq(toPerc("1.25")); + it("should update the target system ratio", async function () { + expect(await feePolicy.targetSystemRatio()).to.eq(toPerc("3")); + await feePolicy.connect(deployer).updateTargetSystemRatio(toPerc("2")); + expect(await feePolicy.targetSystemRatio()).to.eq(toPerc("2")); }); }); }); - describe("#updateDeviationRatioBounds", function () { - describe("when triggered by non-owner", function () { - it("should revert", async function () { - await expect( - feePolicy.connect(otherUser).updateDeviationRatioBounds(toPerc("1"), toPerc("1")), - ).to.be.revertedWith("Ownable: caller is not the owner"); - }); - }); - - describe("when parameters are invalid", function () { - it("should revert", async function () { - await expect( - feePolicy.connect(deployer).updateDeviationRatioBounds(toPerc("1.01"), toPerc("2")), - ).to.be.revertedWithCustomError(feePolicy, "InvalidDRBounds"); - }); - }); + describe("#updateFees", function () { + const VALID_DOWN = toLine("0.0", "1.0", "0.99", "0.0"); + const VALID_UP = toLine("1.01", "0.0", "2.0", "1.0"); - describe("when parameters are invalid", function () { - it("should revert", async function () { - await expect( - feePolicy.connect(deployer).updateDeviationRatioBounds(toPerc("0.5"), toPerc("0.99")), - ).to.be.revertedWithCustomError(feePolicy, "InvalidDRBounds"); - }); - }); - - describe("when triggered by owner", function () { - it("should update the target sr", async function () { - expect(await feePolicy.deviationRatioBoundLower()).to.eq(toPerc("0.75")); - expect(await feePolicy.deviationRatioBoundUpper()).to.eq(toPerc("2")); - await feePolicy.connect(deployer).updateDeviationRatioBounds(toPerc("0.5"), toPerc("1.5")); - expect(await feePolicy.deviationRatioBoundLower()).to.eq(toPerc("0.5")); - expect(await feePolicy.deviationRatioBoundUpper()).to.eq(toPerc("1.5")); - }); - }); - }); - - describe("#updatePerpMintFees", function () { describe("when triggered by non-owner", function () { it("should revert", async function () { - await expect(feePolicy.connect(otherUser).updatePerpMintFees(toPerc("0.01"))).to.be.revertedWith( + await expect(feePolicy.connect(otherUser).updateFees(VALID_DOWN, VALID_UP)).to.be.revertedWith( "Ownable: caller is not the owner", ); }); }); - describe("when parameters are invalid", function () { - it("should revert", async function () { - await expect(feePolicy.connect(deployer).updatePerpMintFees(toPerc("1.01"))).to.be.revertedWithCustomError( + describe("when parameters are invalid (InvalidFees)", function () { + it("x1 > x2 for downwards leg", async function () { + const badDown = toLine("1.1", "1.0", "1.0", "0.0"); + await expect(feePolicy.connect(deployer).updateFees(badDown, VALID_UP)).to.be.revertedWithCustomError( feePolicy, - "InvalidPerc", - ); - }); - }); - - describe("when triggered by owner", function () { - it("should update the mint fees", async function () { - expect(await feePolicy.computePerpMintFeePerc()).to.eq("0"); - await feePolicy.connect(deployer).updatePerpMintFees(toPerc("0.01")); - expect(await feePolicy.computePerpMintFeePerc()).to.eq(toPerc("0.01")); - }); - }); - }); - - describe("#updatePerpBurnFees", function () { - describe("when triggered by non-owner", function () { - it("should revert", async function () { - await expect(feePolicy.connect(otherUser).updatePerpBurnFees(toPerc("0.01"))).to.be.revertedWith( - "Ownable: caller is not the owner", + "InvalidFees", ); }); - }); - describe("when parameters are invalid", function () { - it("should revert", async function () { - await expect(feePolicy.connect(deployer).updatePerpBurnFees(toPerc("1.01"))).to.be.revertedWithCustomError( + it("equilibrium zone crosses 1.0", async function () { + const badDown = toLine("0.0", "1.0", "1.1", "0.0"); + await expect(feePolicy.connect(deployer).updateFees(badDown, VALID_UP)).to.be.revertedWithCustomError( feePolicy, - "InvalidPerc", + "InvalidFees", ); - }); - }); - - describe("when triggered by owner", function () { - it("should update the burn fees", async function () { - expect(await feePolicy.computePerpBurnFeePerc()).to.eq("0"); - await feePolicy.connect(deployer).updatePerpBurnFees(toPerc("0.01")); - expect(await feePolicy.computePerpBurnFeePerc()).to.eq(toPerc("0.01")); - }); - }); - }); - - describe("#updatePerpRolloverFees", function () { - describe("when triggered by non-owner", function () { - it("should revert", async function () { - await expect( - feePolicy.connect(otherUser).updatePerpRolloverFees({ - lower: toPerc("-0.01"), - upper: toPerc("0.01"), - growth: toPerc("3"), - }), - ).to.be.revertedWith("Ownable: caller is not the owner"); - }); - }); - - describe("when parameters are invalid", function () { - it("should revert", async function () { - await expect( - feePolicy.connect(deployer).updatePerpRolloverFees({ - lower: toPerc("0.02"), - upper: toPerc("0.01"), - growth: toPerc("3"), - }), - ).to.be.revertedWithCustomError(feePolicy, "InvalidSigmoidAsymptotes"); - }); - }); - - describe("when triggered by owner", function () { - it("should update parameters", async function () { - expect(await feePolicy.computePerpRolloverFeePerc(toPerc("1"))).to.eq(0); - expect(await feePolicy.computePerpRolloverFeePerc(toPerc("10"))).to.eq(toPerc("0.00769230")); - expect(await feePolicy.computePerpRolloverFeePerc("0")).to.eq(toPerc("-0.00245837")); - - await feePolicy.connect(deployer).updatePerpRolloverFees({ - lower: toPerc("-0.009"), - upper: toPerc("0.009"), - growth: toPerc("3"), - }); - expect(await feePolicy.computePerpRolloverFeePerc(toPerc("1"))).to.eq(0); - expect(await feePolicy.computePerpRolloverFeePerc(toPerc("10"))).to.eq(toPerc("0.009")); - expect(await feePolicy.computePerpRolloverFeePerc("0")).to.eq(toPerc("-0.007")); - }); - }); - }); - - describe("#updateVaultMintFees", function () { - describe("when triggered by non-owner", function () { - it("should revert", async function () { - await expect(feePolicy.connect(otherUser).updateVaultMintFees(toPerc("0.01"))).to.be.revertedWith( - "Ownable: caller is not the owner", + const badUp = toLine("0.9", "0.0", "2.0", "1.0"); + await expect(feePolicy.connect(deployer).updateFees(VALID_DOWN, badUp)).to.be.revertedWithCustomError( + feePolicy, + "InvalidFees", ); }); - }); - describe("when parameters are invalid", function () { - it("should revert", async function () { - await expect(feePolicy.connect(deployer).updateVaultMintFees(toPerc("1.01"))).to.be.revertedWithCustomError( + it("fees not monotonic wrt distance from 1.0", async function () { + const badDown = toLine("0.0", "0.0", "1.0", "1.0"); + await expect(feePolicy.connect(deployer).updateFees(badDown, VALID_UP)).to.be.revertedWithCustomError( feePolicy, - "InvalidPerc", + "InvalidFees", ); - }); - }); - - describe("when triggered by owner", function () { - beforeEach(async function () {}); - it("should update the vault mint fees", async function () { - expect(await feePolicy.computeVaultMintFeePerc()).to.eq("0"); - await feePolicy.connect(deployer).updateVaultMintFees(toPerc("0.025")); - expect(await feePolicy.computeVaultMintFeePerc()).to.eq(toPerc("0.025")); - }); - }); - }); - describe("#updateVaultBurnFees", function () { - describe("when triggered by non-owner", function () { - it("should revert", async function () { - await expect(feePolicy.connect(otherUser).updateVaultBurnFees(toPerc("0.01"))).to.be.revertedWith( - "Ownable: caller is not the owner", + const badUp = toLine("1.0", "1.0", "2.0", "0.5"); + await expect(feePolicy.connect(deployer).updateFees(VALID_DOWN, badUp)).to.be.revertedWithCustomError( + feePolicy, + "InvalidFees", ); }); - }); - describe("when parameters are invalid", function () { - it("should revert", async function () { - await expect(feePolicy.connect(deployer).updateVaultBurnFees(toPerc("1.01"))).to.be.revertedWithCustomError( - feePolicy, - "InvalidPerc", - ); + it("fee percentage > 1 (100 %)", async function () { + await expect( + feePolicy.connect(deployer).updateFees(toLine("0.0", "1.1", "1.0", "0.1"), VALID_UP), + ).to.be.revertedWithCustomError(feePolicy, "InvalidFees"); + await expect( + feePolicy.connect(deployer).updateFees(VALID_DOWN, toLine("1.0", "0", "2.0", "1.1")), + ).to.be.revertedWithCustomError(feePolicy, "InvalidFees"); }); }); - describe("when triggered by owner", function () { - it("should update the vault burn fees", async function () { - expect(await feePolicy.computeVaultBurnFeePerc()).to.eq("0"); - await feePolicy.connect(deployer).updateVaultBurnFees(toPerc("0.025")); - expect(await feePolicy.computeVaultBurnFeePerc()).to.eq(toPerc("0.025")); + describe("when triggered by owner with valid parameters", function () { + it("should update the fee functions", async function () { + await feePolicy.connect(deployer).updateFees(VALID_DOWN, VALID_UP); + const f1 = await feePolicy.feeFnDRDown(); + expect(f1.x1).to.eq(VALID_DOWN.x1); + expect(f1.y1).to.eq(VALID_DOWN.y1); + expect(f1.x2).to.eq(VALID_DOWN.x2); + expect(f1.y2).to.eq(VALID_DOWN.y2); + const f2 = await feePolicy.feeFnDRUp(); + expect(f2.x1).to.eq(VALID_UP.x1); + expect(f2.y1).to.eq(VALID_UP.y1); + expect(f2.x2).to.eq(VALID_UP.x2); + expect(f2.y2).to.eq(VALID_UP.y2); }); }); }); - describe("#updateVaultUnderlyingToPerpSwapFeePerc", function () { + describe("#updateRebalanceConfig", function () { + const DEBASE_LAG = 30; + const ENRICH_LAG = 30; + const DEBASE_RNG = toRange("0.01", "0.05"); + const ENRICH_RNG = toRange("0.01", "0.03"); + const REBAL_FREQ = 86_400; + describe("when triggered by non-owner", function () { it("should revert", async function () { await expect( - feePolicy.connect(otherUser).updateVaultUnderlyingToPerpSwapFeePerc(toPerc("0.1")), + feePolicy + .connect(otherUser) + .updateRebalanceConfig(DEBASE_LAG, ENRICH_LAG, DEBASE_RNG, ENRICH_RNG, REBAL_FREQ), ).to.be.revertedWith("Ownable: caller is not the owner"); }); }); - describe("when parameters are invalid", function () { + describe("when range is invalid", function () { it("should revert", async function () { await expect( - feePolicy.connect(deployer).updateVaultUnderlyingToPerpSwapFeePerc(toPerc("1.01")), - ).to.be.revertedWithCustomError(feePolicy, "InvalidPerc"); + feePolicy + .connect(deployer) + .updateRebalanceConfig(DEBASE_LAG, ENRICH_LAG, toRange("0.06", "0.05"), ENRICH_RNG, REBAL_FREQ), + ).to.be.revertedWithCustomError(feePolicy, "InvalidRange"); + await expect( + feePolicy + .connect(deployer) + .updateRebalanceConfig(DEBASE_LAG, ENRICH_LAG, DEBASE_RNG, toRange("0.06", "0.05"), REBAL_FREQ), + ).to.be.revertedWithCustomError(feePolicy, "InvalidRange"); }); }); describe("when triggered by owner", function () { - it("should update the vault burn fees", async function () { - expect(await feePolicy.computeUnderlyingToPerpVaultSwapFeePerc(toPerc("1.01"), toPerc("1.01"))).to.eq( - toPerc("1"), - ); - await feePolicy.connect(deployer).updateVaultUnderlyingToPerpSwapFeePerc(toPerc("0.1")); - expect(await feePolicy.computeUnderlyingToPerpVaultSwapFeePerc(toPerc("1.01"), toPerc("1.01"))).to.eq( - toPerc("0.1"), - ); + it("should update every field", async function () { + await feePolicy + .connect(deployer) + .updateRebalanceConfig(DEBASE_LAG, ENRICH_LAG, DEBASE_RNG, ENRICH_RNG, REBAL_FREQ); + + const newDebaseLag = await feePolicy.perpDebasementLag(); + const newEnrichLag = await feePolicy.perpEnrichmentLag(); + const newDebaseRng = await feePolicy.perpDebasementPercLimits(); + const newEnrichRng = await feePolicy.perpEnrichmentPercLimits(); + const newFreq = await feePolicy.rebalanceFreqSec(); + + expect(newDebaseLag).to.equal(DEBASE_LAG); + expect(newEnrichLag).to.equal(ENRICH_LAG); + expect(newDebaseRng.lower).to.equal(DEBASE_RNG.lower); + expect(newDebaseRng.upper).to.equal(DEBASE_RNG.upper); + expect(newEnrichRng.lower).to.equal(ENRICH_RNG.lower); + expect(newEnrichRng.upper).to.equal(ENRICH_RNG.upper); + expect(newFreq).to.equal(REBAL_FREQ); }); }); }); - describe("#updateVaultPerpToUnderlyingSwapFeePerc", function () { + describe("#updateProtocolFeeConfig", function () { + const VALID_SHARE = toPerc("0.05"); + const OVER_SHARE = toPerc("1.01"); + describe("when triggered by non-owner", function () { it("should revert", async function () { await expect( - feePolicy.connect(otherUser).updateVaultPerpToUnderlyingSwapFeePerc(toPerc("0.1")), + feePolicy.connect(otherUser).updateProtocolFeeConfig(VALID_SHARE, await otherUser.getAddress()), ).to.be.revertedWith("Ownable: caller is not the owner"); }); }); - describe("when parameters are invalid", function () { - it("should revert", async function () { + describe("when percentage is > 100 %", function () { + it("should revert with InvalidPerc", async function () { await expect( - feePolicy.connect(deployer).updateVaultPerpToUnderlyingSwapFeePerc(toPerc("1.01")), + feePolicy.connect(deployer).updateProtocolFeeConfig(OVER_SHARE, await otherUser.getAddress()), ).to.be.revertedWithCustomError(feePolicy, "InvalidPerc"); }); }); - describe("when triggered by owner", function () { - it("should update the vault burn fees", async function () { - expect(await feePolicy.computePerpToUnderlyingVaultSwapFeePerc(toPerc("1"), toPerc("1"))).to.eq(toPerc("1")); - await feePolicy.connect(deployer).updateVaultPerpToUnderlyingSwapFeePerc(toPerc("0.2")); - expect(await feePolicy.computePerpToUnderlyingVaultSwapFeePerc(toPerc("1"), toPerc("1"))).to.eq(toPerc("0.2")); + describe("when called by owner with valid params", function () { + it("should update both fields", async function () { + await feePolicy.connect(deployer).updateProtocolFeeConfig(VALID_SHARE, await otherUser.getAddress()); + expect(await feePolicy.protocolSharePerc()).to.eq(VALID_SHARE); + expect(await feePolicy.protocolFeeCollector()).to.eq(await otherUser.getAddress()); }); }); }); describe("fee logic", function () { beforeEach(async function () { - await feePolicy.updatePerpMintFees(toPerc("0.025")); - await feePolicy.updatePerpBurnFees(toPerc("0.035")); - await feePolicy.updatePerpRolloverFees({ - lower: toPerc("-0.00253"), - upper: toPerc("0.00769"), - growth: toPerc("5"), - }); - await feePolicy.updateVaultUnderlyingToPerpSwapFeePerc(toPerc("0.1")); - await feePolicy.updateVaultPerpToUnderlyingSwapFeePerc(toPerc("0.15")); - await feePolicy.updateVaultMintFees(toPerc("0.05")); - await feePolicy.updateVaultBurnFees(toPerc("0.075")); - await feePolicy.updateDeviationRatioBounds(toPerc("0.85"), toPerc("1.15")); + await feePolicy.updateFees(toLine("0.66", "0.5", "0.99", "0"), toLine("1.01", "0.01", "1.5", "0.5")); }); - describe("when dr is decreasing", function () { - async function cmpFees(dr1, dr2, fees) { - // perp mint, vault burn and swap u2p - expect(await feePolicy.computePerpMintFeePerc()).to.eq(toPerc(fees[0])); - expect(await feePolicy.computeVaultBurnFeePerc()).to.eq(toPerc(fees[1])); - expect(await feePolicy.computeUnderlyingToPerpVaultSwapFeePerc(toPerc(dr1), toPerc(dr2))).to.eq( - toPerc(fees[2]), - ); - } + async function cmpFees(dr1, dr2, fees) { + expect(await feePolicy.computeFeePerc(toPerc(dr1), toPerc(dr2))).to.eq(toPerc(fees)); + } - describe("when ONE < dr2, dr1", function () { - it("should compute fees as expected", async function () { - await cmpFees("1.1", "1.01", ["0.025", "0.075", "0.1"]); - }); + describe("when dr is decreasing", function () { + it("should compute fees as expected", async function () { + await cmpFees("1.1", "1.01", "0"); + await cmpFees("1.01", "1", "0"); + await cmpFees("1.05", "0.95", "0.01212121"); + await cmpFees("1.01", "0.96", "0.01363636"); + await cmpFees("1.1", "0.99", "0"); + await cmpFees("0.99", "0.95", "0.03030304"); + await cmpFees("0.9", "0.8", "0.21212122"); + await cmpFees("1.2", "0.8", "0.06837121"); + await cmpFees("0.8", "0.75", "0.32575758"); }); + }); - describe("when ONE <= dr2, dr1", function () { - it("should compute fees as expected", async function () { - await cmpFees("1.01", "1", ["0.025", "0.075", "0.1"]); - }); + describe("when dr is increasing", function () { + it("should compute fees as expected", async function () { + await cmpFees("0.8", "0.8", "0.01"); + await cmpFees("0.9", "0.99", "0.01"); + await cmpFees("0.9", "1", "0.01"); + await cmpFees("0.95", "1.05", "0.018"); + await cmpFees("0.99", "1.04", "0.019"); + await cmpFees("0.99", "1.1", "0.04681818"); + await cmpFees("1.01", "1.05", "0.03"); + await cmpFees("1.01", "1.25", "0.13"); + await cmpFees("1.25", "1.35", "0.3"); }); + }); + }); - describe("when dr2 < ONE < dr1", function () { - it("should compute fees as expected", async function () { - await cmpFees("1.05", "0.95", ["0.025", "0.075", "0.1"]); - }); - }); + describe("#computeDeviationRatio", async function () { + beforeEach(async function () { + await feePolicy.updateTargetSystemRatio(toPerc("3")); + }); - describe("when dr2 < ONE < dr1", function () { - it("should compute fees as expected", async function () { - await cmpFees("1.01", "0.96", ["0.025", "0.075", "0.1"]); + describe("when deviation = 1.0", function () { + it("should return 1", async function () { + const r = await feePolicy.computeDeviationRatio({ + perpTVL: toAmt("100"), + vaultTVL: toAmt("300"), }); + expect(r).to.eq(toPerc("1")); }); + }); - describe("when dr2 < ONE < dr1", function () { - it("should compute fees as expected", async function () { - await cmpFees("1.1", "0.99", ["0.025", "0.075", "0.1"]); + describe("when deviation > 1.0", function () { + it("should compute dr", async function () { + const r = await feePolicy.computeDeviationRatio({ + perpTVL: toAmt("100"), + vaultTVL: toAmt("600"), }); + expect(r).to.eq(toPerc("2")); }); + }); - describe("when dr2,dr1 < ONE", function () { - it("should compute fees as expected", async function () { - await cmpFees("0.99", "0.95", ["0.025", "0.075", "0.1"]); + describe("when deviation < 1.0", function () { + it("should compute dr", async function () { + const r = await feePolicy.computeDeviationRatio({ + perpTVL: toAmt("100"), + vaultTVL: toAmt("150"), }); + expect(r).to.eq(toPerc("0.5")); }); + }); + }); - describe("when dr2 < lower < dr1 < ONE", function () { - it("should compute fees as expected", async function () { - await cmpFees("0.9", "0.8", ["0.025", "0.075", "1"]); - }); - }); + describe("#computeRebalanceAmount", async function () { + beforeEach(async function () { + await feePolicy.updateTargetSystemRatio(toPerc("5")); + await feePolicy.connect(deployer).updateRebalanceConfig(1, 1, toRange("0", "10"), toRange("0", "10"), 86400); + }); - describe("when dr2 < lower < ONE < dr1", function () { - it("should compute fees as expected", async function () { - await cmpFees("1.2", "0.8", ["0.025", "0.075", "1"]); + describe("when deviation is within eq range", function () { + it("should compute rebalance data", async function () { + await feePolicy.updateFees(toLine("0", "0.5", "0.5", "0"), toLine("2", "0", "10", "0.5")); + const r1 = await feePolicy.computeRebalanceAmount({ + perpTVL: toAmt("120"), + vaultTVL: toAmt("500"), }); - }); - - describe("when dr2,dr1 < lower", function () { - it("should compute fees as expected", async function () { - await cmpFees("0.8", "0.75", ["0.025", "0.075", "1"]); + expect(r1).to.eq(0n); + const r2 = await feePolicy.computeRebalanceAmount({ + perpTVL: toAmt("80"), + vaultTVL: toAmt("500"), }); + expect(r2).to.eq(0n); }); }); - describe("when dr is increasing", function () { - async function cmpFees(dr1, dr2, fees) { - // perp burn, vault mint and swap p2u - expect(await feePolicy.computePerpBurnFeePerc()).to.eq(toPerc(fees[0])); - expect(await feePolicy.computeVaultMintFeePerc()).to.eq(toPerc(fees[1])); - expect(await feePolicy.computePerpToUnderlyingVaultSwapFeePerc(toPerc(dr1), toPerc(dr2))).to.eq( - toPerc(fees[2]), - ); - } - - describe("when dr1, dr2 < ONE", function () { - it("should compute fees as expected", async function () { - await cmpFees("0.9", "0.99", ["0.035", "0.05", "0.15"]); + describe("when deviation = 1.0", function () { + it("should compute rebalance data", async function () { + const r = await feePolicy.computeRebalanceAmount({ + perpTVL: toAmt("100"), + vaultTVL: toAmt("500"), }); + expect(r).to.eq(0n); }); + }); - describe("when dr1, dr2 <= ONE", function () { - it("should compute fees as expected", async function () { - await cmpFees("0.9", "1", ["0.035", "0.05", "0.15"]); + describe("when deviation ~= 1.0", function () { + it("should compute rebalance data", async function () { + const r = await feePolicy.computeRebalanceAmount({ + perpTVL: toAmt("100"), + vaultTVL: toAmt("500.001"), }); + expect(r).to.eq(0n); }); + }); - describe("when dr1 < ONE < dr2", function () { - it("should compute fees as expected", async function () { - await cmpFees("0.95", "1.05", ["0.035", "0.05", "0.15"]); + describe("when deviation ~= 1.0", function () { + it("should compute rebalance data", async function () { + const r = await feePolicy.computeRebalanceAmount({ + perpTVL: toAmt("99.999"), + vaultTVL: toAmt("500"), }); + expect(r).to.eq(0n); }); + }); - describe("when dr1 < ONE < dr2", function () { - it("should compute fees as expected", async function () { - await cmpFees("0.99", "1.04", ["0.035", "0.05", "0.15"]); + describe("enrichment", function () { + it("should compute rebalance data", async function () { + const r = await feePolicy.computeRebalanceAmount({ + perpTVL: toAmt("100"), + vaultTVL: toAmt("1000"), }); + expect(r).to.eq(toAmt("83.333333333333333333")); }); - describe("when dr1 < ONE < dr2", function () { - it("should compute fees as expected", async function () { - await cmpFees("0.99", "1.1", ["0.035", "0.05", "0.15"]); + it("should compute rebalance data", async function () { + await feePolicy.connect(deployer).updateRebalanceConfig(1, 2, toRange("0", "10"), toRange("0", "10"), 86400); + const r = await feePolicy.computeRebalanceAmount({ + perpTVL: toAmt("100"), + vaultTVL: toAmt("1000"), }); + expect(r).to.eq(toAmt("41.666666666666666666")); }); - describe("when ONE < dr1, dr2 < upper", function () { - it("should compute fees as expected", async function () { - await cmpFees("1.01", "1.05", ["0.035", "0.05", "0.15"]); + it("should compute rebalance data", async function () { + await feePolicy.connect(deployer).updateRebalanceConfig(1, 10, toRange("0", "10"), toRange("0.1", "10"), 86400); + const r = await feePolicy.computeRebalanceAmount({ + perpTVL: toAmt("100"), + vaultTVL: toAmt("1000"), }); + expect(r).to.eq(toAmt("10")); }); - describe("when ONE < dr1 < upper < dr2", function () { - it("should compute fees as expected", async function () { - await cmpFees("1.01", "1.25", ["0.035", "0.05", "1"]); + it("should compute rebalance data", async function () { + await feePolicy.connect(deployer).updateRebalanceConfig(1, 10, toRange("0", "10"), toRange("0", "0.05"), 86400); + const r = await feePolicy.computeRebalanceAmount({ + perpTVL: toAmt("100"), + vaultTVL: toAmt("1000"), }); + expect(r).to.eq(toAmt("5")); }); - describe("when dr1 < ONE < upper < dr2", function () { - it("should compute fees as expected", async function () { - await cmpFees("1.01", "1.25", ["0.035", "0.05", "1"]); + it("should compute rebalance data", async function () { + await feePolicy.connect(deployer).updateRebalanceConfig(1, 10, toRange("0", "10"), toRange("1", "10"), 86400); + const r = await feePolicy.computeRebalanceAmount({ + perpTVL: toAmt("100"), + vaultTVL: toAmt("1000"), }); + expect(r).to.eq(toAmt("83.333333333333333333")); }); + }); - describe("when upper < dr1, dr2", function () { - it("should compute fees as expected", async function () { - await cmpFees("1.25", "1.35", ["0.035", "0.05", "1"]); + describe("debasement", function () { + it("should compute rebalance data", async function () { + const r = await feePolicy.computeRebalanceAmount({ + perpTVL: toAmt("1000"), + vaultTVL: toAmt("2500"), }); + expect(r).to.eq(toAmt("-416.666666666666666667")); }); - }); - describe("rollover fee", function () { - it("should compute fees as expected", async function () { - expect(await feePolicy.computePerpRolloverFeePerc(toPerc("0.01"))).to.eq(toPerc("-0.00242144")); - expect(await feePolicy.computePerpRolloverFeePerc(toPerc("0.25"))).to.eq(toPerc("-0.00228606")); - expect(await feePolicy.computePerpRolloverFeePerc(toPerc("0.5"))).to.eq(toPerc("-0.00196829")); - expect(await feePolicy.computePerpRolloverFeePerc(toPerc("0.75"))).to.eq(toPerc("-0.00128809")); - expect(await feePolicy.computePerpRolloverFeePerc(toPerc("0.9"))).to.eq(toPerc("-0.00060117")); - expect(await feePolicy.computePerpRolloverFeePerc(toPerc("0.99"))).to.eq(toPerc("-0.00004101")); - expect(await feePolicy.computePerpRolloverFeePerc(toPerc("1"))).to.eq("0"); - expect(await feePolicy.computePerpRolloverFeePerc(toPerc("1.01"))).to.eq(toPerc("0.00004146")); - expect(await feePolicy.computePerpRolloverFeePerc(toPerc("1.05"))).to.eq(toPerc("0.00034407")); - expect(await feePolicy.computePerpRolloverFeePerc(toPerc("1.1"))).to.eq(toPerc("0.00071519")); - expect(await feePolicy.computePerpRolloverFeePerc(toPerc("1.25"))).to.eq(toPerc("0.00195646")); - expect(await feePolicy.computePerpRolloverFeePerc(toPerc("1.5"))).to.eq(toPerc("0.00411794")); - expect(await feePolicy.computePerpRolloverFeePerc(toPerc("1.75"))).to.eq(toPerc("0.00580663")); - expect(await feePolicy.computePerpRolloverFeePerc(toPerc("2"))).to.eq(toPerc("0.00680345")); - expect(await feePolicy.computePerpRolloverFeePerc(toPerc("5"))).to.eq(toPerc("0.00768997")); + it("should compute rebalance data", async function () { + await feePolicy.connect(deployer).updateRebalanceConfig(2, 1, toRange("0", "10"), toRange("0", "10"), 86400); + const r = await feePolicy.computeRebalanceAmount({ + perpTVL: toAmt("1000"), + vaultTVL: toAmt("2500"), + }); + expect(r).to.eq(toAmt("-208.333333333333333333")); }); - }); - }); - describe("#computeDeviationRatio", async function () { - beforeEach(async function () { - await feePolicy.updateTargetSubscriptionRatio(toPerc("1.25")); - }); - - describe("when deviation = 1.0", function () { - it("should return 1", async function () { - const r = await feePolicy["computeDeviationRatio((uint256,uint256,uint256))"]({ - perpTVL: toAmt("100"), - vaultTVL: toAmt("500"), - seniorTR: 200, + it("should compute rebalance data", async function () { + await feePolicy + .connect(deployer) + .updateRebalanceConfig(10, 1, toRange("0.05", "10"), toRange("0", "10"), 86400); + const r = await feePolicy.computeRebalanceAmount({ + perpTVL: toAmt("1000"), + vaultTVL: toAmt("2500"), }); - expect(r).to.eq(toPerc("1")); + expect(r).to.eq(toAmt("-50")); }); - }); - describe("when deviation > 1.0", function () { - it("should compute dr", async function () { - const r = await feePolicy["computeDeviationRatio((uint256,uint256,uint256))"]({ - perpTVL: toAmt("100"), - vaultTVL: toAmt("1000"), - seniorTR: 200, + it("should compute rebalance data", async function () { + await feePolicy.connect(deployer).updateRebalanceConfig(10, 1, toRange("0", "0.03"), toRange("0", "10"), 86400); + const r = await feePolicy.computeRebalanceAmount({ + perpTVL: toAmt("1000"), + vaultTVL: toAmt("2500"), }); - expect(r).to.eq(toPerc("2")); + expect(r).to.eq(toAmt("-30")); }); - }); - describe("when deviation < 1.0", function () { - it("should compute dr", async function () { - const r = await feePolicy["computeDeviationRatio((uint256,uint256,uint256))"]({ - perpTVL: toAmt("100"), - vaultTVL: toAmt("250"), - seniorTR: 200, + it("should compute rebalance data", async function () { + await feePolicy.connect(deployer).updateRebalanceConfig(10, 1, toRange("1", "10"), toRange("0", "10"), 86400); + const r = await feePolicy.computeRebalanceAmount({ + perpTVL: toAmt("1000"), + vaultTVL: toAmt("2500"), }); - expect(r).to.eq(toPerc("0.5")); + expect(r).to.eq(toAmt("-416.666666666666666667")); }); }); }); diff --git a/spot-contracts/test/RouterV2.ts b/spot-contracts/test/RouterV2.ts index 040f3433..a278d2c2 100644 --- a/spot-contracts/test/RouterV2.ts +++ b/spot-contracts/test/RouterV2.ts @@ -1,7 +1,6 @@ -import { expect, use } from "chai"; +import { expect } from "chai"; import { network, ethers, upgrades } from "hardhat"; -import { constants, Contract, Signer } from "ethers"; -import { smock } from "@defi-wonderland/smock"; +import { Contract, Signer } from "ethers"; import { setupCollateralToken, setupBondFactory, @@ -11,8 +10,9 @@ import { advancePerpQueue, advanceTime, mintCollteralToken, + DMock, + toPercFixedPtAmt, } from "./helpers"; -use(smock.matchers); let perp: Contract, bondFactory: Contract, @@ -40,21 +40,22 @@ describe("RouterV2", function () { const BondIssuer = await ethers.getContractFactory("BondIssuer"); issuer = await upgrades.deployProxy( BondIssuer.connect(deployer), - [bondFactory.address, collateralToken.address, 3600, [200, 800], 1200, 0], + [bondFactory.target, collateralToken.target, 3600, [200, 800], 1200, 0], { initializer: "init(address,address,uint256,uint256[],uint256,uint256)", }, ); - const FeePolicy = await ethers.getContractFactory("FeePolicy"); - feePolicy = await smock.fake(FeePolicy); - await feePolicy.computePerpRolloverFeePerc.returns("0"); - await feePolicy.decimals.returns(8); + feePolicy = new DMock(await ethers.getContractFactory("FeePolicy")); + await feePolicy.deploy(); + await feePolicy.mockMethod("decimals()", [8]); + await feePolicy.mockMethod("computeDeviationRatio((uint256,uint256))", [toPercFixedPtAmt("1")]); + await feePolicy.mockMethod("computeFeePerc(uint256,uint256)", [0]); const PerpetualTranche = await ethers.getContractFactory("PerpetualTranche"); perp = await upgrades.deployProxy( PerpetualTranche.connect(deployer), - ["PerpetualTranche", "PERP", collateralToken.address, issuer.address, feePolicy.address], + ["PerpetualTranche", "PERP", collateralToken.target, issuer.target, feePolicy.target], { initializer: "init(string,string,address,address,address)", }, @@ -62,12 +63,19 @@ describe("RouterV2", function () { await perp.updateTolerableTrancheMaturity(600, 3600); await advancePerpQueue(perp, 3600); - const RolloverVault = await ethers.getContractFactory("RolloverVault"); - vault = await smock.fake(RolloverVault); - await vault.getTVL.returns("0"); - await perp.updateVault(vault.address); + const TrancheManager = await ethers.getContractFactory("TrancheManager"); + const trancheManager = await TrancheManager.deploy(); + const RolloverVault = await ethers.getContractFactory("RolloverVault", { + libraries: { + TrancheManager: trancheManager.target, + }, + }); + vault = new DMock(RolloverVault); + await vault.deploy(); + await vault.mockMethod("getTVL()", [0]); + await perp.updateVault(vault.target); - depositBond = await bondAt(await perp.callStatic.getDepositBond()); + depositBond = await bondAt(await perp.getDepositBond.staticCall()); depositTranches = await getTranches(depositBond); const Router = await ethers.getContractFactory("RouterV2"); @@ -80,11 +88,11 @@ describe("RouterV2", function () { describe("#previewTranche", function () { it("should compute the tranche amounts", async function () { - const r = await router.callStatic.previewTranche(perp.address, toFixedPtAmt("1000")); - expect(r[0]).to.eq(await perp.callStatic.getDepositBond()); - expect(r[1][0].token).to.eq(depositTranches[0].address); + const r = await router.previewTranche.staticCall(perp.target, toFixedPtAmt("1000")); + expect(r[0]).to.eq(await perp.getDepositBond.staticCall()); + expect(r[1][0].token).to.eq(depositTranches[0].target); expect(r[1][0].amount).to.eq(toFixedPtAmt("200")); - expect(r[1][1].token).to.eq(depositTranches[1].address); + expect(r[1][1].token).to.eq(depositTranches[1].target); expect(r[1][1].amount).to.eq(toFixedPtAmt("800")); }); }); @@ -92,37 +100,37 @@ describe("RouterV2", function () { describe("#trancheAndDeposit", function () { beforeEach(async function () { await mintCollteralToken(collateralToken, toFixedPtAmt("1100"), deployer); - await collateralToken.transfer(router.address, toFixedPtAmt("100")); + await collateralToken.transfer(router.target, toFixedPtAmt("100")); }); describe("when deposit bond is incorrect", function () { beforeEach(async function () { - await collateralToken.approve(router.address, constants.MaxUint256); + await collateralToken.approve(router.target, ethers.MaxUint256); await advancePerpQueue(perp, 7200); }); it("should revert", async function () { await expect( - router.trancheAndDeposit(perp.address, depositBond.address, toFixedPtAmt("1000")), + router.trancheAndDeposit(perp.target, depositBond.target, toFixedPtAmt("1000")), ).to.revertedWithCustomError(perp, "UnexpectedAsset"); }); }); describe("when deposit bond is not issued", function () { beforeEach(async function () { - await collateralToken.approve(router.address, constants.MaxUint256); + await collateralToken.approve(router.target, ethers.MaxUint256); await advanceTime(7200); }); it("should not revert", async function () { - const depositBond = await bondAt(await perp.callStatic.getDepositBond()); - await expect(router.trancheAndDeposit(perp.address, depositBond.address, toFixedPtAmt("1000"))).not.to.be + const depositBond = await bondAt(await perp.getDepositBond.staticCall()); + await expect(router.trancheAndDeposit(perp.target, depositBond.target, toFixedPtAmt("1000"))).not.to.be .reverted; }); }); describe("when deposit bond is correct", function () { beforeEach(async function () { - await collateralToken.approve(router.address, constants.MaxUint256); - await router.trancheAndDeposit(perp.address, depositBond.address, toFixedPtAmt("1000")); + await collateralToken.approve(router.target, ethers.MaxUint256); + await router.trancheAndDeposit(perp.target, depositBond.target, toFixedPtAmt("1000")); }); it("should mint tranches", async function () { @@ -139,10 +147,10 @@ describe("RouterV2", function () { }); it("should leave no dust", async function () { - expect(await depositTranches[0].balanceOf(router.address)).to.eq("0"); - expect(await depositTranches[1].balanceOf(router.address)).to.eq("0"); - expect(await perp.balanceOf(router.address)).to.eq("0"); - expect(await collateralToken.balanceOf(router.address)).to.eq("0"); + expect(await depositTranches[0].balanceOf(router.target)).to.eq("0"); + expect(await depositTranches[1].balanceOf(router.target)).to.eq("0"); + expect(await perp.balanceOf(router.target)).to.eq("0"); + expect(await collateralToken.balanceOf(router.target)).to.eq("0"); }); }); }); diff --git a/spot-contracts/test/_utils/HelpersTester.ts b/spot-contracts/test/_utils/HelpersTester.ts index 09cf7d7e..a428e892 100644 --- a/spot-contracts/test/_utils/HelpersTester.ts +++ b/spot-contracts/test/_utils/HelpersTester.ts @@ -1,8 +1,6 @@ -import { expect, use } from "chai"; +import { expect } from "chai"; import { network, ethers } from "hardhat"; import { Contract, Signer } from "ethers"; -import { smock } from "@defi-wonderland/smock"; - import { TimeHelpers, setupCollateralToken, @@ -15,8 +13,8 @@ import { getTranches, getContractFactoryFromExternalArtifacts, mintCollteralToken, + DMock, } from "../helpers"; -use(smock.matchers); let bondFactory: Contract, collateralToken: Contract, @@ -37,13 +35,10 @@ async function setupContracts() { deployerAddress = await deployer.getAddress(); user = accounts[1]; userAddress = await user.getAddress(); - bondFactory = await setupBondFactory(); ({ collateralToken, rebaseOracle } = await setupCollateralToken("Bitcoin", "BTC")); - const HelpersTester = await ethers.getContractFactory("HelpersTester"); helper = await HelpersTester.deploy(); - await helper.deployed(); } describe("HelpersTester", function () { @@ -52,28 +47,28 @@ describe("HelpersTester", function () { }); after(async function () { - await network.provider.send("hardhat_reset"); + await network.provider.request({ method: "hardhat_reset" }); }); describe("#timeToMatirity", function () { - let maturityDate: number, bondLength: number, bond: Contract; + let maturityDate: BigInt, bondLength: BigInt, bond: Contract; beforeEach(async function () { bondLength = 86400; bond = await createBondWithFactory(bondFactory, collateralToken, [1000], bondLength); - maturityDate = (await bond.maturityDate()).toNumber(); + maturityDate = await bond.maturityDate(); }); describe("when bond is NOT mature", function () { it("should return the time to maturity", async function () { - await TimeHelpers.setNextBlockTimestamp(maturityDate - bondLength / 2); - expect(await helper.secondsToMaturity(bond.address)).to.eq(bondLength / 2); + await TimeHelpers.setNextBlockTimestamp(Number(maturityDate) - bondLength / 2); + expect(await helper.secondsToMaturity(bond.target)).to.eq(bondLength / 2); }); }); describe("when bond is mature", function () { it("should return the time to maturity", async function () { - await TimeHelpers.setNextBlockTimestamp(maturityDate + 1); - expect(await helper.secondsToMaturity(bond.address)).to.eq(0); + await TimeHelpers.setNextBlockTimestamp(Number(maturityDate) + 1); + expect(await helper.secondsToMaturity(bond.target)).to.eq(0); }); }); }); @@ -81,12 +76,12 @@ describe("HelpersTester", function () { describe("#getTranches", function () { it("should revert if bond has more than 2 tranches", async function () { const bond = await createBondWithFactory(bondFactory, collateralToken, [200, 300, 500], 86400); - await expect(helper.getTranches(bond.address)).to.be.revertedWithCustomError(helper, "UnacceptableTrancheLength"); + await expect(helper.getTranches(bond.target)).to.be.revertedWithCustomError(helper, "UnacceptableTrancheLength"); }); it("should return the tranche data", async function () { const bond = await createBondWithFactory(bondFactory, collateralToken, [498, 502], 86400); - const td = await helper.getTranches(bond.address); + const td = await helper.getTranches(bond.target); expect(td.tranches.length).to.eq(2); expect(td.trancheRatios.length).to.eq(2); expect(td.trancheRatios[0]).to.eq(498); @@ -100,24 +95,24 @@ describe("HelpersTester", function () { it("should return the tranche when given index", async function () { const bond = await createBondWithFactory(bondFactory, collateralToken, [100, 100, 100, 100, 100, 500], 86400); for (let i = 0; i < 6; i++) { - expect(await helper.trancheAt(bond.address, i)).to.eq((await bond.tranches(i))[0]); + expect(await helper.trancheAt(bond.target, i)).to.eq((await bond.tranches(i))[0]); } - await expect(helper.trancheAt(bond.address, 7)).to.be.reverted; + await expect(helper.trancheAt(bond.target, 7)).to.be.reverted; }); }); - describe("#getSeniorTranche", function () { + describe("#seniorTranche", function () { it("should return the tranche when given index", async function () { const bond = await createBondWithFactory(bondFactory, collateralToken, [300, 700], 86400); - const td = await helper.getTranches(bond.address); - expect(await helper.getSeniorTranche(bond.address)).to.eq(td.tranches[0]); + const td = await helper.getTranches(bond.target); + expect(await helper.getSeniorTranche(bond.target)).to.eq(td.tranches[0]); }); }); - describe("#getSeniorTrancheRatio", function () { + describe("#seniorTrancheRatio", function () { it("should return the tranche when given index", async function () { const bond = await createBondWithFactory(bondFactory, collateralToken, [50, 950], 86400); - const ratio = await helper.getSeniorTrancheRatio(bond.address); + const ratio = await helper.getSeniorTrancheRatio(bond.target); expect(ratio).to.eq(50); }); }); @@ -131,7 +126,7 @@ describe("HelpersTester", function () { describe("if bond is mature", function () { it("should revert", async function () { await bond.mature(); - await expect(helper.previewDeposit(bond.address, toFixedPtAmt("1000"))).to.be.revertedWithCustomError( + await expect(helper.previewDeposit(bond.target, toFixedPtAmt("1000"))).to.be.revertedWithCustomError( helper, "UnacceptableDeposit", ); @@ -140,7 +135,7 @@ describe("HelpersTester", function () { describe("first deposit", function () { it("should calculate the tranche balances after deposit", async function () { - const d = await helper.previewDeposit(bond.address, toFixedPtAmt("1000")); + const d = await helper.previewDeposit(bond.target, toFixedPtAmt("1000")); expect(d[0].amount).to.eq(toFixedPtAmt("500")); expect(d[1].amount).to.eq(toFixedPtAmt("500")); }); @@ -163,7 +158,7 @@ describe("HelpersTester", function () { await rebase(collateralToken, rebaseOracle, 0); }); it("should calculate the tranche balances after deposit", async function () { - const d = await helper.previewDeposit(bond.address, toFixedPtAmt("1000")); + const d = await helper.previewDeposit(bond.target, toFixedPtAmt("1000")); expect(d[0].amount).to.eq(toFixedPtAmt("500")); expect(d[1].amount).to.eq(toFixedPtAmt("500")); }); @@ -181,7 +176,7 @@ describe("HelpersTester", function () { await rebase(collateralToken, rebaseOracle, +0.25); }); it("should calculate the tranche balances after deposit", async function () { - const d = await helper.previewDeposit(bond.address, toFixedPtAmt("1000")); + const d = await helper.previewDeposit(bond.target, toFixedPtAmt("1000")); expect(d[0].amount).to.eq(toFixedPtAmt("400")); expect(d[1].amount).to.eq(toFixedPtAmt("400")); }); @@ -199,7 +194,7 @@ describe("HelpersTester", function () { await rebase(collateralToken, rebaseOracle, -0.5); }); it("should calculate the tranche balances after deposit", async function () { - const d = await helper.previewDeposit(bond.address, toFixedPtAmt("1000")); + const d = await helper.previewDeposit(bond.target, toFixedPtAmt("1000")); expect(d[0].amount).to.eq(toFixedPtAmt("1000")); expect(d[1].amount).to.eq(toFixedPtAmt("1000")); }); @@ -220,7 +215,7 @@ describe("BondTranchesHelpers", function () { }); after(async function () { - await network.provider.send("hardhat_reset"); + await network.provider.request({ method: "hardhat_reset" }); }); describe("#computeRedeemableTrancheAmounts", function () { @@ -237,19 +232,21 @@ describe("BondTranchesHelpers", function () { for (const a in amounts) { await tranches[a].transfer(userAddress, toFixedPtAmt(amounts[a])); } - const b = await helper["computeRedeemableTrancheAmounts(address,address)"](bond.address, userAddress); + const b = await helper["computeRedeemableTrancheAmounts(address,address)"](bond.target, userAddress); for (const a in redemptionAmts) { expect(b[1][a]).to.eq(toFixedPtAmt(redemptionAmts[a])); } - if (b[1][0].gt("0")) { - await bond.connect(user).redeem(b[1]); + if (b[1][0] > 0n) { + await bond.connect(user).redeem([b[1][0], b[1][1]]); } } describe("when the user has the entire supply", function () { describe("[200,800]:[200,800]", async function () { it("should calculate the amounts", async function () { - await checkRedeemableAmts([200, 800], ["200", "800"], ["200", "800"]); + await expect(checkRedeemableAmts([200, 800], ["200", "800"], ["200", "800"])).to.be.revertedWith( + "BondController: Expected minimum valid debt", + ); }); }); }); @@ -265,26 +262,26 @@ describe("BondTranchesHelpers", function () { describe("when the user does not have tranches right proportions", function () { async function checkRedeemableAmts( - trancheRatios: number[] = [], + trancheRatios: BigInt[] = [], amounts: string[] = [], redemptionAmts: string[] = [], ) { const bond = await createBondWithFactory(bondFactory, collateralToken, trancheRatios, 86400); const amt = amounts - .map((a, i) => toFixedPtAmt(a).mul("1000").div(trancheRatios[i])) - .reduce((m, a) => (m.gt(a) ? m : a), toFixedPtAmt("0")); - await depositIntoBond(bond, amt.add(toFixedPtAmt("1")), deployer); + .map((a, i) => (toFixedPtAmt(a) * BigInt("1000")) / BigInt(trancheRatios[i])) + .reduce((m, a) => (m > a ? m : a), 0n); + await depositIntoBond(bond, amt + toFixedPtAmt("1"), deployer); const tranches = await getTranches(bond); for (const a in amounts) { await tranches[a].transfer(userAddress, toFixedPtAmt(amounts[a])); } - const b = await helper["computeRedeemableTrancheAmounts(address,address)"](bond.address, userAddress); + const b = await helper["computeRedeemableTrancheAmounts(address,address)"](bond.target, userAddress); for (const a in redemptionAmts) { expect(b[1][a]).to.eq(toFixedPtAmt(redemptionAmts[a])); } - if (b[1][0].gt("0")) { - await bond.connect(user).redeem(b[1]); + if (b[1][0] > 0n) { + await bond.connect(user).redeem([b[1][0], b[1][1]]); } } @@ -402,7 +399,7 @@ describe("BondTranchesHelpers", function () { ) { bond = await createBondWithFactory(bondFactory, collateralToken, trancheRatios, 86400); const b = await helper["computeRedeemableTrancheAmounts(address,uint256[])"]( - bond.address, + bond.target, amounts.map(toFixedPtAmt), ); for (const a in redemptionAmts) { @@ -447,12 +444,12 @@ describe("BondTranchesHelpers", function () { ) { const bond = await createBondWithFactory(bondFactory, collateralToken, trancheRatios, 86400); const amt = amounts - .map((a, i) => toFixedPtAmt(a).mul("1000").div(trancheRatios[i])) - .reduce((m, a) => (m.gt(a) ? m : a), toFixedPtAmt("0")); - await depositIntoBond(bond, amt.add(toFixedPtAmt("1")), deployer); + .map((a, i) => (toFixedPtAmt(a) * BigInt("1000")) / BigInt(trancheRatios[i])) + .reduce((m, a) => (m > a ? m : a), 0n); + await depositIntoBond(bond, amt + toFixedPtAmt("1"), deployer); const b = await helper["computeRedeemableTrancheAmounts(address,uint256[])"]( - bond.address, + bond.target, amounts.map(toFixedPtAmt), ); for (const a in redemptionAmts) { @@ -571,11 +568,11 @@ describe("TrancheHelpers", function () { }); after(async function () { - await network.provider.send("hardhat_reset"); + await network.provider.request({ method: "hardhat_reset" }); }); describe("#getTrancheCollateralizations", function () { - let bond: Contract, bondLength: number, tranches: Contract[]; + let bond: Contract, bondLength: BigInt, tranches: Contract[]; beforeEach(async function () { bondLength = 86400; bond = await createBondWithFactory(bondFactory, collateralToken, [250, 750], bondLength); @@ -587,7 +584,7 @@ describe("TrancheHelpers", function () { it("should return 0", async function () { const bond = await createBondWithFactory(bondFactory, collateralToken, [1000], bondLength); const tranches = await getTranches(bond); - await expect(helper.getTrancheCollateralizations(tranches[0].address)).to.be.revertedWithCustomError( + await expect(helper.getTrancheCollateralizations(tranches[0].target)).to.be.revertedWithCustomError( helper, "UnacceptableTrancheLength", ); @@ -598,7 +595,7 @@ describe("TrancheHelpers", function () { it("should return 0", async function () { const bond = await createBondWithFactory(bondFactory, collateralToken, [100, 200, 700], bondLength); const tranches = await getTranches(bond); - await expect(helper.getTrancheCollateralizations(tranches[0].address)).to.be.revertedWithCustomError( + await expect(helper.getTrancheCollateralizations(tranches[0].target)).to.be.revertedWithCustomError( helper, "UnacceptableTrancheLength", ); @@ -610,11 +607,11 @@ describe("TrancheHelpers", function () { const bond = await createBondWithFactory(bondFactory, collateralToken, [333, 667], bondLength); const tranches = await getTranches(bond); - const t0 = await helper.getTrancheCollateralizations(tranches[0].address); + const t0 = await helper.getTrancheCollateralizations(tranches[0].target); expect(t0[0]).to.eq("0"); expect(t0[1]).to.eq("0"); - const t1 = await helper.getTrancheCollateralizations(tranches[1].address); + const t1 = await helper.getTrancheCollateralizations(tranches[1].target); expect(t1[0]).to.eq("0"); expect(t1[1]).to.eq("0"); }); @@ -623,11 +620,11 @@ describe("TrancheHelpers", function () { describe("when bond not mature", function () { describe("when no change in supply", function () { it("should calculate the balances", async function () { - const t0 = await helper.getTrancheCollateralizations(tranches[0].address); + const t0 = await helper.getTrancheCollateralizations(tranches[0].target); expect(t0[0]).to.eq(toFixedPtAmt("250")); expect(t0[1]).to.eq(toFixedPtAmt("250")); - const t1 = await helper.getTrancheCollateralizations(tranches[1].address); + const t1 = await helper.getTrancheCollateralizations(tranches[1].target); expect(t1[0]).to.eq(toFixedPtAmt("750")); expect(t1[1]).to.eq(toFixedPtAmt("750")); }); @@ -636,10 +633,10 @@ describe("TrancheHelpers", function () { describe("when supply increases above bond threshold", function () { it("should calculate the balances", async function () { await rebase(collateralToken, rebaseOracle, 0.1); - const t0 = await helper.getTrancheCollateralizations(tranches[0].address); + const t0 = await helper.getTrancheCollateralizations(tranches[0].target); expect(t0[0]).to.eq(toFixedPtAmt("250")); expect(t0[1]).to.eq(toFixedPtAmt("250")); - const t1 = await helper.getTrancheCollateralizations(tranches[1].address); + const t1 = await helper.getTrancheCollateralizations(tranches[1].target); expect(t1[0]).to.eq(toFixedPtAmt("850")); expect(t1[1]).to.eq(toFixedPtAmt("750")); }); @@ -648,10 +645,10 @@ describe("TrancheHelpers", function () { describe("when supply decreases below bond threshold", function () { it("should calculate the balances", async function () { await rebase(collateralToken, rebaseOracle, -0.1); - const t0 = await helper.getTrancheCollateralizations(tranches[0].address); + const t0 = await helper.getTrancheCollateralizations(tranches[0].target); expect(t0[0]).to.eq(toFixedPtAmt("250")); expect(t0[1]).to.eq(toFixedPtAmt("250")); - const t1 = await helper.getTrancheCollateralizations(tranches[1].address); + const t1 = await helper.getTrancheCollateralizations(tranches[1].target); expect(t1[0]).to.eq(toFixedPtAmt("650")); expect(t1[1]).to.eq(toFixedPtAmt("750")); }); @@ -660,10 +657,10 @@ describe("TrancheHelpers", function () { describe("when supply decreases below junior threshold", function () { it("should calculate the balances", async function () { await rebase(collateralToken, rebaseOracle, -0.8); - const t0 = await helper.getTrancheCollateralizations(tranches[0].address); + const t0 = await helper.getTrancheCollateralizations(tranches[0].target); expect(t0[0]).to.eq(toFixedPtAmt("200")); expect(t0[1]).to.eq(toFixedPtAmt("250")); - const t1 = await helper.getTrancheCollateralizations(tranches[1].address); + const t1 = await helper.getTrancheCollateralizations(tranches[1].target); expect(t1[0]).to.eq("0"); expect(t1[1]).to.eq(toFixedPtAmt("750")); }); @@ -672,16 +669,16 @@ describe("TrancheHelpers", function () { describe("when bond is mature", function () { beforeEach(async function () { - await TimeHelpers.increaseTime(bondLength); + await TimeHelpers.increaseTime(Number(bondLength)); await bond.mature(); // NOTE: Any rebase after maturity goes directly to the tranches }); describe("when no change in supply", function () { it("should calculate the balances", async function () { - const t0 = await helper.getTrancheCollateralizations(tranches[0].address); + const t0 = await helper.getTrancheCollateralizations(tranches[0].target); expect(t0[0]).to.eq(toFixedPtAmt("250")); expect(t0[1]).to.eq(toFixedPtAmt("250")); - const t1 = await helper.getTrancheCollateralizations(tranches[1].address); + const t1 = await helper.getTrancheCollateralizations(tranches[1].target); expect(t1[0]).to.eq(toFixedPtAmt("750")); expect(t1[1]).to.eq(toFixedPtAmt("750")); }); @@ -690,10 +687,10 @@ describe("TrancheHelpers", function () { describe("when supply increases", function () { it("should calculate the balances", async function () { await rebase(collateralToken, rebaseOracle, 0.1); - const t0 = await helper.getTrancheCollateralizations(tranches[0].address); + const t0 = await helper.getTrancheCollateralizations(tranches[0].target); expect(t0[0]).to.eq(toFixedPtAmt("275")); expect(t0[1]).to.eq(toFixedPtAmt("250")); - const t1 = await helper.getTrancheCollateralizations(tranches[1].address); + const t1 = await helper.getTrancheCollateralizations(tranches[1].target); expect(t1[0]).to.eq(toFixedPtAmt("825")); expect(t1[1]).to.eq(toFixedPtAmt("750")); }); @@ -702,10 +699,10 @@ describe("TrancheHelpers", function () { describe("when supply decreases", function () { it("should calculate the balances", async function () { await rebase(collateralToken, rebaseOracle, -0.1); - const t0 = await helper.getTrancheCollateralizations(tranches[0].address); + const t0 = await helper.getTrancheCollateralizations(tranches[0].target); expect(t0[0]).to.eq(toFixedPtAmt("225")); expect(t0[1]).to.eq(toFixedPtAmt("250")); - const t1 = await helper.getTrancheCollateralizations(tranches[1].address); + const t1 = await helper.getTrancheCollateralizations(tranches[1].target); expect(t1[0]).to.eq(toFixedPtAmt("675")); expect(t1[1]).to.eq(toFixedPtAmt("750")); }); @@ -718,35 +715,32 @@ describe("PerpHelpers", function () { beforeEach(async () => { await setupContracts(); - const PerpetualTranche = await ethers.getContractFactory("PerpetualTranche"); - perp = await smock.fake(PerpetualTranche); - - const BondController = await getContractFactoryFromExternalArtifacts("BondController"); - depositBond = await smock.fake(BondController); - - const Tranche = await getContractFactoryFromExternalArtifacts("Tranche"); - depositTranche = await smock.fake(Tranche); - - await perp.getDepositBond.returns(depositBond.address); - await perp.totalSupply.returns(toFixedPtAmt("100")); + perp = new DMock(await ethers.getContractFactory("PerpetualTranche")); + await perp.deploy(); + depositBond = new DMock(await getContractFactoryFromExternalArtifacts("BondController")); + await depositBond.deploy(); + depositTranche = new DMock(await getContractFactoryFromExternalArtifacts("Tranche")); + await depositTranche.deploy(); + await perp.mockMethod("getDepositBond()", [depositBond.target]); + await perp.mockMethod("totalSupply()", [toFixedPtAmt("100")]); await mintCollteralToken(collateralToken, toFixedPtAmt("500"), deployer); - await collateralToken.transfer(depositBond.address, toFixedPtAmt("500")); - await depositBond.collateralToken.returns(collateralToken.address); - await depositBond.tranches.whenCalledWith(0).returns([depositTranche.address, 200]); - await depositBond.totalDebt.returns(toFixedPtAmt("500")); - await depositTranche.totalSupply.returns(toFixedPtAmt("100")); + await collateralToken.transfer(depositBond.target, toFixedPtAmt("500")); + await depositBond.mockMethod("collateralToken()", [collateralToken.target]); + await depositBond.mockMethod("tranches(uint256)", [depositTranche.target, 200]); + await depositBond.mockMethod("totalDebt()", [toFixedPtAmt("500")]); + await depositTranche.mockMethod("totalSupply()", [toFixedPtAmt("100")]); }); after(async function () { - await network.provider.send("hardhat_reset"); + await network.provider.request({ method: "hardhat_reset" }); }); describe("when perp price = 1", async function () { describe("when bond cdr = 1", async function () { it("should compute the underlying amount", async function () { - const r = await helper.callStatic.estimateUnderlyingAmtToTranche( - perp.address, + const r = await helper.estimateUnderlyingAmtToTranche.staticCall( + perp.target, toFixedPtAmt("100"), toFixedPtAmt("10"), ); @@ -760,8 +754,8 @@ describe("PerpHelpers", function () { await rebase(collateralToken, rebaseOracle, 0.1); }); it("should compute the underlying amount", async function () { - const r = await helper.callStatic.estimateUnderlyingAmtToTranche( - perp.address, + const r = await helper.estimateUnderlyingAmtToTranche.staticCall( + perp.target, toFixedPtAmt("100"), toFixedPtAmt("10"), ); @@ -775,8 +769,8 @@ describe("PerpHelpers", function () { await rebase(collateralToken, rebaseOracle, -0.1); }); it("should compute the underlying amount", async function () { - const r = await helper.callStatic.estimateUnderlyingAmtToTranche( - perp.address, + const r = await helper.estimateUnderlyingAmtToTranche.staticCall( + perp.target, toFixedPtAmt("100"), toFixedPtAmt("10"), ); @@ -790,8 +784,8 @@ describe("PerpHelpers", function () { await rebase(collateralToken, rebaseOracle, -0.9); }); it("should compute the underlying amount", async function () { - const r = await helper.callStatic.estimateUnderlyingAmtToTranche( - perp.address, + const r = await helper.estimateUnderlyingAmtToTranche.staticCall( + perp.target, toFixedPtAmt("100"), toFixedPtAmt("10"), ); @@ -804,8 +798,8 @@ describe("PerpHelpers", function () { describe("when perp price > 1", async function () { describe("when bond cdr = 1", async function () { it("should compute the underlying amount", async function () { - const r = await helper.callStatic.estimateUnderlyingAmtToTranche( - perp.address, + const r = await helper.estimateUnderlyingAmtToTranche.staticCall( + perp.target, toFixedPtAmt("200"), toFixedPtAmt("10"), ); @@ -819,8 +813,8 @@ describe("PerpHelpers", function () { await rebase(collateralToken, rebaseOracle, 0.1); }); it("should compute the underlying amount", async function () { - const r = await helper.callStatic.estimateUnderlyingAmtToTranche( - perp.address, + const r = await helper.estimateUnderlyingAmtToTranche.staticCall( + perp.target, toFixedPtAmt("200"), toFixedPtAmt("10"), ); @@ -834,8 +828,8 @@ describe("PerpHelpers", function () { await rebase(collateralToken, rebaseOracle, -0.1); }); it("should compute the underlying amount", async function () { - const r = await helper.callStatic.estimateUnderlyingAmtToTranche( - perp.address, + const r = await helper.estimateUnderlyingAmtToTranche.staticCall( + perp.target, toFixedPtAmt("200"), toFixedPtAmt("10"), ); @@ -849,8 +843,8 @@ describe("PerpHelpers", function () { await rebase(collateralToken, rebaseOracle, -0.9); }); it("should compute the underlying amount", async function () { - const r = await helper.callStatic.estimateUnderlyingAmtToTranche( - perp.address, + const r = await helper.estimateUnderlyingAmtToTranche.staticCall( + perp.target, toFixedPtAmt("200"), toFixedPtAmt("10"), ); @@ -863,8 +857,8 @@ describe("PerpHelpers", function () { describe("when perp price < 1", async function () { describe("when bond cdr = 1", async function () { it("should compute the underlying amount", async function () { - const r = await helper.callStatic.estimateUnderlyingAmtToTranche( - perp.address, + const r = await helper.estimateUnderlyingAmtToTranche.staticCall( + perp.target, toFixedPtAmt("50"), toFixedPtAmt("10"), ); @@ -878,8 +872,8 @@ describe("PerpHelpers", function () { await rebase(collateralToken, rebaseOracle, 0.1); }); it("should compute the underlying amount", async function () { - const r = await helper.callStatic.estimateUnderlyingAmtToTranche( - perp.address, + const r = await helper.estimateUnderlyingAmtToTranche.staticCall( + perp.target, toFixedPtAmt("50"), toFixedPtAmt("10"), ); @@ -893,8 +887,8 @@ describe("PerpHelpers", function () { await rebase(collateralToken, rebaseOracle, -0.1); }); it("should compute the underlying amount", async function () { - const r = await helper.callStatic.estimateUnderlyingAmtToTranche( - perp.address, + const r = await helper.estimateUnderlyingAmtToTranche.staticCall( + perp.target, toFixedPtAmt("50"), toFixedPtAmt("10"), ); @@ -908,8 +902,8 @@ describe("PerpHelpers", function () { await rebase(collateralToken, rebaseOracle, -0.9); }); it("should compute the underlying amount", async function () { - const r = await helper.callStatic.estimateUnderlyingAmtToTranche( - perp.address, + const r = await helper.estimateUnderlyingAmtToTranche.staticCall( + perp.target, toFixedPtAmt("50"), toFixedPtAmt("10"), ); @@ -921,8 +915,8 @@ describe("PerpHelpers", function () { describe("imperfect rounding", async function () { it("should compute the underlying amount", async function () { - const r = await helper.callStatic.estimateUnderlyingAmtToTranche( - perp.address, + const r = await helper.estimateUnderlyingAmtToTranche.staticCall( + perp.target, toFixedPtAmt("100"), toFixedPtAmt("0.999999999999999999"), ); @@ -933,13 +927,13 @@ describe("PerpHelpers", function () { describe("when perp supply is zero", function () { beforeEach(async function () { - await perp.totalSupply.returns("0"); + await perp.mockMethod("totalSupply()", [0n]); }); describe("when bond cdr = 1", async function () { it("should compute the underlying amount", async function () { - const r = await helper.callStatic.estimateUnderlyingAmtToTranche( - perp.address, + const r = await helper.estimateUnderlyingAmtToTranche.staticCall( + perp.target, toFixedPtAmt("100"), toFixedPtAmt("10"), ); @@ -953,8 +947,8 @@ describe("PerpHelpers", function () { await rebase(collateralToken, rebaseOracle, 0.1); }); it("should compute the underlying amount", async function () { - const r = await helper.callStatic.estimateUnderlyingAmtToTranche( - perp.address, + const r = await helper.estimateUnderlyingAmtToTranche.staticCall( + perp.target, toFixedPtAmt("100"), toFixedPtAmt("10"), ); @@ -968,8 +962,8 @@ describe("PerpHelpers", function () { await rebase(collateralToken, rebaseOracle, -0.1); }); it("should compute the underlying amount", async function () { - const r = await helper.callStatic.estimateUnderlyingAmtToTranche( - perp.address, + const r = await helper.estimateUnderlyingAmtToTranche.staticCall( + perp.target, toFixedPtAmt("100"), toFixedPtAmt("10"), ); @@ -983,8 +977,8 @@ describe("PerpHelpers", function () { await rebase(collateralToken, rebaseOracle, -0.9); }); it("should compute the underlying amount", async function () { - const r = await helper.callStatic.estimateUnderlyingAmtToTranche( - perp.address, + const r = await helper.estimateUnderlyingAmtToTranche.staticCall( + perp.target, toFixedPtAmt("100"), toFixedPtAmt("10"), ); @@ -996,13 +990,13 @@ describe("PerpHelpers", function () { describe("when deposit bond has no deposits yet", function () { beforeEach(async function () { - await depositBond.totalDebt.returns("0"); - await depositTranche.totalSupply.returns("0"); + await depositBond.mockMethod("totalDebt()", [0n]); + await depositTranche.mockMethod("totalSupply()", [0n]); }); it("should compute the underlying amount", async function () { - const r = await helper.callStatic.estimateUnderlyingAmtToTranche( - perp.address, + const r = await helper.estimateUnderlyingAmtToTranche.staticCall( + perp.target, toFixedPtAmt("100"), toFixedPtAmt("10"), ); diff --git a/spot-contracts/test/_utils/LineHelpers.ts b/spot-contracts/test/_utils/LineHelpers.ts new file mode 100644 index 00000000..47c2cf50 --- /dev/null +++ b/spot-contracts/test/_utils/LineHelpers.ts @@ -0,0 +1,97 @@ +import { ethers } from "hardhat"; +import { expect } from "chai"; +import { Contract } from "ethers"; + +interface Line { + x1: number; + y1: number; + x2: number; + y2: number; +} + +interface Range { + lower: number; + upper: number; +} + +describe("LineHelpers", function () { + let lineHelpersTest: Contract; + + before(async function () { + const TestFactory = await ethers.getContractFactory("LineHelpersTester"); + lineHelpersTest = await TestFactory.deploy(); + }); + + describe("computePiecewiseAvgY", function () { + it("should compute average when xRange is entirely below the breakpoint", async function () { + // Branch: xRange.upper <= xBreakPt + // Use fn1: f(x) = 2x + 5, defined by points (0,5) and (10,25) + // Use fn2: arbitrary (not used in this branch), e.g. f(x) = 3x + 7 + // xRange: lower = 10, upper = 20, xBreakPt = 30 + // Expected: avgY(fn1, [10,20]) = 2*((10+20)/2) + 5 = 35. + const fn1: Line = { x1: 0, y1: 5, x2: 10, y2: 25 }; + const fn2: Line = { x1: 0, y1: 7, x2: 10, y2: 37 }; + const xRange: Range = { lower: 10, upper: 20 }; + const xBreakPt = 30; + const result = await lineHelpersTest.computePiecewiseAvgY(fn1, fn2, xRange, xBreakPt); + expect(result).to.equal(35); + }); + + it("should compute average when xRange is entirely above the breakpoint", async function () { + // Branch: xRange.lower >= xBreakPt + // Use fn2: f(x) = 3x + 7, defined by (0,7) and (10,37) + // xRange: lower = 40, upper = 50, xBreakPt = 30 + // Expected: avgY(fn2, [40,50]) = 3*((40+50)/2) + 7 = 142. + const fn1: Line = { x1: 0, y1: 5, x2: 10, y2: 25 }; // dummy function + const fn2: Line = { x1: 0, y1: 7, x2: 10, y2: 37 }; + const xRange: Range = { lower: 40, upper: 50 }; + const xBreakPt = 30; + const result = await lineHelpersTest.computePiecewiseAvgY(fn1, fn2, xRange, xBreakPt); + expect(result).to.equal(142); + }); + + it("should compute weighted average when xRange spans the breakpoint", async function () { + // Branch: xRange.lower < xBreakPt < xRange.upper + // Use fn1: f(x) = 2x + 5 for [20,30] + // Use fn2: f(x) = 3x + 7 for [30,40] + // xRange: lower = 20, upper = 40, xBreakPt = 30. + // Compute averages: + // avgY(fn1, [20,30]) = 2*((20+30)/2) + 5 = 2*25 + 5 = 55. + // avgY(fn2, [30,40]) = 3*((30+40)/2) + 7 = 3*35 + 7 = 112. + // Weighted average = (55 * (30-20) + 112 * (40-30)) / (40-20) + // = (55*10 + 112*10) / 20 = 1670/20 = 83 (integer division truncates any fraction). + const fn1: Line = { x1: 0, y1: 5, x2: 10, y2: 25 }; + const fn2: Line = { x1: 0, y1: 7, x2: 10, y2: 37 }; + const xRange: Range = { lower: 20, upper: 40 }; + const xBreakPt = 30; + const result = await lineHelpersTest.computePiecewiseAvgY(fn1, fn2, xRange, xBreakPt); + expect(result).to.equal(83); + }); + }); + + describe("avgY", function () { + it("should return the constant y-value for a horizontal line", async function () { + // For a horizontal line f(x) = constant, avgY should return that constant. + // Define a horizontal line f(x) = 10 with points (0,10) and (10,10) + // For any x-range (here [5,15]), the average is 10. + const horizontalLine: Line = { x1: 0, y1: 10, x2: 10, y2: 10 }; + const xL = 5; + const xU = 15; + const result = await lineHelpersTest.avgY(horizontalLine, xL, xU); + expect(result).to.equal(10); + }); + + it("should compute average correctly for a non-horizontal line with fractional average", async function () { + // Test a line with a fractional average result. + // Define line: f(x) = x + 1, using points (0,1) and (3,4) + // For x-range [1,2]: + // m = (4-1)/(3-0) = 1, c = 4 - 1*3 = 1. + // Expected average = 1*((1+2)/2) + 1 = 1*1 + 1 = 2 (due to integer division truncation). + const line: Line = { x1: 0, y1: 1, x2: 3, y2: 4 }; + const xL = 1; + const xU = 2; + const result = await lineHelpersTest.avgY(line, xL, xU); + expect(result).to.equal(2); + }); + }); +}); diff --git a/spot-contracts/test/_utils/Sigmoid.ts b/spot-contracts/test/_utils/Sigmoid.ts index 550e9f8a..0ef75639 100644 --- a/spot-contracts/test/_utils/Sigmoid.ts +++ b/spot-contracts/test/_utils/Sigmoid.ts @@ -1,6 +1,6 @@ import { expect } from "chai"; import { ethers } from "hardhat"; -import { Contract, BigNumber } from "ethers"; +import { Contract } from "ethers"; import { toPercFixedPtAmt } from "../helpers"; @@ -22,7 +22,6 @@ describe("Sigmoid", function () { before(async function () { const MathTester = await ethers.getContractFactory("MathTester"); math = await MathTester.deploy(); - await math.deployed(); }); it("should return sigmoid(x)", async function () { await cmp(0, 0, -0.01, 0.05, 0); @@ -58,72 +57,71 @@ describe("Sigmoid", function () { before(async function () { const MathTester = await ethers.getContractFactory("MathTester"); math = await MathTester.deploy(); - await math.deployed(); }); - const decimals18 = BigNumber.from("1000000000000000000"); - const decimals10 = BigNumber.from("10000000000"); + const decimals18 = BigInt("1000000000000000000"); + const decimals10 = BigInt("10000000000"); it("2^0", async function () { - const e = BigNumber.from(0); - const one = BigNumber.from(1).mul(decimals18); + const e = 0n; + const one = 1n * decimals18; expect(await math.twoPower(e, one)).to.eq(one); }); it("2^1", async function () { - const e = BigNumber.from(1).mul(decimals18); - const one = BigNumber.from(1).mul(decimals18); - const result = BigNumber.from(2).mul(decimals18); + const e = 1n * decimals18; + const one = 1n * decimals18; + const result = 2n * decimals18; expect(await math.twoPower(e, one)).to.eq(result); }); it("2^30", async function () { - const e = BigNumber.from(30).mul(decimals18); - const one = BigNumber.from(1).mul(decimals18); - const result = BigNumber.from(2 ** 30).mul(decimals18); + const e = 30n * decimals18; + const one = 1n * decimals18; + const result = 2n ** 30n * decimals18; expect(await math.twoPower(e, one)).to.eq(result); }); it("2^2.5", async function () { - const e = BigNumber.from("25000000000"); - const one = BigNumber.from(1).mul(decimals10); - const result = BigNumber.from("56568542494"); + const e = BigInt("25000000000"); + const one = 1n * decimals10; + const result = BigInt("56568542494"); expect(await math.twoPower(e, one)).to.eq(result); }); it("2^2.25", async function () { - const e = BigNumber.from("22500000000"); - const one = BigNumber.from(1).mul(decimals10); - const result = BigNumber.from("47568284600"); + const e = BigInt("22500000000"); + const one = 1n * decimals10; + const result = BigInt("47568284600"); expect(await math.twoPower(e, one)).to.eq(result); }); it("2^-2.25", async function () { - const e = BigNumber.from("-22500000000"); - const one = BigNumber.from(1).mul(decimals10); - const result = BigNumber.from("2102241038"); + const e = BigInt("-22500000000"); + const one = 1n * decimals10; + const result = BigInt("2102241038"); expect(await math.twoPower(e, one)).to.eq(result); }); it("2^-0.6", async function () { - const e = BigNumber.from("-6000000000"); - const one = BigNumber.from(1).mul(decimals10); - const result = BigNumber.from("6626183216"); + const e = BigInt("-6000000000"); + const one = 1n * decimals10; + const result = BigInt("6626183216"); expect(await math.twoPower(e, one)).to.eq(result); }); it("2^2.96875", async function () { - const e = BigNumber.from("29687500000"); - const one = BigNumber.from(1).mul(decimals10); - const result = BigNumber.from("78285764964"); + const e = BigInt("29687500000"); + const one = 1n * decimals10; + const result = BigInt("78285764964"); expect(await math.twoPower(e, one)).to.eq(result); }); it("2^2.99", async function () { - const e = BigNumber.from("29900000000"); - const one = BigNumber.from(1).mul(decimals10); - const result = BigNumber.from("78285764964"); + const e = BigInt("29900000000"); + const one = 1n * decimals10; + const result = BigInt("78285764964"); expect(await math.twoPower(e, one)).to.eq(result); }); it("should fail on too small exponents", async function () { - const e = BigNumber.from("-1011000000000"); - const one = BigNumber.from(1).mul(decimals10); + const e = BigInt("-1011000000000"); + const one = 1n * decimals10; await expect(math.twoPower(e, one)).to.be.revertedWithCustomError(math, "ExpTooLarge"); }); it("should fail on too large exponents", async function () { - const e = BigNumber.from("1011000000000"); - const one = BigNumber.from(1).mul(decimals10); + const e = BigInt("1011000000000"); + const one = 1n * decimals10; await expect(math.twoPower(e, one)).to.be.revertedWithCustomError(math, "ExpTooLarge"); }); }); diff --git a/spot-contracts/test/helpers.ts b/spot-contracts/test/helpers.ts index 52b40ed6..23d6cc8b 100644 --- a/spot-contracts/test/helpers.ts +++ b/spot-contracts/test/helpers.ts @@ -1,25 +1,27 @@ -import { expect, use } from "chai"; +import { expect } from "chai"; import hre, { ethers } from "hardhat"; -import { Signer, Contract, BigNumber, ContractFactory, Transaction, utils } from "ethers"; +import { Signer, Contract, ContractFactory, Transaction } from "ethers"; import * as fs from "fs"; import * as path from "path"; -import { smock, FakeContract } from "@defi-wonderland/smock"; -use(smock.matchers); const TOKEN_DECIMALS = 18; const PRICE_DECIMALS = 8; const DISCOUNT_DECIMALS = 18; const PERC_DECIMALS = 8; -const sciParseFloat = (a: string): BigNumber => (a.includes("e") ? parseFloat(a).toFixed(18) : a); -export const toFixedPtAmt = (a: string): BigNumber => utils.parseUnits(sciParseFloat(a), TOKEN_DECIMALS); -export const toPriceFixedPtAmt = (a: string): BigNumber => utils.parseUnits(sciParseFloat(a), PRICE_DECIMALS); -export const toDiscountFixedPtAmt = (a: string): BigNumber => utils.parseUnits(sciParseFloat(a), DISCOUNT_DECIMALS); -export const toPercFixedPtAmt = (a: string): BigNumber => utils.parseUnits(sciParseFloat(a), PERC_DECIMALS); +const sciParseFloat = (a: string): BigInt => (a.includes("e") ? parseFloat(a).toFixed(18) : a); +export const toFixedPtAmt = (a: string): BigInt => ethers.parseUnits(sciParseFloat(a), TOKEN_DECIMALS); +export const toPriceFixedPtAmt = (a: string): BigInt => ethers.parseUnits(sciParseFloat(a), PRICE_DECIMALS); +export const toDiscountFixedPtAmt = (a: string): BigInt => ethers.parseUnits(sciParseFloat(a), DISCOUNT_DECIMALS); +export const toPercFixedPtAmt = (a: string): BigInt => ethers.parseUnits(sciParseFloat(a), PERC_DECIMALS); const ORACLE_BASE_PRICE = toPriceFixedPtAmt("1"); const EXTERNAL_ARTIFACTS_PATH = path.join(__dirname, "/../external-artifacts"); +export const getAbiFromExternalArtifacts = (name: string): Promise => { + const artifact = JSON.parse(fs.readFileSync(`${EXTERNAL_ARTIFACTS_PATH}/${name}.json`).toString()); + return artifact.abi; +}; export const getContractFactoryFromExternalArtifacts = (name: string): Promise => { const artifact = JSON.parse(fs.readFileSync(`${EXTERNAL_ARTIFACTS_PATH}/${name}.json`).toString()); return ethers.getContractFactoryFromArtifact(artifact); @@ -31,26 +33,97 @@ export const TimeHelpers = { }, increaseTime: async (seconds: number): Promise => { - await hre.network.provider.send("evm_increaseTime", [seconds]); - await hre.network.provider.send("evm_mine"); + await hre.network.provider.request({ method: "evm_increaseTime", params: [seconds] }); + await hre.network.provider.request({ method: "evm_mine" }); }, setNextBlockTimestamp: async (timestamp: number): Promise => { - await ethers.provider.send("evm_setNextBlockTimestamp", [timestamp]); - await hre.network.provider.send("evm_mine"); + await hre.network.provider.request({ method: "evm_setNextBlockTimestamp", params: [timestamp] }); + await hre.network.provider.request({ method: "evm_mine" }); }, currentTime: async (): Promise => { - const res = await hre.network.provider.send("eth_getBlockByNumber", ["latest", false]); + const res = await hre.network.provider.request({ method: "eth_getBlockByNumber", params: ["latest", false] }); const timestamp = parseInt(res.timestamp, 16); return timestamp; }, }; +export interface DMockMethod { + methodName: string; + parameters: any[]; + returnType: string; + returnValue: any; +} + +export class DMock { + private refFactory: string; + private contract: Contract | null = null; + private target: string | null = null; + + constructor(refFactory: ContractFactory) { + this.refFactory = refFactory; + } + + public async deploy(): Promise { + this.contract = await (await ethers.getContractFactory("DMock")).deploy(); + this.target = this.contract.target; + } + + public async mockMethod(methodFragment: string, returnValue: any = []): Promise { + if (!this.contract) { + await this.deploy(); + } + const methodFragmentObj = this.refFactory.interface.fragments.filter( + f => f.type === "function" && f.format("sighash") === methodFragment, + )[0]; + if (!methodFragmentObj) { + throw Error(`Unkown function fragment ${methodFragment}, not part of the contract abi`); + } + const encodedReturnValue = ethers.AbiCoder.defaultAbiCoder().encode(methodFragmentObj.outputs, returnValue); + await this.contract.mockMethod(methodFragmentObj.selector, encodedReturnValue); + } + + public async clearMockMethod(methodFragment: string): Promise { + if (!this.contract) { + await this.deploy(); + } + const methodFragmentObj = this.refFactory.interface.fragments.filter( + f => f.type === "function" && f.format("sighash") === methodFragment, + )[0]; + if (!methodFragmentObj) { + throw Error(`Unkown function fragment ${methodFragment}, not part of the contract abi`); + } + await this.contract.clearMockMethodSig(methodFragmentObj.selector); + } + + public async mockCall(methodFragment: string, parameters: any, returnValue: any = []): Promise { + if (!this.contract) { + await this.deploy(); + } + const methodFragmentObj = this.refFactory.interface.fragments.filter( + f => f.type === "function" && f.format("sighash") === methodFragment, + )[0]; + if (!methodFragmentObj) { + throw Error(`Unkown function fragment ${methodFragment}, not part of the contract abi`); + } + const encodedData = this.refFactory.interface.encodeFunctionData(methodFragmentObj, parameters); + await this.contract.mockCall( + encodedData, + ethers.AbiCoder.defaultAbiCoder().encode(methodFragmentObj.outputs, returnValue), + ); + } + + public async staticCall(methodFragment: string, parameters: any = []): Promise { + const mock = this.refFactory.attach(this.contract.target); + return mock[methodFragment].staticCall(...parameters); + } +} + // Rebasing collateral token (button tokens) interface ButtonTokenContracts { underlyingToken: Contract; - rebaseOracle: FakeContract; + rebaseOracle: Contract; collateralToken: Contract; } export const setupCollateralToken = async (name: string, symbol: string): Promise => { @@ -58,13 +131,13 @@ export const setupCollateralToken = async (name: string, symbol: string): Promis const underlyingToken = await ERC20.deploy(); await underlyingToken.init(name, symbol); - const MedianOracle = await getContractFactoryFromExternalArtifacts("MedianOracle"); - const rebaseOracle = await smock.fake(MedianOracle); - await rebaseOracle.getData.returns([ORACLE_BASE_PRICE, true]); + const rebaseOracle = new DMock(await getContractFactoryFromExternalArtifacts("MedianOracle")); + await rebaseOracle.deploy(); + await rebaseOracle.mockMethod("getData()", [ORACLE_BASE_PRICE, true]); const ButtonToken = await getContractFactoryFromExternalArtifacts("ButtonToken"); const collateralToken = await ButtonToken.deploy(); - await collateralToken.initialize(underlyingToken.address, `Button ${name}`, `btn-${symbol}`, rebaseOracle.address); + await collateralToken.initialize(underlyingToken.target, `Button ${name}`, `btn-${symbol}`, rebaseOracle.target); return { underlyingToken, @@ -73,20 +146,21 @@ export const setupCollateralToken = async (name: string, symbol: string): Promis }; }; -export const mintCollteralToken = async (collateralToken: Contract, amount: BigNumber, from: Signer) => { +export const mintCollteralToken = async (collateralToken: Contract, amount: BigInt, from: Signer) => { const fromAddress = await from.getAddress(); const ERC20 = await ethers.getContractFactory("MockERC20"); const underlyingToken = await ERC20.attach(await collateralToken.underlying()); const cAmount = await collateralToken.wrapperToUnderlying(amount); await underlyingToken.connect(from).mint(fromAddress, cAmount); - await underlyingToken.connect(from).approve(collateralToken.address, cAmount); + await underlyingToken.connect(from).approve(collateralToken.target, cAmount); await collateralToken.connect(from).mint(amount); }; -export const rebase = async (token: Contract, oracle: FakeContract, perc: number) => { +export const rebase = async (token: Contract, oracle: Contract, perc: number) => { const p = await token.lastPrice(); - const newPrice = p.mul(ORACLE_BASE_PRICE.add(ORACLE_BASE_PRICE.toNumber() * perc)).div(ORACLE_BASE_PRICE); - await oracle.getData.returns([newPrice, true]); + const delta = BigInt(Number(ORACLE_BASE_PRICE) * perc); + const newPrice = (p * (ORACLE_BASE_PRICE + delta)) / ORACLE_BASE_PRICE; + await oracle.mockMethod("getData()", [newPrice, true]); await token.rebase(); }; @@ -94,20 +168,15 @@ export const rebase = async (token: Contract, oracle: FakeContract, perc: number export const setupBondFactory = async (): Promise => { const BondController = await getContractFactoryFromExternalArtifacts("BondController"); const bondController = await BondController.deploy(); - await bondController.deployed(); const Tranche = await getContractFactoryFromExternalArtifacts("Tranche"); const tranche = await Tranche.deploy(); - await tranche.deployed(); const TrancheFactory = await getContractFactoryFromExternalArtifacts("TrancheFactory"); - const trancheFactory = await TrancheFactory.deploy(tranche.address); - await trancheFactory.deployed(); + const trancheFactory = await TrancheFactory.deploy(tranche.target); const BondFactory = await getContractFactoryFromExternalArtifacts("BondFactory"); - const bondFactory = await BondFactory.deploy(bondController.address, trancheFactory.address); - await bondFactory.deployed(); - + const bondFactory = await BondFactory.deploy(bondController.target, trancheFactory.target); return bondFactory; }; @@ -129,31 +198,29 @@ export const createBondWithFactory = async ( ): Promise => { const timeNow = await TimeHelpers.secondsFromNow(0); const maturityDate = timeNow + bondLength; - - const bondAddress = await bondFactory.callStatic.createBond(collateralToken.address, trancheRatios, maturityDate); - await bondFactory.createBond(collateralToken.address, trancheRatios, maturityDate); - + const bondAddress = await bondFactory.createBond.staticCall(collateralToken.target, trancheRatios, maturityDate); + await bondFactory.createBond(collateralToken.target, trancheRatios, maturityDate); return bondAt(bondAddress); }; // Bond interaction helpers export interface BondDeposit { - amount: BigNumber; - feeBps: BigNumber; + amount: BigInt; + feeBps: BigInt; from: string; } -export const depositIntoBond = async (bond: Contract, amount: BigNumber, from: Signer): Promise => { +export const depositIntoBond = async (bond: Contract, amount: BigInt, from: Signer): Promise => { const ButtonToken = await getContractFactoryFromExternalArtifacts("ButtonToken"); const collateralToken = await ButtonToken.attach(await bond.collateralToken()); await mintCollteralToken(collateralToken, amount, from); - await collateralToken.connect(from).approve(bond.address, amount); + await collateralToken.connect(from).approve(bond.target, amount); const tx = await bond.connect(from).deposit(amount); const txR = await tx.wait(); - const depositEvent = txR.events[txR.events.length - 1].args; + const depositEvent = txR.logs[txR.logs.length - 1].args; return depositEvent; }; @@ -168,9 +235,9 @@ export const getTranches = async (bond: Contract): Promise => { return tranches; }; -export const getTrancheBalances = async (bond: Contract, user: string): Promise => { +export const getTrancheBalances = async (bond: Contract, user: string): Promise => { const tranches = await getTranches(bond); - const balances: BigNumber[] = []; + const balances: BigInt[] = []; for (let i = 0; i < tranches.length; i++) { balances.push(await tranches[i].balanceOf(user)); } @@ -178,11 +245,11 @@ export const getTrancheBalances = async (bond: Contract, user: string): Promise< }; export const timeToMaturity = async (bond: Contract): Promise => { - return (await bond.maturityDate()).toNumber() - (await TimeHelpers.currentTime()); + return Number(await bond.maturityDate()) - (await TimeHelpers.currentTime()); }; export const getDepositBond = async (perp: Contract): Contract => { - return bondAt(await perp.callStatic.getDepositBond()); + return bondAt(await perp.getDepositBond.staticCall()); }; export const advanceTime = async (time: number): Promise => { @@ -197,7 +264,7 @@ export const advancePerpQueue = async (perp: Contract, time: number): Promise => { await perp.updateState(); const matuirtyDate = await bond.maturityDate(); - await TimeHelpers.setNextBlockTimestamp(matuirtyDate.toNumber()); + await TimeHelpers.setNextBlockTimestamp(Number(matuirtyDate)); }; export const advancePerpQueueToBondMaturity = async (perp: Contract, bond: Contract): Promise => { @@ -210,60 +277,60 @@ export const advancePerpQueueToRollover = async (perp: Contract, bond: Contract) await perp.updateState(); const bufferSec = await perp.minTrancheMaturitySec(); const matuirtyDate = await bond.maturityDate(); - await TimeHelpers.setNextBlockTimestamp(matuirtyDate.sub(bufferSec).toNumber()); + await TimeHelpers.setNextBlockTimestamp(Number(matuirtyDate - bufferSec)); await perp.updateState(); await TimeHelpers.increaseTime(1); return perp.updateState(); }; -export const logReserveComposition = async (perp: Contract) => { +export const logPerpAssets = async (perp: Contract) => { const ERC20 = await ethers.getContractFactory("MockERC20"); - const count = await perp.callStatic.getReserveCount(); - console.log("Reserve count", count); + const count = await perp.getReserveCount.staticCall(); + console.log("Perp assets", count); for (let i = 0; i < count; i++) { - const token = await ERC20.attach(await perp.callStatic.getReserveAt(i)); - const ONE = BigNumber.from(`${10 ** (await perp.decimals())}`); - const tokenVal = await perp.callStatic.getReserveTokenValue(token.address); - const tokenBal = await perp.callStatic.getReserveTokenBalance(token.address); - const tokenPrice = tokenBal.gt("0") ? tokenVal.mul(ONE).div(tokenBal) : BigNumber.from(0); + const token = await ERC20.attach(await perp.getReserveAt.staticCall(i)); + const ONE = ethers.parseUnits("1", await perp.decimals()); + const tokenVal = await perp.getReserveTokenValue.staticCall(token.target); + const tokenBal = await perp.getReserveTokenBalance.staticCall(token.target); + const tokenPrice = tokenBal > 0n ? (tokenVal * ONE) / tokenBal : 0n; console.log( i, - token.address, - utils.formatUnits(await token.balanceOf(perp.address), await perp.decimals()), - utils.formatUnits(tokenPrice, await perp.decimals()), + token.target, + ethers.formatUnits(await token.balanceOf(perp.target), await perp.decimals()), + ethers.formatUnits(tokenPrice, await perp.decimals()), ); } }; -export const checkReserveComposition = async (perp: Contract, tokens: Contract[], balances: BigNumber[] = []) => { +export const checkPerpComposition = async (perp: Contract, tokens: Contract[], balances: BigInt[] = []) => { const checkBalances = balances.length > 0; - expect(await perp.callStatic.getReserveCount()).to.eq(tokens.length); + expect(await perp.getReserveCount.staticCall()).to.eq(tokens.length); const tokenMap = {}; const tokenBalanceMap = {}; for (const i in tokens) { - tokenMap[tokens[i].address] = true; + tokenMap[tokens[i].target] = true; if (checkBalances) { - tokenBalanceMap[tokens[i].address] = balances[i]; + tokenBalanceMap[tokens[i].target] = balances[i]; } } const ERC20 = await ethers.getContractFactory("MockERC20"); for (let j = 0; j < tokens.length; j++) { - const reserveToken = ERC20.attach(await perp.callStatic.getReserveAt(j)); - expect(tokenMap[reserveToken.address]).to.eq(true); + const reserveToken = ERC20.attach(await perp.getReserveAt.staticCall(j)); + expect(tokenMap[reserveToken.target]).to.eq(true); if (checkBalances) { - expect(await reserveToken.balanceOf(perp.address)).to.eq(tokenBalanceMap[reserveToken.address]); + expect(await reserveToken.balanceOf(perp.target)).to.eq(tokenBalanceMap[reserveToken.target]); } } - await expect(perp.callStatic.getReserveAt(tokens.length)).to.be.reverted; + await expect(perp.getReserveAt.staticCall(tokens.length)).to.be.reverted; }; export const getReserveTokens = async (perp: Contract) => { const ERC20 = await ethers.getContractFactory("MockERC20"); const reserves: Contract[] = []; - for (let i = 0; i < (await perp.callStatic.getReserveCount()); i++) { - reserves.push(await ERC20.attach(await perp.callStatic.getReserveAt(i))); + for (let i = 0; i < (await perp.getReserveCount()); i++) { + reserves.push(await ERC20.attach(await perp.getReserveAt.staticCall(i))); } return reserves; }; @@ -272,28 +339,28 @@ export const logVaultAssets = async (vault: Contract) => { const ERC20 = await ethers.getContractFactory("MockERC20"); const count = await vault.assetCount(); const assetCount = await vault.assetCount(); - console.log("Asset count", count); + console.log("Vault assets", count); const underlying = await ERC20.attach(await vault.underlying()); console.log( 0, - underlying.address, - utils.formatUnits(await vault.vaultAssetBalance(underlying.address), await underlying.decimals()), + underlying.target, + ethers.formatUnits(await vault.vaultAssetBalance(underlying.target), await underlying.decimals()), ); for (let i = 1; i < assetCount; i++) { const token = await ERC20.attach(await vault.assetAt(i)); console.log( i + 1, - token.address, - utils.formatUnits(await vault.vaultAssetBalance(token.address), await token.decimals()), + token.target, + ethers.formatUnits(await vault.vaultAssetBalance(token.target), await token.decimals()), ); } }; -export const checkVaultAssetComposition = async (vault: Contract, tokens: Contract[], balances: BigNumber[] = []) => { +export const checkVaultComposition = async (vault: Contract, tokens: Contract[], balances: BigInt[] = []) => { expect(await vault.assetCount()).to.eq(tokens.length); for (const i in tokens) { - expect(await vault.vaultAssetBalance(tokens[i].address)).to.eq(balances[i]); + expect(await vault.vaultAssetBalance(tokens[i].target)).to.eq(balances[i]); } }; diff --git a/spot-contracts/test/perp/PerpetualTranche.ts b/spot-contracts/test/perp/PerpetualTranche.ts index 85a48f71..994b9305 100644 --- a/spot-contracts/test/perp/PerpetualTranche.ts +++ b/spot-contracts/test/perp/PerpetualTranche.ts @@ -1,7 +1,6 @@ -import { expect, use } from "chai"; +import { expect } from "chai"; import { network, ethers, upgrades } from "hardhat"; -import { Contract, Transaction, Signer, constants } from "ethers"; -import { smock } from "@defi-wonderland/smock"; +import { Contract, Transaction, Signer } from "ethers"; import { setupCollateralToken, setupBondFactory, @@ -11,13 +10,13 @@ import { toFixedPtAmt, advancePerpQueue, bondAt, - checkReserveComposition, + checkPerpComposition, TimeHelpers, rebase, advancePerpQueueToRollover, toPercFixedPtAmt, + DMock, } from "../helpers"; -use(smock.matchers); let perp: Contract, collateralToken: Contract, @@ -36,27 +35,37 @@ describe("PerpetualTranche", function () { ({ collateralToken, rebaseOracle } = await setupCollateralToken("Bitcoin", "BTC")); - const BondIssuer = await ethers.getContractFactory("BondIssuer"); - issuer = await smock.fake(BondIssuer); - await issuer.collateral.returns(collateralToken.address); + issuer = new DMock(await ethers.getContractFactory("BondIssuer")); + await issuer.deploy(); + await issuer.mockMethod("collateral()", [collateralToken.target]); + await issuer.mockMethod("getLatestBond()", [ethers.ZeroAddress]); - const FeePolicy = await ethers.getContractFactory("FeePolicy"); - feePolicy = await smock.fake(FeePolicy); - await feePolicy.decimals.returns(8); + feePolicy = new DMock(await ethers.getContractFactory("FeePolicy")); + await feePolicy.deploy(); + await feePolicy.mockMethod("decimals()", [8]); + await feePolicy.mockMethod("computeDeviationRatio((uint256,uint256))", [toPercFixedPtAmt("1")]); + await feePolicy.mockMethod("computeFeePerc(uint256,uint256)", [0]); const PerpetualTranche = await ethers.getContractFactory("PerpetualTranche"); perp = await upgrades.deployProxy( PerpetualTranche.connect(deployer), - ["PerpetualTranche", "PERP", collateralToken.address, issuer.address, feePolicy.address], + ["PerpetualTranche", "PERP", collateralToken.target, issuer.target, feePolicy.target], { initializer: "init(string,string,address,address,address)", }, ); - const RolloverVault = await ethers.getContractFactory("RolloverVault"); - const vault = await smock.fake(RolloverVault); - await vault.getTVL.returns("0"); - await perp.updateVault(vault.address); + const TrancheManager = await ethers.getContractFactory("TrancheManager"); + const trancheManager = await TrancheManager.deploy(); + const RolloverVault = await ethers.getContractFactory("RolloverVault", { + libraries: { + TrancheManager: trancheManager.target, + }, + }); + const vault = new DMock(RolloverVault); + await vault.deploy(); + await vault.mockMethod("getTVL()", [0]); + await perp.updateVault(vault.target); }); afterEach(async function () { @@ -75,22 +84,22 @@ describe("PerpetualTranche", function () { }); it("should set ext service references", async function () { - expect(await perp.bondIssuer()).to.eq(issuer.address); - expect(await perp.feePolicy()).to.eq(feePolicy.address); + expect(await perp.bondIssuer()).to.eq(issuer.target); + expect(await perp.feePolicy()).to.eq(feePolicy.target); }); it("should set underlying collateral reference", async function () { - expect(await perp.underlying()).to.eq(collateralToken.address); + expect(await perp.underlying()).to.eq(collateralToken.target); }); it("should initialize lists", async function () { - expect(await perp.callStatic.getReserveCount()).to.eq(1); + expect(await perp.getReserveCount.staticCall()).to.eq(1); }); it("should set hyper parameters", async function () { - expect(await perp.minTrancheMaturitySec()).to.eq(1); - expect(await perp.maxTrancheMaturitySec()).to.eq(constants.MaxUint256); - expect(await perp.maxSupply()).to.eq(constants.MaxUint256); + expect(await perp.minTrancheMaturitySec()).to.eq(86400 * 7); + expect(await perp.maxTrancheMaturitySec()).to.eq(86400 * 31); + expect(await perp.maxSupply()).to.eq(ethers.MaxUint256); expect(await perp.maxDepositTrancheValuePerc()).to.eq(toPercFixedPtAmt("1")); }); @@ -181,7 +190,7 @@ describe("PerpetualTranche", function () { describe("when triggered by non-owner", function () { it("should revert", async function () { - await expect(perp.connect(otherUser).updateKeeper(constants.AddressZero)).to.be.revertedWith( + await expect(perp.connect(otherUser).updateKeeper(ethers.ZeroAddress)).to.be.revertedWith( "Ownable: caller is not the owner", ); }); @@ -201,7 +210,7 @@ describe("PerpetualTranche", function () { describe("#updateVault", function () { describe("when triggered by non-owner", function () { it("should revert", async function () { - await expect(perp.connect(otherUser).updateVault(constants.AddressZero)).to.be.revertedWith( + await expect(perp.connect(otherUser).updateVault(ethers.ZeroAddress)).to.be.revertedWith( "Ownable: caller is not the owner", ); }); @@ -210,15 +219,22 @@ describe("PerpetualTranche", function () { describe("when vault reference is set", function () { let tx: Transaction, vault: Contract; beforeEach(async function () { - const RolloverVault = await ethers.getContractFactory("RolloverVault"); - vault = await smock.fake(RolloverVault); - await vault.getTVL.returns(0); + const TrancheManager = await ethers.getContractFactory("TrancheManager"); + const trancheManager = await TrancheManager.deploy(); + const RolloverVault = await ethers.getContractFactory("RolloverVault", { + libraries: { + TrancheManager: trancheManager.target, + }, + }); + vault = new DMock(RolloverVault); + await vault.deploy(); + await vault.mockMethod("getTVL()", [0]); - tx = perp.connect(deployer).updateVault(vault.address); + tx = perp.connect(deployer).updateVault(vault.target); await tx; }); it("should update vault reference", async function () { - expect(await perp.vault()).to.eq(vault.address); + expect(await perp.vault()).to.eq(vault.target); }); }); }); @@ -228,7 +244,7 @@ describe("PerpetualTranche", function () { describe("when triggered by non-owner", function () { it("should revert", async function () { - await expect(perp.connect(otherUser).updateBondIssuer(constants.AddressZero)).to.be.revertedWith( + await expect(perp.connect(otherUser).updateBondIssuer(ethers.ZeroAddress)).to.be.revertedWith( "Ownable: caller is not the owner", ); }); @@ -236,25 +252,26 @@ describe("PerpetualTranche", function () { describe("when set address is valid", function () { beforeEach(async function () { - const BondIssuer = await ethers.getContractFactory("BondIssuer"); - newIssuer = await smock.fake(BondIssuer); - await newIssuer.collateral.returns(collateralToken.address); - tx = perp.updateBondIssuer(newIssuer.address); + newIssuer = new DMock(await ethers.getContractFactory("BondIssuer")); + await newIssuer.deploy(); + await newIssuer.mockMethod("collateral()", [collateralToken.target]); + + tx = perp.updateBondIssuer(newIssuer.target); await tx; }); it("should update reference", async function () { - expect(await perp.bondIssuer()).to.eq(newIssuer.address); + expect(await perp.bondIssuer()).to.eq(newIssuer.target); }); }); describe("when collateral is NOT valid", function () { beforeEach(async function () { - const BondIssuer = await ethers.getContractFactory("BondIssuer"); - newIssuer = await smock.fake(BondIssuer); - await newIssuer.collateral.returns(constants.AddressZero); + newIssuer = new DMock(await ethers.getContractFactory("BondIssuer")); + await newIssuer.deploy(); + await newIssuer.mockMethod("collateral()", [ethers.ZeroAddress]); }); it("should revert", async function () { - await expect(perp.updateBondIssuer(newIssuer.address)).to.be.revertedWithCustomError(perp, "UnexpectedAsset"); + await expect(perp.updateBondIssuer(newIssuer.target)).to.be.revertedWithCustomError(perp, "UnexpectedAsset"); }); }); }); @@ -264,7 +281,7 @@ describe("PerpetualTranche", function () { describe("when triggered by non-owner", function () { it("should revert", async function () { - await expect(perp.connect(otherUser).updateFeePolicy(constants.AddressZero)).to.be.revertedWith( + await expect(perp.connect(otherUser).updateFeePolicy(ethers.ZeroAddress)).to.be.revertedWith( "Ownable: caller is not the owner", ); }); @@ -272,10 +289,10 @@ describe("PerpetualTranche", function () { describe("when set strategy decimals dont match", function () { it("should revert", async function () { - const FeePolicy = await ethers.getContractFactory("FeePolicy"); - newFeePolicy = await smock.fake(FeePolicy); - await newFeePolicy.decimals.returns(7); - await expect(perp.updateFeePolicy(newFeePolicy.address)).to.be.revertedWithCustomError( + newFeePolicy = new DMock(await ethers.getContractFactory("FeePolicy")); + await newFeePolicy.deploy(); + await newFeePolicy.mockMethod("decimals()", [7]); + await expect(perp.updateFeePolicy(newFeePolicy.target)).to.be.revertedWithCustomError( perp, "UnexpectedDecimals", ); @@ -284,14 +301,14 @@ describe("PerpetualTranche", function () { describe("when set address is valid", function () { beforeEach(async function () { - const FeePolicy = await ethers.getContractFactory("FeePolicy"); - newFeePolicy = await smock.fake(FeePolicy); - await newFeePolicy.decimals.returns(8); - tx = perp.updateFeePolicy(newFeePolicy.address); + newFeePolicy = new DMock(await ethers.getContractFactory("FeePolicy")); + await newFeePolicy.deploy(); + await newFeePolicy.mockMethod("decimals()", [8]); + tx = perp.updateFeePolicy(newFeePolicy.target); await tx; }); it("should update reference", async function () { - expect(await perp.feePolicy()).to.eq(newFeePolicy.address); + expect(await perp.feePolicy()).to.eq(newFeePolicy.target); }); }); }); @@ -333,7 +350,7 @@ describe("PerpetualTranche", function () { describe("when triggered by non-keeper", function () { it("should revert", async function () { - await expect(perp.connect(otherUser).updateMaxSupply(constants.MaxUint256)).to.be.revertedWithCustomError( + await expect(perp.connect(otherUser).updateMaxSupply(ethers.MaxUint256)).to.be.revertedWithCustomError( perp, "UnauthorizedCall", ); @@ -391,13 +408,13 @@ describe("PerpetualTranche", function () { const Token = await ethers.getContractFactory("MockERC20"); transferToken = await Token.deploy(); await transferToken.init("Mock Token", "MOCK"); - await transferToken.mint(perp.address, "100"); + await transferToken.mint(perp.target, "100"); toAddress = await deployer.getAddress(); }); describe("when triggered by non-owner", function () { it("should revert", async function () { - await expect(perp.connect(otherUser).transferERC20(transferToken.address, toAddress, "100")).to.be.revertedWith( + await expect(perp.connect(otherUser).transferERC20(transferToken.target, toAddress, "100")).to.be.revertedWith( "Ownable: caller is not the owner", ); }); @@ -405,7 +422,7 @@ describe("PerpetualTranche", function () { describe("when non reserve asset", function () { it("should transfer", async function () { - await expect(() => perp.transferERC20(transferToken.address, toAddress, "100")).to.changeTokenBalance( + await expect(() => perp.transferERC20(transferToken.target, toAddress, "100")).to.changeTokenBalance( transferToken, deployer, "100", @@ -415,9 +432,9 @@ describe("PerpetualTranche", function () { describe("when reserve asset", function () { it("should revert", async function () { - expect(await perp.callStatic.inReserve(collateralToken.address)).to.eq(true); + expect(await perp.inReserve.staticCall(collateralToken.target)).to.eq(true); await expect( - perp.transferERC20(collateralToken.address, toAddress, toFixedPtAmt("100")), + perp.transferERC20(collateralToken.target, toAddress, toFixedPtAmt("100")), ).to.be.revertedWithCustomError(perp, "UnauthorizedTransferOut"); }); }); @@ -427,12 +444,13 @@ describe("PerpetualTranche", function () { const bondFactory = await setupBondFactory(); const bond = await createBondWithFactory(bondFactory, collateralToken, [200, 800], 3600); const tranches = await getTranches(bond); - await issuer.getLatestBond.returns(bond.address); + await issuer.mockMethod("getLatestBond()", [bond.target]); + await depositIntoBond(bond, toFixedPtAmt("1000"), deployer); - await tranches[0].approve(perp.address, toFixedPtAmt("100")); - await perp.deposit(tranches[0].address, toFixedPtAmt("100")); - await perp.transfer(perp.address, toFixedPtAmt("100")); - await expect(perp.transferERC20(perp.address, toAddress, toFixedPtAmt("100"))).not.to.be.reverted; + await tranches[0].approve(perp.target, toFixedPtAmt("100")); + await perp.deposit(tranches[0].target, toFixedPtAmt("100")); + await perp.transfer(perp.target, toFixedPtAmt("100")); + await expect(perp.transferERC20(perp.target, toAddress, toFixedPtAmt("100"))).not.to.be.reverted; }); }); }); @@ -445,10 +463,10 @@ describe("PerpetualTranche", function () { describe("when reserve has no tranches", function () { it("should have expected reserve composition", async function () { - await checkReserveComposition(perp, [collateralToken], ["0"]); + await checkPerpComposition(perp, [collateralToken], ["0"]); }); it("should calculate the tvl", async function () { - expect(await perp.callStatic.getTVL()).to.eq(0); + expect(await perp.getTVL.staticCall()).to.eq(0); }); }); @@ -456,18 +474,18 @@ describe("PerpetualTranche", function () { beforeEach(async function () { bond = await createBondWithFactory(bondFactory, collateralToken, [200, 800], 3600); tranches = await getTranches(bond); - await issuer.getLatestBond.returns(bond.address); + await issuer.mockMethod("getLatestBond()", [bond.target]); await depositIntoBond(bond, toFixedPtAmt("1000"), deployer); - await tranches[0].approve(perp.address, toFixedPtAmt("200")); - await perp.deposit(tranches[0].address, toFixedPtAmt("200")); + await tranches[0].approve(perp.target, toFixedPtAmt("200")); + await perp.deposit(tranches[0].target, toFixedPtAmt("200")); }); it("should have expected reserve composition", async function () { - await checkReserveComposition(perp, [collateralToken, tranches[0]], ["0", toFixedPtAmt("200")]); + await checkPerpComposition(perp, [collateralToken, tranches[0]], ["0", toFixedPtAmt("200")]); }); it("should calculate the tvl", async function () { - expect(await perp.callStatic.getTVL()).to.eq(toFixedPtAmt("200")); + expect(await perp.getTVL.staticCall()).to.eq(toFixedPtAmt("200")); }); }); @@ -475,32 +493,32 @@ describe("PerpetualTranche", function () { beforeEach(async function () { bond = await createBondWithFactory(bondFactory, collateralToken, [200, 800], 3600); tranches = await getTranches(bond); - await issuer.getLatestBond.returns(bond.address); + await issuer.mockMethod("getLatestBond()", [bond.target]); await depositIntoBond(bond, toFixedPtAmt("1000"), deployer); - await tranches[0].approve(perp.address, toFixedPtAmt("200")); - await perp.deposit(tranches[0].address, toFixedPtAmt("200")); + await tranches[0].approve(perp.target, toFixedPtAmt("200")); + await perp.deposit(tranches[0].target, toFixedPtAmt("200")); await rebase(collateralToken, rebaseOracle, -0.9); bondNext = await createBondWithFactory(bondFactory, collateralToken, [200, 800], 3600); tranchesNext = await getTranches(bondNext); - await issuer.getLatestBond.returns(bondNext.address); + await issuer.mockMethod("getLatestBond()", [bondNext.target]); await depositIntoBond(bondNext, toFixedPtAmt("1000"), deployer); - await tranchesNext[0].approve(perp.address, toFixedPtAmt("100")); - await perp.deposit(tranchesNext[0].address, toFixedPtAmt("100")); + await tranchesNext[0].approve(perp.target, toFixedPtAmt("100")); + await perp.deposit(tranchesNext[0].target, toFixedPtAmt("100")); }); it("should have expected reserve composition", async function () { - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, tranches[0], tranchesNext[0]], ["0", toFixedPtAmt("200"), toFixedPtAmt("100")], ); }); it("should calculate the tvl", async function () { - expect(await perp.callStatic.getTVL()).to.eq(toFixedPtAmt("200")); + expect(await perp.getTVL.staticCall()).to.eq(toFixedPtAmt("200")); }); }); @@ -510,37 +528,37 @@ describe("PerpetualTranche", function () { const BondIssuer = await ethers.getContractFactory("BondIssuer"); issuer = await upgrades.deployProxy( BondIssuer.connect(deployer), - [bondFactory.address, collateralToken.address, 3600, [200, 800], 1200, 0], + [bondFactory.target, collateralToken.target, 3600, [200, 800], 1200, 0], { initializer: "init(address,address,uint256,uint256[],uint256,uint256)", }, ); - await perp.updateBondIssuer(issuer.address); + await perp.updateBondIssuer(issuer.target); await advancePerpQueue(perp, 1200); - bond = await bondAt(await perp.callStatic.getDepositBond()); + bond = await bondAt(await perp.getDepositBond.staticCall()); tranches = await getTranches(bond); await depositIntoBond(bond, toFixedPtAmt("1000"), deployer); - await tranches[0].approve(perp.address, toFixedPtAmt("200")); - await perp.deposit(tranches[0].address, toFixedPtAmt("200")); + await tranches[0].approve(perp.target, toFixedPtAmt("200")); + await perp.deposit(tranches[0].target, toFixedPtAmt("200")); await advancePerpQueue(perp, 1200); - bondNext = await bondAt(await perp.callStatic.getDepositBond()); + bondNext = await bondAt(await perp.getDepositBond.staticCall()); tranchesNext = await getTranches(bondNext); await depositIntoBond(bondNext, toFixedPtAmt("1000"), deployer); - await tranchesNext[0].approve(perp.address, toFixedPtAmt("100")); - await perp.deposit(tranchesNext[0].address, toFixedPtAmt("100")); + await tranchesNext[0].approve(perp.target, toFixedPtAmt("100")); + await perp.deposit(tranchesNext[0].target, toFixedPtAmt("100")); await advancePerpQueue(perp, 36000); }); it("should have expected reserve composition", async function () { - await checkReserveComposition(perp, [collateralToken], [toFixedPtAmt("300")]); + await checkPerpComposition(perp, [collateralToken], [toFixedPtAmt("300")]); }); it("should calculate the tvl", async function () { - expect(await perp.callStatic.getTVL()).to.eq(toFixedPtAmt("300")); + expect(await perp.getTVL.staticCall()).to.eq(toFixedPtAmt("300")); }); }); @@ -550,41 +568,41 @@ describe("PerpetualTranche", function () { const BondIssuer = await ethers.getContractFactory("BondIssuer"); issuer = await upgrades.deployProxy( BondIssuer.connect(deployer), - [bondFactory.address, collateralToken.address, 3600, [200, 800], 1200, 0], + [bondFactory.target, collateralToken.target, 3600, [200, 800], 1200, 0], { initializer: "init(address,address,uint256,uint256[],uint256,uint256)", }, ); - await perp.updateBondIssuer(issuer.address); + await perp.updateBondIssuer(issuer.target); await advancePerpQueue(perp, 3600); - bond = await bondAt(await perp.callStatic.getDepositBond()); + bond = await bondAt(await perp.getDepositBond.staticCall()); tranches = await getTranches(bond); await depositIntoBond(bond, toFixedPtAmt("1000"), deployer); - await tranches[0].approve(perp.address, toFixedPtAmt("200")); - await perp.deposit(tranches[0].address, toFixedPtAmt("200")); + await tranches[0].approve(perp.target, toFixedPtAmt("200")); + await perp.deposit(tranches[0].target, toFixedPtAmt("200")); await advancePerpQueue(perp, 1200); - bondNext = await bondAt(await perp.callStatic.getDepositBond()); + bondNext = await bondAt(await perp.getDepositBond.staticCall()); tranchesNext = await getTranches(bondNext); await depositIntoBond(bondNext, toFixedPtAmt("1000"), deployer); - await tranchesNext[0].approve(perp.address, toFixedPtAmt("100")); - await perp.deposit(tranchesNext[0].address, toFixedPtAmt("100")); + await tranchesNext[0].approve(perp.target, toFixedPtAmt("100")); + await perp.deposit(tranchesNext[0].target, toFixedPtAmt("100")); await advancePerpQueue(perp, 2400); }); it("should have expected reserve composition", async function () { - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, tranchesNext[0]], [toFixedPtAmt("200"), toFixedPtAmt("100")], ); }); it("should calculate the tvl", async function () { - expect(await perp.callStatic.getTVL()).to.eq(toFixedPtAmt("300")); + expect(await perp.getTVL.staticCall()).to.eq(toFixedPtAmt("300")); }); }); @@ -594,27 +612,27 @@ describe("PerpetualTranche", function () { const BondIssuer = await ethers.getContractFactory("BondIssuer"); issuer = await upgrades.deployProxy( BondIssuer.connect(deployer), - [bondFactory.address, collateralToken.address, 3600, [200, 800], 1200, 0], + [bondFactory.target, collateralToken.target, 3600, [200, 800], 1200, 0], { initializer: "init(address,address,uint256,uint256[],uint256,uint256)", }, ); - await perp.updateBondIssuer(issuer.address); + await perp.updateBondIssuer(issuer.target); await advancePerpQueue(perp, 3600); - bond = await bondAt(await perp.callStatic.getDepositBond()); + bond = await bondAt(await perp.getDepositBond.staticCall()); tranches = await getTranches(bond); await depositIntoBond(bond, toFixedPtAmt("1000"), deployer); - await tranches[0].approve(perp.address, toFixedPtAmt("200")); - await perp.deposit(tranches[0].address, toFixedPtAmt("200")); + await tranches[0].approve(perp.target, toFixedPtAmt("200")); + await perp.deposit(tranches[0].target, toFixedPtAmt("200")); await advancePerpQueue(perp, 1200); - bondNext = await bondAt(await perp.callStatic.getDepositBond()); + bondNext = await bondAt(await perp.getDepositBond.staticCall()); tranchesNext = await getTranches(bondNext); await depositIntoBond(bondNext, toFixedPtAmt("1000"), deployer); - await tranchesNext[0].approve(perp.address, toFixedPtAmt("100")); - await perp.deposit(tranchesNext[0].address, toFixedPtAmt("100")); + await tranchesNext[0].approve(perp.target, toFixedPtAmt("100")); + await perp.deposit(tranchesNext[0].target, toFixedPtAmt("100")); await advancePerpQueue(perp, 2400); @@ -622,14 +640,14 @@ describe("PerpetualTranche", function () { }); it("should have expected reserve composition", async function () { - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, tranchesNext[0]], [toFixedPtAmt("220"), toFixedPtAmt("100")], ); }); it("should calculate the tvl", async function () { - expect(await perp.callStatic.getTVL()).to.eq(toFixedPtAmt("320")); + expect(await perp.getTVL.staticCall()).to.eq(toFixedPtAmt("320")); }); }); @@ -639,28 +657,28 @@ describe("PerpetualTranche", function () { const BondIssuer = await ethers.getContractFactory("BondIssuer"); issuer = await upgrades.deployProxy( BondIssuer.connect(deployer), - [bondFactory.address, collateralToken.address, 3600, [200, 800], 1200, 0], + [bondFactory.target, collateralToken.target, 3600, [200, 800], 1200, 0], { initializer: "init(address,address,uint256,uint256[],uint256,uint256)", }, ); - await perp.updateBondIssuer(issuer.address); + await perp.updateBondIssuer(issuer.target); await advancePerpQueue(perp, 3600); - bond = await bondAt(await perp.callStatic.getDepositBond()); + bond = await bondAt(await perp.getDepositBond.staticCall()); tranches = await getTranches(bond); await depositIntoBond(bond, toFixedPtAmt("1000"), deployer); - await tranches[0].approve(perp.address, toFixedPtAmt("200")); - await perp.deposit(tranches[0].address, toFixedPtAmt("200")); + await tranches[0].approve(perp.target, toFixedPtAmt("200")); + await perp.deposit(tranches[0].target, toFixedPtAmt("200")); await advancePerpQueue(perp, 1200); - bondNext = await bondAt(await perp.callStatic.getDepositBond()); + bondNext = await bondAt(await perp.getDepositBond.staticCall()); tranchesNext = await getTranches(bondNext); await depositIntoBond(bondNext, toFixedPtAmt("1000"), deployer); - await tranchesNext[0].approve(perp.address, toFixedPtAmt("100")); - await perp.deposit(tranchesNext[0].address, toFixedPtAmt("100")); + await tranchesNext[0].approve(perp.target, toFixedPtAmt("100")); + await perp.deposit(tranchesNext[0].target, toFixedPtAmt("100")); await advancePerpQueue(perp, 2400); @@ -668,14 +686,14 @@ describe("PerpetualTranche", function () { }); it("should have expected reserve composition", async function () { - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, tranchesNext[0]], [toFixedPtAmt("180"), toFixedPtAmt("100")], ); }); it("should calculate the tvl", async function () { - expect(await perp.callStatic.getTVL()).to.eq(toFixedPtAmt("280")); + expect(await perp.getTVL.staticCall()).to.eq(toFixedPtAmt("280")); }); }); }); @@ -693,12 +711,12 @@ describe("PerpetualTranche", function () { beforeEach(async function () { await perp.updateTolerableTrancheMaturity(1200, 7200); bond = await createBondWithFactory(bondFactory, collateralToken, [200, 800], 7210); - await issuer.getLatestBond.returns(bond.address); + await issuer.mockMethod("getLatestBond()", [bond.target]); await perp.updateState(); }); it("should NOT update the deposit bond", async function () { - expect(await perp.callStatic.getDepositBond()).to.not.eq(bond.address); + expect(await perp.getDepositBond.staticCall()).to.not.eq(bond.target); }); }); @@ -707,12 +725,12 @@ describe("PerpetualTranche", function () { await perp.updateTolerableTrancheMaturity(1200, 7200); const r = await setupCollateralToken("Ethereum", "ETH"); bond = await createBondWithFactory(bondFactory, r.collateralToken, [200, 800], 3600); - await issuer.getLatestBond.returns(bond.address); + await issuer.mockMethod("getLatestBond()", [bond.target]); await perp.updateState(); }); it("should NOT update the deposit bond", async function () { - expect(await perp.callStatic.getDepositBond()).to.not.eq(bond.address); + expect(await perp.getDepositBond.staticCall()).to.not.eq(bond.target); }); }); @@ -721,17 +739,17 @@ describe("PerpetualTranche", function () { beforeEach(async function () { await perp.updateTolerableTrancheMaturity(1200, 7200); bond = await createBondWithFactory(bondFactory, collateralToken, [200, 800], 3600); - await issuer.getLatestBond.returns(bond.address); + await issuer.mockMethod("getLatestBond()", [bond.target]); tx = perp.updateState(); await tx; }); it("should update the deposit bond", async function () { - expect(await perp.callStatic.getDepositBond()).to.eq(bond.address); + expect(await perp.getDepositBond.staticCall()).to.eq(bond.target); }); it("should emit event", async function () { - await expect(tx).to.emit(perp, "UpdatedDepositBond").withArgs(bond.address); + await expect(tx).to.emit(perp, "UpdatedDepositBond").withArgs(bond.target); }); }); }); @@ -743,26 +761,26 @@ describe("PerpetualTranche", function () { const BondIssuer = await ethers.getContractFactory("BondIssuer"); issuer = await upgrades.deployProxy( BondIssuer.connect(deployer), - [bondFactory.address, collateralToken.address, 10800, [500, 500], 1200, 0], + [bondFactory.target, collateralToken.target, 10800, [500, 500], 1200, 0], { initializer: "init(address,address,uint256,uint256[],uint256,uint256)", }, ); - await perp.updateBondIssuer(issuer.address); + await perp.updateBondIssuer(issuer.target); await perp.updateTolerableTrancheMaturity(0, 10800); await advancePerpQueue(perp, 10900); for (let i = 0; i < 5; i++) { - const depositBond = await bondAt(await perp.callStatic.getDepositBond()); + const depositBond = await bondAt(await perp.getDepositBond.staticCall()); const tranches = await getTranches(depositBond); await depositIntoBond(depositBond, toFixedPtAmt("1000"), deployer); - await tranches[0].approve(perp.address, toFixedPtAmt("500")); - await perp.deposit(tranches[0].address, toFixedPtAmt("500")); + await tranches[0].approve(perp.target, toFixedPtAmt("500")); + await perp.deposit(tranches[0].target, toFixedPtAmt("500")); reserveTranches[i] = tranches[0]; await advancePerpQueue(perp, 1200); } - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, ...reserveTranches], [ @@ -775,8 +793,8 @@ describe("PerpetualTranche", function () { ], ); - expect(await perp.callStatic.getReserveCount()).to.eq("6"); - expect(await collateralToken.balanceOf(perp.address)).to.eq("0"); + expect(await perp.getReserveCount.staticCall()).to.eq("6"); + expect(await collateralToken.balanceOf(perp.target)).to.eq("0"); await TimeHelpers.increaseTime(1200); tx = await perp.updateState(); @@ -784,7 +802,7 @@ describe("PerpetualTranche", function () { }); it("should have expected reserve composition", async function () { - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, ...reserveTranches], [ @@ -799,17 +817,17 @@ describe("PerpetualTranche", function () { }); it("should NOT change reserveCount", async function () { - expect(await perp.callStatic.getReserveCount()).to.eq("6"); + expect(await perp.getReserveCount.staticCall()).to.eq("6"); }); it("should NOT change tranche balances", async function () {}); it("should emit ReserveSynced", async function () { - await expect(tx).to.emit(perp, "ReserveSynced").withArgs(collateralToken.address, "0"); + await expect(tx).to.emit(perp, "ReserveSynced").withArgs(collateralToken.target, "0"); }); it("should NOT update the reserve balance", async function () { - expect(await collateralToken.balanceOf(perp.address)).to.eq("0"); + expect(await collateralToken.balanceOf(perp.target)).to.eq("0"); }); }); @@ -821,25 +839,25 @@ describe("PerpetualTranche", function () { const BondIssuer = await ethers.getContractFactory("BondIssuer"); issuer = await upgrades.deployProxy( BondIssuer.connect(deployer), - [bondFactory.address, collateralToken.address, 10800, [500, 500], 1200, 0], + [bondFactory.target, collateralToken.target, 10800, [500, 500], 1200, 0], { initializer: "init(address,address,uint256,uint256[],uint256,uint256)", }, ); - await perp.updateBondIssuer(issuer.address); + await perp.updateBondIssuer(issuer.target); await perp.updateTolerableTrancheMaturity(0, 10800); await advancePerpQueue(perp, 10900); for (let i = 0; i < 5; i++) { - const depositBond = await bondAt(await perp.callStatic.getDepositBond()); + const depositBond = await bondAt(await perp.getDepositBond.staticCall()); const tranches = await getTranches(depositBond); await depositIntoBond(depositBond, toFixedPtAmt("1000"), deployer); - await tranches[0].approve(perp.address, toFixedPtAmt("500")); - await perp.deposit(tranches[0].address, toFixedPtAmt("500")); + await tranches[0].approve(perp.target, toFixedPtAmt("500")); + await perp.deposit(tranches[0].target, toFixedPtAmt("500")); reserveTranches[i] = tranches[0]; await advancePerpQueue(perp, 1200); } - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, ...reserveTranches], [ @@ -851,8 +869,8 @@ describe("PerpetualTranche", function () { toFixedPtAmt("500"), ], ); - expect(await perp.callStatic.getReserveCount()).to.eq("6"); - expect(await collateralToken.balanceOf(perp.address)).to.eq("0"); + expect(await perp.getReserveCount.staticCall()).to.eq("6"); + expect(await collateralToken.balanceOf(perp.target)).to.eq("0"); await TimeHelpers.increaseTime(6000); // NOTE: invoking mature on reserveTranches[0], @@ -864,7 +882,7 @@ describe("PerpetualTranche", function () { }); it("should have expected reserve composition", async function () { - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, reserveTranches[3], reserveTranches[4], reserveTranches[2]], [toFixedPtAmt("1000"), toFixedPtAmt("500"), toFixedPtAmt("500"), toFixedPtAmt("500")], @@ -872,27 +890,27 @@ describe("PerpetualTranche", function () { }); it("should change reserveCount", async function () { - expect(await perp.callStatic.getReserveCount()).to.eq("4"); + expect(await perp.getReserveCount.staticCall()).to.eq("4"); }); it("should call mature if not already called", async function () { await expect(tx) .to.emit(await bondAt(await reserveTranches[1].bond()), "Mature") - .withArgs(perp.address); + .withArgs(perp.target); }); it("should emit ReserveSynced", async function () { await expect(tx) .to.emit(perp, "ReserveSynced") - .withArgs(collateralToken.address, toFixedPtAmt("1000")) + .withArgs(collateralToken.target, toFixedPtAmt("1000")) .to.emit(perp, "ReserveSynced") - .withArgs(reserveTranches[0].address, "0") + .withArgs(reserveTranches[0].target, "0") .to.emit(perp, "ReserveSynced") - .withArgs(reserveTranches[1].address, "0"); + .withArgs(reserveTranches[1].target, "0"); }); it("should update the reserve balance", async function () { - expect(await collateralToken.balanceOf(perp.address)).to.eq(toFixedPtAmt("1000")); + expect(await collateralToken.balanceOf(perp.target)).to.eq(toFixedPtAmt("1000")); }); }); @@ -904,26 +922,26 @@ describe("PerpetualTranche", function () { const BondIssuer = await ethers.getContractFactory("BondIssuer"); issuer = await upgrades.deployProxy( BondIssuer.connect(deployer), - [bondFactory.address, collateralToken.address, 10800, [500, 500], 1200, 0], + [bondFactory.target, collateralToken.target, 10800, [500, 500], 1200, 0], { initializer: "init(address,address,uint256,uint256[],uint256,uint256)", }, ); - await perp.updateBondIssuer(issuer.address); + await perp.updateBondIssuer(issuer.target); await perp.updateTolerableTrancheMaturity(0, 10800); await advancePerpQueue(perp, 10900); for (let i = 0; i < 5; i++) { - const depositBond = await bondAt(await perp.callStatic.getDepositBond()); + const depositBond = await bondAt(await perp.getDepositBond.staticCall()); const tranches = await getTranches(depositBond); await depositIntoBond(depositBond, toFixedPtAmt("1000"), deployer); - await tranches[0].approve(perp.address, toFixedPtAmt("500")); - await perp.deposit(tranches[0].address, toFixedPtAmt("500")); + await tranches[0].approve(perp.target, toFixedPtAmt("500")); + await perp.deposit(tranches[0].target, toFixedPtAmt("500")); reserveTranches[i] = tranches[0]; await advancePerpQueue(perp, 1200); await rebase(collateralToken, rebaseOracle, -0.25); } - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, ...reserveTranches], [ @@ -935,8 +953,8 @@ describe("PerpetualTranche", function () { toFixedPtAmt("500"), ], ); - expect(await perp.callStatic.getReserveCount()).to.eq("6"); - expect(await collateralToken.balanceOf(perp.address)).to.eq("0"); + expect(await perp.getReserveCount.staticCall()).to.eq("6"); + expect(await collateralToken.balanceOf(perp.target)).to.eq("0"); await TimeHelpers.increaseTime(6000); tx = perp.updateState(); @@ -944,7 +962,7 @@ describe("PerpetualTranche", function () { }); it("should have expected reserve composition", async function () { - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, reserveTranches[3], reserveTranches[4], reserveTranches[2]], [toFixedPtAmt("553.710919999999999999"), toFixedPtAmt("500"), toFixedPtAmt("500"), toFixedPtAmt("500")], @@ -952,29 +970,29 @@ describe("PerpetualTranche", function () { }); it("should change reserveCount", async function () { - expect(await perp.callStatic.getReserveCount()).to.eq("4"); + expect(await perp.getReserveCount.staticCall()).to.eq("4"); }); it("should call mature if not already called", async function () { await expect(tx) .to.emit(await bondAt(await reserveTranches[0].bond()), "Mature") - .withArgs(perp.address) + .withArgs(perp.target) .to.emit(await bondAt(await reserveTranches[1].bond()), "Mature") - .withArgs(perp.address); + .withArgs(perp.target); }); it("should emit ReserveSynced", async function () { await expect(tx) .to.emit(perp, "ReserveSynced") - .withArgs(collateralToken.address, "553710919999999999999") + .withArgs(collateralToken.target, "553710919999999999999") .to.emit(perp, "ReserveSynced") - .withArgs(reserveTranches[0].address, "0") + .withArgs(reserveTranches[0].target, "0") .to.emit(perp, "ReserveSynced") - .withArgs(reserveTranches[1].address, "0"); + .withArgs(reserveTranches[1].target, "0"); }); it("should update the reserve balance", async function () { - expect(await collateralToken.balanceOf(perp.address)).to.eq("553710919999999999999"); + expect(await collateralToken.balanceOf(perp.target)).to.eq("553710919999999999999"); }); }); @@ -986,25 +1004,25 @@ describe("PerpetualTranche", function () { const BondIssuer = await ethers.getContractFactory("BondIssuer"); issuer = await upgrades.deployProxy( BondIssuer.connect(deployer), - [bondFactory.address, collateralToken.address, 10800, [500, 500], 1200, 0], + [bondFactory.target, collateralToken.target, 10800, [500, 500], 1200, 0], { initializer: "init(address,address,uint256,uint256[],uint256,uint256)", }, ); - await perp.updateBondIssuer(issuer.address); + await perp.updateBondIssuer(issuer.target); await perp.updateTolerableTrancheMaturity(0, 10800); await advancePerpQueue(perp, 10900); for (let i = 0; i < 5; i++) { - const depositBond = await bondAt(await perp.callStatic.getDepositBond()); + const depositBond = await bondAt(await perp.getDepositBond.staticCall()); const tranches = await getTranches(depositBond); await depositIntoBond(depositBond, toFixedPtAmt("1000"), deployer); - await tranches[0].approve(perp.address, toFixedPtAmt("500")); - await perp.deposit(tranches[0].address, toFixedPtAmt("500")); + await tranches[0].approve(perp.target, toFixedPtAmt("500")); + await perp.deposit(tranches[0].target, toFixedPtAmt("500")); reserveTranches[i] = tranches[0]; await advancePerpQueue(perp, 1200); } - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, ...reserveTranches], [ @@ -1016,8 +1034,8 @@ describe("PerpetualTranche", function () { toFixedPtAmt("500"), ], ); - expect(await perp.callStatic.getReserveCount()).to.eq("6"); - expect(await collateralToken.balanceOf(perp.address)).to.eq("0"); + expect(await perp.getReserveCount.staticCall()).to.eq("6"); + expect(await collateralToken.balanceOf(perp.target)).to.eq("0"); await TimeHelpers.increaseTime(6000); tx = perp.updateState(); @@ -1025,7 +1043,7 @@ describe("PerpetualTranche", function () { }); it("should have expected reserve composition", async function () { - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, reserveTranches[3], reserveTranches[4], reserveTranches[2]], [toFixedPtAmt("1000"), toFixedPtAmt("500"), toFixedPtAmt("500"), toFixedPtAmt("500")], @@ -1033,7 +1051,7 @@ describe("PerpetualTranche", function () { }); it("should change reserveCount", async function () { - expect(await perp.callStatic.getReserveCount()).to.eq("4"); + expect(await perp.getReserveCount.staticCall()).to.eq("4"); }); it("should change mature tranche balances", async function () {}); @@ -1041,23 +1059,23 @@ describe("PerpetualTranche", function () { it("should call mature if not already called", async function () { await expect(tx) .to.emit(await bondAt(await reserveTranches[0].bond()), "Mature") - .withArgs(perp.address) + .withArgs(perp.target) .to.emit(await bondAt(await reserveTranches[1].bond()), "Mature") - .withArgs(perp.address); + .withArgs(perp.target); }); it("should emit ReserveSynced", async function () { await expect(tx) .to.emit(perp, "ReserveSynced") - .withArgs(collateralToken.address, toFixedPtAmt("1000")) + .withArgs(collateralToken.target, toFixedPtAmt("1000")) .to.emit(perp, "ReserveSynced") - .withArgs(reserveTranches[0].address, "0") + .withArgs(reserveTranches[0].target, "0") .to.emit(perp, "ReserveSynced") - .withArgs(reserveTranches[1].address, "0"); + .withArgs(reserveTranches[1].target, "0"); }); it("should update the reserve balance", async function () { - expect(await collateralToken.balanceOf(perp.address)).to.eq(toFixedPtAmt("1000")); + expect(await collateralToken.balanceOf(perp.target)).to.eq(toFixedPtAmt("1000")); }); }); @@ -1069,25 +1087,25 @@ describe("PerpetualTranche", function () { const BondIssuer = await ethers.getContractFactory("BondIssuer"); issuer = await upgrades.deployProxy( BondIssuer.connect(deployer), - [bondFactory.address, collateralToken.address, 10800, [500, 500], 1200, 0], + [bondFactory.target, collateralToken.target, 10800, [500, 500], 1200, 0], { initializer: "init(address,address,uint256,uint256[],uint256,uint256)", }, ); - await perp.updateBondIssuer(issuer.address); + await perp.updateBondIssuer(issuer.target); await perp.updateTolerableTrancheMaturity(0, 10800); await advancePerpQueue(perp, 10900); for (let i = 0; i < 5; i++) { - const depositBond = await bondAt(await perp.callStatic.getDepositBond()); + const depositBond = await bondAt(await perp.getDepositBond.staticCall()); const tranches = await getTranches(depositBond); await depositIntoBond(depositBond, toFixedPtAmt("1000"), deployer); - await tranches[0].approve(perp.address, toFixedPtAmt("500")); - await perp.deposit(tranches[0].address, toFixedPtAmt("500")); + await tranches[0].approve(perp.target, toFixedPtAmt("500")); + await perp.deposit(tranches[0].target, toFixedPtAmt("500")); reserveTranches[i] = tranches[0]; await advancePerpQueue(perp, 1200); } - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, ...reserveTranches], [ @@ -1099,8 +1117,8 @@ describe("PerpetualTranche", function () { toFixedPtAmt("500"), ], ); - expect(await perp.callStatic.getReserveCount()).to.eq("6"); - expect(await collateralToken.balanceOf(perp.address)).to.eq("0"); + expect(await perp.getReserveCount.staticCall()).to.eq("6"); + expect(await collateralToken.balanceOf(perp.target)).to.eq("0"); await TimeHelpers.increaseTime(6000); await perp.updateKeeper(await deployer.getAddress()); @@ -1110,7 +1128,7 @@ describe("PerpetualTranche", function () { }); it("should have not updated composition", async function () { - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, ...reserveTranches], [ @@ -1133,34 +1151,34 @@ describe("PerpetualTranche", function () { const BondIssuer = await ethers.getContractFactory("BondIssuer"); issuer = await upgrades.deployProxy( BondIssuer.connect(deployer), - [bondFactory.address, collateralToken.address, 10800, [500, 500], 1200, 0], + [bondFactory.target, collateralToken.target, 10800, [500, 500], 1200, 0], { initializer: "init(address,address,uint256,uint256[],uint256,uint256)", }, ); - await perp.updateBondIssuer(issuer.address); + await perp.updateBondIssuer(issuer.target); await perp.updateTolerableTrancheMaturity(600, 10800); await advancePerpQueue(perp, 10900); for (let i = 0; i < 5; i++) { - const depositBond = await bondAt(await perp.callStatic.getDepositBond()); + const depositBond = await bondAt(await perp.getDepositBond.staticCall()); const tranches = await getTranches(depositBond); await depositIntoBond(depositBond, toFixedPtAmt("1000"), deployer); - await tranches[0].approve(perp.address, toFixedPtAmt("500")); - await perp.deposit(tranches[0].address, toFixedPtAmt("500")); + await tranches[0].approve(perp.target, toFixedPtAmt("500")); + await perp.deposit(tranches[0].target, toFixedPtAmt("500")); depositTranches[i] = tranches[0]; await advancePerpQueue(perp, 1200); } - await advancePerpQueueToRollover(perp, await bondAt(depositTranches[2].bond())); + await advancePerpQueueToRollover(perp, await bondAt(await depositTranches[2].bond())); }); it("should get the rollover ready tranches", async function () { - const r = await perp.callStatic.getReserveTokensUpForRollover(); - expect(r).to.include(collateralToken.address); - expect(r).to.include(depositTranches[2].address); - expect(r).not.to.include(depositTranches[0].address); - expect(r).not.to.include(depositTranches[1].address); - expect(r).not.to.include(depositTranches[3].address); - expect(r).not.to.include(depositTranches[4].address); + const r = await perp.getReserveTokensUpForRollover.staticCall(); + expect(r).to.include(collateralToken.target); + expect(r).to.include(depositTranches[2].target); + expect(r).not.to.include(depositTranches[0].target); + expect(r).not.to.include(depositTranches[1].target); + expect(r).not.to.include(depositTranches[3].target); + expect(r).not.to.include(depositTranches[4].target); }); }); @@ -1171,34 +1189,34 @@ describe("PerpetualTranche", function () { const BondIssuer = await ethers.getContractFactory("BondIssuer"); issuer = await upgrades.deployProxy( BondIssuer.connect(deployer), - [bondFactory.address, collateralToken.address, 10800, [500, 500], 1200, 0], + [bondFactory.target, collateralToken.target, 10800, [500, 500], 1200, 0], { initializer: "init(address,address,uint256,uint256[],uint256,uint256)", }, ); - await perp.updateBondIssuer(issuer.address); + await perp.updateBondIssuer(issuer.target); await perp.updateTolerableTrancheMaturity(600, 10800); await advancePerpQueue(perp, 10900); for (let i = 0; i < 5; i++) { - const depositBond = await bondAt(await perp.callStatic.getDepositBond()); + const depositBond = await bondAt(await perp.getDepositBond.staticCall()); const tranches = await getTranches(depositBond); await depositIntoBond(depositBond, toFixedPtAmt("1000"), deployer); - await tranches[0].approve(perp.address, toFixedPtAmt("500")); - await perp.deposit(tranches[0].address, toFixedPtAmt("500")); + await tranches[0].approve(perp.target, toFixedPtAmt("500")); + await perp.deposit(tranches[0].target, toFixedPtAmt("500")); depositTranches[i] = tranches[0]; await advancePerpQueue(perp, 1200); } - await advancePerpQueueToRollover(perp, await bondAt(depositTranches[2].bond())); + await advancePerpQueueToRollover(perp, await bondAt(await depositTranches[2].bond())); }); it("should return the token balance", async function () { - expect(await perp.callStatic.getReserveTokenBalance(perp.address)).to.eq("0"); - expect(await perp.callStatic.getReserveTokenBalance(collateralToken.address)).to.eq(toFixedPtAmt("1000")); - expect(await perp.callStatic.getReserveTokenBalance(depositTranches[0].address)).to.eq("0"); - expect(await perp.callStatic.getReserveTokenBalance(depositTranches[1].address)).to.eq("0"); - expect(await perp.callStatic.getReserveTokenBalance(depositTranches[2].address)).to.eq(toFixedPtAmt("500")); - expect(await perp.callStatic.getReserveTokenBalance(depositTranches[3].address)).to.eq(toFixedPtAmt("500")); - expect(await perp.callStatic.getReserveTokenBalance(depositTranches[4].address)).to.eq(toFixedPtAmt("500")); + expect(await perp.getReserveTokenBalance.staticCall(perp.target)).to.eq("0"); + expect(await perp.getReserveTokenBalance.staticCall(collateralToken.target)).to.eq(toFixedPtAmt("1000")); + expect(await perp.getReserveTokenBalance.staticCall(depositTranches[0].target)).to.eq("0"); + expect(await perp.getReserveTokenBalance.staticCall(depositTranches[1].target)).to.eq("0"); + expect(await perp.getReserveTokenBalance.staticCall(depositTranches[2].target)).to.eq(toFixedPtAmt("500")); + expect(await perp.getReserveTokenBalance.staticCall(depositTranches[3].target)).to.eq(toFixedPtAmt("500")); + expect(await perp.getReserveTokenBalance.staticCall(depositTranches[4].target)).to.eq(toFixedPtAmt("500")); }); }); @@ -1209,35 +1227,35 @@ describe("PerpetualTranche", function () { const BondIssuer = await ethers.getContractFactory("BondIssuer"); issuer = await upgrades.deployProxy( BondIssuer.connect(deployer), - [bondFactory.address, collateralToken.address, 10800, [500, 500], 1200, 0], + [bondFactory.target, collateralToken.target, 10800, [500, 500], 1200, 0], { initializer: "init(address,address,uint256,uint256[],uint256,uint256)", }, ); - await perp.updateBondIssuer(issuer.address); + await perp.updateBondIssuer(issuer.target); await perp.updateTolerableTrancheMaturity(600, 10800); await advancePerpQueue(perp, 10900); for (let i = 0; i < 5; i++) { - const depositBond = await bondAt(await perp.callStatic.getDepositBond()); + const depositBond = await bondAt(await perp.getDepositBond.staticCall()); const tranches = await getTranches(depositBond); await depositIntoBond(depositBond, toFixedPtAmt("1000"), deployer); - await tranches[0].approve(perp.address, toFixedPtAmt("500")); - await perp.deposit(tranches[0].address, toFixedPtAmt("500")); + await tranches[0].approve(perp.target, toFixedPtAmt("500")); + await perp.deposit(tranches[0].target, toFixedPtAmt("500")); depositTranches[i] = tranches[0]; await advancePerpQueue(perp, 1200); await rebase(collateralToken, rebaseOracle, -0.5); } - await advancePerpQueueToRollover(perp, await bondAt(depositTranches[2].bond())); + await advancePerpQueueToRollover(perp, await bondAt(await depositTranches[2].bond())); }); it("should return the tranche value", async function () { - expect(await perp.callStatic.getReserveTokenValue(perp.address)).to.eq("0"); - expect(await perp.callStatic.getReserveTokenValue(collateralToken.address)).to.eq(toFixedPtAmt("93.75")); - expect(await perp.callStatic.getReserveTokenValue(depositTranches[0].address)).to.eq("0"); - expect(await perp.callStatic.getReserveTokenValue(depositTranches[1].address)).to.eq("0"); - expect(await perp.callStatic.getReserveTokenValue(depositTranches[2].address)).to.eq(toFixedPtAmt("125")); - expect(await perp.callStatic.getReserveTokenValue(depositTranches[3].address)).to.eq(toFixedPtAmt("250")); - expect(await perp.callStatic.getReserveTokenValue(depositTranches[4].address)).to.eq(toFixedPtAmt("500")); + expect(await perp.getReserveTokenValue.staticCall(perp.target)).to.eq("0"); + expect(await perp.getReserveTokenValue.staticCall(collateralToken.target)).to.eq(toFixedPtAmt("93.75")); + expect(await perp.getReserveTokenValue.staticCall(depositTranches[0].target)).to.eq("0"); + expect(await perp.getReserveTokenValue.staticCall(depositTranches[1].target)).to.eq("0"); + expect(await perp.getReserveTokenValue.staticCall(depositTranches[2].target)).to.eq(toFixedPtAmt("125")); + expect(await perp.getReserveTokenValue.staticCall(depositTranches[3].target)).to.eq(toFixedPtAmt("250")); + expect(await perp.getReserveTokenValue.staticCall(depositTranches[4].target)).to.eq(toFixedPtAmt("500")); }); }); }); diff --git a/spot-contracts/test/perp/PerpetualTranche_deposit.ts b/spot-contracts/test/perp/PerpetualTranche_deposit.ts index d42714e9..eb441960 100644 --- a/spot-contracts/test/perp/PerpetualTranche_deposit.ts +++ b/spot-contracts/test/perp/PerpetualTranche_deposit.ts @@ -1,7 +1,6 @@ -import { expect, use } from "chai"; +import { expect } from "chai"; import { network, ethers, upgrades } from "hardhat"; import { Contract, Transaction, Signer } from "ethers"; -import { smock } from "@defi-wonderland/smock"; import { setupCollateralToken, setupBondFactory, @@ -12,11 +11,11 @@ import { toPercFixedPtAmt, toFixedPtAmt, advancePerpQueue, - checkReserveComposition, + checkPerpComposition, rebase, mintCollteralToken, + DMock, } from "../helpers"; -use(smock.matchers); let perp: Contract, bondFactory: Contract, @@ -43,39 +42,46 @@ describe("PerpetualTranche", function () { const BondIssuer = await ethers.getContractFactory("BondIssuer"); issuer = await upgrades.deployProxy( BondIssuer.connect(deployer), - [bondFactory.address, collateralToken.address, 3600, [500, 500], 1200, 0], + [bondFactory.target, collateralToken.target, 3600, [500, 500], 1200, 0], { initializer: "init(address,address,uint256,uint256[],uint256,uint256)", }, ); - const FeePolicy = await ethers.getContractFactory("FeePolicy"); - feePolicy = await smock.fake(FeePolicy); - await feePolicy.decimals.returns(8); + feePolicy = new DMock(await ethers.getContractFactory("FeePolicy")); + await feePolicy.deploy(); + await feePolicy.mockMethod("decimals()", [8]); + await feePolicy.mockMethod("computeDeviationRatio((uint256,uint256))", [toPercFixedPtAmt("1")]); + await feePolicy.mockMethod("computeFeePerc(uint256,uint256)", [0]); const PerpetualTranche = await ethers.getContractFactory("PerpetualTranche"); perp = await upgrades.deployProxy( PerpetualTranche.connect(deployer), - ["PerpetualTranche", "PERP", collateralToken.address, issuer.address, feePolicy.address], + ["PerpetualTranche", "PERP", collateralToken.target, issuer.target, feePolicy.target], { initializer: "init(string,string,address,address,address)", }, ); await advancePerpQueue(perp, 3600); - const RolloverVault = await ethers.getContractFactory("RolloverVault"); - const vault = await smock.fake(RolloverVault); - await vault.getTVL.returns("0"); - await perp.updateVault(vault.address); + const TrancheManager = await ethers.getContractFactory("TrancheManager"); + const trancheManager = await TrancheManager.deploy(); + const RolloverVault = await ethers.getContractFactory("RolloverVault", { + libraries: { + TrancheManager: trancheManager.target, + }, + }); + const vault = new DMock(RolloverVault); + await vault.deploy(); + await vault.mockMethod("getTVL()", [0]); + await perp.updateVault(vault.target); - depositBond = await bondAt(await perp.callStatic.getDepositBond()); + depositBond = await bondAt(await perp.getDepositBond.staticCall()); [depositTrancheA, depositTrancheZ] = await getTranches(depositBond); await depositIntoBond(depositBond, toFixedPtAmt("1000"), deployer); - await depositTrancheA.approve(perp.address, toFixedPtAmt("500")); - await depositTrancheZ.approve(perp.address, toFixedPtAmt("500")); - - await feePolicy.computePerpMintFeePerc.returns("0"); + await depositTrancheA.approve(perp.target, toFixedPtAmt("500")); + await depositTrancheZ.approve(perp.target, toFixedPtAmt("500")); }); afterEach(async function () { @@ -90,24 +96,24 @@ describe("PerpetualTranche", function () { }); it("should revert", async function () { - await expect(perp.deposit(depositTrancheA.address, toFixedPtAmt("500"))).to.revertedWith("Pausable: paused"); + await expect(perp.deposit(depositTrancheA.target, toFixedPtAmt("500"))).to.revertedWith("Pausable: paused"); }); }); describe("when bond issuer is NOT set correctly", function () { let bond: Contract; beforeEach(async function () { - const BondIssuer = await ethers.getContractFactory("BondIssuer"); - const newIssuer = await smock.fake(BondIssuer); - await newIssuer.collateral.returns(collateralToken.address); - await perp.updateBondIssuer(newIssuer.address); bond = await createBondWithFactory(bondFactory, perp, [200, 300, 500], 3600); - await newIssuer.getLatestBond.returns(bond.address); + const newIssuer = new DMock(await ethers.getContractFactory("BondIssuer")); + await newIssuer.deploy(); + await newIssuer.mockMethod("collateral()", [collateralToken.target]); + await newIssuer.mockMethod("getLatestBond()", [bond.target]); + await perp.updateBondIssuer(newIssuer.target); }); it("should not update the deposit bond", async function () { - await depositTrancheA.approve(perp.address, toFixedPtAmt("500")); - await expect(perp.deposit(depositTrancheA.address, toFixedPtAmt("500"))).to.not.be.reverted; - expect(await perp.callStatic.getDepositBond()).to.not.eq(bond.address); + await depositTrancheA.approve(perp.target, toFixedPtAmt("500")); + await expect(perp.deposit(depositTrancheA.target, toFixedPtAmt("500"))).to.not.be.reverted; + expect(await perp.getDepositBond.staticCall()).to.not.eq(bond.target); }); }); @@ -118,8 +124,8 @@ describe("PerpetualTranche", function () { depositTrancheA = (await getTranches(bond))[0]; }); it("should revert", async function () { - await depositTrancheA.approve(perp.address, toFixedPtAmt("500")); - await expect(perp.deposit(depositTrancheA.address, toFixedPtAmt("500"))).to.revertedWithCustomError( + await depositTrancheA.approve(perp.target, toFixedPtAmt("500")); + await expect(perp.deposit(depositTrancheA.target, toFixedPtAmt("500"))).to.revertedWithCustomError( perp, "UnexpectedAsset", ); @@ -132,9 +138,9 @@ describe("PerpetualTranche", function () { const maliciousTranche = await ERC20.deploy(); await maliciousTranche.init("Tranche", "TRA"); await maliciousTranche.mint(deployerAddress, toFixedPtAmt("500")); - await maliciousTranche.setBond(await perp.callStatic.getDepositBond()); - await maliciousTranche.approve(perp.address, toFixedPtAmt("500")); - await expect(perp.deposit(maliciousTranche.address, toFixedPtAmt("500"))).to.revertedWithCustomError( + await maliciousTranche.setBond(await perp.getDepositBond.staticCall()); + await maliciousTranche.approve(perp.target, toFixedPtAmt("500")); + await expect(perp.deposit(maliciousTranche.target, toFixedPtAmt("500"))).to.revertedWithCustomError( perp, "UnexpectedAsset", ); @@ -143,10 +149,10 @@ describe("PerpetualTranche", function () { describe("when user has not approved sufficient tranche tokens", function () { beforeEach(async function () { - await depositTrancheA.approve(perp.address, "0"); + await depositTrancheA.approve(perp.target, "0"); }); it("should revert", async function () { - await expect(perp.deposit(depositTrancheA.address, toFixedPtAmt("500"))).to.revertedWith( + await expect(perp.deposit(depositTrancheA.target, toFixedPtAmt("500"))).to.revertedWith( "ERC20: transfer amount exceeds allowance", ); }); @@ -154,11 +160,11 @@ describe("PerpetualTranche", function () { describe("when user has insufficient balance", function () { beforeEach(async function () { - await depositTrancheA.transfer(perp.address, toFixedPtAmt("500")); + await depositTrancheA.transfer(perp.target, toFixedPtAmt("500")); }); it("should revert", async function () { expect(await depositTrancheA.balanceOf(deployerAddress)).to.eq("0"); - await expect(perp.deposit(depositTrancheA.address, toFixedPtAmt("500"))).to.revertedWith( + await expect(perp.deposit(depositTrancheA.target, toFixedPtAmt("500"))).to.revertedWith( "ERC20: transfer amount exceeds balance", ); }); @@ -170,7 +176,7 @@ describe("PerpetualTranche", function () { }); it("should revert", async function () { - await expect(perp.deposit(depositTrancheA.address, toFixedPtAmt("500"))).to.revertedWithCustomError( + await expect(perp.deposit(depositTrancheA.target, toFixedPtAmt("500"))).to.revertedWithCustomError( perp, "ExceededMaxSupply", ); @@ -179,12 +185,12 @@ describe("PerpetualTranche", function () { describe("when the supply cap is exceeded and existing supply > 0", function () { beforeEach(async function () { - await perp.deposit(depositTrancheA.address, toFixedPtAmt("400")); + await perp.deposit(depositTrancheA.target, toFixedPtAmt("400")); await perp.updateMaxSupply(toFixedPtAmt("499")); }); it("should revert", async function () { - await expect(perp.deposit(depositTrancheA.address, toFixedPtAmt("100"))).to.revertedWithCustomError( + await expect(perp.deposit(depositTrancheA.target, toFixedPtAmt("100"))).to.revertedWithCustomError( perp, "ExceededMaxSupply", ); @@ -196,7 +202,7 @@ describe("PerpetualTranche", function () { await perp.updateMaxDepositTrancheValuePerc(toPercFixedPtAmt("0.5")); }); it("should not revert", async function () { - await expect(perp.deposit(depositTrancheA.address, toFixedPtAmt("100"))).to.revertedWithCustomError( + await expect(perp.deposit(depositTrancheA.target, toFixedPtAmt("100"))).to.revertedWithCustomError( perp, "ExceededMaxMintPerTranche", ); @@ -205,59 +211,62 @@ describe("PerpetualTranche", function () { describe("when the tranche mint limit has not exceeded and existing supply > 0", function () { beforeEach(async function () { - await perp.deposit(depositTrancheA.address, toFixedPtAmt("250")); + await perp.deposit(depositTrancheA.target, toFixedPtAmt("250")); await advancePerpQueue(perp, 1200); + await perp.updateTolerableTrancheMaturity(1, ethers.MaxUint256); await perp.updateMaxDepositTrancheValuePerc(toPercFixedPtAmt("0.5")); }); it("should NOT revert", async function () { await mintCollteralToken(collateralToken, toFixedPtAmt("50"), deployer); - await collateralToken.transfer(perp.address, toFixedPtAmt("10")); - const newBond = await bondAt(await perp.callStatic.getDepositBond()); + await collateralToken.transfer(perp.target, toFixedPtAmt("10")); + const newBond = await bondAt(await perp.getDepositBond.staticCall()); await depositIntoBond(newBond, toFixedPtAmt("2000"), deployer); const tranches = await getTranches(newBond); const newTranche = tranches[0]; - await newTranche.approve(perp.address, toFixedPtAmt("500")); - await perp.deposit(newTranche.address, toFixedPtAmt("200")); - await expect(perp.deposit(newTranche.address, toFixedPtAmt("1"))).not.to.reverted; + await newTranche.approve(perp.target, toFixedPtAmt("500")); + await perp.deposit(newTranche.target, toFixedPtAmt("200")); + await expect(perp.deposit(newTranche.target, toFixedPtAmt("1"))).not.to.reverted; }); }); describe("when the tranche mint limit has exceeded and existing supply > 0", function () { beforeEach(async function () { - await perp.deposit(depositTrancheA.address, toFixedPtAmt("250")); + await perp.deposit(depositTrancheA.target, toFixedPtAmt("250")); await advancePerpQueue(perp, 1200); + await perp.updateTolerableTrancheMaturity(1, ethers.MaxUint256); await perp.updateMaxDepositTrancheValuePerc(toPercFixedPtAmt("0.5")); }); it("should revert", async function () { await mintCollteralToken(collateralToken, toFixedPtAmt("50"), deployer); - await collateralToken.transfer(perp.address, toFixedPtAmt("50")); - const newBond = await bondAt(await perp.callStatic.getDepositBond()); + await collateralToken.transfer(perp.target, toFixedPtAmt("50")); + const newBond = await bondAt(await perp.getDepositBond.staticCall()); await depositIntoBond(newBond, toFixedPtAmt("2000"), deployer); const tranches = await getTranches(newBond); const newTranche = tranches[0]; - await newTranche.approve(perp.address, toFixedPtAmt("500")); - await perp.deposit(newTranche.address, toFixedPtAmt("200")); - await expect(perp.deposit(newTranche.address, toFixedPtAmt("1"))).to.reverted; + await newTranche.approve(perp.target, toFixedPtAmt("500")); + await perp.deposit(newTranche.target, toFixedPtAmt("200")); + await expect(perp.deposit(newTranche.target, toFixedPtAmt("1"))).to.reverted; }); }); describe("when the tranche mint limit is exceeded and existing supply > 0", function () { beforeEach(async function () { - await perp.deposit(depositTrancheA.address, toFixedPtAmt("250")); + await perp.deposit(depositTrancheA.target, toFixedPtAmt("250")); await advancePerpQueue(perp, 1200); + await perp.updateTolerableTrancheMaturity(1, ethers.MaxUint256); await perp.updateMaxDepositTrancheValuePerc(toPercFixedPtAmt("0.5")); }); it("should revert", async function () { - const newBond = await bondAt(await perp.callStatic.getDepositBond()); + const newBond = await bondAt(await perp.getDepositBond.staticCall()); await depositIntoBond(newBond, toFixedPtAmt("2000"), deployer); const tranches = await getTranches(newBond); const newTranche = tranches[0]; - await newTranche.approve(perp.address, toFixedPtAmt("500")); - await perp.deposit(newTranche.address, toFixedPtAmt("250")); - await expect(perp.deposit(newTranche.address, toFixedPtAmt("1"))).to.revertedWithCustomError( + await newTranche.approve(perp.target, toFixedPtAmt("500")); + await perp.deposit(newTranche.target, toFixedPtAmt("250")); + await expect(perp.deposit(newTranche.target, toFixedPtAmt("1"))).to.revertedWithCustomError( perp, "ExceededMaxMintPerTranche", ); @@ -266,13 +275,13 @@ describe("PerpetualTranche", function () { describe("when tranche amount is zero", function () { it("should return without minting", async function () { - expect(await perp.callStatic.deposit(depositTrancheA.address, "0")).to.eq("0"); + expect(await perp.deposit.staticCall(depositTrancheA.target, "0")).to.eq("0"); }); }); describe("when depositing a junior", function () { it("should return without minting", async function () { - await expect(perp.deposit(depositTrancheZ.address, toFixedPtAmt("500"))).to.revertedWithCustomError( + await expect(perp.deposit(depositTrancheZ.target, toFixedPtAmt("500"))).to.revertedWithCustomError( perp, "UnexpectedAsset", ); @@ -282,7 +291,7 @@ describe("PerpetualTranche", function () { describe("when total supply is zero", function () { describe("when tranche price is 1", function () { it("should mint the correct amount", async function () { - const r = await perp.callStatic.computeMintAmt(depositTrancheA.address, toFixedPtAmt("500")); + const r = await perp.computeMintAmt.staticCall(depositTrancheA.target, toFixedPtAmt("500")); expect(r).to.eq(toFixedPtAmt("500")); }); }); @@ -293,7 +302,7 @@ describe("PerpetualTranche", function () { }); it("should mint the correct amount", async function () { - const r = await perp.callStatic.computeMintAmt(depositTrancheA.address, toFixedPtAmt("500")); + const r = await perp.computeMintAmt.staticCall(depositTrancheA.target, toFixedPtAmt("500")); expect(r).to.eq(toFixedPtAmt("250")); }); }); @@ -302,19 +311,19 @@ describe("PerpetualTranche", function () { describe("when total supply > zero", function () { let newBond: Contract, newTranche: Contract; beforeEach(async function () { - await perp.deposit(depositTrancheA.address, toFixedPtAmt("200")); + await perp.deposit(depositTrancheA.target, toFixedPtAmt("200")); await advancePerpQueue(perp, 1200); - newBond = await bondAt(await perp.callStatic.getDepositBond()); + newBond = await bondAt(await perp.getDepositBond.staticCall()); await depositIntoBond(newBond, toFixedPtAmt("1000"), deployer); const tranches = await getTranches(newBond); newTranche = tranches[0]; - await newTranche.approve(perp.address, toFixedPtAmt("250")); + await newTranche.approve(perp.target, toFixedPtAmt("250")); }); describe("when price is eql to avg reserve price", function () { it("should mint the correct amount", async function () { - const r = await perp.callStatic.computeMintAmt(newTranche.address, toFixedPtAmt("250")); + const r = await perp.computeMintAmt.staticCall(newTranche.target, toFixedPtAmt("250")); expect(r).to.eq(toFixedPtAmt("250")); }); }); @@ -322,11 +331,11 @@ describe("PerpetualTranche", function () { describe("when price is < avg reserve price", function () { beforeEach(async function () { await mintCollteralToken(collateralToken, toFixedPtAmt("500"), deployer); - await collateralToken.transfer(perp.address, toFixedPtAmt("200")); + await collateralToken.transfer(perp.target, toFixedPtAmt("200")); }); it("should mint the correct amount", async function () { - const r = await perp.callStatic.computeMintAmt(newTranche.address, toFixedPtAmt("250")); + const r = await perp.computeMintAmt.staticCall(newTranche.target, toFixedPtAmt("250")); expect(r).to.eq(toFixedPtAmt("125")); }); }); @@ -336,15 +345,15 @@ describe("PerpetualTranche", function () { await rebase(collateralToken, rebaseOracle, -0.75); await advancePerpQueue(perp, 1200); - newBond = await bondAt(await perp.callStatic.getDepositBond()); + newBond = await bondAt(await perp.getDepositBond.staticCall()); await depositIntoBond(newBond, toFixedPtAmt("1000"), deployer); const tranches = await getTranches(newBond); newTranche = tranches[0]; - await newTranche.approve(perp.address, toFixedPtAmt("250")); + await newTranche.approve(perp.target, toFixedPtAmt("250")); }); it("should mint the correct amount", async function () { - const r = await perp.callStatic.computeMintAmt(newTranche.address, toFixedPtAmt("250")); + const r = await perp.computeMintAmt.staticCall(newTranche.target, toFixedPtAmt("250")); expect(r).to.eq(toFixedPtAmt("500")); }); }); @@ -352,28 +361,28 @@ describe("PerpetualTranche", function () { describe("on successful deposit", function () { it("should mint perp tokens", async function () { - await expect(() => perp.deposit(depositTrancheA.address, toFixedPtAmt("500"))).to.changeTokenBalance( + await expect(() => perp.deposit(depositTrancheA.target, toFixedPtAmt("500"))).to.changeTokenBalance( perp, deployer, toFixedPtAmt("500"), ); }); it("should NOT withhold any fee amount", async function () { - await expect(() => perp.deposit(depositTrancheA.address, toFixedPtAmt("500"))).to.changeTokenBalance( + await expect(() => perp.deposit(depositTrancheA.target, toFixedPtAmt("500"))).to.changeTokenBalance( perp, perp, "0", ); }); it("should transfer the tranches in", async function () { - await expect(() => perp.deposit(depositTrancheA.address, toFixedPtAmt("500"))).to.changeTokenBalances( + await expect(() => perp.deposit(depositTrancheA.target, toFixedPtAmt("500"))).to.changeTokenBalances( depositTrancheA, [deployer, perp], [toFixedPtAmt("-500"), toFixedPtAmt("500")], ); }); it("should return the mintAmt", async function () { - const r = await perp.callStatic.computeMintAmt(depositTrancheA.address, toFixedPtAmt("500")); + const r = await perp.computeMintAmt.staticCall(depositTrancheA.target, toFixedPtAmt("500")); expect(r).to.eq(toFixedPtAmt("500")); }); }); @@ -381,24 +390,24 @@ describe("PerpetualTranche", function () { describe("when the reserve has no tranches", function () { let tx: Transaction; beforeEach(async function () { - expect(await perp.callStatic.getDepositBond()).to.eq(depositBond.address); + expect(await perp.getDepositBond.staticCall()).to.eq(depositBond.target); - await checkReserveComposition(perp, [collateralToken], ["0"]); + await checkPerpComposition(perp, [collateralToken], ["0"]); expect(await perp.totalSupply()).to.eq(0); - tx = perp.deposit(depositTrancheA.address, toFixedPtAmt("500")); + tx = perp.deposit(depositTrancheA.target, toFixedPtAmt("500")); await tx; }); it("should NOT update the deposit bond", async function () { - expect(await perp.callStatic.getDepositBond()).to.eq(depositBond.address); + expect(await perp.getDepositBond.staticCall()).to.eq(depositBond.target); }); it("should emit reserve synced", async function () { - await expect(tx).to.emit(perp, "ReserveSynced").withArgs(depositTrancheA.address, toFixedPtAmt("500")); + await expect(tx).to.emit(perp, "ReserveSynced").withArgs(depositTrancheA.target, toFixedPtAmt("500")); }); it("should update the reserve", async function () { - await checkReserveComposition(perp, [collateralToken, depositTrancheA], ["0", toFixedPtAmt("500")]); + await checkPerpComposition(perp, [collateralToken, depositTrancheA], ["0", toFixedPtAmt("500")]); }); it("should update the total supply", async function () { expect(await perp.totalSupply()).to.eq(toFixedPtAmt("500")); @@ -407,10 +416,10 @@ describe("PerpetualTranche", function () { describe("when the reserve has tranches", function () { beforeEach(async function () { - await perp.deposit(depositTrancheA.address, toFixedPtAmt("200")); + await perp.deposit(depositTrancheA.target, toFixedPtAmt("200")); - expect(await perp.callStatic.getDepositBond()).to.eq(depositBond.address); - await checkReserveComposition(perp, [collateralToken, depositTrancheA], ["0", toFixedPtAmt("200")]); + expect(await perp.getDepositBond.staticCall()).to.eq(depositBond.target); + await checkPerpComposition(perp, [collateralToken, depositTrancheA], ["0", toFixedPtAmt("200")]); expect(await perp.totalSupply()).to.eq(toFixedPtAmt("200")); }); @@ -418,18 +427,18 @@ describe("PerpetualTranche", function () { describe("when inserting the an existing tranche", async function () { let tx: Transaction; beforeEach(async function () { - tx = perp.deposit(depositTrancheA.address, toFixedPtAmt("300")); + tx = perp.deposit(depositTrancheA.target, toFixedPtAmt("300")); await tx; }); it("should NOT update the deposit bond", async function () { - expect(await perp.callStatic.getDepositBond()).to.eq(depositBond.address); + expect(await perp.getDepositBond.staticCall()).to.eq(depositBond.target); }); it("should emit reserve synced", async function () { - await expect(tx).to.emit(perp, "ReserveSynced").withArgs(depositTrancheA.address, toFixedPtAmt("500")); + await expect(tx).to.emit(perp, "ReserveSynced").withArgs(depositTrancheA.target, toFixedPtAmt("500")); }); it("should update the reserve", async function () { - await checkReserveComposition(perp, [collateralToken, depositTrancheA], ["0", toFixedPtAmt("500")]); + await checkPerpComposition(perp, [collateralToken, depositTrancheA], ["0", toFixedPtAmt("500")]); }); it("should update the total supply", async function () { expect(await perp.totalSupply()).to.eq(toFixedPtAmt("500")); @@ -441,25 +450,25 @@ describe("PerpetualTranche", function () { beforeEach(async function () { await advancePerpQueue(perp, 1200); - newBond = await bondAt(await perp.callStatic.getDepositBond()); + newBond = await bondAt(await perp.getDepositBond.staticCall()); await depositIntoBond(newBond, toFixedPtAmt("1000"), deployer); const tranches = await getTranches(newBond); newTranche = tranches[0]; - await checkReserveComposition(perp, [collateralToken, depositTrancheA], ["0", toFixedPtAmt("200")]); + await checkPerpComposition(perp, [collateralToken, depositTrancheA], ["0", toFixedPtAmt("200")]); expect(await perp.totalSupply()).to.eq(toFixedPtAmt("200")); - await newTranche.approve(perp.address, toFixedPtAmt("250")); - tx = perp.deposit(newTranche.address, toFixedPtAmt("250")); + await newTranche.approve(perp.target, toFixedPtAmt("250")); + tx = perp.deposit(newTranche.target, toFixedPtAmt("250")); await tx; }); it("should update the deposit bond", async function () { - expect(await perp.callStatic.getDepositBond()).to.eq(newBond.address); + expect(await perp.getDepositBond.staticCall()).to.eq(newBond.target); }); it("should emit reserve synced", async function () { - await expect(tx).to.emit(perp, "ReserveSynced").withArgs(newTranche.address, toFixedPtAmt("250")); + await expect(tx).to.emit(perp, "ReserveSynced").withArgs(newTranche.target, toFixedPtAmt("250")); }); it("should update the reserve", async function () { - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, depositTrancheA, newTranche], ["0", toFixedPtAmt("200"), toFixedPtAmt("250")], @@ -473,26 +482,50 @@ describe("PerpetualTranche", function () { describe("when fee is set", function () { beforeEach(async function () { - await feePolicy.computePerpMintFeePerc.returns(toPercFixedPtAmt("0.01")); + await feePolicy.clearMockMethod("computeDeviationRatio((uint256,uint256))"); + await feePolicy.mockCall( + "computeDeviationRatio((uint256,uint256))", + [[toFixedPtAmt("0"), toFixedPtAmt("0")]], + [toPercFixedPtAmt("1")], + ); + await feePolicy.mockCall( + "computeDeviationRatio((uint256,uint256))", + [[toFixedPtAmt("500"), toFixedPtAmt("0")]], + [toPercFixedPtAmt("1")], + ); + await feePolicy.mockMethod("computeFeePerc(uint256,uint256)", [toPercFixedPtAmt("0.01")]); }); it("should mint perp tokens", async function () { - await expect(() => perp.deposit(depositTrancheA.address, toFixedPtAmt("500"))).to.changeTokenBalance( + await expect(() => perp.deposit(depositTrancheA.target, toFixedPtAmt("500"))).to.changeTokenBalance( perp, deployer, toFixedPtAmt("495"), ); }); it("should transfer the tranches in", async function () { - await expect(() => perp.deposit(depositTrancheA.address, toFixedPtAmt("500"))).to.changeTokenBalances( + await expect(() => perp.deposit(depositTrancheA.target, toFixedPtAmt("500"))).to.changeTokenBalances( depositTrancheA, [deployer, perp], [toFixedPtAmt("-500"), toFixedPtAmt("500")], ); }); it("should return the mintAmt", async function () { - const r = await perp.callStatic.computeMintAmt(depositTrancheA.address, toFixedPtAmt("500")); + const r = await perp.computeMintAmt.staticCall(depositTrancheA.target, toFixedPtAmt("500")); expect(r).to.eq(toFixedPtAmt("495")); }); + + it("should update the total supply", async function () { + await perp.deposit(depositTrancheA.target, toFixedPtAmt("500")); + expect(await perp.totalSupply()).to.eq(toFixedPtAmt("500")); + }); + + it("should mint fees to perp", async function () { + await expect(() => perp.deposit(depositTrancheA.target, toFixedPtAmt("500"))).to.changeTokenBalances( + perp, + [perp], + [toFixedPtAmt("5")], + ); + }); }); describe("when fee is set and caller is the vault", function () { @@ -500,24 +533,24 @@ describe("PerpetualTranche", function () { beforeEach(async function () { const MockVault = await ethers.getContractFactory("MockVault"); mockVault = await MockVault.deploy(); - await perp.updateVault(mockVault.address); - await depositTrancheA.approve(mockVault.address, toFixedPtAmt("500")); - await feePolicy.computePerpMintFeePerc.returns(toPercFixedPtAmt("1")); + await perp.updateVault(mockVault.target); + await depositTrancheA.approve(mockVault.target, toFixedPtAmt("500")); + await feePolicy.mockMethod("computeFeePerc(uint256,uint256)", [toPercFixedPtAmt("11")]); }); it("should mint perp tokens", async function () { await expect(() => - mockVault.mintPerps(perp.address, depositTrancheA.address, toFixedPtAmt("500")), + mockVault.mintPerps(perp.target, depositTrancheA.target, toFixedPtAmt("500")), ).to.changeTokenBalance(perp, deployer, toFixedPtAmt("500")); }); it("should transfer the tranches in", async function () { await expect(() => - mockVault.mintPerps(perp.address, depositTrancheA.address, toFixedPtAmt("500")), + mockVault.mintPerps(perp.target, depositTrancheA.target, toFixedPtAmt("500")), ).to.changeTokenBalances(depositTrancheA, [deployer, perp], [toFixedPtAmt("-500"), toFixedPtAmt("500")]); }); it("should return the mintAmt", async function () { - const r = await mockVault.callStatic.computePerpMintAmt( - perp.address, - depositTrancheA.address, + const r = await mockVault.computePerpMintAmt.staticCall( + perp.target, + depositTrancheA.target, toFixedPtAmt("500"), ); expect(r).to.eq(toFixedPtAmt("500")); diff --git a/spot-contracts/test/perp/PerpetualTranche_redeem.ts b/spot-contracts/test/perp/PerpetualTranche_redeem.ts index 61291431..bb7112b0 100644 --- a/spot-contracts/test/perp/PerpetualTranche_redeem.ts +++ b/spot-contracts/test/perp/PerpetualTranche_redeem.ts @@ -1,7 +1,6 @@ -import { expect, use } from "chai"; +import { expect } from "chai"; import { network, ethers, upgrades } from "hardhat"; import { Contract, Transaction, Signer } from "ethers"; -import { smock } from "@defi-wonderland/smock"; import { setupCollateralToken, setupBondFactory, @@ -11,11 +10,11 @@ import { toPercFixedPtAmt, toFixedPtAmt, advancePerpQueue, - checkReserveComposition, + checkPerpComposition, rebase, mintCollteralToken, + DMock, } from "../helpers"; -use(smock.matchers); let perp: Contract, bondFactory: Contract, @@ -44,38 +43,46 @@ describe("PerpetualTranche", function () { const BondIssuer = await ethers.getContractFactory("BondIssuer"); issuer = await upgrades.deployProxy( BondIssuer.connect(deployer), - [bondFactory.address, collateralToken.address, 3600, [500, 500], 1200, 0], + [bondFactory.target, collateralToken.target, 3600, [500, 500], 1200, 0], { initializer: "init(address,address,uint256,uint256[],uint256,uint256)", }, ); - const FeePolicy = await ethers.getContractFactory("FeePolicy"); - feePolicy = await smock.fake(FeePolicy); - await feePolicy.decimals.returns(8); + feePolicy = new DMock(await ethers.getContractFactory("FeePolicy")); + await feePolicy.deploy(); + await feePolicy.mockMethod("decimals()", [8]); + await feePolicy.mockMethod("computeDeviationRatio((uint256,uint256))", [toPercFixedPtAmt("1")]); + await feePolicy.mockMethod("computeFeePerc(uint256,uint256)", [0]); const PerpetualTranche = await ethers.getContractFactory("PerpetualTranche"); perp = await upgrades.deployProxy( PerpetualTranche.connect(deployer), - ["PerpetualTranche", "PERP", collateralToken.address, issuer.address, feePolicy.address], + ["PerpetualTranche", "PERP", collateralToken.target, issuer.target, feePolicy.target], { initializer: "init(string,string,address,address,address)", }, ); await advancePerpQueue(perp, 3600); - const RolloverVault = await ethers.getContractFactory("RolloverVault"); - const vault = await smock.fake(RolloverVault); - await vault.getTVL.returns("0"); - await perp.updateVault(vault.address); + const TrancheManager = await ethers.getContractFactory("TrancheManager"); + const trancheManager = await TrancheManager.deploy(); + const RolloverVault = await ethers.getContractFactory("RolloverVault", { + libraries: { + TrancheManager: trancheManager.target, + }, + }); + const vault = new DMock(RolloverVault); + await vault.deploy(); + await vault.mockMethod("getTVL()", [0]); + await perp.updateVault(vault.target); - depositBond = await bondAt(await perp.callStatic.getDepositBond()); + depositBond = await bondAt(await perp.getDepositBond.staticCall()); [initialDepositTranche] = await getTranches(depositBond); await depositIntoBond(depositBond, toFixedPtAmt("1000"), deployer); - await initialDepositTranche.approve(perp.address, toFixedPtAmt("500")); - await perp.deposit(initialDepositTranche.address, toFixedPtAmt("500")); - await feePolicy.computePerpBurnFeePerc.returns("0"); + await initialDepositTranche.approve(perp.target, toFixedPtAmt("500")); + await perp.deposit(initialDepositTranche.target, toFixedPtAmt("500")); await mintCollteralToken(collateralToken, toFixedPtAmt("1000"), deployer); }); @@ -85,23 +92,23 @@ describe("PerpetualTranche", function () { describe("#burn", function () { it("should burn tokens without redemption", async function () { - await checkReserveComposition(perp, [collateralToken, initialDepositTranche], ["0", toFixedPtAmt("500")]); + await checkPerpComposition(perp, [collateralToken, initialDepositTranche], ["0", toFixedPtAmt("500")]); expect(await perp.balanceOf(deployerAddress)).to.eq(toFixedPtAmt("500")); await perp.burn(toFixedPtAmt("500")); expect(await perp.balanceOf(deployerAddress)).to.eq("0"); - await checkReserveComposition(perp, [collateralToken, initialDepositTranche], ["0", toFixedPtAmt("500")]); + await checkPerpComposition(perp, [collateralToken, initialDepositTranche], ["0", toFixedPtAmt("500")]); }); }); describe("#burnFrom", function () { it("should burn tokens without redemption from authorized wallet", async function () { - await checkReserveComposition(perp, [collateralToken, initialDepositTranche], ["0", toFixedPtAmt("500")]); + await checkPerpComposition(perp, [collateralToken, initialDepositTranche], ["0", toFixedPtAmt("500")]); expect(await perp.balanceOf(deployerAddress)).to.eq(toFixedPtAmt("500")); await perp.approve(await otherUser.getAddress(), toFixedPtAmt("500")); await perp.connect(otherUser).burnFrom(deployerAddress, toFixedPtAmt("200")); expect(await perp.balanceOf(deployerAddress)).to.eq(toFixedPtAmt("300")); expect(await perp.allowance(deployerAddress, await otherUser.getAddress())).to.eq(toFixedPtAmt("300")); - await checkReserveComposition(perp, [collateralToken, initialDepositTranche], ["0", toFixedPtAmt("500")]); + await checkPerpComposition(perp, [collateralToken, initialDepositTranche], ["0", toFixedPtAmt("500")]); }); }); @@ -130,7 +137,7 @@ describe("PerpetualTranche", function () { describe("when requested amount is zero", function () { it("should return without redeeming", async function () { - expect(await perp.callStatic.redeem("0")).to.deep.eq([]); + expect(await perp.redeem.staticCall("0")).to.deep.eq([]); }); }); @@ -144,7 +151,7 @@ describe("PerpetualTranche", function () { }); it("should revert", async function () { - await expect(perp.callStatic.computeRedemptionAmts(toFixedPtAmt("100"))).to.be.reverted; + await expect(perp.computeRedemptionAmts.staticCall(toFixedPtAmt("100"))).to.be.reverted; }); }); @@ -166,21 +173,21 @@ describe("PerpetualTranche", function () { it("should emit reserve synced", async function () { await expect(perp.redeem(toFixedPtAmt("500"))) .to.emit(perp, "ReserveSynced") - .withArgs(collateralToken.address, "0") + .withArgs(collateralToken.target, "0") .to.emit(perp, "ReserveSynced") - .withArgs(initialDepositTranche.address, "0"); + .withArgs(initialDepositTranche.target, "0"); }); it("should return the redemption amounts", async function () { - const r = await perp.callStatic.redeem(toFixedPtAmt("500")); - expect(r[0].token).to.eq(collateralToken.address); - expect(r[1].token).to.eq(initialDepositTranche.address); + const r = await perp.redeem.staticCall(toFixedPtAmt("500")); + expect(r[0].token).to.eq(collateralToken.target); + expect(r[1].token).to.eq(initialDepositTranche.target); expect(r[0].amount).to.eq("0"); expect(r[1].amount).to.eq(toFixedPtAmt("500")); }); it("should return the redemption amounts", async function () { - const r = await perp.callStatic.computeRedemptionAmts(toFixedPtAmt("500")); - expect(r[0].token).to.eq(collateralToken.address); - expect(r[1].token).to.eq(initialDepositTranche.address); + const r = await perp.computeRedemptionAmts.staticCall(toFixedPtAmt("500")); + expect(r[0].token).to.eq(collateralToken.target); + expect(r[1].token).to.eq(initialDepositTranche.target); expect(r[0].amount).to.eq("0"); expect(r[1].amount).to.eq(toFixedPtAmt("500")); }); @@ -193,15 +200,15 @@ describe("PerpetualTranche", function () { await advancePerpQueue(perp, 1200); - const newBond = await bondAt(await perp.callStatic.getDepositBond()); + const newBond = await bondAt(await perp.getDepositBond.staticCall()); await depositIntoBond(newBond, toFixedPtAmt("1000"), deployer); const tranches = await getTranches(newBond); newRedemptionTranche = tranches[0]; - await newRedemptionTranche.approve(perp.address, toFixedPtAmt("500")); - await perp.deposit(newRedemptionTranche.address, toFixedPtAmt("500")); + await newRedemptionTranche.approve(perp.target, toFixedPtAmt("500")); + await perp.deposit(newRedemptionTranche.target, toFixedPtAmt("500")); - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, initialDepositTranche, newRedemptionTranche], ["0", toFixedPtAmt("500"), toFixedPtAmt("500")], @@ -213,7 +220,7 @@ describe("PerpetualTranche", function () { it("should update the reserve composition", async function () { await txFn(); - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, initialDepositTranche, newRedemptionTranche], ["0", toFixedPtAmt("312.5"), toFixedPtAmt("312.5")], @@ -256,16 +263,16 @@ describe("PerpetualTranche", function () { await perp.updateTolerableTrancheMaturity(1200, 3600); await advancePerpQueue(perp, 1200); - const newBond = await bondAt(await perp.callStatic.getDepositBond()); + const newBond = await bondAt(await perp.getDepositBond.staticCall()); await depositIntoBond(newBond, toFixedPtAmt("1000"), deployer); const tranches = await getTranches(newBond); newRedemptionTranche = tranches[0]; - await newRedemptionTranche.approve(perp.address, toFixedPtAmt("500")); - await perp.deposit(newRedemptionTranche.address, toFixedPtAmt("500")); + await newRedemptionTranche.approve(perp.target, toFixedPtAmt("500")); + await perp.deposit(newRedemptionTranche.target, toFixedPtAmt("500")); - await collateralToken.transfer(perp.address, toFixedPtAmt("100")); - await checkReserveComposition( + await collateralToken.transfer(perp.target, toFixedPtAmt("100")); + await checkPerpComposition( perp, [collateralToken, initialDepositTranche, newRedemptionTranche], [toFixedPtAmt("100"), toFixedPtAmt("500"), toFixedPtAmt("500")], @@ -277,7 +284,7 @@ describe("PerpetualTranche", function () { it("should update the reserve composition", async function () { await txFn(); - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, initialDepositTranche, newRedemptionTranche], [toFixedPtAmt("50"), toFixedPtAmt("250"), toFixedPtAmt("250")], @@ -324,15 +331,15 @@ describe("PerpetualTranche", function () { await advancePerpQueue(perp, 1200); - const newBond = await bondAt(await perp.callStatic.getDepositBond()); + const newBond = await bondAt(await perp.getDepositBond.staticCall()); await depositIntoBond(newBond, toFixedPtAmt("1000"), deployer); const tranches = await getTranches(newBond); newRedemptionTranche = tranches[0]; - await newRedemptionTranche.approve(perp.address, toFixedPtAmt("500")); - await perp.deposit(newRedemptionTranche.address, toFixedPtAmt("500")); + await newRedemptionTranche.approve(perp.target, toFixedPtAmt("500")); + await perp.deposit(newRedemptionTranche.target, toFixedPtAmt("500")); - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, initialDepositTranche, newRedemptionTranche], ["0", toFixedPtAmt("500"), toFixedPtAmt("500")], @@ -340,7 +347,7 @@ describe("PerpetualTranche", function () { await advancePerpQueue(perp, 2400); await rebase(collateralToken, rebaseOracle, +0.5); - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, newRedemptionTranche], [toFixedPtAmt("750"), toFixedPtAmt("500")], @@ -352,7 +359,7 @@ describe("PerpetualTranche", function () { it("should update the reserve composition", async function () { await txFn(); - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, newRedemptionTranche], [toFixedPtAmt("468.75"), toFixedPtAmt("312.5")], @@ -388,15 +395,15 @@ describe("PerpetualTranche", function () { await advancePerpQueue(perp, 1200); - const newBond = await bondAt(await perp.callStatic.getDepositBond()); + const newBond = await bondAt(await perp.getDepositBond.staticCall()); await depositIntoBond(newBond, toFixedPtAmt("1000"), deployer); const tranches = await getTranches(newBond); newRedemptionTranche = tranches[0]; - await newRedemptionTranche.approve(perp.address, toFixedPtAmt("500")); - await perp.deposit(newRedemptionTranche.address, toFixedPtAmt("500")); + await newRedemptionTranche.approve(perp.target, toFixedPtAmt("500")); + await perp.deposit(newRedemptionTranche.target, toFixedPtAmt("500")); - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, initialDepositTranche, newRedemptionTranche], ["0", toFixedPtAmt("500"), toFixedPtAmt("500")], @@ -404,7 +411,7 @@ describe("PerpetualTranche", function () { await advancePerpQueue(perp, 2400); await rebase(collateralToken, rebaseOracle, -0.5); - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, newRedemptionTranche], [toFixedPtAmt("250"), toFixedPtAmt("500")], @@ -416,7 +423,7 @@ describe("PerpetualTranche", function () { it("should update the reserve composition", async function () { await txFn(); - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, newRedemptionTranche], [toFixedPtAmt("156.25"), toFixedPtAmt("312.5")], @@ -448,22 +455,22 @@ describe("PerpetualTranche", function () { await advancePerpQueue(perp, 1200); - const newBond = await bondAt(await perp.callStatic.getDepositBond()); + const newBond = await bondAt(await perp.getDepositBond.staticCall()); await depositIntoBond(newBond, toFixedPtAmt("1000"), deployer); const tranches = await getTranches(newBond); newRedemptionTranche = tranches[0]; - await newRedemptionTranche.approve(perp.address, toFixedPtAmt("500")); - await perp.deposit(newRedemptionTranche.address, toFixedPtAmt("500")); + await newRedemptionTranche.approve(perp.target, toFixedPtAmt("500")); + await perp.deposit(newRedemptionTranche.target, toFixedPtAmt("500")); - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, initialDepositTranche, newRedemptionTranche], ["0", toFixedPtAmt("500"), toFixedPtAmt("500")], ); await advancePerpQueue(perp, 7200); - await checkReserveComposition(perp, [collateralToken], [toFixedPtAmt("1000")]); + await checkPerpComposition(perp, [collateralToken], [toFixedPtAmt("1000")]); expect(await perp.totalSupply()).to.eq(toFixedPtAmt("1000")); txFn = () => perp.redeem(toFixedPtAmt("375")); @@ -471,7 +478,7 @@ describe("PerpetualTranche", function () { it("should update the reserve composition", async function () { await txFn(); - await checkReserveComposition(perp, [collateralToken], [toFixedPtAmt("625")]); + await checkPerpComposition(perp, [collateralToken], [toFixedPtAmt("625")]); }); it("should transfer tokens out", async function () { @@ -499,15 +506,15 @@ describe("PerpetualTranche", function () { await advancePerpQueue(perp, 1200); - const newBond = await bondAt(await perp.callStatic.getDepositBond()); + const newBond = await bondAt(await perp.getDepositBond.staticCall()); await depositIntoBond(newBond, toFixedPtAmt("1000"), deployer); const tranches = await getTranches(newBond); newRedemptionTranche = tranches[0]; - await newRedemptionTranche.approve(perp.address, toFixedPtAmt("500")); - await perp.deposit(newRedemptionTranche.address, toFixedPtAmt("500")); + await newRedemptionTranche.approve(perp.target, toFixedPtAmt("500")); + await perp.deposit(newRedemptionTranche.target, toFixedPtAmt("500")); - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, initialDepositTranche, newRedemptionTranche], ["0", toFixedPtAmt("500"), toFixedPtAmt("500")], @@ -520,7 +527,7 @@ describe("PerpetualTranche", function () { it("should update the reserve composition", async function () { await txFn(); - await checkReserveComposition(perp, [collateralToken], ["0"]); + await checkPerpComposition(perp, [collateralToken], ["0"]); }); it("should transfer tokens out", async function () { @@ -559,29 +566,40 @@ describe("PerpetualTranche", function () { await perp.updateTolerableTrancheMaturity(1200, 3600); await advancePerpQueue(perp, 1200); - const newBond = await bondAt(await perp.callStatic.getDepositBond()); + const newBond = await bondAt(await perp.getDepositBond.staticCall()); await depositIntoBond(newBond, toFixedPtAmt("1000"), deployer); const tranches = await getTranches(newBond); newRedemptionTranche = tranches[0]; - await newRedemptionTranche.approve(perp.address, toFixedPtAmt("500")); - await perp.deposit(newRedemptionTranche.address, toFixedPtAmt("500")); + await newRedemptionTranche.approve(perp.target, toFixedPtAmt("500")); + await perp.deposit(newRedemptionTranche.target, toFixedPtAmt("500")); - await collateralToken.transfer(perp.address, toFixedPtAmt("100")); - await checkReserveComposition( + await collateralToken.transfer(perp.target, toFixedPtAmt("100")); + await checkPerpComposition( perp, [collateralToken, initialDepositTranche, newRedemptionTranche], [toFixedPtAmt("100"), toFixedPtAmt("500"), toFixedPtAmt("500")], ); expect(await perp.totalSupply()).to.eq(toFixedPtAmt("1000")); - await feePolicy.computePerpBurnFeePerc.returns(toPercFixedPtAmt("0.1")); + await feePolicy.clearMockMethod("computeDeviationRatio((uint256,uint256))"); + await feePolicy.mockCall( + "computeDeviationRatio((uint256,uint256))", + [[toFixedPtAmt("1100"), toFixedPtAmt("0")]], + [toPercFixedPtAmt("1")], + ); + await feePolicy.mockCall( + "computeDeviationRatio((uint256,uint256))", + [[toFixedPtAmt("550"), toFixedPtAmt("0")]], + [toPercFixedPtAmt("1")], + ); + await feePolicy.mockMethod("computeFeePerc(uint256,uint256)", [toPercFixedPtAmt("0.1")]); txFn = () => perp.redeem(toFixedPtAmt("500")); }); it("should update the reserve composition", async function () { await txFn(); - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, initialDepositTranche, newRedemptionTranche], [toFixedPtAmt("55"), toFixedPtAmt("275"), toFixedPtAmt("275")], @@ -614,12 +632,16 @@ describe("PerpetualTranche", function () { it("should update the total supply", async function () { await txFn(); - expect(await perp.totalSupply()).to.eq(toFixedPtAmt("500")); + expect(await perp.totalSupply()).to.eq(toFixedPtAmt("550")); }); it("should burn perp tokens", async function () { await expect(txFn).to.changeTokenBalances(perp, [deployer], [toFixedPtAmt("-500")]); }); + + it("should mint fees to perp", async function () { + await expect(txFn).to.changeTokenBalances(perp, [perp], [toFixedPtAmt("50")]); + }); }); describe("when fee is set and caller is vault", function () { @@ -628,33 +650,33 @@ describe("PerpetualTranche", function () { await perp.updateTolerableTrancheMaturity(1200, 3600); await advancePerpQueue(perp, 1200); - const newBond = await bondAt(await perp.callStatic.getDepositBond()); + const newBond = await bondAt(await perp.getDepositBond.staticCall()); await depositIntoBond(newBond, toFixedPtAmt("1000"), deployer); const tranches = await getTranches(newBond); newRedemptionTranche = tranches[0]; - await newRedemptionTranche.approve(perp.address, toFixedPtAmt("500")); - await perp.deposit(newRedemptionTranche.address, toFixedPtAmt("500")); + await newRedemptionTranche.approve(perp.target, toFixedPtAmt("500")); + await perp.deposit(newRedemptionTranche.target, toFixedPtAmt("500")); - await collateralToken.transfer(perp.address, toFixedPtAmt("100")); - await checkReserveComposition( + await collateralToken.transfer(perp.target, toFixedPtAmt("100")); + await checkPerpComposition( perp, [collateralToken, initialDepositTranche, newRedemptionTranche], [toFixedPtAmt("100"), toFixedPtAmt("500"), toFixedPtAmt("500")], ); expect(await perp.totalSupply()).to.eq(toFixedPtAmt("1000")); - await feePolicy.computePerpBurnFeePerc.returns(toPercFixedPtAmt("1")); + await feePolicy.mockMethod("computeFeePerc(uint256,uint256)", [toPercFixedPtAmt("1")]); const MockVault = await ethers.getContractFactory("MockVault"); mockVault = await MockVault.deploy(); - await perp.updateVault(mockVault.address); - await perp.approve(mockVault.address, toFixedPtAmt("500")); - txFn = () => mockVault.redeemPerps(perp.address, toFixedPtAmt("500")); + await perp.updateVault(mockVault.target); + await perp.approve(mockVault.target, toFixedPtAmt("500")); + txFn = () => mockVault.redeemPerps(perp.target, toFixedPtAmt("500")); }); it("should update the reserve composition", async function () { await txFn(); - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, initialDepositTranche, newRedemptionTranche], [toFixedPtAmt("50"), toFixedPtAmt("250"), toFixedPtAmt("250")], @@ -695,10 +717,10 @@ describe("PerpetualTranche", function () { }); it("should return the redemption amounts", async function () { - const r = await mockVault.callStatic.computePerpRedemptionAmts(perp.address, toFixedPtAmt("500")); - expect(r[0].token).to.eq(collateralToken.address); - expect(r[1].token).to.eq(initialDepositTranche.address); - expect(r[2].token).to.eq(newRedemptionTranche.address); + const r = await mockVault.computePerpRedemptionAmts.staticCall(perp.target, toFixedPtAmt("500")); + expect(r[0].token).to.eq(collateralToken.target); + expect(r[1].token).to.eq(initialDepositTranche.target); + expect(r[2].token).to.eq(newRedemptionTranche.target); expect(r[0].amount).to.eq(toFixedPtAmt("50")); expect(r[1].amount).to.eq(toFixedPtAmt("250")); expect(r[2].amount).to.eq(toFixedPtAmt("250")); diff --git a/spot-contracts/test/perp/PerpetualTranche_rollover.ts b/spot-contracts/test/perp/PerpetualTranche_rollover.ts index c6a2787d..6576c9ea 100644 --- a/spot-contracts/test/perp/PerpetualTranche_rollover.ts +++ b/spot-contracts/test/perp/PerpetualTranche_rollover.ts @@ -1,7 +1,6 @@ -import { expect, use } from "chai"; +import { expect } from "chai"; import { network, ethers, upgrades } from "hardhat"; import { Contract, Transaction, Signer } from "ethers"; -import { smock } from "@defi-wonderland/smock"; import { setupCollateralToken, setupBondFactory, @@ -14,11 +13,11 @@ import { advancePerpQueue, advancePerpQueueToBondMaturity, advancePerpQueueToRollover, - checkReserveComposition, + checkPerpComposition, rebase, mintCollteralToken, + DMock, } from "../helpers"; -use(smock.matchers); let perp: Contract, bondFactory: Contract, @@ -50,15 +49,17 @@ describe("PerpetualTranche", function () { const BondIssuer = await ethers.getContractFactory("BondIssuer"); issuer = await upgrades.deployProxy( BondIssuer.connect(deployer), - [bondFactory.address, collateralToken.address, 10800, [500, 500], 1200, 0], + [bondFactory.target, collateralToken.target, 10800, [500, 500], 1200, 0], { initializer: "init(address,address,uint256,uint256[],uint256,uint256)", }, ); - const FeePolicy = await ethers.getContractFactory("FeePolicy"); - feePolicy = await smock.fake(FeePolicy); - await feePolicy.decimals.returns(8); + feePolicy = new DMock(await ethers.getContractFactory("FeePolicy")); + await feePolicy.deploy(); + await feePolicy.mockMethod("decimals()", [8]); + await feePolicy.mockMethod("computeDeviationRatio((uint256,uint256))", [toPercFixedPtAmt("1")]); + await feePolicy.mockMethod("computeFeePerc(uint256,uint256)", [0]); const MockVault = await ethers.getContractFactory("MockVault"); mockVault = await MockVault.deploy(); @@ -66,7 +67,7 @@ describe("PerpetualTranche", function () { const PerpetualTranche = await ethers.getContractFactory("PerpetualTranche"); perp = await upgrades.deployProxy( PerpetualTranche.connect(deployer), - ["PerpetualTranche", "PERP", collateralToken.address, issuer.address, feePolicy.address], + ["PerpetualTranche", "PERP", collateralToken.target, issuer.target, feePolicy.target], { initializer: "init(string,string,address,address,address)", }, @@ -74,42 +75,42 @@ describe("PerpetualTranche", function () { await perp.updateTolerableTrancheMaturity(1200, 10800); await advancePerpQueue(perp, 10900); - await perp.updateVault(mockVault.address); + await perp.updateVault(mockVault.target); - holdingPenBond = await bondAt(await perp.callStatic.getDepositBond()); + holdingPenBond = await bondAt(await perp.getDepositBond.staticCall()); [holdingPenTranche1] = await getTranches(holdingPenBond); await depositIntoBond(holdingPenBond, toFixedPtAmt("2000"), deployer); - await holdingPenTranche1.approve(perp.address, toFixedPtAmt("500")); - await perp.deposit(holdingPenTranche1.address, toFixedPtAmt("500")); + await holdingPenTranche1.approve(perp.target, toFixedPtAmt("500")); + await perp.deposit(holdingPenTranche1.target, toFixedPtAmt("500")); await advancePerpQueue(perp, 1200); - reserveBond = await bondAt(await perp.callStatic.getDepositBond()); + reserveBond = await bondAt(await perp.getDepositBond.staticCall()); [reserveTranche] = await getTranches(reserveBond); await depositIntoBond(reserveBond, toFixedPtAmt("2000"), deployer); - await reserveTranche.approve(perp.address, toFixedPtAmt("500")); - await perp.deposit(reserveTranche.address, toFixedPtAmt("500")); + await reserveTranche.approve(perp.target, toFixedPtAmt("500")); + await perp.deposit(reserveTranche.target, toFixedPtAmt("500")); await advancePerpQueueToBondMaturity(perp, holdingPenBond); - rolloverInBond = await bondAt(await perp.callStatic.getDepositBond()); + rolloverInBond = await bondAt(await perp.getDepositBond.staticCall()); [rolloverInTranche] = await getTranches(rolloverInBond); await depositIntoBond(rolloverInBond, toFixedPtAmt("5000"), deployer); - await rolloverInTranche.approve(perp.address, toFixedPtAmt("5000")); - await perp.deposit(rolloverInTranche.address, toFixedPtAmt("500")); + await rolloverInTranche.approve(perp.target, toFixedPtAmt("5000")); + await perp.deposit(rolloverInTranche.target, toFixedPtAmt("500")); - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, reserveTranche, rolloverInTranche], [toFixedPtAmt("500"), toFixedPtAmt("500"), toFixedPtAmt("500")], ); - await rolloverInTranche.approve(mockVault.address, toFixedPtAmt("5000")); - await reserveTranche.approve(mockVault.address, toFixedPtAmt("5000")); + await rolloverInTranche.approve(mockVault.target, toFixedPtAmt("5000")); + await reserveTranche.approve(mockVault.target, toFixedPtAmt("5000")); }); afterEach(async function () { @@ -125,26 +126,26 @@ describe("PerpetualTranche", function () { it("should revert", async function () { await expect( - mockVault.rollover(perp.address, rolloverInTranche.address, reserveTranche.address, toFixedPtAmt("500")), + mockVault.rollover(perp.target, rolloverInTranche.target, reserveTranche.target, toFixedPtAmt("500")), ).to.revertedWith("Pausable: paused"); }); }); describe("when rollover vault reference is set", function () { beforeEach(async function () { - await perp.updateVault(mockVault.address); + await perp.updateVault(mockVault.target); }); it("should revert when invoked from other addresses", async function () { await expect( - perp.rollover(rolloverInTranche.address, reserveTranche.address, toFixedPtAmt("500")), + perp.rollover(rolloverInTranche.target, reserveTranche.target, toFixedPtAmt("500")), ).to.revertedWithCustomError(perp, "UnauthorizedCall"); }); it("should NOT revert when invoked from the vault ", async function () { - await rolloverInTranche.approve(mockVault.address, toFixedPtAmt("500")); + await rolloverInTranche.approve(mockVault.target, toFixedPtAmt("500")); await expect( - mockVault.rollover(perp.address, rolloverInTranche.address, reserveTranche.address, toFixedPtAmt("500")), + mockVault.rollover(perp.target, rolloverInTranche.target, reserveTranche.target, toFixedPtAmt("500")), ).not.to.be.reverted; }); }); @@ -156,7 +157,7 @@ describe("PerpetualTranche", function () { }); it("should revert", async function () { await expect( - mockVault.rollover(perp.address, rolloverInTranche.address, tranches[1].address, toFixedPtAmt("500")), + mockVault.rollover(perp.target, rolloverInTranche.target, tranches[1].target, toFixedPtAmt("500")), ).to.revertedWithCustomError(perp, "UnacceptableRollover"); }); }); @@ -164,16 +165,16 @@ describe("PerpetualTranche", function () { describe("when trancheIn is NOT of deposit bond", function () { it("should revert", async function () { await expect( - mockVault.rollover(perp.address, reserveTranche.address, collateralToken.address, toFixedPtAmt("500")), + mockVault.rollover(perp.target, reserveTranche.target, collateralToken.target, toFixedPtAmt("500")), ).to.revertedWithCustomError(perp, "UnacceptableRollover"); await expect( - mockVault.rollover(perp.address, reserveTranche.address, reserveTranche.address, toFixedPtAmt("500")), + mockVault.rollover(perp.target, reserveTranche.target, reserveTranche.target, toFixedPtAmt("500")), ).to.revertedWithCustomError(perp, "UnacceptableRollover"); await expect( - mockVault.rollover(perp.address, reserveTranche.address, reserveTranche.address, toFixedPtAmt("500")), + mockVault.rollover(perp.target, reserveTranche.target, reserveTranche.target, toFixedPtAmt("500")), ).to.revertedWithCustomError(perp, "UnacceptableRollover"); await expect( - mockVault.rollover(perp.address, reserveTranche.address, holdingPenTranche1.address, toFixedPtAmt("500")), + mockVault.rollover(perp.target, reserveTranche.target, holdingPenTranche1.target, toFixedPtAmt("500")), ).to.revertedWithCustomError(perp, "UnacceptableRollover"); }); }); @@ -186,7 +187,7 @@ describe("PerpetualTranche", function () { }); it("should revert", async function () { await expect( - mockVault.rollover(perp.address, rolloverInTranche.address, maliciousTranche.address, toFixedPtAmt("500")), + mockVault.rollover(perp.target, rolloverInTranche.target, maliciousTranche.target, toFixedPtAmt("500")), ).to.revertedWithCustomError(perp, "UnacceptableRollover"); }); }); @@ -195,19 +196,14 @@ describe("PerpetualTranche", function () { let newRotationInTranche: Contract; beforeEach(async function () { await advancePerpQueue(perp, 1200); - const newRotationInBond = await bondAt(await perp.callStatic.getDepositBond()); + const newRotationInBond = await bondAt(await perp.getDepositBond.staticCall()); [newRotationInTranche] = await getTranches(newRotationInBond); await depositIntoBond(newRotationInBond, toFixedPtAmt("2000"), deployer); - await newRotationInTranche.approve(mockVault.address, toFixedPtAmt("500")); + await newRotationInTranche.approve(mockVault.target, toFixedPtAmt("500")); }); it("should revert", async function () { await expect( - mockVault.rollover( - perp.address, - newRotationInTranche.address, - rolloverInTranche.address, - toFixedPtAmt("500"), - ), + mockVault.rollover(perp.target, newRotationInTranche.target, rolloverInTranche.target, toFixedPtAmt("500")), ).to.revertedWithCustomError(perp, "UnacceptableRollover"); }); }); @@ -219,12 +215,12 @@ describe("PerpetualTranche", function () { maliciousTranche = await ERC20.deploy(); await maliciousTranche.init("Tranche", "TRA"); await maliciousTranche.mint(deployerAddress, toFixedPtAmt("500")); - await maliciousTranche.setBond(await perp.callStatic.getDepositBond()); - await maliciousTranche.approve(mockVault.address, toFixedPtAmt("500")); + await maliciousTranche.setBond(await perp.getDepositBond.staticCall()); + await maliciousTranche.approve(mockVault.target, toFixedPtAmt("500")); }); it("should revert", async function () { await expect( - mockVault.rollover(perp.address, maliciousTranche.address, reserveTranche.address, toFixedPtAmt("500")), + mockVault.rollover(perp.target, maliciousTranche.target, reserveTranche.target, toFixedPtAmt("500")), ).to.revertedWithCustomError(perp, "UnacceptableRollover"); }); }); @@ -237,26 +233,26 @@ describe("PerpetualTranche", function () { it("should revert", async function () { expect(await rolloverInTranche.balanceOf(deployerAddress)).to.lt(toFixedPtAmt("500")); await expect( - mockVault.rollover(perp.address, rolloverInTranche.address, reserveTranche.address, toFixedPtAmt("500")), + mockVault.rollover(perp.target, rolloverInTranche.target, reserveTranche.target, toFixedPtAmt("500")), ).to.revertedWith("ERC20: transfer amount exceeds balance"); }); }); describe("when approval is insufficient", function () { it("should return without rollover", async function () { - await rolloverInTranche.transfer(mockVault.address, toFixedPtAmt("500")); + await rolloverInTranche.transfer(mockVault.target, toFixedPtAmt("500")); await expect( - mockVault.callRollover(perp.address, rolloverInTranche.address, reserveTranche.address, toFixedPtAmt("500")), + mockVault.callRollover(perp.target, rolloverInTranche.target, reserveTranche.target, toFixedPtAmt("500")), ).to.revertedWith("ERC20: transfer amount exceeds allowance"); }); }); describe("when trancheInAmt is zero", function () { it("should return without rollover", async function () { - const r = await mockVault.callStatic.rollover( - perp.address, - rolloverInTranche.address, - reserveTranche.address, + const r = await mockVault.rollover.staticCall( + perp.target, + rolloverInTranche.target, + reserveTranche.target, "0", ); expect(r.tokenOutAmt).to.eq("0"); @@ -269,12 +265,12 @@ describe("PerpetualTranche", function () { beforeEach(async function () { const tranches = await getTranches(rolloverInBond); newRotationInTranche = tranches[1]; - await newRotationInTranche.approve(mockVault.address, toFixedPtAmt("500")); + await newRotationInTranche.approve(mockVault.target, toFixedPtAmt("500")); }); it("should revert", async function () { await expect( - mockVault.rollover(perp.address, newRotationInTranche.address, reserveTranche.address, toFixedPtAmt("500")), + mockVault.rollover(perp.target, newRotationInTranche.target, reserveTranche.target, toFixedPtAmt("500")), ).to.revertedWithCustomError(perp, "UnacceptableRollover"); }); }); @@ -283,13 +279,13 @@ describe("PerpetualTranche", function () { beforeEach(async function () { await rebase(collateralToken, rebaseOracle, -0.75); await mintCollteralToken(collateralToken, toFixedPtAmt("1000"), deployer); - await collateralToken.transfer(perp.address, toFixedPtAmt("1000")); + await collateralToken.transfer(perp.target, toFixedPtAmt("1000")); }); it("should rollover the correct amount", async function () { - const r = await perp.callStatic.computeRolloverAmt( - rolloverInTranche.address, - collateralToken.address, + const r = await perp.computeRolloverAmt.staticCall( + rolloverInTranche.target, + collateralToken.target, toFixedPtAmt("500"), ); expect(r.tokenOutAmt).to.eq(toFixedPtAmt("250")); @@ -304,14 +300,14 @@ describe("PerpetualTranche", function () { await advancePerpQueueToRollover(perp, await bondAt(await rolloverInTranche.bond())); newReserveTranche = rolloverInTranche; - const newDepositBond = await bondAt(await perp.callStatic.getDepositBond()); + const newDepositBond = await bondAt(await perp.getDepositBond.staticCall()); [newRotationInTranche] = await getTranches(newDepositBond); }); it("should rollover the correct amount", async function () { - const r = await perp.callStatic.computeRolloverAmt( - newRotationInTranche.address, - newReserveTranche.address, + const r = await perp.computeRolloverAmt.staticCall( + newRotationInTranche.target, + newReserveTranche.target, toFixedPtAmt("500"), ); expect(r.tokenOutAmt).to.eq(toFixedPtAmt("500")); @@ -325,9 +321,9 @@ describe("PerpetualTranche", function () { }); it("should rollover the correct amount", async function () { - const r = await perp.callStatic.computeRolloverAmt( - rolloverInTranche.address, - collateralToken.address, + const r = await perp.computeRolloverAmt.staticCall( + rolloverInTranche.target, + collateralToken.target, toFixedPtAmt("500"), ); expect(r.tokenOutAmt).to.eq(toFixedPtAmt("500")); @@ -341,9 +337,9 @@ describe("PerpetualTranche", function () { }); it("should rollover the correct amount", async function () { - const r = await perp.callStatic.computeRolloverAmt( - rolloverInTranche.address, - collateralToken.address, + const r = await perp.computeRolloverAmt.staticCall( + rolloverInTranche.target, + collateralToken.target, toFixedPtAmt("500"), ); expect(r.tokenOutAmt).to.eq(toFixedPtAmt("250")); @@ -356,13 +352,13 @@ describe("PerpetualTranche", function () { await rebase(collateralToken, rebaseOracle, -0.75); // simulating collateral rebase up, by just transferring some tokens in await mintCollteralToken(collateralToken, toFixedPtAmt("1000"), deployer); - await collateralToken.transfer(perp.address, toFixedPtAmt("1000")); + await collateralToken.transfer(perp.target, toFixedPtAmt("1000")); }); it("should rollover the correct amount", async function () { - const r = await perp.callStatic.computeRolloverAmt( - rolloverInTranche.address, - collateralToken.address, + const r = await perp.computeRolloverAmt.staticCall( + rolloverInTranche.target, + collateralToken.target, toFixedPtAmt("500"), ); expect(r.tokenOutAmt).to.eq(toFixedPtAmt("250")); @@ -373,14 +369,14 @@ describe("PerpetualTranche", function () { describe("when trancheIn price is 0.5 and tokenOut is collateral which rebased down", function () { beforeEach(async function () { await mintCollteralToken(collateralToken, toFixedPtAmt("1000"), deployer); - await collateralToken.transfer(perp.address, toFixedPtAmt("1000")); + await collateralToken.transfer(perp.target, toFixedPtAmt("1000")); await rebase(collateralToken, rebaseOracle, -0.75); }); it("should rollover the correct amount", async function () { - const r = await perp.callStatic.computeRolloverAmt( - rolloverInTranche.address, - collateralToken.address, + const r = await perp.computeRolloverAmt.staticCall( + rolloverInTranche.target, + collateralToken.target, toFixedPtAmt("500"), ); expect(r.tokenOutAmt).to.eq(toFixedPtAmt("250")); @@ -393,9 +389,9 @@ describe("PerpetualTranche", function () { await rebase(collateralToken, rebaseOracle, -0.25); }); it("should rollover the correct amount", async function () { - const r = await perp.callStatic.computeRolloverAmt( - rolloverInTranche.address, - collateralToken.address, + const r = await perp.computeRolloverAmt.staticCall( + rolloverInTranche.target, + collateralToken.target, toFixedPtAmt("500"), ); expect(r.tokenOutAmt).to.eq(toFixedPtAmt("375")); @@ -408,9 +404,9 @@ describe("PerpetualTranche", function () { await rebase(collateralToken, rebaseOracle, 0.25); }); it("should rollover the correct amount", async function () { - const r = await perp.callStatic.computeRolloverAmt( - rolloverInTranche.address, - collateralToken.address, + const r = await perp.computeRolloverAmt.staticCall( + rolloverInTranche.target, + collateralToken.target, toFixedPtAmt("500"), ); expect(r.tokenOutAmt).to.eq(toFixedPtAmt("500")); @@ -418,29 +414,27 @@ describe("PerpetualTranche", function () { }); }); - describe("when fee is zero", function () { - beforeEach(async function () { - await feePolicy.computePerpRolloverFeePerc.returns("0"); - }); + describe("when typical rollover", function () { + beforeEach(async function () {}); it("should transfer the tranches in", async function () { await expect(() => - mockVault.rollover(perp.address, rolloverInTranche.address, reserveTranche.address, toFixedPtAmt("500")), + mockVault.rollover(perp.target, rolloverInTranche.target, reserveTranche.target, toFixedPtAmt("500")), ).to.changeTokenBalances(rolloverInTranche, [deployer, perp], [toFixedPtAmt("-500"), toFixedPtAmt("500")]); }); it("should transfer the tranches out", async function () { await expect(() => - mockVault.rollover(perp.address, rolloverInTranche.address, reserveTranche.address, toFixedPtAmt("500")), + mockVault.rollover(perp.target, rolloverInTranche.target, reserveTranche.target, toFixedPtAmt("500")), ).to.changeTokenBalances(reserveTranche, [deployer, perp], [toFixedPtAmt("500"), toFixedPtAmt("-500")]); }); it("should charge fee", async function () { await expect(() => - mockVault.rollover(perp.address, rolloverInTranche.address, reserveTranche.address, toFixedPtAmt("500")), + mockVault.rollover(perp.target, rolloverInTranche.target, reserveTranche.target, toFixedPtAmt("500")), ).to.changeTokenBalance(perp, perp, "0"); }); it("should calculate rollover amt", async function () { - const r = await perp.callStatic.computeRolloverAmt( - rolloverInTranche.address, - reserveTranche.address, + const r = await perp.computeRolloverAmt.staticCall( + rolloverInTranche.target, + reserveTranche.target, toFixedPtAmt("500"), ); expect(r.tokenOutAmt).to.eq(toFixedPtAmt("500")); @@ -448,83 +442,24 @@ describe("PerpetualTranche", function () { }); }); - describe("when fee > 0", function () { - beforeEach(async function () { - await feePolicy.computePerpRolloverFeePerc.returns(toPercFixedPtAmt("0.01")); - }); - it("should transfer the tranches in", async function () { - await expect(() => - mockVault.rollover(perp.address, rolloverInTranche.address, reserveTranche.address, toFixedPtAmt("500")), - ).to.changeTokenBalances(rolloverInTranche, [deployer, perp], [toFixedPtAmt("-500"), toFixedPtAmt("500")]); - }); - it("should transfer the tranches out", async function () { - await expect(() => - mockVault.rollover(perp.address, rolloverInTranche.address, reserveTranche.address, toFixedPtAmt("500")), - ).to.changeTokenBalances(reserveTranche, [deployer, perp], [toFixedPtAmt("495"), toFixedPtAmt("-495")]); - }); - it("should calculate rollover amt", async function () { - const r = await perp.callStatic.computeRolloverAmt( - rolloverInTranche.address, - reserveTranche.address, - toFixedPtAmt("500"), - ); - expect(r.tokenOutAmt).to.eq(toFixedPtAmt("495")); - expect(r.trancheInAmt).to.eq(toFixedPtAmt("500")); - }); - }); - - describe("when fee < 0", function () { - beforeEach(async function () { - await feePolicy.computePerpRolloverFeePerc.returns(toPercFixedPtAmt("-0.01")); - }); - it("should transfer the tranches in", async function () { - await expect(() => - mockVault.rollover(perp.address, rolloverInTranche.address, reserveTranche.address, toFixedPtAmt("500")), - ).to.changeTokenBalances( - rolloverInTranche, - [deployer, perp], - [toFixedPtAmt("-495.049504950495049505"), toFixedPtAmt("495.049504950495049505")], - ); - }); - it("should transfer the tranches out", async function () { - await expect(() => - mockVault.rollover(perp.address, rolloverInTranche.address, reserveTranche.address, toFixedPtAmt("500")), - ).to.changeTokenBalances(reserveTranche, [deployer, perp], [toFixedPtAmt("500"), toFixedPtAmt("-500")]); - }); - it("should calculate rollover amt", async function () { - const r = await perp.callStatic.computeRolloverAmt( - rolloverInTranche.address, - reserveTranche.address, - toFixedPtAmt("500"), - ); - expect(r.tokenOutAmt).to.eq(toFixedPtAmt("500")); - expect(r.trancheInAmt).to.eq(toFixedPtAmt("495.049504950495049505")); - }); - }); - describe("when trancheIn is NOT yet in the reserve", async function () { let tx: Transaction, newRotationInTranche: Contract, r: any; beforeEach(async function () { await advancePerpQueueToBondMaturity(perp, rolloverInBond); // advancing to next issuance - const newRolloverInBond = await bondAt(await perp.callStatic.getDepositBond()); + const newRolloverInBond = await bondAt(await perp.getDepositBond.staticCall()); await depositIntoBond(newRolloverInBond, toFixedPtAmt("1000"), deployer); [newRotationInTranche] = await getTranches(newRolloverInBond); - await newRotationInTranche.approve(mockVault.address, toFixedPtAmt("250")); - r = await perp.callStatic.computeRolloverAmt( - newRotationInTranche.address, - collateralToken.address, - toFixedPtAmt("250"), - ); - tx = mockVault.rollover( - perp.address, - newRotationInTranche.address, - collateralToken.address, + await newRotationInTranche.approve(mockVault.target, toFixedPtAmt("250")); + r = await perp.computeRolloverAmt.staticCall( + newRotationInTranche.target, + collateralToken.target, toFixedPtAmt("250"), ); + tx = mockVault.rollover(perp.target, newRotationInTranche.target, collateralToken.target, toFixedPtAmt("250")); await tx; }); it("should update the reserve", async function () { - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, newRotationInTranche], [toFixedPtAmt("1250"), toFixedPtAmt("250")], @@ -533,9 +468,9 @@ describe("PerpetualTranche", function () { it("should emit reserve synced", async function () { await expect(tx) .to.emit(perp, "ReserveSynced") - .withArgs(newRotationInTranche.address, toFixedPtAmt("250")) + .withArgs(newRotationInTranche.target, toFixedPtAmt("250")) .to.emit(perp, "ReserveSynced") - .withArgs(collateralToken.address, toFixedPtAmt("1250")); + .withArgs(collateralToken.target, toFixedPtAmt("1250")); }); it("should compute the rollover amounts", async function () { expect(r.tokenOutAmt).to.eq(toFixedPtAmt("250")); @@ -546,17 +481,17 @@ describe("PerpetualTranche", function () { describe("when tokenOut is a reserve tranche", async function () { let tx: Transaction, r: any; beforeEach(async function () { - r = await perp.callStatic.computeRolloverAmt( - rolloverInTranche.address, - reserveTranche.address, + r = await perp.computeRolloverAmt.staticCall( + rolloverInTranche.target, + reserveTranche.target, toFixedPtAmt("250"), ); - tx = mockVault.rollover(perp.address, rolloverInTranche.address, reserveTranche.address, toFixedPtAmt("250")); + tx = mockVault.rollover(perp.target, rolloverInTranche.target, reserveTranche.target, toFixedPtAmt("250")); await tx; }); it("should update the reserve", async function () { - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, reserveTranche, rolloverInTranche], [toFixedPtAmt("500"), toFixedPtAmt("250"), toFixedPtAmt("750")], @@ -565,9 +500,9 @@ describe("PerpetualTranche", function () { it("should emit reserve synced", async function () { await expect(tx) .to.emit(perp, "ReserveSynced") - .withArgs(rolloverInTranche.address, toFixedPtAmt("750")) + .withArgs(rolloverInTranche.target, toFixedPtAmt("750")) .to.emit(perp, "ReserveSynced") - .withArgs(reserveTranche.address, toFixedPtAmt("250")); + .withArgs(reserveTranche.target, toFixedPtAmt("250")); }); it("should compute the rollover amounts", async function () { expect(r.tokenOutAmt).to.eq(toFixedPtAmt("250")); @@ -578,17 +513,17 @@ describe("PerpetualTranche", function () { describe("when tokenOut is the mature collateral", async function () { let tx: Transaction, r: any; beforeEach(async function () { - r = await perp.callStatic.computeRolloverAmt( - rolloverInTranche.address, - collateralToken.address, + r = await perp.computeRolloverAmt.staticCall( + rolloverInTranche.target, + collateralToken.target, toFixedPtAmt("250"), ); - tx = mockVault.rollover(perp.address, rolloverInTranche.address, collateralToken.address, toFixedPtAmt("250")); + tx = mockVault.rollover(perp.target, rolloverInTranche.target, collateralToken.target, toFixedPtAmt("250")); await tx; }); it("should update the reserve", async function () { - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, reserveTranche, rolloverInTranche], [toFixedPtAmt("250"), toFixedPtAmt("500"), toFixedPtAmt("750")], @@ -597,9 +532,9 @@ describe("PerpetualTranche", function () { it("should emit reserve synced", async function () { await expect(tx) .to.emit(perp, "ReserveSynced") - .withArgs(rolloverInTranche.address, toFixedPtAmt("750")) + .withArgs(rolloverInTranche.target, toFixedPtAmt("750")) .to.emit(perp, "ReserveSynced") - .withArgs(collateralToken.address, toFixedPtAmt("250")); + .withArgs(collateralToken.target, toFixedPtAmt("250")); }); it("should compute the rollover amounts", async function () { expect(r.tokenOutAmt).to.eq(toFixedPtAmt("250")); @@ -611,17 +546,17 @@ describe("PerpetualTranche", function () { let tx: Transaction, r: any; beforeEach(async function () { await rebase(collateralToken, rebaseOracle, +0.5); - r = await perp.callStatic.computeRolloverAmt( - rolloverInTranche.address, - collateralToken.address, + r = await perp.computeRolloverAmt.staticCall( + rolloverInTranche.target, + collateralToken.target, toFixedPtAmt("250"), ); - tx = mockVault.rollover(perp.address, rolloverInTranche.address, collateralToken.address, toFixedPtAmt("250")); + tx = mockVault.rollover(perp.target, rolloverInTranche.target, collateralToken.target, toFixedPtAmt("250")); await tx; }); it("should update the reserve", async function () { - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, reserveTranche, rolloverInTranche], [toFixedPtAmt("500"), toFixedPtAmt("500"), toFixedPtAmt("750")], @@ -630,9 +565,9 @@ describe("PerpetualTranche", function () { it("should emit reserve synced", async function () { await expect(tx) .to.emit(perp, "ReserveSynced") - .withArgs(rolloverInTranche.address, toFixedPtAmt("750")) + .withArgs(rolloverInTranche.target, toFixedPtAmt("750")) .to.emit(perp, "ReserveSynced") - .withArgs(collateralToken.address, toFixedPtAmt("500")); + .withArgs(collateralToken.target, toFixedPtAmt("500")); }); it("should compute the rollover amounts", async function () { expect(r.tokenOutAmt).to.eq(toFixedPtAmt("250")); @@ -644,17 +579,17 @@ describe("PerpetualTranche", function () { let tx: Transaction, r: any; beforeEach(async function () { await rebase(collateralToken, rebaseOracle, -0.5); - r = await perp.callStatic.computeRolloverAmt( - rolloverInTranche.address, - collateralToken.address, + r = await perp.computeRolloverAmt.staticCall( + rolloverInTranche.target, + collateralToken.target, toFixedPtAmt("250"), ); - tx = mockVault.rollover(perp.address, rolloverInTranche.address, collateralToken.address, toFixedPtAmt("250")); + tx = mockVault.rollover(perp.target, rolloverInTranche.target, collateralToken.target, toFixedPtAmt("250")); await tx; }); it("should update the reserve", async function () { - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, reserveTranche, rolloverInTranche], ["0", toFixedPtAmt("500"), toFixedPtAmt("750")], @@ -663,9 +598,9 @@ describe("PerpetualTranche", function () { it("should emit reserve synced", async function () { await expect(tx) .to.emit(perp, "ReserveSynced") - .withArgs(rolloverInTranche.address, toFixedPtAmt("750")) + .withArgs(rolloverInTranche.target, toFixedPtAmt("750")) .to.emit(perp, "ReserveSynced") - .withArgs(collateralToken.address, "0"); + .withArgs(collateralToken.target, "0"); }); it("should compute the rollover amounts", async function () { expect(r.tokenOutAmt).to.eq(toFixedPtAmt("250")); @@ -676,17 +611,17 @@ describe("PerpetualTranche", function () { describe("when tokenOut is tranche and fully withdrawn", async function () { let tx: Transaction, r: any; beforeEach(async function () { - r = await perp.callStatic.computeRolloverAmt( - rolloverInTranche.address, - reserveTranche.address, + r = await perp.computeRolloverAmt.staticCall( + rolloverInTranche.target, + reserveTranche.target, toFixedPtAmt("500"), ); - tx = mockVault.rollover(perp.address, rolloverInTranche.address, reserveTranche.address, toFixedPtAmt("500")); + tx = mockVault.rollover(perp.target, rolloverInTranche.target, reserveTranche.target, toFixedPtAmt("500")); await tx; }); it("should update the reserve", async function () { - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, rolloverInTranche], [toFixedPtAmt("500"), toFixedPtAmt("1000")], @@ -696,9 +631,9 @@ describe("PerpetualTranche", function () { it("should emit reserve synced", async function () { await expect(tx) .to.emit(perp, "ReserveSynced") - .withArgs(rolloverInTranche.address, toFixedPtAmt("1000")) + .withArgs(rolloverInTranche.target, toFixedPtAmt("1000")) .to.emit(perp, "ReserveSynced") - .withArgs(reserveTranche.address, "0"); + .withArgs(reserveTranche.target, "0"); }); it("should compute the rollover amounts", async function () { expect(r.tokenOutAmt).to.eq(toFixedPtAmt("500")); @@ -709,17 +644,17 @@ describe("PerpetualTranche", function () { describe("when tokenOut is collateral and fully withdrawn", async function () { let tx: Transaction, r: any; beforeEach(async function () { - r = await perp.callStatic.computeRolloverAmt( - rolloverInTranche.address, - collateralToken.address, + r = await perp.computeRolloverAmt.staticCall( + rolloverInTranche.target, + collateralToken.target, toFixedPtAmt("500"), ); - tx = mockVault.rollover(perp.address, rolloverInTranche.address, collateralToken.address, toFixedPtAmt("500")); + tx = mockVault.rollover(perp.target, rolloverInTranche.target, collateralToken.target, toFixedPtAmt("500")); await tx; }); it("should update the reserve", async function () { - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, reserveTranche, rolloverInTranche], ["0", toFixedPtAmt("500"), toFixedPtAmt("1000")], @@ -728,9 +663,9 @@ describe("PerpetualTranche", function () { it("should emit reserve synced", async function () { await expect(tx) .to.emit(perp, "ReserveSynced") - .withArgs(rolloverInTranche.address, toFixedPtAmt("1000")) + .withArgs(rolloverInTranche.target, toFixedPtAmt("1000")) .to.emit(perp, "ReserveSynced") - .withArgs(collateralToken.address, "0"); + .withArgs(collateralToken.target, "0"); }); it("should compute the rollover amounts", async function () { expect(r.tokenOutAmt).to.eq(toFixedPtAmt("500")); @@ -741,17 +676,17 @@ describe("PerpetualTranche", function () { describe("when tokenOut is partially redeemed", async function () { let tx: Transaction, r: any; beforeEach(async function () { - r = await perp.callStatic.computeRolloverAmt( - rolloverInTranche.address, - reserveTranche.address, + r = await perp.computeRolloverAmt.staticCall( + rolloverInTranche.target, + reserveTranche.target, toFixedPtAmt("100"), ); - tx = mockVault.rollover(perp.address, rolloverInTranche.address, reserveTranche.address, toFixedPtAmt("100")); + tx = mockVault.rollover(perp.target, rolloverInTranche.target, reserveTranche.target, toFixedPtAmt("100")); await tx; }); it("should update the reserve", async function () { - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, reserveTranche, rolloverInTranche], [toFixedPtAmt("500"), toFixedPtAmt("400"), toFixedPtAmt("600")], @@ -761,9 +696,9 @@ describe("PerpetualTranche", function () { it("should emit reserve synced", async function () { await expect(tx) .to.emit(perp, "ReserveSynced") - .withArgs(rolloverInTranche.address, toFixedPtAmt("600")) + .withArgs(rolloverInTranche.target, toFixedPtAmt("600")) .to.emit(perp, "ReserveSynced") - .withArgs(reserveTranche.address, toFixedPtAmt("400")); + .withArgs(reserveTranche.target, toFixedPtAmt("400")); }); it("should compute the rollover amounts", async function () { expect(r.tokenOutAmt).to.eq(toFixedPtAmt("100")); @@ -774,17 +709,17 @@ describe("PerpetualTranche", function () { describe("when tokenOut is NOT covered", async function () { let tx: Transaction, r: any; beforeEach(async function () { - r = await perp.callStatic.computeRolloverAmt( - rolloverInTranche.address, - reserveTranche.address, + r = await perp.computeRolloverAmt.staticCall( + rolloverInTranche.target, + reserveTranche.target, toFixedPtAmt("2000"), ); - tx = mockVault.rollover(perp.address, rolloverInTranche.address, reserveTranche.address, toFixedPtAmt("2000")); + tx = mockVault.rollover(perp.target, rolloverInTranche.target, reserveTranche.target, toFixedPtAmt("2000")); await tx; }); it("should update the reserve (only transfers covered amount)", async function () { - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, rolloverInTranche], [toFixedPtAmt("500"), toFixedPtAmt("1000")], @@ -794,9 +729,9 @@ describe("PerpetualTranche", function () { it("should emit reserve synced", async function () { await expect(tx) .to.emit(perp, "ReserveSynced") - .withArgs(rolloverInTranche.address, toFixedPtAmt("1000")) + .withArgs(rolloverInTranche.target, toFixedPtAmt("1000")) .to.emit(perp, "ReserveSynced") - .withArgs(reserveTranche.address, "0"); + .withArgs(reserveTranche.target, "0"); }); it("should compute the rollover amounts", async function () { expect(r.tokenOutAmt).to.eq(toFixedPtAmt("500")); @@ -804,88 +739,20 @@ describe("PerpetualTranche", function () { }); }); - describe("when tokenOut is NOT covered and fee > 0", async function () { - let tx: Transaction, r: any; - beforeEach(async function () { - await feePolicy.computePerpRolloverFeePerc.returns(toPercFixedPtAmt("0.01")); - r = await perp.callStatic.computeRolloverAmt( - rolloverInTranche.address, - reserveTranche.address, - toFixedPtAmt("2000"), - ); - tx = mockVault.rollover(perp.address, rolloverInTranche.address, reserveTranche.address, toFixedPtAmt("2000")); - await tx; - }); - - it("should update the reserve (only transfers covered amount)", async function () { - await checkReserveComposition( - perp, - [collateralToken, rolloverInTranche], - [toFixedPtAmt("500"), toFixedPtAmt("1005.050505050505050506")], - ); - }); - - it("should emit reserve synced", async function () { - await expect(tx) - .to.emit(perp, "ReserveSynced") - .withArgs(rolloverInTranche.address, toFixedPtAmt("1005.050505050505050506")) - .to.emit(perp, "ReserveSynced") - .withArgs(reserveTranche.address, "0"); - }); - it("should compute the rollover amounts", async function () { - expect(r.tokenOutAmt).to.eq(toFixedPtAmt("500")); - expect(r.trancheInAmt).to.eq(toFixedPtAmt("505.050505050505050506")); - }); - }); - - describe("when tokenOut is NOT covered and fee < 0", async function () { - let tx: Transaction, r: any; - beforeEach(async function () { - await feePolicy.computePerpRolloverFeePerc.returns(toPercFixedPtAmt("-0.01")); - r = await perp.callStatic.computeRolloverAmt( - rolloverInTranche.address, - reserveTranche.address, - toFixedPtAmt("2000"), - ); - tx = mockVault.rollover(perp.address, rolloverInTranche.address, reserveTranche.address, toFixedPtAmt("2000")); - await tx; - }); - - it("should update the reserve (only transfers covered amount)", async function () { - await checkReserveComposition( - perp, - [collateralToken, rolloverInTranche], - [toFixedPtAmt("500"), toFixedPtAmt("995.049504950495049505")], - ); - }); - - it("should emit reserve synced", async function () { - await expect(tx) - .to.emit(perp, "ReserveSynced") - .withArgs(rolloverInTranche.address, toFixedPtAmt("995.049504950495049505")) - .to.emit(perp, "ReserveSynced") - .withArgs(reserveTranche.address, "0"); - }); - it("should compute the rollover amounts", async function () { - expect(r.tokenOutAmt).to.eq(toFixedPtAmt("500")); - expect(r.trancheInAmt).to.eq(toFixedPtAmt("495.049504950495049505")); - }); - }); - describe("when valid rollover", async function () { let tx: Transaction, r: any; beforeEach(async function () { - r = await perp.callStatic.computeRolloverAmt( - rolloverInTranche.address, - collateralToken.address, + r = await perp.computeRolloverAmt.staticCall( + rolloverInTranche.target, + collateralToken.target, toFixedPtAmt("100"), ); - tx = mockVault.rollover(perp.address, rolloverInTranche.address, collateralToken.address, toFixedPtAmt("100")); + tx = mockVault.rollover(perp.target, rolloverInTranche.target, collateralToken.target, toFixedPtAmt("100")); await tx; }); it("should update the reserve", async function () { - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, reserveTranche, rolloverInTranche], [toFixedPtAmt("400"), toFixedPtAmt("500"), toFixedPtAmt("600")], @@ -895,9 +762,9 @@ describe("PerpetualTranche", function () { it("should emit reserve synced", async function () { await expect(tx) .to.emit(perp, "ReserveSynced") - .withArgs(rolloverInTranche.address, toFixedPtAmt("600")) + .withArgs(rolloverInTranche.target, toFixedPtAmt("600")) .to.emit(perp, "ReserveSynced") - .withArgs(collateralToken.address, toFixedPtAmt("400")); + .withArgs(collateralToken.target, toFixedPtAmt("400")); }); it("should compute the rollover amounts", async function () { expect(r.tokenOutAmt).to.eq(toFixedPtAmt("100")); diff --git a/spot-contracts/test/rollover-vault/RolloverVault.ts b/spot-contracts/test/rollover-vault/RolloverVault.ts index 7a23860b..75ca1178 100644 --- a/spot-contracts/test/rollover-vault/RolloverVault.ts +++ b/spot-contracts/test/rollover-vault/RolloverVault.ts @@ -1,6 +1,6 @@ -import { expect, use } from "chai"; +import { expect } from "chai"; import { network, ethers, upgrades } from "hardhat"; -import { Contract, Transaction, Signer, constants } from "ethers"; +import { Contract, Transaction, Signer } from "ethers"; import { setupCollateralToken, mintCollteralToken, @@ -11,14 +11,13 @@ import { getTranches, getDepositBond, advancePerpQueueToBondMaturity, + DMock, } from "../helpers"; -import { smock, FakeContract } from "@defi-wonderland/smock"; - -use(smock.matchers); let vault: Contract, - perp: FakeContract, - feePolicy: FakeContract, + trancheManager: Contract, + perp: Contract, + feePolicy: Contract, collateralToken: Contract, deployer: Signer, otherUser: Signer; @@ -33,19 +32,30 @@ describe("RolloverVault", function () { ({ collateralToken } = await setupCollateralToken("Bitcoin", "BTC")); await mintCollteralToken(collateralToken, toFixedPtAmt("1000"), deployer); - const PerpetualTranche = await ethers.getContractFactory("PerpetualTranche"); - perp = await smock.fake(PerpetualTranche); - await perp.underlying.returns(collateralToken.address); - - const FeePolicy = await ethers.getContractFactory("FeePolicy"); - feePolicy = await smock.fake(FeePolicy); - await feePolicy.decimals.returns(8); - - const RolloverVault = await ethers.getContractFactory("RolloverVault"); - vault = await upgrades.deployProxy(RolloverVault.connect(deployer)); - await collateralToken.approve(vault.address, toFixedPtAmt("1")); - await vault.init("RolloverVault", "VSHARE", perp.address, feePolicy.address); - await perp.vault.returns(vault.address); + perp = new DMock(await ethers.getContractFactory("PerpetualTranche")); + await perp.deploy(); + await perp.mockMethod("underlying()", [collateralToken.target]); + + feePolicy = new DMock(await ethers.getContractFactory("FeePolicy")); + await feePolicy.deploy(); + await feePolicy.mockMethod("decimals()", [8]); + await feePolicy.mockMethod("computeDeviationRatio((uint256,uint256))", [toPercFixedPtAmt("1")]); + await feePolicy.mockMethod("computeFeePerc(uint256,uint256)", [0]); + + const TrancheManager = await ethers.getContractFactory("TrancheManager"); + trancheManager = await TrancheManager.deploy(); + const RolloverVault = await ethers.getContractFactory("RolloverVault", { + libraries: { + TrancheManager: trancheManager.target, + }, + }); + await upgrades.silenceWarnings(); + vault = await upgrades.deployProxy(RolloverVault.connect(deployer), { + unsafeAllow: ["external-library-linking"], + }); + await collateralToken.approve(vault.target, toFixedPtAmt("1")); + await vault.init("RolloverVault", "VSHARE", perp.target, feePolicy.target); + await perp.mockMethod("vault()", [vault.target]); }); afterEach(async function () { @@ -64,24 +74,25 @@ describe("RolloverVault", function () { }); it("should set ext service references", async function () { - expect(await vault.perp()).to.eq(perp.address); + expect(await vault.perp()).to.eq(perp.target); }); it("should set deposit asset reference", async function () { - expect(await vault.underlying()).to.eq(collateralToken.address); + expect(await vault.underlying()).to.eq(collateralToken.target); }); it("should set initial param values", async function () { expect(await vault.minDeploymentAmt()).to.eq("0"); expect(await vault.reservedUnderlyingBal()).to.eq("0"); - expect(await vault.reservedSubscriptionPerc()).to.eq("0"); + expect(await vault.reservedUnderlyingPerc()).to.eq("0"); + expect(await vault.lastRebalanceTimestampSec()).not.to.eq("0"); }); it("should initialize lists", async function () { expect(await vault.assetCount()).to.eq(1); - expect(await vault.assetAt(0)).to.eq(collateralToken.address); - expect(await vault.isVaultAsset(collateralToken.address)).to.eq(true); - expect(await vault.isVaultAsset(perp.address)).to.eq(false); + expect(await vault.assetAt(0)).to.eq(collateralToken.target); + expect(await vault.isVaultAsset(collateralToken.target)).to.eq(true); + expect(await vault.isVaultAsset(perp.target)).to.eq(false); }); it("should NOT be paused", async function () { @@ -167,6 +178,47 @@ describe("RolloverVault", function () { }); }); + describe("#pauseRebalance", function () { + beforeEach(async function () { + await vault.updateKeeper(await otherUser.getAddress()); + }); + + describe("when triggered by non-owner", function () { + it("should revert", async function () { + await expect(vault.connect(deployer).pauseRebalance()).to.be.revertedWithCustomError(vault, "UnauthorizedCall"); + }); + }); + + describe("when valid", function () { + it("should stop rebalance", async function () { + await vault.connect(otherUser).pauseRebalance(); + expect(await vault.lastRebalanceTimestampSec()).to.eq(18446744073709551615n); + }); + }); + }); + + describe("#unpauseRebalance", function () { + beforeEach(async function () { + await vault.updateKeeper(await otherUser.getAddress()); + }); + + describe("when triggered by non-owner", function () { + it("should revert", async function () { + await expect(vault.connect(deployer).unpauseRebalance()).to.be.revertedWithCustomError( + vault, + "UnauthorizedCall", + ); + }); + }); + + describe("when valid", function () { + it("should restart rebalance", async function () { + await vault.connect(otherUser).unpauseRebalance(); + expect(await vault.lastRebalanceTimestampSec()).to.lt(ethers.MaxUint256); + }); + }); + }); + describe("#transferERC20", function () { let transferToken: Contract, toAddress: string; @@ -174,21 +226,21 @@ describe("RolloverVault", function () { const Token = await ethers.getContractFactory("MockERC20"); transferToken = await Token.deploy(); await transferToken.init("Mock Token", "MOCK"); - await transferToken.mint(vault.address, "100"); + await transferToken.mint(vault.target, "100"); toAddress = await deployer.getAddress(); }); describe("when triggered by non-owner", function () { it("should revert", async function () { - await expect( - vault.connect(otherUser).transferERC20(transferToken.address, toAddress, "100"), - ).to.be.revertedWith("Ownable: caller is not the owner"); + await expect(vault.connect(otherUser).transferERC20(transferToken.target, toAddress, "100")).to.be.revertedWith( + "Ownable: caller is not the owner", + ); }); }); describe("when non vault asset", function () { it("should transfer", async function () { - await expect(() => vault.transferERC20(transferToken.address, toAddress, "100")).to.changeTokenBalance( + await expect(() => vault.transferERC20(transferToken.target, toAddress, "100")).to.changeTokenBalance( transferToken, deployer, "100", @@ -206,8 +258,8 @@ describe("RolloverVault", function () { describe("when perp", function () { it("should not revert", async function () { - await perp.transfer.returns(() => true); - await expect(vault.transferERC20(perp.address, toAddress, toFixedPtAmt("100"))).not.to.be.reverted; + await perp.mockMethod("transfer(address,uint256)", [true]); + await expect(vault.transferERC20(perp.target, toAddress, toFixedPtAmt("100"))).not.to.be.reverted; }); }); @@ -219,7 +271,7 @@ describe("RolloverVault", function () { const BondIssuer = await ethers.getContractFactory("BondIssuer"); const issuer = await upgrades.deployProxy( BondIssuer.connect(deployer), - [bondFactory.address, collateralToken.address, 4800, [200, 800], 1200, 0], + [bondFactory.target, collateralToken.target, 4800, [200, 800], 1200, 0], { initializer: "init(address,address,uint256,uint256[],uint256,uint256)", }, @@ -228,7 +280,7 @@ describe("RolloverVault", function () { const PerpetualTranche = await ethers.getContractFactory("PerpetualTranche"); perp = await upgrades.deployProxy( PerpetualTranche.connect(deployer), - ["PerpetualTranche", "PERP", collateralToken.address, issuer.address, feePolicy.address], + ["PerpetualTranche", "PERP", collateralToken.target, issuer.target, feePolicy.target], { initializer: "init(string,string,address,address,address)", }, @@ -237,20 +289,26 @@ describe("RolloverVault", function () { await perp.updateTolerableTrancheMaturity(1200, 4800); await advancePerpQueueToBondMaturity(perp, await getDepositBond(perp)); - const RolloverVault = await ethers.getContractFactory("RolloverVault"); - vault = await upgrades.deployProxy(RolloverVault.connect(deployer)); - await vault.init("RolloverVault", "VSHARE", perp.address, feePolicy.address); - await perp.updateVault(vault.address); + const RolloverVault = await ethers.getContractFactory("RolloverVault", { + libraries: { + TrancheManager: trancheManager.target, + }, + }); + vault = await upgrades.deployProxy(RolloverVault.connect(deployer), { + unsafeAllow: ["external-library-linking"], + }); + await vault.init("RolloverVault", "VSHARE", perp.target, feePolicy.target); + await perp.updateVault(vault.target); await mintCollteralToken(collateralToken, toFixedPtAmt("100000"), deployer); const bond = await getDepositBond(perp); const tranches = await getTranches(bond); await depositIntoBond(bond, toFixedPtAmt("1000"), deployer); - await tranches[0].approve(perp.address, toFixedPtAmt("200")); - await perp.deposit(tranches[0].address, toFixedPtAmt("200")); + await tranches[0].approve(perp.target, toFixedPtAmt("200")); + await perp.deposit(tranches[0].target, toFixedPtAmt("200")); await advancePerpQueueToBondMaturity(perp, bond); - await collateralToken.transfer(vault.address, toFixedPtAmt("1000")); + await collateralToken.transfer(vault.target, toFixedPtAmt("1000")); await vault.deploy(); expect(await vault.assetCount()).to.eq(2); }); @@ -270,7 +328,7 @@ describe("RolloverVault", function () { describe("when triggered by non-owner", function () { it("should revert", async function () { - await expect(vault.connect(deployer).updateFeePolicy(constants.AddressZero)).to.be.revertedWith( + await expect(vault.connect(deployer).updateFeePolicy(ethers.ZeroAddress)).to.be.revertedWith( "Ownable: caller is not the owner", ); }); @@ -279,71 +337,19 @@ describe("RolloverVault", function () { describe("when triggered by owner", function () { let newFeePolicy: Contract; beforeEach(async function () { - const FeePolicy = await ethers.getContractFactory("FeePolicy"); - newFeePolicy = await smock.fake(FeePolicy); - await newFeePolicy.decimals.returns(8); - tx = await vault.connect(otherUser).updateFeePolicy(newFeePolicy.address); + newFeePolicy = new DMock(await ethers.getContractFactory("FeePolicy")); + await newFeePolicy.deploy(); + await newFeePolicy.mockMethod("decimals()", [8]); + tx = await vault.connect(otherUser).updateFeePolicy(newFeePolicy.target); await tx; }); it("should update the fee policy", async function () { - expect(await vault.feePolicy()).to.eq(newFeePolicy.address); - }); - }); - }); - - describe("#updateReservedUnderlyingBal", function () { - let tx: Transaction; - beforeEach(async function () { - await vault.connect(deployer).updateKeeper(await otherUser.getAddress()); - }); - - describe("when triggered by non-keeper", function () { - it("should revert", async function () { - await expect(vault.connect(deployer).updateReservedUnderlyingBal(0)).to.be.revertedWithCustomError( - vault, - "UnauthorizedCall", - ); - }); - }); - - describe("when triggered by keeper", function () { - beforeEach(async function () { - tx = await vault.connect(otherUser).updateReservedUnderlyingBal(toFixedPtAmt("1000")); - await tx; - }); - it("should update the min deployment amount", async function () { - expect(await vault.reservedUnderlyingBal()).to.eq(toFixedPtAmt("1000")); - }); - }); - }); - - describe("#updateReservedUnderlyingBal", function () { - let tx: Transaction; - beforeEach(async function () { - await vault.connect(deployer).updateKeeper(await otherUser.getAddress()); - }); - - describe("when triggered by non-keeper", function () { - it("should revert", async function () { - await expect(vault.connect(deployer).updateReservedUnderlyingBal(0)).to.be.revertedWithCustomError( - vault, - "UnauthorizedCall", - ); - }); - }); - - describe("when triggered by keeper", function () { - beforeEach(async function () { - tx = await vault.connect(otherUser).updateReservedUnderlyingBal(toFixedPtAmt("1000")); - await tx; - }); - it("should update the min underlying balance", async function () { - expect(await vault.reservedUnderlyingBal()).to.eq(toFixedPtAmt("1000")); + expect(await vault.feePolicy()).to.eq(newFeePolicy.target); }); }); }); - describe("#updateReservedSubscriptionPerc", function () { + describe("#updateLiquidityLimits", function () { let tx: Transaction; beforeEach(async function () { await vault.connect(deployer).updateKeeper(await otherUser.getAddress()); @@ -351,20 +357,25 @@ describe("RolloverVault", function () { describe("when triggered by non-keeper", function () { it("should revert", async function () { - await expect(vault.connect(deployer).updateReservedSubscriptionPerc(0)).to.be.revertedWithCustomError( - vault, - "UnauthorizedCall", - ); + await expect( + vault + .connect(deployer) + .updateLiquidityLimits(toFixedPtAmt("1000"), toFixedPtAmt("100000"), toPercFixedPtAmt("0.25")), + ).to.be.revertedWithCustomError(vault, "UnauthorizedCall"); }); }); describe("when triggered by keeper", function () { beforeEach(async function () { - tx = await vault.connect(otherUser).updateReservedSubscriptionPerc(toPercFixedPtAmt("0.1")); + tx = await vault + .connect(otherUser) + .updateLiquidityLimits(toFixedPtAmt("1000"), toFixedPtAmt("100000"), toPercFixedPtAmt("0.25")); await tx; }); - it("should update the min underlying balance", async function () { - expect(await vault.reservedSubscriptionPerc()).to.eq(toPercFixedPtAmt("0.1")); + it("should update the liquidity parameters", async function () { + expect(await vault.minDeploymentAmt()).to.eq(toFixedPtAmt("1000")); + expect(await vault.reservedUnderlyingBal()).to.eq(toFixedPtAmt("100000")); + expect(await vault.reservedUnderlyingPerc()).to.eq(toPercFixedPtAmt("0.25")); }); }); }); @@ -377,7 +388,7 @@ describe("RolloverVault", function () { describe("when triggered by non-owner", function () { it("should revert", async function () { - await expect(vault.connect(deployer).updateKeeper(constants.AddressZero)).to.be.revertedWith( + await expect(vault.connect(deployer).updateKeeper(ethers.ZeroAddress)).to.be.revertedWith( "Ownable: caller is not the owner", ); }); diff --git a/spot-contracts/test/rollover-vault/RolloverVault_deploy.ts b/spot-contracts/test/rollover-vault/RolloverVault_deploy.ts index 3f85a0eb..b2627157 100644 --- a/spot-contracts/test/rollover-vault/RolloverVault_deploy.ts +++ b/spot-contracts/test/rollover-vault/RolloverVault_deploy.ts @@ -1,7 +1,6 @@ -import { expect, use } from "chai"; +import { expect } from "chai"; import { network, ethers, upgrades } from "hardhat"; import { Contract, Signer, Transaction } from "ethers"; -import { smock } from "@defi-wonderland/smock"; import { setupCollateralToken, @@ -16,11 +15,11 @@ import { advancePerpQueue, advancePerpQueueToBondMaturity, advancePerpQueueToRollover, - checkReserveComposition, - checkVaultAssetComposition, + checkPerpComposition, + checkVaultComposition, rebase, + DMock, } from "../helpers"; -use(smock.matchers); let vault: Contract; let perp: Contract; @@ -47,21 +46,22 @@ describe("RolloverVault", function () { const BondIssuer = await ethers.getContractFactory("BondIssuer"); issuer = await upgrades.deployProxy( BondIssuer.connect(deployer), - [bondFactory.address, collateralToken.address, 4800, [200, 800], 1200, 0], + [bondFactory.target, collateralToken.target, 4800, [200, 800], 1200, 0], { initializer: "init(address,address,uint256,uint256[],uint256,uint256)", }, ); - const FeePolicy = await ethers.getContractFactory("FeePolicy"); - feePolicy = await smock.fake(FeePolicy); - await feePolicy.decimals.returns(8); - await feePolicy.computePerpRolloverFeePerc.returns("0"); + feePolicy = new DMock(await ethers.getContractFactory("FeePolicy")); + await feePolicy.deploy(); + await feePolicy.mockMethod("decimals()", [8]); + await feePolicy.mockMethod("computeDeviationRatio((uint256,uint256))", [toPercFixedPtAmt("1")]); + await feePolicy.mockMethod("computeFeePerc(uint256,uint256)", [0]); const PerpetualTranche = await ethers.getContractFactory("PerpetualTranche"); perp = await upgrades.deployProxy( PerpetualTranche.connect(deployer), - ["PerpetualTranche", "PERP", collateralToken.address, issuer.address, feePolicy.address], + ["PerpetualTranche", "PERP", collateralToken.target, issuer.target, feePolicy.target], { initializer: "init(string,string,address,address,address)", }, @@ -70,10 +70,19 @@ describe("RolloverVault", function () { await perp.updateTolerableTrancheMaturity(1200, 4800); await advancePerpQueueToBondMaturity(perp, await getDepositBond(perp)); - const RolloverVault = await ethers.getContractFactory("RolloverVault"); - vault = await upgrades.deployProxy(RolloverVault.connect(deployer)); - await vault.init("RolloverVault", "VSHARE", perp.address, feePolicy.address); - await perp.updateVault(vault.address); + const TrancheManager = await ethers.getContractFactory("TrancheManager"); + const trancheManager = await TrancheManager.deploy(); + const RolloverVault = await ethers.getContractFactory("RolloverVault", { + libraries: { + TrancheManager: trancheManager.target, + }, + }); + await upgrades.silenceWarnings(); + vault = await upgrades.deployProxy(RolloverVault.connect(deployer), { + unsafeAllow: ["external-library-linking"], + }); + await vault.init("RolloverVault", "VSHARE", perp.target, feePolicy.target); + await perp.updateVault(vault.target); reserveTranches = []; for (let i = 0; i < 4; i++) { @@ -81,25 +90,25 @@ describe("RolloverVault", function () { const tranches = await getTranches(bond); await depositIntoBond(bond, toFixedPtAmt("1000"), deployer); - await tranches[0].approve(perp.address, toFixedPtAmt("200")); - await perp.deposit(tranches[0].address, toFixedPtAmt("200")); + await tranches[0].approve(perp.target, toFixedPtAmt("200")); + await perp.deposit(tranches[0].target, toFixedPtAmt("200")); reserveTranches.push(tranches[0]); await advancePerpQueue(perp, 1200); } - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, ...reserveTranches.slice(-3)], [toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200")], ); - rolloverInBond = await bondAt(await perp.callStatic.getDepositBond()); + rolloverInBond = await bondAt(await perp.getDepositBond.staticCall()); rolloverInTranches = await getTranches(rolloverInBond); await mintCollteralToken(collateralToken, toFixedPtAmt("100000"), deployer); - await collateralToken.approve(vault.address, toFixedPtAmt("1")); + await collateralToken.approve(vault.target, toFixedPtAmt("1")); - await checkVaultAssetComposition(vault, [collateralToken], ["0"]); + await checkVaultComposition(vault, [collateralToken], ["0"]); expect(await vault.assetCount()).to.eq(1); }); @@ -116,13 +125,13 @@ describe("RolloverVault", function () { describe("when reservedUnderlyingBal is not set", function () { beforeEach(async function () { - await vault.updateReservedUnderlyingBal(toFixedPtAmt("0")); + await vault.updateLiquidityLimits(toFixedPtAmt("0"), toFixedPtAmt("0"), toPercFixedPtAmt("0")); }); describe("when usable balance is lower than the min deployment", function () { beforeEach(async function () { - await collateralToken.transfer(vault.address, toFixedPtAmt("999")); - await vault.updateMinDeploymentAmt(toFixedPtAmt("1000")); + await collateralToken.transfer(vault.target, toFixedPtAmt("999")); + await vault.updateLiquidityLimits(toFixedPtAmt("1000"), toFixedPtAmt("0"), toPercFixedPtAmt("0")); }); it("should revert", async function () { await expect(vault.deploy()).to.be.revertedWithCustomError(vault, "InsufficientDeployment"); @@ -131,8 +140,8 @@ describe("RolloverVault", function () { describe("when usable balance is higher than the min deployment", function () { beforeEach(async function () { - await collateralToken.transfer(vault.address, toFixedPtAmt("1000")); - await vault.updateMinDeploymentAmt(toFixedPtAmt("100")); + await collateralToken.transfer(vault.target, toFixedPtAmt("1000")); + await vault.updateLiquidityLimits(toFixedPtAmt("100"), toFixedPtAmt("0"), toPercFixedPtAmt("0")); }); it("should not revert", async function () { await expect(vault.deploy()).not.to.be.reverted; @@ -142,13 +151,12 @@ describe("RolloverVault", function () { describe("when reservedUnderlyingBal is set", function () { beforeEach(async function () { - await vault.updateReservedUnderlyingBal(toFixedPtAmt("25")); + await vault.updateLiquidityLimits(toFixedPtAmt("0"), toFixedPtAmt("25"), toPercFixedPtAmt("0")); }); describe("when usable balance is lower than the reservedUnderlyingBal", function () { beforeEach(async function () { - await collateralToken.transfer(vault.address, toFixedPtAmt("20")); - await vault.updateMinDeploymentAmt(toFixedPtAmt("1")); + await collateralToken.transfer(vault.target, toFixedPtAmt("20")); }); it("should revert", async function () { await expect(vault.deploy()).to.be.revertedWithCustomError(vault, "InsufficientDeployment"); @@ -157,8 +165,8 @@ describe("RolloverVault", function () { describe("when usable balance is lower than the min deployment", function () { beforeEach(async function () { - await collateralToken.transfer(vault.address, toFixedPtAmt("125")); - await vault.updateMinDeploymentAmt(toFixedPtAmt("100")); + await collateralToken.transfer(vault.target, toFixedPtAmt("125")); + await vault.updateLiquidityLimits(toFixedPtAmt("100"), toFixedPtAmt("25"), toPercFixedPtAmt("0")); }); it("should revert", async function () { await expect(vault.deploy()).to.be.revertedWithCustomError(vault, "InsufficientDeployment"); @@ -167,8 +175,8 @@ describe("RolloverVault", function () { describe("when usable balance is higher than the min deployment", function () { beforeEach(async function () { - await collateralToken.transfer(vault.address, toFixedPtAmt("126")); - await vault.updateMinDeploymentAmt(toFixedPtAmt("100")); + await collateralToken.transfer(vault.target, toFixedPtAmt("126")); + await vault.updateLiquidityLimits(toFixedPtAmt("100"), toFixedPtAmt("25"), toPercFixedPtAmt("0")); }); it("should not revert", async function () { await expect(vault.deploy()).not.to.be.reverted; @@ -180,23 +188,23 @@ describe("RolloverVault", function () { let newTranchesIn; beforeEach(async function () { await advancePerpQueueToBondMaturity(perp, rolloverInBond); - const newBondIn = await bondAt(await perp.callStatic.getDepositBond()); + const newBondIn = await bondAt(await perp.getDepositBond.staticCall()); newTranchesIn = await getTranches(newBondIn); - await checkReserveComposition(perp, [collateralToken], [toFixedPtAmt("800")]); + await checkPerpComposition(perp, [collateralToken], [toFixedPtAmt("800")]); }); describe("when balance covers just 1 token", function () { beforeEach(async function () { - await collateralToken.transfer(vault.address, toFixedPtAmt("10")); + await collateralToken.transfer(vault.target, toFixedPtAmt("10")); }); it("should rollover", async function () { await expect(vault.deploy()).not.to.be.reverted; - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, newTranchesIn[1]], [toFixedPtAmt("2"), toFixedPtAmt("8")], ); - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, newTranchesIn[0]], [toFixedPtAmt("798"), toFixedPtAmt("2")], @@ -206,16 +214,16 @@ describe("RolloverVault", function () { describe("when balance covers just 1 token exactly", function () { beforeEach(async function () { - await collateralToken.transfer(vault.address, toFixedPtAmt("10000")); + await collateralToken.transfer(vault.target, toFixedPtAmt("10000")); }); it("should rollover", async function () { await expect(vault.deploy()).not.to.be.reverted; - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, newTranchesIn[1]], [toFixedPtAmt("6800"), toFixedPtAmt("3200")], ); - await checkReserveComposition(perp, [collateralToken, newTranchesIn[0]], ["0", toFixedPtAmt("800")]); + await checkPerpComposition(perp, [collateralToken, newTranchesIn[0]], ["0", toFixedPtAmt("800")]); }); }); }); @@ -223,48 +231,49 @@ describe("RolloverVault", function () { describe("when one trancheIn one tokenOut (near mature tranche)", function () { let curTranchesIn, newTranchesIn; beforeEach(async function () { - await advancePerpQueueToBondMaturity(perp, await bondAt(reserveTranches[2].bond())); - const curBondIn = await bondAt(await perp.callStatic.getDepositBond()); + await advancePerpQueueToBondMaturity(perp, await bondAt(await reserveTranches[2].bond())); + const curBondIn = await bondAt(await perp.getDepositBond.staticCall()); + await depositIntoBond(curBondIn, toFixedPtAmt("10"), deployer); curTranchesIn = await getTranches(curBondIn); - await collateralToken.transfer(vault.address, toFixedPtAmt("10000")); + await collateralToken.transfer(vault.target, toFixedPtAmt("10000")); await vault.deploy(); await advancePerpQueueToRollover(perp, curBondIn); - const newBondIn = await bondAt(await perp.callStatic.getDepositBond()); + const newBondIn = await bondAt(await perp.getDepositBond.staticCall()); newTranchesIn = await getTranches(newBondIn); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, reserveTranches[3], curTranchesIn[1]], [toFixedPtAmt("6600"), toFixedPtAmt("200"), toFixedPtAmt("3200")], ); - await checkReserveComposition(perp, [collateralToken, curTranchesIn[0]], ["0", toFixedPtAmt("800")]); + await checkPerpComposition(perp, [collateralToken, curTranchesIn[0]], ["0", toFixedPtAmt("800")]); }); describe("when balance covers just 1 token", function () { it("should rollover", async function () { await expect(vault.deploy()).not.to.be.reverted; - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, newTranchesIn[1], reserveTranches[3]], [toFixedPtAmt("6600"), toFixedPtAmt("3200"), toFixedPtAmt("200")], ); - await checkReserveComposition(perp, [collateralToken, newTranchesIn[0]], ["0", toFixedPtAmt("800")]); + await checkPerpComposition(perp, [collateralToken, newTranchesIn[0]], ["0", toFixedPtAmt("800")]); }); }); describe("when balance covers just 1 token exactly", function () { beforeEach(async function () { - await collateralToken.transfer(vault.address, toFixedPtAmt("8500")); + await collateralToken.transfer(vault.target, toFixedPtAmt("8500")); }); it("should rollover", async function () { await expect(vault.deploy()).not.to.be.reverted; - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, reserveTranches[3], newTranchesIn[1]], [toFixedPtAmt("15100"), toFixedPtAmt("200"), toFixedPtAmt("3200")], ); - await checkReserveComposition(perp, [collateralToken, newTranchesIn[0]], ["0", toFixedPtAmt("800")]); + await checkPerpComposition(perp, [collateralToken, newTranchesIn[0]], ["0", toFixedPtAmt("800")]); }); }); }); @@ -272,16 +281,16 @@ describe("RolloverVault", function () { describe("when one trancheIn many tokenOut", function () { describe("when balance covers just 1 token", function () { beforeEach(async function () { - await collateralToken.transfer(vault.address, toFixedPtAmt("10")); + await collateralToken.transfer(vault.target, toFixedPtAmt("10")); }); it("should rollover", async function () { await expect(vault.deploy()).not.to.be.reverted; - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, rolloverInTranches[1]], [toFixedPtAmt("2"), toFixedPtAmt("8")], ); - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, ...reserveTranches.slice(-3), rolloverInTranches[0]], [toFixedPtAmt("198"), toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("2")], @@ -291,16 +300,16 @@ describe("RolloverVault", function () { describe("when balance covers just 1 token exactly", function () { beforeEach(async function () { - await collateralToken.transfer(vault.address, toFixedPtAmt("1000")); + await collateralToken.transfer(vault.target, toFixedPtAmt("1000")); }); it("should rollover", async function () { await expect(vault.deploy()).not.to.be.reverted; - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, rolloverInTranches[1]], [toFixedPtAmt("200"), toFixedPtAmt("800")], ); - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, ...reserveTranches.slice(-3), rolloverInTranches[0]], ["0", toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200")], @@ -310,16 +319,16 @@ describe("RolloverVault", function () { describe("when balance covers many tokens", function () { beforeEach(async function () { - await collateralToken.transfer(vault.address, toFixedPtAmt("4000")); + await collateralToken.transfer(vault.target, toFixedPtAmt("4000")); }); it("should rollover", async function () { await expect(vault.deploy()).not.to.be.reverted; - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, reserveTranches[1], rolloverInTranches[1]], [toFixedPtAmt("2200"), toFixedPtAmt("200"), toFixedPtAmt("1600")], ); - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, ...reserveTranches.slice(-2), rolloverInTranches[0]], ["0", toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("400")], @@ -332,16 +341,16 @@ describe("RolloverVault", function () { describe("when balance covers many tokens", async function () { beforeEach(async function () { await rebase(collateralToken, rebaseOracle, -0.9); - await collateralToken.transfer(vault.address, toFixedPtAmt("600")); + await collateralToken.transfer(vault.target, toFixedPtAmt("600")); }); it("should rollover", async function () { await expect(vault.deploy()).not.to.be.reverted; - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, reserveTranches[1], rolloverInTranches[1]], [toFixedPtAmt("20"), toFixedPtAmt("200"), toFixedPtAmt("480")], ); - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, ...reserveTranches.slice(-2), rolloverInTranches[0]], ["0", toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("120")], @@ -350,55 +359,11 @@ describe("RolloverVault", function () { }); }); - describe("when rollover fee is +ve", function () { - beforeEach(async function () { - await feePolicy.computePerpRolloverFeePerc.returns(toPercFixedPtAmt("0.01")); - await collateralToken.transfer(vault.address, toFixedPtAmt("1500")); - }); - - it("should rollover", async function () { - await expect(vault.deploy()).not.to.be.reverted; - await checkVaultAssetComposition( - vault, - [collateralToken, reserveTranches[1], rolloverInTranches[1]], - [toFixedPtAmt("200"), toFixedPtAmt("96.999999999999999999"), toFixedPtAmt("1200")], - ); - await checkReserveComposition( - perp, - [collateralToken, reserveTranches[1], reserveTranches[2], reserveTranches[3], rolloverInTranches[0]], - ["0", toFixedPtAmt("103.000000000000000001"), toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("300")], - ); - }); - }); - - describe("when rollover fee is -ve", function () { - beforeEach(async function () { - await feePolicy.computePerpRolloverFeePerc.returns(toPercFixedPtAmt("-0.01")); - await collateralToken.transfer(vault.address, toFixedPtAmt("1500")); - }); - - it("should rollover", async function () { - await expect(vault.deploy()).not.to.be.reverted; - await checkVaultAssetComposition( - vault, - [collateralToken, reserveTranches[1], rolloverInTranches[1]], - [toFixedPtAmt("200"), toFixedPtAmt("102.999999999999999999"), toFixedPtAmt("1200")], - ); - await checkReserveComposition( - perp, - [collateralToken, reserveTranches[1], reserveTranches[2], reserveTranches[3], rolloverInTranches[0]], - ["0", toFixedPtAmt("97.000000000000000001"), toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("300")], - ); - }); - }); - describe("typical deploy", function () { let txFn: Promise; beforeEach(async function () { await rebase(collateralToken, rebaseOracle, -0.9); - await feePolicy.computePerpRolloverFeePerc.returns(toPercFixedPtAmt("-0.01")); - await collateralToken.transfer(vault.address, toFixedPtAmt("1000")); - + await collateralToken.transfer(vault.target, toFixedPtAmt("1000")); txFn = () => vault.deploy(); }); @@ -406,44 +371,33 @@ describe("RolloverVault", function () { const tx = txFn(); // Tranche - await expect(tx).to.emit(vault, "AssetSynced").withArgs(rolloverInTranches[0].address, toFixedPtAmt("200")); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(rolloverInTranches[1].address, toFixedPtAmt("800")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(rolloverInTranches[0].target, toFixedPtAmt("200")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(rolloverInTranches[1].target, toFixedPtAmt("800")); // Rollover - await expect(tx).to.emit(vault, "AssetSynced").withArgs(reserveTranches[1].address, toFixedPtAmt("200")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(reserveTranches[1].target, toFixedPtAmt("200")); // Recover - await expect(tx) - .to.emit(vault, "AssetSynced") - .withArgs(rolloverInTranches[0].address, toFixedPtAmt("0.000000000000000118")); - await expect(tx) - .to.emit(vault, "AssetSynced") - .withArgs(rolloverInTranches[1].address, toFixedPtAmt("475.247524752475248")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(rolloverInTranches[0].target, toFixedPtAmt("0")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(rolloverInTranches[1].target, toFixedPtAmt("480")); // Final - await expect(tx) - .to.emit(vault, "AssetSynced") - .withArgs(collateralToken.address, toFixedPtAmt("425.940594059405940000")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(collateralToken.target, toFixedPtAmt("420")); }); it("should update the list of deployed assets", async function () { await txFn(); - await checkVaultAssetComposition( + await checkVaultComposition( vault, - [collateralToken, reserveTranches[1], rolloverInTranches[0], rolloverInTranches[1]], - [ - toFixedPtAmt("425.940594059405940000"), - toFixedPtAmt("200"), - toFixedPtAmt("0.000000000000000118"), - toFixedPtAmt("475.247524752475248"), - ], + [collateralToken, reserveTranches[1], rolloverInTranches[1]], + [toFixedPtAmt("420"), toFixedPtAmt("200"), toFixedPtAmt("480")], ); - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, reserveTranches[2], reserveTranches[3], rolloverInTranches[0]], - ["0", toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("118.811881188118811882")], + ["0", toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("120")], ); }); }); @@ -451,9 +405,9 @@ describe("RolloverVault", function () { describe("deploy limit", function () { async function setupDeployment() { - const curBondIn = await bondAt(await perp.callStatic.getDepositBond()); + const curBondIn = await bondAt(await perp.getDepositBond.staticCall()); await advancePerpQueueToRollover(perp, curBondIn); - await collateralToken.transfer(vault.address, toFixedPtAmt("10")); + await collateralToken.transfer(vault.target, toFixedPtAmt("10")); } beforeEach(async function () { @@ -469,7 +423,7 @@ describe("RolloverVault", function () { await expect(vault.deploy()).to.be.revertedWithCustomError(vault, "DeployedCountOverLimit"); }); it("redemption should be within gas limit", async function () { - await collateralToken.approve(vault.address, toFixedPtAmt("10")); + await collateralToken.approve(vault.target, toFixedPtAmt("10")); await vault.deposit(toFixedPtAmt("10")); await expect(vault.redeem(await vault.balanceOf(await deployer.getAddress()))).not.to.be.reverted; }); diff --git a/spot-contracts/test/rollover-vault/RolloverVault_deposit_redeem.ts b/spot-contracts/test/rollover-vault/RolloverVault_deposit_redeem.ts index 80ec756e..2d3126fd 100644 --- a/spot-contracts/test/rollover-vault/RolloverVault_deposit_redeem.ts +++ b/spot-contracts/test/rollover-vault/RolloverVault_deposit_redeem.ts @@ -1,7 +1,6 @@ -import { expect, use } from "chai"; +import { expect } from "chai"; import { network, ethers, upgrades } from "hardhat"; import { Contract, Signer, BigNumber } from "ethers"; -import { smock } from "@defi-wonderland/smock"; import { setupCollateralToken, @@ -14,13 +13,12 @@ import { getDepositBond, advancePerpQueue, advancePerpQueueToBondMaturity, - checkReserveComposition, - checkVaultAssetComposition, + checkPerpComposition, + checkVaultComposition, rebase, toPercFixedPtAmt, - advancePerpQueueUpToBondMaturity, + DMock, } from "../helpers"; -use(smock.matchers); let deployer: Signer; let deployerAddress: string; @@ -54,21 +52,22 @@ describe("RolloverVault", function () { const BondIssuer = await ethers.getContractFactory("BondIssuer"); issuer = await upgrades.deployProxy( BondIssuer.connect(deployer), - [bondFactory.address, collateralToken.address, 4800, [200, 800], 1200, 0], + [bondFactory.target, collateralToken.target, 4800, [200, 800], 1200, 0], { initializer: "init(address,address,uint256,uint256[],uint256,uint256)", }, ); - const FeePolicy = await ethers.getContractFactory("FeePolicy"); - feePolicy = await smock.fake(FeePolicy); - await feePolicy.decimals.returns(8); - await feePolicy.computePerpRolloverFeePerc.returns("0"); + feePolicy = new DMock(await ethers.getContractFactory("FeePolicy")); + await feePolicy.deploy(); + await feePolicy.mockMethod("decimals()", [8]); + await feePolicy.mockMethod("computeDeviationRatio((uint256,uint256))", [toPercFixedPtAmt("1")]); + await feePolicy.mockMethod("computeFeePerc(uint256,uint256)", [0]); const PerpetualTranche = await ethers.getContractFactory("PerpetualTranche"); perp = await upgrades.deployProxy( PerpetualTranche.connect(deployer), - ["PerpetualTranche", "PERP", collateralToken.address, issuer.address, feePolicy.address], + ["PerpetualTranche", "PERP", collateralToken.target, issuer.target, feePolicy.target], { initializer: "init(string,string,address,address,address)", }, @@ -77,10 +76,19 @@ describe("RolloverVault", function () { await perp.updateTolerableTrancheMaturity(1200, 4800); await advancePerpQueueToBondMaturity(perp, await getDepositBond(perp)); - const RolloverVault = await ethers.getContractFactory("RolloverVault"); - vault = await upgrades.deployProxy(RolloverVault.connect(deployer)); - await vault.init("RolloverVault", "VSHARE", perp.address, feePolicy.address); - await perp.updateVault(vault.address); + const TrancheManager = await ethers.getContractFactory("TrancheManager"); + const trancheManager = await TrancheManager.deploy(); + const RolloverVault = await ethers.getContractFactory("RolloverVault", { + libraries: { + TrancheManager: trancheManager.target, + }, + }); + await upgrades.silenceWarnings(); + vault = await upgrades.deployProxy(RolloverVault.connect(deployer), { + unsafeAllow: ["external-library-linking"], + }); + await vault.init("RolloverVault", "VSHARE", perp.target, feePolicy.target); + await perp.updateVault(vault.target); reserveTranches = []; for (let i = 0; i < 3; i++) { @@ -88,24 +96,24 @@ describe("RolloverVault", function () { const tranches = await getTranches(bond); await depositIntoBond(bond, toFixedPtAmt("1000"), deployer); - await tranches[0].approve(perp.address, toFixedPtAmt("200")); - await perp.deposit(tranches[0].address, toFixedPtAmt("200")); + await tranches[0].approve(perp.target, toFixedPtAmt("200")); + await perp.deposit(tranches[0].target, toFixedPtAmt("200")); reserveTranches.push(tranches[0]); await advancePerpQueue(perp, 1200); } - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, ...reserveTranches], ["0", toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200")], ); - rolloverInBond = await bondAt(await perp.callStatic.getDepositBond()); + rolloverInBond = await bondAt(await perp.getDepositBond.staticCall()); rolloverInTranches = await getTranches(rolloverInBond); await mintCollteralToken(collateralToken, toFixedPtAmt("100000"), deployer); - await collateralToken.approve(vault.address, toFixedPtAmt("1")); + await collateralToken.approve(vault.target, toFixedPtAmt("1")); expect(await vault.assetCount()).to.eq(1); expect(await vault.vaultAssetBalance(await vault.underlying())).to.eq(0); @@ -114,125 +122,125 @@ describe("RolloverVault", function () { describe("#getTVL", function () { describe("when vault is empty", function () { it("should return 0 vaule", async function () { - expect(await vault.callStatic.getTVL()).to.eq(0); - expect(await vault.callStatic.getVaultAssetValue(collateralToken.address)).to.eq(0); - expect(await vault.callStatic.getVaultAssetValue(perp.address)).to.eq(0); + expect(await vault.getTVL.staticCall()).to.eq(0); + expect(await vault.getVaultAssetValue.staticCall(collateralToken.target)).to.eq(0); + expect(await vault.getVaultAssetValue.staticCall(perp.target)).to.eq(0); }); }); describe("when vault has only usable balance", function () { beforeEach(async function () { - await collateralToken.transfer(vault.address, toFixedPtAmt("100")); + await collateralToken.transfer(vault.target, toFixedPtAmt("100")); }); it("should return tvl", async function () { - expect(await vault.callStatic.getTVL()).to.eq(toFixedPtAmt("100")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("100")); }); it("should return asset value", async function () { - expect(await vault.callStatic.getVaultAssetValue(collateralToken.address)).to.eq(toFixedPtAmt("100")); - expect(await vault.callStatic.getVaultAssetValue(perp.address)).to.eq(0); + expect(await vault.getVaultAssetValue.staticCall(collateralToken.target)).to.eq(toFixedPtAmt("100")); + expect(await vault.getVaultAssetValue.staticCall(perp.target)).to.eq(0); }); }); describe("when vault has only deployed balance", function () { beforeEach(async function () { - await collateralToken.transfer(vault.address, toFixedPtAmt("100")); + await collateralToken.transfer(vault.target, toFixedPtAmt("100")); await vault.deploy(); expect(await vault.vaultAssetBalance(await vault.underlying())).to.eq(0); expect(await vault.assetCount()).to.eq(3); }); it("should return tvl", async function () { - expect(await vault.callStatic.getTVL()).to.eq(toFixedPtAmt("100")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("100")); }); it("should return asset value", async function () { - expect(await vault.callStatic.getVaultAssetValue(collateralToken.address)).to.eq(0); - expect(await vault.callStatic.getVaultAssetValue(reserveTranches[0].address)).to.eq(toFixedPtAmt("20")); - expect(await vault.callStatic.getVaultAssetValue(rolloverInTranches[1].address)).to.eq(toFixedPtAmt("80")); - expect(await vault.callStatic.getVaultAssetValue(perp.address)).to.eq(0); + expect(await vault.getVaultAssetValue.staticCall(collateralToken.target)).to.eq(0); + expect(await vault.getVaultAssetValue.staticCall(reserveTranches[0].target)).to.eq(toFixedPtAmt("20")); + expect(await vault.getVaultAssetValue.staticCall(rolloverInTranches[1].target)).to.eq(toFixedPtAmt("80")); + expect(await vault.getVaultAssetValue.staticCall(perp.target)).to.eq(0); }); }); describe("when vault has many balances", function () { beforeEach(async function () { - await perp.transfer(vault.address, toFixedPtAmt("100")); - await collateralToken.transfer(vault.address, toFixedPtAmt("2000")); + await perp.transfer(vault.target, toFixedPtAmt("100")); + await collateralToken.transfer(vault.target, toFixedPtAmt("2000")); await vault.deploy(); - await collateralToken.transfer(vault.address, toFixedPtAmt("100")); + await collateralToken.transfer(vault.target, toFixedPtAmt("100")); }); it("should return tvl", async function () { - expect(await vault.callStatic.getTVL()).to.eq(toFixedPtAmt("2100")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("2100")); }); it("should return asset value", async function () { - expect(await vault.callStatic.getVaultAssetValue(perp.address)).to.eq("0"); - expect(await vault.callStatic.getVaultAssetValue(collateralToken.address)).to.eq(toFixedPtAmt("1100")); - expect(await vault.callStatic.getVaultAssetValue(reserveTranches[0].address)).to.eq(toFixedPtAmt("200")); - expect(await vault.callStatic.getVaultAssetValue(rolloverInTranches[1].address)).to.eq(toFixedPtAmt("800")); + expect(await vault.getVaultAssetValue.staticCall(perp.target)).to.eq("0"); + expect(await vault.getVaultAssetValue.staticCall(collateralToken.target)).to.eq(toFixedPtAmt("1100")); + expect(await vault.getVaultAssetValue.staticCall(reserveTranches[0].target)).to.eq(toFixedPtAmt("200")); + expect(await vault.getVaultAssetValue.staticCall(rolloverInTranches[1].target)).to.eq(toFixedPtAmt("800")); }); }); describe("when vault has many balances and rebases up", function () { beforeEach(async function () { - await collateralToken.transfer(vault.address, toFixedPtAmt("2000")); + await collateralToken.transfer(vault.target, toFixedPtAmt("2000")); await vault.deploy(); - await collateralToken.transfer(vault.address, toFixedPtAmt("100")); + await collateralToken.transfer(vault.target, toFixedPtAmt("100")); await rebase(collateralToken, rebaseOracle, 0.1); }); it("should return tvl", async function () { - expect(await vault.callStatic.getTVL()).to.eq(toFixedPtAmt("2310")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("2310")); }); it("should return asset value", async function () { - expect(await vault.callStatic.getVaultAssetValue(collateralToken.address)).to.eq(toFixedPtAmt("1210")); - expect(await vault.callStatic.getVaultAssetValue(reserveTranches[0].address)).to.eq(toFixedPtAmt("200")); - expect(await vault.callStatic.getVaultAssetValue(rolloverInTranches[1].address)).to.eq(toFixedPtAmt("900")); + expect(await vault.getVaultAssetValue.staticCall(collateralToken.target)).to.eq(toFixedPtAmt("1210")); + expect(await vault.getVaultAssetValue.staticCall(reserveTranches[0].target)).to.eq(toFixedPtAmt("200")); + expect(await vault.getVaultAssetValue.staticCall(rolloverInTranches[1].target)).to.eq(toFixedPtAmt("900")); }); }); describe("when vault has many balances and rebases down", function () { beforeEach(async function () { - await collateralToken.transfer(vault.address, toFixedPtAmt("2000")); + await collateralToken.transfer(vault.target, toFixedPtAmt("2000")); await vault.deploy(); - await collateralToken.transfer(vault.address, toFixedPtAmt("100")); + await collateralToken.transfer(vault.target, toFixedPtAmt("100")); await rebase(collateralToken, rebaseOracle, -0.1); }); it("should return tvl", async function () { - expect(await vault.callStatic.getTVL()).to.eq(toFixedPtAmt("1890")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("1890")); }); it("should return asset value", async function () { - expect(await vault.callStatic.getVaultAssetValue(collateralToken.address)).to.eq(toFixedPtAmt("990")); - expect(await vault.callStatic.getVaultAssetValue(reserveTranches[0].address)).to.eq(toFixedPtAmt("200")); - expect(await vault.callStatic.getVaultAssetValue(rolloverInTranches[1].address)).to.eq(toFixedPtAmt("700")); + expect(await vault.getVaultAssetValue.staticCall(collateralToken.target)).to.eq(toFixedPtAmt("990")); + expect(await vault.getVaultAssetValue.staticCall(reserveTranches[0].target)).to.eq(toFixedPtAmt("200")); + expect(await vault.getVaultAssetValue.staticCall(rolloverInTranches[1].target)).to.eq(toFixedPtAmt("700")); }); }); describe("when vault has many balances and rebases down below threshold", function () { beforeEach(async function () { - await collateralToken.transfer(vault.address, toFixedPtAmt("5000")); + await collateralToken.transfer(vault.target, toFixedPtAmt("5000")); await vault.deploy(); - await collateralToken.transfer(vault.address, toFixedPtAmt("100")); + await collateralToken.transfer(vault.target, toFixedPtAmt("100")); await rebase(collateralToken, rebaseOracle, -0.9); }); it("should return tvl", async function () { - expect(await vault.callStatic.getTVL()).to.eq(toFixedPtAmt("510")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("510")); }); it("should return asset value", async function () { - expect(await vault.callStatic.getVaultAssetValue(collateralToken.address)).to.eq(toFixedPtAmt("410")); - expect(await vault.callStatic.getVaultAssetValue(reserveTranches[0].address)).to.eq(toFixedPtAmt("100")); - expect(await vault.callStatic.getVaultAssetValue(reserveTranches[1].address)).to.eq("0"); - expect(await vault.callStatic.getVaultAssetValue(reserveTranches[2].address)).to.eq("0"); - expect(await vault.callStatic.getVaultAssetValue(rolloverInTranches[0].address)).to.eq(toFixedPtAmt("0")); - expect(await vault.callStatic.getVaultAssetValue(rolloverInTranches[1].address)).to.eq("0"); + expect(await vault.getVaultAssetValue.staticCall(collateralToken.target)).to.eq(toFixedPtAmt("410")); + expect(await vault.getVaultAssetValue.staticCall(reserveTranches[0].target)).to.eq(toFixedPtAmt("100")); + expect(await vault.getVaultAssetValue.staticCall(reserveTranches[1].target)).to.eq("0"); + expect(await vault.getVaultAssetValue.staticCall(reserveTranches[2].target)).to.eq("0"); + expect(await vault.getVaultAssetValue.staticCall(rolloverInTranches[0].target)).to.eq(toFixedPtAmt("0")); + expect(await vault.getVaultAssetValue.staticCall(rolloverInTranches[1].target)).to.eq("0"); }); }); describe("when vault has some dust balances", function () { beforeEach(async function () { - await perp.transfer(vault.address, toFixedPtAmt("100")); - await collateralToken.transfer(vault.address, toFixedPtAmt("2000")); + await perp.transfer(vault.target, toFixedPtAmt("100")); + await collateralToken.transfer(vault.target, toFixedPtAmt("2000")); await vault.deploy(); - await vault["recover(address)"](perp.address); - await collateralToken.transfer(vault.address, toFixedPtAmt("100")); - await checkVaultAssetComposition( + await vault["recover(address)"](perp.target); + await collateralToken.transfer(vault.target, toFixedPtAmt("100")); + await checkVaultComposition( vault, [ collateralToken, @@ -254,27 +262,27 @@ describe("RolloverVault", function () { }); it("should return tvl excluding the dust", async function () { // balances sum up to 2200 but tvl will exclude 0.000000000000000133 - expect(await vault.callStatic.getTVL()).to.eq(toFixedPtAmt("2199.999999999999999866")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("2199.999999999999999866")); }); it("should return asset value", async function () { - expect(await vault.callStatic.getVaultAssetValue(perp.address)).to.eq("0"); - expect(await vault.callStatic.getVaultAssetValue(collateralToken.address)).to.eq( + expect(await vault.getVaultAssetValue.staticCall(perp.target)).to.eq("0"); + expect(await vault.getVaultAssetValue.staticCall(collateralToken.target)).to.eq( toFixedPtAmt("1266.666666666666666"), ); - expect(await vault.callStatic.getVaultAssetValue(reserveTranches[0].address)).to.eq(toFixedPtAmt("200")); - expect(await vault.callStatic.getVaultAssetValue(reserveTranches[1].address)).to.eq( + expect(await vault.getVaultAssetValue.staticCall(reserveTranches[0].target)).to.eq(toFixedPtAmt("200")); + expect(await vault.getVaultAssetValue.staticCall(reserveTranches[1].target)).to.eq( toFixedPtAmt("33.333333333333333333"), ); - expect(await vault.callStatic.getVaultAssetValue(reserveTranches[2].address)).to.eq( + expect(await vault.getVaultAssetValue.staticCall(reserveTranches[2].target)).to.eq( toFixedPtAmt("33.333333333333333333"), ); - expect(await vault.callStatic.getVaultAssetValue(rolloverInTranches[1].address)).to.eq( + expect(await vault.getVaultAssetValue.staticCall(rolloverInTranches[1].target)).to.eq( toFixedPtAmt("666.6666666666666672"), ); }); it("should return no asset value for dust", async function () { - expect(await rolloverInTranches[0].balanceOf(vault.address)).eq("133"); - expect(await vault.callStatic.getVaultAssetValue(rolloverInTranches[0].address)).to.eq("0"); + expect(await rolloverInTranches[0].balanceOf(vault.target)).eq("133"); + expect(await vault.getVaultAssetValue.staticCall(rolloverInTranches[0].target)).to.eq("0"); }); }); }); @@ -284,14 +292,14 @@ describe("RolloverVault", function () { describe("when deposit amount is zero", async function () { it("should return zero", async function () { - expect(await vault.callStatic.deposit("0")).to.eq("0"); + expect(await vault.deposit.staticCall("0")).to.eq("0"); }); }); describe("when total supply = 0", async function () { beforeEach(async function () { - await collateralToken.approve(vault.address, toFixedPtAmt("100")); - noteAmt = await vault.callStatic.deposit(toFixedPtAmt("100")); + await collateralToken.approve(vault.target, toFixedPtAmt("100")); + noteAmt = await vault.deposit.staticCall(toFixedPtAmt("100")); }); it("should transfer underlying", async function () { await expect(() => vault.deposit(toFixedPtAmt("100"))).to.changeTokenBalances( @@ -301,25 +309,25 @@ describe("RolloverVault", function () { ); }); it("should update vault", async function () { - await checkVaultAssetComposition(vault, [collateralToken], ["0"]); + await checkVaultComposition(vault, [collateralToken], ["0"]); await vault.deposit(toFixedPtAmt("100")); - await checkVaultAssetComposition(vault, [collateralToken], [toFixedPtAmt("100")]); + await checkVaultComposition(vault, [collateralToken], [toFixedPtAmt("100")]); }); it("should mint notes", async function () { await expect(() => vault.deposit(toFixedPtAmt("100"))).to.changeTokenBalances(vault, [deployer], [noteAmt]); }); it("should return the note amount", async function () { - expect(noteAmt).to.eq(toFixedPtAmt("100").mul("1000000")); + expect(noteAmt).to.eq(toFixedPtAmt("100") * 1000000n); }); }); describe("when total supply > 0 and tvl = ts", async function () { beforeEach(async function () { - await collateralToken.approve(vault.address, toFixedPtAmt("100")); + await collateralToken.approve(vault.target, toFixedPtAmt("100")); await vault.deposit(toFixedPtAmt("100")); await collateralToken.transfer(otherUserAddress, toFixedPtAmt("100")); - await collateralToken.connect(otherUser).approve(vault.address, toFixedPtAmt("100")); - noteAmt = await vault.connect(otherUser).callStatic.deposit(toFixedPtAmt("100")); + await collateralToken.connect(otherUser).approve(vault.target, toFixedPtAmt("100")); + noteAmt = await vault.connect(otherUser).deposit.staticCall(toFixedPtAmt("100")); }); it("should transfer underlying", async function () { await expect(() => vault.connect(otherUser).deposit(toFixedPtAmt("100"))).to.changeTokenBalances( @@ -330,9 +338,9 @@ describe("RolloverVault", function () { }); it("should update vault", async function () { - await checkVaultAssetComposition(vault, [collateralToken], [toFixedPtAmt("100")]); + await checkVaultComposition(vault, [collateralToken], [toFixedPtAmt("100")]); await vault.connect(otherUser).deposit(toFixedPtAmt("100")); - await checkVaultAssetComposition(vault, [collateralToken], [toFixedPtAmt("200")]); + await checkVaultComposition(vault, [collateralToken], [toFixedPtAmt("200")]); }); it("should mint notes", async function () { @@ -343,18 +351,18 @@ describe("RolloverVault", function () { ); }); it("should return the note amount", async function () { - expect(noteAmt).to.eq(toFixedPtAmt("100").mul("1000000")); + expect(noteAmt).to.eq(toFixedPtAmt("100") * 1000000n); }); }); describe("when total supply > 0 and tvl > ts", async function () { beforeEach(async function () { - await collateralToken.approve(vault.address, toFixedPtAmt("100")); + await collateralToken.approve(vault.target, toFixedPtAmt("100")); await vault.deposit(toFixedPtAmt("100")); - await collateralToken.transfer(vault.address, toFixedPtAmt("100")); + await collateralToken.transfer(vault.target, toFixedPtAmt("100")); await collateralToken.transfer(otherUserAddress, toFixedPtAmt("100")); - await collateralToken.connect(otherUser).approve(vault.address, toFixedPtAmt("100")); - noteAmt = await vault.connect(otherUser).callStatic.deposit(toFixedPtAmt("100")); + await collateralToken.connect(otherUser).approve(vault.target, toFixedPtAmt("100")); + noteAmt = await vault.connect(otherUser).deposit.staticCall(toFixedPtAmt("100")); }); it("should transfer underlying", async function () { @@ -366,9 +374,9 @@ describe("RolloverVault", function () { }); it("should update vault", async function () { - await checkVaultAssetComposition(vault, [collateralToken], [toFixedPtAmt("200")]); + await checkVaultComposition(vault, [collateralToken], [toFixedPtAmt("200")]); await vault.connect(otherUser).deposit(toFixedPtAmt("100")); - await checkVaultAssetComposition(vault, [collateralToken], [toFixedPtAmt("300")]); + await checkVaultComposition(vault, [collateralToken], [toFixedPtAmt("300")]); }); it("should mint notes", async function () { @@ -379,18 +387,18 @@ describe("RolloverVault", function () { ); }); it("should return the note amount", async function () { - expect(noteAmt).to.eq(toFixedPtAmt("100").mul("500000")); + expect(noteAmt).to.eq(toFixedPtAmt("100") * 500000n); }); }); describe("when total supply > 0 and tvl < ts", async function () { beforeEach(async function () { - await collateralToken.approve(vault.address, toFixedPtAmt("100")); + await collateralToken.approve(vault.target, toFixedPtAmt("100")); await vault.deposit(toFixedPtAmt("100")); await rebase(collateralToken, rebaseOracle, -0.5); await collateralToken.transfer(otherUserAddress, toFixedPtAmt("100")); - await collateralToken.connect(otherUser).approve(vault.address, toFixedPtAmt("100")); - noteAmt = await vault.connect(otherUser).callStatic.deposit(toFixedPtAmt("100")); + await collateralToken.connect(otherUser).approve(vault.target, toFixedPtAmt("100")); + noteAmt = await vault.connect(otherUser).deposit.staticCall(toFixedPtAmt("100")); }); it("should transfer underlying", async function () { @@ -402,9 +410,9 @@ describe("RolloverVault", function () { }); it("should update vault", async function () { - await checkVaultAssetComposition(vault, [collateralToken], [toFixedPtAmt("50")]); + await checkVaultComposition(vault, [collateralToken], [toFixedPtAmt("50")]); await vault.connect(otherUser).deposit(toFixedPtAmt("100")); - await checkVaultAssetComposition(vault, [collateralToken], [toFixedPtAmt("150")]); + await checkVaultComposition(vault, [collateralToken], [toFixedPtAmt("150")]); }); it("should mint notes", async function () { @@ -416,17 +424,17 @@ describe("RolloverVault", function () { }); it("should return the note amount", async function () { - expect(noteAmt).to.eq(toFixedPtAmt("100").mul("2000000")); + expect(noteAmt).to.eq(toFixedPtAmt("100") * 2000000n); }); }); describe("when total supply > 0 and vault has deployed assets", async function () { beforeEach(async function () { - await collateralToken.approve(vault.address, toFixedPtAmt("100")); + await collateralToken.approve(vault.target, toFixedPtAmt("100")); await vault.deposit(toFixedPtAmt("100")); await collateralToken.transfer(otherUserAddress, toFixedPtAmt("100")); - await collateralToken.connect(otherUser).approve(vault.address, toFixedPtAmt("100")); - noteAmt = await vault.connect(otherUser).callStatic.deposit(toFixedPtAmt("100")); + await collateralToken.connect(otherUser).approve(vault.target, toFixedPtAmt("100")); + noteAmt = await vault.connect(otherUser).deposit.staticCall(toFixedPtAmt("100")); }); it("should transfer underlying", async function () { await expect(() => vault.connect(otherUser).deposit(toFixedPtAmt("100"))).to.changeTokenBalances( @@ -437,9 +445,9 @@ describe("RolloverVault", function () { }); it("should update vault", async function () { - await checkVaultAssetComposition(vault, [collateralToken], [toFixedPtAmt("100")]); + await checkVaultComposition(vault, [collateralToken], [toFixedPtAmt("100")]); await vault.connect(otherUser).deposit(toFixedPtAmt("100")); - await checkVaultAssetComposition(vault, [collateralToken], [toFixedPtAmt("200")]); + await checkVaultComposition(vault, [collateralToken], [toFixedPtAmt("200")]); }); it("should mint notes", async function () { @@ -450,19 +458,30 @@ describe("RolloverVault", function () { ); }); it("should return the note amount", async function () { - expect(noteAmt).to.eq(toFixedPtAmt("100").mul("1000000")); + expect(noteAmt).to.eq(toFixedPtAmt("100") * 1000000n); }); }); describe("fee > 0", async function () { beforeEach(async function () { - await collateralToken.approve(vault.address, toFixedPtAmt("100")); + await collateralToken.approve(vault.target, toFixedPtAmt("100")); await vault.deposit(toFixedPtAmt("100")); - await feePolicy.computeVaultMintFeePerc.returns(toPercFixedPtAmt("0.05")); + await feePolicy.clearMockMethod("computeDeviationRatio((uint256,uint256))"); + await feePolicy.mockCall( + "computeDeviationRatio((uint256,uint256))", + [[toFixedPtAmt("600"), toFixedPtAmt("100")]], + [toPercFixedPtAmt("1")], + ); + await feePolicy.mockCall( + "computeDeviationRatio((uint256,uint256))", + [[toFixedPtAmt("600"), toFixedPtAmt("200")]], + [toPercFixedPtAmt("1")], + ); + await feePolicy.mockMethod("computeFeePerc(uint256,uint256)", [toPercFixedPtAmt("0.05")]); await collateralToken.transfer(otherUserAddress, toFixedPtAmt("100")); - await collateralToken.connect(otherUser).approve(vault.address, toFixedPtAmt("100")); - noteAmt = await vault.connect(otherUser).callStatic.deposit(toFixedPtAmt("100")); + await collateralToken.connect(otherUser).approve(vault.target, toFixedPtAmt("100")); + noteAmt = await vault.connect(otherUser).deposit.staticCall(toFixedPtAmt("100")); }); it("should transfer underlying", async function () { await expect(() => vault.connect(otherUser).deposit(toFixedPtAmt("100"))).to.changeTokenBalances( @@ -472,9 +491,9 @@ describe("RolloverVault", function () { ); }); it("should update vault", async function () { - await checkVaultAssetComposition(vault, [collateralToken], [toFixedPtAmt("100")]); + await checkVaultComposition(vault, [collateralToken], [toFixedPtAmt("100")]); await vault.connect(otherUser).deposit(toFixedPtAmt("100")); - await checkVaultAssetComposition(vault, [collateralToken], [toFixedPtAmt("200")]); + await checkVaultComposition(vault, [collateralToken], [toFixedPtAmt("200")]); }); it("should mint notes", async function () { @@ -485,7 +504,7 @@ describe("RolloverVault", function () { ); }); it("should return the note amount", async function () { - expect(noteAmt).to.eq(toFixedPtAmt("95").mul("1000000")); + expect(noteAmt).to.eq(toFixedPtAmt("95") * 1000000n); }); }); }); @@ -501,34 +520,34 @@ describe("RolloverVault", function () { describe("when redeem amount is zero", async function () { beforeEach(async function () { - await collateralToken.approve(vault.address, toFixedPtAmt("100")); + await collateralToken.approve(vault.target, toFixedPtAmt("100")); await vault.deposit(toFixedPtAmt("100")); }); it("should return []", async function () { - expect(await vault.callStatic.redeem("0")).to.deep.eq([]); + expect(await vault.redeem.staticCall("0")).to.deep.eq([]); }); }); describe("when burning more than balance", function () { beforeEach(async function () { - await collateralToken.approve(vault.address, toFixedPtAmt("100")); + await collateralToken.approve(vault.target, toFixedPtAmt("100")); await vault.deposit(toFixedPtAmt("100")); }); it("should revert", async function () { - await expect(vault.redeem((await vault.balanceOf(deployerAddress)).add("1"))).to.be.reverted; + await expect(vault.redeem((await vault.balanceOf(deployerAddress)) + 1n)).to.be.reverted; await expect(vault.redeem(await vault.balanceOf(deployerAddress))).not.to.be.reverted; }); }); describe("when vault has only underlying balance", function () { beforeEach(async function () { - await collateralToken.approve(vault.address, toFixedPtAmt("100")); + await collateralToken.approve(vault.target, toFixedPtAmt("100")); await vault.deposit(toFixedPtAmt("100")); await collateralToken.transfer(otherUserAddress, toFixedPtAmt("100")); - await collateralToken.connect(otherUser).approve(vault.address, toFixedPtAmt("100")); + await collateralToken.connect(otherUser).approve(vault.target, toFixedPtAmt("100")); await vault.connect(otherUser).deposit(toFixedPtAmt("100")); bal = await vault.balanceOf(deployerAddress); @@ -543,20 +562,20 @@ describe("RolloverVault", function () { }); it("should update vault", async function () { - await checkVaultAssetComposition(vault, [collateralToken], [toFixedPtAmt("200")]); + await checkVaultComposition(vault, [collateralToken], [toFixedPtAmt("200")]); await vault.redeem(bal); - await checkVaultAssetComposition(vault, [collateralToken], [toFixedPtAmt("100")]); + await checkVaultComposition(vault, [collateralToken], [toFixedPtAmt("100")]); }); it("should burn users notes", async function () { - await expect(() => vault.redeem(bal)).to.changeTokenBalances(vault, [deployer], [bal.mul("-1")]); - expect(await vault.balanceOf(otherUserAddress)).to.eq(toFixedPtAmt("100").mul("1000000")); + await expect(() => vault.redeem(bal)).to.changeTokenBalances(vault, [deployer], [bal * -1n]); + expect(await vault.balanceOf(otherUserAddress)).to.eq(toFixedPtAmt("100") * 1000000n); }); it("should return redemption amounts", async function () { - const redemptionAmts = await vault.callStatic.redeem(bal); + const redemptionAmts = await vault.redeem.staticCall(bal); expect(redemptionAmts.length).to.eq(1); - expect(redemptionAmts[0].token).to.eq(collateralToken.address); + expect(redemptionAmts[0].token).to.eq(collateralToken.target); expect(redemptionAmts[0].amount).to.eq(toFixedPtAmt("100")); }); }); @@ -564,11 +583,11 @@ describe("RolloverVault", function () { describe("when vault has only deployed balance", function () { let bal: BigNumber; beforeEach(async function () { - await collateralToken.approve(vault.address, toFixedPtAmt("100")); + await collateralToken.approve(vault.target, toFixedPtAmt("100")); await vault.deposit(toFixedPtAmt("100")); await collateralToken.transfer(otherUserAddress, toFixedPtAmt("100")); - await collateralToken.connect(otherUser).approve(vault.address, toFixedPtAmt("100")); + await collateralToken.connect(otherUser).approve(vault.target, toFixedPtAmt("100")); await vault.connect(otherUser).deposit(toFixedPtAmt("100")); await vault.deploy(); @@ -596,13 +615,13 @@ describe("RolloverVault", function () { }); it("should update vault", async function () { - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, reserveTranches[0], rolloverInTranches[1]], ["0", toFixedPtAmt("40"), toFixedPtAmt("160")], ); await vault.redeem(bal); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, reserveTranches[0], rolloverInTranches[1]], ["0", toFixedPtAmt("20"), toFixedPtAmt("80")], @@ -610,18 +629,18 @@ describe("RolloverVault", function () { }); it("should burn users notes", async function () { - await expect(() => vault.redeem(bal)).to.changeTokenBalances(vault, [deployer], [bal.mul("-1")]); - expect(await vault.balanceOf(otherUserAddress)).to.eq(toFixedPtAmt("100").mul("1000000")); + await expect(() => vault.redeem(bal)).to.changeTokenBalances(vault, [deployer], [bal * -1n]); + expect(await vault.balanceOf(otherUserAddress)).to.eq(toFixedPtAmt("100") * 1000000n); }); it("should return redemption amounts", async function () { - const redemptionAmts = await vault.callStatic.redeem(bal); + const redemptionAmts = await vault.redeem.staticCall(bal); expect(redemptionAmts.length).to.eq(3); - expect(redemptionAmts[0].token).to.eq(collateralToken.address); + expect(redemptionAmts[0].token).to.eq(collateralToken.target); expect(redemptionAmts[0].amount).to.eq(0); - expect(redemptionAmts[1].token).to.eq(reserveTranches[0].address); + expect(redemptionAmts[1].token).to.eq(reserveTranches[0].target); expect(redemptionAmts[1].amount).to.eq(toFixedPtAmt("20")); - expect(redemptionAmts[2].token).to.eq(rolloverInTranches[1].address); + expect(redemptionAmts[2].token).to.eq(rolloverInTranches[1].target); expect(redemptionAmts[2].amount).to.eq(toFixedPtAmt("80")); }); }); @@ -629,17 +648,17 @@ describe("RolloverVault", function () { describe("when vault has a combination of balances (full balance redemption)", function () { let redemptionAmts: [string, BigNumber][]; beforeEach(async function () { - await collateralToken.approve(vault.address, toFixedPtAmt("100")); + await collateralToken.approve(vault.target, toFixedPtAmt("100")); await vault.deposit(toFixedPtAmt("100")); await collateralToken.transfer(otherUserAddress, toFixedPtAmt("100")); - await collateralToken.connect(otherUser).approve(vault.address, toFixedPtAmt("100")); + await collateralToken.connect(otherUser).approve(vault.target, toFixedPtAmt("100")); await vault.connect(otherUser).deposit(toFixedPtAmt("100")); await vault.deploy(); - await collateralToken.transfer(vault.address, toFixedPtAmt("20")); + await collateralToken.transfer(vault.target, toFixedPtAmt("20")); - redemptionAmts = await vault.callStatic.redeem(await vault.balanceOf(deployerAddress)); + redemptionAmts = await vault.redeem.staticCall(await vault.balanceOf(deployerAddress)); bal = await vault.balanceOf(deployerAddress); }); @@ -668,13 +687,13 @@ describe("RolloverVault", function () { }); it("should update vault", async function () { - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, reserveTranches[0], rolloverInTranches[1]], [toFixedPtAmt("20"), toFixedPtAmt("40"), toFixedPtAmt("160")], ); await vault.redeem(bal); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, reserveTranches[0], rolloverInTranches[1]], [toFixedPtAmt("10"), toFixedPtAmt("20"), toFixedPtAmt("80")], @@ -682,34 +701,34 @@ describe("RolloverVault", function () { }); it("should burn users notes", async function () { - await expect(() => vault.redeem(bal)).to.changeTokenBalances(vault, [deployer], [bal.mul("-1")]); - expect(await vault.balanceOf(otherUserAddress)).to.eq(toFixedPtAmt("100").mul("1000000")); + await expect(() => vault.redeem(bal)).to.changeTokenBalances(vault, [deployer], [bal * -1n]); + expect(await vault.balanceOf(otherUserAddress)).to.eq(toFixedPtAmt("100") * 1000000n); }); it("should return redemption amounts", async function () { expect(redemptionAmts.length).to.eq(3); - expect(redemptionAmts[0].token).to.eq(collateralToken.address); + expect(redemptionAmts[0].token).to.eq(collateralToken.target); expect(redemptionAmts[0].amount).to.eq(toFixedPtAmt("10")); - expect(redemptionAmts[1].token).to.eq(reserveTranches[0].address); + expect(redemptionAmts[1].token).to.eq(reserveTranches[0].target); expect(redemptionAmts[1].amount).to.eq(toFixedPtAmt("20")); - expect(redemptionAmts[2].token).to.eq(rolloverInTranches[1].address); + expect(redemptionAmts[2].token).to.eq(rolloverInTranches[1].target); expect(redemptionAmts[2].amount).to.eq(toFixedPtAmt("80")); }); }); describe("when vault has a combination of balances (partial balance redemption)", function () { beforeEach(async function () { - await collateralToken.approve(vault.address, toFixedPtAmt("100")); + await collateralToken.approve(vault.target, toFixedPtAmt("100")); await vault.deposit(toFixedPtAmt("100")); await collateralToken.transfer(otherUserAddress, toFixedPtAmt("100")); - await collateralToken.connect(otherUser).approve(vault.address, toFixedPtAmt("100")); + await collateralToken.connect(otherUser).approve(vault.target, toFixedPtAmt("100")); await vault.connect(otherUser).deposit(toFixedPtAmt("100")); await vault.deploy(); - await collateralToken.transfer(vault.address, toFixedPtAmt("20")); + await collateralToken.transfer(vault.target, toFixedPtAmt("20")); - bal = toFixedPtAmt("50").mul("1000000"); + bal = toFixedPtAmt("50") * 1000000n; }); it("should transfer assets", async function () { @@ -737,13 +756,13 @@ describe("RolloverVault", function () { }); it("should update vault", async function () { - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, reserveTranches[0], rolloverInTranches[1]], [toFixedPtAmt("20"), toFixedPtAmt("40"), toFixedPtAmt("160")], ); await vault.redeem(bal); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, reserveTranches[0], rolloverInTranches[1]], [toFixedPtAmt("15"), toFixedPtAmt("30"), toFixedPtAmt("120")], @@ -751,37 +770,47 @@ describe("RolloverVault", function () { }); it("should burn users notes", async function () { - await expect(() => vault.redeem(bal)).to.changeTokenBalances(vault, [deployer], [bal.mul("-1")]); - expect(await vault.balanceOf(otherUserAddress)).to.eq(toFixedPtAmt("100").mul("1000000")); + await expect(() => vault.redeem(bal)).to.changeTokenBalances(vault, [deployer], [bal * -1n]); + expect(await vault.balanceOf(otherUserAddress)).to.eq(toFixedPtAmt("100") * 1000000n); }); it("should return redemption amounts", async function () { - const redemptionAmts = await vault.callStatic.redeem(bal); + const redemptionAmts = await vault.redeem.staticCall(bal); expect(redemptionAmts.length).to.eq(3); - expect(redemptionAmts[0].token).to.eq(collateralToken.address); + expect(redemptionAmts[0].token).to.eq(collateralToken.target); expect(redemptionAmts[0].amount).to.eq(toFixedPtAmt("5")); - expect(redemptionAmts[1].token).to.eq(reserveTranches[0].address); + expect(redemptionAmts[1].token).to.eq(reserveTranches[0].target); expect(redemptionAmts[1].amount).to.eq(toFixedPtAmt("10")); - expect(redemptionAmts[2].token).to.eq(rolloverInTranches[1].address); + expect(redemptionAmts[2].token).to.eq(rolloverInTranches[1].target); expect(redemptionAmts[2].amount).to.eq(toFixedPtAmt("40")); }); }); describe("when fee > 0", function () { beforeEach(async function () { - await collateralToken.approve(vault.address, toFixedPtAmt("100")); + await collateralToken.approve(vault.target, toFixedPtAmt("100")); await vault.deposit(toFixedPtAmt("100")); await collateralToken.transfer(otherUserAddress, toFixedPtAmt("100")); - await collateralToken.connect(otherUser).approve(vault.address, toFixedPtAmt("100")); + await collateralToken.connect(otherUser).approve(vault.target, toFixedPtAmt("100")); await vault.connect(otherUser).deposit(toFixedPtAmt("100")); await vault.deploy(); - await collateralToken.transfer(vault.address, toFixedPtAmt("20")); - - bal = toFixedPtAmt("50").mul("1000000"); + await collateralToken.transfer(vault.target, toFixedPtAmt("20")); - await feePolicy.computeVaultBurnFeePerc.returns(toPercFixedPtAmt("0.1")); + bal = toFixedPtAmt("50") * 1000000n; + await feePolicy.clearMockMethod("computeDeviationRatio((uint256,uint256))"); + await feePolicy.mockCall( + "computeDeviationRatio((uint256,uint256))", + [[toFixedPtAmt("600"), toFixedPtAmt("220")]], + [toPercFixedPtAmt("1")], + ); + await feePolicy.mockCall( + "computeDeviationRatio((uint256,uint256))", + [[toFixedPtAmt("600"), toFixedPtAmt("165")]], + [toPercFixedPtAmt("1")], + ); + await feePolicy.mockMethod("computeFeePerc(uint256,uint256)", [toPercFixedPtAmt("0.1")]); }); it("should transfer assets", async function () { @@ -809,13 +838,13 @@ describe("RolloverVault", function () { }); it("should update vault", async function () { - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, reserveTranches[0], rolloverInTranches[1]], [toFixedPtAmt("20"), toFixedPtAmt("40"), toFixedPtAmt("160")], ); await vault.redeem(bal); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, reserveTranches[0], rolloverInTranches[1]], [toFixedPtAmt("15.5"), toFixedPtAmt("31"), toFixedPtAmt("124")], @@ -823,85 +852,20 @@ describe("RolloverVault", function () { }); it("should burn users notes", async function () { - await expect(() => vault.redeem(bal)).to.changeTokenBalances(vault, [deployer], [bal.mul("-1")]); - expect(await vault.balanceOf(otherUserAddress)).to.eq(toFixedPtAmt("100").mul("1000000")); + await expect(() => vault.redeem(bal)).to.changeTokenBalances(vault, [deployer], [bal * -1n]); + expect(await vault.balanceOf(otherUserAddress)).to.eq(toFixedPtAmt("100") * 1000000n); }); it("should return redemption amounts", async function () { - const redemptionAmts = await vault.callStatic.redeem(bal); + const redemptionAmts = await vault.redeem.staticCall(bal); expect(redemptionAmts.length).to.eq(3); - expect(redemptionAmts[0].token).to.eq(collateralToken.address); + expect(redemptionAmts[0].token).to.eq(collateralToken.target); expect(redemptionAmts[0].amount).to.eq(toFixedPtAmt("4.5")); - expect(redemptionAmts[1].token).to.eq(reserveTranches[0].address); + expect(redemptionAmts[1].token).to.eq(reserveTranches[0].target); expect(redemptionAmts[1].amount).to.eq(toFixedPtAmt("9")); - expect(redemptionAmts[2].token).to.eq(rolloverInTranches[1].address); + expect(redemptionAmts[2].token).to.eq(rolloverInTranches[1].target); expect(redemptionAmts[2].amount).to.eq(toFixedPtAmt("36")); }); }); }); - - describe("#recoverAndRedeem", function () { - let bal: BigNumber; - beforeEach(async function () { - await collateralToken.approve(vault.address, toFixedPtAmt("100")); - await vault.deposit(toFixedPtAmt("100")); - - await collateralToken.transfer(otherUserAddress, toFixedPtAmt("100")); - await collateralToken.connect(otherUser).approve(vault.address, toFixedPtAmt("100")); - await vault.connect(otherUser).deposit(toFixedPtAmt("100")); - - await vault.deploy(); - await collateralToken.transfer(vault.address, toFixedPtAmt("20")); - - await advancePerpQueueUpToBondMaturity(perp, await bondAt(await perp.callStatic.getDepositBond())); - bal = toFixedPtAmt("50").mul("1000000"); - }); - - it("should transfer assets", async function () { - await expect(() => vault.recoverAndRedeem(bal)).to.changeTokenBalances( - collateralToken, - [deployer, vault], - [toFixedPtAmt("55"), toFixedPtAmt("145")], - ); - }); - - it("should transfer assets", async function () { - await expect(() => vault.recoverAndRedeem(bal)).to.changeTokenBalances( - reserveTranches[0], - [deployer, vault], - [toFixedPtAmt("0"), toFixedPtAmt("-40")], - ); - }); - - it("should transfer assets", async function () { - await expect(() => vault.recoverAndRedeem(bal)).to.changeTokenBalances( - rolloverInTranches[1], - [deployer, vault], - [toFixedPtAmt("0"), toFixedPtAmt("-160")], - ); - }); - - it("should update vault", async function () { - await checkVaultAssetComposition( - vault, - [collateralToken, reserveTranches[0], rolloverInTranches[1]], - [toFixedPtAmt("20"), toFixedPtAmt("40"), toFixedPtAmt("160")], - ); - await vault.recoverAndRedeem(bal); - await checkVaultAssetComposition(vault, [collateralToken], [toFixedPtAmt("165")]); - }); - - it("should burn users notes", async function () { - await expect(() => vault.recoverAndRedeem(bal)).to.changeTokenBalances(vault, [deployer], [bal.mul("-1")]); - expect(await vault.balanceOf(otherUserAddress)).to.eq(toFixedPtAmt("100").mul("1000000")); - }); - - it("should return redemption amounts", async function () { - await perp.updateState(); - const redemptionAmts = await vault.callStatic.recoverAndRedeem(bal); - expect(redemptionAmts.length).to.eq(1); - expect(redemptionAmts[0].token).to.eq(collateralToken.address); - expect(redemptionAmts[0].amount).to.eq(toFixedPtAmt("55")); - }); - }); }); diff --git a/spot-contracts/test/rollover-vault/RolloverVault_pair_ops.ts b/spot-contracts/test/rollover-vault/RolloverVault_pair_ops.ts new file mode 100644 index 00000000..15fc8c4d --- /dev/null +++ b/spot-contracts/test/rollover-vault/RolloverVault_pair_ops.ts @@ -0,0 +1,532 @@ +import { expect } from "chai"; +import { network, ethers, upgrades } from "hardhat"; +import { Contract, Signer } from "ethers"; + +import { + setupCollateralToken, + mintCollteralToken, + setupBondFactory, + depositIntoBond, + bondAt, + getTranches, + toFixedPtAmt, + toPercFixedPtAmt, + getDepositBond, + advancePerpQueue, + advancePerpQueueToBondMaturity, + checkPerpComposition, + checkVaultComposition, + DMock, +} from "../helpers"; + +let vault: Contract; +let perp: Contract; +let bondFactory: Contract; +let collateralToken: Contract; +let issuer: Contract; +let feePolicy: Contract; +let deployer: Signer; +let reserveTranches: Contract[][] = []; +let remainingJuniorTranches: Contract[][] = []; +let currentBondIn: Contract; +let currentTranchesIn: Contract[]; + +describe("RolloverVault", function () { + beforeEach(async function () { + await network.provider.send("hardhat_reset"); + + const accounts = await ethers.getSigners(); + deployer = accounts[0]; + + bondFactory = await setupBondFactory(); + ({ collateralToken } = await setupCollateralToken("Bitcoin", "BTC")); + + const BondIssuer = await ethers.getContractFactory("BondIssuer"); + issuer = await upgrades.deployProxy( + BondIssuer.connect(deployer), + [bondFactory.target, collateralToken.target, 4800, [200, 800], 1200, 0], + { + initializer: "init(address,address,uint256,uint256[],uint256,uint256)", + }, + ); + + feePolicy = new DMock(await ethers.getContractFactory("FeePolicy")); + await feePolicy.deploy(); + await feePolicy.mockMethod("decimals()", [8]); + await feePolicy.mockMethod("computeDeviationRatio((uint256,uint256))", [toPercFixedPtAmt("1")]); + await feePolicy.mockMethod("computeFeePerc(uint256,uint256)", [0]); + + const PerpetualTranche = await ethers.getContractFactory("PerpetualTranche"); + perp = await upgrades.deployProxy( + PerpetualTranche.connect(deployer), + ["PerpetualTranche", "PERP", collateralToken.target, issuer.target, feePolicy.target], + { + initializer: "init(string,string,address,address,address)", + }, + ); + await perp.updateTolerableTrancheMaturity(1200, 4800); + await advancePerpQueueToBondMaturity(perp, await getDepositBond(perp)); + + const TrancheManager = await ethers.getContractFactory("TrancheManager"); + const trancheManager = await TrancheManager.deploy(); + const RolloverVault = await ethers.getContractFactory("RolloverVault", { + libraries: { + TrancheManager: trancheManager.target, + }, + }); + await upgrades.silenceWarnings(); + vault = await upgrades.deployProxy(RolloverVault.connect(deployer), { + unsafeAllow: ["external-library-linking"], + }); + await collateralToken.approve(vault.target, toFixedPtAmt("1")); + await vault.init("RolloverVault", "VSHARE", perp.target, feePolicy.target); + await perp.updateVault(vault.target); + + reserveTranches = []; + remainingJuniorTranches = []; + for (let i = 0; i < 4; i++) { + const bond = await getDepositBond(perp); + const tranches = await getTranches(bond); + await depositIntoBond(bond, toFixedPtAmt("1200"), deployer); + + await tranches[0].approve(perp.target, toFixedPtAmt("200")); + await perp.deposit(tranches[0].target, toFixedPtAmt("200")); + + reserveTranches.push(tranches[0]); + remainingJuniorTranches.push(tranches[1]); + await advancePerpQueue(perp, 1200); + } + + await checkPerpComposition( + perp, + [collateralToken, ...reserveTranches.slice(-3)], + [toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200")], + ); + await checkVaultComposition(vault, [collateralToken], [0]); + expect(await vault.assetCount()).to.eq(1); + + await mintCollteralToken(collateralToken, toFixedPtAmt("100000"), deployer); + currentBondIn = await bondAt(await perp.getDepositBond.staticCall()); + currentTranchesIn = await getTranches(currentBondIn); + + await collateralToken.approve(vault.target, toFixedPtAmt("10000")); + await perp.approve(vault.target, toFixedPtAmt("10000")); + + await vault.deposit(toFixedPtAmt("1000")); + await vault.deploy(); + await vault.deposit(toFixedPtAmt("1000")); + + await checkVaultComposition( + vault, + [collateralToken, currentTranchesIn[1]], + [toFixedPtAmt("1200"), toFixedPtAmt("800")], + ); + expect(await vault.assetCount()).to.eq(2); + }); + + afterEach(async function () { + await network.provider.send("hardhat_reset"); + }); + + describe("#mint2", function () { + describe("when dr = 1", function () { + beforeEach(async function () { + await feePolicy.mockMethod("targetSystemRatio()", [toPercFixedPtAmt("3")]); + }); + + it("should compute amounts", async function () { + const r = await vault.mint2.staticCall(toFixedPtAmt("100")); + expect(r[0]).to.eq(toFixedPtAmt("25")); + expect(r[1]).to.eq(toFixedPtAmt("75") * 1000000n); + }); + + it("should transfer underlying", async function () { + await expect(() => vault.mint2(toFixedPtAmt("100"))).to.changeTokenBalances( + collateralToken, + [deployer], + [toFixedPtAmt("-100")], + ); + }); + + it("should mint perps", async function () { + await expect(() => vault.mint2(toFixedPtAmt("100"))).to.changeTokenBalances( + perp, + [deployer], + [toFixedPtAmt("25")], + ); + }); + + it("should mint vault notes", async function () { + await expect(() => vault.mint2(toFixedPtAmt("100"))).to.changeTokenBalances( + vault, + [deployer], + [toFixedPtAmt("75") * 1000000n], + ); + }); + + it("should increase tvl", async function () { + await vault.mint2(toFixedPtAmt("100")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("2075")); + expect(await perp.getTVL.staticCall()).to.eq(toFixedPtAmt("825")); + }); + + it("should have the updated composition", async function () { + await vault.mint2(toFixedPtAmt("100")); + await checkPerpComposition( + perp, + [collateralToken, ...reserveTranches.slice(-3), currentTranchesIn[0]], + [toFixedPtAmt("0"), toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("225")], + ); + await checkVaultComposition( + vault, + [collateralToken, currentTranchesIn[1]], + [toFixedPtAmt("1175"), toFixedPtAmt("900")], + ); + }); + + it("should sync vault assets", async function () { + const tx = vault.mint2(toFixedPtAmt("100")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(collateralToken.target, toFixedPtAmt("1175")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(currentTranchesIn[1].target, toFixedPtAmt("900")); + }); + }); + + describe("when dr > 1", function () { + beforeEach(async function () { + await feePolicy.mockMethod("targetSystemRatio()", [toPercFixedPtAmt("3")]); + await feePolicy.mockMethod("computeDeviationRatio((uint256,uint256))", [toPercFixedPtAmt("1.25")]); + await vault.deposit(toFixedPtAmt("1000")); + }); + + it("should compute amounts", async function () { + const r = await vault.mint2.staticCall(toFixedPtAmt("100")); + expect(r[0]).to.eq(toFixedPtAmt("25")); + expect(r[1]).to.eq(toFixedPtAmt("75") * 1000000n); + }); + + it("should transfer underlying", async function () { + await expect(() => vault.mint2(toFixedPtAmt("100"))).to.changeTokenBalances( + collateralToken, + [deployer], + [toFixedPtAmt("-100")], + ); + }); + + it("should mint perps", async function () { + await expect(() => vault.mint2(toFixedPtAmt("100"))).to.changeTokenBalances( + perp, + [deployer], + [toFixedPtAmt("25")], + ); + }); + + it("should mint vault notes", async function () { + await expect(() => vault.mint2(toFixedPtAmt("100"))).to.changeTokenBalances( + vault, + [deployer], + [toFixedPtAmt("75") * 1000000n], + ); + }); + + it("should increase tvl", async function () { + await vault.mint2(toFixedPtAmt("100")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("3075")); + expect(await perp.getTVL.staticCall()).to.eq(toFixedPtAmt("825")); + }); + + it("should have the updated composition", async function () { + await vault.mint2(toFixedPtAmt("100")); + await checkPerpComposition( + perp, + [collateralToken, ...reserveTranches.slice(-3), currentTranchesIn[0]], + [toFixedPtAmt("0"), toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("225")], + ); + await checkVaultComposition( + vault, + [collateralToken, currentTranchesIn[1]], + [toFixedPtAmt("2175"), toFixedPtAmt("900")], + ); + }); + + it("should sync vault assets", async function () { + const tx = vault.mint2(toFixedPtAmt("100")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(collateralToken.target, toFixedPtAmt("2175")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(currentTranchesIn[1].target, toFixedPtAmt("900")); + }); + }); + + describe("when dr < 1", function () { + beforeEach(async function () { + await feePolicy.mockMethod("targetSystemRatio()", [toPercFixedPtAmt("3")]); + await feePolicy.mockMethod("computeDeviationRatio((uint256,uint256))", [toPercFixedPtAmt("0.75")]); + await vault.redeem(toFixedPtAmt("500") * 1000000n); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("1500")); + }); + + it("should compute amounts", async function () { + const r = await vault.mint2.staticCall(toFixedPtAmt("100")); + expect(r[0]).to.eq(toFixedPtAmt("25")); + expect(r[1]).to.eq(toFixedPtAmt("75") * 1000000n); + }); + + it("should transfer underlying", async function () { + await expect(() => vault.mint2(toFixedPtAmt("100"))).to.changeTokenBalances( + collateralToken, + [deployer], + [toFixedPtAmt("-100")], + ); + }); + + it("should mint perps", async function () { + await expect(() => vault.mint2(toFixedPtAmt("100"))).to.changeTokenBalances( + perp, + [deployer], + [toFixedPtAmt("25")], + ); + }); + + it("should mint vault notes", async function () { + await expect(() => vault.mint2(toFixedPtAmt("100"))).to.changeTokenBalances( + vault, + [deployer], + [toFixedPtAmt("75") * 1000000n], + ); + }); + + it("should increase tvl", async function () { + await vault.mint2(toFixedPtAmt("100")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("1575")); + expect(await perp.getTVL.staticCall()).to.eq(toFixedPtAmt("825")); + }); + + it("should have the updated composition", async function () { + await vault.mint2(toFixedPtAmt("100")); + await checkPerpComposition( + perp, + [collateralToken, ...reserveTranches.slice(-3), currentTranchesIn[0]], + [toFixedPtAmt("0"), toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("225")], + ); + await checkVaultComposition( + vault, + [collateralToken, currentTranchesIn[1]], + [toFixedPtAmt("875"), toFixedPtAmt("700")], + ); + }); + + it("should sync vault assets", async function () { + const tx = vault.mint2(toFixedPtAmt("100")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(collateralToken.target, toFixedPtAmt("875")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(currentTranchesIn[1].target, toFixedPtAmt("700")); + }); + }); + }); + + describe("#redeem2", function () { + describe("when redeeming proportionally", function () { + it("should compute amounts", async function () { + const r = await vault.redeem2.staticCall(toFixedPtAmt("20"), toFixedPtAmt("50") * 1000000n); + + expect(r[0]).to.eq(toFixedPtAmt("20")); + expect(r[1]).to.eq(toFixedPtAmt("50") * 1000000n); + + expect(r[2][0][0]).to.eq(collateralToken.target); + expect(r[2][0][1]).to.eq(toFixedPtAmt("30")); + + expect(r[2][1][0]).to.eq(reserveTranches[3].target); + expect(r[2][1][1]).to.eq(toFixedPtAmt("5")); + + expect(r[2][2][0]).to.eq(reserveTranches[1].target); + expect(r[2][2][1]).to.eq(toFixedPtAmt("5")); + + expect(r[2][3][0]).to.eq(reserveTranches[2].target); + expect(r[2][3][1]).to.eq(toFixedPtAmt("5")); + + expect(r[2][4][0]).to.eq(currentTranchesIn[0].target); + expect(r[2][4][1]).to.eq(toFixedPtAmt("5")); + + expect(r[2][5][0]).to.eq(currentTranchesIn[1].target); + expect(r[2][5][1]).to.eq(toFixedPtAmt("20")); + }); + + it("should burn perps", async function () { + await expect(() => vault.redeem2(toFixedPtAmt("20"), toFixedPtAmt("50") * 1000000n)).to.changeTokenBalances( + perp, + [deployer], + [toFixedPtAmt("-20")], + ); + }); + + it("should burn vault notes", async function () { + await expect(() => vault.redeem2(toFixedPtAmt("20"), toFixedPtAmt("50") * 1000000n)).to.changeTokenBalances( + vault, + [deployer], + [toFixedPtAmt("-50") * 1000000n], + ); + }); + + it("should decrease tvl", async function () { + await vault.redeem2(toFixedPtAmt("20"), toFixedPtAmt("50") * 1000000n); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("1950")); + expect(await perp.getTVL.staticCall()).to.eq(toFixedPtAmt("780")); + }); + + it("should have the updated composition", async function () { + await vault.redeem2(toFixedPtAmt("20"), toFixedPtAmt("50") * 1000000n); + await checkPerpComposition( + perp, + [collateralToken, ...reserveTranches.slice(-3), currentTranchesIn[0]], + [toFixedPtAmt("0"), toFixedPtAmt("195"), toFixedPtAmt("195"), toFixedPtAmt("195"), toFixedPtAmt("195")], + ); + await checkVaultComposition( + vault, + [collateralToken, currentTranchesIn[1]], + [toFixedPtAmt("1170"), toFixedPtAmt("780")], + ); + }); + + it("should sync vault assets", async function () { + const tx = vault.redeem2(toFixedPtAmt("20"), toFixedPtAmt("50") * 1000000n); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(collateralToken.target, toFixedPtAmt("1170")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(currentTranchesIn[1].target, toFixedPtAmt("780")); + }); + }); + + describe("when redeeming more perps", function () { + it("should compute amounts", async function () { + const r = await vault.redeem2.staticCall(toFixedPtAmt("100"), toFixedPtAmt("50") * 1000000n); + + expect(r[0]).to.eq(toFixedPtAmt("20")); + expect(r[1]).to.eq(toFixedPtAmt("50") * 1000000n); + + expect(r[2][0][0]).to.eq(collateralToken.target); + expect(r[2][0][1]).to.eq(toFixedPtAmt("30")); + + expect(r[2][1][0]).to.eq(reserveTranches[3].target); + expect(r[2][1][1]).to.eq(toFixedPtAmt("5")); + + expect(r[2][2][0]).to.eq(reserveTranches[1].target); + expect(r[2][2][1]).to.eq(toFixedPtAmt("5")); + + expect(r[2][3][0]).to.eq(reserveTranches[2].target); + expect(r[2][3][1]).to.eq(toFixedPtAmt("5")); + + expect(r[2][4][0]).to.eq(currentTranchesIn[0].target); + expect(r[2][4][1]).to.eq(toFixedPtAmt("5")); + + expect(r[2][5][0]).to.eq(currentTranchesIn[1].target); + expect(r[2][5][1]).to.eq(toFixedPtAmt("20")); + }); + + it("should burn perps", async function () { + await expect(() => vault.redeem2(toFixedPtAmt("100"), toFixedPtAmt("50") * 1000000n)).to.changeTokenBalances( + perp, + [deployer], + [toFixedPtAmt("-20")], + ); + }); + + it("should burn vault notes", async function () { + await expect(() => vault.redeem2(toFixedPtAmt("100"), toFixedPtAmt("50") * 1000000n)).to.changeTokenBalances( + vault, + [deployer], + [toFixedPtAmt("-50") * 1000000n], + ); + }); + + it("should decrease tvl", async function () { + await vault.redeem2(toFixedPtAmt("100"), toFixedPtAmt("50") * 1000000n); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("1950")); + expect(await perp.getTVL.staticCall()).to.eq(toFixedPtAmt("780")); + }); + + it("should have the updated composition", async function () { + await vault.redeem2(toFixedPtAmt("100"), toFixedPtAmt("50") * 1000000n); + await checkPerpComposition( + perp, + [collateralToken, ...reserveTranches.slice(-3), currentTranchesIn[0]], + [toFixedPtAmt("0"), toFixedPtAmt("195"), toFixedPtAmt("195"), toFixedPtAmt("195"), toFixedPtAmt("195")], + ); + await checkVaultComposition( + vault, + [collateralToken, currentTranchesIn[1]], + [toFixedPtAmt("1170"), toFixedPtAmt("780")], + ); + }); + + it("should sync vault assets", async function () { + const tx = vault.redeem2(toFixedPtAmt("100"), toFixedPtAmt("50") * 1000000n); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(collateralToken.target, toFixedPtAmt("1170")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(currentTranchesIn[1].target, toFixedPtAmt("780")); + }); + }); + + describe("when redeeming more vault notes", function () { + it("should compute amounts", async function () { + const r = await vault.redeem2.staticCall(toFixedPtAmt("20"), toFixedPtAmt("100") * 1000000n); + + expect(r[0]).to.eq(toFixedPtAmt("20")); + expect(r[1]).to.eq(toFixedPtAmt("50") * 1000000n); + + expect(r[2][0][0]).to.eq(collateralToken.target); + expect(r[2][0][1]).to.eq(toFixedPtAmt("30")); + + expect(r[2][1][0]).to.eq(reserveTranches[3].target); + expect(r[2][1][1]).to.eq(toFixedPtAmt("5")); + + expect(r[2][2][0]).to.eq(reserveTranches[1].target); + expect(r[2][2][1]).to.eq(toFixedPtAmt("5")); + + expect(r[2][3][0]).to.eq(reserveTranches[2].target); + expect(r[2][3][1]).to.eq(toFixedPtAmt("5")); + + expect(r[2][4][0]).to.eq(currentTranchesIn[0].target); + expect(r[2][4][1]).to.eq(toFixedPtAmt("5")); + + expect(r[2][5][0]).to.eq(currentTranchesIn[1].target); + expect(r[2][5][1]).to.eq(toFixedPtAmt("20")); + }); + + it("should burn perps", async function () { + await expect(() => vault.redeem2(toFixedPtAmt("20"), toFixedPtAmt("100") * 1000000n)).to.changeTokenBalances( + perp, + [deployer], + [toFixedPtAmt("-20")], + ); + }); + + it("should burn vault notes", async function () { + await expect(() => vault.redeem2(toFixedPtAmt("20"), toFixedPtAmt("100") * 1000000n)).to.changeTokenBalances( + vault, + [deployer], + [toFixedPtAmt("-50") * 1000000n], + ); + }); + + it("should decrease tvl", async function () { + await vault.redeem2(toFixedPtAmt("20"), toFixedPtAmt("100") * 1000000n); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("1950")); + expect(await perp.getTVL.staticCall()).to.eq(toFixedPtAmt("780")); + }); + + it("should have the updated composition", async function () { + await vault.redeem2(toFixedPtAmt("20"), toFixedPtAmt("100") * 1000000n); + await checkPerpComposition( + perp, + [collateralToken, ...reserveTranches.slice(-3), currentTranchesIn[0]], + [toFixedPtAmt("0"), toFixedPtAmt("195"), toFixedPtAmt("195"), toFixedPtAmt("195"), toFixedPtAmt("195")], + ); + await checkVaultComposition( + vault, + [collateralToken, currentTranchesIn[1]], + [toFixedPtAmt("1170"), toFixedPtAmt("780")], + ); + }); + + it("should sync vault assets", async function () { + const tx = vault.redeem2(toFixedPtAmt("20"), toFixedPtAmt("100") * 1000000n); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(collateralToken.target, toFixedPtAmt("1170")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(currentTranchesIn[1].target, toFixedPtAmt("780")); + }); + }); + }); +}); diff --git a/spot-contracts/test/rollover-vault/RolloverVault_rebalance.ts b/spot-contracts/test/rollover-vault/RolloverVault_rebalance.ts new file mode 100644 index 00000000..e5eb49eb --- /dev/null +++ b/spot-contracts/test/rollover-vault/RolloverVault_rebalance.ts @@ -0,0 +1,373 @@ +import { expect } from "chai"; +import { network, ethers, upgrades } from "hardhat"; +import { Contract, Signer } from "ethers"; + +import { + setupCollateralToken, + mintCollteralToken, + setupBondFactory, + depositIntoBond, + bondAt, + getTranches, + toFixedPtAmt, + getDepositBond, + advancePerpQueue, + advancePerpQueueToBondMaturity, + checkPerpComposition, + checkVaultComposition, + DMock, + toPercFixedPtAmt, + TimeHelpers, +} from "../helpers"; + +let vault: Contract; +let perp: Contract; +let bondFactory: Contract; +let collateralToken: Contract; +let issuer: Contract; +let feePolicy: Contract; +let deployer: Signer; +const reserveSrTranches: Contract[][] = []; +const reserveJrTranches: Contract[][] = []; + +describe("RolloverVault", function () { + beforeEach(async function () { + await network.provider.send("hardhat_reset"); + + const accounts = await ethers.getSigners(); + deployer = accounts[0]; + + bondFactory = await setupBondFactory(); + ({ collateralToken } = await setupCollateralToken("Bitcoin", "BTC")); + + const BondIssuer = await ethers.getContractFactory("BondIssuer"); + issuer = await upgrades.deployProxy( + BondIssuer.connect(deployer), + [bondFactory.target, collateralToken.target, 4 * 86400, [200, 800], 86400, 0], + { + initializer: "init(address,address,uint256,uint256[],uint256,uint256)", + }, + ); + + feePolicy = new DMock(await ethers.getContractFactory("FeePolicy")); + await feePolicy.deploy(); + await feePolicy.mockMethod("decimals()", [8]); + await feePolicy.mockMethod("computeDeviationRatio((uint256,uint256))", [toPercFixedPtAmt("1")]); + await feePolicy.mockMethod("computeFeePerc(uint256,uint256)", [0]); + + const PerpetualTranche = await ethers.getContractFactory("PerpetualTranche"); + perp = await upgrades.deployProxy( + PerpetualTranche.connect(deployer), + ["PerpetualTranche", "PERP", collateralToken.target, issuer.target, feePolicy.target], + { + initializer: "init(string,string,address,address,address)", + }, + ); + + await perp.updateTolerableTrancheMaturity(86400, 4 * 86400); + await advancePerpQueueToBondMaturity(perp, await getDepositBond(perp)); + + const TrancheManager = await ethers.getContractFactory("TrancheManager"); + const trancheManager = await TrancheManager.deploy(); + const RolloverVault = await ethers.getContractFactory("RolloverVault", { + libraries: { + TrancheManager: trancheManager.target, + }, + }); + await upgrades.silenceWarnings(); + vault = await upgrades.deployProxy(RolloverVault.connect(deployer), { + unsafeAllow: ["external-library-linking"], + }); + await vault.init("RolloverVault", "VSHARE", perp.target, feePolicy.target); + await perp.updateVault(vault.target); + + for (let i = 0; i < 4; i++) { + const bond = await getDepositBond(perp); + const tranches = await getTranches(bond); + await depositIntoBond(bond, toFixedPtAmt("1000"), deployer); + + await tranches[0].approve(perp.target, toFixedPtAmt("200")); + await perp.deposit(tranches[0].target, toFixedPtAmt("200")); + + reserveSrTranches.push(tranches[0]); + reserveJrTranches.push(tranches[1]); + await advancePerpQueue(perp, 86400); + } + + await checkPerpComposition( + perp, + [collateralToken, ...reserveSrTranches.slice(-3)], + [toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200")], + ); + + await mintCollteralToken(collateralToken, toFixedPtAmt("100000"), deployer); + await collateralToken.approve(vault.target, toFixedPtAmt("100000")); + const currentBondIn = await bondAt(await perp.getDepositBond.staticCall()); + const currentTranchesIn = await getTranches(currentBondIn); + await vault.deposit(toFixedPtAmt("2000")); + await vault.deploy(); + + await checkVaultComposition( + vault, + [collateralToken, reserveSrTranches[1], currentTranchesIn[1]], + [toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("1600")], + ); + expect(await vault.assetCount()).to.eq(3); + await TimeHelpers.increaseTime(86401); + + await feePolicy.mockMethod("protocolSharePerc()", [0n]); + await feePolicy.mockMethod("computeRebalanceAmount((uint256,uint256))", [0n]); + await feePolicy.mockMethod("protocolFeeCollector()", [await deployer.getAddress()]); + await feePolicy.mockMethod("rebalanceFreqSec()", [86400]); + }); + + afterEach(async function () { + await network.provider.send("hardhat_reset"); + }); + + describe("#rebalance()", function () { + describe("when system is paused", function () { + it("should revert", async function () { + await vault.pause(); + await expect(vault.rebalance()).to.be.revertedWith("Pausable: paused"); + }); + }); + + describe("when rebalance is paused", function () { + it("should revert", async function () { + await vault.pauseRebalance(); + await expect(vault.rebalance()).to.be.revertedWithCustomError(vault, "LastRebalanceTooRecent"); + }); + }); + + describe("when invoked too soon", function () { + it("should revert", async function () { + await vault.rebalance(); + await expect(vault.rebalance()).to.be.revertedWithCustomError(vault, "LastRebalanceTooRecent"); + await TimeHelpers.increaseTime(86401); + await expect(vault.rebalance()).to.not.be.reverted; + }); + }); + + describe("no-change", function () { + beforeEach(async function () { + await feePolicy.mockMethod("computeRebalanceAmount((uint256,uint256))", [toFixedPtAmt("0")]); + }); + it("should transfer value to the vault (by minting and melding perps)", async function () { + expect(await perp.totalSupply()).to.eq(toFixedPtAmt("800")); + expect(await perp.getTVL.staticCall()).to.eq(toFixedPtAmt("800")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("2000")); + await expect(() => vault.rebalance()).to.changeTokenBalances(perp, [vault], [toFixedPtAmt("0")]); + expect(await perp.getTVL.staticCall()).to.eq(toFixedPtAmt("800")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("2000")); + expect(await perp.totalSupply()).to.eq(toFixedPtAmt("800")); + expect(await vault.totalSupply()).to.eq(toFixedPtAmt("2000000000")); + }); + }); + + describe("no-change with protocol fee", function () { + beforeEach(async function () { + await feePolicy.mockMethod("protocolSharePerc()", [toPercFixedPtAmt("0.01")]); + await feePolicy.mockMethod("computeRebalanceAmount((uint256,uint256))", [toFixedPtAmt("0")]); + }); + it("should transfer value to the vault (by minting and melding perps)", async function () { + expect(await perp.totalSupply()).to.eq(toFixedPtAmt("800")); + expect(await perp.getTVL.staticCall()).to.eq(toFixedPtAmt("800")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("2000")); + await expect(() => vault.rebalance()).to.changeTokenBalances(perp, [vault], [toFixedPtAmt("0")]); + expect(await perp.getTVL.staticCall()).to.eq(toFixedPtAmt("800")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("2000")); + expect(await perp.totalSupply()).to.eq(toFixedPtAmt("808.080808080808080808")); + expect(await vault.totalSupply()).to.eq(toFixedPtAmt("2020202020.202020202020202020")); + }); + it("should pay the protocol fee", async function () { + await expect(() => vault.rebalance()).to.changeTokenBalances( + perp, + [deployer], + [toFixedPtAmt("8.080808080808080808")], + ); + }); + it("should pay the protocol fee", async function () { + await expect(() => vault.rebalance()).to.changeTokenBalances( + vault, + [deployer], + [toFixedPtAmt("20202020.202020202020202020")], + ); + }); + }); + + describe("perp debasement", function () { + beforeEach(async function () { + await feePolicy.mockMethod("computeRebalanceAmount((uint256,uint256))", [toFixedPtAmt("-10")]); + }); + it("should transfer value to the vault (by minting and melding perps)", async function () { + expect(await perp.totalSupply()).to.eq(toFixedPtAmt("800")); + expect(await perp.getTVL.staticCall()).to.eq(toFixedPtAmt("800")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("2000")); + await expect(() => vault.rebalance()).to.changeTokenBalances(perp, [vault], [toFixedPtAmt("0")]); + expect(await perp.getTVL.staticCall()).to.eq(toFixedPtAmt("790")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("2010")); + expect(await perp.totalSupply()).to.eq(toFixedPtAmt("800")); + expect(await vault.totalSupply()).to.eq(toFixedPtAmt("2000000000")); + }); + it("should update the vault balance (after melding)", async function () { + await expect(() => vault.rebalance()).to.changeTokenBalances(collateralToken, [vault], [toFixedPtAmt("25")]); + }); + it("should sync token balances", async function () { + const tx = vault.rebalance(); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(collateralToken.target, toFixedPtAmt("225")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(perp.target, toFixedPtAmt("0")); + }); + }); + + describe("perp debasement with protocol fee", function () { + beforeEach(async function () { + await feePolicy.mockMethod("protocolSharePerc()", [toPercFixedPtAmt("0.01")]); + await feePolicy.mockMethod("computeRebalanceAmount((uint256,uint256))", [toFixedPtAmt("-10")]); + }); + it("should transfer value to the vault (by minting and melding perps)", async function () { + expect(await perp.totalSupply()).to.eq(toFixedPtAmt("800")); + expect(await perp.getTVL.staticCall()).to.eq(toFixedPtAmt("800")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("2000")); + await expect(() => vault.rebalance()).to.changeTokenBalances(perp, [vault], [toFixedPtAmt("0")]); + expect(await perp.getTVL.staticCall()).to.eq(toFixedPtAmt("790")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("2010")); + expect(await perp.totalSupply()).to.eq(toFixedPtAmt("808.080808080808080808")); + expect(await vault.totalSupply()).to.eq(toFixedPtAmt("2020202020.202020202020202020")); + }); + it("should pay the protocol fee", async function () { + await expect(() => vault.rebalance()).to.changeTokenBalances( + perp, + [deployer], + [toFixedPtAmt("8.080808080808080808")], + ); + }); + it("should pay the protocol fee", async function () { + await expect(() => vault.rebalance()).to.changeTokenBalances( + vault, + [deployer], + [toFixedPtAmt("20202020.202020202020202020")], + ); + }); + it("should update the vault balance (after melding)", async function () { + await expect(() => vault.rebalance()).to.changeTokenBalances(collateralToken, [vault], [toFixedPtAmt("25")]); + }); + it("should sync token balances", async function () { + const tx = vault.rebalance(); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(collateralToken.target, toFixedPtAmt("225")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(perp.target, toFixedPtAmt("0")); + }); + }); + + describe("perp enrichment", function () { + let depositBond: Contract, depositTranches: Contract[]; + beforeEach(async function () { + await feePolicy.mockMethod("computeRebalanceAmount((uint256,uint256))", [toFixedPtAmt("25")]); + await perp.updateState(); + depositBond = await getDepositBond(perp); + depositTranches = await getTranches(depositBond); + }); + + it("should transfer value to perp", async function () { + expect(await perp.totalSupply()).to.eq(toFixedPtAmt("800")); + expect(await perp.getTVL.staticCall()).to.eq(toFixedPtAmt("800")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("2000")); + await expect(() => vault.rebalance()).to.changeTokenBalances(perp, [vault], [toFixedPtAmt("0")]); + expect(await perp.getTVL.staticCall()).to.eq(toFixedPtAmt("825")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("1975")); + expect(await perp.totalSupply()).to.eq(toFixedPtAmt("800")); + expect(await vault.totalSupply()).to.eq(toFixedPtAmt("2000000000")); + }); + + it("should tranche using deposit bond", async function () { + await expect(() => vault.rebalance()).to.changeTokenBalances( + collateralToken, + [vault, depositBond.target], + [toFixedPtAmt("-125"), toFixedPtAmt("125")], + ); + }); + it("should transfer seniors from vault to perp", async function () { + await expect(() => vault.rebalance()).to.changeTokenBalances( + depositTranches[0], + [vault, perp], + [toFixedPtAmt("0"), toFixedPtAmt("25")], + ); + }); + it("should not change perp supply", async function () { + expect(await perp.totalSupply()).to.eq(toFixedPtAmt("800")); + await vault.rebalance(); + expect(await perp.totalSupply()).to.eq(toFixedPtAmt("800")); + }); + it("should sync token balances", async function () { + const tx = vault.rebalance(); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(collateralToken.target, toFixedPtAmt("75")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(depositTranches[1].target, toFixedPtAmt("100")); + await expect(tx).to.emit(perp, "ReserveSynced").withArgs(depositTranches[0].target, toFixedPtAmt("25")); + }); + }); + + describe("perp enrichment with protocol fee", function () { + let depositBond: Contract, depositTranches: Contract[]; + beforeEach(async function () { + await feePolicy.mockMethod("protocolSharePerc()", [toPercFixedPtAmt("0.01")]); + await feePolicy.mockMethod("computeRebalanceAmount((uint256,uint256))", [toFixedPtAmt("25")]); + await perp.updateState(); + depositBond = await getDepositBond(perp); + depositTranches = await getTranches(depositBond); + }); + + it("should transfer value to perp", async function () { + expect(await perp.totalSupply()).to.eq(toFixedPtAmt("800")); + expect(await perp.getTVL.staticCall()).to.eq(toFixedPtAmt("800")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("2000")); + await expect(() => vault.rebalance()).to.changeTokenBalances(perp, [vault], [toFixedPtAmt("0")]); + expect(await perp.getTVL.staticCall()).to.eq(toFixedPtAmt("825")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("1975")); + expect(await perp.totalSupply()).to.eq(toFixedPtAmt("808.080808080808080808")); + expect(await vault.totalSupply()).to.eq(toFixedPtAmt("2020202020.202020202020202020")); + }); + + it("should tranche using deposit bond", async function () { + await expect(() => vault.rebalance()).to.changeTokenBalances( + collateralToken, + [vault, depositBond.target], + [toFixedPtAmt("-125"), toFixedPtAmt("125")], + ); + }); + it("should transfer seniors from vault to perp", async function () { + await expect(() => vault.rebalance()).to.changeTokenBalances( + depositTranches[0], + [vault, perp], + [toFixedPtAmt("0"), toFixedPtAmt("25")], + ); + }); + it("should pay the protocol fee", async function () { + await expect(() => vault.rebalance()).to.changeTokenBalances( + perp, + [deployer], + [toFixedPtAmt("8.080808080808080808")], + ); + }); + it("should pay the protocol fee", async function () { + await expect(() => vault.rebalance()).to.changeTokenBalances( + vault, + [deployer], + [toFixedPtAmt("20202020.202020202020202020")], + ); + }); + it("should mint notes as fees", async function () { + expect(await perp.totalSupply()).to.eq(toFixedPtAmt("800")); + expect(await vault.totalSupply()).to.eq(toFixedPtAmt("2000000000")); + await vault.rebalance(); + expect(await perp.totalSupply()).to.eq(toFixedPtAmt("808.080808080808080808")); + expect(await vault.totalSupply()).to.eq(toFixedPtAmt("2020202020.202020202020202020")); + }); + it("should sync token balances", async function () { + const tx = vault.rebalance(); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(collateralToken.target, toFixedPtAmt("75")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(depositTranches[1].target, toFixedPtAmt("100")); + await expect(tx).to.emit(perp, "ReserveSynced").withArgs(depositTranches[0].target, toFixedPtAmt("25")); + }); + }); + }); +}); diff --git a/spot-contracts/test/rollover-vault/RolloverVault_recover.ts b/spot-contracts/test/rollover-vault/RolloverVault_recover.ts index e3d97785..8bb3d2a7 100644 --- a/spot-contracts/test/rollover-vault/RolloverVault_recover.ts +++ b/spot-contracts/test/rollover-vault/RolloverVault_recover.ts @@ -1,7 +1,6 @@ -import { expect, use } from "chai"; +import { expect } from "chai"; import { network, ethers, upgrades } from "hardhat"; import { Contract, Signer } from "ethers"; -import { smock } from "@defi-wonderland/smock"; import { setupCollateralToken, @@ -17,10 +16,11 @@ import { advancePerpQueueUpToBondMaturity, advancePerpQueueToBondMaturity, advancePerpQueueToRollover, - checkReserveComposition, - checkVaultAssetComposition, + checkPerpComposition, + checkVaultComposition, + DMock, + toPercFixedPtAmt, } from "../helpers"; -use(smock.matchers); let vault: Contract; let perp: Contract; @@ -45,21 +45,22 @@ describe("RolloverVault", function () { const BondIssuer = await ethers.getContractFactory("BondIssuer"); issuer = await upgrades.deployProxy( BondIssuer.connect(deployer), - [bondFactory.address, collateralToken.address, 4800, [200, 800], 1200, 0], + [bondFactory.target, collateralToken.target, 4800, [200, 800], 1200, 0], { initializer: "init(address,address,uint256,uint256[],uint256,uint256)", }, ); - const FeePolicy = await ethers.getContractFactory("FeePolicy"); - feePolicy = await smock.fake(FeePolicy); - await feePolicy.computePerpRolloverFeePerc.returns("0"); - await feePolicy.decimals.returns(8); + feePolicy = new DMock(await ethers.getContractFactory("FeePolicy")); + await feePolicy.deploy(); + await feePolicy.mockMethod("decimals()", [8]); + await feePolicy.mockMethod("computeDeviationRatio((uint256,uint256))", [toPercFixedPtAmt("1")]); + await feePolicy.mockMethod("computeFeePerc(uint256,uint256)", [0]); const PerpetualTranche = await ethers.getContractFactory("PerpetualTranche"); perp = await upgrades.deployProxy( PerpetualTranche.connect(deployer), - ["PerpetualTranche", "PERP", collateralToken.address, issuer.address, feePolicy.address], + ["PerpetualTranche", "PERP", collateralToken.target, issuer.target, feePolicy.target], { initializer: "init(string,string,address,address,address)", }, @@ -68,10 +69,19 @@ describe("RolloverVault", function () { await perp.updateTolerableTrancheMaturity(1200, 4800); await advancePerpQueueToBondMaturity(perp, await getDepositBond(perp)); - const RolloverVault = await ethers.getContractFactory("RolloverVault"); - vault = await upgrades.deployProxy(RolloverVault.connect(deployer)); - await vault.init("RolloverVault", "VSHARE", perp.address, feePolicy.address); - await perp.updateVault(vault.address); + const TrancheManager = await ethers.getContractFactory("TrancheManager"); + const trancheManager = await TrancheManager.deploy(); + const RolloverVault = await ethers.getContractFactory("RolloverVault", { + libraries: { + TrancheManager: trancheManager.target, + }, + }); + await upgrades.silenceWarnings(); + vault = await upgrades.deployProxy(RolloverVault.connect(deployer), { + unsafeAllow: ["external-library-linking"], + }); + await vault.init("RolloverVault", "VSHARE", perp.target, feePolicy.target); + await perp.updateVault(vault.target); reserveTranches = []; for (let i = 0; i < 4; i++) { @@ -79,25 +89,25 @@ describe("RolloverVault", function () { const tranches = await getTranches(bond); await depositIntoBond(bond, toFixedPtAmt("1000"), deployer); - await tranches[0].approve(perp.address, toFixedPtAmt("200")); - await perp.deposit(tranches[0].address, toFixedPtAmt("200")); + await tranches[0].approve(perp.target, toFixedPtAmt("200")); + await perp.deposit(tranches[0].target, toFixedPtAmt("200")); reserveTranches.push(tranches[0]); await advancePerpQueue(perp, 1200); } - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, ...reserveTranches.slice(-3)], [toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200")], ); - rolloverInBond = await bondAt(await perp.callStatic.getDepositBond()); + rolloverInBond = await bondAt(await perp.getDepositBond.staticCall()); await mintCollteralToken(collateralToken, toFixedPtAmt("100000"), deployer); - await collateralToken.approve(vault.address, toFixedPtAmt("1")); + await collateralToken.approve(vault.target, toFixedPtAmt("1")); - await checkVaultAssetComposition(vault, [collateralToken], ["0"]); + await checkVaultComposition(vault, [collateralToken], ["0"]); expect(await vault.assetCount()).to.eq(1); }); @@ -118,13 +128,13 @@ describe("RolloverVault", function () { let currentBondIn: Contract, currentTranchesIn: Contract[]; beforeEach(async function () { await advancePerpQueueToBondMaturity(perp, rolloverInBond); - currentBondIn = await bondAt(await perp.callStatic.getDepositBond()); + currentBondIn = await bondAt(await perp.getDepositBond.staticCall()); currentTranchesIn = await getTranches(currentBondIn); - await collateralToken.transfer(vault.address, toFixedPtAmt("10")); + await collateralToken.transfer(vault.target, toFixedPtAmt("10")); await vault.deploy(); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("2"), toFixedPtAmt("8")], @@ -134,7 +144,7 @@ describe("RolloverVault", function () { describe("when its not mature", function () { it("should be a no-op", async function () { await expect(vault["recover()"]()).not.to.be.reverted; - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("2"), toFixedPtAmt("8")], @@ -149,12 +159,12 @@ describe("RolloverVault", function () { it("should recover", async function () { await expect(vault["recover()"]()).not.to.be.reverted; expect(await vault.assetCount()).to.eq(1); - await checkVaultAssetComposition(vault, [collateralToken], [toFixedPtAmt("10")]); + await checkVaultComposition(vault, [collateralToken], [toFixedPtAmt("10")]); }); it("should sync assets", async function () { const tx = vault["recover()"](); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(collateralToken.address, toFixedPtAmt("10")); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(currentTranchesIn[1].address, "0"); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(collateralToken.target, toFixedPtAmt("10")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(currentTranchesIn[1].target, "0"); }); }); }); @@ -163,13 +173,13 @@ describe("RolloverVault", function () { let currentBondIn: Contract, currentTranchesIn: Contract[], newBondIn: Contract, newTranchesIn: Contract[]; beforeEach(async function () { await advancePerpQueueToBondMaturity(perp, rolloverInBond); - currentBondIn = await bondAt(await perp.callStatic.getDepositBond()); + currentBondIn = await bondAt(await perp.getDepositBond.staticCall()); currentTranchesIn = await getTranches(currentBondIn); - await collateralToken.transfer(vault.address, toFixedPtAmt("10")); + await collateralToken.transfer(vault.target, toFixedPtAmt("10")); await vault.deploy(); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("2"), toFixedPtAmt("8")], @@ -180,7 +190,7 @@ describe("RolloverVault", function () { describe("when no redemption", function () { it("should be a no-op", async function () { await expect(vault["recover()"]()).not.to.be.reverted; - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("2"), toFixedPtAmt("8")], @@ -196,30 +206,30 @@ describe("RolloverVault", function () { it("should recover", async function () { await expect(vault["recover()"]()).not.to.be.reverted; expect(await vault.assetCount()).to.eq(1); - await checkVaultAssetComposition(vault, [collateralToken], [toFixedPtAmt("10")]); + await checkVaultComposition(vault, [collateralToken], [toFixedPtAmt("10")]); }); it("should sync assets", async function () { const tx = vault["recover()"](); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(collateralToken.address, toFixedPtAmt("10")); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(currentTranchesIn[1].address, "0"); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(collateralToken.target, toFixedPtAmt("10")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(currentTranchesIn[1].target, "0"); }); }); describe("when immature redemption", function () { beforeEach(async function () { await depositIntoBond(currentBondIn, toFixedPtAmt("1000"), deployer); - await currentTranchesIn[0].transfer(vault.address, toFixedPtAmt("100")); + await currentTranchesIn[0].transfer(vault.target, toFixedPtAmt("100")); await advancePerpQueueToRollover(perp, currentBondIn); - newBondIn = await bondAt(await perp.callStatic.getDepositBond()); + newBondIn = await bondAt(await perp.getDepositBond.staticCall()); newTranchesIn = await getTranches(newBondIn); - await collateralToken.transfer(vault.address, toFixedPtAmt("9998")); + await collateralToken.transfer(vault.target, toFixedPtAmt("9998")); await vault.deploy(); expect(await vault.assetCount()).to.eq(3); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[0], newTranchesIn[1]], [toFixedPtAmt("6808"), toFixedPtAmt("100"), toFixedPtAmt("3200")], @@ -228,12 +238,12 @@ describe("RolloverVault", function () { describe("without reminder", function () { beforeEach(async function () { - await currentTranchesIn[1].transfer(vault.address, toFixedPtAmt("400")); + await currentTranchesIn[1].transfer(vault.target, toFixedPtAmt("400")); }); it("should recover", async function () { await expect(vault["recover()"]()).not.to.be.reverted; expect(await vault.assetCount()).to.eq(2); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, newTranchesIn[1]], [toFixedPtAmt("7308"), toFixedPtAmt("3200")], @@ -241,20 +251,20 @@ describe("RolloverVault", function () { }); it("should sync assets", async function () { const tx = vault["recover()"](); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(collateralToken.address, toFixedPtAmt("7308")); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(newTranchesIn[1].address, toFixedPtAmt("3200")); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(currentTranchesIn[0].address, toFixedPtAmt("0")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(collateralToken.target, toFixedPtAmt("7308")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(newTranchesIn[1].target, toFixedPtAmt("3200")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(currentTranchesIn[0].target, toFixedPtAmt("0")); }); }); describe("with reminder", function () { beforeEach(async function () { - await currentTranchesIn[1].transfer(vault.address, toFixedPtAmt("100")); + await currentTranchesIn[1].transfer(vault.target, toFixedPtAmt("100")); }); it("should recover", async function () { await expect(vault["recover()"]()).not.to.be.reverted; expect(await vault.assetCount()).to.eq(3); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[0], newTranchesIn[1]], [toFixedPtAmt("6933"), toFixedPtAmt("75"), toFixedPtAmt("3200")], @@ -262,9 +272,9 @@ describe("RolloverVault", function () { }); it("should sync assets", async function () { const tx = vault["recover()"](); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(collateralToken.address, toFixedPtAmt("6933")); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(currentTranchesIn[0].address, toFixedPtAmt("75")); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(newTranchesIn[1].address, toFixedPtAmt("3200")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(collateralToken.target, toFixedPtAmt("6933")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(currentTranchesIn[0].target, toFixedPtAmt("75")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(newTranchesIn[1].target, toFixedPtAmt("3200")); }); }); }); @@ -275,7 +285,7 @@ describe("RolloverVault", function () { describe("when no asset is deployed", function () { it("should revert", async function () { await vault["recover()"](); - await expect(vault["recover(address)"](collateralToken.address)).to.be.revertedWithCustomError( + await expect(vault["recover(address)"](collateralToken.target)).to.be.revertedWithCustomError( vault, "UnexpectedAsset", ); @@ -287,13 +297,13 @@ describe("RolloverVault", function () { let currentBondIn: Contract, currentTranchesIn: Contract[]; beforeEach(async function () { await advancePerpQueueToBondMaturity(perp, rolloverInBond); - currentBondIn = await bondAt(await perp.callStatic.getDepositBond()); + currentBondIn = await bondAt(await perp.getDepositBond.staticCall()); currentTranchesIn = await getTranches(currentBondIn); - await collateralToken.transfer(vault.address, toFixedPtAmt("10")); + await collateralToken.transfer(vault.target, toFixedPtAmt("10")); await vault.deploy(); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("2"), toFixedPtAmt("8")], @@ -303,7 +313,7 @@ describe("RolloverVault", function () { describe("when address is not valid", function () { it("should be reverted", async function () { - await expect(vault["recover(address)"](collateralToken.address)).to.be.revertedWithCustomError( + await expect(vault["recover(address)"](collateralToken.target)).to.be.revertedWithCustomError( vault, "UnexpectedAsset", ); @@ -313,14 +323,14 @@ describe("RolloverVault", function () { describe("when belongs to a malicious tranche", function () { it("should be reverted", async function () { const maliciousBond = await createBondWithFactory(bondFactory, collateralToken, [1, 999], 100000000000); - await collateralToken.approve(maliciousBond.address, toFixedPtAmt("1")); + await collateralToken.approve(maliciousBond.target, toFixedPtAmt("1")); await maliciousBond.deposit(toFixedPtAmt("1")); const maliciousTranches = await getTranches(maliciousBond); await maliciousTranches[1].transfer( - vault.address, + vault.target, maliciousTranches[1].balanceOf(await deployer.getAddress()), ); - await expect(vault["recover(address)"](maliciousTranches[1].address)).to.be.revertedWithCustomError( + await expect(vault["recover(address)"](maliciousTranches[1].target)).to.be.revertedWithCustomError( vault, "UnexpectedAsset", ); @@ -329,8 +339,8 @@ describe("RolloverVault", function () { describe("when its not mature", function () { it("should be a no-op", async function () { - await expect(vault["recover(address)"](currentTranchesIn[1].address)).not.to.be.reverted; - await checkVaultAssetComposition( + await expect(vault["recover(address)"](currentTranchesIn[1].target)).not.to.be.reverted; + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("2"), toFixedPtAmt("8")], @@ -344,14 +354,14 @@ describe("RolloverVault", function () { await advancePerpQueueUpToBondMaturity(perp, currentBondIn); }); it("should recover", async function () { - await expect(vault["recover(address)"](currentTranchesIn[1].address)).not.to.be.reverted; + await expect(vault["recover(address)"](currentTranchesIn[1].target)).not.to.be.reverted; expect(await vault.assetCount()).to.eq(1); - await checkVaultAssetComposition(vault, [collateralToken], [toFixedPtAmt("10")]); + await checkVaultComposition(vault, [collateralToken], [toFixedPtAmt("10")]); }); it("should sync assets", async function () { - const tx = vault["recover(address)"](currentTranchesIn[1].address); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(collateralToken.address, toFixedPtAmt("10")); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(currentTranchesIn[1].address, "0"); + const tx = vault["recover(address)"](currentTranchesIn[1].target); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(collateralToken.target, toFixedPtAmt("10")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(currentTranchesIn[1].target, "0"); }); }); }); @@ -360,13 +370,13 @@ describe("RolloverVault", function () { let currentBondIn: Contract, currentTranchesIn: Contract[], newBondIn: Contract, newTranchesIn: Contract[]; beforeEach(async function () { await advancePerpQueueToBondMaturity(perp, rolloverInBond); - currentBondIn = await bondAt(await perp.callStatic.getDepositBond()); + currentBondIn = await bondAt(await perp.getDepositBond.staticCall()); currentTranchesIn = await getTranches(currentBondIn); - await collateralToken.transfer(vault.address, toFixedPtAmt("10")); + await collateralToken.transfer(vault.target, toFixedPtAmt("10")); await vault.deploy(); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("2"), toFixedPtAmt("8")], @@ -376,8 +386,8 @@ describe("RolloverVault", function () { describe("when no redemption", function () { it("should be a no-op", async function () { - await expect(vault["recover(address)"](currentTranchesIn[1].address)).not.to.be.reverted; - await checkVaultAssetComposition( + await expect(vault["recover(address)"](currentTranchesIn[1].target)).not.to.be.reverted; + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("2"), toFixedPtAmt("8")], @@ -391,29 +401,30 @@ describe("RolloverVault", function () { await advancePerpQueueToBondMaturity(perp, currentBondIn); }); it("should recover", async function () { - await expect(vault["recover(address)"](currentTranchesIn[1].address)).not.to.be.reverted; - await checkVaultAssetComposition(vault, [collateralToken], [toFixedPtAmt("10")]); + await expect(vault["recover(address)"](currentTranchesIn[1].target)).not.to.be.reverted; + await checkVaultComposition(vault, [collateralToken], [toFixedPtAmt("10")]); expect(await vault.assetCount()).to.eq(1); }); it("should sync assets", async function () { - const tx = vault["recover(address)"](currentTranchesIn[1].address); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(collateralToken.address, toFixedPtAmt("10")); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(currentTranchesIn[1].address, "0"); + const tx = vault["recover(address)"](currentTranchesIn[1].target); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(collateralToken.target, toFixedPtAmt("10")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(currentTranchesIn[1].target, "0"); }); }); describe("when immature redemption", function () { beforeEach(async function () { await advancePerpQueueToRollover(perp, currentBondIn); + await depositIntoBond(currentBondIn, toFixedPtAmt("10"), deployer); - newBondIn = await bondAt(await perp.callStatic.getDepositBond()); + newBondIn = await bondAt(await perp.getDepositBond.staticCall()); newTranchesIn = await getTranches(newBondIn); - await collateralToken.transfer(vault.address, toFixedPtAmt("9998")); + await collateralToken.transfer(vault.target, toFixedPtAmt("9998")); await vault.deploy(); expect(await vault.assetCount()).to.eq(2); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, newTranchesIn[1]], [toFixedPtAmt("6808"), toFixedPtAmt("3200")], @@ -423,31 +434,31 @@ describe("RolloverVault", function () { describe("without reminder", function () { beforeEach(async function () { await depositIntoBond(newBondIn, toFixedPtAmt("4000"), deployer); - await newTranchesIn[0].transfer(vault.address, toFixedPtAmt("800")); + await newTranchesIn[0].transfer(vault.target, toFixedPtAmt("800")); }); it("should recover", async function () { - await expect(vault["recover(address)"](newTranchesIn[1].address)).not.to.be.reverted; + await expect(vault["recover(address)"](newTranchesIn[1].target)).not.to.be.reverted; expect(await vault.assetCount()).to.eq(1); - await checkVaultAssetComposition(vault, [collateralToken], [toFixedPtAmt("10808")]); + await checkVaultComposition(vault, [collateralToken], [toFixedPtAmt("10808")]); }); it("should sync assets", async function () { - const tx = vault["recover(address)"](newTranchesIn[1].address); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(collateralToken.address, toFixedPtAmt("10808")); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(newTranchesIn[0].address, "0"); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(newTranchesIn[1].address, "0"); + const tx = vault["recover(address)"](newTranchesIn[1].target); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(collateralToken.target, toFixedPtAmt("10808")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(newTranchesIn[0].target, "0"); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(newTranchesIn[1].target, "0"); }); }); describe("with reminder", function () { beforeEach(async function () { await depositIntoBond(newBondIn, toFixedPtAmt("1000"), deployer); - await newTranchesIn[0].transfer(vault.address, toFixedPtAmt("200")); + await newTranchesIn[0].transfer(vault.target, toFixedPtAmt("200")); }); it("should recover", async function () { - await expect(vault["recover(address)"](newTranchesIn[1].address)).not.to.be.reverted; + await expect(vault["recover(address)"](newTranchesIn[1].target)).not.to.be.reverted; expect(await vault.assetCount()).to.eq(2); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, newTranchesIn[1]], [toFixedPtAmt("7808"), toFixedPtAmt("2400")], @@ -455,23 +466,23 @@ describe("RolloverVault", function () { }); it("should sync assets", async function () { - const tx = vault["recover(address)"](newTranchesIn[1].address); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(collateralToken.address, toFixedPtAmt("7808")); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(newTranchesIn[0].address, toFixedPtAmt("0")); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(newTranchesIn[1].address, toFixedPtAmt("2400")); + const tx = vault["recover(address)"](newTranchesIn[1].target); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(collateralToken.target, toFixedPtAmt("7808")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(newTranchesIn[0].target, toFixedPtAmt("0")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(newTranchesIn[1].target, toFixedPtAmt("2400")); }); }); describe("with dust reminder", function () { beforeEach(async function () { await depositIntoBond(newBondIn, toFixedPtAmt("1000"), deployer); - await newTranchesIn[0].transfer(vault.address, "200000"); + await newTranchesIn[0].transfer(vault.target, "200000"); }); it("should recover", async function () { - await expect(vault["recover(address)"](newTranchesIn[1].address)).not.to.be.reverted; + await expect(vault["recover(address)"](newTranchesIn[1].target)).not.to.be.reverted; expect(await vault.assetCount()).to.eq(2); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, newTranchesIn[1]], [toFixedPtAmt("6808.000000000001"), toFixedPtAmt("3199.9999999999992")], @@ -479,31 +490,31 @@ describe("RolloverVault", function () { }); it("should sync assets", async function () { - const tx = vault["recover(address)"](newTranchesIn[1].address); + const tx = vault["recover(address)"](newTranchesIn[1].target); await expect(tx) .to.emit(vault, "AssetSynced") - .withArgs(collateralToken.address, toFixedPtAmt("6808.000000000001")); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(newTranchesIn[0].address, toFixedPtAmt("0")); + .withArgs(collateralToken.target, toFixedPtAmt("6808.000000000001")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(newTranchesIn[0].target, toFixedPtAmt("0")); await expect(tx) .to.emit(vault, "AssetSynced") - .withArgs(newTranchesIn[1].address, toFixedPtAmt("3199.9999999999992")); + .withArgs(newTranchesIn[1].target, toFixedPtAmt("3199.9999999999992")); }); it("should not recover dust when triggered again", async function () { await depositIntoBond(newBondIn, toFixedPtAmt("10000"), deployer); - await newTranchesIn[0].transfer(vault.address, toFixedPtAmt("799.999999999999")); - await vault["recover(address)"](newTranchesIn[1].address); - const tx = vault["recover(address)"](newTranchesIn[1].address); + await newTranchesIn[0].transfer(vault.target, toFixedPtAmt("799.999999999999")); + await vault["recover(address)"](newTranchesIn[1].target); + const tx = vault["recover(address)"](newTranchesIn[1].target); await tx; - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, newTranchesIn[1]], [toFixedPtAmt("10807.999999999996"), "3200000"], ); await expect(tx) .to.emit(vault, "AssetSynced") - .withArgs(collateralToken.address, toFixedPtAmt("10807.999999999996")); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(newTranchesIn[1].address, "3200000"); + .withArgs(collateralToken.target, toFixedPtAmt("10807.999999999996")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(newTranchesIn[1].target, "3200000"); }); }); }); @@ -512,13 +523,13 @@ describe("RolloverVault", function () { describe("recovering perp", function () { let currentBondIn: Contract, currentTranchesIn: Contract[]; beforeEach(async function () { - currentBondIn = await bondAt(await perp.callStatic.getDepositBond()); + currentBondIn = await bondAt(await perp.getDepositBond.staticCall()); currentTranchesIn = await getTranches(currentBondIn); - await collateralToken.transfer(vault.address, toFixedPtAmt("125")); + await collateralToken.transfer(vault.target, toFixedPtAmt("125")); await vault.deploy(); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("25"), toFixedPtAmt("100")], @@ -528,8 +539,8 @@ describe("RolloverVault", function () { describe("when vault has no perps", function () { it("should be a no-op", async function () { - await expect(vault["recover(address)"](perp.address)).not.to.be.reverted; - await checkVaultAssetComposition( + await expect(vault["recover(address)"](perp.target)).not.to.be.reverted; + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("25"), toFixedPtAmt("100")], @@ -540,11 +551,11 @@ describe("RolloverVault", function () { describe("when vault has perps", function () { beforeEach(async function () { - await perp.transfer(vault.address, toFixedPtAmt("100")); + await perp.transfer(vault.target, toFixedPtAmt("100")); }); it("should recover", async function () { - await expect(vault["recover(address)"](perp.address)).not.to.be.reverted; - await checkVaultAssetComposition( + await expect(vault["recover(address)"](perp.target)).not.to.be.reverted; + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1], ...reserveTranches.slice(-3)], [toFixedPtAmt("62.5"), toFixedPtAmt("87.5"), toFixedPtAmt("25"), toFixedPtAmt("25"), toFixedPtAmt("25")], @@ -552,13 +563,13 @@ describe("RolloverVault", function () { expect(await vault.assetCount()).to.eq(5); }); it("should sync assets", async function () { - const tx = vault["recover(address)"](perp.address); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(collateralToken.address, toFixedPtAmt("62.5")); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(currentTranchesIn[1].address, toFixedPtAmt("87.5")); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(currentTranchesIn[0].address, "0"); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(reserveTranches[1].address, toFixedPtAmt("25")); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(reserveTranches[2].address, toFixedPtAmt("25")); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(reserveTranches[3].address, toFixedPtAmt("25")); + const tx = vault["recover(address)"](perp.target); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(collateralToken.target, toFixedPtAmt("62.5")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(currentTranchesIn[1].target, toFixedPtAmt("87.5")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(currentTranchesIn[0].target, "0"); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(reserveTranches[1].target, toFixedPtAmt("25")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(reserveTranches[2].target, toFixedPtAmt("25")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(reserveTranches[3].target, toFixedPtAmt("25")); }); }); }); @@ -568,13 +579,13 @@ describe("RolloverVault", function () { let currentBondIn: Contract, currentTranchesIn: Contract[], newBondIn: Contract, newTranchesIn: Contract[]; beforeEach(async function () { await advancePerpQueueToBondMaturity(perp, rolloverInBond); - currentBondIn = await bondAt(await perp.callStatic.getDepositBond()); + currentBondIn = await bondAt(await perp.getDepositBond.staticCall()); currentTranchesIn = await getTranches(currentBondIn); - await collateralToken.transfer(vault.address, toFixedPtAmt("10")); + await collateralToken.transfer(vault.target, toFixedPtAmt("10")); await vault.deploy(); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("2"), toFixedPtAmt("8")], @@ -583,28 +594,24 @@ describe("RolloverVault", function () { await advancePerpQueueToBondMaturity(perp, currentBondIn); - newBondIn = await bondAt(await perp.callStatic.getDepositBond()); + newBondIn = await bondAt(await perp.getDepositBond.staticCall()); newTranchesIn = await getTranches(newBondIn); }); it("should recover", async function () { await expect(vault.recoverAndRedeploy()).not.to.be.reverted; expect(await vault.assetCount()).to.eq(2); - await checkVaultAssetComposition( - vault, - [collateralToken, newTranchesIn[1]], - [toFixedPtAmt("2"), toFixedPtAmt("8")], - ); + await checkVaultComposition(vault, [collateralToken, newTranchesIn[1]], [toFixedPtAmt("2"), toFixedPtAmt("8")]); }); it("should sync assets", async function () { const tx = vault.recoverAndRedeploy(); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(collateralToken.address, toFixedPtAmt("10")); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(currentTranchesIn[1].address, "0"); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(newTranchesIn[0].address, toFixedPtAmt("2")); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(newTranchesIn[1].address, toFixedPtAmt("8")); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(newTranchesIn[0].address, "0"); - await expect(tx).to.emit(vault, "AssetSynced").withArgs(collateralToken.address, toFixedPtAmt("2")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(collateralToken.target, toFixedPtAmt("10")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(currentTranchesIn[1].target, "0"); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(newTranchesIn[0].target, toFixedPtAmt("2")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(newTranchesIn[1].target, toFixedPtAmt("8")); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(newTranchesIn[0].target, "0"); + await expect(tx).to.emit(vault, "AssetSynced").withArgs(collateralToken.target, toFixedPtAmt("2")); }); }); }); diff --git a/spot-contracts/test/rollover-vault/RolloverVault_swap.ts b/spot-contracts/test/rollover-vault/RolloverVault_swap.ts index fa686e38..647e268e 100644 --- a/spot-contracts/test/rollover-vault/RolloverVault_swap.ts +++ b/spot-contracts/test/rollover-vault/RolloverVault_swap.ts @@ -1,7 +1,6 @@ -import { expect, use } from "chai"; +import { expect } from "chai"; import { network, ethers, upgrades } from "hardhat"; -import { Contract, Signer, constants, Transaction } from "ethers"; -import { smock } from "@defi-wonderland/smock"; +import { Contract, Signer, Transaction } from "ethers"; import { setupCollateralToken, @@ -15,11 +14,11 @@ import { getDepositBond, advancePerpQueue, advancePerpQueueToBondMaturity, - checkReserveComposition, - checkVaultAssetComposition, + checkPerpComposition, + checkVaultComposition, rebase, + DMock, } from "../helpers"; -use(smock.matchers); let vault: Contract; let perp: Contract; @@ -47,23 +46,22 @@ describe("RolloverVault", function () { const BondIssuer = await ethers.getContractFactory("BondIssuer"); issuer = await upgrades.deployProxy( BondIssuer.connect(deployer), - [bondFactory.address, collateralToken.address, 4800, [200, 800], 1200, 0], + [bondFactory.target, collateralToken.target, 4800, [200, 800], 1200, 0], { initializer: "init(address,address,uint256,uint256[],uint256,uint256)", }, ); - const FeePolicy = await ethers.getContractFactory("FeePolicy"); - feePolicy = await smock.fake(FeePolicy); - await feePolicy.decimals.returns(8); - await feePolicy.computePerpMintFeePerc.returns(0); - await feePolicy.computePerpBurnFeePerc.returns(0); - await feePolicy.computePerpRolloverFeePerc.returns(0); + feePolicy = new DMock(await ethers.getContractFactory("FeePolicy")); + await feePolicy.deploy(); + await feePolicy.mockMethod("decimals()", [8]); + await feePolicy.mockMethod("computeDeviationRatio((uint256,uint256))", [toPercFixedPtAmt("1")]); + await feePolicy.mockMethod("computeFeePerc(uint256,uint256)", [0]); const PerpetualTranche = await ethers.getContractFactory("PerpetualTranche"); perp = await upgrades.deployProxy( PerpetualTranche.connect(deployer), - ["PerpetualTranche", "PERP", collateralToken.address, issuer.address, feePolicy.address], + ["PerpetualTranche", "PERP", collateralToken.target, issuer.target, feePolicy.target], { initializer: "init(string,string,address,address,address)", }, @@ -71,51 +69,60 @@ describe("RolloverVault", function () { await perp.updateTolerableTrancheMaturity(1200, 4800); await advancePerpQueueToBondMaturity(perp, await getDepositBond(perp)); - const RolloverVault = await ethers.getContractFactory("RolloverVault"); - vault = await upgrades.deployProxy(RolloverVault.connect(deployer)); - await collateralToken.approve(vault.address, toFixedPtAmt("1")); - await vault.init("RolloverVault", "VSHARE", perp.address, feePolicy.address); - await perp.updateVault(vault.address); + const TrancheManager = await ethers.getContractFactory("TrancheManager"); + const trancheManager = await TrancheManager.deploy(); + const RolloverVault = await ethers.getContractFactory("RolloverVault", { + libraries: { + TrancheManager: trancheManager.target, + }, + }); + await upgrades.silenceWarnings(); + vault = await upgrades.deployProxy(RolloverVault.connect(deployer), { + unsafeAllow: ["external-library-linking"], + }); + await collateralToken.approve(vault.target, toFixedPtAmt("1")); + await vault.init("RolloverVault", "VSHARE", perp.target, feePolicy.target); + await perp.updateVault(vault.target); reserveTranches = []; remainingJuniorTranches = []; for (let i = 0; i < 4; i++) { const bond = await getDepositBond(perp); const tranches = await getTranches(bond); - await depositIntoBond(bond, toFixedPtAmt("1000"), deployer); + await depositIntoBond(bond, toFixedPtAmt("1200"), deployer); - await tranches[0].approve(perp.address, toFixedPtAmt("200")); - await perp.deposit(tranches[0].address, toFixedPtAmt("200")); + await tranches[0].approve(perp.target, toFixedPtAmt("200")); + await perp.deposit(tranches[0].target, toFixedPtAmt("200")); reserveTranches.push(tranches[0]); remainingJuniorTranches.push(tranches[1]); await advancePerpQueue(perp, 1200); } - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, ...reserveTranches.slice(-3)], [toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200")], ); - await checkVaultAssetComposition(vault, [collateralToken], [0]); + await checkVaultComposition(vault, [collateralToken], [0]); expect(await vault.assetCount()).to.eq(1); await mintCollteralToken(collateralToken, toFixedPtAmt("100000"), deployer); - currentBondIn = await bondAt(await perp.callStatic.getDepositBond()); + currentBondIn = await bondAt(await perp.getDepositBond.staticCall()); currentTranchesIn = await getTranches(currentBondIn); - await collateralToken.transfer(vault.address, toFixedPtAmt("1000")); + await collateralToken.transfer(vault.target, toFixedPtAmt("1000")); await vault.deploy(); - await collateralToken.transfer(vault.address, toFixedPtAmt("1000")); + await collateralToken.transfer(vault.target, toFixedPtAmt("1000")); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("1200"), toFixedPtAmt("800")], ); expect(await vault.assetCount()).to.eq(2); - await collateralToken.approve(vault.address, toFixedPtAmt("10000")); - await perp.approve(vault.address, toFixedPtAmt("10000")); + await collateralToken.approve(vault.target, toFixedPtAmt("10000")); + await perp.approve(vault.target, toFixedPtAmt("10000")); }); afterEach(async function () { @@ -124,23 +131,17 @@ describe("RolloverVault", function () { describe("#swapUnderlyingForPerps", function () { describe("when fee is zero", function () { - beforeEach(async function () { - await feePolicy.computePerpMintFeePerc.returns(0); - await feePolicy.computeUnderlyingToPerpVaultSwapFeePerc.returns(0); - }); - describe("when perp price is 1", function () { it("should compute swap amount", async function () { - const s = await vault.callStatic.computeUnderlyingToPerpSwapAmt(toFixedPtAmt("100")); + const s = await vault.computeUnderlyingToPerpSwapAmt.staticCall(toFixedPtAmt("100")); expect(s[0]).to.eq(toFixedPtAmt("100")); expect(s[1]).to.eq(0); expect(s[2].perpTVL).to.eq(toFixedPtAmt("800")); expect(s[2].vaultTVL).to.eq(toFixedPtAmt("2000")); - expect(s[2].seniorTR).to.eq("200"); }); it("should update vault after swap", async function () { - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("1200"), toFixedPtAmt("800")], @@ -148,7 +149,7 @@ describe("RolloverVault", function () { await vault.swapUnderlyingForPerps(toFixedPtAmt("100")); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("800"), toFixedPtAmt("1200")], @@ -158,20 +159,19 @@ describe("RolloverVault", function () { describe("when perp price > 1", function () { beforeEach(async function () { - await collateralToken.transfer(perp.address, toFixedPtAmt("800")); + await collateralToken.transfer(perp.target, toFixedPtAmt("800")); }); it("should compute swap amount", async function () { - const s = await vault.callStatic.computeUnderlyingToPerpSwapAmt(toFixedPtAmt("100")); + const s = await vault.computeUnderlyingToPerpSwapAmt.staticCall(toFixedPtAmt("100")); expect(s[0]).to.eq(toFixedPtAmt("50")); expect(s[1]).to.eq(0); expect(s[2].perpTVL).to.eq(toFixedPtAmt("1600")); expect(s[2].vaultTVL).to.eq(toFixedPtAmt("2000")); - expect(s[2].seniorTR).to.eq("200"); }); it("should update vault after swap", async function () { - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("1200"), toFixedPtAmt("800")], @@ -179,7 +179,7 @@ describe("RolloverVault", function () { await vault.swapUnderlyingForPerps(toFixedPtAmt("100")); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("800"), toFixedPtAmt("1200")], @@ -192,15 +192,14 @@ describe("RolloverVault", function () { await rebase(collateralToken, rebaseOracle, -0.9); }); it("should compute swap amount", async function () { - const s = await vault.callStatic.computeUnderlyingToPerpSwapAmt(toFixedPtAmt("100")); + const s = await vault.computeUnderlyingToPerpSwapAmt.staticCall(toFixedPtAmt("100")); expect(s[0]).to.eq(toFixedPtAmt("200")); expect(s[1]).to.eq(0); expect(s[2].perpTVL).to.eq(toFixedPtAmt("400")); expect(s[2].vaultTVL).to.eq(toFixedPtAmt("120")); - expect(s[2].seniorTR).to.eq("200"); }); it("should update vault after swap", async function () { - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("120"), toFixedPtAmt("800")], @@ -208,7 +207,7 @@ describe("RolloverVault", function () { await vault.swapUnderlyingForPerps(toFixedPtAmt("100")); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("120"), toFixedPtAmt("1600")], @@ -222,16 +221,15 @@ describe("RolloverVault", function () { }); it("should compute swap amount", async function () { - const s = await vault.callStatic.computeUnderlyingToPerpSwapAmt(toFixedPtAmt("100")); + const s = await vault.computeUnderlyingToPerpSwapAmt.staticCall(toFixedPtAmt("100")); expect(s[0]).to.eq(toFixedPtAmt("100")); expect(s[1]).to.eq(0); expect(s[2].perpTVL).to.eq(toFixedPtAmt("800")); expect(s[2].vaultTVL).to.eq(toFixedPtAmt("1780")); - expect(s[2].seniorTR).to.eq("200"); }); it("should update vault after swap", async function () { - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("1080"), toFixedPtAmt("800")], @@ -239,7 +237,7 @@ describe("RolloverVault", function () { await vault.swapUnderlyingForPerps(toFixedPtAmt("100")); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("730"), toFixedPtAmt("1200")], @@ -253,16 +251,15 @@ describe("RolloverVault", function () { }); it("should compute swap amount", async function () { - const s = await vault.callStatic.computeUnderlyingToPerpSwapAmt(toFixedPtAmt("100")); + const s = await vault.computeUnderlyingToPerpSwapAmt.staticCall(toFixedPtAmt("100")); expect(s[0]).to.eq(toFixedPtAmt("100")); expect(s[1]).to.eq(0); expect(s[2].perpTVL).to.eq(toFixedPtAmt("800")); expect(s[2].vaultTVL).to.eq(toFixedPtAmt("2220")); - expect(s[2].seniorTR).to.eq("200"); }); it("should update vault after swap", async function () { - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("1320"), toFixedPtAmt("800")], @@ -270,7 +267,7 @@ describe("RolloverVault", function () { await vault.swapUnderlyingForPerps(toFixedPtAmt("100")); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("870"), toFixedPtAmt("1200")], @@ -281,17 +278,15 @@ describe("RolloverVault", function () { describe("when fee is not zero", function () { beforeEach(async function () { - await feePolicy.computePerpMintFeePerc.returns(toPercFixedPtAmt("0.05")); - await feePolicy.computeUnderlyingToPerpVaultSwapFeePerc.returns(toPercFixedPtAmt("0.1")); + await feePolicy.mockMethod("computeFeePerc(uint256,uint256)", [toPercFixedPtAmt("0.1")]); }); it("should compute swap amount", async function () { - const s = await vault.callStatic.computeUnderlyingToPerpSwapAmt(toFixedPtAmt("100")); - expect(s[0]).to.eq(toFixedPtAmt("85")); - expect(s[1]).to.eq(toFixedPtAmt("5")); + const s = await vault.computeUnderlyingToPerpSwapAmt.staticCall(toFixedPtAmt("100")); + expect(s[0]).to.eq(toFixedPtAmt("90")); + expect(s[1]).to.eq(toFixedPtAmt("0")); expect(s[2].perpTVL).to.eq(toFixedPtAmt("800")); expect(s[2].vaultTVL).to.eq(toFixedPtAmt("2000")); - expect(s[2].seniorTR).to.eq("200"); }); }); @@ -303,8 +298,7 @@ describe("RolloverVault", function () { describe("when absolute liquidity is too low", function () { beforeEach(async function () { - await vault.updateReservedUnderlyingBal(toFixedPtAmt("1000")); - await vault.updateReservedSubscriptionPerc(0); + await vault.updateLiquidityLimits(toFixedPtAmt("2500"), toFixedPtAmt("1000"), toPercFixedPtAmt("0")); }); it("should be reverted", async function () { await expect(vault.swapUnderlyingForPerps(toFixedPtAmt("50"))).to.be.revertedWithCustomError( @@ -317,8 +311,7 @@ describe("RolloverVault", function () { describe("when percentage of liquidity is too low", function () { beforeEach(async function () { - await vault.updateReservedUnderlyingBal(0); - await vault.updateReservedSubscriptionPerc(toPercFixedPtAmt("0.25")); + await vault.updateLiquidityLimits(toFixedPtAmt("2500"), toFixedPtAmt("0"), toPercFixedPtAmt("0.4")); }); it("should be reverted", async function () { await expect(vault.swapUnderlyingForPerps(toFixedPtAmt("100"))).to.be.revertedWithCustomError( @@ -331,8 +324,7 @@ describe("RolloverVault", function () { describe("when fee is 100%", function () { it("should be reverted", async function () { - await feePolicy.computePerpMintFeePerc.returns(0); - await feePolicy.computeUnderlyingToPerpVaultSwapFeePerc.returns(toPercFixedPtAmt("1")); + await feePolicy.mockMethod("computeFeePerc(uint256,uint256)", [toPercFixedPtAmt("1")]); await expect(vault.swapUnderlyingForPerps(toFixedPtAmt("100"))).to.be.revertedWithCustomError( vault, "UnacceptableSwap", @@ -342,8 +334,7 @@ describe("RolloverVault", function () { describe("when fee is greater than 100%", function () { it("should be reverted", async function () { - await feePolicy.computePerpMintFeePerc.returns(toPercFixedPtAmt("0.05")); - await feePolicy.computeUnderlyingToPerpVaultSwapFeePerc.returns(toPercFixedPtAmt("1")); + await feePolicy.mockMethod("computeFeePerc(uint256,uint256)", [toPercFixedPtAmt("1.01")]); await expect(vault.swapUnderlyingForPerps(toFixedPtAmt("100"))).to.be.reverted; }); }); @@ -351,22 +342,18 @@ describe("RolloverVault", function () { describe("on successful swap with zero fees", function () { let txFn: Promise; beforeEach(async function () { - await feePolicy.computePerpMintFeePerc.returns(0); - await feePolicy.computeUnderlyingToPerpVaultSwapFeePerc.returns(0); txFn = () => vault.swapUnderlyingForPerps(toFixedPtAmt("100")); }); it("should mint perps for swap and leave none left over", async function () { expect(await perp.totalSupply()).to.eq(toFixedPtAmt("800")); - await expect(txFn()) - .to.emit(perp, "Transfer") - .withArgs(constants.AddressZero, vault.address, toFixedPtAmt("100")); + await expect(txFn()).to.emit(perp, "Transfer").withArgs(ethers.ZeroAddress, vault.target, toFixedPtAmt("100")); expect(await perp.totalSupply()).to.eq(toFixedPtAmt("900")); - expect(await perp.balanceOf(vault.address)).to.eq(0); + expect(await perp.balanceOf(vault.target)).to.eq(0); }); it("should return the perp amt", async function () { - expect(await vault.callStatic.swapUnderlyingForPerps(toFixedPtAmt("100"))).to.eq(toFixedPtAmt("100")); + expect(await vault.swapUnderlyingForPerps.staticCall(toFixedPtAmt("100"))).to.eq(toFixedPtAmt("100")); }); it("should transfer underlying from the user", async function () { @@ -378,13 +365,13 @@ describe("RolloverVault", function () { }); it("should update the vault assets", async function () { - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, ...reserveTranches.slice(-3), currentTranchesIn[0]], [0, toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200")], ); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("1200"), toFixedPtAmt("800")], @@ -392,13 +379,13 @@ describe("RolloverVault", function () { await txFn(); - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, ...reserveTranches.slice(-3), currentTranchesIn[0]], [0, toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("300")], ); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("800"), toFixedPtAmt("1200")], @@ -406,31 +393,28 @@ describe("RolloverVault", function () { }); it("should update the vault tvl", async function () { - expect(await vault.callStatic.getTVL()).to.eq(toFixedPtAmt("2000")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("2000")); await txFn(); - expect(await vault.callStatic.getTVL()).to.eq(toFixedPtAmt("2000")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("2000")); }); }); - describe("on successful swap with zero perp fees", function () { + describe("on successful swap with flash fees", function () { let txFn: Promise; beforeEach(async function () { - await feePolicy.computePerpMintFeePerc.returns(0); - await feePolicy.computeUnderlyingToPerpVaultSwapFeePerc.returns(toPercFixedPtAmt("0.1")); + await feePolicy.mockMethod("computeFeePerc(uint256,uint256)", [toPercFixedPtAmt("0.1")]); txFn = () => vault.swapUnderlyingForPerps(toFixedPtAmt("100")); }); it("should mint perps for swap and leave none left over", async function () { expect(await perp.totalSupply()).to.eq(toFixedPtAmt("800")); - await expect(txFn()) - .to.emit(perp, "Transfer") - .withArgs(constants.AddressZero, vault.address, toFixedPtAmt("90")); + await expect(txFn()).to.emit(perp, "Transfer").withArgs(ethers.ZeroAddress, vault.target, toFixedPtAmt("90")); expect(await perp.totalSupply()).to.eq(toFixedPtAmt("890")); - expect(await perp.balanceOf(vault.address)).to.eq(0); + expect(await perp.balanceOf(vault.target)).to.eq(0); }); it("should return the perp amt", async function () { - expect(await vault.callStatic.swapUnderlyingForPerps(toFixedPtAmt("100"))).to.eq(toFixedPtAmt("90")); + expect(await vault.swapUnderlyingForPerps.staticCall(toFixedPtAmt("100"))).to.eq(toFixedPtAmt("90")); }); it("should transfer underlying from the user", async function () { @@ -442,83 +426,13 @@ describe("RolloverVault", function () { }); it("should update the vault assets", async function () { - await checkReserveComposition( - perp, - [collateralToken, ...reserveTranches.slice(-3), currentTranchesIn[0]], - [0, toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200")], - ); - - await checkVaultAssetComposition( - vault, - [collateralToken, currentTranchesIn[1]], - [toFixedPtAmt("1200"), toFixedPtAmt("800")], - ); - - await txFn(); - - await checkReserveComposition( - perp, - [collateralToken, ...reserveTranches.slice(-3), currentTranchesIn[0]], - [0, toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("290")], - ); - - await checkVaultAssetComposition( - vault, - [collateralToken, currentTranchesIn[1]], - [toFixedPtAmt("850"), toFixedPtAmt("1160")], - ); - }); - - it("should update the vault tvl", async function () { - expect(await vault.callStatic.getTVL()).to.eq(toFixedPtAmt("2000")); - await txFn(); - expect(await vault.callStatic.getTVL()).to.eq(toFixedPtAmt("2010")); - }); - }); - - describe("on successful swap", function () { - let txFn: Promise; - beforeEach(async function () { - await feePolicy.computePerpMintFeePerc.returns(toPercFixedPtAmt("0.05")); - await feePolicy.computeUnderlyingToPerpVaultSwapFeePerc.returns(toPercFixedPtAmt("0.1")); - txFn = () => vault.swapUnderlyingForPerps(toFixedPtAmt("100")); - }); - - it("should mint perps for swap and leave none left over", async function () { - expect(await perp.totalSupply()).to.eq(toFixedPtAmt("800")); - await expect(txFn()) - .to.emit(perp, "Transfer") - .withArgs(constants.AddressZero, vault.address, toFixedPtAmt("90")); - expect(await perp.totalSupply()).to.eq(toFixedPtAmt("885")); - expect(await perp.balanceOf(vault.address)).to.eq(0); - }); - - it("should burn perps as fee", async function () { - await expect(txFn()) - .to.emit(perp, "Transfer") - .withArgs(vault.address, constants.AddressZero, toFixedPtAmt("5")); - }); - - it("should return the perp amt", async function () { - expect(await vault.callStatic.swapUnderlyingForPerps(toFixedPtAmt("100"))).to.eq(toFixedPtAmt("85")); - }); - - it("should transfer underlying from the user", async function () { - await expect(txFn).to.changeTokenBalances(collateralToken, [deployer], [toFixedPtAmt("-100")]); - }); - - it("should transfer back perps to the user", async function () { - await expect(txFn).to.changeTokenBalances(perp, [deployer], [toFixedPtAmt("85")]); - }); - - it("should update the vault assets", async function () { - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, ...reserveTranches.slice(-3), currentTranchesIn[0]], [0, toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200")], ); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("1200"), toFixedPtAmt("800")], @@ -526,13 +440,13 @@ describe("RolloverVault", function () { await txFn(); - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, ...reserveTranches.slice(-3), currentTranchesIn[0]], [0, toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("290")], ); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("850"), toFixedPtAmt("1160")], @@ -540,17 +454,16 @@ describe("RolloverVault", function () { }); it("should update the vault tvl", async function () { - expect(await vault.callStatic.getTVL()).to.eq(toFixedPtAmt("2000")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("2000")); await txFn(); - expect(await vault.callStatic.getTVL()).to.eq(toFixedPtAmt("2010")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("2010")); }); }); describe("on successful swap with imperfect rounding", function () { let txFn: Promise; beforeEach(async function () { - await feePolicy.computePerpMintFeePerc.returns(toPercFixedPtAmt("0.1")); - await feePolicy.computeUnderlyingToPerpVaultSwapFeePerc.returns(toPercFixedPtAmt("0.1")); + await feePolicy.mockMethod("computeFeePerc(uint256,uint256)", [toPercFixedPtAmt("0.1")]); txFn = () => vault.swapUnderlyingForPerps(toFixedPtAmt("100.999999999999999999")); }); @@ -558,20 +471,14 @@ describe("RolloverVault", function () { expect(await perp.totalSupply()).to.eq(toFixedPtAmt("800")); await expect(txFn()) .to.emit(perp, "Transfer") - .withArgs(constants.AddressZero, vault.address, toFixedPtAmt("90.899999999999999999")); - expect(await perp.totalSupply()).to.eq(toFixedPtAmt("880.799999999999999999")); - expect(await perp.balanceOf(vault.address)).to.eq(0); - }); - - it("should burn perps as fee", async function () { - await expect(txFn()) - .to.emit(perp, "Transfer") - .withArgs(vault.address, constants.AddressZero, toFixedPtAmt("10.1")); + .withArgs(ethers.ZeroAddress, vault.target, toFixedPtAmt("90.899999999999999999")); + expect(await perp.totalSupply()).to.eq(toFixedPtAmt("890.899999999999999999")); + expect(await perp.balanceOf(vault.target)).to.eq(0); }); it("should return the perp amt", async function () { - expect(await vault.callStatic.swapUnderlyingForPerps(toFixedPtAmt("100.999999999999999999"))).to.eq( - toFixedPtAmt("80.799999999999999999"), + expect(await vault.swapUnderlyingForPerps.staticCall(toFixedPtAmt("100.999999999999999999"))).to.eq( + toFixedPtAmt("90.899999999999999999"), ); }); @@ -584,17 +491,17 @@ describe("RolloverVault", function () { }); it("should transfer back perps to the user", async function () { - await expect(txFn).to.changeTokenBalances(perp, [deployer], [toFixedPtAmt("80.799999999999999999")]); + await expect(txFn).to.changeTokenBalances(perp, [deployer], [toFixedPtAmt("90.899999999999999999")]); }); it("should update the vault assets", async function () { - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, ...reserveTranches.slice(-3), currentTranchesIn[0]], [0, toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200")], ); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("1200"), toFixedPtAmt("800")], @@ -602,13 +509,13 @@ describe("RolloverVault", function () { await txFn(); - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, ...reserveTranches.slice(-3), currentTranchesIn[0]], [0, toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("290.899999999999999999")], ); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("846.500000000000000004"), toFixedPtAmt("1163.599999999999999996")], @@ -616,9 +523,9 @@ describe("RolloverVault", function () { }); it("should update the vault tvl", async function () { - expect(await vault.callStatic.getTVL()).to.eq(toFixedPtAmt("2000")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("2000")); await txFn(); - expect(await vault.callStatic.getTVL()).to.eq(toFixedPtAmt("2010.10")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("2010.10")); }); }); @@ -626,28 +533,19 @@ describe("RolloverVault", function () { let txFn: Promise; beforeEach(async function () { await advancePerpQueueToBondMaturity(perp, await getDepositBond(perp)); - await feePolicy.computePerpMintFeePerc.returns(toPercFixedPtAmt("0.05")); - await feePolicy.computeUnderlyingToPerpVaultSwapFeePerc.returns(toPercFixedPtAmt("0.1")); + await feePolicy.mockMethod("computeFeePerc(uint256,uint256)", [toPercFixedPtAmt("0.1")]); txFn = () => vault.swapUnderlyingForPerps(toFixedPtAmt("100")); }); it("should mint perps for swap and leave none left over", async function () { expect(await perp.totalSupply()).to.eq(toFixedPtAmt("800")); - await expect(txFn()) - .to.emit(perp, "Transfer") - .withArgs(constants.AddressZero, vault.address, toFixedPtAmt("90")); - expect(await perp.totalSupply()).to.eq(toFixedPtAmt("885")); - expect(await perp.balanceOf(vault.address)).to.eq(0); - }); - - it("should burn perps as fee", async function () { - await expect(txFn()) - .to.emit(perp, "Transfer") - .withArgs(vault.address, constants.AddressZero, toFixedPtAmt("5")); + await expect(txFn()).to.emit(perp, "Transfer").withArgs(ethers.ZeroAddress, vault.target, toFixedPtAmt("90")); + expect(await perp.totalSupply()).to.eq(toFixedPtAmt("890")); + expect(await perp.balanceOf(vault.target)).to.eq(0); }); it("should return the perp amt", async function () { - expect(await vault.callStatic.swapUnderlyingForPerps(toFixedPtAmt("100"))).to.eq(toFixedPtAmt("85")); + expect(await vault.swapUnderlyingForPerps.staticCall(toFixedPtAmt("100"))).to.eq(toFixedPtAmt("90")); }); it("should transfer underlying from the user", async function () { @@ -655,15 +553,15 @@ describe("RolloverVault", function () { }); it("should transfer back perps to the user", async function () { - await expect(txFn).to.changeTokenBalances(perp, [deployer], [toFixedPtAmt("85")]); + await expect(txFn).to.changeTokenBalances(perp, [deployer], [toFixedPtAmt("90")]); }); it("should update the vault assets", async function () { - const depositBond = await bondAt(perp.callStatic.getDepositBond()); + const depositBond = await bondAt(await perp.getDepositBond.staticCall()); const depositTranches = await getTranches(depositBond); - await checkReserveComposition(perp, [collateralToken], [toFixedPtAmt("800")]); + await checkPerpComposition(perp, [collateralToken], [toFixedPtAmt("800")]); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("1200"), toFixedPtAmt("800")], @@ -671,13 +569,13 @@ describe("RolloverVault", function () { await txFn(); - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, depositTranches[0]], [toFixedPtAmt("800"), toFixedPtAmt("90")], ); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1], depositTranches[1]], [toFixedPtAmt("850"), toFixedPtAmt("800"), toFixedPtAmt("360")], @@ -685,9 +583,9 @@ describe("RolloverVault", function () { }); it("should update the vault tvl", async function () { - expect(await vault.callStatic.getTVL()).to.eq(toFixedPtAmt("2000")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("2000")); await txFn(); - expect(await vault.callStatic.getTVL()).to.eq(toFixedPtAmt("2010")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("2010")); }); }); }); @@ -695,32 +593,29 @@ describe("RolloverVault", function () { describe("#swapPerpsForUnderlying", function () { describe("when fee is zero", function () { beforeEach(async function () { - await feePolicy.computePerpBurnFeePerc.returns(0); - await feePolicy.computePerpToUnderlyingVaultSwapFeePerc.returns(0); + await feePolicy.mockMethod("computeFeePerc(uint256,uint256)", [0]); }); describe("when perp price is 1", function () { it("should compute swap amount", async function () { - const s = await vault.callStatic.computePerpToUnderlyingSwapAmt(toFixedPtAmt("100")); + const s = await vault.computePerpToUnderlyingSwapAmt.staticCall(toFixedPtAmt("100")); expect(s[0]).to.eq(toFixedPtAmt("100")); expect(s[1]).to.eq(0); expect(s[2].perpTVL).to.eq(toFixedPtAmt("800")); expect(s[2].vaultTVL).to.eq(toFixedPtAmt("2000")); - expect(s[2].seniorTR).to.eq("200"); }); }); describe("when perp price > 1", function () { beforeEach(async function () { - await collateralToken.transfer(perp.address, toFixedPtAmt("800")); + await collateralToken.transfer(perp.target, toFixedPtAmt("800")); }); it("should compute swap amount", async function () { - const s = await vault.callStatic.computePerpToUnderlyingSwapAmt(toFixedPtAmt("100")); + const s = await vault.computePerpToUnderlyingSwapAmt.staticCall(toFixedPtAmt("100")); expect(s[0]).to.eq(toFixedPtAmt("200")); expect(s[1]).to.eq(0); expect(s[2].perpTVL).to.eq(toFixedPtAmt("1600")); expect(s[2].vaultTVL).to.eq(toFixedPtAmt("2000")); - expect(s[2].seniorTR).to.eq("200"); }); }); @@ -729,29 +624,26 @@ describe("RolloverVault", function () { await rebase(collateralToken, rebaseOracle, -0.9); }); it("should compute swap amount", async function () { - const s = await vault.callStatic.computePerpToUnderlyingSwapAmt(toFixedPtAmt("100")); + const s = await vault.computePerpToUnderlyingSwapAmt.staticCall(toFixedPtAmt("100")); expect(s[0]).to.eq(toFixedPtAmt("50")); expect(s[1]).to.eq(0); expect(s[2].perpTVL).to.eq(toFixedPtAmt("400")); expect(s[2].vaultTVL).to.eq(toFixedPtAmt("120")); - expect(s[2].seniorTR).to.eq("200"); }); }); }); describe("when fee is not zero", function () { beforeEach(async function () { - await feePolicy.computePerpBurnFeePerc.returns(toPercFixedPtAmt("0.05")); - await feePolicy.computePerpToUnderlyingVaultSwapFeePerc.returns(toPercFixedPtAmt("0.15")); + await feePolicy.mockMethod("computeFeePerc(uint256,uint256)", [toPercFixedPtAmt("0.15")]); }); it("should compute swap amount", async function () { - const s = await vault.callStatic.computePerpToUnderlyingSwapAmt(toFixedPtAmt("100")); - expect(s[0]).to.eq(toFixedPtAmt("80")); - expect(s[1]).to.eq(toFixedPtAmt("5")); + const s = await vault.computePerpToUnderlyingSwapAmt.staticCall(toFixedPtAmt("100")); + expect(s[0]).to.eq(toFixedPtAmt("85")); + expect(s[1]).to.eq(toFixedPtAmt("0")); expect(s[2].perpTVL).to.eq(toFixedPtAmt("800")); expect(s[2].vaultTVL).to.eq(toFixedPtAmt("2000")); - expect(s[2].seniorTR).to.eq("200"); }); }); @@ -763,8 +655,7 @@ describe("RolloverVault", function () { describe("when fee is 100%", function () { it("should be reverted", async function () { - await feePolicy.computePerpBurnFeePerc.returns(0); - await feePolicy.computePerpToUnderlyingVaultSwapFeePerc.returns(toPercFixedPtAmt("1")); + await feePolicy.mockMethod("computeFeePerc(uint256,uint256)", [toPercFixedPtAmt("1")]); await expect(vault.swapPerpsForUnderlying(toFixedPtAmt("100"))).to.be.revertedWithCustomError( vault, "UnacceptableSwap", @@ -774,8 +665,7 @@ describe("RolloverVault", function () { describe("when fee is greater than 100%", function () { it("should be reverted", async function () { - await feePolicy.computePerpBurnFeePerc.returns(toPercFixedPtAmt("0.05")); - await feePolicy.computePerpToUnderlyingVaultSwapFeePerc.returns(toPercFixedPtAmt("1")); + await feePolicy.mockMethod("computeFeePerc(uint256,uint256)", [toPercFixedPtAmt("1")]); await expect(vault.swapPerpsForUnderlying(toFixedPtAmt("100"))).to.be.reverted; }); }); @@ -783,22 +673,18 @@ describe("RolloverVault", function () { describe("on successful swap with zero fees", function () { let txFn: Promise; beforeEach(async function () { - await feePolicy.computePerpBurnFeePerc.returns(0); - await feePolicy.computePerpToUnderlyingVaultSwapFeePerc.returns(0); txFn = () => vault.swapPerpsForUnderlying(toFixedPtAmt("100")); }); it("should redeem perps for swap and leave none left over", async function () { expect(await perp.totalSupply()).to.eq(toFixedPtAmt("800")); - await expect(txFn()) - .to.emit(perp, "Transfer") - .withArgs(vault.address, constants.AddressZero, toFixedPtAmt("100")); + await expect(txFn()).to.emit(perp, "Transfer").withArgs(vault.target, ethers.ZeroAddress, toFixedPtAmt("100")); expect(await perp.totalSupply()).to.eq(toFixedPtAmt("700")); - expect(await perp.balanceOf(vault.address)).to.eq(0); + expect(await perp.balanceOf(vault.target)).to.eq(0); }); it("should return the underlying amt", async function () { - expect(await vault.callStatic.swapPerpsForUnderlying(toFixedPtAmt("100"))).to.eq(toFixedPtAmt("100")); + expect(await vault.swapPerpsForUnderlying.staticCall(toFixedPtAmt("100"))).to.eq(toFixedPtAmt("100")); }); it("should transfer perps from the user", async function () { @@ -810,13 +696,13 @@ describe("RolloverVault", function () { }); it("should update the vault assets", async function () { - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, ...reserveTranches.slice(-3), currentTranchesIn[0]], [0, toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200")], ); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("1200"), toFixedPtAmt("800")], @@ -824,13 +710,13 @@ describe("RolloverVault", function () { await txFn(); - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, ...reserveTranches.slice(-3), currentTranchesIn[0]], [0, toFixedPtAmt("175"), toFixedPtAmt("175"), toFixedPtAmt("175"), toFixedPtAmt("175")], ); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1], ...reserveTranches.slice(-3)], [toFixedPtAmt("1225"), toFixedPtAmt("700"), toFixedPtAmt("25"), toFixedPtAmt("25"), toFixedPtAmt("25")], @@ -838,31 +724,28 @@ describe("RolloverVault", function () { }); it("should update the vault tvl", async function () { - expect(await vault.callStatic.getTVL()).to.eq(toFixedPtAmt("2000")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("2000")); await txFn(); - expect(await vault.callStatic.getTVL()).to.eq(toFixedPtAmt("2000")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("2000")); }); }); - describe("on successful swap with zero perp fees", function () { + describe("on successful swap with flash fees", function () { let txFn: Promise; beforeEach(async function () { - await feePolicy.computePerpBurnFeePerc.returns(0); - await feePolicy.computePerpToUnderlyingVaultSwapFeePerc.returns(toPercFixedPtAmt("0.1")); + await feePolicy.mockMethod("computeFeePerc(uint256,uint256)", [toPercFixedPtAmt("0.15")]); txFn = () => vault.swapPerpsForUnderlying(toFixedPtAmt("100")); }); it("should redeem perps for swap and leave none left over", async function () { expect(await perp.totalSupply()).to.eq(toFixedPtAmt("800")); - await expect(txFn()) - .to.emit(perp, "Transfer") - .withArgs(vault.address, constants.AddressZero, toFixedPtAmt("100")); + await expect(txFn()).to.emit(perp, "Transfer").withArgs(vault.target, ethers.ZeroAddress, toFixedPtAmt("100")); expect(await perp.totalSupply()).to.eq(toFixedPtAmt("700")); - expect(await perp.balanceOf(vault.address)).to.eq(0); + expect(await perp.balanceOf(vault.target)).to.eq(0); }); it("should return the underlying amt", async function () { - expect(await vault.callStatic.swapPerpsForUnderlying(toFixedPtAmt("100"))).to.eq(toFixedPtAmt("90")); + expect(await vault.swapPerpsForUnderlying.staticCall(toFixedPtAmt("100"))).to.eq(toFixedPtAmt("85")); }); it("should transfer perps from the user", async function () { @@ -870,17 +753,17 @@ describe("RolloverVault", function () { }); it("should transfer back underlying to the user", async function () { - await expect(txFn).to.changeTokenBalances(collateralToken, [deployer], [toFixedPtAmt("90")]); + await expect(txFn).to.changeTokenBalances(collateralToken, [deployer], [toFixedPtAmt("85")]); }); it("should update the vault assets", async function () { - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, ...reserveTranches.slice(-3), currentTranchesIn[0]], [0, toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200")], ); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("1200"), toFixedPtAmt("800")], @@ -888,114 +771,30 @@ describe("RolloverVault", function () { await txFn(); - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, ...reserveTranches.slice(-3), currentTranchesIn[0]], [0, toFixedPtAmt("175"), toFixedPtAmt("175"), toFixedPtAmt("175"), toFixedPtAmt("175")], ); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1], ...reserveTranches.slice(-3)], - [toFixedPtAmt("1235"), toFixedPtAmt("700"), toFixedPtAmt("25"), toFixedPtAmt("25"), toFixedPtAmt("25")], + [toFixedPtAmt("1240"), toFixedPtAmt("700"), toFixedPtAmt("25"), toFixedPtAmt("25"), toFixedPtAmt("25")], ); }); it("should update the vault tvl", async function () { - expect(await vault.callStatic.getTVL()).to.eq(toFixedPtAmt("2000")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("2000")); await txFn(); - expect(await vault.callStatic.getTVL()).to.eq(toFixedPtAmt("2010")); - }); - }); - - describe("on successful swap", function () { - let txFn: Promise; - beforeEach(async function () { - await feePolicy.computePerpBurnFeePerc.returns(toPercFixedPtAmt("0.1")); - await feePolicy.computePerpToUnderlyingVaultSwapFeePerc.returns(toPercFixedPtAmt("0.15")); - txFn = () => vault.swapPerpsForUnderlying(toFixedPtAmt("100")); - }); - - it("should redeem perps for swap and leave none left over", async function () { - expect(await perp.totalSupply()).to.eq(toFixedPtAmt("800")); - await expect(txFn()) - .to.emit(perp, "Transfer") - .withArgs(vault.address, constants.AddressZero, toFixedPtAmt("90")); - expect(await perp.totalSupply()).to.eq(toFixedPtAmt("700")); - expect(await perp.balanceOf(vault.address)).to.eq(0); - }); - - it("should burn perps as fee", async function () { - await expect(txFn()) - .to.emit(perp, "Transfer") - .withArgs(vault.address, constants.AddressZero, toFixedPtAmt("10")); - }); - - it("should return the underlying amt", async function () { - expect(await vault.callStatic.swapPerpsForUnderlying(toFixedPtAmt("100"))).to.eq(toFixedPtAmt("75")); - }); - - it("should transfer perps from the user", async function () { - await expect(txFn).to.changeTokenBalances(perp, [deployer], [toFixedPtAmt("-100")]); - }); - - it("should transfer back underlying to the user", async function () { - await expect(txFn).to.changeTokenBalances(collateralToken, [deployer], [toFixedPtAmt("75")]); - }); - - it("should update the vault assets", async function () { - await checkReserveComposition( - perp, - [collateralToken, ...reserveTranches.slice(-3), currentTranchesIn[0]], - [0, toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200")], - ); - - await checkVaultAssetComposition( - vault, - [collateralToken, currentTranchesIn[1]], - [toFixedPtAmt("1200"), toFixedPtAmt("800")], - ); - - await txFn(); - - await checkReserveComposition( - perp, - [collateralToken, ...reserveTranches.slice(-3), currentTranchesIn[0]], - [ - 0, - toFixedPtAmt("177.215189873417721519"), - toFixedPtAmt("177.215189873417721519"), - toFixedPtAmt("177.215189873417721519"), - toFixedPtAmt("177.215189873417721519"), - ], - ); - - await checkVaultAssetComposition( - vault, - [collateralToken, currentTranchesIn[1], ...reserveTranches.slice(-3), currentTranchesIn[0]], - [ - toFixedPtAmt("1238.924050632911392"), - toFixedPtAmt("708.8607594936708864"), - toFixedPtAmt("22.784810126582278481"), - toFixedPtAmt("22.784810126582278481"), - toFixedPtAmt("22.784810126582278481"), - toFixedPtAmt("0.000000000000000081"), - ], - ); - }); - - it("should update the vault tvl", async function () { - expect(await vault.callStatic.getTVL()).to.eq(toFixedPtAmt("2000")); - await txFn(); - expect(await vault.callStatic.getTVL()).to.eq(toFixedPtAmt("2016.139240506329113843")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("2015")); }); }); describe("on successful swap with imperfect rounding", function () { let txFn: Promise; beforeEach(async function () { - await feePolicy.computePerpBurnFeePerc.returns(toPercFixedPtAmt("0.1")); - await feePolicy.computePerpToUnderlyingVaultSwapFeePerc.returns(toPercFixedPtAmt("0.1")); + await feePolicy.mockMethod("computeFeePerc(uint256,uint256)", [toPercFixedPtAmt("0.1")]); txFn = () => vault.swapPerpsForUnderlying(toFixedPtAmt("100.999999999999999999")); }); @@ -1003,20 +802,14 @@ describe("RolloverVault", function () { expect(await perp.totalSupply()).to.eq(toFixedPtAmt("800")); await expect(txFn()) .to.emit(perp, "Transfer") - .withArgs(vault.address, constants.AddressZero, toFixedPtAmt("90.899999999999999999")); + .withArgs(vault.target, ethers.ZeroAddress, toFixedPtAmt("100.999999999999999999")); expect(await perp.totalSupply()).to.eq(toFixedPtAmt("699.000000000000000001")); - expect(await perp.balanceOf(vault.address)).to.eq(0); - }); - - it("should burn perps as fee", async function () { - await expect(txFn()) - .to.emit(perp, "Transfer") - .withArgs(vault.address, constants.AddressZero, toFixedPtAmt("10.1")); + expect(await perp.balanceOf(vault.target)).to.eq(0); }); it("should return the underlying amt", async function () { - expect(await vault.callStatic.swapPerpsForUnderlying(toFixedPtAmt("100.999999999999999999"))).to.eq( - toFixedPtAmt("80.799999999999999999"), + expect(await vault.swapPerpsForUnderlying.staticCall(toFixedPtAmt("100.999999999999999999"))).to.eq( + toFixedPtAmt("90.899999999999999999"), ); }); @@ -1025,17 +818,17 @@ describe("RolloverVault", function () { }); it("should transfer back underlying to the user", async function () { - await expect(txFn).to.changeTokenBalances(collateralToken, [deployer], [toFixedPtAmt("80.799999999999999999")]); + await expect(txFn).to.changeTokenBalances(collateralToken, [deployer], [toFixedPtAmt("90.899999999999999999")]); }); it("should update the vault assets", async function () { - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, ...reserveTranches.slice(-3), currentTranchesIn[0]], [0, toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200")], ); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("1200"), toFixedPtAmt("800")], @@ -1043,67 +836,58 @@ describe("RolloverVault", function () { await txFn(); - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, ...reserveTranches.slice(-3), currentTranchesIn[0]], [ 0, - toFixedPtAmt("176.984428408659323966"), - toFixedPtAmt("176.984428408659323966"), - toFixedPtAmt("176.984428408659323966"), - toFixedPtAmt("176.984428408659323966"), + toFixedPtAmt("174.750000000000000001"), + toFixedPtAmt("174.750000000000000001"), + toFixedPtAmt("174.750000000000000001"), + toFixedPtAmt("174.750000000000000001"), ], ); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1], ...reserveTranches.slice(-3), currentTranchesIn[0]], [ - toFixedPtAmt("1234.277857956703380001"), - toFixedPtAmt("707.937713634637296000"), - toFixedPtAmt("23.015571591340676034"), - toFixedPtAmt("23.015571591340676034"), - toFixedPtAmt("23.015571591340676034"), - toFixedPtAmt("0.000000000000000034"), + toFixedPtAmt("1235.349999999999999001"), + toFixedPtAmt("699.000000000000000800"), + toFixedPtAmt("25.249999999999999999"), + toFixedPtAmt("25.249999999999999999"), + toFixedPtAmt("25.249999999999999999"), + toFixedPtAmt("0.000000000000000199"), ], ); }); it("should update the vault tvl", async function () { - expect(await vault.callStatic.getTVL()).to.eq(toFixedPtAmt("2000")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("2000")); await txFn(); - expect(await vault.callStatic.getTVL()).to.eq(toFixedPtAmt("2011.262286365362704103")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("2010.099999999999999798")); }); }); describe("on successful swap with some the juniors in the vault", function () { let txFn: Promise; beforeEach(async function () { - await feePolicy.computePerpBurnFeePerc.returns(toPercFixedPtAmt("0.1")); - await feePolicy.computePerpToUnderlyingVaultSwapFeePerc.returns(toPercFixedPtAmt("0.15")); - remainingJuniorTranches[1].transfer(vault.address, toFixedPtAmt("100")); - remainingJuniorTranches[2].transfer(vault.address, toFixedPtAmt("100")); - remainingJuniorTranches[3].transfer(vault.address, toFixedPtAmt("100")); + await feePolicy.mockMethod("computeFeePerc(uint256,uint256)", [toPercFixedPtAmt("0.15")]); + remainingJuniorTranches[1].transfer(vault.target, toFixedPtAmt("100")); + remainingJuniorTranches[2].transfer(vault.target, toFixedPtAmt("100")); + remainingJuniorTranches[3].transfer(vault.target, toFixedPtAmt("100")); txFn = () => vault.swapPerpsForUnderlying(toFixedPtAmt("200")); }); it("should redeem perps for swap and leave none left over", async function () { expect(await perp.totalSupply()).to.eq(toFixedPtAmt("800")); - await expect(txFn()) - .to.emit(perp, "Transfer") - .withArgs(vault.address, constants.AddressZero, toFixedPtAmt("180")); + await expect(txFn()).to.emit(perp, "Transfer").withArgs(vault.target, ethers.ZeroAddress, toFixedPtAmt("200")); expect(await perp.totalSupply()).to.eq(toFixedPtAmt("600")); - expect(await perp.balanceOf(vault.address)).to.eq(0); - }); - - it("should burn perps as fee", async function () { - await expect(txFn()) - .to.emit(perp, "Transfer") - .withArgs(vault.address, constants.AddressZero, toFixedPtAmt("20")); + expect(await perp.balanceOf(vault.target)).to.eq(0); }); it("should return the underlying amt", async function () { - expect(await vault.callStatic.swapPerpsForUnderlying(toFixedPtAmt("200"))).to.eq(toFixedPtAmt("150")); + expect(await vault.swapPerpsForUnderlying.staticCall(toFixedPtAmt("200"))).to.eq(toFixedPtAmt("170")); }); it("should transfer perps from the user", async function () { @@ -1111,17 +895,17 @@ describe("RolloverVault", function () { }); it("should transfer back underlying to the user", async function () { - await expect(txFn).to.changeTokenBalances(collateralToken, [deployer], [toFixedPtAmt("150")]); + await expect(txFn).to.changeTokenBalances(collateralToken, [deployer], [toFixedPtAmt("170")]); }); it("should update the vault assets", async function () { - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, ...reserveTranches.slice(-3), currentTranchesIn[0]], [0, toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200")], ); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("1200"), toFixedPtAmt("800")], @@ -1129,69 +913,47 @@ describe("RolloverVault", function () { await txFn(); - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, ...reserveTranches.slice(-3), currentTranchesIn[0]], - [ - 0, - toFixedPtAmt("153.846153846153846154"), - toFixedPtAmt("153.846153846153846154"), - toFixedPtAmt("153.846153846153846154"), - toFixedPtAmt("153.846153846153846154"), - ], + [0, toFixedPtAmt("150"), toFixedPtAmt("150"), toFixedPtAmt("150"), toFixedPtAmt("150")], ); - await checkVaultAssetComposition( + await checkVaultComposition( vault, - [collateralToken, currentTranchesIn[1], ...reserveTranches.slice(-3), currentTranchesIn[0]], - [ - toFixedPtAmt("1655.769230769230769000"), - toFixedPtAmt("615.384615384615384800"), - toFixedPtAmt("21.153846153846153846"), - toFixedPtAmt("21.153846153846153846"), - toFixedPtAmt("21.153846153846153846"), - toFixedPtAmt("0.000000000000000046"), - ], + [collateralToken, currentTranchesIn[1], ...reserveTranches.slice(-3)], + [toFixedPtAmt("1655"), toFixedPtAmt("600"), toFixedPtAmt("25"), toFixedPtAmt("25"), toFixedPtAmt("25")], ); }); it("should update the vault tvl", async function () { - expect(await vault.callStatic.getTVL()).to.eq(toFixedPtAmt("2000")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("2000")); await txFn(); - expect(await vault.callStatic.getTVL()).to.eq(toFixedPtAmt("2334.615384615384615338")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("2330")); }); }); describe("on successful swap with all the juniors in the vault", function () { let txFn: Promise; beforeEach(async function () { - await feePolicy.computePerpBurnFeePerc.returns(toPercFixedPtAmt("0.1")); - await feePolicy.computePerpToUnderlyingVaultSwapFeePerc.returns(toPercFixedPtAmt("0.15")); + await feePolicy.mockMethod("computeFeePerc(uint256,uint256)", [toPercFixedPtAmt("0.15")]); - remainingJuniorTranches[1].transfer(vault.address, toFixedPtAmt("800")); - remainingJuniorTranches[2].transfer(vault.address, toFixedPtAmt("800")); - remainingJuniorTranches[3].transfer(vault.address, toFixedPtAmt("800")); + remainingJuniorTranches[1].transfer(vault.target, toFixedPtAmt("800")); + remainingJuniorTranches[2].transfer(vault.target, toFixedPtAmt("800")); + remainingJuniorTranches[3].transfer(vault.target, toFixedPtAmt("800")); txFn = () => vault.swapPerpsForUnderlying(toFixedPtAmt("200")); }); it("should redeem perps for swap and leave none left over", async function () { expect(await perp.totalSupply()).to.eq(toFixedPtAmt("800")); - await expect(txFn()) - .to.emit(perp, "Transfer") - .withArgs(vault.address, constants.AddressZero, toFixedPtAmt("180")); + await expect(txFn()).to.emit(perp, "Transfer").withArgs(vault.target, ethers.ZeroAddress, toFixedPtAmt("200")); expect(await perp.totalSupply()).to.eq(toFixedPtAmt("600")); - expect(await perp.balanceOf(vault.address)).to.eq(0); - }); - - it("should burn perps as fee", async function () { - await expect(txFn()) - .to.emit(perp, "Transfer") - .withArgs(vault.address, constants.AddressZero, toFixedPtAmt("20")); + expect(await perp.balanceOf(vault.target)).to.eq(0); }); it("should return the underlying amt", async function () { - expect(await vault.callStatic.swapPerpsForUnderlying(toFixedPtAmt("200"))).to.eq(toFixedPtAmt("150")); + expect(await vault.swapPerpsForUnderlying.staticCall(toFixedPtAmt("200"))).to.eq(toFixedPtAmt("170")); }); it("should transfer perps from the user", async function () { @@ -1199,17 +961,17 @@ describe("RolloverVault", function () { }); it("should transfer back underlying to the user", async function () { - await expect(txFn).to.changeTokenBalances(collateralToken, [deployer], [toFixedPtAmt("150")]); + await expect(txFn).to.changeTokenBalances(collateralToken, [deployer], [toFixedPtAmt("170")]); }); it("should update the vault assets", async function () { - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, ...reserveTranches.slice(-3), currentTranchesIn[0]], [0, toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200"), toFixedPtAmt("200")], ); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [collateralToken, currentTranchesIn[1]], [toFixedPtAmt("1200"), toFixedPtAmt("800")], @@ -1217,19 +979,13 @@ describe("RolloverVault", function () { await txFn(); - await checkReserveComposition( + await checkPerpComposition( perp, [collateralToken, ...reserveTranches.slice(-3), currentTranchesIn[0]], - [ - 0, - toFixedPtAmt("153.846153846153846154"), - toFixedPtAmt("153.846153846153846154"), - toFixedPtAmt("153.846153846153846154"), - toFixedPtAmt("153.846153846153846154"), - ], + [0, toFixedPtAmt("150"), toFixedPtAmt("150"), toFixedPtAmt("150"), toFixedPtAmt("150")], ); - await checkVaultAssetComposition( + await checkVaultComposition( vault, [ collateralToken, @@ -1237,41 +993,29 @@ describe("RolloverVault", function () { remainingJuniorTranches[1], remainingJuniorTranches[2], remainingJuniorTranches[3], - ...reserveTranches.slice(-3), - currentTranchesIn[0], - ], - [ - toFixedPtAmt("1973.076923076923076"), - toFixedPtAmt("615.3846153846153848"), - toFixedPtAmt("615.3846153846153848"), - toFixedPtAmt("615.3846153846153848"), - toFixedPtAmt("615.3846153846153848"), - toFixedPtAmt("0.000000000000000046"), - toFixedPtAmt("0.000000000000000046"), - toFixedPtAmt("0.000000000000000046"), - toFixedPtAmt("0.000000000000000046"), ], + [toFixedPtAmt("2030"), toFixedPtAmt("600"), toFixedPtAmt("600"), toFixedPtAmt("600"), toFixedPtAmt("600")], ); }); it("should update the vault tvl", async function () { - expect(await vault.callStatic.getTVL()).to.eq(toFixedPtAmt("2000")); // + 2400 transferred in + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("2000")); await txFn(); - expect(await vault.callStatic.getTVL()).to.eq(toFixedPtAmt("4434.6153846153846152")); + expect(await vault.getTVL.staticCall()).to.eq(toFixedPtAmt("4430")); }); }); describe("when vault reduces underlying liquidity", function () { it("should be reverted", async function () { - await feePolicy.computePerpBurnFeePerc.returns(toPercFixedPtAmt("0.1")); - await feePolicy.computePerpToUnderlyingVaultSwapFeePerc.returns(toPercFixedPtAmt("0.15")); - await vault.swapPerpsForUnderlying(toFixedPtAmt("800")); + await feePolicy.mockMethod("computeFeePerc(uint256,uint256)", [toPercFixedPtAmt("0.15")]); const bond = await getDepositBond(perp); const tranches = await getTranches(bond); - await depositIntoBond(bond, toFixedPtAmt("1000"), deployer); - await tranches[0].approve(perp.address, toFixedPtAmt("200")); - await perp.deposit(tranches[0].address, toFixedPtAmt("200")); + await depositIntoBond(bond, toFixedPtAmt("1200"), deployer); + + await vault.swapPerpsForUnderlying(toFixedPtAmt("800")); + await tranches[0].approve(perp.target, toFixedPtAmt("200")); + await perp.deposit(tranches[0].target, toFixedPtAmt("200")); await expect(vault.swapPerpsForUnderlying(toFixedPtAmt("1"))).to.be.revertedWithCustomError( vault, "InsufficientLiquidity", diff --git a/spot-staking-subgraph/README.md b/spot-staking-subgraph/README.md index 5a04bb42..6bb96bd6 100644 --- a/spot-staking-subgraph/README.md +++ b/spot-staking-subgraph/README.md @@ -8,8 +8,6 @@ yarn codegen yarn build -yarn graph deploy spot-staking \ - --node https://subgraphs.alchemy.com/api/subgraphs/deploy \ - --deploy-key $GRAPH_AUTH \ - --ipfs https://ipfs.satsuma.xyz +export GRAPH_AUTH="SET_KEY" +yarn deploy ``` \ No newline at end of file diff --git a/spot-staking-subgraph/abis/BillBroker.json b/spot-staking-subgraph/abis/BillBroker.json new file mode 100644 index 00000000..ab4ff3a8 --- /dev/null +++ b/spot-staking-subgraph/abis/BillBroker.json @@ -0,0 +1,1691 @@ +[ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InvalidARBound", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidPerc", + "type": "error" + }, + { + "inputs": [], + "name": "SlippageTooHigh", + "type": "error" + }, + { + "inputs": [], + "name": "UnacceptableSwap", + "type": "error" + }, + { + "inputs": [], + "name": "UnauthorizedCall", + "type": "error" + }, + { + "inputs": [], + "name": "UnexpectedARDelta", + "type": "error" + }, + { + "inputs": [], + "name": "UnexpectedDecimals", + "type": "error" + }, + { + "inputs": [], + "name": "UnreliablePrice", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "perpAmtIn", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "usdBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "perpBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "usdPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "perpPrice", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct ReserveState", + "name": "preOpState", + "type": "tuple" + } + ], + "name": "DepositPerp", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "usdAmtIn", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "usdBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "perpBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "usdPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "perpPrice", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct ReserveState", + "name": "preOpState", + "type": "tuple" + } + ], + "name": "DepositUSD", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "perpAmtIn", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "usdBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "perpBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "usdPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "perpPrice", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct ReserveState", + "name": "preOpState", + "type": "tuple" + } + ], + "name": "SwapPerpsForUSD", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "usdAmtIn", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "usdBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "perpBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "usdPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "perpPrice", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct ReserveState", + "name": "preOpState", + "type": "tuple" + } + ], + "name": "SwapUSDForPerps", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "inputs": [], + "name": "DECIMALS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MINIMUM_LIQUIDITY", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ONE", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "arHardBound", + "outputs": [ + { + "internalType": "uint256", + "name": "lower", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "upper", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "arSoftBound", + "outputs": [ + { + "internalType": "uint256", + "name": "lower", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "upper", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "usdBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "perpBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "usdPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "perpPrice", + "type": "uint256" + } + ], + "internalType": "struct ReserveState", + "name": "s", + "type": "tuple" + } + ], + "name": "assetRatio", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burnFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "usdAmtMax", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "perpAmtMax", + "type": "uint256" + } + ], + "name": "computeMintAmt", + "outputs": [ + { + "internalType": "uint256", + "name": "mintAmt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "usdAmtIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "perpAmtIn", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isFirstMint", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "perpAmtIn", + "type": "uint256" + } + ], + "name": "computeMintAmtWithPerp", + "outputs": [ + { + "internalType": "uint256", + "name": "mintAmt", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "perpAmtIn", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "usdBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "perpBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "usdPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "perpPrice", + "type": "uint256" + } + ], + "internalType": "struct ReserveState", + "name": "s", + "type": "tuple" + } + ], + "name": "computeMintAmtWithPerp", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "usdAmtIn", + "type": "uint256" + } + ], + "name": "computeMintAmtWithUSD", + "outputs": [ + { + "internalType": "uint256", + "name": "mintAmt", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "usdAmtIn", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "usdBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "perpBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "usdPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "perpPrice", + "type": "uint256" + } + ], + "internalType": "struct ReserveState", + "name": "s", + "type": "tuple" + } + ], + "name": "computeMintAmtWithUSD", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "perpAmtIn", + "type": "uint256" + } + ], + "name": "computePerpToUSDSwapAmt", + "outputs": [ + { + "internalType": "uint256", + "name": "usdAmtOut", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "perpAmtIn", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "usdBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "perpBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "usdPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "perpPrice", + "type": "uint256" + } + ], + "internalType": "struct ReserveState", + "name": "s", + "type": "tuple" + } + ], + "name": "computePerpToUSDSwapAmt", + "outputs": [ + { + "internalType": "uint256", + "name": "usdAmtOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lpFeeUsdAmt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "protocolFeeUsdAmt", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "arPre", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "arPost", + "type": "uint256" + } + ], + "name": "computePerpToUSDSwapFeePerc", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "burnAmt", + "type": "uint256" + } + ], + "name": "computeRedemptionAmts", + "outputs": [ + { + "internalType": "uint256", + "name": "usdAmtOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "perpAmtOut", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "usdAmtIn", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "usdBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "perpBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "usdPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "perpPrice", + "type": "uint256" + } + ], + "internalType": "struct ReserveState", + "name": "s", + "type": "tuple" + } + ], + "name": "computeUSDToPerpSwapAmt", + "outputs": [ + { + "internalType": "uint256", + "name": "perpAmtOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lpFeePerpAmt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "protocolFeePerpAmt", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "usdAmtIn", + "type": "uint256" + } + ], + "name": "computeUSDToPerpSwapAmt", + "outputs": [ + { + "internalType": "uint256", + "name": "perpAmtOut", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "arPre", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "arPost", + "type": "uint256" + } + ], + "name": "computeUSDToPerpSwapFeePerc", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "usdAmtMax", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "perpAmtMax", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "usdAmtMin", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "perpAmtMin", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [ + { + "internalType": "uint256", + "name": "mintAmt", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "perpAmtIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "postOpAssetRatioMin", + "type": "uint256" + } + ], + "name": "depositPerp", + "outputs": [ + { + "internalType": "uint256", + "name": "mintAmt", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "usdAmtIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "postOpAssetRatioMax", + "type": "uint256" + } + ], + "name": "depositUSD", + "outputs": [ + { + "internalType": "uint256", + "name": "mintAmt", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "fees", + "outputs": [ + { + "internalType": "uint256", + "name": "mintFeePerc", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "burnFeePerc", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "lower", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "upper", + "type": "uint256" + } + ], + "internalType": "struct Range", + "name": "perpToUSDSwapFeePercs", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "lower", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "upper", + "type": "uint256" + } + ], + "internalType": "struct Range", + "name": "usdToPerpSwapFeePercs", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "protocolSwapSharePerc", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "contract IERC20Upgradeable", + "name": "usd_", + "type": "address" + }, + { + "internalType": "contract IPerpetualTranche", + "name": "perp_", + "type": "address" + }, + { + "internalType": "contract ISpotPricingStrategy", + "name": "pricingStrategy_", + "type": "address" + } + ], + "name": "init", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "keeper", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "perp", + "outputs": [ + { + "internalType": "contract IPerpetualTranche", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "perpBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "perpPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "perpUnitAmt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pricingStrategy", + "outputs": [ + { + "internalType": "contract ISpotPricingStrategy", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "protocolFeeCollector", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "burnAmt", + "type": "uint256" + } + ], + "name": "redeem", + "outputs": [ + { + "internalType": "uint256", + "name": "usdAmtOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "perpAmtOut", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "reserveState", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "usdBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "perpBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "usdPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "perpPrice", + "type": "uint256" + } + ], + "internalType": "struct ReserveState", + "name": "s", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "perpAmtIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "usdAmtMin", + "type": "uint256" + } + ], + "name": "swapPerpsForUSD", + "outputs": [ + { + "internalType": "uint256", + "name": "usdAmtOut", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "usdAmtIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "perpAmtMin", + "type": "uint256" + } + ], + "name": "swapUSDForPerps", + "outputs": [ + { + "internalType": "uint256", + "name": "perpAmtOut", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "lower", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "upper", + "type": "uint256" + } + ], + "internalType": "struct Range", + "name": "arSoftBound_", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "lower", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "upper", + "type": "uint256" + } + ], + "internalType": "struct Range", + "name": "arHardBound_", + "type": "tuple" + } + ], + "name": "updateARBounds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "mintFeePerc", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "burnFeePerc", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "lower", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "upper", + "type": "uint256" + } + ], + "internalType": "struct Range", + "name": "perpToUSDSwapFeePercs", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "lower", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "upper", + "type": "uint256" + } + ], + "internalType": "struct Range", + "name": "usdToPerpSwapFeePercs", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "protocolSwapSharePerc", + "type": "uint256" + } + ], + "internalType": "struct BillBrokerFees", + "name": "fees_", + "type": "tuple" + } + ], + "name": "updateFees", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "keeper_", + "type": "address" + } + ], + "name": "updateKeeper", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ISpotPricingStrategy", + "name": "pricingStrategy_", + "type": "address" + } + ], + "name": "updatePricingStrategy", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "usd", + "outputs": [ + { + "internalType": "contract IERC20Upgradeable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "usdBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "usdPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "usdUnitAmt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/spot-staking-subgraph/abis/Wrapper.json b/spot-staking-subgraph/abis/Wrapper.json new file mode 100644 index 00000000..7e04cd87 --- /dev/null +++ b/spot-staking-subgraph/abis/Wrapper.json @@ -0,0 +1,28 @@ +[ + { + "inputs": [], + "name": "underlying", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "collateral", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/spot-staking-subgraph/package.json b/spot-staking-subgraph/package.json index 8af2db64..27c82288 100644 --- a/spot-staking-subgraph/package.json +++ b/spot-staking-subgraph/package.json @@ -7,6 +7,7 @@ "codegen": "graph codegen --output-dir ./generated", "build": "graph build", "lint": "yarn prettier --config .prettierrc --write '**/*.ts'", + "deploy": "yarn codegen && yarn build && yarn graph deploy spot-staking --node https://subgraphs.alchemy.com/api/subgraphs/deploy --deploy-key $GRAPH_AUTH", "create-local": "graph create --node http://localhost:8020/ ampleforth/spot-staking", "remove-local": "graph remove --node http://localhost:8020/ ampleforth/spot-staking", "deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 ampleforth/spot-staking", diff --git a/spot-staking-subgraph/schema.graphql b/spot-staking-subgraph/schema.graphql index 82f2139a..61e1d6f3 100644 --- a/spot-staking-subgraph/schema.graphql +++ b/spot-staking-subgraph/schema.graphql @@ -1,3 +1,59 @@ +type BillBroker @entity { + " the vault address " + id: ID! + name: String! + symbol: String! + decimals: BigInt! + perp: String! + perpName: String! + perpSymbol: String! + perpDecimals: BigInt! + usd: String! + usdName: String! + usdSymbol: String! + usdDecimals: BigInt! + perpBal: BigDecimal! + usdBal: BigDecimal! + perpPrice: BigDecimal! + usdPrice: BigDecimal! + totalSupply: BigDecimal! + tvl:BigDecimal! + price:BigDecimal! + dailyStats: [BillBrokerDailyStat!]! @derivedFrom(field: "vault") + swapNonce: BigInt! + swaps: [BillBrokerSwap!]! @derivedFrom(field: "vault") +} + +type BillBrokerDailyStat @entity { + "-" + id: ID! + vault: BillBroker! + timestamp: BigInt! + perpBal: BigDecimal! + usdBal: BigDecimal! + perpPrice: BigDecimal! + usdPrice: BigDecimal! + totalSupply: BigDecimal! + usdSwapAmt: BigDecimal! + perpSwapAmt: BigDecimal! + usdFeeAmt: BigDecimal! + perpFeeAmt: BigDecimal! + tvl:BigDecimal! + price:BigDecimal! +} + +type BillBrokerSwap @entity { + "-" + id: ID! + vault: BillBroker! + timestamp: BigInt! + nonce: BigInt! + type: String! + swapAmt: BigDecimal! + feeAmt: BigDecimal! + tx: String! +} + type CharmVault @entity { " the vault address " id: ID! @@ -15,17 +71,11 @@ type CharmVault @entity { token1Decimals: BigInt! token0Bal: BigDecimal! token1Bal: BigDecimal! - token0BalIn: BigDecimal! - token1BalIn: BigDecimal! token0Price: BigDecimal! token1Price: BigDecimal! tvl: BigDecimal! - valueIn: BigDecimal! price: BigDecimal! totalSupply: BigDecimal! - unusedToken0Bal: BigDecimal! - unusedToken1Bal: BigDecimal! - unusedTVL: BigDecimal! dailyStats: [CharmVaultDailyStat!]! @derivedFrom(field: "vault") } @@ -36,12 +86,13 @@ type CharmVaultDailyStat @entity { timestamp: BigInt! token0Bal: BigDecimal! token1Bal: BigDecimal! - token0BalIn: BigDecimal! - token1BalIn: BigDecimal! token0Price: BigDecimal! token1Price: BigDecimal! tvl: BigDecimal! - valueIn: BigDecimal! price: BigDecimal! totalSupply: BigDecimal! -} \ No newline at end of file + token0Fees: BigDecimal! + token1Fees: BigDecimal! + totalFeeVal: BigDecimal! + feeYield: BigDecimal! +} diff --git a/spot-staking-subgraph/src/billBroker.ts b/spot-staking-subgraph/src/billBroker.ts new file mode 100644 index 00000000..c43664be --- /dev/null +++ b/spot-staking-subgraph/src/billBroker.ts @@ -0,0 +1,284 @@ +import { + log, + ethereum, + BigInt, + BigDecimal, + Address, + DataSourceContext, +} from '@graphprotocol/graph-ts' +import { RebasingERC20 } from '../generated/templates' +import { + DepositCall, + RedeemCall, + DepositUSD, + DepositPerp, + SwapPerpsForUSD, + SwapUSDForPerps, +} from '../generated/BillBroker/BillBroker' +import { + BillBroker__computePerpToUSDSwapAmt1InputSStruct, + BillBroker__computeUSDToPerpSwapAmtInputSStruct, +} from '../generated/BillBroker/BillBroker' +import { BillBroker as BillBrokerABI } from '../generated/BillBroker/BillBroker' +import { ERC20 as ERC20ABI } from '../generated/BillBroker/ERC20' +import { BillBroker, BillBrokerDailyStat, BillBrokerSwap } from '../generated/schema' +import { + BIGINT_ZERO, + BIGINT_ONE, + BIGDECIMAL_ZERO, + BIGDECIMAL_ONE, + dayTimestamp, + stringToAddress, + formatBalance, + getUnderlyingAddress, +} from './utils' + +export function fetchBillBroker(address: Address): BillBroker { + let id = address.toHexString() + let vault = BillBroker.load(id) + if (vault === null) { + vault = new BillBroker(id) + let vaultContract = BillBrokerABI.bind(address) + vault.name = vaultContract.name() + vault.symbol = vaultContract.symbol() + vault.decimals = BigInt.fromI32(vaultContract.decimals()) + + let perpAddress = vaultContract.perp() + let perpContract = ERC20ABI.bind(perpAddress) + vault.perp = perpAddress.toHexString() + vault.perpName = perpContract.name() + vault.perpSymbol = perpContract.symbol() + vault.perpDecimals = BigInt.fromI32(perpContract.decimals()) + + let usdAddress = vaultContract.usd() + let usdContract = ERC20ABI.bind(usdAddress) + vault.usd = usdAddress.toHexString() + vault.usdName = usdContract.name() + vault.usdSymbol = usdContract.symbol() + vault.usdDecimals = BigInt.fromI32(usdContract.decimals()) + + vault.perpBal = BIGDECIMAL_ZERO + vault.usdBal = BIGDECIMAL_ZERO + vault.perpPrice = BIGDECIMAL_ZERO + vault.usdPrice = BIGDECIMAL_ZERO + vault.totalSupply = BIGDECIMAL_ZERO + vault.tvl = BIGDECIMAL_ZERO + vault.price = BIGDECIMAL_ZERO + vault.swapNonce = BIGINT_ZERO + + let context = new DataSourceContext() + context.setString('billBroker', id) + RebasingERC20.createWithContext(getUnderlyingAddress(perpAddress), context) + vault.save() + } + return vault as BillBroker +} + +export function fetchBillBrokerDailyStat(vault: BillBroker, timestamp: BigInt): BillBrokerDailyStat { + let id = vault.id.concat('-').concat(timestamp.toString()) + let dailyStat = BillBrokerDailyStat.load(id) + if (dailyStat === null) { + dailyStat = new BillBrokerDailyStat(id) + dailyStat.vault = vault.id + dailyStat.timestamp = timestamp + dailyStat.perpBal = BIGDECIMAL_ZERO + dailyStat.usdBal = BIGDECIMAL_ZERO + dailyStat.perpPrice = BIGDECIMAL_ZERO + dailyStat.usdPrice = BIGDECIMAL_ZERO + dailyStat.totalSupply = BIGDECIMAL_ZERO + dailyStat.usdSwapAmt = BIGDECIMAL_ZERO + dailyStat.perpSwapAmt = BIGDECIMAL_ZERO + dailyStat.usdFeeAmt = BIGDECIMAL_ZERO + dailyStat.perpFeeAmt = BIGDECIMAL_ZERO + dailyStat.tvl = BIGDECIMAL_ZERO + dailyStat.price = BIGDECIMAL_ZERO + dailyStat.save() + } + return dailyStat as BillBrokerDailyStat +} + +function fetchBillBrokerSwap(vault: BillBroker, nonce: BigInt): BillBrokerSwap { + let id = vault.id.concat('-').concat(nonce.toString()) + let swap = BillBrokerSwap.load(id) + if (swap === null) { + swap = new BillBrokerSwap(id) + swap.vault = vault.id + swap.nonce = nonce + swap.type = '' + swap.swapAmt = BIGDECIMAL_ZERO + swap.feeAmt = BIGDECIMAL_ZERO + swap.tx = '0x' + swap.timestamp = BIGINT_ZERO + swap.save() + } + return swap as BillBrokerSwap +} + +export function refreshBillBrokerStats(vault: BillBroker, dailyStat: BillBrokerDailyStat): void { + let vaultContract = BillBrokerABI.bind(stringToAddress(vault.id)) + vault.perpBal = formatBalance(vaultContract.perpBalance(), vault.perpDecimals) + vault.usdBal = formatBalance(vaultContract.usdBalance(), vault.usdDecimals) + vault.totalSupply = formatBalance(vaultContract.totalSupply(), vault.decimals) + vault.save() + + dailyStat.perpBal = vault.perpBal + dailyStat.usdBal = vault.usdBal + dailyStat.totalSupply = vault.totalSupply + dailyStat.save() +} + +export function handleDeposit(call: DepositCall): void { + log.warning('triggered deposit', []) + let vault = fetchBillBroker(call.to) + let dailyStat = fetchBillBrokerDailyStat(vault, dayTimestamp(call.block.timestamp)) + refreshBillBrokerStats(vault, dailyStat) +} + +export function handleRedeem(call: RedeemCall): void { + log.warning('triggered redeem', []) + let vault = fetchBillBroker(call.to) + let dailyStat = fetchBillBrokerDailyStat(vault, dayTimestamp(call.block.timestamp)) + refreshBillBrokerStats(vault, dailyStat) +} + +export function handleSwapPerpsForUSD(event: SwapPerpsForUSD): void { + log.warning('triggered swap perps', []) + let vault = fetchBillBroker(event.address) + let dailyStat = fetchBillBrokerDailyStat(vault, dayTimestamp(event.block.timestamp)) + let swap = fetchBillBrokerSwap(vault, vault.swapNonce.plus(BIGINT_ONE)) + refreshBillBrokerStats(vault, dailyStat) + + vault.perpPrice = formatBalance(event.params.preOpState.perpPrice, vault.decimals) + vault.usdPrice = formatBalance(event.params.preOpState.usdPrice, vault.decimals) + vault.tvl = vault.usdBal.times(vault.usdPrice).plus(vault.perpBal.times(vault.perpPrice)) + vault.price = vault.tvl.div(vault.totalSupply) + vault.save() + + dailyStat.perpPrice = vault.perpPrice + dailyStat.usdPrice = vault.usdPrice + dailyStat.tvl = vault.tvl + dailyStat.price = vault.price + dailyStat.save() + + swap.type = 'perps' + swap.swapAmt = formatBalance(event.params.perpAmtIn, vault.perpDecimals) + swap.tx = event.transaction.hash.toHex() + swap.timestamp = event.block.timestamp + swap.save() + + let vaultContract = BillBrokerABI.bind(stringToAddress(vault.id)) + let reserveStateValues: Array = [ + ethereum.Value.fromUnsignedBigInt(event.params.preOpState.usdBalance), + ethereum.Value.fromUnsignedBigInt(event.params.preOpState.perpBalance), + ethereum.Value.fromUnsignedBigInt(event.params.preOpState.usdPrice), + ethereum.Value.fromUnsignedBigInt(event.params.preOpState.perpPrice), + ] + let reserveStateTuple = changetype(reserveStateValues) + let reserveStateStruct = changetype( + reserveStateTuple, + ) + let r = vaultContract.try_computePerpToUSDSwapAmt1(event.params.perpAmtIn, reserveStateStruct) + if (!r.reverted) { + let swapAmts = r.value + dailyStat.perpSwapAmt = dailyStat.perpSwapAmt.plus( + formatBalance(event.params.perpAmtIn, vault.perpDecimals), + ) + dailyStat.usdFeeAmt = dailyStat.usdFeeAmt.plus( + formatBalance(swapAmts.value1, vault.usdDecimals), + ) + dailyStat.save() + + swap.feeAmt = dailyStat.usdFeeAmt + swap.save() + } +} + +export function handleSwapUSDForPerps(event: SwapUSDForPerps): void { + log.warning('triggered swap usd', []) + let vault = fetchBillBroker(event.address) + let dailyStat = fetchBillBrokerDailyStat(vault, dayTimestamp(event.block.timestamp)) + let swap = fetchBillBrokerSwap(vault, vault.swapNonce.plus(BIGINT_ONE)) + refreshBillBrokerStats(vault, dailyStat) + + vault.perpPrice = formatBalance(event.params.preOpState.perpPrice, vault.decimals) + vault.usdPrice = formatBalance(event.params.preOpState.usdPrice, vault.decimals) + vault.tvl = vault.usdBal.times(vault.usdPrice).plus(vault.perpBal.times(vault.perpPrice)) + vault.price = vault.tvl.div(vault.totalSupply) + vault.save() + + dailyStat.perpPrice = vault.perpPrice + dailyStat.usdPrice = vault.usdPrice + dailyStat.tvl = vault.tvl + dailyStat.price = vault.price + dailyStat.save() + + swap.type = 'usd' + swap.swapAmt = formatBalance(event.params.usdAmtIn, vault.perpDecimals) + swap.tx = event.transaction.hash.toHex() + swap.timestamp = event.block.timestamp + swap.save() + + let vaultContract = BillBrokerABI.bind(stringToAddress(vault.id)) + let reserveStateValues: Array = [ + ethereum.Value.fromUnsignedBigInt(event.params.preOpState.usdBalance), + ethereum.Value.fromUnsignedBigInt(event.params.preOpState.perpBalance), + ethereum.Value.fromUnsignedBigInt(event.params.preOpState.usdPrice), + ethereum.Value.fromUnsignedBigInt(event.params.preOpState.perpPrice), + ] + let reserveStateTuple = changetype(reserveStateValues) + let reserveStateStruct = changetype( + reserveStateTuple, + ) + let r = vaultContract.try_computeUSDToPerpSwapAmt(event.params.usdAmtIn, reserveStateStruct) + if (!r.reverted) { + let swapAmts = r.value + dailyStat.usdSwapAmt = dailyStat.usdSwapAmt.plus( + formatBalance(event.params.usdAmtIn, vault.usdDecimals), + ) + dailyStat.perpFeeAmt = dailyStat.perpFeeAmt.plus( + formatBalance(swapAmts.value1, vault.perpDecimals), + ) + dailyStat.save() + + swap.feeAmt = dailyStat.perpFeeAmt + swap.save() + } +} + +export function handleDepositUSD(event: DepositUSD): void { + log.warning('triggered single sided deposit', []) + let vault = fetchBillBroker(event.address) + let dailyStat = fetchBillBrokerDailyStat(vault, dayTimestamp(event.block.timestamp)) + refreshBillBrokerStats(vault, dailyStat) + + vault.perpPrice = formatBalance(event.params.preOpState.perpPrice, vault.decimals) + vault.usdPrice = formatBalance(event.params.preOpState.usdPrice, vault.decimals) + vault.tvl = vault.usdBal.times(vault.usdPrice).plus(vault.perpBal.times(vault.perpPrice)) + vault.price = vault.tvl.div(vault.totalSupply) + vault.save() + + dailyStat.perpPrice = vault.perpPrice + dailyStat.usdPrice = vault.usdPrice + dailyStat.tvl = vault.tvl + dailyStat.price = vault.price + dailyStat.save() +} + +export function handleDepositPerp(event: DepositPerp): void { + log.warning('triggered single sided deposit', []) + let vault = fetchBillBroker(event.address) + let dailyStat = fetchBillBrokerDailyStat(vault, dayTimestamp(event.block.timestamp)) + refreshBillBrokerStats(vault, dailyStat) + + vault.perpPrice = formatBalance(event.params.preOpState.perpPrice, vault.decimals) + vault.usdPrice = formatBalance(event.params.preOpState.usdPrice, vault.decimals) + vault.tvl = vault.usdBal.times(vault.usdPrice).plus(vault.perpBal.times(vault.perpPrice)) + vault.price = vault.tvl.div(vault.totalSupply) + vault.save() + + dailyStat.perpPrice = vault.perpPrice + dailyStat.usdPrice = vault.usdPrice + dailyStat.tvl = vault.tvl + dailyStat.price = vault.price + dailyStat.save() +} diff --git a/spot-staking-subgraph/src/charmVault.ts b/spot-staking-subgraph/src/charmVault.ts new file mode 100644 index 00000000..3a420458 --- /dev/null +++ b/spot-staking-subgraph/src/charmVault.ts @@ -0,0 +1,153 @@ +import { + log, + ethereum, + BigInt, + BigDecimal, + Address, + DataSourceContext, +} from '@graphprotocol/graph-ts' +import { RebasingERC20 } from '../generated/templates' +import { Deposit, Withdraw, Snapshot, CollectFees } from '../generated/CharmSPOTVault/CharmVault' +import { CharmVault as CharmVaultABI } from '../generated/CharmSPOTVault/CharmVault' +import { UniV3Pool as UniV3PoolABI } from '../generated/CharmSPOTVault/UniV3Pool' +import { ERC20 as ERC20ABI } from '../generated/CharmSPOTVault/ERC20' +import { CharmVault, CharmVaultDailyStat } from '../generated/schema' + +import { + BIGINT_ZERO, + BIGINT_ONE, + BIGDECIMAL_ZERO, + BIGDECIMAL_ONE, + dayTimestamp, + stringToAddress, + formatBalance, + exponentToBigDecimal, + safeDiv, + sqrtPriceX96ToTokenPrices, + getUnderlyingAddress, +} from './utils' + +export function fetchCharmVault(address: Address): CharmVault { + let id = address.toHexString() + let vault = CharmVault.load(id) + if (vault === null) { + vault = new CharmVault(id) + let vaultContract = CharmVaultABI.bind(address) + vault.pool = vaultContract.pool().toHexString() + vault.name = vaultContract.name() + vault.symbol = vaultContract.symbol() + vault.decimals = BigInt.fromI32(vaultContract.decimals()) + + let token0Address = vaultContract.token0() + let token0Contract = ERC20ABI.bind(token0Address) + vault.token0 = token0Address.toHexString() + vault.token0Name = token0Contract.name() + vault.token0Symbol = token0Contract.symbol() + vault.token0Decimals = BigInt.fromI32(token0Contract.decimals()) + + let token1Address = vaultContract.token1() + let token1Contract = ERC20ABI.bind(token1Address) + vault.token1 = token1Address.toHexString() + vault.token1Name = token1Contract.name() + vault.token1Symbol = token1Contract.symbol() + vault.token1Decimals = BigInt.fromI32(token1Contract.decimals()) + + vault.token0Bal = BIGDECIMAL_ZERO + vault.token1Bal = BIGDECIMAL_ZERO + vault.token0Price = BIGDECIMAL_ZERO + vault.token1Price = BIGDECIMAL_ZERO + vault.tvl = BIGDECIMAL_ZERO + vault.price = BIGDECIMAL_ZERO + vault.totalSupply = BIGDECIMAL_ZERO + + let context = new DataSourceContext() + context.setString('charmVault', id) + RebasingERC20.createWithContext(getUnderlyingAddress(token1Address), context) + vault.save() + } + return vault as CharmVault +} + +export function fetchCharmVaultDailyStat(vault: CharmVault, timestamp: BigInt): CharmVaultDailyStat { + let id = vault.id.concat('-').concat(timestamp.toString()) + let dailyStat = CharmVaultDailyStat.load(id) + if (dailyStat === null) { + dailyStat = new CharmVaultDailyStat(id) + dailyStat.vault = vault.id + dailyStat.timestamp = timestamp + dailyStat.token0Bal = BIGDECIMAL_ZERO + dailyStat.token1Bal = BIGDECIMAL_ZERO + dailyStat.token0Price = BIGDECIMAL_ZERO + dailyStat.token1Price = BIGDECIMAL_ZERO + dailyStat.tvl = BIGDECIMAL_ZERO + dailyStat.price = BIGDECIMAL_ZERO + dailyStat.totalSupply = BIGDECIMAL_ZERO + dailyStat.token0Fees = BIGDECIMAL_ZERO + dailyStat.token1Fees = BIGDECIMAL_ZERO + dailyStat.totalFeeVal = BIGDECIMAL_ZERO + dailyStat.feeYield = BIGDECIMAL_ZERO + dailyStat.save() + } + return dailyStat as CharmVaultDailyStat +} + +export function refreshCharmVaultStats(vault: CharmVault, dailyStat: CharmVaultDailyStat): void { + let vaultContract = CharmVaultABI.bind(stringToAddress(vault.id)) + let tokenBals = vaultContract.getTotalAmounts() + let uniPoolContract = UniV3PoolABI.bind(stringToAddress(vault.pool)) + let slot0 = uniPoolContract.slot0() + let sqrtPrice = slot0.value0 + let prices = sqrtPriceX96ToTokenPrices(sqrtPrice, vault.token0Decimals, vault.token1Decimals) + + vault.token0Bal = formatBalance(tokenBals.value0, vault.token0Decimals) + vault.token1Bal = formatBalance(tokenBals.value1, vault.token1Decimals) + vault.token0Price = BIGDECIMAL_ONE + vault.token1Price = prices[0] + vault.tvl = vault.token0Bal.times(vault.token0Price).plus(vault.token1Bal.times(vault.token1Price)) + vault.totalSupply = formatBalance(vaultContract.totalSupply(), vault.decimals) + vault.price = vault.tvl.div(vault.totalSupply) + vault.save() + + dailyStat.token0Bal = vault.token0Bal + dailyStat.token1Bal = vault.token1Bal + dailyStat.token0Price = vault.token0Price + dailyStat.token1Price = vault.token1Price + dailyStat.tvl = vault.tvl + dailyStat.totalSupply = vault.totalSupply + dailyStat.price = vault.price + dailyStat.save() +} + +export function handleDeposit(event: Deposit): void { + log.warning('triggered deposit', []) + let vault = fetchCharmVault(event.address) + let dailyStat = fetchCharmVaultDailyStat(vault, dayTimestamp(event.block.timestamp)) + refreshCharmVaultStats(vault, dailyStat) +} + +export function handleWithdraw(event: Withdraw): void { + log.warning('triggered withdraw', []) + let vault = fetchCharmVault(event.address) + let dailyStat = fetchCharmVaultDailyStat(vault, dayTimestamp(event.block.timestamp)) + refreshCharmVaultStats(vault, dailyStat) +} + +export function handleSnapshot(event: Snapshot): void { + log.warning('triggered snapshot', []) + let vault = fetchCharmVault(event.address) + let dailyStat = fetchCharmVaultDailyStat(vault, dayTimestamp(event.block.timestamp)) + refreshCharmVaultStats(vault, dailyStat) +} + +export function handleFees(event: CollectFees): void { + log.warning('triggered collect fees', []) + let vault = fetchCharmVault(event.address) + let dailyStat = fetchCharmVaultDailyStat(vault, dayTimestamp(event.block.timestamp)) + refreshCharmVaultStats(vault, dailyStat) + + dailyStat.token0Fees = dailyStat.token0Fees.plus(formatBalance(event.params.feesToVault0, vault.token0Decimals)) + dailyStat.token1Fees = dailyStat.token1Fees.plus(formatBalance(event.params.feesToVault1, vault.token1Decimals)) + dailyStat.totalFeeVal = dailyStat.token1Fees.times(dailyStat.token1Price).plus(dailyStat.token0Fees.times(dailyStat.token0Price)) + dailyStat.feeYield = dailyStat.totalFeeVal.div(dailyStat.tvl.minus(dailyStat.totalFeeVal)) + dailyStat.save() +} diff --git a/spot-staking-subgraph/src/mappings.ts b/spot-staking-subgraph/src/mappings.ts deleted file mode 100644 index d1430dc8..00000000 --- a/spot-staking-subgraph/src/mappings.ts +++ /dev/null @@ -1,214 +0,0 @@ -import { log, ethereum, BigInt, BigDecimal, Address } from '@graphprotocol/graph-ts' -import { Deposit, Withdraw, Snapshot } from '../generated/CharmVault/CharmVault' -import { CharmVault as CharmVaultABI } from '../generated/CharmVault/CharmVault' -import { UniV3Pool as UniV3PoolABI } from '../generated/CharmVault/UniV3Pool' -import { ERC20 as ERC20ABI } from '../generated/CharmVault/ERC20' -import { CharmVault, CharmVaultDailyStat } from '../generated/schema' - -let BIGINT_ZERO = BigInt.fromI32(0) -let BIGDECIMAL_ZERO = BigDecimal.fromString('0') -let BIGDECIMAL_ONE = BigDecimal.fromString('1') - -let BLOCK_UPDATE_INTERVAL = BigInt.fromI32(240) -let CHARM_VAULT_ID = '0x2dcaff0f75765d7867887fc402b71c841b3a4bfb' -let CHARM_VAULT_UPDATE_BLOCK = BigInt.fromI32(19798270) - -const dayTimestamp = (timestamp: BigInt): BigInt => { - return timestamp.minus(timestamp % BigInt.fromI32(24 * 3600)) -} -const stringToAddress = (id: string): Address => { - return Address.fromString(id) -} -const formatBalance = (wei: BigInt, decimals: BigInt): BigDecimal => { - return wei.toBigDecimal().div( - BigInt.fromI32(10) - .pow(decimals.toI32() as u8) - .toBigDecimal(), - ) -} - -// https://github.com/Uniswap/v3-subgraph/blob/main/src/utils/index.ts#L30 -function exponentToBigDecimal(decimals: BigInt): BigDecimal { - let resultString = '1' - for (let i = 0; i < decimals.toI32(); i++) { - resultString += '0' - } - return BigDecimal.fromString(resultString) -} -function safeDiv(amount0: BigDecimal, amount1: BigDecimal): BigDecimal { - if (amount1.equals(BIGDECIMAL_ZERO)) { - return BIGDECIMAL_ZERO - } else { - return amount0.div(amount1) - } -} -function sqrtPriceX96ToTokenPrices( - sqrtPriceX96: BigInt, - token0Decimals: BigInt, - token1Decimals: BigInt, -): BigDecimal[] { - let Q192 = BigInt.fromI32(2).pow(192 as u8) - let num = sqrtPriceX96.times(sqrtPriceX96).toBigDecimal() - let denom = BigDecimal.fromString(Q192.toString()) - let price1 = num - .div(denom) - .times(exponentToBigDecimal(token0Decimals)) - .div(exponentToBigDecimal(token1Decimals)) - let price0 = safeDiv(BigDecimal.fromString('1'), price1) - return [price0, price1] -} - -function fetchCharmVault(address: Address): CharmVault { - let id = address.toHexString() - let vault = CharmVault.load(id) - if (vault === null) { - vault = new CharmVault(id) - let vaultContract = CharmVaultABI.bind(address) - vault.pool = vaultContract.pool().toHexString() - vault.name = vaultContract.name() - vault.symbol = vaultContract.symbol() - vault.decimals = BigInt.fromI32(vaultContract.decimals()) - - let token0Address = vaultContract.token0() - let token0Contract = ERC20ABI.bind(token0Address) - vault.token0 = token0Address.toHexString() - vault.token0Name = token0Contract.name() - vault.token0Symbol = token0Contract.symbol() - vault.token0Decimals = BigInt.fromI32(token0Contract.decimals()) - - let token1Address = vaultContract.token1() - let token1Contract = ERC20ABI.bind(token1Address) - vault.token1 = token1Address.toHexString() - vault.token1Name = token1Contract.name() - vault.token1Symbol = token1Contract.symbol() - vault.token1Decimals = BigInt.fromI32(token1Contract.decimals()) - - vault.token0Bal = BIGDECIMAL_ZERO - vault.token1Bal = BIGDECIMAL_ZERO - vault.token0BalIn = BIGDECIMAL_ZERO - vault.token1BalIn = BIGDECIMAL_ZERO - vault.token0Price = BIGDECIMAL_ZERO - vault.token1Price = BIGDECIMAL_ZERO - vault.tvl = BIGDECIMAL_ZERO - vault.valueIn = BIGDECIMAL_ZERO - vault.price = BIGDECIMAL_ZERO - vault.totalSupply = BIGDECIMAL_ZERO - vault.unusedToken0Bal = BIGDECIMAL_ZERO - vault.unusedToken1Bal = BIGDECIMAL_ZERO - vault.unusedTVL = BIGDECIMAL_ZERO - vault.save() - } - return vault as CharmVault -} - -function fetchCharmVaultDailyStat(vault: CharmVault, timestamp: BigInt): CharmVaultDailyStat { - let id = vault.id.concat('-').concat(timestamp.toString()) - let dailyStat = CharmVaultDailyStat.load(id) - if (dailyStat === null) { - dailyStat = new CharmVaultDailyStat(id) - dailyStat.vault = vault.id - dailyStat.timestamp = timestamp - dailyStat.token0Bal = BIGDECIMAL_ZERO - dailyStat.token1Bal = BIGDECIMAL_ZERO - dailyStat.token0BalIn = BIGDECIMAL_ZERO - dailyStat.token1BalIn = BIGDECIMAL_ZERO - dailyStat.token0Price = BIGDECIMAL_ZERO - dailyStat.token1Price = BIGDECIMAL_ZERO - dailyStat.tvl = BIGDECIMAL_ZERO - dailyStat.valueIn = BIGDECIMAL_ZERO - dailyStat.price = BIGDECIMAL_ZERO - dailyStat.totalSupply = BIGDECIMAL_ZERO - dailyStat.save() - } - return dailyStat as CharmVaultDailyStat -} - -function refreshCharmVaultStats(vault: CharmVault, dailyStat: CharmVaultDailyStat): void { - let vaultContract = CharmVaultABI.bind(stringToAddress(vault.id)) - let tokenBals = vaultContract.getTotalAmounts() - let uniPoolContract = UniV3PoolABI.bind(stringToAddress(vault.pool)) - let slot0 = uniPoolContract.slot0() - let sqrtPrice = slot0.value0 - let prices = sqrtPriceX96ToTokenPrices(sqrtPrice, vault.token0Decimals, vault.token1Decimals) - - vault.token0Bal = formatBalance(tokenBals.value0, vault.token0Decimals) - vault.token1Bal = formatBalance(tokenBals.value1, vault.token1Decimals) - vault.token0Price = prices[0] - vault.token1Price = prices[1] - vault.tvl = vault.token0Bal.plus(vault.token1Bal.times(vault.token0Price)) - vault.totalSupply = formatBalance(vaultContract.totalSupply(), vault.decimals) - vault.price = vault.tvl.div(vault.totalSupply) - vault.unusedToken0Bal = formatBalance(vaultContract.getBalance0(), vault.token0Decimals) - vault.unusedToken1Bal = formatBalance(vaultContract.getBalance1(), vault.token1Decimals) - vault.unusedTVL = vault.unusedToken0Bal.plus(vault.unusedToken1Bal.times(vault.token0Price)) - vault.save() - - dailyStat.token0Bal = vault.token0Bal - dailyStat.token1Bal = vault.token1Bal - dailyStat.token0Price = vault.token0Price - dailyStat.token1Price = vault.token1Price - dailyStat.tvl = vault.tvl - dailyStat.totalSupply = vault.totalSupply - dailyStat.price = vault.price - dailyStat.save() -} - -export function handleDeposit(event: Deposit): void { - log.debug('triggered deposit', []) - let vault = fetchCharmVault(event.address) - let dailyStat = fetchCharmVaultDailyStat(vault, dayTimestamp(event.block.timestamp)) - refreshCharmVaultStats(vault, dailyStat) - vault.token0BalIn = vault.token0BalIn.plus( - formatBalance(event.params.amount0, vault.token0Decimals), - ) - vault.token1BalIn = vault.token1BalIn.plus( - formatBalance(event.params.amount1, vault.token1Decimals), - ) - vault.valueIn = vault.token0BalIn.plus(vault.token1BalIn.times(vault.token0Price)) - vault.save() - - dailyStat.token0BalIn = vault.token0BalIn - dailyStat.token1BalIn = vault.token1BalIn - dailyStat.valueIn = vault.valueIn - dailyStat.save() -} - -export function handleWithdraw(event: Withdraw): void { - log.debug('triggered withdraw', []) - let vault = fetchCharmVault(event.address) - let dailyStat = fetchCharmVaultDailyStat(vault, dayTimestamp(event.block.timestamp)) - refreshCharmVaultStats(vault, dailyStat) - vault.token0BalIn = vault.token0BalIn.minus( - formatBalance(event.params.amount0, vault.token0Decimals), - ) - vault.token1BalIn = vault.token1BalIn.minus( - formatBalance(event.params.amount1, vault.token1Decimals), - ) - vault.valueIn = vault.token0BalIn.plus(vault.token1BalIn.times(vault.token0Price)) - vault.save() - - dailyStat.token0BalIn = vault.token0BalIn - dailyStat.token1BalIn = vault.token1BalIn - dailyStat.valueIn = vault.valueIn - dailyStat.save() - dailyStat.save() -} - -export function handleSnapshot(event: Snapshot): void { - log.debug('triggered snapshot', []) - let vault = fetchCharmVault(event.address) - let dailyStat = fetchCharmVaultDailyStat(vault, dayTimestamp(event.block.timestamp)) - refreshCharmVaultStats(vault, dailyStat) -} - -export function refreshStore(block: ethereum.Block): void { - let timeForUpdate = - block.number.gt(CHARM_VAULT_UPDATE_BLOCK) && - block.number.mod(BLOCK_UPDATE_INTERVAL).equals(BIGINT_ZERO) - if (timeForUpdate) { - log.debug('triggered store refresh', []) - let vault = fetchCharmVault(stringToAddress(CHARM_VAULT_ID)) - let dailyStat = fetchCharmVaultDailyStat(vault, dayTimestamp(block.timestamp)) - refreshCharmVaultStats(vault, dailyStat) - } -} diff --git a/spot-staking-subgraph/src/rebasingToken.ts b/spot-staking-subgraph/src/rebasingToken.ts new file mode 100644 index 00000000..0942d556 --- /dev/null +++ b/spot-staking-subgraph/src/rebasingToken.ts @@ -0,0 +1,34 @@ +import { log, dataSource, Address, BigInt } from '@graphprotocol/graph-ts' +import { LogRebase, Rebase } from '../generated/templates/RebasingERC20/RebasingERC20' +import { stringToAddress, dayTimestamp } from './utils' +import { fetchBillBroker, fetchBillBrokerDailyStat, refreshBillBrokerStats } from './billBroker' +import { fetchCharmVault, fetchCharmVaultDailyStat, refreshCharmVaultStats } from './charmVault' + +function _handleRebase(address: Address, timestamp: BigInt): void { + let context = dataSource.context() + if (context.get('billBroker') != null) { + let id = context.getString('billBroker') + log.warning('billBrokerRefresh: {}', [id]) + let vault = fetchBillBroker(stringToAddress(id)) + let dailyStat = fetchBillBrokerDailyStat(vault, dayTimestamp(timestamp)) + refreshBillBrokerStats(vault, dailyStat) + } + + if (context.get('charmVault') != null) { + let id = context.getString('charmVault') + log.warning('charmVaultRefresh: {}', [id]) + let vault = fetchCharmVault(stringToAddress(id)) + let dailyStat = fetchCharmVaultDailyStat(vault, dayTimestamp(timestamp)) + refreshCharmVaultStats(vault, dailyStat) + } +} + +export function handleRebase(event: Rebase): void { + log.warning('triggered handleRebase', []) + _handleRebase(event.address, event.block.timestamp) +} + +export function handleLogRebase(event: LogRebase): void { + log.warning('triggered handleLogRebase', []) + _handleRebase(event.address, event.block.timestamp) +} diff --git a/spot-staking-subgraph/src/utils.ts b/spot-staking-subgraph/src/utils.ts new file mode 100644 index 00000000..a5aa75c4 --- /dev/null +++ b/spot-staking-subgraph/src/utils.ts @@ -0,0 +1,70 @@ +import { BigInt, BigDecimal, Address } from '@graphprotocol/graph-ts' + +import { Wrapper as WrapperABI } from '../generated/CharmSPOTVault/Wrapper' + +export let BIGINT_ZERO = BigInt.fromI32(0) +export let BIGINT_ONE = BigInt.fromI32(1) +export let BIGDECIMAL_ZERO = BigDecimal.fromString('0') +export let BIGDECIMAL_ONE = BigDecimal.fromString('1') + +export const dayTimestamp = (timestamp: BigInt): BigInt => { + return timestamp.minus(timestamp % BigInt.fromI32(24 * 3600)) +} + +export const stringToAddress = (id: string): Address => { + return Address.fromString(id) +} + +export const formatBalance = (wei: BigInt, decimals: BigInt): BigDecimal => { + return wei.toBigDecimal().div( + BigInt.fromI32(10) + .pow(decimals.toI32() as u8) + .toBigDecimal(), + ) +} + +// https://github.com/Uniswap/v3-subgraph/blob/main/src/utils/index.ts#L30 +export function exponentToBigDecimal(decimals: BigInt): BigDecimal { + let resultString = '1' + for (let i = 0; i < decimals.toI32(); i++) { + resultString += '0' + } + return BigDecimal.fromString(resultString) +} + +export function safeDiv(amount0: BigDecimal, amount1: BigDecimal): BigDecimal { + if (amount1.equals(BIGDECIMAL_ZERO)) { + return BIGDECIMAL_ZERO + } else { + return amount0.div(amount1) + } +} + +export function sqrtPriceX96ToTokenPrices( + sqrtPriceX96: BigInt, + token0Decimals: BigInt, + token1Decimals: BigInt, +): BigDecimal[] { + let Q192 = BigInt.fromI32(2).pow(192 as u8) + let num = sqrtPriceX96.times(sqrtPriceX96).toBigDecimal() + let denom = BigDecimal.fromString(Q192.toString()) + let price1 = num + .div(denom) + .times(exponentToBigDecimal(token0Decimals)) + .div(exponentToBigDecimal(token1Decimals)) + let price0 = safeDiv(BigDecimal.fromString('1'), price1) + return [price0, price1] +} + +export function getUnderlyingAddress(tokenAddress: Address): Address { + let wrapperContract = WrapperABI.bind(tokenAddress) + let underlyingResult = wrapperContract.try_underlying() + if (!underlyingResult.reverted) { + return underlyingResult.value + } + let collateralResult = wrapperContract.try_collateral() + if (!collateralResult.reverted) { + return collateralResult.value + } + return Address.fromString('0x0000000000000000000000000000000000000000') +} \ No newline at end of file diff --git a/spot-staking-subgraph/subgraph.yaml b/spot-staking-subgraph/subgraph.yaml index 007875fc..65139dd2 100644 --- a/spot-staking-subgraph/subgraph.yaml +++ b/spot-staking-subgraph/subgraph.yaml @@ -3,9 +3,81 @@ description: Subgraph to keep track of spot staking repository: http://github.com/ampleforth/spot schema: file: ./schema.graphql +templates: + - kind: ethereum/contract + name: RebasingERC20 + network: mainnet + source: + abi: RebasingERC20 + mapping: + kind: ethereum/events + apiVersion: 0.0.4 + language: wasm/assemblyscript + entities: + - Rebase + - LogRebase + abis: + - name: BillBroker + file: ./abis/BillBroker.json + - name: CharmVault + file: ./abis/CharmVault.json + - name: UniV3Pool + file: ./abis/UniV3Pool.json + - name: Wrapper + file: ./abis/Wrapper.json + - name: ERC20 + file: ./abis/ERC20.json + - name: RebasingERC20 + file: ./abis/RebasingERC20.json + eventHandlers: + - event: Rebase(indexed uint256,uint256) + handler: handleRebase + - event: LogRebase(indexed uint256,uint256) + handler: handleLogRebase + file: ./src/rebasingToken.ts + dataSources: - kind: ethereum/contract - name: CharmVault + name: BillBroker + network: mainnet + source: + address: "0xA088Aef966CAD7fE0B38e28c2E07590127Ab4ccB" + abi: BillBroker + startBlock: 20127140 + mapping: + kind: ethereum/events + apiVersion: 0.0.4 + language: wasm/assemblyscript + entities: + - BillBroker + - ERC20 + abis: + - name: BillBroker + file: ./abis/BillBroker.json + - name: Wrapper + file: ./abis/Wrapper.json + - name: ERC20 + file: ./abis/ERC20.json + - name: RebasingERC20 + file: ./abis/RebasingERC20.json + eventHandlers: + - event: DepositUSD(uint256,(uint256,uint256,uint256,uint256)) + handler: handleDepositUSD + - event: DepositPerp(uint256,(uint256,uint256,uint256,uint256)) + handler: handleDepositPerp + - event: SwapPerpsForUSD(uint256,(uint256,uint256,uint256,uint256)) + handler: handleSwapPerpsForUSD + - event: SwapUSDForPerps(uint256,(uint256,uint256,uint256,uint256)) + handler: handleSwapUSDForPerps + callHandlers: + - function: deposit(uint256,uint256,uint256,uint256) + handler: handleDeposit + - function: redeem(uint256) + handler: handleRedeem + file: ./src/billBroker.ts + + - kind: ethereum/contract + name: CharmSPOTVault network: mainnet source: address: "0x2dcaff0f75765d7867887fc402b71c841b3a4bfb" @@ -24,8 +96,49 @@ dataSources: file: ./abis/CharmVault.json - name: UniV3Pool file: ./abis/UniV3Pool.json + - name: Wrapper + file: ./abis/Wrapper.json + - name: ERC20 + file: ./abis/ERC20.json + - name: RebasingERC20 + file: ./abis/RebasingERC20.json + eventHandlers: + - event: Deposit(indexed address,indexed address,uint256,uint256,uint256) + handler: handleDeposit + - event: Withdraw(indexed address,indexed address,uint256,uint256,uint256) + handler: handleWithdraw + - event: Snapshot(int24,uint256,uint256,uint256) + handler: handleSnapshot + - event: CollectFees(uint256,uint256,uint256,uint256,uint256,uint256) + handler: handleFees + file: ./src/charmVault.ts + + - kind: ethereum/contract + name: CharmWAMPLVault + network: mainnet + source: + address: "0x9658b5bdcad59dd0b7b936d955e5df81ea2b4dcb" + abi: CharmVault + startBlock: 20162628 + mapping: + kind: ethereum/events + apiVersion: 0.0.4 + language: wasm/assemblyscript + entities: + - CharmVault + - UniV3Pool + - ERC20 + abis: + - name: CharmVault + file: ./abis/CharmVault.json + - name: UniV3Pool + file: ./abis/UniV3Pool.json + - name: Wrapper + file: ./abis/Wrapper.json - name: ERC20 file: ./abis/ERC20.json + - name: RebasingERC20 + file: ./abis/RebasingERC20.json eventHandlers: - event: Deposit(indexed address,indexed address,uint256,uint256,uint256) handler: handleDeposit @@ -33,6 +146,6 @@ dataSources: handler: handleWithdraw - event: Snapshot(int24,uint256,uint256,uint256) handler: handleSnapshot - blockHandlers: - - handler: refreshStore - file: ./src/mappings.ts \ No newline at end of file + - event: CollectFees(uint256,uint256,uint256,uint256,uint256,uint256) + handler: handleFees + file: ./src/charmVault.ts \ No newline at end of file diff --git a/spot-subgraph/schema.graphql b/spot-subgraph/schema.graphql index 624b640d..c37a2229 100644 --- a/spot-subgraph/schema.graphql +++ b/spot-subgraph/schema.graphql @@ -355,4 +355,10 @@ type RolloverVaultDailyStat @entity { " the total value of swaps on the given day " totalSwapValue: BigDecimal! + + " the total value of underlying to perp swaps on the given day " + totalUnderlyingToPerpSwapValue: BigDecimal! + + " the total value of perp to underlying swaps on the given day " + totalPerpToUnderlyingSwapValue: BigDecimal! } \ No newline at end of file diff --git a/spot-subgraph/scripts/deploy.sh b/spot-subgraph/scripts/deploy.sh index a6bcbc3f..e6c0c3c6 100755 --- a/spot-subgraph/scripts/deploy.sh +++ b/spot-subgraph/scripts/deploy.sh @@ -9,5 +9,4 @@ yarn build yarn graph deploy $2 \ --node https://subgraphs.alchemy.com/api/subgraphs/deploy \ - --deploy-key $GRAPH_AUTH \ - --ipfs https://ipfs.satsuma.xyz \ No newline at end of file + --deploy-key $GRAPH_AUTH \ No newline at end of file diff --git a/spot-subgraph/src/data/rolloverVault.ts b/spot-subgraph/src/data/rolloverVault.ts index 77f7919c..47575d5e 100644 --- a/spot-subgraph/src/data/rolloverVault.ts +++ b/spot-subgraph/src/data/rolloverVault.ts @@ -4,7 +4,7 @@ import { RolloverVaultAsset, ScaledUnderlyingVaultDepositorBalance, RolloverVaultDailyStat, - Tranche + Tranche, } from '../../generated/schema' import { RolloverVault as RolloverVaultABI } from '../../generated/RolloverVault/RolloverVault' import { ERC20 as ERC20ABI } from '../../generated/BondFactory/ERC20' @@ -144,10 +144,10 @@ export function refreshRolloverVaultRebaseMultiplier(vault: RolloverVault): void .plus(vaultPerpBalance) .plus(vaultZBalance) .plus(vaultUnderlyingBalance) - if(denominator.gt(BIGDECIMAL_ZERO)){ + if (denominator.gt(BIGDECIMAL_ZERO)) { vault.rebaseMultiplier = numerator.div(denominator) } - vault.save() + vault.save() } export function refreshRolloverVaultDailyStat(dailyStat: RolloverVaultDailyStat): void { @@ -246,6 +246,8 @@ export function fetchRolloverVaultDailyStat( dailyStat.price = BIGDECIMAL_ZERO dailyStat.totalSupply = BIGDECIMAL_ZERO dailyStat.totalSwapValue = BIGDECIMAL_ZERO + dailyStat.totalUnderlyingToPerpSwapValue = BIGDECIMAL_ZERO + dailyStat.totalPerpToUnderlyingSwapValue = BIGDECIMAL_ZERO } return dailyStat as RolloverVaultDailyStat } diff --git a/spot-subgraph/src/mappings/rolloverVault.ts b/spot-subgraph/src/mappings/rolloverVault.ts index d29317c7..0aad7c70 100644 --- a/spot-subgraph/src/mappings/rolloverVault.ts +++ b/spot-subgraph/src/mappings/rolloverVault.ts @@ -135,6 +135,9 @@ export function handleUnderlyingToPerpSwap(call: SwapUnderlyingForPerpsCall): vo let dailyStat = fetchRolloverVaultDailyStat(vault, dayTimestamp(call.block.timestamp)) dailyStat.totalSwapValue = dailyStat.totalSwapValue.plus(underlyingAmtIn) + dailyStat.totalUnderlyingToPerpSwapValue = dailyStat.totalUnderlyingToPerpSwapValue.plus( + underlyingAmtIn, + ) dailyStat.save() } @@ -153,5 +156,8 @@ export function handlePerpToUnderlyingSwap(call: SwapPerpsForUnderlyingCall): vo let dailyStat = fetchRolloverVaultDailyStat(vault, dayTimestamp(call.block.timestamp)) dailyStat.totalSwapValue = dailyStat.totalSwapValue.plus(perpAmtIn.times(perp.price)) + dailyStat.totalPerpToUnderlyingSwapValue = dailyStat.totalPerpToUnderlyingSwapValue.plus( + perpAmtIn.times(perp.price), + ) dailyStat.save() } diff --git a/spot-vaults/.openzeppelin/mainnet.json b/spot-vaults/.openzeppelin/mainnet.json index bcc7efee..befb1c87 100644 --- a/spot-vaults/.openzeppelin/mainnet.json +++ b/spot-vaults/.openzeppelin/mainnet.json @@ -326,6 +326,325 @@ }, "namespaces": {} } + }, + "d00a4d75788e81fee448c9ae6273844f2de0999fa1330a99643609691807db49": { + "address": "0x0CE64cD7583864f7005898Aa133C74DBccaca063", + "txHash": "0x9116fa3d9dd6a540f56cd7e85144a0eaf7408d8fcb32dde8f5993884d5321ac1", + "layout": { + "solcVersion": "0.8.24", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:63", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:68" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:40" + }, + { + "label": "_balances", + "offset": 0, + "slot": "51", + "type": "t_mapping(t_address,t_uint256)", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:40" + }, + { + "label": "_allowances", + "offset": 0, + "slot": "52", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:42" + }, + { + "label": "_totalSupply", + "offset": 0, + "slot": "53", + "type": "t_uint256", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:44" + }, + { + "label": "_name", + "offset": 0, + "slot": "54", + "type": "t_string_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:46" + }, + { + "label": "_symbol", + "offset": 0, + "slot": "55", + "type": "t_string_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:47" + }, + { + "label": "__gap", + "offset": 0, + "slot": "56", + "type": "t_array(t_uint256)45_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:376" + }, + { + "label": "__gap", + "offset": 0, + "slot": "101", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC20BurnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol:51" + }, + { + "label": "_owner", + "offset": 0, + "slot": "151", + "type": "t_address", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22" + }, + { + "label": "__gap", + "offset": 0, + "slot": "152", + "type": "t_array(t_uint256)49_storage", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:94" + }, + { + "label": "_paused", + "offset": 0, + "slot": "201", + "type": "t_bool", + "contract": "PausableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:29" + }, + { + "label": "__gap", + "offset": 0, + "slot": "202", + "type": "t_array(t_uint256)49_storage", + "contract": "PausableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:116" + }, + { + "label": "_status", + "offset": 0, + "slot": "251", + "type": "t_uint256", + "contract": "ReentrancyGuardUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol:38" + }, + { + "label": "__gap", + "offset": 0, + "slot": "252", + "type": "t_array(t_uint256)49_storage", + "contract": "ReentrancyGuardUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol:88" + }, + { + "label": "perp", + "offset": 0, + "slot": "301", + "type": "t_contract(IPerpetualTranche)389", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:89" + }, + { + "label": "usd", + "offset": 0, + "slot": "302", + "type": "t_contract(IERC20Upgradeable)1872", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:92" + }, + { + "label": "usdUnitAmt", + "offset": 0, + "slot": "303", + "type": "t_uint256", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:95" + }, + { + "label": "perpUnitAmt", + "offset": 0, + "slot": "304", + "type": "t_uint256", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:98" + }, + { + "label": "keeper", + "offset": 0, + "slot": "305", + "type": "t_address", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:103" + }, + { + "label": "pricingStrategy", + "offset": 0, + "slot": "306", + "type": "t_contract(ISpotPricingStrategy)8533", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:106" + }, + { + "label": "fees", + "offset": 0, + "slot": "307", + "type": "t_struct(BillBrokerFees)8494_storage", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:109" + }, + { + "label": "arHardBound", + "offset": 0, + "slot": "314", + "type": "t_struct(Range)8475_storage", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:112" + }, + { + "label": "arSoftBound", + "offset": 0, + "slot": "316", + "type": "t_struct(Range)8475_storage", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:116" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)45_storage": { + "label": "uint256[45]", + "numberOfBytes": "1440" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(IERC20Upgradeable)1872": { + "label": "contract IERC20Upgradeable", + "numberOfBytes": "20" + }, + "t_contract(IPerpetualTranche)389": { + "label": "contract IPerpetualTranche", + "numberOfBytes": "20" + }, + "t_contract(ISpotPricingStrategy)8533": { + "label": "contract ISpotPricingStrategy", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "label": "mapping(address => mapping(address => uint256))", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)", + "numberOfBytes": "32" + }, + "t_string_storage": { + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(BillBrokerFees)8494_storage": { + "label": "struct BillBrokerFees", + "members": [ + { + "label": "mintFeePerc", + "type": "t_uint256", + "offset": 0, + "slot": "0" + }, + { + "label": "burnFeePerc", + "type": "t_uint256", + "offset": 0, + "slot": "1" + }, + { + "label": "perpToUSDSwapFeePercs", + "type": "t_struct(Range)8475_storage", + "offset": 0, + "slot": "2" + }, + { + "label": "usdToPerpSwapFeePercs", + "type": "t_struct(Range)8475_storage", + "offset": 0, + "slot": "4" + }, + { + "label": "protocolSwapSharePerc", + "type": "t_uint256", + "offset": 0, + "slot": "6" + } + ], + "numberOfBytes": "224" + }, + "t_struct(Range)8475_storage": { + "label": "struct Range", + "members": [ + { + "label": "lower", + "type": "t_uint256", + "offset": 0, + "slot": "0" + }, + { + "label": "upper", + "type": "t_uint256", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + }, + "namespaces": {} + } } } } diff --git a/spot-vaults/README.md b/spot-vaults/README.md index 16c86577..e915bacc 100644 --- a/spot-vaults/README.md +++ b/spot-vaults/README.md @@ -5,15 +5,14 @@ This repository is a collection of vault strategies leveraging the SPOT system. The official mainnet addresses are: - Bill Broker (SPOT-USDC): [0xA088Aef966CAD7fE0B38e28c2E07590127Ab4ccB](https://etherscan.io/address/0xA088Aef966CAD7fE0B38e28c2E07590127Ab4ccB) -- WethWamplManager: [0x6785fa26191eb531c54fd093931f395c4b01b583](https://etherscan.io/address/0x6785fa26191eb531c54fd093931f395c4b01b583) -- UsdcSpotManager: [0x780eB92040bf24cd9BF993505390e88E8ED59935](https://etherscan.io/address/0x780eB92040bf24cd9BF993505390e88E8ED59935) -- SpotAppraiser: [0x965FBFebDA76d9AA11642C1d0074CdF02e546F3c](https://etherscan.io/address/0x965FBFebDA76d9AA11642C1d0074CdF02e546F3c) Used by the Bill Broker -- SpotCDRPricer: [0xa76df05BAb61444fa2C1c5c1e14A3aD912A00EbA](https://etherscan.io/address/0xa76df05BAb61444fa2C1c5c1e14A3aD912A00EbA) Used by the Charm USDC/SPOT auto manager +- WethWamplManager: [0x574fca658b4B59E965C0e5f74761AE0Ac41DA6a7](https://etherscan.io/address/0x574fca658b4B59E965C0e5f74761AE0Ac41DA6a7) +- UsdcSpotManager: [0x2f67158859Fe0f69f5773570eC60444Fe0c1693c](https://etherscan.io/address/0x2f67158859Fe0f69f5773570eC60444Fe0c1693c) +- SpotPricer: [0x0f8f519878c10ce36C6aAF89c1AeefaaDE5D7881](https://etherscan.io/address/0x0f8f519878c10ce36C6aAF89c1AeefaaDE5D7881) The official testnet addresses are: - Bill Broker (SPOT-USDC): [0xc3f6D1F1d253EdC8B34D78Bc6cDD2b3eEFAd76BD](https://sepolia.etherscan.io/address/0xc3f6D1F1d253EdC8B34D78Bc6cDD2b3eEFAd76BD) -- SpotAppraiser: [0x08c5b39F000705ebeC8427C1d64D6262392944EE](https://sepolia.etherscan.io/address/0x08c5b39F000705ebeC8427C1d64D6262392944EE) +- SpotAppraiser **(deprecated)**: [0x08c5b39F000705ebeC8427C1d64D6262392944EE](https://sepolia.etherscan.io/address/0x08c5b39F000705ebeC8427C1d64D6262392944EE) ## Install diff --git a/spot-vaults/contracts/BillBroker.sol b/spot-vaults/contracts/BillBroker.sol index 0e12f3b4..77330628 100644 --- a/spot-vaults/contracts/BillBroker.sol +++ b/spot-vaults/contracts/BillBroker.sol @@ -5,17 +5,19 @@ import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/O import { PausableUpgradeable } from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import { MathUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol"; -import { SafeCastUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol"; -import { SignedMathUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol"; import { SafeERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; + import { ERC20BurnableUpgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol"; import { IERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import { IERC20MetadataUpgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol"; - +import { LineHelpers } from "./_utils/LineHelpers.sol"; +import { MathHelpers } from "./_utils/MathHelpers.sol"; import { IPerpetualTranche } from "@ampleforthorg/spot-contracts/contracts/_interfaces/IPerpetualTranche.sol"; -import { ISpotPricingStrategy } from "./_interfaces/ISpotPricingStrategy.sol"; -import { ReserveState, BillBrokerFees, Line, Range } from "./_interfaces/BillBrokerTypes.sol"; -import { UnacceptableSwap, UnreliablePrice, UnexpectedDecimals, InvalidPerc, InvalidARBound, SlippageTooHigh, UnauthorizedCall, UnexpectedARDelta } from "./_interfaces/BillBrokerErrors.sol"; +import { IPerpPricer } from "./_interfaces/IPerpPricer.sol"; +import { ReserveState, BillBrokerFees } from "./_interfaces/types/BillBrokerTypes.sol"; +import { Line, Range } from "./_interfaces/types/CommonTypes.sol"; +import { UnacceptableSwap, UnreliablePrice, UnexpectedDecimals, InvalidPerc, SlippageTooHigh, UnauthorizedCall } from "./_interfaces/errors/CommonErrors.sol"; +import { InvalidARBound } from "./_interfaces/errors/BillBrokerErrors.sol"; /** * @title BillBroker @@ -70,17 +72,20 @@ contract BillBroker is // Math using MathUpgradeable for uint256; - using SafeCastUpgradeable for uint256; - using SafeCastUpgradeable for int256; - using SignedMathUpgradeable for int256; + using MathHelpers for uint256; + using MathHelpers for int256; + using LineHelpers for Line; //------------------------------------------------------------------------- // Constants & Immutables uint256 public constant DECIMALS = 18; uint256 public constant ONE = (10 ** DECIMALS); + uint256 public constant TWO = ONE * 2; uint256 private constant INITIAL_RATE = 1000000; uint256 public constant MINIMUM_LIQUIDITY = 10 ** 22; + uint256 public constant MAX_FEE_FACTOR = ((ONE * 6) / 5); // 1.2 or 20% + uint256 public constant MAX_ASSET_RATIO = uint256(type(int256).max); //------------------------------------------------------------------------- // Storage @@ -102,8 +107,8 @@ contract BillBroker is /// @return The address of the keeper. address public keeper; - /// @notice The pricing strategy. - ISpotPricingStrategy public pricingStrategy; + /// @notice The pricing oracle for perp and usd tokens. + IPerpPricer public oracle; /// @notice All of the system fees. BillBrokerFees public fees; @@ -112,30 +117,30 @@ contract BillBroker is Range public arHardBound; /// @notice The asset ratio bounds outside which swapping is still functional but, - /// the swap fees transition from a flat percentage fee to a linear function. + /// the swap fees transition from a constant fee to a linear function. Range public arSoftBound; //-------------------------------------------------------------------------- // Events - /// @notice Emitted when a user deposits USD tokens to mint LP tokens. - /// @param usdAmtIn The amount of USD tokens deposited. - /// @param preOpState The reserve state before the deposit operation. + /// @notice Emitted when a user deposits usd tokens to mint LP tokens. + /// @param usdAmtIn The amount of usd tokens deposited. + /// @param preOpState Pre-operation reserve state. event DepositUSD(uint256 usdAmtIn, ReserveState preOpState); /// @notice Emitted when a user deposits Perp tokens to mint LP tokens. /// @param perpAmtIn The amount of Perp tokens deposited. - /// @param preOpState The reserve state before the deposit operation. + /// @param preOpState Pre-operation reserve state. event DepositPerp(uint256 perpAmtIn, ReserveState preOpState); - /// @notice Emitted when a user swaps Perp tokens for USD tokens. + /// @notice Emitted when a user swaps Perp tokens for usd tokens. /// @param perpAmtIn The amount of Perp tokens swapped in. - /// @param preOpState The reserve state before the swap operation. + /// @param preOpState Pre-operation reserve state. event SwapPerpsForUSD(uint256 perpAmtIn, ReserveState preOpState); - /// @notice Emitted when a user swaps USD tokens for Perp tokens. - /// @param usdAmtIn The amount of USD tokens swapped in. - /// @param preOpState The reserve state before the swap operation. + /// @notice Emitted when a user swaps usd tokens for Perp tokens. + /// @param usdAmtIn The amount of usd tokens swapped in. + /// @param preOpState Pre-operation reserve state. event SwapUSDForPerps(uint256 usdAmtIn, ReserveState preOpState); //-------------------------------------------------------------------------- @@ -161,13 +166,13 @@ contract BillBroker is /// @param symbol ERC-20 Symbol of the Bill broker LP token. /// @param usd_ Address of the usd token. /// @param perp_ Address of the perp token. - /// @param pricingStrategy_ Address of the pricing strategy contract. + /// @param oracle_ Address of the oracle contract. function init( string memory name, string memory symbol, IERC20Upgradeable usd_, IPerpetualTranche perp_, - ISpotPricingStrategy pricingStrategy_ + IPerpPricer oracle_ ) public initializer { // initialize dependencies __ERC20_init(name, symbol); @@ -183,22 +188,22 @@ contract BillBroker is perpUnitAmt = 10 ** IERC20MetadataUpgradeable(address(perp_)).decimals(); updateKeeper(owner()); - updatePricingStrategy(pricingStrategy_); + updateOracle(oracle_); updateFees( BillBrokerFees({ mintFeePerc: 0, burnFeePerc: 0, - perpToUSDSwapFeePercs: Range({ lower: ONE, upper: ONE }), - usdToPerpSwapFeePercs: Range({ lower: ONE, upper: ONE }), + perpToUSDSwapFeeFactors: Range({ lower: ONE, upper: ONE }), + usdToPerpSwapFeeFactors: Range({ lower: ONE, upper: ONE }), protocolSwapSharePerc: 0 }) ); updateARBounds( // Soft bound - Range({ lower: 0, upper: type(uint256).max }), + Range({ lower: 0, upper: MAX_ASSET_RATIO }), // Hard bound - Range({ lower: 0, upper: type(uint256).max }) + Range({ lower: 0, upper: MAX_ASSET_RATIO }) ); } @@ -211,15 +216,13 @@ contract BillBroker is keeper = keeper_; } - /// @notice Updates the reference to the pricing strategy. - /// @param pricingStrategy_ The address of the new pricing strategy. - function updatePricingStrategy( - ISpotPricingStrategy pricingStrategy_ - ) public onlyOwner { - if (pricingStrategy_.decimals() != DECIMALS) { + /// @notice Updates the reference to the oracle. + /// @param oracle_ The address of the new oracle. + function updateOracle(IPerpPricer oracle_) public onlyOwner { + if (oracle_.decimals() != DECIMALS) { revert UnexpectedDecimals(); } - pricingStrategy = pricingStrategy_; + oracle = oracle_; } /// @notice Updates the system fees. @@ -228,13 +231,27 @@ contract BillBroker is if ( fees_.mintFeePerc > ONE || fees_.burnFeePerc > ONE || - fees_.perpToUSDSwapFeePercs.lower > fees_.perpToUSDSwapFeePercs.upper || - fees_.usdToPerpSwapFeePercs.lower > fees_.usdToPerpSwapFeePercs.upper || fees_.protocolSwapSharePerc > ONE ) { revert InvalidPerc(); } + if ( + fees_.perpToUSDSwapFeeFactors.lower > fees_.perpToUSDSwapFeeFactors.upper || + fees_.perpToUSDSwapFeeFactors.lower < ONE || + fees_.perpToUSDSwapFeeFactors.upper > MAX_FEE_FACTOR + ) { + revert InvalidPerc(); + } + + if ( + fees_.usdToPerpSwapFeeFactors.lower > fees_.usdToPerpSwapFeeFactors.upper || + fees_.usdToPerpSwapFeeFactors.lower < ONE || + fees_.usdToPerpSwapFeeFactors.upper > MAX_FEE_FACTOR + ) { + revert InvalidPerc(); + } + fees = fees_; } @@ -323,15 +340,10 @@ contract BillBroker is uint256 usdAmtIn, uint256 postOpAssetRatioMax ) external nonReentrant whenNotPaused returns (uint256 mintAmt) { - ReserveState memory preOpState = reserveState(); - uint256 preOpAssetRatio = assetRatio(preOpState); + ReserveState memory s = reserveState(); + uint256 preOpAssetRatio = assetRatio(s); uint256 postOpAssetRatio = assetRatio( - ReserveState({ - usdBalance: preOpState.usdBalance + usdAmtIn, - perpBalance: preOpState.perpBalance, - usdPrice: preOpState.usdPrice, - perpPrice: preOpState.perpPrice - }) + _updatedReserveState(s, s.usdBalance + usdAmtIn, s.perpBalance) ); // We allow minting only pool is underweight usd @@ -339,7 +351,7 @@ contract BillBroker is return 0; } - mintAmt = computeMintAmtWithUSD(usdAmtIn, preOpState); + mintAmt = computeMintAmtWithUSD(usdAmtIn, s); if (mintAmt <= 0) { return 0; } @@ -354,7 +366,7 @@ contract BillBroker is _mint(msg.sender, mintAmt); // Emit deposit info - emit DepositUSD(usdAmtIn, preOpState); + emit DepositUSD(usdAmtIn, s); } /// @notice Single sided perp token deposit and mint LP tokens. @@ -365,15 +377,10 @@ contract BillBroker is uint256 perpAmtIn, uint256 postOpAssetRatioMin ) external nonReentrant whenNotPaused returns (uint256 mintAmt) { - ReserveState memory preOpState = reserveState(); - uint256 preOpAssetRatio = assetRatio(preOpState); + ReserveState memory s = reserveState(); + uint256 preOpAssetRatio = assetRatio(s); uint256 postOpAssetRatio = assetRatio( - ReserveState({ - usdBalance: preOpState.usdBalance, - perpBalance: preOpState.perpBalance + perpAmtIn, - usdPrice: preOpState.usdPrice, - perpPrice: preOpState.perpPrice - }) + _updatedReserveState(s, s.usdBalance, s.perpBalance + perpAmtIn) ); // We allow minting only pool is underweight perp @@ -381,7 +388,7 @@ contract BillBroker is return 0; } - mintAmt = computeMintAmtWithPerp(perpAmtIn, preOpState); + mintAmt = computeMintAmtWithPerp(perpAmtIn, s); if (mintAmt <= 0) { return 0; } @@ -396,7 +403,7 @@ contract BillBroker is _mint(msg.sender, mintAmt); // Emit deposit info - emit DepositPerp(perpAmtIn, preOpState); + emit DepositPerp(perpAmtIn, s); } /// @notice Burns LP tokens and redeems usd and perp tokens. @@ -433,12 +440,9 @@ contract BillBroker is uint256 perpAmtMin ) external nonReentrant whenNotPaused returns (uint256 perpAmtOut) { // compute perp amount out - ReserveState memory preOpState = reserveState(); + ReserveState memory s = reserveState(); uint256 protocolFeePerpAmt; - (perpAmtOut, , protocolFeePerpAmt) = computeUSDToPerpSwapAmt( - usdAmtIn, - preOpState - ); + (perpAmtOut, protocolFeePerpAmt) = computeUSDToPerpSwapAmt(usdAmtIn, s); if (usdAmtIn <= 0 || perpAmtOut <= 0) { revert UnacceptableSwap(); } @@ -458,7 +462,7 @@ contract BillBroker is perp.safeTransfer(msg.sender, perpAmtOut); // Emit swap info - emit SwapUSDForPerps(usdAmtIn, preOpState); + emit SwapUSDForPerps(usdAmtIn, s); } /// @notice Swaps perp tokens from the user for usd tokens from the reserve. @@ -470,9 +474,9 @@ contract BillBroker is uint256 usdAmtMin ) external nonReentrant whenNotPaused returns (uint256 usdAmtOut) { // Compute swap amount - ReserveState memory preOpState = reserveState(); + ReserveState memory s = reserveState(); uint256 protocolFeeUsdAmt; - (usdAmtOut, , protocolFeeUsdAmt) = computePerpToUSDSwapAmt(perpAmtIn, preOpState); + (usdAmtOut, protocolFeeUsdAmt) = computePerpToUSDSwapAmt(perpAmtIn, s); if (perpAmtIn <= 0 || usdAmtOut <= 0) { revert UnacceptableSwap(); } @@ -492,7 +496,7 @@ contract BillBroker is usd.safeTransfer(msg.sender, usdAmtOut); // Emit swap info - emit SwapPerpsForUSD(perpAmtIn, preOpState); + emit SwapPerpsForUSD(perpAmtIn, s); } //----------------------------------------------------------------------------- @@ -521,7 +525,7 @@ contract BillBroker is function computePerpToUSDSwapAmt( uint256 perpAmtIn ) public returns (uint256 usdAmtOut) { - (usdAmtOut, , ) = computePerpToUSDSwapAmt(perpAmtIn, reserveState()); + (usdAmtOut, ) = computePerpToUSDSwapAmt(perpAmtIn, reserveState()); } /// @notice Computes the amount of perp tokens swapped out, @@ -531,7 +535,7 @@ contract BillBroker is function computeUSDToPerpSwapAmt( uint256 usdAmtIn ) public returns (uint256 perpAmtOut) { - (perpAmtOut, , ) = computeUSDToPerpSwapAmt(usdAmtIn, reserveState()); + (perpAmtOut, ) = computeUSDToPerpSwapAmt(usdAmtIn, reserveState()); } /// @return s The reserve usd and perp token balances and prices. @@ -545,20 +549,20 @@ contract BillBroker is }); } - /// @dev Reverts if the pricing strategy returns an invalid price. - /// @return The price of usd tokens from the pricing strategy. + /// @dev Reverts if the oracle returns an invalid price. + /// @return The price of usd tokens from the oracle. function usdPrice() public returns (uint256) { - (uint256 p, bool v) = pricingStrategy.usdPrice(); + (uint256 p, bool v) = oracle.usdPrice(); if (!v) { revert UnreliablePrice(); } return p; } - /// @dev Reverts if the pricing strategy returns an invalid price. - /// @return The price of perp tokens from the pricing strategy. + /// @dev Reverts if the oracle returns an invalid price. + /// @return The price of perp tokens from the oracle. function perpPrice() public returns (uint256) { - (uint256 p, bool v) = pricingStrategy.perpPrice(); + (uint256 p, bool v) = oracle.perpFmvUsdPrice(); if (!v) { revert UnreliablePrice(); } @@ -647,22 +651,37 @@ contract BillBroker is function computeMintAmtWithUSD( uint256 usdAmtIn, ReserveState memory s - ) public view returns (uint256) { + ) public view returns (uint256 mintAmt) { if (usdAmtIn <= 0) { return 0; } + uint256 totalSupply_ = totalSupply(); uint256 valueIn = s.usdPrice.mulDiv(usdAmtIn, usdUnitAmt); uint256 totalReserveVal = (s.usdPrice.mulDiv(s.usdBalance, usdUnitAmt) + s.perpPrice.mulDiv(s.perpBalance, perpUnitAmt)); + if (totalReserveVal == 0 || totalSupply_ == 0) { + return 0; + } - return - (totalReserveVal > 0) - ? valueIn.mulDiv(totalSupply(), totalReserveVal).mulDiv( - ONE - fees.mintFeePerc, - ONE - ) - : 0; + // Compute mint amount. + mintAmt = valueIn.mulDiv(totalSupply_, totalReserveVal); + + // A single sided deposit is a combination of swap and mint. + // We first calculate the amount of usd swapped into perps and + // apply the swap fee only for that portion. + // The mint fees are waived, because single sided deposits + // push the pool back into balance. + uint256 postOpUsdBal = s.usdBalance + usdAmtIn; + uint256 postOpUsdClaim = postOpUsdBal.mulDiv(mintAmt, totalSupply_ + mintAmt); + uint256 percOfAmtInSwapped = ONE.mulDiv(usdAmtIn - postOpUsdClaim, usdAmtIn); + uint256 feeFactor = computeUSDToPerpSwapFeeFactor( + assetRatio(s), + assetRatio(_updatedReserveState(s, postOpUsdBal, s.perpBalance)) + ); + mintAmt = + mintAmt.mulDiv(percOfAmtInSwapped, ONE).mulDiv(TWO - feeFactor, ONE) + + mintAmt.mulDiv(ONE - percOfAmtInSwapped, ONE); } /// @notice Computes the amount of LP tokens minted, @@ -673,22 +692,37 @@ contract BillBroker is function computeMintAmtWithPerp( uint256 perpAmtIn, ReserveState memory s - ) public view returns (uint256) { + ) public view returns (uint256 mintAmt) { if (perpAmtIn <= 0) { return 0; } + uint256 totalSupply_ = totalSupply(); uint256 valueIn = s.perpPrice.mulDiv(perpAmtIn, perpUnitAmt); uint256 totalReserveVal = (s.usdPrice.mulDiv(s.usdBalance, usdUnitAmt) + s.perpPrice.mulDiv(s.perpBalance, perpUnitAmt)); + if (totalReserveVal == 0 || totalSupply_ == 0) { + return 0; + } - return - (totalReserveVal > 0) - ? valueIn.mulDiv(totalSupply(), totalReserveVal).mulDiv( - ONE - fees.mintFeePerc, - ONE - ) - : 0; + // Compute mint amount. + mintAmt = valueIn.mulDiv(totalSupply_, totalReserveVal); + + // A single sided deposit is a combination of swap and mint. + // We first calculate the amount of perps swapped into usd and + // apply the swap fee only for that portion. + // The mint fees are waived, because single sided deposits + // push the pool back into balance. + uint256 postOpPerpBal = s.perpBalance + perpAmtIn; + uint256 postOpPerpClaim = postOpPerpBal.mulDiv(mintAmt, totalSupply_ + mintAmt); + uint256 percOfAmtInSwapped = ONE.mulDiv(perpAmtIn - postOpPerpClaim, perpAmtIn); + uint256 feeFactor = computePerpToUSDSwapFeeFactor( + assetRatio(s), + assetRatio(_updatedReserveState(s, s.usdBalance, postOpPerpBal)) + ); + mintAmt = + mintAmt.mulDiv(percOfAmtInSwapped, ONE).mulDiv(TWO - feeFactor, ONE) + + mintAmt.mulDiv(ONE - percOfAmtInSwapped, ONE); } /// @notice Computes the amount of usd and perp tokens redeemed, @@ -720,41 +754,39 @@ contract BillBroker is /// @param s The current reserve state. /// @dev Quoted usd token amount out includes the fees withheld. /// @return usdAmtOut The amount of usd tokens swapped out. - /// @return lpFeeUsdAmt The amount of usd tokens charged as swap fees by LPs. /// @return protocolFeeUsdAmt The amount of usd tokens charged as protocol fees. function computePerpToUSDSwapAmt( uint256 perpAmtIn, ReserveState memory s - ) - public - view - returns (uint256 usdAmtOut, uint256 lpFeeUsdAmt, uint256 protocolFeeUsdAmt) - { - // We compute equal value of usd tokens out given perp tokens in. + ) public view returns (uint256 usdAmtOut, uint256 protocolFeeUsdAmt) { + // We compute equal value tokens to swap out. usdAmtOut = perpAmtIn.mulDiv(s.perpPrice, s.usdPrice).mulDiv( usdUnitAmt, perpUnitAmt ); - // We compute the total fee percentage, lp fees and protocol fees - uint256 totalFeePerc = computePerpToUSDSwapFeePerc( + // We compute the fee factor. + uint256 feeFactor = computePerpToUSDSwapFeeFactor( assetRatio(s), assetRatio( - ReserveState({ - usdBalance: s.usdBalance - usdAmtOut, - perpBalance: s.perpBalance + perpAmtIn, - usdPrice: s.usdPrice, - perpPrice: s.perpPrice - }) + _updatedReserveState( + s, + s.usdBalance - usdAmtOut, + s.perpBalance + perpAmtIn + ) ) ); - if (totalFeePerc >= ONE) { - return (0, 0, 0); + + // We compute protocol fee. + // System only changes a protocol fee when fees are non-negative. + if (feeFactor >= ONE) { + protocolFeeUsdAmt = usdAmtOut + .mulDiv(feeFactor - ONE, ONE, MathUpgradeable.Rounding.Up) + .mulDiv(fees.protocolSwapSharePerc, ONE, MathUpgradeable.Rounding.Up); } - uint256 totalFeeUsdAmt = usdAmtOut.mulDiv(totalFeePerc, ONE); - usdAmtOut -= totalFeeUsdAmt; - protocolFeeUsdAmt = totalFeeUsdAmt.mulDiv(fees.protocolSwapSharePerc, ONE); - lpFeeUsdAmt = totalFeeUsdAmt - protocolFeeUsdAmt; + + // We computed fee adjusted amount out. + usdAmtOut = usdAmtOut.mulDiv(TWO - feeFactor, ONE); } /// @notice Computes the amount of perp tokens swapped out, @@ -763,149 +795,131 @@ contract BillBroker is /// @param s The current reserve state. /// @dev Quoted perp token amount out includes the fees withheld. /// @return perpAmtOut The amount of perp tokens swapped out. - /// @return lpFeePerpAmt The amount of perp tokens charged as swap fees by LPs. /// @return protocolFeePerpAmt The amount of perp tokens charged as protocol fees. function computeUSDToPerpSwapAmt( uint256 usdAmtIn, ReserveState memory s - ) - public - view - returns (uint256 perpAmtOut, uint256 lpFeePerpAmt, uint256 protocolFeePerpAmt) - { - // We compute equal value of perp tokens out given usd tokens in. + ) public view returns (uint256 perpAmtOut, uint256 protocolFeePerpAmt) { + // We compute equal value tokens to swap out. perpAmtOut = usdAmtIn.mulDiv(s.usdPrice, s.perpPrice).mulDiv( perpUnitAmt, usdUnitAmt ); - // We compute the total fee percentage, lp fees and protocol fees - uint256 totalFeePerc = computeUSDToPerpSwapFeePerc( + + // We compute the fee factor. + uint256 feeFactor = computeUSDToPerpSwapFeeFactor( assetRatio(s), assetRatio( - ReserveState({ - usdBalance: s.usdBalance + usdAmtIn, - perpBalance: s.perpBalance - perpAmtOut, - usdPrice: s.usdPrice, - perpPrice: s.perpPrice - }) + _updatedReserveState( + s, + s.usdBalance + usdAmtIn, + s.perpBalance - perpAmtOut + ) ) ); - if (totalFeePerc >= ONE) { - return (0, 0, 0); + + // We compute protocol fee. + // System only changes a protocol fee when fees are non-negative. + if (feeFactor >= ONE) { + protocolFeePerpAmt = perpAmtOut + .mulDiv(feeFactor - ONE, ONE, MathUpgradeable.Rounding.Up) + .mulDiv(fees.protocolSwapSharePerc, ONE, MathUpgradeable.Rounding.Up); } - uint256 totalFeePerpAmt = perpAmtOut.mulDiv(totalFeePerc, ONE); - perpAmtOut -= totalFeePerpAmt; - protocolFeePerpAmt = totalFeePerpAmt.mulDiv(fees.protocolSwapSharePerc, ONE); - lpFeePerpAmt = totalFeePerpAmt - protocolFeePerpAmt; + + // We computed fee adjusted amount out. + perpAmtOut = perpAmtOut.mulDiv(TWO - feeFactor, ONE); } - /// @notice Computes the swap fee percentage when swapping from perp to usd tokens. + /// @notice Computes the swap fee factor when swapping from perp to usd tokens. /// @dev Swapping from perp to usd tokens, leaves the system with more perp and fewer usd tokens /// thereby decreasing the system's `assetRatio`. Thus arPost < arPre. /// @param arPre The asset ratio of the system before swapping. /// @param arPost The asset ratio of the system after swapping. - /// @return The fee percentage. - function computePerpToUSDSwapFeePerc( + /// @return The fee factor. + function computePerpToUSDSwapFeeFactor( uint256 arPre, uint256 arPost ) public view returns (uint256) { - if (arPost > arPre) { - revert UnexpectedARDelta(); + // When the ar decreases below the lower bound swaps are halted. + // Fees are set to 100% or a fee factor of 2.0 + if (arPost < arHardBound.lower) { + return TWO; } - // When the ar decreases below the lower bound, - // swaps are effectively halted by setting fees to 100%. - if (arPost < arHardBound.lower) { - return ONE; - } - // When the ar is between the soft and hard bound, a linear function is applied. - // When the ar is above the soft bound, a flat percentage fee is applied. - // - // fee - // ^ - // | - // fh | \ | - // | \ | - // | \ | - // | \ | - // | \ | - // | \ | - // fl | \__________ - // | | - // | | - // | | - // +---------------------------> ar - // arHL arSL 1.0 - // - Range memory swapFeePercs = fees.perpToUSDSwapFeePercs; + Range memory feeP2U = fees.perpToUSDSwapFeeFactors; + // The maximum -ve fee, inferred from fees for the other swap direction. + uint256 feeU2PUpperInv = (TWO - fees.usdToPerpSwapFeeFactors.upper); return - _computeFeePerc( - Line({ - x1: arHardBound.lower, - y1: swapFeePercs.upper, - x2: arSoftBound.lower, - y2: swapFeePercs.lower - }), - Line({ x1: 0, y1: swapFeePercs.lower, x2: ONE, y2: swapFeePercs.lower }), - arPost, - arPre, - arSoftBound.lower - ); - } - - /// @notice Computes the swap fee percentage when swapping from usd to perp tokens. + LineHelpers + .computePiecewiseAvgY( + Line({ + x1: arHardBound.lower, + y1: feeP2U.upper, + x2: arSoftBound.lower, + y2: feeP2U.lower + }), + Line({ + x1: arSoftBound.lower, + y1: feeP2U.lower, + x2: arSoftBound.upper, + y2: feeP2U.lower + }), + Line({ + x1: arSoftBound.upper, + y1: feeP2U.lower, + x2: arHardBound.upper, + y2: feeU2PUpperInv + }), + arSoftBound, + Range({ lower: arPost, upper: arPre }) + ) + .clip(feeU2PUpperInv, feeP2U.upper); + } + + /// @notice Computes the swap fee factor when swapping from usd to perp tokens. /// @dev Swapping from usd to perp tokens, leaves the system with more usd and fewer perp tokens /// thereby increasing the system's `assetRatio`. Thus arPost > arPre. /// @param arPre The asset ratio of the system before swapping. /// @param arPost The asset ratio of the system after swapping. - /// @return The fee percentage. - function computeUSDToPerpSwapFeePerc( + /// @return The fee factor. + function computeUSDToPerpSwapFeeFactor( uint256 arPre, uint256 arPost ) public view returns (uint256) { - if (arPost < arPre) { - revert UnexpectedARDelta(); + // When the ar increases above the hard bound, swaps are halted. + // Fees are set to 100% or a fee factor of 2.0 + if (arPost > arHardBound.upper) { + return TWO; } - // When the ar increases above the hard bound, - // swaps are effectively halted by setting fees to 100%. - if (arPost > arHardBound.upper) { - return ONE; - } - - // When the ar is between the soft and hard bound, a linear function is applied. - // When the ar is below the soft bound, a flat percentage fee is applied. - // - // fee - // ^ - // | - // fh | | / - // | | / - // | | / - // | | / - // | | / - // | | / - // fl | __________/ - // | | - // | | - // | | - // +---------------------------> ar - // 1.0 arSU arHU - // - Range memory swapFeePercs = fees.usdToPerpSwapFeePercs; + Range memory feeU2P = fees.usdToPerpSwapFeeFactors; + // The maximum -ve fee, inferred from fees for the other swap direction. + uint256 feeP2UUpperInv = (TWO - fees.perpToUSDSwapFeeFactors.upper); return - _computeFeePerc( - Line({ x1: 0, y1: swapFeePercs.lower, x2: ONE, y2: swapFeePercs.lower }), - Line({ - x1: arSoftBound.upper, - y1: swapFeePercs.lower, - x2: arHardBound.upper, - y2: swapFeePercs.upper - }), - arPre, - arPost, - arSoftBound.upper - ); + LineHelpers + .computePiecewiseAvgY( + Line({ + x1: arHardBound.lower, + y1: feeP2UUpperInv, + x2: arSoftBound.lower, + y2: feeU2P.lower + }), + Line({ + x1: arSoftBound.lower, + y1: feeU2P.lower, + x2: arSoftBound.upper, + y2: feeU2P.lower + }), + Line({ + x1: arSoftBound.upper, + y1: feeU2P.lower, + x2: arHardBound.upper, + y2: feeU2P.upper + }), + arSoftBound, + Range({ lower: arPre, upper: arPost }) + ) + .clip(feeP2UUpperInv, feeU2P.upper); } /// @param s The system reserve state. @@ -919,7 +933,7 @@ contract BillBroker is s.perpBalance.mulDiv(s.perpPrice, perpUnitAmt) ) ) - : type(uint256).max; + : MAX_ASSET_RATIO; } /// @notice The address which holds any revenue extracted by protocol. @@ -931,44 +945,18 @@ contract BillBroker is //----------------------------------------------------------------------------- // Private methods - /// @dev The function assumes the fee curve is defined as a pair-wise linear function which merge at the cutoff point. - /// The swap fee is computed as avg height of the fee curve between {arL,arU}. - function _computeFeePerc( - Line memory fn1, - Line memory fn2, - uint256 arL, - uint256 arU, - uint256 cutoff - ) private pure returns (uint256 feePerc) { - if (arU <= cutoff) { - feePerc = _avgY(fn1, arL, arU); - } else if (arL >= cutoff) { - feePerc = _avgY(fn2, arL, arU); - } else { - feePerc = (_avgY(fn1, arL, cutoff).mulDiv(cutoff - arL, arU - arL) + - _avgY(fn2, cutoff, arU).mulDiv(arU - cutoff, arU - arL)); - } - feePerc = MathUpgradeable.min(feePerc, ONE); - } - - /// @dev We compute the average height of the line between {xL,xU}. - function _avgY( - Line memory fn, - uint256 xL, - uint256 xU - ) private pure returns (uint256) { - // if the line has a zero slope, return any y - if (fn.y1 == fn.y2) { - return fn.y2; - } - - // m = dlY/dlX - // c = y2 - m . x2 - // Avg height => (yL + yU) / 2 - // => m . ( xL + xU ) / 2 + c - int256 dlY = fn.y2.toInt256() - fn.y1.toInt256(); - int256 dlX = fn.x2.toInt256() - fn.x1.toInt256(); - int256 c = fn.y2.toInt256() - ((fn.x2.toInt256() * dlY) / dlX); - return ((((xL + xU).toInt256() * dlY) / (2 * dlX)) + c).abs(); + /// @dev Constructs the new reserve state based on provided balances. + function _updatedReserveState( + ReserveState memory s, + uint256 usdBalance_, + uint256 perpBalance_ + ) private pure returns (ReserveState memory) { + return + ReserveState({ + usdBalance: usdBalance_, + perpBalance: perpBalance_, + usdPrice: s.usdPrice, + perpPrice: s.perpPrice + }); } } diff --git a/spot-vaults/contracts/UsdcSpotManager.sol b/spot-vaults/contracts/UsdcSpotManager.sol deleted file mode 100644 index 05d985b3..00000000 --- a/spot-vaults/contracts/UsdcSpotManager.sol +++ /dev/null @@ -1,231 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -// solhint-disable-next-line compiler-version -pragma solidity ^0.7.6; -pragma abicoder v2; - -import { FullMath } from "@uniswap/v3-core/contracts/libraries/FullMath.sol"; -import { TickMath } from "@uniswap/v3-core/contracts/libraries/TickMath.sol"; -import { PositionKey } from "@uniswap/v3-periphery/contracts/libraries/PositionKey.sol"; - -import { ISpotPricingStrategy } from "./_interfaces/ISpotPricingStrategy.sol"; -import { IAlphaProVault } from "./_interfaces/external/IAlphaProVault.sol"; -import { IUniswapV3Pool } from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol"; - -/// @title UsdcSpotManager -/// @notice This contract is a programmatic manager for the USDC-SPOT Charm AlphaProVault. -contract UsdcSpotManager { - /// @dev Token Constants. - uint256 public constant ONE_SPOT = 1e9; - uint256 public constant ONE_USDC = 1e6; - - /// @dev Decimals. - uint256 public constant DECIMALS = 18; - uint256 public constant ONE = (10 ** DECIMALS); - - /// @dev We bound the deviation factor to 100.0. - uint256 public constant MAX_DEVIATION = 100 * ONE; // 100.0 - - //------------------------------------------------------------------------- - // Storage - - /// @notice The USDC-SPOT charm alpha vault. - IAlphaProVault public immutable VAULT; - - /// @notice The underlying USDC-SPOT univ3 pool. - IUniswapV3Pool public immutable POOL; - - /// @notice The vault's token0, the USDC token. - address public immutable USDC; - - /// @notice The vault's token1, the SPOT token. - address public immutable SPOT; - - /// @notice Pricing strategy to price the SPOT token. - ISpotPricingStrategy public pricingStrategy; - - /// @notice The contract owner. - address public owner; - - //------------------------------------------------------------------------- - // Manager storage - - /// @notice The recorded deviation factor at the time of the last successful rebalance operation. - uint256 public prevDeviation; - - //-------------------------------------------------------------------------- - // Modifiers - - modifier onlyOwner() { - // solhint-disable-next-line custom-errors - require(msg.sender == owner, "Unauthorized caller"); - _; - } - - //----------------------------------------------------------------------------- - // Constructor and Initializer - - /// @notice Constructor initializes the contract with provided addresses. - /// @param vault_ Address of the AlphaProVault contract. - /// @param pricingStrategy_ Address of the spot appraiser. - constructor(IAlphaProVault vault_, ISpotPricingStrategy pricingStrategy_) { - owner = msg.sender; - - VAULT = vault_; - POOL = vault_.pool(); - USDC = vault_.token0(); - SPOT = vault_.token1(); - - pricingStrategy = pricingStrategy_; - // solhint-disable-next-line custom-errors - require(pricingStrategy.decimals() == DECIMALS, "Invalid decimals"); - } - - //-------------------------------------------------------------------------- - // Owner only methods - - /// @notice Updates the owner role. - function transferOwnership(address owner_) external onlyOwner { - owner = owner_; - } - - /// @notice Updates the Spot pricing strategy reference. - function updatePricingStrategy( - ISpotPricingStrategy pricingStrategy_ - ) external onlyOwner { - pricingStrategy = pricingStrategy_; - } - - /// @notice Updates the vault's liquidity range parameters. - function setLiquidityRanges( - int24 baseThreshold, - uint24 fullRangeWeight, - int24 limitThreshold - ) external onlyOwner { - // Update liquidity parameters on the vault. - VAULT.setBaseThreshold(baseThreshold); - VAULT.setFullRangeWeight(fullRangeWeight); - VAULT.setLimitThreshold(limitThreshold); - } - - /// @notice Forwards the given calldata to the vault. - /// @param callData The calldata to pass to the vault. - /// @return The data returned by the vault method call. - function execOnVault( - bytes calldata callData - ) external onlyOwner returns (bytes memory) { - // solhint-disable-next-line avoid-low-level-calls - (bool success, bytes memory r) = address(VAULT).call(callData); - // solhint-disable-next-line custom-errors - require(success, "Vault call failed"); - return r; - } - - //-------------------------------------------------------------------------- - // External write methods - - /// @notice Executes vault rebalance. - function rebalance() public { - (uint256 deviation, bool deviationValid) = computeDeviationFactor(); - - // We rebalance if the deviation factor has crossed ONE (in either direction). - bool forceLiquidityUpdate = ((deviation <= ONE && prevDeviation > ONE) || - (deviation >= ONE && prevDeviation < ONE)); - - // Execute rebalance. - // NOTE: the vault.rebalance() will revert if enough time has not elapsed. - // We thus override with a force rebalance. - // https://learn.charm.fi/charm/technical-references/core/alphaprovault#rebalance - forceLiquidityUpdate ? _execForceRebalance() : VAULT.rebalance(); - - // We only activate the limit range liquidity, when - // the vault sells SPOT and deviation is above ONE, or when - // the vault buys SPOT and deviation is below ONE - bool extraSpot = isOverweightSpot(); - bool activeLimitRange = deviationValid && - ((deviation >= ONE && extraSpot) || (deviation <= ONE && !extraSpot)); - - // Trim positions after rebalance. - if (!activeLimitRange) { - _removeLimitLiquidity(); - } - - // Update rebalance state. - prevDeviation = deviation; - } - - /// @notice Computes the deviation between SPOT's market price and it's FMV price. - /// @return The computed deviation factor. - function computeDeviationFactor() public returns (uint256, bool) { - uint256 spotMarketPrice = getSpotUSDPrice(); - (uint256 spotTargetPrice, bool spotTargetPriceValid) = pricingStrategy - .perpPrice(); - (, bool usdcPriceValid) = pricingStrategy.usdPrice(); - bool deviationValid = (spotTargetPriceValid && usdcPriceValid); - uint256 deviation = spotTargetPrice > 0 - ? FullMath.mulDiv(spotMarketPrice, ONE, spotTargetPrice) - : type(uint256).max; - deviation = (deviation > MAX_DEVIATION) ? MAX_DEVIATION : deviation; - return (deviation, deviationValid); - } - - //----------------------------------------------------------------------------- - // External Public view methods - - /// @return The computed SPOT price in USD from the underlying univ3 pool. - function getSpotUSDPrice() public view returns (uint256) { - uint160 sqrtPriceX96 = TickMath.getSqrtRatioAtTick(VAULT.getTwap()); - uint256 ratioX192 = uint256(sqrtPriceX96) * sqrtPriceX96; - uint256 usdcPerSpot = FullMath.mulDiv(ONE, (1 << 192), ratioX192); - return FullMath.mulDiv(usdcPerSpot, ONE_SPOT, ONE_USDC); - } - - /// @notice Checks the vault is overweight SPOT, and looking to sell the extra SPOT for USDC. - function isOverweightSpot() public view returns (bool) { - // NOTE: This assumes that in the underlying univ3 pool and - // token0 is USDC and token1 is SPOT. - int24 _marketPrice = VAULT.getTwap(); - int24 _limitLower = VAULT.limitLower(); - int24 _limitUpper = VAULT.limitUpper(); - int24 _limitPrice = (_limitLower + _limitUpper) / 2; - // The limit range has more token1 than token0 if `_marketPrice >= _limitPrice`, - // so the vault looks to sell token1. - return (_marketPrice >= _limitPrice); - } - - /// @return Number of decimals representing 1.0. - function decimals() external pure returns (uint8) { - return uint8(DECIMALS); - } - - //----------------------------------------------------------------------------- - // Private methods - - /// @dev A low-level method, which interacts directly with the vault and executes - /// a rebalance even when enough time hasn't elapsed since the last rebalance. - function _execForceRebalance() private { - uint32 _period = VAULT.period(); - VAULT.setPeriod(0); - VAULT.rebalance(); - VAULT.setPeriod(_period); - } - - /// @dev Removes the vault's limit range liquidity. - /// To be invoked right after a rebalance operation, as it assumes that - /// the vault has a active limit range liquidity. - function _removeLimitLiquidity() private { - int24 _limitLower = VAULT.limitLower(); - int24 _limitUpper = VAULT.limitUpper(); - (uint128 limitLiquidity, , , , ) = _position(_limitLower, _limitUpper); - // docs: https://learn.charm.fi/charm/technical-references/core/alphaprovault#emergencyburn - VAULT.emergencyBurn(_limitLower, _limitUpper, limitLiquidity); - } - - /// @dev Wrapper around `IUniswapV3Pool.positions()`. - function _position( - int24 tickLower, - int24 tickUpper - ) private view returns (uint128, uint256, uint256, uint128, uint128) { - bytes32 positionKey = PositionKey.compute(address(VAULT), tickLower, tickUpper); - return POOL.positions(positionKey); - } -} diff --git a/spot-vaults/contracts/WethWamplManager.sol b/spot-vaults/contracts/WethWamplManager.sol deleted file mode 100644 index b51cc16c..00000000 --- a/spot-vaults/contracts/WethWamplManager.sol +++ /dev/null @@ -1,431 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -// solhint-disable-next-line compiler-version -pragma solidity ^0.7.6; -pragma abicoder v2; - -import { FullMath } from "@uniswap/v3-core/contracts/libraries/FullMath.sol"; -import { TickMath } from "@uniswap/v3-core/contracts/libraries/TickMath.sol"; -import { PositionKey } from "@uniswap/v3-periphery/contracts/libraries/PositionKey.sol"; -import { SafeCast } from "@uniswap/v3-core/contracts/libraries/SafeCast.sol"; - -import { IAlphaProVault } from "./_interfaces/external/IAlphaProVault.sol"; -import { IChainlinkOracle } from "./_interfaces/external/IChainlinkOracle.sol"; -import { IAmpleforthOracle } from "./_interfaces/external/IAmpleforthOracle.sol"; -import { IWAMPL } from "./_interfaces/external/IWAMPL.sol"; -import { IUniswapV3Pool } from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol"; - -/// @title WethWamplManager -/// @notice This contract is a programmatic manager for the WETH-WAMPL Charm AlphaProVault. -contract WethWamplManager { - /// @dev Constants for AMPL and WAMPL units and supply limits. - uint256 public constant ONE_AMPL = 1e9; - uint256 public constant ONE_WAMPL = 1e18; - - /// @dev Decimals. - uint256 public constant DECIMALS = 18; - uint256 public constant ONE = (10 ** DECIMALS); - - /// @dev At all times active liquidity percentage is no lower than 20%. - uint256 public constant MIN_ACTIVE_LIQ_PERC = ONE / 5; // 20% - - /// @dev We bound the deviation factor to 100.0. - uint256 public constant MAX_DEVIATION = 100 * ONE; // 100.0 - - /// @dev Oracle constants. - uint256 public constant CL_ORACLE_STALENESS_THRESHOLD_SEC = 3600 * 24; // 1 day - - //------------------------------------------------------------------------- - // Storage - - /// @notice The WETH-WAMPL charm alpha vault. - IAlphaProVault public immutable VAULT; - - /// @notice The underlying WETH-WAMPL univ3 pool. - IUniswapV3Pool public immutable POOL; - - /// @notice The vault's token0, the WETH token. - address public immutable WETH; - - /// @notice The vault's token1, the WAMPL token. - IWAMPL public immutable WAMPL; - - /// @notice The cpi oracle which returns AMPL's price target in USD. - IAmpleforthOracle public cpiOracle; - - /// @notice The chainlink oracle which returns ETH's current USD price. - IChainlinkOracle public ethOracle; - - /// @notice The contract owner. - address public owner; - - //------------------------------------------------------------------------- - // Active percentage calculation parameters - // - // The deviation factor (or deviation) is defined as the ratio between - // AMPL's current market price and its target price. - // The deviation is 1.0, when AMPL is at the target. - // - // The active liquidity percentage (a value between 20% to 100%) - // is computed based on pair-wise linear function, defined by the contract owner. - // - // If the current deviation is below ONE, function f1 is used - // else function f2 is used. Both f1 and f2 are defined by the owner. - // They are lines, with 2 {x,y} coordinates. The x coordinates are deviation factors, - // and y coordinates are active liquidity percentages. - // - // Both deviation and active liquidity percentage and represented internally - // as a fixed-point number with {DECIMALS} places. - // - - /// @notice A data structure to define a geometric Line with two points. - struct Line { - // x-coordinate of the first point. - uint256 x1; - // y-coordinate of the first point. - uint256 y1; - // x-coordinate of the second point. - uint256 x2; - // y-coordinate of the second point. - uint256 y2; - } - - /// @notice Active percentage calculation function for when deviation is below ONE. - Line public activeLiqPercFn1; - - /// @notice Active percentage calculation function for when deviation is above ONE. - Line public activeLiqPercFn2; - - //------------------------------------------------------------------------- - // Manager parameters - - /// @notice The delta between the current and last recorded active liquidity percentage values - /// outside which a rebalance is executed forcefully. - uint256 public tolerableActiveLiqPercDelta; - - //------------------------------------------------------------------------- - // Manager storage - - /// @notice The recorded deviation factor at the time of the last successful rebalance operation. - uint256 public prevDeviation; - - //-------------------------------------------------------------------------- - // Modifiers - - modifier onlyOwner() { - // solhint-disable-next-line custom-errors - require(msg.sender == owner, "Unauthorized caller"); - _; - } - - //----------------------------------------------------------------------------- - // Constructor and Initializer - - /// @notice Constructor initializes the contract with provided addresses. - /// @param vault_ Address of the AlphaProVault contract. - /// @param cpiOracle_ Address of the Ampleforth CPI oracle contract. - /// @param ethOracle_ Address of the Chainlink ETH price oracle contract. - constructor( - IAlphaProVault vault_, - IAmpleforthOracle cpiOracle_, - IChainlinkOracle ethOracle_ - ) { - owner = msg.sender; - - VAULT = vault_; - POOL = vault_.pool(); - WETH = vault_.token0(); - WAMPL = IWAMPL(vault_.token1()); - - cpiOracle = cpiOracle_; - ethOracle = ethOracle_; - - activeLiqPercFn1 = Line({ - x1: ONE / 2, // 0.5 - y1: ONE / 5, // 20% - x2: ONE, // 1.0 - y2: ONE // 100% - }); - activeLiqPercFn2 = Line({ - x1: ONE, // 1.0 - y1: ONE, // 100% - x2: ONE * 2, // 2.0 - y2: ONE / 5 // 20% - }); - - tolerableActiveLiqPercDelta = ONE / 10; // 10% - prevDeviation = 0; - } - - //-------------------------------------------------------------------------- - // Owner only methods - - /// @notice Updates the owner role. - function transferOwnership(address owner_) external onlyOwner { - owner = owner_; - } - - /// @notice Updates the ampleforth cpi oracle. - function setCpiOracle(IAmpleforthOracle cpiOracle_) external onlyOwner { - cpiOracle = cpiOracle_; - } - - /// @notice Updates the chainlink eth usd price oracle. - function setEthOracle(IChainlinkOracle ethOracle_) external onlyOwner { - ethOracle = ethOracle_; - } - - /// @notice Updates the active liquidity percentage calculation parameters. - function setActivePercParams( - uint256 tolerableActiveLiqPercDelta_, - Line memory activeLiqPercFn1_, - Line memory activeLiqPercFn2_ - ) external onlyOwner { - tolerableActiveLiqPercDelta = tolerableActiveLiqPercDelta_; - activeLiqPercFn1 = activeLiqPercFn1_; - activeLiqPercFn2 = activeLiqPercFn2_; - } - - /// @notice Updates the vault's liquidity range parameters. - function setLiquidityRanges( - int24 baseThreshold, - uint24 fullRangeWeight, - int24 limitThreshold - ) external onlyOwner { - // Update liquidity parameters on the vault. - VAULT.setBaseThreshold(baseThreshold); - VAULT.setFullRangeWeight(fullRangeWeight); - VAULT.setLimitThreshold(limitThreshold); - } - - /// @notice Forwards the given calldata to the vault. - /// @param callData The calldata to pass to the vault. - /// @return The data returned by the vault method call. - function execOnVault( - bytes calldata callData - ) external onlyOwner returns (bytes memory) { - // solhint-disable-next-line avoid-low-level-calls - (bool success, bytes memory r) = address(VAULT).call(callData); - // solhint-disable-next-line custom-errors - require(success, "Vault call failed"); - return r; - } - - //-------------------------------------------------------------------------- - // External write methods - - /// @notice Executes vault rebalance. - function rebalance() public { - // Get the current deviation factor. - (uint256 deviation, bool deviationValid) = computeDeviationFactor(); - - // Calculate the current active liquidity percentage. - uint256 activeLiqPerc = deviationValid - ? computeActiveLiqPerc(deviation) - : MIN_ACTIVE_LIQ_PERC; - - // We have to rebalance out of turn - // - if the active liquidity perc has deviated significantly, or - // - if the deviation factor has crossed ONE (in either direction). - uint256 prevActiveLiqPerc = computeActiveLiqPerc(prevDeviation); - uint256 activeLiqPercDelta = (activeLiqPerc > prevActiveLiqPerc) - ? activeLiqPerc - prevActiveLiqPerc - : prevActiveLiqPerc - activeLiqPerc; - bool forceLiquidityUpdate = (activeLiqPercDelta > tolerableActiveLiqPercDelta) || - ((deviation <= ONE && prevDeviation > ONE) || - (deviation >= ONE && prevDeviation < ONE)); - - // Execute rebalance. - // NOTE: the vault.rebalance() will revert if enough time has not elapsed. - // We thus override with a force rebalance. - // https://learn.charm.fi/charm/technical-references/core/alphaprovault#rebalance - forceLiquidityUpdate ? _execForceRebalance() : VAULT.rebalance(); - - // We only activate the limit range liquidity, when - // the vault sells WAMPL and deviation is above ONE, or when - // the vault buys WAMPL and deviation is below ONE - bool extraWampl = isOverweightWampl(); - bool activeLimitRange = deviationValid && - ((deviation >= ONE && extraWampl) || (deviation <= ONE && !extraWampl)); - - // Trim positions after rebalance. - _trimLiquidity(activeLiqPerc, activeLimitRange); - - // Update rebalance state. - prevDeviation = deviation; - } - - /// @notice Computes the deviation between AMPL's market price and target. - /// @return The computed deviation factor. - function computeDeviationFactor() public returns (uint256, bool) { - (uint256 ethUSDPrice, bool ethPriceValid) = getEthUSDPrice(); - uint256 marketPrice = getAmplUSDPrice(ethUSDPrice); - (uint256 targetPrice, bool targetPriceValid) = _getAmpleforthOracleData( - cpiOracle - ); - bool deviationValid = (ethPriceValid && targetPriceValid); - uint256 deviation = (targetPrice > 0) - ? FullMath.mulDiv(marketPrice, ONE, targetPrice) - : type(uint256).max; - deviation = (deviation > MAX_DEVIATION) ? MAX_DEVIATION : deviation; - return (deviation, deviationValid); - } - - //----------------------------------------------------------------------------- - // External Public view methods - - /// @notice Computes active liquidity percentage based on the provided deviation factor. - /// @return The computed active liquidity percentage. - function computeActiveLiqPerc(uint256 deviation) public view returns (uint256) { - return - (deviation <= ONE) - ? _computeActiveLiqPerc(activeLiqPercFn1, deviation) - : _computeActiveLiqPerc(activeLiqPercFn2, deviation); - } - - /// @notice Computes the AMPL price in USD. - /// @param ethUSDPrice The ETH price in USD. - /// @return The computed AMPL price in USD. - function getAmplUSDPrice(uint256 ethUSDPrice) public view returns (uint256) { - return - FullMath.mulDiv( - getWamplUSDPrice(ethUSDPrice), - ONE_AMPL, - WAMPL.wrapperToUnderlying(ONE_WAMPL) // #AMPL per WAMPL - ); - } - - /// @notice Computes the WAMPL price in USD based on ETH price. - /// @param ethUSDPrice The ETH price in USD. - /// @return The computed WAMPL price in USD. - function getWamplUSDPrice(uint256 ethUSDPrice) public view returns (uint256) { - // We first get the WETH-WAMPL price from the pool and then convert that - // to a USD price using the given ETH-USD price. - uint160 sqrtPriceX96 = TickMath.getSqrtRatioAtTick(VAULT.getTwap()); - uint256 ratioX192 = uint256(sqrtPriceX96) * sqrtPriceX96; - // NOTE: Since both weth and wampl have 18 decimals, - // we don't adjust the `wamplPerWeth`. - uint256 wamplPerWeth = FullMath.mulDiv(ONE, ratioX192, (1 << 192)); - return FullMath.mulDiv(ethUSDPrice, ONE, wamplPerWeth); - } - - /// @notice Fetches the current ETH price in USD from the Chainlink oracle. - /// @return The ETH price in USD and its validity. - function getEthUSDPrice() public view returns (uint256, bool) { - return _getCLOracleData(ethOracle); - } - - /// @notice Checks the vault is overweight WAMPL, and looking to sell the extra WAMPL for WETH. - function isOverweightWampl() public view returns (bool) { - // NOTE: This assumes that in the underlying univ3 pool and - // token0 is WETH and token1 is WAMPL. - int24 _marketPrice = VAULT.getTwap(); - int24 _limitLower = VAULT.limitLower(); - int24 _limitUpper = VAULT.limitUpper(); - int24 _limitPrice = (_limitLower + _limitUpper) / 2; - // The limit range has more token1 than token0 if `_marketPrice >= _limitPrice`, - // so the vault looks to sell token1. - return (_marketPrice >= _limitPrice); - } - - /// @return Number of decimals representing 1.0. - function decimals() external pure returns (uint8) { - return uint8(DECIMALS); - } - - //----------------------------------------------------------------------------- - // Private methods - - /// @dev Trims the vault's current liquidity. - /// To be invoked right after a rebalance operation, as it assumes that all of the vault's - /// liquidity has been deployed before trimming. - function _trimLiquidity(uint256 activePerc, bool activeLimitRange) private { - // Calculated baseLiquidityToBurn, baseLiquidityToBurn will be lesser than fullLiquidity, baseLiquidity - // Thus, there's no risk of overflow. - if (activePerc < ONE) { - int24 _fullLower = VAULT.fullLower(); - int24 _fullUpper = VAULT.fullUpper(); - int24 _baseLower = VAULT.baseLower(); - int24 _baseUpper = VAULT.baseUpper(); - (uint128 fullLiquidity, , , , ) = _position(_fullLower, _fullUpper); - (uint128 baseLiquidity, , , , ) = _position(_baseLower, _baseUpper); - uint128 fullLiquidityToBurn = uint128( - FullMath.mulDiv(uint256(fullLiquidity), ONE - activePerc, ONE) - ); - uint128 baseLiquidityToBurn = uint128( - FullMath.mulDiv(uint256(baseLiquidity), ONE - activePerc, ONE) - ); - // docs: https://learn.charm.fi/charm/technical-references/core/alphaprovault#emergencyburn - // We remove the calculated percentage of base and full range liquidity. - VAULT.emergencyBurn(_fullLower, _fullUpper, fullLiquidityToBurn); - VAULT.emergencyBurn(_baseLower, _baseUpper, baseLiquidityToBurn); - } - - // When the limit range is not active, we remove entirely. - if (!activeLimitRange) { - int24 _limitLower = VAULT.limitLower(); - int24 _limitUpper = VAULT.limitUpper(); - (uint128 limitLiquidity, , , , ) = _position(_limitLower, _limitUpper); - // docs: https://learn.charm.fi/charm/technical-references/core/alphaprovault#emergencyburn - VAULT.emergencyBurn(_limitLower, _limitUpper, limitLiquidity); - } - } - - /// @dev Fetches most recent report from the given ampleforth oracle contract. - /// The returned report is a fixed point number with {DECIMALS} places. - function _getAmpleforthOracleData( - IAmpleforthOracle oracle - ) private returns (uint256, bool) { - (uint256 p, bool valid) = oracle.getData(); - return (FullMath.mulDiv(p, ONE, 10 ** oracle.DECIMALS()), valid); - } - - /// @dev A low-level method, which interacts directly with the vault and executes - /// a rebalance even when enough time hasn't elapsed since the last rebalance. - function _execForceRebalance() private { - uint32 _period = VAULT.period(); - VAULT.setPeriod(0); - VAULT.rebalance(); - VAULT.setPeriod(_period); - } - - /// @dev Wrapper around `IUniswapV3Pool.positions()`. - function _position( - int24 tickLower, - int24 tickUpper - ) private view returns (uint128, uint256, uint256, uint128, uint128) { - bytes32 positionKey = PositionKey.compute(address(VAULT), tickLower, tickUpper); - return POOL.positions(positionKey); - } - - /// @dev Fetches most recent report from the given chain link oracle contract. - /// The data is considered invalid if the latest report is stale. - /// The returned report is a fixed point number with {DECIMALS} places. - function _getCLOracleData( - IChainlinkOracle oracle - ) private view returns (uint256, bool) { - (, int256 p, , uint256 updatedAt, ) = oracle.latestRoundData(); - uint256 price = FullMath.mulDiv(uint256(p), ONE, 10 ** oracle.decimals()); - return ( - price, - (block.timestamp - updatedAt) <= CL_ORACLE_STALENESS_THRESHOLD_SEC - ); - } - - /// @dev We compute activeLiqPerc value given a linear fn and deviation. - function _computeActiveLiqPerc( - Line memory fn, - uint256 deviation - ) private pure returns (uint256) { - deviation = (deviation > MAX_DEVIATION) ? MAX_DEVIATION : deviation; - int256 dlY = SafeCast.toInt256(fn.y2) - SafeCast.toInt256(fn.y1); - int256 dlX = SafeCast.toInt256(fn.x2) - SafeCast.toInt256(fn.x1); - int256 activeLiqPerc = SafeCast.toInt256(fn.y2) + - (((SafeCast.toInt256(deviation) - SafeCast.toInt256(fn.x2)) * dlY) / dlX); - activeLiqPerc = (activeLiqPerc < int256(MIN_ACTIVE_LIQ_PERC)) - ? int256(MIN_ACTIVE_LIQ_PERC) - : activeLiqPerc; - activeLiqPerc = (activeLiqPerc > int256(ONE)) ? int256(ONE) : activeLiqPerc; - // Casting from int256 to uint256 here is safe as activeLiqPerc >= 0. - return uint256(activeLiqPerc); - } -} diff --git a/spot-vaults/contracts/_interfaces/IMetaOracle.sol b/spot-vaults/contracts/_interfaces/IMetaOracle.sol new file mode 100644 index 00000000..b705bbda --- /dev/null +++ b/spot-vaults/contracts/_interfaces/IMetaOracle.sol @@ -0,0 +1,46 @@ +// SPDX-License-Identifier: BUSL-1.1 + +/// @notice Oracle adapter for AMPL and its family of assets. +// solhint-disable-next-line compiler-version +interface IMetaOracle { + /// @return Number of decimals representing the prices returned. + function decimals() external pure returns (uint8); + + /// @return price The price of USDC tokens in dollars. + /// @return isValid True if the returned price is valid. + function usdcPrice() external returns (uint256 price, bool isValid); + + /// @notice Computes SPOT's market price over FMV price. + /// @return deviation The computed deviation factor. + /// @return isValid True if the returned deviation is valid. + function spotPriceDeviation() external returns (uint256 deviation, bool isValid); + + /// @notice Computes AMPL's market price over price target. + /// @return deviation The computed deviation factor. + /// @return isValid True if the returned deviation is valid. + function amplPriceDeviation() external returns (uint256 deviation, bool isValid); + + /// @return price The price of SPOT in dollars. + /// @return isValid True if the returned price is valid. + function spotUsdPrice() external returns (uint256 price, bool isValid); + + /// @return price The price of AMPL in dollars. + /// @return isValid True if the returned price is valid. + function amplUsdPrice() external returns (uint256 price, bool isValid); + + /// @return price The SPOT FMV price in dollars. + /// @return isValid True if the returned price is valid. + function spotFmvUsdPrice() external returns (uint256 price, bool isValid); + + /// @return price The AMPL target price in dollars. + /// @return isValid True if the returned price is valid. + function amplTargetUsdPrice() external returns (uint256 price, bool isValid); + + /// @return price The WAMPL price in dollars. + /// @return isValid True if the returned price is valid. + function wamplUsdPrice() external returns (uint256 price, bool isValid); + + /// @return price The ETH price in dollars. + /// @return isValid True if the returned price is valid. + function ethUsdPrice() external returns (uint256 price, bool isValid); +} diff --git a/spot-vaults/contracts/_interfaces/IPerpPricer.sol b/spot-vaults/contracts/_interfaces/IPerpPricer.sol new file mode 100644 index 00000000..a98ef938 --- /dev/null +++ b/spot-vaults/contracts/_interfaces/IPerpPricer.sol @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: BUSL-1.1 + +/// @notice Oracle contract to price perps and its underlying token. +// solhint-disable-next-line compiler-version +interface IPerpPricer { + /// @return Number of decimals representing the prices returned. + function decimals() external pure returns (uint8); + + /// @return price The price of reference USD tokens. + /// @return isValid True if the returned price is valid. + function usdPrice() external returns (uint256 price, bool isValid); + + /// @return price The price of perp tokens in dollars. + /// @return isValid True if the returned price is valid. + function perpUsdPrice() external returns (uint256 price, bool isValid); + + /// @return price The price of underlying tokens (which back perp) in dollars. + /// @return isValid True if the returned price is valid. + function underlyingUsdPrice() external returns (uint256 price, bool isValid); + + /// @return price Perp's fmv price in dollars. + /// @return isValid True if the returned price is valid. + function perpFmvUsdPrice() external returns (uint256 price, bool isValid); +} diff --git a/spot-vaults/contracts/_interfaces/ISpotPricingStrategy.sol b/spot-vaults/contracts/_interfaces/ISpotPricingStrategy.sol deleted file mode 100644 index 2f794c76..00000000 --- a/spot-vaults/contracts/_interfaces/ISpotPricingStrategy.sol +++ /dev/null @@ -1,22 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 - -/** - * @title ISpotPricingStrategy - * - * @notice Pricing strategy adapter for a BillBroker vault - * which accepts Perp and USDC tokens. - * - */ -// solhint-disable-next-line compiler-version -interface ISpotPricingStrategy { - /// @return Number of decimals representing the prices returned. - function decimals() external pure returns (uint8); - - /// @return price The price of USD tokens. - /// @return isValid True if the returned price is valid. - function usdPrice() external returns (uint256 price, bool isValid); - - /// @return price The price of perp tokens. - /// @return isValid True if the returned price is valid. - function perpPrice() external returns (uint256 price, bool isValid); -} diff --git a/spot-vaults/contracts/_interfaces/errors/BillBrokerErrors.sol b/spot-vaults/contracts/_interfaces/errors/BillBrokerErrors.sol new file mode 100644 index 00000000..e1dc341f --- /dev/null +++ b/spot-vaults/contracts/_interfaces/errors/BillBrokerErrors.sol @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: BUSL-1.1 +pragma solidity ^0.8.24; + +/// @notice Expect AR lower bound to be under the upper bound. +error InvalidARBound(); + +/// @notice Expected pre and post swap AR delta to be non-increasing or non-decreasing. +error UnexpectedARDelta(); diff --git a/spot-vaults/contracts/_interfaces/BillBrokerErrors.sol b/spot-vaults/contracts/_interfaces/errors/CommonErrors.sol similarity index 63% rename from spot-vaults/contracts/_interfaces/BillBrokerErrors.sol rename to spot-vaults/contracts/_interfaces/errors/CommonErrors.sol index babbae79..42e6d9b0 100644 --- a/spot-vaults/contracts/_interfaces/BillBrokerErrors.sol +++ b/spot-vaults/contracts/_interfaces/errors/CommonErrors.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: BUSL-1.1 +/// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.24; /// @notice Expected contract call to be triggered by authorized caller. @@ -10,15 +10,6 @@ error UnexpectedDecimals(); /// @notice Expected perc value to be at most (1 * 10**DECIMALS), i.e) 1.0 or 100%. error InvalidPerc(); -/// @notice Expected Senior CDR bound to be more than 1.0 or 100%. -error InvalidSeniorCDRBound(); - -/// @notice Expect AR lower bound to be under the upper bound. -error InvalidARBound(); - -/// @notice Expected pre and post swap AR delta to be non-increasing or non-decreasing. -error UnexpectedARDelta(); - /// @notice Slippage higher than tolerance requested by user. error SlippageTooHigh(); @@ -27,3 +18,9 @@ error UnacceptableSwap(); /// @notice Expected usable external price. error UnreliablePrice(); + +/// @notice Range upper is larger than lower +error InvalidRange(); + +/// @notice Expected range delta to be smaller. +error UnexpectedRangeDelta(); diff --git a/spot-vaults/contracts/_interfaces/external/IAMPL.sol b/spot-vaults/contracts/_interfaces/external/IAMPL.sol index 4fb916eb..63d84404 100644 --- a/spot-vaults/contracts/_interfaces/external/IAMPL.sol +++ b/spot-vaults/contracts/_interfaces/external/IAMPL.sol @@ -1,9 +1,6 @@ // SPDX-License-Identifier: GPL-3.0-or-later -pragma solidity ^0.8.24; - -import { IERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; +// solhint-disable-next-line compiler-version import { IAmpleforth } from "./IAmpleforth.sol"; - -interface IAMPL is IERC20Upgradeable { +interface IAMPL { function monetaryPolicy() external view returns (IAmpleforth); } diff --git a/spot-vaults/contracts/_interfaces/external/IAlphaProVault.sol b/spot-vaults/contracts/_interfaces/external/IAlphaProVault.sol index d599cdfd..39b4d5fe 100644 --- a/spot-vaults/contracts/_interfaces/external/IAlphaProVault.sol +++ b/spot-vaults/contracts/_interfaces/external/IAlphaProVault.sol @@ -1,6 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-or-later -// solhint-disable-next-line compiler-version -pragma solidity ^0.7.6; +pragma solidity ^0.8.24; import { IUniswapV3Pool } from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol"; diff --git a/spot-vaults/contracts/_interfaces/external/IAmpleforth.sol b/spot-vaults/contracts/_interfaces/external/IAmpleforth.sol index 9cae4b77..43b8f607 100644 --- a/spot-vaults/contracts/_interfaces/external/IAmpleforth.sol +++ b/spot-vaults/contracts/_interfaces/external/IAmpleforth.sol @@ -1,8 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-or-later -pragma solidity ^0.8.24; - -import { IAmpleforthOracle } from "./IAmpleforthOracle.sol"; - +// solhint-disable-next-line compiler-version interface IAmpleforth { - function cpiOracle() external view returns (IAmpleforthOracle); + function getTargetRate() external returns (uint256, bool); } diff --git a/spot-vaults/contracts/_interfaces/external/IBondController.sol b/spot-vaults/contracts/_interfaces/external/IBondController.sol new file mode 100644 index 00000000..5488c920 --- /dev/null +++ b/spot-vaults/contracts/_interfaces/external/IBondController.sol @@ -0,0 +1,5 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +// solhint-disable-next-line compiler-version +interface IBondController { + function collateralBalance() external view returns (uint256); +} diff --git a/spot-vaults/contracts/_interfaces/external/IERC20.sol b/spot-vaults/contracts/_interfaces/external/IERC20.sol new file mode 100644 index 00000000..caab7e44 --- /dev/null +++ b/spot-vaults/contracts/_interfaces/external/IERC20.sol @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +// solhint-disable-next-line compiler-version +interface IERC20 { + function totalSupply() external view returns (uint256); + function balanceOf(address account) external view returns (uint256); + function transfer(address to, uint256 value) external returns (bool); + function allowance(address owner, address spender) external view returns (uint256); + function approve(address spender, uint256 value) external returns (bool); + function transferFrom( + address from, + address to, + uint256 value + ) external returns (bool); +} diff --git a/spot-vaults/contracts/_interfaces/external/IPerpFeePolicy.sol b/spot-vaults/contracts/_interfaces/external/IPerpFeePolicy.sol new file mode 100644 index 00000000..b4aba5c9 --- /dev/null +++ b/spot-vaults/contracts/_interfaces/external/IPerpFeePolicy.sol @@ -0,0 +1,7 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +// solhint-disable-next-line compiler-version +interface IPerpFeePolicy { + function decimals() external returns (uint8); + function deviationRatio() external returns (uint256); + function computePerpRolloverFeePerc(uint256 dr) external returns (int256); +} diff --git a/spot-vaults/contracts/_interfaces/external/IPerpetualTranche.sol b/spot-vaults/contracts/_interfaces/external/IPerpetualTranche.sol new file mode 100644 index 00000000..a730f331 --- /dev/null +++ b/spot-vaults/contracts/_interfaces/external/IPerpetualTranche.sol @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +// solhint-disable-next-line compiler-version +interface IPerpetualTranche { + function underlying() external view returns (address); + function getTVL() external returns (uint256); + function totalSupply() external returns (uint256); + function getReserveCount() external returns (uint256); + function getReserveAt(uint256 index) external returns (address); + function deviationRatio() external returns (uint256); + function getReserveTokenValue(address t) external returns (uint256); + function getReserveTokenBalance(address t) external returns (uint256); + function feePolicy() external returns (address); +} diff --git a/spot-vaults/contracts/_interfaces/external/ITranche.sol b/spot-vaults/contracts/_interfaces/external/ITranche.sol new file mode 100644 index 00000000..51a582d3 --- /dev/null +++ b/spot-vaults/contracts/_interfaces/external/ITranche.sol @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +// solhint-disable-next-line compiler-version +interface ITranche { + function bond() external view returns (address); + function totalSupply() external view returns (uint256); +} diff --git a/spot-vaults/contracts/_interfaces/external/IWAMPL.sol b/spot-vaults/contracts/_interfaces/external/IWAMPL.sol index 0176dd22..b5f24a1a 100644 --- a/spot-vaults/contracts/_interfaces/external/IWAMPL.sol +++ b/spot-vaults/contracts/_interfaces/external/IWAMPL.sol @@ -1,7 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-or-later // solhint-disable-next-line compiler-version -pragma solidity ^0.7.6; - interface IWAMPL { function wrapperToUnderlying(uint256 wamples) external view returns (uint256); } diff --git a/spot-vaults/contracts/_interfaces/BillBrokerTypes.sol b/spot-vaults/contracts/_interfaces/types/BillBrokerTypes.sol similarity index 55% rename from spot-vaults/contracts/_interfaces/BillBrokerTypes.sol rename to spot-vaults/contracts/_interfaces/types/BillBrokerTypes.sol index d24601ad..6b61fcb7 100644 --- a/spot-vaults/contracts/_interfaces/BillBrokerTypes.sol +++ b/spot-vaults/contracts/_interfaces/types/BillBrokerTypes.sol @@ -1,25 +1,7 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.24; -/// @notice A data structure to define a geometric Line with two points. -struct Line { - /// @notice x-coordinate of the first point. - uint256 x1; - /// @notice y-coordinate of the first point. - uint256 y1; - /// @notice x-coordinate of the second point. - uint256 x2; - /// @notice y-coordinate of the second point. - uint256 y2; -} - -/// @notice A data structure to define a numeric Range. -struct Range { - /// @notice Lower bound of the range. - uint256 lower; - /// @notice Upper bound of the range. - uint256 upper; -} +import { Range } from "./CommonTypes.sol"; /// @notice A data structure to store various fees associated with BillBroker operations. struct BillBrokerFees { @@ -27,10 +9,11 @@ struct BillBrokerFees { uint256 mintFeePerc; /// @notice The percentage fee charged for burning BillBroker LP tokens. uint256 burnFeePerc; - /// @notice Range of fee percentages for swapping from perp tokens to USD. - Range perpToUSDSwapFeePercs; - /// @notice Range of fee percentages for swapping from USD to perp tokens. - Range usdToPerpSwapFeePercs; + /// @notice Range of fee factors for swapping from perp tokens to USD. + /// @dev Factor of 1.02 implies a +2% fees, and 0.98 implies a -2% fees. + Range perpToUSDSwapFeeFactors; + /// @notice Range of fee factors for swapping from USD to perp tokens. + Range usdToPerpSwapFeeFactors; /// @notice The percentage of the swap fees that goes to the protocol. uint256 protocolSwapSharePerc; } diff --git a/spot-vaults/contracts/_interfaces/types/CommonTypes.sol b/spot-vaults/contracts/_interfaces/types/CommonTypes.sol new file mode 100644 index 00000000..00ea2009 --- /dev/null +++ b/spot-vaults/contracts/_interfaces/types/CommonTypes.sol @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: BUSL-1.1 +pragma solidity ^0.8.24; + +/// @notice A data structure to define a geometric Line with two points. +struct Line { + // @dev x-coordinate of the first point. + uint256 x1; + // @dev y-coordinate of the first point. + uint256 y1; + // @dev x-coordinate of the second point. + uint256 x2; + // @dev y-coordinate of the second point. + uint256 y2; +} + +/// @notice A data structure to define a numeric Range. +struct Range { + // @dev Lower bound of the range. + uint256 lower; + // @dev Upper bound of the range. + uint256 upper; +} diff --git a/spot-vaults/contracts/_strategies/SpotAppraiser.sol b/spot-vaults/contracts/_strategies/SpotAppraiser.sol deleted file mode 100644 index 05cd2b28..00000000 --- a/spot-vaults/contracts/_strategies/SpotAppraiser.sol +++ /dev/null @@ -1,217 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -pragma solidity ^0.8.24; - -import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; -import { Math } from "@openzeppelin/contracts/utils/math/Math.sol"; - -import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -import { ITranche } from "@ampleforthorg/spot-contracts/contracts/_interfaces/buttonwood/ITranche.sol"; -import { IBondController } from "@ampleforthorg/spot-contracts/contracts/_interfaces/buttonwood/IBondController.sol"; -import { IPerpetualTranche } from "@ampleforthorg/spot-contracts/contracts/_interfaces/IPerpetualTranche.sol"; -import { IChainlinkOracle } from "../_interfaces/external/IChainlinkOracle.sol"; -import { IAmpleforthOracle } from "../_interfaces/external/IAmpleforthOracle.sol"; -import { ISpotPricingStrategy } from "../_interfaces/ISpotPricingStrategy.sol"; -import { InvalidSeniorCDRBound } from "../_interfaces/BillBrokerErrors.sol"; - -/** - * @title SpotAppraiser - * - * @notice Pricing strategy adapter for a BillBroker vault which accepts - * SPOT (as the perp token) and dollar tokens like USDC. - * - * AMPL is the underlying token for SPOT. - * The market price of AMPL is mean reverting and eventually converges to its target. - * However, it can significantly deviate from the target in the near term. - * - * SPOT is a perpetual claim on AMPL senior tranches. Insofar as SPOT is fully backed by - * healthy senior tranches, we can price spot reliably using the following strategy: - * - * SPOT_PRICE = MULTIPLIER * AMPL_TARGET - * MULTIPLIER = spot.getTVL() / spot.totalSupply(), which is it's enrichment/debasement factor. - * To know more, read the spot documentation. - * - * We get the AMPL target price from Ampleforth's CPI oracle, - * which is also used by the protocol to adjust AMPL supply through rebasing. - * - * And the MULTIPLIER is directly queried from the SPOT contract. - * - */ -contract SpotAppraiser is Ownable, ISpotPricingStrategy { - //------------------------------------------------------------------------- - // Libraries - using Math for uint256; - - //------------------------------------------------------------------------- - // Constants & Immutables - - uint256 private constant DECIMALS = 18; - uint256 private constant ONE = (10 ** DECIMALS); - uint256 private constant SPOT_DR_DECIMALS = 8; - uint256 private constant SPOT_DR_ONE = (10 ** SPOT_DR_DECIMALS); - uint256 public constant CL_ORACLE_DECIMALS = 8; - uint256 public constant CL_ORACLE_STALENESS_THRESHOLD_SEC = 3600 * 48; // 2 days - uint256 public constant USD_UPPER_BOUND = (101 * ONE) / 100; // 1.01$ - uint256 public constant USD_LOWER_BOUND = (99 * ONE) / 100; // 0.99$ - uint256 public constant AMPL_DUST_AMT = 25000 * (10 ** 9); // 25000 AMPL - - /// @notice Address of the SPOT (perpetual tranche) ERC-20 token contract. - IPerpetualTranche public immutable SPOT; - - /// @notice Address of the AMPL ERC-20 token contract. - IERC20 public immutable AMPL; - - /// @notice Address of the USD token market price oracle. - IChainlinkOracle public immutable USD_ORACLE; - - /// @notice Number of decimals representing the prices returned by the chainlink oracle. - uint256 public immutable USD_ORACLE_DECIMALS; - - /// @notice Address of the Ampleforth CPI oracle. (provides the inflation-adjusted target price for AMPL). - IAmpleforthOracle public immutable AMPL_CPI_ORACLE; - - /// @notice Number of decimals representing the prices returned by the ampleforth oracle. - uint256 public immutable AMPL_CPI_ORACLE_DECIMALS; - - //------------------------------------------------------------------------- - // Storage - - /// @notice The minimum "deviation ratio" of the SPOT outside which it's considered unhealthy. - uint256 public minSPOTDR; - - /// @notice The minimum CDR of senior tranches backing SPOT outside which it's considered unhealthy. - uint256 public minSeniorCDR; - - //----------------------------------------------------------------------------- - // Constructor - - /// @notice Contract constructor. - /// @param spot Address of the SPOT token. - /// @param usdOracle Address of the USD token market price oracle token. - /// @param cpiOracle Address of the Ampleforth CPI oracle. - constructor( - IPerpetualTranche spot, - IChainlinkOracle usdOracle, - IAmpleforthOracle cpiOracle - ) Ownable() { - SPOT = spot; - AMPL = IERC20(address(spot.underlying())); - - USD_ORACLE = usdOracle; - USD_ORACLE_DECIMALS = usdOracle.decimals(); - - AMPL_CPI_ORACLE = cpiOracle; - AMPL_CPI_ORACLE_DECIMALS = cpiOracle.DECIMALS(); - - minSPOTDR = (ONE * 8) / 10; // 0.8 - minSeniorCDR = (ONE * 11) / 10; // 110% - } - - //-------------------------------------------------------------------------- - // Owner only methods - - /// @notice Controls the minimum `deviationRatio` ratio of SPOT below which SPOT is considered unhealthy. - /// @param minSPOTDR_ The minimum SPOT `deviationRatio`. - function updateMinSPOTDR(uint256 minSPOTDR_) external onlyOwner { - minSPOTDR = minSPOTDR_; - } - - /// @notice Controls the minimum CDR of SPOT's senior tranche below which SPOT is considered unhealthy. - /// @param minSeniorCDR_ The minimum senior tranche CDR. - function updateMinPerpCollateralCDR(uint256 minSeniorCDR_) external onlyOwner { - if (minSeniorCDR_ < ONE) { - revert InvalidSeniorCDRBound(); - } - minSeniorCDR = minSeniorCDR_; - } - - //-------------------------------------------------------------------------- - // External methods - - /// @return p The price of the usd token in dollars. - /// @return v True if the price is valid and can be used by downstream consumers. - function usdPrice() external view override returns (uint256, bool) { - (uint256 p, bool v) = _getCLOracleData(USD_ORACLE, USD_ORACLE_DECIMALS); - // If the market price of the USD coin deviated too much from 1$, - // it's an indication of some systemic issue with the USD token - // and thus its price should be considered unreliable. - return (ONE, (v && p < USD_UPPER_BOUND && p > USD_LOWER_BOUND)); - } - - /// @return p The price of the spot token in dollar coins. - /// @return v True if the price is valid and can be used by downstream consumers. - function perpPrice() external override returns (uint256, bool) { - // NOTE: Since {DECIMALS} == {AMPL_CPI_ORACLE_DECIMALS} == 18 - // we don't adjust the returned values. - (uint256 targetPrice, bool targetPriceValid) = AMPL_CPI_ORACLE.getData(); - uint256 p = targetPrice.mulDiv(SPOT.getTVL(), SPOT.totalSupply()); - bool v = (targetPriceValid && isSPOTHealthy()); - return (p, v); - } - - /// @return Number of decimals representing a price of 1.0 USD. - function decimals() external pure override returns (uint8) { - return uint8(DECIMALS); - } - - //----------------------------------------------------------------------------- - // Public methods - - /// @return If the spot token is healthy. - function isSPOTHealthy() public returns (bool) { - // If the SPOT's `deviationRatio` is lower than the defined bound - // i.e) it doesn't have enough capital to cover future rollovers, - // we consider it unhealthy. - uint256 spotDR = SPOT.deviationRatio().mulDiv(ONE, SPOT_DR_ONE); - if (spotDR < minSPOTDR) { - return false; - } - - // We compute the CDR of all the senior tranches backing perp. - // If any one of the seniors is mature or has a CDR below below the defined minimum, - // we consider it unhealthy. - // NOTE: Any CDR below 100%, means that the tranche is impaired - // and is roughly equivalent to holding AMPL. - uint8 reserveCount = uint8(SPOT.getReserveCount()); - for (uint8 i = 1; i < reserveCount; i++) { - ITranche tranche = ITranche(address(SPOT.getReserveAt(i))); - IBondController bond = IBondController(tranche.bond()); - if (bond.isMature()) { - return false; - } - uint256 seniorCDR = AMPL.balanceOf(address(bond)).mulDiv( - ONE, - tranche.totalSupply() - ); - if (seniorCDR < minSeniorCDR) { - return false; - } - } - - // If SPOT has ANY raw AMPL as collateral, we consider it unhealthy. - // NOTE: In practice some dust might exist or someone could grief this check - // by transferring some dust AMPL into the spot contract. - // We consider SPOT unhealthy if it has more than `AMPL_DUST_AMT` AMPL. - if (AMPL.balanceOf(address(SPOT)) > AMPL_DUST_AMT) { - return false; - } - - return true; - } - - //----------------------------------------------------------------------------- - // Private methods - - /// @dev Fetches most recent report from the given chain link oracle contract. - /// The data is considered invalid if the latest report is stale. - function _getCLOracleData( - IChainlinkOracle oracle, - uint256 oracleDecimals - ) private view returns (uint256, bool) { - (, int256 p, , uint256 updatedAt, ) = oracle.latestRoundData(); - uint256 price = uint256(p).mulDiv(ONE, 10 ** oracleDecimals); - return ( - price, - (block.timestamp - updatedAt) <= CL_ORACLE_STALENESS_THRESHOLD_SEC - ); - } -} diff --git a/spot-vaults/contracts/_strategies/SpotCDRPricer.sol b/spot-vaults/contracts/_strategies/SpotCDRPricer.sol deleted file mode 100644 index 2848949d..00000000 --- a/spot-vaults/contracts/_strategies/SpotCDRPricer.sol +++ /dev/null @@ -1,126 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -pragma solidity ^0.8.24; - -import { Math } from "@openzeppelin/contracts/utils/math/Math.sol"; - -import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -import { IPerpetualTranche } from "@ampleforthorg/spot-contracts/contracts/_interfaces/IPerpetualTranche.sol"; -import { IChainlinkOracle } from "../_interfaces/external/IChainlinkOracle.sol"; -import { IAmpleforthOracle } from "../_interfaces/external/IAmpleforthOracle.sol"; -import { ISpotPricingStrategy } from "../_interfaces/ISpotPricingStrategy.sol"; - -/** - * @title SpotCDRPricer - * - * @notice Pricing strategy adapter for SPOT. - * - * SPOT is a perpetual claim on AMPL senior tranches. - * We price spot based on the redeemable value of it's collateral at maturity. - * NOTE: SPOT's internal `getTVL` prices the collateral this way. - * - * SPOT_PRICE = (spot.getTVL() / spot.totalSupply()) * AMPL_TARGET - * - * We get the AMPL target price from Ampleforth's CPI oracle, - * which is also used by the protocol to adjust AMPL supply through rebasing. - * - */ -contract SpotCDRPricer is ISpotPricingStrategy { - //------------------------------------------------------------------------- - // Libraries - using Math for uint256; - - //------------------------------------------------------------------------- - // Constants & Immutables - - uint256 private constant DECIMALS = 18; - uint256 private constant ONE = (10 ** DECIMALS); - uint256 public constant CL_ORACLE_DECIMALS = 8; - uint256 public constant CL_ORACLE_STALENESS_THRESHOLD_SEC = 3600 * 48; // 2 days - uint256 public constant USD_UPPER_BOUND = (101 * ONE) / 100; // 1.01$ - uint256 public constant USD_LOWER_BOUND = (99 * ONE) / 100; // 0.99$ - - /// @notice Address of the SPOT (perpetual tranche) ERC-20 token contract. - IPerpetualTranche public immutable SPOT; - - /// @notice Address of the AMPL ERC-20 token contract. - IERC20 public immutable AMPL; - - /// @notice Address of the USD token market price oracle. - IChainlinkOracle public immutable USD_ORACLE; - - /// @notice Number of decimals representing the prices returned by the chainlink oracle. - uint256 public immutable USD_ORACLE_DECIMALS; - - /// @notice Address of the Ampleforth CPI oracle. (provides the inflation-adjusted target price for AMPL). - IAmpleforthOracle public immutable AMPL_CPI_ORACLE; - - /// @notice Number of decimals representing the prices returned by the ampleforth oracle. - uint256 public immutable AMPL_CPI_ORACLE_DECIMALS; - - //----------------------------------------------------------------------------- - // Constructor - - /// @notice Contract constructor. - /// @param spot Address of the SPOT token. - /// @param usdOracle Address of the USD token market price oracle token. - /// @param cpiOracle Address of the Ampleforth CPI oracle. - constructor( - IPerpetualTranche spot, - IChainlinkOracle usdOracle, - IAmpleforthOracle cpiOracle - ) { - SPOT = spot; - AMPL = IERC20(address(spot.underlying())); - - USD_ORACLE = usdOracle; - USD_ORACLE_DECIMALS = usdOracle.decimals(); - - AMPL_CPI_ORACLE = cpiOracle; - AMPL_CPI_ORACLE_DECIMALS = cpiOracle.DECIMALS(); - } - - //-------------------------------------------------------------------------- - // External methods - - /// @return p The price of the usd token in dollars. - /// @return v True if the price is valid and can be used by downstream consumers. - function usdPrice() external view override returns (uint256, bool) { - (uint256 p, bool v) = _getCLOracleData(USD_ORACLE, USD_ORACLE_DECIMALS); - // If the market price of the USD coin deviated too much from 1$, - // it's an indication of some systemic issue with the USD token - // and thus its price should be considered unreliable. - return (ONE, (v && p < USD_UPPER_BOUND && p > USD_LOWER_BOUND)); - } - - /// @return p The price of the spot token in dollar coins. - /// @return v True if the price is valid and can be used by downstream consumers. - function perpPrice() external override returns (uint256, bool) { - // NOTE: Since {DECIMALS} == {AMPL_CPI_ORACLE_DECIMALS} == 18 - // we don't adjust the returned values. - (uint256 targetPrice, bool targetPriceValid) = AMPL_CPI_ORACLE.getData(); - uint256 p = targetPrice.mulDiv(SPOT.getTVL(), SPOT.totalSupply()); - return (p, targetPriceValid); - } - - /// @return Number of decimals representing a price of 1.0 USD. - function decimals() external pure override returns (uint8) { - return uint8(DECIMALS); - } - - //----------------------------------------------------------------------------- - // Private methods - - /// @dev Fetches most recent report from the given chain link oracle contract. - /// The data is considered invalid if the latest report is stale. - function _getCLOracleData( - IChainlinkOracle oracle, - uint256 oracleDecimals - ) private view returns (uint256, bool) { - (, int256 p, , uint256 updatedAt, ) = oracle.latestRoundData(); - uint256 price = uint256(p).mulDiv(ONE, 10 ** oracleDecimals); - return ( - price, - (block.timestamp - updatedAt) <= CL_ORACLE_STALENESS_THRESHOLD_SEC - ); - } -} diff --git a/spot-vaults/contracts/_strategies/SpotPricer.sol b/spot-vaults/contracts/_strategies/SpotPricer.sol new file mode 100644 index 00000000..b96ee9d0 --- /dev/null +++ b/spot-vaults/contracts/_strategies/SpotPricer.sol @@ -0,0 +1,255 @@ +// SPDX-License-Identifier: BUSL-1.1 +// solhint-disable-next-line compiler-version +pragma solidity ^0.7.6; +pragma abicoder v2; + +import { FullMath } from "@uniswap/v3-core/contracts/libraries/FullMath.sol"; +import { UniswapV3PoolHelpers } from "../_utils/UniswapV3PoolHelpers.sol"; + +import { IUniswapV3Pool } from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol"; +import { IERC20 } from "../_interfaces/external/IERC20.sol"; +import { IWAMPL } from "../_interfaces/external/IWAMPL.sol"; +import { IPerpetualTranche } from "../_interfaces/external/IPerpetualTranche.sol"; +import { IChainlinkOracle } from "../_interfaces/external/IChainlinkOracle.sol"; +import { IAMPL } from "../_interfaces/external/IAMPL.sol"; +import { IAmpleforth } from "../_interfaces/external/IAmpleforth.sol"; + +import { IPerpPricer } from "../_interfaces/IPerpPricer.sol"; +import { IMetaOracle } from "../_interfaces/IMetaOracle.sol"; + +/** + * @title SpotPricer + * + * @notice A pricing oracle for SPOT, a perpetual claim on AMPL senior tranches. + * + * Internally aggregates prices from multiple oracles. + * Chainlink for USDC and ETH prices, + * The Ampleforth monetary policy for the AMPL price target and + * UniV3 pools for current AMPL and SPOT market prices. + * + */ +contract SpotPricer is IPerpPricer, IMetaOracle { + using FullMath for uint256; + + //------------------------------------------------------------------------- + // Constants + + /// @dev Standardizes prices from various oracles and returns the final value + /// as a fixed point number with {DECIMALS} places. + uint256 private constant DECIMALS = 18; + uint256 private constant ONE = (10 ** DECIMALS); + + /// @dev We bound the deviation factor to 100.0. + uint256 public constant MAX_DEVIATION = 100 * ONE; // 100.0 + + /// @dev Token denominations. + uint256 private constant ONE_USDC = 1e6; + uint256 private constant ONE_WETH = 1e18; + uint256 private constant ONE_SPOT = 1e9; + uint256 private constant ONE_AMPL = 1e9; + uint256 private constant ONE_WAMPL = 1e18; + + /// @dev Oracle constants. + uint256 private constant CL_ETH_ORACLE_STALENESS_THRESHOLD_SEC = 3600 * 12; // 12 hours + uint256 private constant CL_USDC_ORACLE_STALENESS_THRESHOLD_SEC = 3600 * 48; // 2 day + uint256 private constant USDC_UPPER_BOUND = (101 * ONE) / 100; // 1.01$ + uint256 private constant USDC_LOWER_BOUND = (99 * ONE) / 100; // 0.99$ + uint32 private constant TWAP_DURATION = 3600; + + //------------------------------------------------------------------------- + // Storage + + /// @notice Address of the WETH-WAMPL univ3 pool. + IUniswapV3Pool public immutable WETH_WAMPL_POOL; + + /// @notice Address of the USDC-SPOT univ3 pool. + IUniswapV3Pool public immutable USDC_SPOT_POOL; + + /// @notice Address of the ETH token market price oracle. + IChainlinkOracle public immutable ETH_ORACLE; + + /// @notice Address of the USD token market price oracle. + IChainlinkOracle public immutable USDC_ORACLE; + + /// @notice Address of the Ampleforth monetary policy. + /// (provides the inflation-adjusted target price for AMPL) + IAmpleforth public immutable AMPLEFORTH_POLICY; + + /// @notice Address of the WAMPL ERC-20 token contract. + IWAMPL public immutable WAMPL; + + /// @notice Address of the USDC ERC-20 token contract. + IERC20 public immutable USDC; + + /// @notice Address of the SPOT (perpetual tranche) ERC-20 token contract. + IPerpetualTranche public immutable SPOT; + + /// @notice Address of the AMPL ERC-20 token contract. + IERC20 public immutable AMPL; + + //----------------------------------------------------------------------------- + // Constructor + + /// @notice Contract constructor. + /// @param wethWamplPool Address of the WETH-WAMPL univ3 pool. + /// @param usdcSpotPool Address of the USDC-SPOT univ3 pool. + /// @param ethOracle Address of the ETH market price oracle. + /// @param usdcOracle Address of the USD coin market price oracle. + constructor( + IUniswapV3Pool wethWamplPool, + IUniswapV3Pool usdcSpotPool, + IChainlinkOracle ethOracle, + IChainlinkOracle usdcOracle + ) { + WETH_WAMPL_POOL = wethWamplPool; + USDC_SPOT_POOL = usdcSpotPool; + + ETH_ORACLE = ethOracle; + USDC_ORACLE = usdcOracle; + + WAMPL = IWAMPL(wethWamplPool.token1()); + USDC = IERC20(usdcSpotPool.token0()); + + IPerpetualTranche spot = IPerpetualTranche(usdcSpotPool.token1()); + SPOT = spot; + address ampl = spot.underlying(); + AMPL = IERC20(ampl); + + AMPLEFORTH_POLICY = IAmpleforth(IAMPL(ampl).monetaryPolicy()); + } + + //-------------------------------------------------------------------------- + // IPerpPricer methods + + /// @inheritdoc IPerpPricer + function decimals() external pure override(IPerpPricer, IMetaOracle) returns (uint8) { + return uint8(DECIMALS); + } + + /// @inheritdoc IPerpPricer + function usdPrice() external view override returns (uint256, bool) { + return usdcPrice(); + } + + /// @inheritdoc IPerpPricer + function perpUsdPrice() external view override returns (uint256, bool) { + return spotUsdPrice(); + } + + /// @inheritdoc IPerpPricer + function underlyingUsdPrice() external view override returns (uint256, bool) { + return amplUsdPrice(); + } + + /// @inheritdoc IPerpPricer + function perpFmvUsdPrice() external override returns (uint256, bool) { + return spotFmvUsdPrice(); + } + + //-------------------------------------------------------------------------- + // IMetaOracle methods + + /// @inheritdoc IMetaOracle + function usdcPrice() public view override returns (uint256, bool) { + (uint256 p, bool v) = _getCLOracleData( + USDC_ORACLE, + CL_USDC_ORACLE_STALENESS_THRESHOLD_SEC + ); + // If the market price of the USD coin deviated too much from 1$, + // it's an indication of some systemic issue with the USD token + // and thus its price should be considered unreliable. + return (ONE, (v && p < USDC_UPPER_BOUND && p > USDC_LOWER_BOUND)); + } + + /// @inheritdoc IMetaOracle + function spotPriceDeviation() public override returns (uint256, bool) { + (uint256 marketPrice, bool marketPriceValid) = spotUsdPrice(); + (uint256 targetPrice, bool targetPriceValid) = spotFmvUsdPrice(); + uint256 deviation = (targetPrice > 0) + ? marketPrice.mulDiv(ONE, targetPrice) + : type(uint256).max; + if (deviation > MAX_DEVIATION) { + deviation = MAX_DEVIATION; + } + return (deviation, (marketPriceValid && targetPriceValid)); + } + + /// @inheritdoc IMetaOracle + function amplPriceDeviation() public override returns (uint256, bool) { + (uint256 marketPrice, bool marketPriceValid) = amplUsdPrice(); + (uint256 targetPrice, bool targetPriceValid) = amplTargetUsdPrice(); + uint256 deviation = (targetPrice > 0) + ? marketPrice.mulDiv(ONE, targetPrice) + : type(uint256).max; + if (deviation > MAX_DEVIATION) { + deviation = MAX_DEVIATION; + } + return (deviation, (marketPriceValid && targetPriceValid)); + } + + /// @inheritdoc IMetaOracle + function spotUsdPrice() public view override returns (uint256, bool) { + uint256 usdcPerSpot = UniswapV3PoolHelpers.calculateTwap( + UniswapV3PoolHelpers.getTwapTick(USDC_SPOT_POOL, TWAP_DURATION), + ONE_USDC, + ONE_SPOT, + ONE + ); + (, bool usdcPriceValid) = usdcPrice(); + return (usdcPerSpot, usdcPriceValid); + } + + /// @inheritdoc IMetaOracle + function amplUsdPrice() public view override returns (uint256, bool) { + (uint256 wamplPrice, bool wamplPriceValid) = wamplUsdPrice(); + uint256 amplPrice = wamplPrice.mulDiv( + ONE_AMPL, + WAMPL.wrapperToUnderlying(ONE_WAMPL) + ); + return (amplPrice, wamplPriceValid); + } + + /// @inheritdoc IMetaOracle + function spotFmvUsdPrice() public override returns (uint256, bool) { + (uint256 targetPrice, bool targetPriceValid) = amplTargetUsdPrice(); + return (targetPrice.mulDiv(SPOT.getTVL(), SPOT.totalSupply()), targetPriceValid); + } + + /// @inheritdoc IMetaOracle + function amplTargetUsdPrice() public override returns (uint256, bool) { + // NOTE: Since {DECIMALS} == {AMPLEFORTH_POLICY_DECIMALS} == 18 + // we don't adjust the returned values. + return AMPLEFORTH_POLICY.getTargetRate(); + } + + /// @inheritdoc IMetaOracle + function wamplUsdPrice() public view override returns (uint256, bool) { + uint256 wethPerWampl = UniswapV3PoolHelpers.calculateTwap( + UniswapV3PoolHelpers.getTwapTick(WETH_WAMPL_POOL, TWAP_DURATION), + ONE_WETH, + ONE_WAMPL, + ONE + ); + (uint256 ethPrice, bool ethPriceValid) = ethUsdPrice(); + uint256 wamplPrice = ethPrice.mulDiv(wethPerWampl, ONE); + return (wamplPrice, ethPriceValid); + } + + /// @inheritdoc IMetaOracle + function ethUsdPrice() public view override returns (uint256, bool) { + return _getCLOracleData(ETH_ORACLE, CL_ETH_ORACLE_STALENESS_THRESHOLD_SEC); + } + + //-------------------------------------------------------------------------- + // Private methods + + /// @dev Fetches price from a given Chainlink oracle. + function _getCLOracleData( + IChainlinkOracle oracle, + uint256 stalenessThresholdSec + ) private view returns (uint256, bool) { + (, int256 p, , uint256 updatedAt, ) = oracle.latestRoundData(); + uint256 price = uint256(p).mulDiv(ONE, 10 ** oracle.decimals()); + return (price, (block.timestamp - updatedAt) <= stalenessThresholdSec); + } +} diff --git a/spot-vaults/contracts/_test/LineHelpersTester.sol b/spot-vaults/contracts/_test/LineHelpersTester.sol new file mode 100644 index 00000000..e3fbc9f6 --- /dev/null +++ b/spot-vaults/contracts/_test/LineHelpersTester.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +pragma solidity ^0.8.24; + +import { LineHelpers } from "../_utils/LineHelpers.sol"; +import { Line, Range } from "../_interfaces/types/CommonTypes.sol"; + +contract LineHelpersTester { + using LineHelpers for Line; + + function testComputeY(Line memory fn, uint256 x) public pure returns (int256) { + return fn.computeY(x); + } + + function testAvgY( + Line memory fn, + uint256 xL, + uint256 xU + ) public pure returns (int256) { + return fn.avgY(xL, xU); + } + + function testComputePiecewiseAvgY( + Line memory fn1, + Line memory fn2, + Line memory fn3, + Range memory xBreakPt, + Range memory xRange + ) public pure returns (int256) { + return LineHelpers.computePiecewiseAvgY(fn1, fn2, fn3, xBreakPt, xRange); + } +} diff --git a/spot-vaults/contracts/_utils/AlphaVaultHelpers.sol b/spot-vaults/contracts/_utils/AlphaVaultHelpers.sol new file mode 100644 index 00000000..5cf119fb --- /dev/null +++ b/spot-vaults/contracts/_utils/AlphaVaultHelpers.sol @@ -0,0 +1,93 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +pragma solidity ^0.8.24; + +import { Math } from "@openzeppelin/contracts/utils/math/Math.sol"; +import { IAlphaProVault } from "../_interfaces/external/IAlphaProVault.sol"; +import { IUniswapV3Pool } from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol"; + +/** + * @title AlphaVaultHelpers + * + * @notice Library with helper functions for Charm's Alpha Vaults. + * + */ +library AlphaVaultHelpers { + /// @dev Checks if the vault is underweight token0 (ie overweight token1). + function isUnderweightToken0(IAlphaProVault vault) internal view returns (bool) { + // `vault.getTwap()` returns the twap tick from the underlying univ3 pool. + // https://learn.charm.fi/charm/technical-references/core/alphaprovault#gettwap + int24 _priceTick = vault.getTwap(); + int24 _limitLower = vault.limitLower(); + int24 _limitUpper = vault.limitUpper(); + int24 _limitPriceTick = (_limitLower + _limitUpper) / 2; + // The limit range has more token1 than token0 if `_priceTick >= _limitPriceTick`, + // so the vault looks to sell token1. + return (_priceTick >= _limitPriceTick); + } + + /// @dev Removes the vault's limit range liquidity completely. + function removeLimitLiquidity(IAlphaProVault vault, IUniswapV3Pool pool) internal { + int24 _limitLower = vault.limitLower(); + int24 _limitUpper = vault.limitUpper(); + uint128 limitLiquidity = getLiquidity(vault, pool, _limitLower, _limitUpper); + // docs: https://learn.charm.fi/charm/technical-references/core/alphaprovault#emergencyburn + vault.emergencyBurn(_limitLower, _limitUpper, limitLiquidity); + } + + /// @dev Removes a percentage of the base and full range liquidity. + function trimLiquidity( + IAlphaProVault vault, + IUniswapV3Pool pool, + uint256 percToRemove, + uint256 one + ) internal { + if (percToRemove <= 0) { + return; + } + int24 _fullLower = vault.fullLower(); + int24 _fullUpper = vault.fullUpper(); + int24 _baseLower = vault.baseLower(); + int24 _baseUpper = vault.baseUpper(); + uint128 fullLiquidity = getLiquidity(vault, pool, _fullLower, _fullUpper); + uint128 baseLiquidity = getLiquidity(vault, pool, _baseLower, _baseUpper); + // Calculated baseLiquidityToBurn, baseLiquidityToBurn will be lesser than fullLiquidity, baseLiquidity + // Thus, there's no risk of overflow. + uint128 fullLiquidityToBurn = uint128( + Math.mulDiv(uint256(fullLiquidity), percToRemove, one) + ); + uint128 baseLiquidityToBurn = uint128( + Math.mulDiv(uint256(baseLiquidity), percToRemove, one) + ); + // docs: https://learn.charm.fi/charm/technical-references/core/alphaprovault#emergencyburn + // We remove the calculated percentage of base and full range liquidity. + if (fullLiquidityToBurn > 0) { + vault.emergencyBurn(_fullLower, _fullUpper, fullLiquidityToBurn); + } + if (baseLiquidityToBurn > 0) { + vault.emergencyBurn(_baseLower, _baseUpper, baseLiquidityToBurn); + } + } + + /// @dev A low-level method, which interacts directly with the vault and executes + /// a rebalance even when enough time hasn't elapsed since the last rebalance. + function forceRebalance(IAlphaProVault vault) internal { + uint32 _period = vault.period(); + vault.setPeriod(0); + vault.rebalance(); + vault.setPeriod(_period); + } + + /// @dev Wrapper around `IUniswapV3Pool.positions()`. + function getLiquidity( + IAlphaProVault vault, + IUniswapV3Pool pool, + int24 tickLower, + int24 tickUpper + ) internal view returns (uint128) { + bytes32 positionKey = keccak256( + abi.encodePacked(address(vault), tickLower, tickUpper) + ); + (uint128 liquidity, , , , ) = pool.positions(positionKey); + return liquidity; + } +} diff --git a/spot-vaults/contracts/_utils/LineHelpers.sol b/spot-vaults/contracts/_utils/LineHelpers.sol new file mode 100644 index 00000000..3eb077ce --- /dev/null +++ b/spot-vaults/contracts/_utils/LineHelpers.sol @@ -0,0 +1,124 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +pragma solidity ^0.8.24; + +import { Math } from "@openzeppelin/contracts/utils/math/Math.sol"; +import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol"; +import { MathHelpers } from "./MathHelpers.sol"; +import { Line, Range } from "../_interfaces/types/CommonTypes.sol"; +import { InvalidRange, UnexpectedRangeDelta } from "../_interfaces/errors/CommonErrors.sol"; + +/** + * @title LineHelpers + * + * @notice Library with helper functions for the Line data structure. + * + */ +library LineHelpers { + using Math for uint256; + using MathHelpers for uint256; + using SafeCast for uint256; + using SafeCast for int256; + + /// @dev This function computes y for a given x on the line (fn). + function computeY(Line memory fn, uint256 x) internal pure returns (int256) { + // If the line has a zero slope, return any y. + if (fn.y1 == fn.y2) { + return fn.y1.toInt256(); + } + + // m = dlY/dlX + // c = y2 - m . x2 + // y = m . x + c + int256 dlY = fn.y2.toInt256() - fn.y1.toInt256(); + int256 dlX = fn.x2.toInt256() - fn.x1.toInt256(); + int256 c = fn.y2.toInt256() - ((fn.x2.toInt256() * dlY) / dlX); + return (((x.toInt256() * dlY) / dlX) + c); + } + + /// @dev We compute the average height of the line between {xL,xU}. + function avgY(Line memory fn, uint256 xL, uint256 xU) internal pure returns (int256) { + // if the line has a zero slope, return any y + if (fn.y1 == fn.y2) { + return fn.y2.toInt256(); + } + + // NOTE: There is some precision loss because we cast to int and back + // m = dlY/dlX + // c = y2 - m . x2 + // Avg height => (yL + yU) / 2 + // => m . ( xL + xU ) / 2 + c + int256 dlY = fn.y2.toInt256() - fn.y1.toInt256(); + int256 dlX = fn.x2.toInt256() - fn.x1.toInt256(); + int256 c = fn.y2.toInt256() - ((fn.x2.toInt256() * dlY) / dlX); + return ((((xL + xU).toInt256() * dlY) / (2 * dlX)) + c); + } + + /// @notice Computes a piecewise average value (yVal) over the domain xRange, + /// based on three linear segments (fn1, fn2, fn3) that switch at xBreakPt. + /// @dev The function splits the input range into up to three segments, then + /// calculates a weighted average in each segment using the corresponding + /// piecewise function. + /// @dev AI-GENERATED + /// @param fn1 Piecewise linear function used when x is below xBreakPt.lower. + /// @param fn2 Piecewise linear function used when x is between xBreakPt.lower and xBreakPt.upper. + /// @param fn3 Piecewise linear function used when x is above xBreakPt.upper. + /// @param xBreakPt Range denoting the lower and upper x thresholds. + /// @param xRange The actual x-range over which we want to compute an averaged value. + /// @return yVal The computed piecewise average. + function computePiecewiseAvgY( + Line memory fn1, + Line memory fn2, + Line memory fn3, + Range memory xBreakPt, + Range memory xRange + ) internal pure returns (int256) { + int256 xl = xRange.lower.toInt256(); + int256 xu = xRange.upper.toInt256(); + int256 bpl = xBreakPt.lower.toInt256(); + int256 bpu = xBreakPt.upper.toInt256(); + + // Validate range inputs (custom errors omitted here). + if (xl > xu) revert InvalidRange(); + if (xl <= bpl && xu > bpu) revert UnexpectedRangeDelta(); + + // --------------------------- + // CASE A: Entire xRange below xBreakPt.lower → use fn1 + if (xu <= bpl) { + return avgY(fn1, xRange.lower, xRange.upper); + } + + // CASE B: xRange straddles bpl but still <= bpu + // Blend fn1 and fn2 + if (xl <= bpl && xu <= bpu) { + // w1 = portion in fn1, w2 = portion in fn2 + int256 w1 = bpl - xl; + int256 w2 = xu - bpl; + // Weighted average across two sub-ranges + return + (avgY(fn1, xRange.lower, xBreakPt.lower) * + w1 + + avgY(fn2, xBreakPt.lower, xRange.upper) * + w2) / (w1 + w2); + } + + // CASE C: Fully within [bpl, bpu] → use fn2 + if (xl > bpl && xu <= bpu) { + return avgY(fn2, xRange.lower, xRange.upper); + } + + // CASE D: xRange straddles xBreakPt.upper → blend fn2 and fn3 + if (xl <= bpu && xu > bpu) { + int256 w1 = bpu - xl; + int256 w2 = xu - bpu; + return + (avgY(fn2, xRange.lower, xBreakPt.upper) * + w1 + + avgY(fn3, xBreakPt.upper, xRange.upper) * + w2) / (w1 + w2); + } + + // CASE E: Entire xRange above xBreakPt.upper → use fn3 + // (if none of the above conditions matched, we must be here) + return avgY(fn3, xRange.lower, xRange.upper); + } +} diff --git a/spot-vaults/contracts/_utils/MathHelpers.sol b/spot-vaults/contracts/_utils/MathHelpers.sol new file mode 100644 index 00000000..4b7d3665 --- /dev/null +++ b/spot-vaults/contracts/_utils/MathHelpers.sol @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +pragma solidity ^0.8.24; + +import { Math } from "@openzeppelin/contracts/utils/math/Math.sol"; +import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol"; + +/** + * @title MathHelpers + * + * @notice Library with helper functions for math operations. + * + */ +library MathHelpers { + using Math for uint256; + using SafeCast for int256; + + /// @dev Clips a given integer number between provided min and max unsigned integer. + function clip(int256 n, uint256 min, uint256 max) internal pure returns (uint256) { + return clip(n > 0 ? n.toUint256() : 0, min, max); + } + + /// @dev Clips a given unsigned integer between provided min and max unsigned integer. + function clip(uint256 n, uint256 min, uint256 max) internal pure returns (uint256) { + return Math.min(Math.max(n, min), max); + } +} diff --git a/spot-vaults/contracts/_utils/UniswapV3PoolHelpers.sol b/spot-vaults/contracts/_utils/UniswapV3PoolHelpers.sol new file mode 100644 index 00000000..8c44d3cd --- /dev/null +++ b/spot-vaults/contracts/_utils/UniswapV3PoolHelpers.sol @@ -0,0 +1,48 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +// solhint-disable-next-line compiler-version +pragma solidity ^0.7.6; + +import { FullMath } from "@uniswap/v3-core/contracts/libraries/FullMath.sol"; +import { TickMath } from "@uniswap/v3-core/contracts/libraries/TickMath.sol"; +import { IUniswapV3Pool } from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol"; + +/** + * @title UniswapV3PoolHelpers + * + * @notice Library with helper functions for a UniswapV3Pool. + * + */ +library UniswapV3PoolHelpers { + /// @notice Calculates the Time-Weighted Average Price (TWAP) given the TWAP tick and unit token amounts. + /// @param twapTick The Time-Weighted Average Price tick. + /// @param token0UnitAmt The fixed-point amount of token0 equivalent to 1.0. + /// @param token1UnitAmt The fixed-point amount of token1 equivalent to 1.0. + /// @param one 1.0 represented in the same fixed point denomination as calculated TWAP. + /// @return The computed TWAP price. + function calculateTwap( + int24 twapTick, + uint256 token0UnitAmt, + uint256 token1UnitAmt, + uint256 one + ) internal pure returns (uint256) { + uint160 sqrtPriceX96 = TickMath.getSqrtRatioAtTick(twapTick); + uint256 ratioX192 = uint256(sqrtPriceX96) * sqrtPriceX96; + uint256 twapPrice = FullMath.mulDiv(one, (1 << 192), ratioX192); + return FullMath.mulDiv(twapPrice, token1UnitAmt, token0UnitAmt); + } + + /// @notice Retrieves the Time-Weighted Average Price (TWAP) tick from a Uniswap V3 pool over a given duration. + /// @param pool The Uniswap V3 pool. + /// @param twapDuration The TWAP duration. + /// @return The TWAP tick. + function getTwapTick( + IUniswapV3Pool pool, + uint32 twapDuration + ) internal view returns (int24) { + uint32[] memory secondsAgo = new uint32[](2); + secondsAgo[0] = twapDuration; + secondsAgo[1] = 0; + (int56[] memory tickCumulatives, ) = pool.observe(secondsAgo); + return int24((tickCumulatives[1] - tickCumulatives[0]) / twapDuration); + } +} diff --git a/spot-vaults/contracts/charm/UsdcSpotManager.sol b/spot-vaults/contracts/charm/UsdcSpotManager.sol new file mode 100644 index 00000000..17056faf --- /dev/null +++ b/spot-vaults/contracts/charm/UsdcSpotManager.sol @@ -0,0 +1,243 @@ +// SPDX-License-Identifier: BUSL-1.1 +pragma solidity ^0.8.24; + +import { Math } from "@openzeppelin/contracts/utils/math/Math.sol"; +import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol"; +import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; +import { AlphaVaultHelpers } from "../_utils/AlphaVaultHelpers.sol"; +import { Range } from "../_interfaces/types/CommonTypes.sol"; + +import { IMetaOracle } from "../_interfaces/IMetaOracle.sol"; +import { IAlphaProVault } from "../_interfaces/external/IAlphaProVault.sol"; +import { IUniswapV3Pool } from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol"; + +/// @title UsdcSpotManager +/// @notice This contract is a programmatic manager for the USDC-SPOT Charm AlphaProVault. +/// +/// @dev The vault's active zone is defined as lower and upper percentages of FMV. +/// For example, if the active zone is [0.95, 1.05]x and SPOT's FMV price is $1.35. +/// When the market price of SPOT is between [$1.28, $1.41] we consider price to be in the active zone. +/// +/// When in the active zone, the vault provides concentrated liquidity around the market price. +/// When price is outside the active zone, the vault reverts to a full range position. +/// +/// +contract UsdcSpotManager is Ownable { + //------------------------------------------------------------------------- + // Libraries + using AlphaVaultHelpers for IAlphaProVault; + using Math for uint256; + + //------------------------------------------------------------------------- + // Constants & Immutables + + /// @dev Decimals. + uint256 public constant DECIMALS = 18; + uint256 public constant ONE = (10 ** DECIMALS); + + /// @dev Vault parameter to set max full range weight (100%). + uint24 public constant VAULT_MAX_FRW = (10 ** 6); + int24 public constant POOL_MAX_TICK = 48000; // (-99.2/+12048.1%) + + /// @notice The USDC-SPOT charm alpha vault. + IAlphaProVault public immutable VAULT; + + /// @notice The underlying USDC-SPOT univ3 pool. + IUniswapV3Pool public immutable POOL; + + //------------------------------------------------------------------------- + // Storage + + /// @notice The meta oracle which returns prices of AMPL asset family. + IMetaOracle public oracle; + + /// @notice The lower and upper deviation factor within which + /// SPOT's price is considered to be in the active zone. + Range public activeZoneDeviation; + + /// @notice The width of concentrated liquidity band, + /// SPOT's price is in the active zone. + uint256 public concBandDeviationWidth; + + /// @notice The maximum USDC balance of the vault's full range position. + uint256 public fullRangeMaxUsdcBal; + + /// @notice The maximum percentage of vault's balanced assets in the full range position. + uint256 public fullRangeMaxPerc; + + /// @notice If price was within the active zone at the time of the last successful rebalance operation. + bool public prevWithinActiveZone; + + //----------------------------------------------------------------------------- + // Constructor and Initializer + + /// @notice Constructor initializes the contract with provided addresses. + /// @param vault_ Address of the AlphaProVault contract. + /// @param oracle_ Address of the MetaOracle contract. + constructor(IAlphaProVault vault_, IMetaOracle oracle_) Ownable() { + VAULT = vault_; + POOL = vault_.pool(); + + updateOracle(oracle_); + + prevWithinActiveZone = false; + activeZoneDeviation = Range({ + lower: ((ONE * 95) / 100), // 0.95 or 95% + upper: ((ONE * 105) / 100) // 1.05 or 105% + }); + concBandDeviationWidth = (ONE / 20); // 0.05 or 5% + fullRangeMaxUsdcBal = 250000 * (10 ** 6); // 250k USDC + fullRangeMaxPerc = (ONE / 2); // 0.5 or 50% + } + + //-------------------------------------------------------------------------- + // Owner only methods + + /// @notice Updates the MetaOracle. + function updateOracle(IMetaOracle oracle_) public onlyOwner { + // solhint-disable-next-line custom-errors + require(DECIMALS == oracle_.decimals(), "UnexpectedDecimals"); + oracle = oracle_; + } + + /// @notice Forwards the given calldata to the vault. + /// @param callData The calldata to pass to the vault. + /// @return The data returned by the vault method call. + function execOnVault( + bytes calldata callData + ) external onlyOwner returns (bytes memory) { + // solhint-disable-next-line avoid-low-level-calls + (bool success, bytes memory r) = address(VAULT).call(callData); + // solhint-disable-next-line custom-errors + require(success, "VaultExecutionFailed"); + return r; + } + + /// @notice Updates the active zone definition. + function updateActiveZone(Range memory activeZoneDeviation_) external onlyOwner { + activeZoneDeviation = activeZoneDeviation_; + } + + /// @notice Updates the width of the concentrated liquidity band. + function updateConcentratedBand(uint256 concBandDeviationWidth_) external onlyOwner { + concBandDeviationWidth = concBandDeviationWidth_; + } + + /// @notice Updates the absolute and percentage maximum amount of liquidity + /// in the full range liquidity band. + function updateFullRangeLiquidity( + uint256 fullRangeMaxUsdcBal_, + uint256 fullRangeMaxPerc_ + ) external onlyOwner { + // solhint-disable-next-line custom-errors + require(fullRangeMaxPerc_ <= ONE, "InvalidPerc"); + fullRangeMaxUsdcBal = fullRangeMaxUsdcBal_; + fullRangeMaxPerc = fullRangeMaxPerc_; + } + + //-------------------------------------------------------------------------- + // External write methods + + /// @notice Executes vault rebalance. + function rebalance() public { + (uint256 deviation, bool deviationValid) = oracle.spotPriceDeviation(); + bool withinActiveZone = (deviationValid && activeZone(deviation)); + bool shouldForceRebalance = (withinActiveZone != prevWithinActiveZone); + + // Set liquidity parameters. + withinActiveZone ? _setupActiveZoneLiq(deviation) : _resetLiq(); + + // Execute rebalance. + // NOTE: the vault.rebalance() will revert if enough time has not elapsed. + // We thus override with a force rebalance. + // https://learn.charm.fi/charm/technical-references/core/alphaprovault#rebalance + shouldForceRebalance ? VAULT.forceRebalance() : VAULT.rebalance(); + + // Trim positions after rebalance. + if (!withinActiveZone) { + VAULT.trimLiquidity(POOL, ONE - activeFullRangePerc(), ONE); + VAULT.removeLimitLiquidity(POOL); + } + + // Update valid rebalance state. + if (deviationValid) { + prevWithinActiveZone = withinActiveZone; + } + } + + //----------------------------------------------------------------------------- + // External/Public read methods + + /// @notice Based on the given deviation factor, + /// calculates if the pool needs to be in the active zone. + function activeZone(uint256 deviation) public view returns (bool) { + return (activeZoneDeviation.lower <= deviation && + deviation <= activeZoneDeviation.upper); + } + + /// @notice Computes the percentage of liquidity to be deployed into the full range, + /// based on owner defined maximums. + function activeFullRangePerc() public view returns (uint256) { + (uint256 usdcBal, ) = VAULT.getTotalAmounts(); + return Math.min(ONE.mulDiv(fullRangeMaxUsdcBal, usdcBal), fullRangeMaxPerc); + } + + /// @notice Checks the vault is overweight SPOT and looking to sell the extra SPOT for USDC. + function isOverweightSpot() public view returns (bool) { + // NOTE: In the underlying univ3 pool and token0 is USDC and token1 is SPOT. + // Underweight Token0 implies that the limit range has less USDC and more SPOT. + return VAULT.isUnderweightToken0(); + } + + /// @notice Calculates the Univ3 tick equivalent of the given deviation factor. + function deviationToTicks(uint256 deviation) public pure returns (int24) { + // 2% ~ 200 ticks -> (POOL.tickSpacing()) + // NOTE: width can't be zero, we set the minimum possible to 200. + uint256 t = deviation.mulDiv(10000, ONE); + t -= (t % 200); + return (t >= 200 ? SafeCast.toInt24(SafeCast.toInt256(t)) : int24(200)); + } + + /// @return Number of decimals representing 1.0. + function decimals() external pure returns (uint8) { + return uint8(DECIMALS); + } + + //----------------------------------------------------------------------------- + // Private methods + + /// @dev Configures the vault to provide concentrated liquidity in the active zone. + function _setupActiveZoneLiq(uint256 deviation) private { + VAULT.setFullRangeWeight( + SafeCast.toUint24(uint256(VAULT_MAX_FRW).mulDiv(activeFullRangePerc(), ONE)) + ); + + // IMPORTANT: + // + // If price is exactly at the bounds of `activeZoneDeviation`, + // the concentrated liquidity will be *at most* + // `deviationToTicks(concBandDeviationWidth/2)` outside the bounds. + // + VAULT.setBaseThreshold(deviationToTicks(concBandDeviationWidth)); + VAULT.setLimitThreshold( + deviationToTicks( + isOverweightSpot() + ? Math.max( + activeZoneDeviation.upper - deviation, + concBandDeviationWidth / 2 + ) + : Math.max( + deviation - activeZoneDeviation.lower, + concBandDeviationWidth / 2 + ) + ) + ); + } + + /// @dev Resets the vault to provide full range liquidity. + function _resetLiq() private { + VAULT.setFullRangeWeight(VAULT_MAX_FRW); + VAULT.setBaseThreshold(POOL_MAX_TICK); + VAULT.setLimitThreshold(POOL_MAX_TICK); + } +} diff --git a/spot-vaults/contracts/charm/WethWamplManager.sol b/spot-vaults/contracts/charm/WethWamplManager.sol new file mode 100644 index 00000000..7988596f --- /dev/null +++ b/spot-vaults/contracts/charm/WethWamplManager.sol @@ -0,0 +1,238 @@ +// SPDX-License-Identifier: BUSL-1.1 +pragma solidity ^0.8.24; + +import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; +import { AlphaVaultHelpers } from "../_utils/AlphaVaultHelpers.sol"; +import { LineHelpers } from "../_utils/LineHelpers.sol"; +import { MathHelpers } from "../_utils/MathHelpers.sol"; +import { Line } from "../_interfaces/types/CommonTypes.sol"; + +import { IMetaOracle } from "../_interfaces/IMetaOracle.sol"; +import { IAlphaProVault } from "../_interfaces/external/IAlphaProVault.sol"; +import { IUniswapV3Pool } from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol"; + +/// @title WethWamplManager +/// @notice This contract is a programmatic manager for the WETH-WAMPL Charm AlphaProVault. +contract WethWamplManager is Ownable { + //------------------------------------------------------------------------- + // Libraries + using AlphaVaultHelpers for IAlphaProVault; + using LineHelpers for Line; + using MathHelpers for int256; + + //------------------------------------------------------------------------- + // Constants & Immutables + + /// @dev Decimals. + uint256 public constant DECIMALS = 18; + uint256 public constant ONE = (10 ** DECIMALS); + + /// @dev At all times active liquidity percentage is no lower than 20%. + uint256 public constant MIN_ACTIVE_LIQ_PERC = ONE / 5; // 20% + + /// @notice The WETH-WAMPL charm alpha vault. + IAlphaProVault public immutable VAULT; + + /// @notice The underlying WETH-WAMPL univ3 pool. + IUniswapV3Pool public immutable POOL; + + //------------------------------------------------------------------------- + // Storage + + /// @notice The meta oracle which returns prices of AMPL asset family. + IMetaOracle public oracle; + + //------------------------------------------------------------------------- + // Active percentage calculation parameters + // + // The deviation factor (or deviation) is defined as the ratio between + // AMPL's current market price and its target price. + // The deviation is 1.0, when AMPL is at the target. + // + // The active liquidity percentage (a value between 20% to 100%) + // is computed based on pair-wise linear function, defined by the contract owner. + // + // If the current deviation is below ONE, function f1 is used + // else function f2 is used. Both f1 and f2 are defined by the owner. + // They are lines, with 2 {x,y} coordinates. The x coordinates are deviation factors, + // and y coordinates are active liquidity percentages. + // + // Both deviation and active liquidity percentage and represented internally + // as a fixed-point number with {DECIMALS} places. + // + + /// @notice Active percentage calculation function for when deviation is below ONE. + Line public activeLiqPercFn1; + + /// @notice Active percentage calculation function for when deviation is above ONE. + Line public activeLiqPercFn2; + + /// @notice The delta between the current and last recorded active liquidity percentage values + /// outside which a rebalance is executed forcefully. + uint256 public tolerableActiveLiqPercDelta; + + /// @notice The recorded deviation factor at the time of the last successful rebalance operation. + uint256 public prevDeviation; + + //----------------------------------------------------------------------------- + // Constructor and Initializer + + /// @notice Constructor initializes the contract with provided addresses. + /// @param vault_ Address of the AlphaProVault contract. + /// @param oracle_ Address of the MetaOracle contract. + constructor(IAlphaProVault vault_, IMetaOracle oracle_) Ownable() { + VAULT = vault_; + POOL = vault_.pool(); + + updateOracle(oracle_); + + activeLiqPercFn1 = Line({ + x1: ONE / 2, // 0.5 + y1: ONE / 5, // 20% + x2: ONE, // 1.0 + y2: ONE // 100% + }); + activeLiqPercFn2 = Line({ + x1: ONE, // 1.0 + y1: ONE, // 100% + x2: ONE * 2, // 2.0 + y2: ONE / 5 // 20% + }); + + tolerableActiveLiqPercDelta = ONE / 10; // 10% + prevDeviation = 0; + } + + //-------------------------------------------------------------------------- + // Owner only methods + + /// @notice Updates the MetaOracle. + function updateOracle(IMetaOracle oracle_) public onlyOwner { + // solhint-disable-next-line custom-errors + require(DECIMALS == oracle_.decimals(), "UnexpectedDecimals"); + oracle = oracle_; + } + + /// @notice Updates the vault's liquidity range parameters. + function setLiquidityRanges( + int24 baseThreshold, + uint24 fullRangeWeight, + int24 limitThreshold + ) external onlyOwner { + // Update liquidity parameters on the vault. + VAULT.setBaseThreshold(baseThreshold); + VAULT.setFullRangeWeight(fullRangeWeight); + VAULT.setLimitThreshold(limitThreshold); + } + + /// @notice Forwards the given calldata to the vault. + /// @param callData The calldata to pass to the vault. + /// @return The data returned by the vault method call. + function execOnVault( + bytes calldata callData + ) external onlyOwner returns (bytes memory) { + // solhint-disable-next-line avoid-low-level-calls + (bool success, bytes memory r) = address(VAULT).call(callData); + // solhint-disable-next-line custom-errors + require(success, "VaultExecutionFailed"); + return r; + } + + /// @notice Updates the active liquidity percentage calculation parameters. + function setActivePercParams( + uint256 tolerableActiveLiqPercDelta_, + Line memory activeLiqPercFn1_, + Line memory activeLiqPercFn2_ + ) external onlyOwner { + tolerableActiveLiqPercDelta = tolerableActiveLiqPercDelta_; + activeLiqPercFn1 = activeLiqPercFn1_; + activeLiqPercFn2 = activeLiqPercFn2_; + } + + //-------------------------------------------------------------------------- + // External write methods + + /// @notice Executes vault rebalance. + function rebalance() public { + // Get the current deviation factor. + (uint256 deviation, bool deviationValid) = oracle.amplPriceDeviation(); + + // Calculate the active liquidity percentages. + uint256 activeLiqPerc = deviationValid + ? computeActiveLiqPerc(deviation) + : MIN_ACTIVE_LIQ_PERC; + uint256 prevActiveLiqPerc = computeActiveLiqPerc(prevDeviation); + uint256 activeLiqPercDelta = (activeLiqPerc > prevActiveLiqPerc) + ? activeLiqPerc - prevActiveLiqPerc + : prevActiveLiqPerc - activeLiqPerc; + + // Execute rebalance. + // NOTE: the vault.rebalance() will revert if enough time has not elapsed. + // We thus override with a force rebalance. + // https://learn.charm.fi/charm/technical-references/core/alphaprovault#rebalance + (deviationValid && + shouldForceRebalance(deviation, prevDeviation, activeLiqPercDelta)) + ? VAULT.forceRebalance() + : VAULT.rebalance(); + + // Trim positions after rebalance. + VAULT.trimLiquidity(POOL, ONE - activeLiqPerc, ONE); + if (!deviationValid || shouldRemoveLimitRange(deviation)) { + VAULT.removeLimitLiquidity(POOL); + } + + // Update valid rebalance state. + if (deviationValid) { + prevDeviation = deviation; + } + } + + //----------------------------------------------------------------------------- + // External Public view methods + + /// @notice Computes active liquidity percentage based on the provided deviation factor. + /// @return The computed active liquidity percentage. + function computeActiveLiqPerc(uint256 deviation) public view returns (uint256) { + Line memory fn = (deviation <= ONE) ? activeLiqPercFn1 : activeLiqPercFn2; + return fn.computeY(deviation).clip(MIN_ACTIVE_LIQ_PERC, ONE); + } + + /// @notice Checks if a rebalance has to be forced. + function shouldForceRebalance( + uint256 deviation, + uint256 prevDeviation_, + uint256 activeLiqPercDelta + ) public view returns (bool) { + // We have to rebalance out of turn + // - if the active liquidity perc has deviated significantly, or + // - if the deviation factor has crossed ONE (in either direction). + return + (activeLiqPercDelta > tolerableActiveLiqPercDelta) || + ((deviation <= ONE && prevDeviation_ > ONE) || + (deviation >= ONE && prevDeviation_ < ONE)); + } + + /// @notice Checks if limit range liquidity needs to be removed. + function shouldRemoveLimitRange(uint256 deviation) public view returns (bool) { + // We only activate the limit range liquidity, when + // the vault sells WAMPL and deviation is above ONE, or when + // the vault buys WAMPL and deviation is below ONE + bool extraWampl = isOverweightWampl(); + bool activeLimitRange = ((deviation >= ONE && extraWampl) || + (deviation <= ONE && !extraWampl)); + return (!activeLimitRange); + } + + /// @notice Checks the vault is overweight WAMPL, + /// and looking to sell the extra WAMPL for WETH. + function isOverweightWampl() public view returns (bool) { + // NOTE: In the underlying univ3 pool and token0 is WETH and token1 is WAMPL. + // Underweight Token0 implies that the limit range has less WETH and more WAMPL. + return VAULT.isUnderweightToken0(); + } + + /// @return Number of decimals representing 1.0. + function decimals() external pure returns (uint8) { + return uint8(DECIMALS); + } +} diff --git a/spot-vaults/hardhat.config.ts b/spot-vaults/hardhat.config.ts index a9ad1cfa..d697b3bd 100644 --- a/spot-vaults/hardhat.config.ts +++ b/spot-vaults/hardhat.config.ts @@ -10,6 +10,7 @@ import "hardhat-gas-reporter"; // Loads custom tasks import "./tasks/deploy"; +import "./tasks/upgrade"; import "./tasks/ops"; import "./tasks/info"; import "./tasks/tools"; diff --git a/spot-vaults/package.json b/spot-vaults/package.json index b2915325..12986136 100644 --- a/spot-vaults/package.json +++ b/spot-vaults/package.json @@ -62,7 +62,7 @@ "ethers": "^6.6.0", "ethers-v5": "npm:ethers@^5.7.0", "ganache-cli": "latest", - "hardhat": "^2.22.8", + "hardhat": "^2.22.18", "hardhat-gas-reporter": "latest", "lodash": "^4.17.21", "prettier": "^2.7.1", diff --git a/spot-vaults/tasks/deploy.ts b/spot-vaults/tasks/deploy.ts index 1c609061..07ae73d6 100644 --- a/spot-vaults/tasks/deploy.ts +++ b/spot-vaults/tasks/deploy.ts @@ -17,52 +17,44 @@ task("deploy:mocks").setAction(async function (args: TaskArguments, hre) { await cpiOracle.mockData("1200000000000000000", true); }); -task("deploy:SpotAppraiser") - .addParam("perp", "the address of the perp token", undefined, types.string, false) - .addParam("usdOracle", "the address of the usd oracle", undefined, types.string, false) - .addParam("cpiOracle", "the address of the usd oracle", undefined, types.string, false) - .addParam("verify", "flag to set false for local deployments", true, types.boolean) - .setAction(async function (args: TaskArguments, hre) { - const deployer = (await hre.ethers.getSigners())[0]; - console.log("Signer", await deployer.getAddress()); - - const { perp, usdOracle, cpiOracle } = args; - - const SpotAppraiser = await hre.ethers.getContractFactory("SpotAppraiser"); - const spotAppraiser = await SpotAppraiser.deploy(perp, usdOracle, cpiOracle); - console.log("spotAppraiser", spotAppraiser.target); - - if (args.verify) { - await sleep(30); - await hre.run("verify:contract", { - address: spotAppraiser.target, - constructorArguments: [perp, usdOracle, cpiOracle], - }); - } else { - console.log("Skipping verification"); - } - }); - -task("deploy:SpotCDRPricer") - .addParam("perp", "the address of the perp token", undefined, types.string, false) +task("deploy:SpotPricer") + .addParam( + "wethWamplPool", + "the address of the weth-wampl univ3 pool", + undefined, + types.string, + false, + ) + .addParam( + "usdcSpotPool", + "the address of the usdc-spot univ3 pool", + undefined, + types.string, + false, + ) + .addParam("ethOracle", "the address of the eth oracle", undefined, types.string, false) .addParam("usdOracle", "the address of the usd oracle", undefined, types.string, false) - .addParam("cpiOracle", "the address of the usd oracle", undefined, types.string, false) .addParam("verify", "flag to set false for local deployments", true, types.boolean) .setAction(async function (args: TaskArguments, hre) { const deployer = (await hre.ethers.getSigners())[0]; console.log("Signer", await deployer.getAddress()); - const { perp, usdOracle, cpiOracle } = args; + const { wethWamplPool, usdcSpotPool, ethOracle, usdOracle } = args; - const SpotCDRPricer = await hre.ethers.getContractFactory("SpotCDRPricer"); - const spotCDRPricer = await SpotCDRPricer.deploy(perp, usdOracle, cpiOracle); - console.log("spotCDRPricer", spotCDRPricer.target); + const SpotPricer = await hre.ethers.getContractFactory("SpotPricer"); + const spotPricer = await SpotPricer.deploy( + wethWamplPool, + usdcSpotPool, + ethOracle, + usdOracle, + ); + console.log("spotPricer", spotPricer.target); if (args.verify) { await sleep(30); await hre.run("verify:contract", { - address: spotCDRPricer.target, - constructorArguments: [perp, usdOracle, cpiOracle], + address: spotPricer.target, + constructorArguments: [wethWamplPool, usdcSpotPool, ethOracle, usdOracle], }); } else { console.log("Skipping verification"); @@ -86,23 +78,17 @@ task("deploy:BillBroker") ) .addParam("usd", "the address of the usd token", undefined, types.string, false) .addParam("perp", "the address of the perp token", undefined, types.string, false) - .addParam( - "pricingStrategy", - "the address of the pricing strategy", - undefined, - types.string, - false, - ) + .addParam("oracle", "the address of the oracle", undefined, types.string, false) .addParam("verify", "flag to set false for local deployments", true, types.boolean) .setAction(async function (args: TaskArguments, hre) { const deployer = (await hre.ethers.getSigners())[0]; console.log("Signer", await deployer.getAddress()); - const { name, symbol, usd, perp, pricingStrategy } = args; + const { name, symbol, usd, perp, oracle } = args; const BillBroker = await hre.ethers.getContractFactory("BillBroker"); const billBroker = await hre.upgrades.deployProxy( BillBroker.connect(deployer), - [name, symbol, usd, perp, pricingStrategy], + [name, symbol, usd, perp, oracle], { initializer: "init(string,string,address,address,address)", }, @@ -119,69 +105,32 @@ task("deploy:BillBroker") } }); -task("deploy:WethWamplManager") - .addParam( - "vault", - "the address of the weth-wampl charm vault", - undefined, - types.string, - false, - ) - .addParam("cpiOracle", "the address of the usd oracle", undefined, types.string, false) - .addParam("ethOracle", "the address of the eth oracle", undefined, types.string, false) - .addParam("verify", "flag to set false for local deployments", true, types.boolean) - .setAction(async function (args: TaskArguments, hre) { - const deployer = (await hre.ethers.getSigners())[0]; - console.log("Signer", await deployer.getAddress()); - - const { vault, cpiOracle, ethOracle } = args; - - const WethWamplManager = await hre.ethers.getContractFactory("WethWamplManager"); - const manager = await WethWamplManager.deploy(vault, cpiOracle, ethOracle); - console.log("wethWamplManager", manager.target); - - if (args.verify) { - await sleep(30); - await hre.run("verify:contract", { - address: manager.target, - constructorArguments: [vault, cpiOracle, ethOracle], - }); - } else { - console.log("Skipping verification"); - } - }); - -task("deploy:UsdcSpotManager") - .addParam( - "vault", - "the address of the usdc-spot charm vault", - undefined, - types.string, - false, - ) +task("deploy:CharmManager") .addParam( - "spotAppraiser", - "the address of the spot appraiser", + "manager", + "the contract reference of the manager to be deployed", undefined, types.string, false, ) + .addParam("vault", "the address of the charm vault", undefined, types.string, false) + .addParam("oracle", "the address of the meta oracle", undefined, types.string, false) .addParam("verify", "flag to set false for local deployments", true, types.boolean) .setAction(async function (args: TaskArguments, hre) { const deployer = (await hre.ethers.getSigners())[0]; console.log("Signer", await deployer.getAddress()); - const { vault, spotAppraiser } = args; + const { manager, vault, oracle } = args; - const UsdcSpotManager = await hre.ethers.getContractFactory("UsdcSpotManager"); - const manager = await UsdcSpotManager.deploy(vault, spotAppraiser); - console.log("usdcSpotManager", manager.target); + const Factory = await hre.ethers.getContractFactory(manager); + const mgr = await Factory.deploy(vault, oracle); + console.log(manager, mgr.target); if (args.verify) { await sleep(30); await hre.run("verify:contract", { - address: manager.target, - constructorArguments: [vault, spotAppraiser], + address: mgr.target, + constructorArguments: [vault, oracle], }); } else { console.log("Skipping verification"); diff --git a/spot-vaults/tasks/info.ts b/spot-vaults/tasks/info.ts index 326c6e76..9cb18ac4 100644 --- a/spot-vaults/tasks/info.ts +++ b/spot-vaults/tasks/info.ts @@ -7,6 +7,68 @@ function pp(val, decimals) { return parseFloat(ethers.formatUnits(val, decimals)); } +task("info:MetaOracle") + .addPositionalParam( + "address", + "the address of the meta oracle contract", + undefined, + types.string, + false, + ) + .setAction(async function (args: TaskArguments, hre) { + const { address } = args; + + const oracle = await hre.ethers.getContractAt("IMetaOracle", address); + const oracleDecimals = await oracle.decimals(); + console.log("---------------------------------------------------------------"); + console.log("MetaOracle:", oracle.target); + + console.log("---------------------------------------------------------------"); + const usdcPriceData = await oracle.usdcPrice.staticCall(); + console.log("usdcPrice:", pp(usdcPriceData[0], oracleDecimals)); + + const ethPriceData = await oracle.ethUsdPrice.staticCall(); + console.log("ethPrice:", pp(ethPriceData[0], oracleDecimals)); + + const wamplPriceData = await oracle.wamplUsdPrice.staticCall(); + console.log("wamplPrice:", pp(wamplPriceData[0], oracleDecimals)); + + console.log("---------------------------------------------------------------"); + + const amplPriceData = await oracle.amplUsdPrice.staticCall(); + console.log("amplPrice:", pp(amplPriceData[0], oracleDecimals)); + + const amplTargetPriceData = await oracle.amplTargetUsdPrice.staticCall(); + console.log("amplTargetPrice:", pp(amplTargetPriceData[0], oracleDecimals)); + + const amplDeviationData = await oracle.amplPriceDeviation.staticCall(); + console.log("amplDeviation:", pp(amplDeviationData[0], oracleDecimals)); + + console.log("---------------------------------------------------------------"); + + const spotPriceData = await oracle.spotUsdPrice.staticCall(); + console.log("spotPrice:", pp(spotPriceData[0], oracleDecimals)); + + const spotFmvPriceData = await oracle.spotFmvUsdPrice.staticCall(); + console.log("spotFmvPrice:", pp(spotFmvPriceData[0], oracleDecimals)); + + const spotDeviationData = await oracle.spotPriceDeviation.staticCall(); + console.log("spotDeviation:", pp(spotDeviationData[0], oracleDecimals)); + + console.log("---------------------------------------------------------------"); + + const spotDeviation = pp(spotDeviationData[0], oracleDecimals); + const amplDeviation = pp(amplDeviationData[0], oracleDecimals); + const relativeDeviation = spotDeviation / amplDeviation; + + console.log("relativeDeviation:", relativeDeviation); + console.log("noArbZone:", relativeDeviation > 0.9 && relativeDeviation < 1.025); + console.log("flashMintZone:", relativeDeviation >= 1.025); + console.log("flashRedeemZone:", relativeDeviation <= 0.9); + + console.log("---------------------------------------------------------------"); + }); + task("info:BillBroker") .addPositionalParam( "address", @@ -31,21 +93,20 @@ task("info:BillBroker") const unitUsd = await billBroker.usdUnitAmt(); const unitPerp = await billBroker.perpUnitAmt(); - const pricingStrategy = await hre.ethers.getContractAt( - "SpotAppraiser", - await billBroker.pricingStrategy.staticCall(), + const oracle = await hre.ethers.getContractAt( + "SpotPricer", + // await billBroker.oracle.staticCall(), + "0x0f8f519878c10ce36C6aAF89c1AeefaaDE5D7881", ); - const pricingStrategyDecimals = await pricingStrategy.decimals(); + const oracleDecimals = await oracle.decimals(); console.log("---------------------------------------------------------------"); - console.log("pricingStrategy:", pricingStrategy.target); - console.log("owner:", await pricingStrategy.owner()); - const usdPriceCall = await pricingStrategy.usdPrice.staticCall(); - console.log("usdPrice:", pp(usdPriceCall[0], pricingStrategyDecimals)); + console.log("oracle:", oracle.target); + const usdPriceCall = await oracle.usdPrice.staticCall(); + console.log("usdPrice:", pp(usdPriceCall[0], oracleDecimals)); console.log("usdPriceValid:", usdPriceCall[1]); - const perpPriceCall = await pricingStrategy.perpPrice.staticCall(); - console.log("perpPrice:", pp(perpPriceCall[0], pricingStrategyDecimals)); + const perpPriceCall = await oracle.perpUsdPrice.staticCall(); + console.log("perpPrice:", pp(perpPriceCall[0], oracleDecimals)); console.log("perpPriceValid:", perpPriceCall[1]); - console.log("isSpotHealthy:", await pricingStrategy.isSPOTHealthy.staticCall()); console.log("---------------------------------------------------------------"); console.log("BillBroker:", billBroker.target); console.log("owner:", await billBroker.owner()); @@ -143,24 +204,15 @@ task("info:WethWamplManager") const { address } = args; const manager = await hre.ethers.getContractAt("WethWamplManager", address); + const oracle = await hre.ethers.getContractAt("IMetaOracle", await manager.oracle()); const managerDecimals = await manager.decimals(); console.log("---------------------------------------------------------------"); console.log("WethWamplManager:", manager.target); console.log("owner:", await manager.owner()); - console.log("cpiOracle:", await manager.cpiOracle()); - console.log("ethOracle:", await manager.ethOracle()); + console.log("oracle:", oracle.target); console.log("---------------------------------------------------------------"); - const ethPriceData = await manager.getEthUSDPrice(); - console.log("ethPrice:", pp(ethPriceData[0], managerDecimals)); - - const wamplPrice = await manager.getWamplUSDPrice(ethPriceData[0]); - console.log("wamplPrice:", pp(wamplPrice, managerDecimals)); - - const amplPrice = await manager.getAmplUSDPrice(ethPriceData[0]); - console.log("amplPrice:", pp(amplPrice, managerDecimals)); - - const r = await manager.computeDeviationFactor.staticCall(); + const r = await oracle.amplPriceDeviation.staticCall(); const deviation = r[0]; console.log("dataValid:", r[1]); console.log("isOverweightWampl:", await manager.isOverweightWampl()); @@ -193,22 +245,25 @@ task("info:UsdcSpotManager") const { address } = args; const manager = await hre.ethers.getContractAt("UsdcSpotManager", address); + const oracle = await hre.ethers.getContractAt("IMetaOracle", await manager.oracle()); const managerDecimals = await manager.decimals(); console.log("---------------------------------------------------------------"); console.log("UsdcSpotManager:", manager.target); console.log("owner:", await manager.owner()); + console.log("oracle:", oracle.target); console.log("---------------------------------------------------------------"); - const spotPrice = await manager.getSpotUSDPrice(); - console.log("spotPrice:", pp(spotPrice, managerDecimals)); - - const r = await manager.computeDeviationFactor.staticCall(); + const r = await oracle.spotPriceDeviation.staticCall(); const deviation = r[0]; console.log("dataValid:", r[1]); console.log("isOverweightSpot:", await manager.isOverweightSpot()); - console.log("prevDeviation:", pp(await manager.prevDeviation(), managerDecimals)); + console.log("prevWithinActiveZone:", await manager.prevWithinActiveZone()); + console.log("withinActiveZone:", await manager.activeZone(deviation)); console.log("deviation:", pp(deviation, managerDecimals)); - + console.log( + "fullRangePerc:", + pp(await manager.activeFullRangePerc(), managerDecimals), + ); let rebalanceActive = true; try { await manager.rebalance.staticCall(); diff --git a/spot-vaults/tasks/scripts/mainnet.sh b/spot-vaults/tasks/scripts/mainnet.sh index bc4b46b0..9b0eb47f 100644 --- a/spot-vaults/tasks/scripts/mainnet.sh +++ b/spot-vaults/tasks/scripts/mainnet.sh @@ -1,40 +1,45 @@ ######################################################################## ## DEPLOYMENT -yarn hardhat --network mainnet deploy:SpotAppraiser \ - --perp "0xC1f33e0cf7e40a67375007104B929E49a581bafE" \ - --usd-oracle "0x8fFfFfd4AfB6115b954Bd326cbe7B4BA576818f6" \ - --cpi-oracle "0x2A18bfb505b49AED12F19F271cC1183F98ff4f71" +yarn hardhat --network mainnet deploy:SpotPricer \ + --weth-wampl-pool "0x0c2b6bf7322a3cceb47c7ba74f2c75a19f530f11" \ + --usdc-spot-pool "0x898adc9aa0c23dce3fed6456c34dbe2b57784325" \ + --eth-oracle "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419" \ + --usd-oracle "0x8fFfFfd4AfB6115b954Bd326cbe7B4BA576818f6" yarn hardhat --network mainnet deploy:BillBroker \ --name "Bill Broker USDC-SPOT LP" \ --symbol "BB-USDC-SPOT" \ --usd "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" \ --perp "0xC1f33e0cf7e40a67375007104B929E49a581bafE" \ - --pricing-strategy "0x965FBFebDA76d9AA11642C1d0074CdF02e546F3c" + --oracle "0x0f8f519878c10ce36C6aAF89c1AeefaaDE5D7881" -yarn hardhat --network mainnet transferOwnership "0x965FBFebDA76d9AA11642C1d0074CdF02e546F3c" \ - --new-owner-address "0x57981B1EaFe4b18EC97f8B10859B40207b364662" +yarn hardhat --network mainnet deploy:CharmManager \ + --manager "WethWamplManager" \ + --vault "0x9658B5bdCad59Dd0b7b936d955E5dF81eA2B4DcB" \ + --oracle "0x0f8f519878c10ce36C6aAF89c1AeefaaDE5D7881" + +yarn hardhat --network mainnet deploy:CharmManager \ + --manager "UsdcSpotManager" \ + --vault "0x2dcaff0f75765d7867887fc402b71c841b3a4bfb" \ + --oracle "0x0f8f519878c10ce36C6aAF89c1AeefaaDE5D7881" yarn hardhat --network mainnet transferOwnership "0xA088Aef966CAD7fE0B38e28c2E07590127Ab4ccB" \ --new-owner-address "0x57981B1EaFe4b18EC97f8B10859B40207b364662" -yarn hardhat --network mainnet transferOwnership "0xF6E42F7a83fCfB1Bd28aC209fD4a849f54bD1044" \ +yarn hardhat --network mainnet transferOwnership "0x574fca658b4B59E965C0e5f74761AE0Ac41DA6a7" \ --new-owner-address "0x57981B1EaFe4b18EC97f8B10859B40207b364662" -yarn hardhat --network mainnet deploy:WethWamplManager \ - --vault "0x9658B5bdCad59Dd0b7b936d955E5dF81eA2B4DcB" \ - --cpi-oracle "0x2A18bfb505b49AED12F19F271cC1183F98ff4f71" \ - --eth-oracle "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419" - -yarn hardhat --network mainnet transferOwnership "0x803094e6427c0bd10398236433F6c18B7aBf98ab" \ +yarn hardhat --network mainnet transferOwnership "0x2f67158859Fe0f69f5773570eC60444Fe0c1693c" \ --new-owner-address "0x57981B1EaFe4b18EC97f8B10859B40207b364662" ######################################################################## ## INFO +yarn hardhat --network mainnet info:MetaOracle "0x0f8f519878c10ce36C6aAF89c1AeefaaDE5D7881" yarn hardhat --network mainnet info:BillBroker "0xA088Aef966CAD7fE0B38e28c2E07590127Ab4ccB" -yarn hardhat --network mainnet info:WethWamplManager "0x803094e6427c0bd10398236433F6c18B7aBf98ab" +yarn hardhat --network mainnet info:WethWamplManager "0x574fca658b4B59E965C0e5f74761AE0Ac41DA6a7" +yarn hardhat --network mainnet info:UsdcSpotManager "0x2f67158859Fe0f69f5773570eC60444Fe0c1693c" ######################################################################## ## OPS @@ -54,4 +59,10 @@ yarn hardhat --network mainnet ops:swapPerpsForUSD \ yarn hardhat --network mainnet ops:redeem \ --address "0xA088Aef966CAD7fE0B38e28c2E07590127Ab4ccB" \ - --amount 1000 \ No newline at end of file + --amount 1000 + +######################################################################## +## Upgrade + +yarn hardhat --network mainnet validate_upgrade BillBroker "0xA088Aef966CAD7fE0B38e28c2E07590127Ab4ccB" +yarn hardhat --network mainnet prepare_upgrade BillBroker "0xA088Aef966CAD7fE0B38e28c2E07590127Ab4ccB" \ No newline at end of file diff --git a/spot-vaults/tasks/upgrade.ts b/spot-vaults/tasks/upgrade.ts new file mode 100644 index 00000000..d47cdd94 --- /dev/null +++ b/spot-vaults/tasks/upgrade.ts @@ -0,0 +1,119 @@ +import { getAdminAddress, getImplementationAddress } from "@openzeppelin/upgrades-core"; +import { task, types } from "hardhat/config"; +import { TaskArguments } from "hardhat/types"; +import { sleep } from "./tools"; + +task("validate_upgrade") + .addPositionalParam( + "factory", + "the name of the factory", + undefined, + types.string, + false, + ) + .addPositionalParam( + "address", + "the address of the deployed proxy contract", + undefined, + types.string, + false, + ) + .setAction(async function (args: TaskArguments, hre) { + const { factory, address } = args; + const Factory = await hre.ethers.getContractFactory(factory); + console.log("Trying strict validation"); + try { + await hre.upgrades.validateUpgrade(address, Factory); + } catch (e) { + console.log("Strict validation failed. ", e); + console.log("Retrying but allowing variable renames."); + await hre.upgrades.validateUpgrade(address, Factory, { + unsafeAllowRenames: true, + }); + } + console.log("Success"); + }); + +task("prepare_upgrade") + .addPositionalParam( + "factory", + "the name of the factory", + undefined, + types.string, + false, + ) + .addPositionalParam( + "address", + "the address of the deployed proxy contract", + undefined, + types.string, + false, + ) + .addParam("fromIdx", "the index of sender", 0, types.int) + .setAction(async function (args: TaskArguments, hre) { + const { factory, address } = args; + + const signer = (await hre.ethers.getSigners())[args.fromIdx]; + const signerAddress = await signer.getAddress(); + console.log("Signer", signerAddress); + + console.log("Proxy Admin", await getAdminAddress(hre.ethers.provider, address)); + + const Factory = await hre.ethers.getContractFactory(factory); + const newImpl = await hre.upgrades.prepareUpgrade(address, Factory, { + unsafeAllowRenames: true, + }); + console.log("Deploying using", factory); + console.log("New implementation at:", newImpl); + + console.log("Update implementation by running the following:"); + console.log(`proxyAdmin.upgrade(${address}, ${newImpl})`); + + await sleep(15); + await hre.run("verify:contract", { + address: newImpl, + }); + }); + +task("upgrade:testnet") + .addPositionalParam( + "factory", + "the name of the factory", + undefined, + types.string, + false, + ) + .addPositionalParam( + "address", + "the address of the deployed proxy contract", + undefined, + types.string, + false, + ) + .addParam("fromIdx", "the index of sender", 0, types.int) + .setAction(async function (args: TaskArguments, hre) { + const signer = (await hre.ethers.getSigners())[args.fromIdx]; + const signerAddress = await signer.getAddress(); + console.log("Signer", signerAddress); + + const { factory, address } = args; + const Factory = await hre.ethers.getContractFactory(factory); + + console.log("Proxy", address); + console.log( + "Current implementation", + await getImplementationAddress(hre.ethers.provider, address), + ); + + const impl = await hre.upgrades.upgradeProxy(address, Factory, { + unsafeAllowRenames: true, + }); + await impl.deployed(); + const newImpl = await getImplementationAddress(hre.ethers.provider, address); + console.log("Updated implementation", newImpl); + + await sleep(15); + await hre.run("verify:contract", { + address: newImpl, + }); + }); diff --git a/spot-vaults/test/BillBroker.ts b/spot-vaults/test/BillBroker.ts index 230b794e..71c2afd0 100644 --- a/spot-vaults/test/BillBroker.ts +++ b/spot-vaults/test/BillBroker.ts @@ -1,7 +1,7 @@ import { ethers, upgrades } from "hardhat"; import { loadFixture } from "@nomicfoundation/hardhat-toolbox/network-helpers"; import { expect } from "chai"; -import { DMock, usdFP, perpFP, percentageFP, priceFP } from "./helpers"; +import { DMock, usdFP, perpFP, percFP, priceFP } from "./helpers"; describe("BillBroker", function () { async function setupContracts() { @@ -13,30 +13,28 @@ describe("BillBroker", function () { await usd.init("USD token", "usd", 6); const perp = await Token.deploy(); await perp.init("Perp token", "perp", 9); - const pricingStrategy = new DMock("SpotAppraiser"); - await pricingStrategy.deploy(); - await pricingStrategy.mockMethod("decimals()", [18]); - await pricingStrategy.mockMethod("perpPrice()", [0, false]); - await pricingStrategy.mockMethod("usdPrice()", [0, false]); + const oracle = new DMock("IPerpPricer"); + await oracle.deploy(); + await oracle.mockMethod("decimals()", [18]); + await oracle.mockMethod("perpFmvUsdPrice()", [0, false]); + await oracle.mockMethod("usdPrice()", [0, false]); const BillBroker = await ethers.getContractFactory("BillBroker"); const billBroker = await upgrades.deployProxy( BillBroker.connect(deployer), - ["BillBroker LP", "LP token", usd.target, perp.target, pricingStrategy.target], + ["BillBroker LP", "LP token", usd.target, perp.target, oracle.target], { initializer: "init(string,string,address,address,address)", }, ); - return { deployer, usd, perp, pricingStrategy, billBroker }; + return { deployer, usd, perp, oracle, billBroker }; } describe("init", function () { it("should set initial values", async function () { - const { deployer, billBroker, usd, pricingStrategy } = await loadFixture( - setupContracts, - ); + const { deployer, billBroker, usd, oracle } = await loadFixture(setupContracts); expect(await billBroker.usd()).to.eq(usd.target); - expect(await billBroker.pricingStrategy()).to.eq(pricingStrategy.target); + expect(await billBroker.oracle()).to.eq(oracle.target); expect(await billBroker.usdUnitAmt()).to.eq(usdFP("1")); expect(await billBroker.perpUnitAmt()).to.eq(perpFP("1")); @@ -44,20 +42,20 @@ describe("BillBroker", function () { expect(await billBroker.keeper()).to.eq(await deployer.getAddress()); const arHardBound = await billBroker.arHardBound(); - expect(arHardBound.upper).to.eq(ethers.MaxUint256); - expect(arHardBound.lower).to.eq(0n); + expect(arHardBound.upper).to.eq(ethers.MaxInt256); + expect(arHardBound.lower).to.eq(0); const arSoftBound = await billBroker.arSoftBound(); - expect(arSoftBound.upper).to.eq(ethers.MaxUint256); - expect(arSoftBound.lower).to.eq(0n); + expect(arSoftBound.upper).to.eq(ethers.MaxInt256); + expect(arSoftBound.lower).to.eq(0); const fees = await billBroker.fees(); expect(fees.mintFeePerc).to.eq(0); expect(fees.burnFeePerc).to.eq(0); - expect(fees.perpToUSDSwapFeePercs.lower).to.eq(percentageFP("1")); - expect(fees.perpToUSDSwapFeePercs.upper).to.eq(percentageFP("1")); - expect(fees.usdToPerpSwapFeePercs.lower).to.eq(percentageFP("1")); - expect(fees.usdToPerpSwapFeePercs.upper).to.eq(percentageFP("1")); + expect(fees.perpToUSDSwapFeeFactors.lower).to.eq(percFP("1")); + expect(fees.perpToUSDSwapFeeFactors.upper).to.eq(percFP("1")); + expect(fees.usdToPerpSwapFeeFactors.lower).to.eq(percFP("1")); + expect(fees.usdToPerpSwapFeeFactors.upper).to.eq(percFP("1")); expect(fees.protocolSwapSharePerc).to.eq(0); expect(await billBroker.usdBalance()).to.eq(0n); @@ -85,35 +83,35 @@ describe("BillBroker", function () { }); }); - describe("#updatePricingStrategy", function () { + describe("#updateOracle", function () { describe("when triggered by non-owner", function () { it("should revert", async function () { const { billBroker } = await loadFixture(setupContracts); await billBroker.renounceOwnership(); - await expect( - billBroker.updatePricingStrategy(ethers.ZeroAddress), - ).to.be.revertedWith("Ownable: caller is not the owner"); + await expect(billBroker.updateOracle(ethers.ZeroAddress)).to.be.revertedWith( + "Ownable: caller is not the owner", + ); }); }); - describe("when pricing strategy is not valid", function () { + describe("when oracle is not valid", function () { it("should revert", async function () { const { billBroker } = await loadFixture(setupContracts); - const pricingStrategy = new DMock("SpotAppraiser"); - await pricingStrategy.deploy(); - await pricingStrategy.mockMethod("decimals()", [17]); + const oracle = new DMock("SpotPricer"); + await oracle.deploy(); + await oracle.mockMethod("decimals()", [17]); await expect( - billBroker.updatePricingStrategy(pricingStrategy.target), + billBroker.updateOracle(oracle.target), ).to.be.revertedWithCustomError(billBroker, "UnexpectedDecimals"); }); it("should revert", async function () { const { billBroker } = await loadFixture(setupContracts); - const pricingStrategy = new DMock("SpotAppraiser"); - await pricingStrategy.deploy(); - await pricingStrategy.mockMethod("decimals()", [18]); + const oracle = new DMock("SpotPricer"); + await oracle.deploy(); + await oracle.mockMethod("decimals()", [18]); - await billBroker.updatePricingStrategy(pricingStrategy.target); - expect(await billBroker.pricingStrategy()).to.eq(pricingStrategy.target); + await billBroker.updateOracle(oracle.target); + expect(await billBroker.oracle()).to.eq(oracle.target); }); }); }); @@ -122,17 +120,17 @@ describe("BillBroker", function () { let fees: any; beforeEach(async function () { fees = { - mintFeePerc: percentageFP("0.005"), - burnFeePerc: percentageFP("0.025"), - perpToUSDSwapFeePercs: { - lower: percentageFP("0.01"), - upper: percentageFP("0.1"), + mintFeePerc: percFP("0.005"), + burnFeePerc: percFP("0.025"), + perpToUSDSwapFeeFactors: { + lower: percFP("1.01"), + upper: percFP("1.1"), }, - usdToPerpSwapFeePercs: { - lower: percentageFP("0.02"), - upper: percentageFP("0.2"), + usdToPerpSwapFeeFactors: { + lower: percFP("1.02"), + upper: percFP("1.2"), }, - protocolSwapSharePerc: percentageFP("0.05"), + protocolSwapSharePerc: percFP("0.05"), }; }); @@ -149,7 +147,7 @@ describe("BillBroker", function () { describe("when parameters are invalid", function () { it("should revert", async function () { const { billBroker } = await loadFixture(setupContracts); - fees.mintFeePerc = percentageFP("1.01"); + fees.mintFeePerc = percFP("1.01"); await expect(billBroker.updateFees(fees)).to.be.revertedWithCustomError( billBroker, "InvalidPerc", @@ -160,7 +158,7 @@ describe("BillBroker", function () { describe("when parameters are invalid", function () { it("should revert", async function () { const { billBroker } = await loadFixture(setupContracts); - fees.burnFeePerc = percentageFP("1.01"); + fees.burnFeePerc = percFP("1.01"); await expect(billBroker.updateFees(fees)).to.be.revertedWithCustomError( billBroker, "InvalidPerc", @@ -168,8 +166,8 @@ describe("BillBroker", function () { }); it("should revert", async function () { const { billBroker } = await loadFixture(setupContracts); - fees.perpToUSDSwapFeePercs.lower = percentageFP("0.2"); - fees.perpToUSDSwapFeePercs.upper = percentageFP("0.1"); + fees.perpToUSDSwapFeeFactors.lower = percFP("0.2"); + fees.perpToUSDSwapFeeFactors.upper = percFP("0.1"); await expect(billBroker.updateFees(fees)).to.be.revertedWithCustomError( billBroker, "InvalidPerc", @@ -177,8 +175,8 @@ describe("BillBroker", function () { }); it("should revert", async function () { const { billBroker } = await loadFixture(setupContracts); - fees.usdToPerpSwapFeePercs.lower = percentageFP("0.2"); - fees.usdToPerpSwapFeePercs.upper = percentageFP("0.1"); + fees.usdToPerpSwapFeeFactors.lower = percFP("0.2"); + fees.usdToPerpSwapFeeFactors.upper = percFP("0.1"); await expect(billBroker.updateFees(fees)).to.be.revertedWithCustomError( billBroker, "InvalidPerc", @@ -186,7 +184,7 @@ describe("BillBroker", function () { }); it("should revert", async function () { const { billBroker } = await loadFixture(setupContracts); - fees.protocolSwapSharePerc = percentageFP("1.01"); + fees.protocolSwapSharePerc = percFP("1.01"); await expect(billBroker.updateFees(fees)).to.be.revertedWithCustomError( billBroker, "InvalidPerc", @@ -201,10 +199,10 @@ describe("BillBroker", function () { const f = await billBroker.fees(); expect(f.mintFeePerc).to.eq(fees.mintFeePerc); expect(f.burnFeePerc).to.eq(fees.burnFeePerc); - expect(f.perpToUSDSwapFeePercs.lower).to.eq(fees.perpToUSDSwapFeePercs.lower); - expect(f.perpToUSDSwapFeePercs.upper).to.eq(fees.perpToUSDSwapFeePercs.upper); - expect(f.usdToPerpSwapFeePercs.lower).to.eq(fees.usdToPerpSwapFeePercs.lower); - expect(f.usdToPerpSwapFeePercs.upper).to.eq(fees.usdToPerpSwapFeePercs.upper); + expect(f.perpToUSDSwapFeeFactors.lower).to.eq(fees.perpToUSDSwapFeeFactors.lower); + expect(f.perpToUSDSwapFeeFactors.upper).to.eq(fees.perpToUSDSwapFeeFactors.upper); + expect(f.usdToPerpSwapFeeFactors.lower).to.eq(fees.usdToPerpSwapFeeFactors.lower); + expect(f.usdToPerpSwapFeeFactors.upper).to.eq(fees.usdToPerpSwapFeeFactors.upper); expect(f.protocolSwapSharePerc).to.eq(fees.protocolSwapSharePerc); }); }); @@ -217,8 +215,8 @@ describe("BillBroker", function () { await billBroker.renounceOwnership(); await expect( billBroker.updateARBounds( - [percentageFP("0.9"), percentageFP("1.1")], - [percentageFP("0.8"), percentageFP("1.2")], + [percFP("0.9"), percFP("1.1")], + [percFP("0.8"), percFP("1.2")], ), ).to.be.revertedWith("Ownable: caller is not the owner"); }); @@ -229,8 +227,8 @@ describe("BillBroker", function () { const { billBroker } = await loadFixture(setupContracts); await expect( billBroker.updateARBounds( - [percentageFP("1.1"), percentageFP("1.0")], - [percentageFP("0.8"), percentageFP("1.2")], + [percFP("1.1"), percFP("1.0")], + [percFP("0.8"), percFP("1.2")], ), ).to.be.revertedWithCustomError(billBroker, "InvalidARBound"); }); @@ -239,8 +237,8 @@ describe("BillBroker", function () { const { billBroker } = await loadFixture(setupContracts); await expect( billBroker.updateARBounds( - [percentageFP("0.9"), percentageFP("1.1")], - [percentageFP("1.2"), percentageFP("0.8")], + [percFP("0.9"), percFP("1.1")], + [percFP("1.2"), percFP("0.8")], ), ).to.be.revertedWithCustomError(billBroker, "InvalidARBound"); }); @@ -249,8 +247,8 @@ describe("BillBroker", function () { const { billBroker } = await loadFixture(setupContracts); await expect( billBroker.updateARBounds( - [percentageFP("0.9"), percentageFP("0.8")], - [percentageFP("1.1"), percentageFP("1.2")], + [percFP("0.9"), percFP("0.8")], + [percFP("1.1"), percFP("1.2")], ), ).to.be.revertedWithCustomError(billBroker, "InvalidARBound"); }); @@ -259,8 +257,8 @@ describe("BillBroker", function () { const { billBroker } = await loadFixture(setupContracts); await expect( billBroker.updateARBounds( - [percentageFP("0.8"), percentageFP("1.2")], - [percentageFP("0.9"), percentageFP("1.1")], + [percFP("0.8"), percFP("1.2")], + [percFP("0.9"), percFP("1.1")], ), ).to.be.revertedWithCustomError(billBroker, "InvalidARBound"); }); @@ -270,16 +268,16 @@ describe("BillBroker", function () { it("should update bound", async function () { const { billBroker } = await loadFixture(setupContracts); await billBroker.updateARBounds( - [percentageFP("0.9"), percentageFP("1.1")], - [percentageFP("0.8"), percentageFP("1.2")], + [percFP("0.9"), percFP("1.1")], + [percFP("0.8"), percFP("1.2")], ); const b1 = await billBroker.arSoftBound(); - expect(b1.lower).to.eq(percentageFP("0.9")); - expect(b1.upper).to.eq(percentageFP("1.1")); + expect(b1.lower).to.eq(percFP("0.9")); + expect(b1.upper).to.eq(percFP("1.1")); const b2 = await billBroker.arHardBound(); - expect(b2.lower).to.eq(percentageFP("0.8")); - expect(b2.upper).to.eq(percentageFP("1.2")); + expect(b2.lower).to.eq(percFP("0.8")); + expect(b2.upper).to.eq(percFP("1.2")); }); }); }); @@ -346,8 +344,8 @@ describe("BillBroker", function () { describe("#usdPrice", function () { describe("when the price is invalid", function () { it("should revert", async function () { - const { billBroker, pricingStrategy } = await loadFixture(setupContracts); - await pricingStrategy.mockMethod("usdPrice()", [priceFP("1"), false]); + const { billBroker, oracle } = await loadFixture(setupContracts); + await oracle.mockMethod("usdPrice()", [priceFP("1"), false]); await expect(billBroker.usdPrice()).to.be.revertedWithCustomError( billBroker, "UnreliablePrice", @@ -357,8 +355,8 @@ describe("BillBroker", function () { describe("when the price is valid", function () { it("should return strategy price", async function () { - const { billBroker, pricingStrategy } = await loadFixture(setupContracts); - await pricingStrategy.mockMethod("usdPrice()", [priceFP("1.001"), true]); + const { billBroker, oracle } = await loadFixture(setupContracts); + await oracle.mockMethod("usdPrice()", [priceFP("1.001"), true]); expect(await billBroker.usdPrice.staticCall()).to.eq(priceFP("1.001")); }); }); @@ -367,8 +365,8 @@ describe("BillBroker", function () { describe("#perpPrice", function () { describe("when the price is invalid", function () { it("should revert", async function () { - const { billBroker, pricingStrategy } = await loadFixture(setupContracts); - await pricingStrategy.mockMethod("perpPrice()", [priceFP("1.17"), false]); + const { billBroker, oracle } = await loadFixture(setupContracts); + await oracle.mockMethod("perpFmvUsdPrice()", [priceFP("1.17"), false]); await expect(billBroker.perpPrice()).to.be.revertedWithCustomError( billBroker, "UnreliablePrice", @@ -378,8 +376,8 @@ describe("BillBroker", function () { describe("when the price is valid", function () { it("should return strategy price", async function () { - const { billBroker, pricingStrategy } = await loadFixture(setupContracts); - await pricingStrategy.mockMethod("perpPrice()", [priceFP("1.17"), true]); + const { billBroker, oracle } = await loadFixture(setupContracts); + await oracle.mockMethod("perpFmvUsdPrice()", [priceFP("1.17"), true]); expect(await billBroker.perpPrice.staticCall()).to.eq(priceFP("1.17")); }); }); @@ -403,235 +401,314 @@ describe("BillBroker", function () { describe("#reserveState", function () { it("should return the reserve state", async function () { - const { billBroker, perp, usd, pricingStrategy } = await loadFixture( - setupContracts, - ); + const { billBroker, perp, usd, oracle } = await loadFixture(setupContracts); await usd.mint(billBroker.target, usdFP("115")); await perp.mint(billBroker.target, perpFP("100")); - await pricingStrategy.mockMethod("usdPrice()", [priceFP("1"), true]); - await pricingStrategy.mockMethod("perpPrice()", [priceFP("1.3"), true]); - const r = { - usdBalance: await billBroker.usdBalance(), - perpBalance: await billBroker.perpBalance(), - usdPrice: await billBroker.usdPrice.staticCall(), - perpPrice: await billBroker.perpPrice.staticCall(), - }; - expect(r.usdBalance).to.eq(usdFP("115")); - expect(r.perpBalance).to.eq(perpFP("100")); - expect(r.usdPrice).to.eq(priceFP("1")); - expect(r.perpPrice).to.eq(priceFP("1.3")); + await oracle.mockMethod("usdPrice()", [priceFP("1"), true]); + await oracle.mockMethod("perpFmvUsdPrice()", [priceFP("1.3"), true]); + const r = await billBroker.reserveState.staticCall(); + expect(r[0]).to.eq(usdFP("115")); + expect(r[1]).to.eq(perpFP("100")); + expect(r[2]).to.eq(priceFP("1")); + expect(r[3]).to.eq(priceFP("1.3")); }); }); - describe("#computeUSDToPerpSwapFeePerc", function () { - it("should compute the right fee perc", async function () { + describe("#computeUSDToPerpSwapFeeFactor", function () { + it("should compute the right factor perc", async function () { const { billBroker } = await loadFixture(setupContracts); await billBroker.updateARBounds( - [percentageFP("0.75"), percentageFP("1.25")], - [percentageFP("0.5"), percentageFP("1.5")], + [percFP("0.75"), percFP("1.25")], + [percFP("0.25"), percFP("4")], ); await billBroker.updateFees({ mintFeePerc: 0n, burnFeePerc: 0n, - perpToUSDSwapFeePercs: { - lower: 0n, - upper: 0n, + perpToUSDSwapFeeFactors: { + lower: percFP("1.025"), + upper: percFP("1.16"), }, - usdToPerpSwapFeePercs: { - lower: percentageFP("0.05"), - upper: percentageFP("1.5"), + usdToPerpSwapFeeFactors: { + lower: percFP("1.025"), + upper: percFP("1.08"), }, protocolSwapSharePerc: 0n, }); await expect( - billBroker.computeUSDToPerpSwapFeePerc(percentageFP("1.5"), percentageFP("0.5")), - ).to.be.revertedWithCustomError(billBroker, "UnexpectedARDelta"); + billBroker.computeUSDToPerpSwapFeeFactor(percFP("1.5"), percFP("0.5")), + ).to.be.revertedWithCustomError(billBroker, "InvalidRange"); await expect( - billBroker.computeUSDToPerpSwapFeePerc( - percentageFP("1.25"), - percentageFP("1.249"), - ), - ).to.be.revertedWithCustomError(billBroker, "UnexpectedARDelta"); + billBroker.computeUSDToPerpSwapFeeFactor(percFP("1.25"), percFP("1.249")), + ).to.be.revertedWithCustomError(billBroker, "InvalidRange"); + await expect( + billBroker.computeUSDToPerpSwapFeeFactor(percFP("0.75"), percFP("1.26")), + ).to.be.revertedWithCustomError(billBroker, "UnexpectedRangeDelta"); + await expect( + billBroker.computeUSDToPerpSwapFeeFactor(percFP("0.5"), percFP("1.5")), + ).to.be.revertedWithCustomError(billBroker, "UnexpectedRangeDelta"); + + expect( + await billBroker.computeUSDToPerpSwapFeeFactor(percFP("0.1"), percFP("0.26")), + ).to.eq(percFP("0.84")); expect( - await billBroker.computeUSDToPerpSwapFeePerc( - percentageFP("0.25"), - percentageFP("1.2"), - ), - ).to.eq(percentageFP("0.05")); + await billBroker.computeUSDToPerpSwapFeeFactor(percFP("0.3"), percFP("0.5")), + ).to.eq(percFP("0.8955")); expect( - await billBroker.computeUSDToPerpSwapFeePerc( - percentageFP("0.25"), - percentageFP("1.25"), - ), - ).to.eq(percentageFP("0.05")); + await billBroker.computeUSDToPerpSwapFeeFactor(percFP("0.25"), percFP("1")), + ).to.eq(percFP("0.963333333333333333")); expect( - await billBroker.computeUSDToPerpSwapFeePerc( - percentageFP("1.2"), - percentageFP("1.3"), - ), - ).to.eq(percentageFP("0.1225")); + await billBroker.computeUSDToPerpSwapFeeFactor(percFP("0.25"), percFP("1.24")), + ).to.eq(percFP("0.978282828282828282")); expect( - await billBroker.computeUSDToPerpSwapFeePerc( - percentageFP("1.3"), - percentageFP("1.45"), - ), - ).to.eq(percentageFP("0.775")); + await billBroker.computeUSDToPerpSwapFeeFactor(percFP("0.76"), percFP("1.24")), + ).to.eq(percFP("1.025")); expect( - await billBroker.computeUSDToPerpSwapFeePerc( - percentageFP("1.3"), - percentageFP("1.5"), - ), - ).to.eq(percentageFP("0.92")); + await billBroker.computeUSDToPerpSwapFeeFactor(percFP("1.2"), percFP("1.3")), + ).to.eq(percFP("1.02525")); expect( - await billBroker.computeUSDToPerpSwapFeePerc( - percentageFP("0.5"), - percentageFP("1.5"), - ), - ).to.eq(percentageFP("0.23125")); + await billBroker.computeUSDToPerpSwapFeeFactor(percFP("1.3"), percFP("1.45")), + ).to.eq(percFP("1.0275")); expect( - await billBroker.computeUSDToPerpSwapFeePerc( - percentageFP("1.3"), - percentageFP("1.501"), - ), - ).to.eq(percentageFP("1")); + await billBroker.computeUSDToPerpSwapFeeFactor(percFP("1.3"), percFP("1.5")), + ).to.eq(percFP("1.028")); expect( - await billBroker.computeUSDToPerpSwapFeePerc( - percentageFP("1.3"), - percentageFP("2"), - ), - ).to.eq(percentageFP("1")); + await billBroker.computeUSDToPerpSwapFeeFactor(percFP("1.3"), percFP("1.501")), + ).to.eq(percFP("1.02801")); + expect( + await billBroker.computeUSDToPerpSwapFeeFactor(percFP("1.3"), percFP("2")), + ).to.eq(percFP("1.033")); + expect( + await billBroker.computeUSDToPerpSwapFeeFactor(percFP("1.5"), percFP("4")), + ).to.eq(percFP("1.055")); + expect( + await billBroker.computeUSDToPerpSwapFeeFactor(percFP("1.3"), percFP("4.01")), + ).to.eq(percFP("2")); }); - it("should compute the right fee perc when outside bounds", async function () { - const { billBroker } = await loadFixture(setupContracts); - await billBroker.updateARBounds( - [percentageFP("0.75"), percentageFP("1.25")], - [percentageFP("0"), percentageFP("10")], - ); + describe("Extended coverage for break-point conditions & edge cases", function () { + let billBroker; - await billBroker.updateFees({ - mintFeePerc: 0n, - burnFeePerc: 0n, - perpToUSDSwapFeePercs: { - lower: 0n, - upper: 0n, - }, - usdToPerpSwapFeePercs: { - lower: percentageFP("1.01"), - upper: percentageFP("2"), - }, - protocolSwapSharePerc: 0n, + beforeEach(async () => { + const fixtures = await loadFixture(setupContracts); + billBroker = fixtures.billBroker; + + await billBroker.updateARBounds( + [percFP("0.75"), percFP("1.25")], + [percFP("0.25"), percFP("4")], + ); + + await billBroker.updateFees({ + mintFeePerc: 0n, + burnFeePerc: 0n, + perpToUSDSwapFeeFactors: { + lower: percFP("1.025"), + upper: percFP("1.0769"), + }, + usdToPerpSwapFeeFactors: { + lower: percFP("1.025"), + upper: percFP("1.1693"), + }, + protocolSwapSharePerc: 0n, + }); + }); + + it("Case A: Entire range below arSoftBound.lower => uses fn1 entirely", async () => { + const result = await billBroker.computeUSDToPerpSwapFeeFactor( + percFP("0.50"), + percFP("0.55"), + ); + expect(result).to.eq(percFP("0.979145")); }); - expect( - await billBroker.computeUSDToPerpSwapFeePerc( - percentageFP("1"), - percentageFP("1.25"), - ), - ).to.eq(percentageFP("1")); + it("Case B: Range straddles arSoftBound.lower => partial weighting fn1/fn2", async () => { + const result = await billBroker.computeUSDToPerpSwapFeeFactor( + percFP("0.70"), + percFP("0.80"), + ); + expect(result).to.eq(percFP("1.0224525")); + }); + + it("Case C: Range fully within [arSoftBound.lower..arSoftBound.upper] => uses fn2 entirely", async () => { + const result = await billBroker.computeUSDToPerpSwapFeeFactor( + percFP("1.0"), + percFP("1.2"), + ); + expect(result).to.eq(percFP("1.025")); + }); + + it("Case D: Range straddles arSoftBound.upper => partial weighting fn2/fn3", async () => { + const result = await billBroker.computeUSDToPerpSwapFeeFactor( + percFP("1.20"), + percFP("1.30"), + ); + expect(result).to.eq(percFP("1.025655909090909091")); + }); + + it("Case E: Entire range above arSoftBound.upper => uses fn3 entirely", async () => { + const result = await billBroker.computeUSDToPerpSwapFeeFactor( + percFP("1.5"), + percFP("3"), + ); + expect(result).to.eq(percFP("1.077472727272727273")); + }); + + it("Zero-length range at boundary (e.g., arPre=arPost=arSoftBound.lower) => picks boundary side", async () => { + const result = await billBroker.computeUSDToPerpSwapFeeFactor( + percFP("0.75"), + percFP("0.75"), + ); + expect(result).to.eq(percFP("1.025")); + }); }); }); - describe("#computePerpToUSDSwapFeePerc", function () { - it("should compute the right fee perc", async function () { + describe("#computePerpToUSDSwapFeeFactor", function () { + it("should compute the right fee factor", async function () { const { billBroker } = await loadFixture(setupContracts); await billBroker.updateARBounds( - [percentageFP("0.75"), percentageFP("1.25")], - [percentageFP("0.5"), percentageFP("1.5")], + [percFP("0.75"), percFP("1.25")], + [percFP("0.25"), percFP("4")], ); await billBroker.updateFees({ mintFeePerc: 0n, burnFeePerc: 0n, - perpToUSDSwapFeePercs: { - lower: percentageFP("0.1"), - upper: percentageFP("0.5"), + perpToUSDSwapFeeFactors: { + lower: percFP("1.1"), + upper: percFP("1.15"), }, - usdToPerpSwapFeePercs: { - lower: 0n, - upper: 0n, + usdToPerpSwapFeeFactors: { + lower: percFP("1.025"), + upper: percFP("1.2"), }, protocolSwapSharePerc: 0n, }); await expect( - billBroker.computePerpToUSDSwapFeePerc(percentageFP("0.5"), percentageFP("1.5")), - ).to.be.revertedWithCustomError(billBroker, "UnexpectedARDelta"); + billBroker.computePerpToUSDSwapFeeFactor(percFP("1.25"), percFP("1.251")), + ).to.be.revertedWithCustomError(billBroker, "InvalidRange"); await expect( - billBroker.computePerpToUSDSwapFeePerc( - percentageFP("1.25"), - percentageFP("1.251"), - ), - ).to.be.revertedWithCustomError(billBroker, "UnexpectedARDelta"); + billBroker.computePerpToUSDSwapFeeFactor(percFP("1.5"), percFP("0.5")), + ).to.be.revertedWithCustomError(billBroker, "UnexpectedRangeDelta"); expect( - await billBroker.computePerpToUSDSwapFeePerc( - percentageFP("2"), - percentageFP("0.8"), - ), - ).to.eq(percentageFP("0.1")); + await billBroker.computePerpToUSDSwapFeeFactor(percFP("4"), percFP("3")), + ).to.eq(percFP("0.854545454545454545")); + + expect( + await billBroker.computePerpToUSDSwapFeeFactor(percFP("4"), percFP("1.25")), + ).to.eq(percFP("0.95")); + expect( - await billBroker.computePerpToUSDSwapFeePerc( - percentageFP("1.45"), - percentageFP("0.8"), - ), - ).to.eq(percentageFP("0.1")); + await billBroker.computePerpToUSDSwapFeeFactor(percFP("3"), percFP("2")), + ).to.eq(percFP("0.963636363636363636")); + expect( - await billBroker.computePerpToUSDSwapFeePerc( - percentageFP("0.8"), - percentageFP("0.7"), - ), - ).to.eq(percentageFP("0.12")); + await billBroker.computePerpToUSDSwapFeeFactor(percFP("2"), percFP("1.5")), + ).to.eq(percFP("1.045454545454545454")); + expect( - await billBroker.computePerpToUSDSwapFeePerc( - percentageFP("0.8"), - percentageFP("0.5"), - ), - ).to.eq(percentageFP("0.266666666666666666")); + await billBroker.computePerpToUSDSwapFeeFactor(percFP("2"), percFP("0.8")), + ).to.eq(percFP("1.074431818181818181")); + expect( - await billBroker.computePerpToUSDSwapFeePerc( - percentageFP("1.5"), - percentageFP("0.5"), - ), - ).to.eq(percentageFP("0.15")); + await billBroker.computePerpToUSDSwapFeeFactor(percFP("1.45"), percFP("0.8")), + ).to.eq(percFP("1.096643356643356643")); + + expect( + await billBroker.computePerpToUSDSwapFeeFactor(percFP("1.25"), percFP("0.9")), + ).to.eq(percFP("1.1")); + + expect( + await billBroker.computePerpToUSDSwapFeeFactor(percFP("0.8"), percFP("0.7")), + ).to.eq(percFP("1.10125")); + expect( - await billBroker.computePerpToUSDSwapFeePerc( - percentageFP("1.0"), - percentageFP("0.49"), - ), - ).to.eq(percentageFP("1")); + await billBroker.computePerpToUSDSwapFeeFactor(percFP("0.8"), percFP("0.5")), + ).to.eq(percFP("1.110416666666666666")); + + expect( + await billBroker.computePerpToUSDSwapFeeFactor(percFP("1.0"), percFP("0.49")), + ).to.eq(percFP("1.106627450980392156")); }); - it("should compute the right fee perc when outside bounds", async function () { - const { billBroker } = await loadFixture(setupContracts); - await billBroker.updateARBounds( - [percentageFP("0.75"), percentageFP("1.25")], - [percentageFP("0"), percentageFP("10")], - ); + describe("Extended coverage for break-point conditions & edge cases", function () { + let billBroker; - await billBroker.updateFees({ - mintFeePerc: 0n, - burnFeePerc: 0n, - perpToUSDSwapFeePercs: { - lower: percentageFP("1.01"), - upper: percentageFP("2"), - }, - usdToPerpSwapFeePercs: { - lower: 0n, - upper: 0n, - }, - protocolSwapSharePerc: 0n, + beforeEach(async () => { + const fixtures = await loadFixture(setupContracts); + billBroker = fixtures.billBroker; + + await billBroker.updateARBounds( + [percFP("0.75"), percFP("1.25")], + [percFP("0.25"), percFP("4")], + ); + + await billBroker.updateFees({ + mintFeePerc: 0n, + burnFeePerc: 0n, + perpToUSDSwapFeeFactors: { + lower: percFP("1.025"), + upper: percFP("1.0769"), + }, + usdToPerpSwapFeeFactors: { + lower: percFP("1.025"), + upper: percFP("1.1693"), + }, + protocolSwapSharePerc: 0n, + }); + }); + + it("Case A: Entirely below arSoftBound.lower => uses fn1 for perp->USD swap", async () => { + const result = await billBroker.computePerpToUSDSwapFeeFactor( + percFP("0.60"), + percFP("0.50"), + ); + expect(result).to.eq(percFP("1.04576")); }); - expect( - await billBroker.computePerpToUSDSwapFeePerc( - percentageFP("1.25"), - percentageFP("1.11"), - ), - ).to.eq(percentageFP("1")); + it("Case B: Straddles arSoftBound.lower => partial weighting", async () => { + const result = await billBroker.computePerpToUSDSwapFeeFactor( + percFP("0.80"), + percFP("0.70"), + ); + expect(result).to.eq(percFP("1.0262975")); + }); + + it("Case C: Fully within [0.75..1.25] => uses middle fn2", async () => { + const result = await billBroker.computePerpToUSDSwapFeeFactor( + percFP("1.20"), + percFP("1.10"), + ); + expect(result).to.eq(percFP("1.025")); + }); + + it("Case D: Straddles arSoftBound.upper => partial weighting", async () => { + const result = await billBroker.computePerpToUSDSwapFeeFactor( + percFP("1.30"), + percFP("1.20"), + ); + expect(result).to.eq(percFP("1.024116818181818182")); + }); + + it("Case E: Entirely above arSoftBound.upper => uses fn3", async () => { + const result = await billBroker.computePerpToUSDSwapFeeFactor( + percFP("2.50"), + percFP("2.0"), + ); + expect(result).to.eq(percFP("0.954345454545454546")); + }); + + it("Zero-length range exactly at boundary => picks boundary side", async () => { + const result = await billBroker.computePerpToUSDSwapFeeFactor( + percFP("1.25"), + percFP("1.25"), + ); + expect(result).to.eq(percFP("1.025")); + }); }); }); }); diff --git a/spot-vaults/test/BillBroker_deposit_redeem.ts b/spot-vaults/test/BillBroker_deposit_redeem.ts index 784f65a9..8c012f34 100644 --- a/spot-vaults/test/BillBroker_deposit_redeem.ts +++ b/spot-vaults/test/BillBroker_deposit_redeem.ts @@ -1,7 +1,7 @@ import { ethers, upgrades } from "hardhat"; import { loadFixture } from "@nomicfoundation/hardhat-toolbox/network-helpers"; import { expect } from "chai"; -import { DMock, usdFP, perpFP, lpAmtFP, percentageFP, priceFP } from "./helpers"; +import { DMock, usdFP, perpFP, lpAmtFP, percFP, priceFP } from "./helpers"; describe("BillBroker", function () { async function setupContracts() { @@ -14,16 +14,16 @@ describe("BillBroker", function () { await usd.init("USD token", "usd", 6); const perp = await Token.deploy(); await perp.init("Perp token", "perp", 9); - const pricingStrategy = new DMock("SpotAppraiser"); - await pricingStrategy.deploy(); - await pricingStrategy.mockMethod("decimals()", [18]); - await pricingStrategy.mockMethod("perpPrice()", [priceFP("1.15"), true]); - await pricingStrategy.mockMethod("usdPrice()", [priceFP("1"), true]); + const oracle = new DMock("IPerpPricer"); + await oracle.deploy(); + await oracle.mockMethod("decimals()", [18]); + await oracle.mockMethod("perpFmvUsdPrice()", [priceFP("1.15"), true]); + await oracle.mockMethod("usdPrice()", [priceFP("1"), true]); const BillBroker = await ethers.getContractFactory("BillBroker"); const billBroker = await upgrades.deployProxy( BillBroker.connect(deployer), - ["BillBroker LP", "LP token", usd.target, perp.target, pricingStrategy.target], + ["BillBroker LP", "LP token", usd.target, perp.target, oracle.target], { initializer: "init(string,string,address,address,address)", }, @@ -31,13 +31,13 @@ describe("BillBroker", function () { await billBroker.updateFees({ mintFeePerc: 0n, burnFeePerc: 0n, - perpToUSDSwapFeePercs: { - lower: 0n, - upper: 0n, + perpToUSDSwapFeeFactors: { + lower: percFP("1"), + upper: percFP("1"), }, - usdToPerpSwapFeePercs: { - lower: 0n, - upper: 0n, + usdToPerpSwapFeeFactors: { + lower: percFP("1"), + upper: percFP("1"), }, protocolSwapSharePerc: 0n, }); @@ -45,7 +45,7 @@ describe("BillBroker", function () { await perp.mint(await deployer.getAddress(), perpFP("2000")); await usd.mint(await otherUser.getAddress(), usdFP("2000")); await perp.mint(await otherUser.getAddress(), perpFP("2000")); - return { deployer, otherUser, usd, perp, pricingStrategy, billBroker }; + return { deployer, otherUser, usd, perp, oracle, billBroker }; } async function assetRatio(billBroker) { @@ -145,15 +145,15 @@ describe("BillBroker", function () { perpFP("100"), ); await billBroker.updateFees({ - mintFeePerc: percentageFP("0.1"), + mintFeePerc: percFP("0.1"), burnFeePerc: 0n, - perpToUSDSwapFeePercs: { - lower: 0n, - upper: 0n, + perpToUSDSwapFeeFactors: { + lower: percFP("1"), + upper: percFP("1"), }, - usdToPerpSwapFeePercs: { - lower: 0n, - upper: 0n, + usdToPerpSwapFeeFactors: { + lower: percFP("1"), + upper: percFP("1"), }, protocolSwapSharePerc: 0n, }); @@ -180,7 +180,7 @@ describe("BillBroker", function () { await billBroker.swapUSDForPerps(usdFP("115"), 0n); expect(await perp.balanceOf(billBroker.target)).to.eq(0n); - expect(await assetRatio(billBroker)).to.eq(ethers.MaxUint256); + expect(await assetRatio(billBroker)).to.eq(ethers.MaxInt256); const r = await billBroker.computeMintAmt.staticCall(usdFP("100"), 0n); expect(r[0]).to.eq(lpAmtFP("93.478260869565217391304347")); @@ -234,45 +234,49 @@ describe("BillBroker", function () { it("should return the mint amount", async function () { const { billBroker, usd, perp } = await loadFixture(setupContracts); await usd.approve(billBroker.target, usdFP("115")); - await perp.approve(billBroker.target, perpFP("200")); + await perp.approve(billBroker.target, perpFP("2000")); await billBroker.deposit( usdFP("115"), - perpFP("200"), + perpFP("2000"), usdFP("115"), - perpFP("200"), + perpFP("2000"), ); expect(await billBroker.computeMintAmtWithUSD.staticCall(usdFP("11.5"))).to.eq( - lpAmtFP("10.5"), + lpAmtFP("10.071428571428571428571427"), ); }); }); - describe("when fee > 0", function () { + describe("when swapFee > 0", function () { it("should return the mint amount", async function () { const { billBroker, usd, perp } = await loadFixture(setupContracts); + await billBroker.updateARBounds( + [percFP("0.9"), percFP("1.1")], + [percFP("0.25"), percFP("4")], + ); await usd.approve(billBroker.target, usdFP("115")); - await perp.approve(billBroker.target, perpFP("200")); + await perp.approve(billBroker.target, perpFP("2000")); await billBroker.deposit( usdFP("115"), - perpFP("200"), + perpFP("2000"), usdFP("115"), - perpFP("200"), + perpFP("2000"), ); await billBroker.updateFees({ - mintFeePerc: percentageFP("0.1"), + mintFeePerc: 0n, burnFeePerc: 0n, - perpToUSDSwapFeePercs: { - lower: 0n, - upper: 0n, + perpToUSDSwapFeeFactors: { + lower: percFP("1"), + upper: percFP("1.2"), }, - usdToPerpSwapFeePercs: { - lower: 0n, - upper: 0n, + usdToPerpSwapFeeFactors: { + lower: percFP("1.025"), + upper: percFP("1.15"), }, protocolSwapSharePerc: 0n, }); expect(await billBroker.computeMintAmtWithUSD.staticCall(usdFP("11.5"))).to.eq( - lpAmtFP("9.45"), + lpAmtFP("11.980704141614906830371426"), ); }); }); @@ -321,46 +325,50 @@ describe("BillBroker", function () { describe("when fee = 0", function () { it("should return the mint amount", async function () { const { billBroker, usd, perp } = await loadFixture(setupContracts); - await usd.approve(billBroker.target, usdFP("200")); + await usd.approve(billBroker.target, usdFP("2000")); await perp.approve(billBroker.target, perpFP("100")); await billBroker.deposit( - usdFP("200"), + usdFP("2000"), perpFP("100"), - usdFP("200"), + usdFP("2000"), perpFP("100"), ); expect(await billBroker.computeMintAmtWithPerp.staticCall(perpFP("10.5"))).to.eq( - lpAmtFP("11.5"), + lpAmtFP("11.989361702127659574468084"), ); }); }); - describe("when fee > 0", function () { + describe("when swapFee > 0", function () { it("should return the mint amount", async function () { const { billBroker, usd, perp } = await loadFixture(setupContracts); - await usd.approve(billBroker.target, usdFP("200")); + await billBroker.updateARBounds( + [percFP("0.9"), percFP("1.1")], + [percFP("0.25"), percFP("4")], + ); + await usd.approve(billBroker.target, usdFP("2000")); await perp.approve(billBroker.target, perpFP("100")); await billBroker.deposit( - usdFP("200"), + usdFP("2000"), perpFP("100"), - usdFP("200"), + usdFP("2000"), perpFP("100"), ); await billBroker.updateFees({ - mintFeePerc: percentageFP("0.1"), + mintFeePerc: 0n, burnFeePerc: 0n, - perpToUSDSwapFeePercs: { - lower: 0n, - upper: 0n, + perpToUSDSwapFeeFactors: { + lower: percFP("1.025"), + upper: percFP("1.1"), }, - usdToPerpSwapFeePercs: { - lower: 0n, - upper: 0n, + usdToPerpSwapFeeFactors: { + lower: percFP("1"), + upper: percFP("1.2"), }, protocolSwapSharePerc: 0n, }); expect(await billBroker.computeMintAmtWithPerp.staticCall(perpFP("10.5"))).to.eq( - lpAmtFP("10.35"), + lpAmtFP("14.243981158876595744680849"), ); }); }); @@ -381,7 +389,7 @@ describe("BillBroker", function () { await billBroker.swapUSDForPerps(usdFP("115"), 0n); expect(await perp.balanceOf(billBroker.target)).to.eq(0n); - expect(await assetRatio(billBroker)).to.eq(ethers.MaxUint256); + expect(await assetRatio(billBroker)).to.eq(ethers.MaxInt256); expect(await billBroker.computeMintAmtWithPerp.staticCall(perpFP("100"))).to.eq( lpAmtFP("107.5"), ); @@ -565,15 +573,15 @@ describe("BillBroker", function () { it("should withhold fees and mint lp tokens", async function () { const { billBroker, usd, perp, deployer } = await loadFixture(setupContracts); await billBroker.updateFees({ - mintFeePerc: percentageFP("0.1"), + mintFeePerc: 0n, burnFeePerc: 0n, - perpToUSDSwapFeePercs: { - lower: 0n, - upper: 0n, + perpToUSDSwapFeeFactors: { + lower: percFP("1"), + upper: percFP("1"), }, - usdToPerpSwapFeePercs: { - lower: 0n, - upper: 0n, + usdToPerpSwapFeeFactors: { + lower: percFP("1"), + upper: percFP("1"), }, protocolSwapSharePerc: 0n, }); @@ -581,7 +589,7 @@ describe("BillBroker", function () { await perp.approve(billBroker.target, perpFP("100")); await expect(() => billBroker.deposit(usdFP("115"), perpFP("100"), usdFP("115"), perpFP("100")), - ).to.changeTokenBalance(billBroker, deployer, lpAmtFP("193.49")); + ).to.changeTokenBalance(billBroker, deployer, lpAmtFP("214.99")); }); }); @@ -601,7 +609,7 @@ describe("BillBroker", function () { await billBroker.swapUSDForPerps(usdFP("115"), 0n); expect(await perp.balanceOf(billBroker.target)).to.eq(0n); - expect(await assetRatio(billBroker)).to.eq(ethers.MaxUint256); + expect(await assetRatio(billBroker)).to.eq(ethers.MaxInt256); await usd.approve(billBroker.target, usdFP("115")); await expect(() => @@ -645,15 +653,14 @@ describe("BillBroker", function () { it("should revert", async function () { const { billBroker } = await loadFixture(setupContracts); await billBroker.pause(); - await expect(billBroker.depositUSD(usdFP("115"), percentageFP("1"))).to.be - .reverted; + await expect(billBroker.depositUSD(usdFP("115"), percFP("1"))).to.be.reverted; }); }); describe("when usdAmtIn is zero", function () { it("should return zero", async function () { const { billBroker } = await loadFixture(setupContracts); - const r = await billBroker.depositUSD.staticCall(0n, percentageFP("1")); + const r = await billBroker.depositUSD.staticCall(0n, percFP("1")); expect(r).to.eq(0n); }); }); @@ -671,7 +678,7 @@ describe("BillBroker", function () { ); await usd.approve(billBroker.target, usdFP("100")); expect( - await billBroker.depositUSD.staticCall(usdFP("100"), ethers.MaxUint256), + await billBroker.depositUSD.staticCall(usdFP("100"), ethers.MaxInt256), ).to.eq(0n); }); }); @@ -689,7 +696,7 @@ describe("BillBroker", function () { ); await usd.approve(billBroker.target, usdFP("100")); expect( - await billBroker.depositUSD.staticCall(usdFP("100"), ethers.MaxUint256), + await billBroker.depositUSD.staticCall(usdFP("100"), ethers.MaxInt256), ).to.eq(0n); }); }); @@ -707,7 +714,7 @@ describe("BillBroker", function () { ); await usd.approve(billBroker.target, usdFP("1")); expect( - await billBroker.depositUSD.staticCall(usdFP("1"), ethers.MaxUint256), + await billBroker.depositUSD.staticCall(usdFP("1"), ethers.MaxInt256), ).to.eq(0n); }); }); @@ -725,7 +732,7 @@ describe("BillBroker", function () { ); await usd.approve(billBroker.target, usdFP("115")); expect( - await billBroker.depositUSD.staticCall(usdFP("115"), ethers.MaxUint256), + await billBroker.depositUSD.staticCall(usdFP("115"), ethers.MaxInt256), ).to.eq(lpAmtFP("105")); }); }); @@ -744,7 +751,7 @@ describe("BillBroker", function () { await usd.approve(billBroker.target, usdFP("10")); await expect( - billBroker.depositUSD(usdFP("10"), percentageFP("0.50")), + billBroker.depositUSD(usdFP("10"), percFP("0.50")), ).to.be.revertedWithCustomError(billBroker, "SlippageTooHigh"); }); }); @@ -763,7 +770,7 @@ describe("BillBroker", function () { await usd.approve(billBroker.target, usdFP("10")); await expect(() => - billBroker.depositUSD(usdFP("10"), percentageFP("1")), + billBroker.depositUSD(usdFP("10"), percFP("1")), ).to.changeTokenBalance(usd, deployer, usdFP("-10")); }); @@ -780,14 +787,14 @@ describe("BillBroker", function () { await usd.approve(billBroker.target, usdFP("10")); await expect(() => - billBroker.depositUSD(usdFP("10"), percentageFP("1")), + billBroker.depositUSD(usdFP("10"), percFP("1")), ).to.changeTokenBalance( billBroker, deployer, - lpAmtFP("9.130434782608695652173913"), + lpAmtFP("9.130434782608695652173912"), ); expect(await billBroker.totalSupply()).to.eq( - lpAmtFP("324.130434782608695652173913"), + lpAmtFP("324.130434782608695652173912"), ); }); @@ -803,11 +810,11 @@ describe("BillBroker", function () { ); await usd.approve(billBroker.target, usdFP("10")); const r = await billBroker.reserveState.staticCall(); - await expect(billBroker.depositUSD(usdFP("10"), percentageFP("1"))) + await expect(billBroker.depositUSD(usdFP("10"), percFP("1"))) .to.emit(billBroker, "DepositUSD") .withArgs(usdFP("10"), r); expect(await billBroker.totalSupply()).to.eq( - lpAmtFP("324.130434782608695652173913"), + lpAmtFP("324.130434782608695652173912"), ); }); @@ -823,8 +830,8 @@ describe("BillBroker", function () { ); await usd.approve(billBroker.target, usdFP("10")); - const r = await billBroker.depositUSD.staticCall(usdFP("10"), percentageFP("1")); - expect(r).to.eq(lpAmtFP("9.130434782608695652173913")); + const r = await billBroker.depositUSD.staticCall(usdFP("10"), percFP("1")); + expect(r).to.eq(lpAmtFP("9.130434782608695652173912")); }); }); @@ -832,15 +839,56 @@ describe("BillBroker", function () { it("should withhold fees and mint lp tokens", async function () { const { billBroker, usd, perp, deployer } = await loadFixture(setupContracts); await billBroker.updateFees({ - mintFeePerc: percentageFP("0.1"), + mintFeePerc: 0n, + burnFeePerc: 0n, + perpToUSDSwapFeeFactors: { + lower: percFP("1.025"), + upper: percFP("1.2"), + }, + usdToPerpSwapFeeFactors: { + lower: percFP("1.025"), + upper: percFP("1.1"), + }, + protocolSwapSharePerc: 0n, + }); + + await usd.approve(billBroker.target, usdFP("115")); + await perp.approve(billBroker.target, perpFP("200")); + await billBroker.deposit( + usdFP("115"), + perpFP("200"), + usdFP("115"), + perpFP("200"), + ); + + await usd.approve(billBroker.target, usdFP("10")); + await expect(() => + billBroker.depositUSD(usdFP("10"), percFP("1")), + ).to.changeTokenBalance( + billBroker, + deployer, + lpAmtFP("8.982547441304347826086955"), + ); + + const r = await billBroker.computeRedemptionAmts.staticCall( + lpAmtFP("8.982547441304347826086955"), + ); + expect(r[0]).to.eq(usdFP("3.465675")); + expect(r[1]).to.eq(perpFP("5.545081062")); + }); + + it("should be roughly equivalent to swap+deposit", async function () { + const { billBroker, usd, perp, deployer } = await loadFixture(setupContracts); + await billBroker.updateFees({ + mintFeePerc: 0n, burnFeePerc: 0n, - perpToUSDSwapFeePercs: { - lower: 0n, - upper: 0n, + perpToUSDSwapFeeFactors: { + lower: percFP("1.025"), + upper: percFP("1.2"), }, - usdToPerpSwapFeePercs: { - lower: 0n, - upper: 0n, + usdToPerpSwapFeeFactors: { + lower: percFP("1.025"), + upper: percFP("1.1"), }, protocolSwapSharePerc: 0n, }); @@ -855,13 +903,20 @@ describe("BillBroker", function () { ); await usd.approve(billBroker.target, usdFP("10")); + await perp.approve(billBroker.target, perpFP("10")); + await billBroker.swapUSDForPerps(usdFP("6.535"), 0n); await expect(() => - billBroker.depositUSD(usdFP("10"), percentageFP("1")), + billBroker.deposit(usdFP("3.465"), percFP("10"), 0n, 0n), ).to.changeTokenBalance( billBroker, deployer, - lpAmtFP("7.395652173913043478260868"), + lpAmtFP("8.980746287077796519521125"), + ); + const r = await billBroker.computeRedemptionAmts.staticCall( + lpAmtFP("8.980746287077796519521125"), ); + expect(r[0]).to.eq(usdFP("3.464999")); + expect(r[1]).to.eq(perpFP("5.544098565")); }); }); }); @@ -871,15 +926,14 @@ describe("BillBroker", function () { it("should revert", async function () { const { billBroker } = await loadFixture(setupContracts); await billBroker.pause(); - await expect(billBroker.depositPerp(perpFP("100"), percentageFP("1"))).to.be - .reverted; + await expect(billBroker.depositPerp(perpFP("100"), percFP("1"))).to.be.reverted; }); }); describe("when perpAmtIn is zero", function () { it("should return zero", async function () { const { billBroker } = await loadFixture(setupContracts); - const r = await billBroker.depositPerp.staticCall(0n, percentageFP("1")); + const r = await billBroker.depositPerp.staticCall(0n, percFP("1")); expect(r).to.eq(0n); }); }); @@ -940,7 +994,7 @@ describe("BillBroker", function () { await billBroker.deposit(usdFP("115"), perpFP("90"), usdFP("115"), perpFP("90")); await perp.approve(billBroker.target, perpFP("10")); expect(await billBroker.depositPerp.staticCall(perpFP("10"), 0n)).to.eq( - lpAmtFP("10.789473684210526315789473"), + lpAmtFP("10.789473684210526315789472"), ); }); }); @@ -959,7 +1013,7 @@ describe("BillBroker", function () { await perp.approve(billBroker.target, perpFP("10")); await expect( - billBroker.depositPerp(perpFP("10"), percentageFP("1.85")), + billBroker.depositPerp(perpFP("10"), percFP("1.85")), ).to.be.revertedWithCustomError(billBroker, "SlippageTooHigh"); }); }); @@ -978,7 +1032,7 @@ describe("BillBroker", function () { await perp.approve(billBroker.target, perpFP("10")); await expect(() => - billBroker.depositPerp(perpFP("10"), percentageFP("1")), + billBroker.depositPerp(perpFP("10"), percFP("1")), ).to.changeTokenBalance(perp, deployer, perpFP("-10")); }); @@ -995,7 +1049,7 @@ describe("BillBroker", function () { await perp.approve(billBroker.target, perpFP("10")); await expect(() => - billBroker.depositPerp(perpFP("10"), percentageFP("1")), + billBroker.depositPerp(perpFP("10"), percFP("1")), ).to.changeTokenBalance(billBroker, deployer, lpAmtFP("11")); expect(await billBroker.totalSupply()).to.eq(lpAmtFP("341")); }); @@ -1013,7 +1067,7 @@ describe("BillBroker", function () { await perp.approve(billBroker.target, perpFP("10")); const r = await billBroker.reserveState.staticCall(); - await expect(billBroker.depositPerp(perpFP("10"), percentageFP("1"))) + await expect(billBroker.depositPerp(perpFP("10"), percFP("1"))) .to.emit(billBroker, "DepositPerp") .withArgs(perpFP("10"), r); expect(await billBroker.totalSupply()).to.eq(lpAmtFP("341")); @@ -1031,10 +1085,7 @@ describe("BillBroker", function () { ); await perp.approve(billBroker.target, perpFP("10")); - const r = await billBroker.depositPerp.staticCall( - perpFP("10"), - percentageFP("1"), - ); + const r = await billBroker.depositPerp.staticCall(perpFP("10"), percFP("1")); expect(r).to.eq(lpAmtFP("11")); }); }); @@ -1052,22 +1103,69 @@ describe("BillBroker", function () { ); await billBroker.updateFees({ - mintFeePerc: percentageFP("0.1"), + mintFeePerc: 0n, burnFeePerc: 0n, - perpToUSDSwapFeePercs: { - lower: 0n, - upper: 0n, + perpToUSDSwapFeeFactors: { + lower: percFP("1.025"), + upper: percFP("1.1"), }, - usdToPerpSwapFeePercs: { - lower: 0n, - upper: 0n, + usdToPerpSwapFeeFactors: { + lower: percFP("1.025"), + upper: percFP("1.2"), }, protocolSwapSharePerc: 0n, }); await perp.approve(billBroker.target, perpFP("10")); await expect(() => - billBroker.depositPerp(perpFP("10"), percentageFP("1")), - ).to.changeTokenBalance(billBroker, deployer, lpAmtFP("9.9")); + billBroker.depositPerp(perpFP("10"), percFP("1")), + ).to.changeTokenBalance(billBroker, deployer, lpAmtFP("10.82258064514")); + + const r = await billBroker.computeRedemptionAmts.staticCall( + lpAmtFP("10.82258064514"), + ); + expect(r[0]).to.eq(usdFP("7.303487")); + expect(r[1]).to.eq(perpFP("3.49297241")); + }); + + it("should be roughly equivalent to swap+deposit", async function () { + const { billBroker, usd, perp, deployer } = await loadFixture(setupContracts); + await usd.approve(billBroker.target, usdFP("230")); + await perp.approve(billBroker.target, perpFP("100")); + await billBroker.deposit( + usdFP("230"), + perpFP("100"), + usdFP("230"), + perpFP("100"), + ); + + await billBroker.updateFees({ + mintFeePerc: 0n, + burnFeePerc: 0n, + perpToUSDSwapFeeFactors: { + lower: percFP("1.025"), + upper: percFP("1.1"), + }, + usdToPerpSwapFeeFactors: { + lower: percFP("1.025"), + upper: percFP("1.2"), + }, + protocolSwapSharePerc: 0n, + }); + await perp.approve(billBroker.target, perpFP("15")); + await usd.approve(billBroker.target, usdFP("15")); + await billBroker.swapPerpsForUSD(perpFP("6"), 0n); + await expect(() => + billBroker.deposit(usdFP("7.30"), percFP("5"), 0n, 0n), + ).to.changeTokenBalance( + billBroker, + deployer, + lpAmtFP("10.789506096809951964527651"), + ); + const r = await billBroker.computeRedemptionAmts.staticCall( + lpAmtFP("10.789506096809951964527651"), + ); + expect(r[0]).to.eq(usdFP("7.299999")); + expect(r[1]).to.eq(perpFP("3.465720140")); }); }); }); @@ -1129,14 +1227,14 @@ describe("BillBroker", function () { const { billBroker, usd, perp } = await loadFixture(setupContracts); await billBroker.updateFees({ mintFeePerc: 0n, - burnFeePerc: percentageFP("0.1"), - perpToUSDSwapFeePercs: { - lower: 0n, - upper: 0n, + burnFeePerc: percFP("0.1"), + perpToUSDSwapFeeFactors: { + lower: percFP("1"), + upper: percFP("1"), }, - usdToPerpSwapFeePercs: { - lower: 0n, - upper: 0n, + usdToPerpSwapFeeFactors: { + lower: percFP("1"), + upper: percFP("1"), }, protocolSwapSharePerc: 0n, }); @@ -1170,15 +1268,7 @@ describe("BillBroker", function () { await billBroker.swapUSDForPerps(usdFP("115"), 0n); expect(await perp.balanceOf(billBroker.target)).to.eq(0n); - const s = await billBroker.reserveState.staticCall(); - expect( - await billBroker.assetRatio({ - usdBalance: s[0], - perpBalance: s[1], - usdPrice: s[2], - perpPrice: s[3], - }), - ).to.eq(ethers.MaxUint256); + expect(await assetRatio(billBroker)).to.eq(ethers.MaxInt256); const r = await billBroker.computeRedemptionAmts.staticCall(lpAmtFP("100")); expect(r[0]).to.eq(usdFP("106.976744")); @@ -1202,15 +1292,7 @@ describe("BillBroker", function () { await billBroker.swapPerpsForUSD(perpFP("100"), 0n); expect(await usd.balanceOf(billBroker.target)).to.eq(0n); - const s = await billBroker.reserveState.staticCall(); - expect( - await billBroker.assetRatio({ - usdBalance: s[0], - perpBalance: s[1], - usdPrice: s[2], - perpPrice: s[3], - }), - ).to.eq(0); + expect(await assetRatio(billBroker)).to.eq(0); const r = await billBroker.computeRedemptionAmts.staticCall(lpAmtFP("100")); expect(r[0]).to.eq(0n); @@ -1426,15 +1508,7 @@ describe("BillBroker", function () { await billBroker.swapUSDForPerps(usdFP("115"), 0n); expect(await perp.balanceOf(billBroker.target)).to.eq(0n); - const s = await billBroker.reserveState.staticCall(); - expect( - await billBroker.assetRatio({ - usdBalance: s[0], - perpBalance: s[1], - usdPrice: s[2], - perpPrice: s[3], - }), - ).to.eq(ethers.MaxUint256); + expect(await assetRatio(billBroker)).to.eq(ethers.MaxInt256); const perpBal = await perp.balanceOf(await deployer.getAddress()); await expect(() => billBroker.redeem(lpAmtFP("100"))).to.changeTokenBalance( @@ -1463,15 +1537,7 @@ describe("BillBroker", function () { await billBroker.swapPerpsForUSD(perpFP("100"), 0n); expect(await usd.balanceOf(billBroker.target)).to.eq(0n); - const s = await billBroker.reserveState.staticCall(); - expect( - await billBroker.assetRatio({ - usdBalance: s[0], - perpBalance: s[1], - usdPrice: s[2], - perpPrice: s[3], - }), - ).to.eq(0); + expect(await assetRatio(billBroker)).to.eq(0); const usdBal = await usd.balanceOf(await deployer.getAddress()); await expect(() => billBroker.redeem(lpAmtFP("100"))).to.changeTokenBalance( diff --git a/spot-vaults/test/BillBroker_swap.ts b/spot-vaults/test/BillBroker_swap.ts index d22bca2d..91224688 100644 --- a/spot-vaults/test/BillBroker_swap.ts +++ b/spot-vaults/test/BillBroker_swap.ts @@ -2,7 +2,7 @@ import { ethers, upgrades } from "hardhat"; import { Contract } from "ethers"; import { loadFixture } from "@nomicfoundation/hardhat-toolbox/network-helpers"; import { expect } from "chai"; -import { DMock, usdFP, perpFP, priceFP, percentageFP } from "./helpers"; +import { DMock, usdFP, perpFP, priceFP, percFP } from "./helpers"; async function updateFees(billBroker: Contract, fees: any) { const currentFees = await billBroker.fees(); @@ -10,11 +10,11 @@ async function updateFees(billBroker: Contract, fees: any) { ...{ mintFeePerc: currentFees[0], burnFeePerc: currentFees[1], - perpToUSDSwapFeePercs: { + perpToUSDSwapFeeFactors: { lower: currentFees[2][0], upper: currentFees[2][1], }, - usdToPerpSwapFeePercs: { + usdToPerpSwapFeeFactors: { lower: currentFees[3][0], upper: currentFees[3][1], }, @@ -28,28 +28,26 @@ async function checkUSDToPerpSwapAmt( billBroker: Contract, usdAmtIn: BigInt, reserveState: any, - amoutsOut: any, + returnVals: any, ) { const r = await billBroker[ "computeUSDToPerpSwapAmt(uint256,(uint256,uint256,uint256,uint256))" ](usdAmtIn, reserveState); - expect(r[0]).to.eq(amoutsOut[0]); - expect(r[1]).to.eq(amoutsOut[1]); - expect(r[2]).to.eq(amoutsOut[2]); + expect(r[0]).to.eq(returnVals[0]); + expect(r[1]).to.eq(returnVals[1]); } -async function checkPerpTpUSDSwapAmt( +async function checkPerpToUSDSwapAmt( billBroker: Contract, perpAmtIn: BigInt, reserveState: any, - amoutsOut: any, + returnVals: any, ) { const r = await billBroker[ "computePerpToUSDSwapAmt(uint256,(uint256,uint256,uint256,uint256))" ](perpAmtIn, reserveState); - expect(r[0]).to.eq(amoutsOut[0]); - expect(r[1]).to.eq(amoutsOut[1]); - expect(r[2]).to.eq(amoutsOut[2]); + expect(r[0]).to.eq(returnVals[0]); + expect(r[1]).to.eq(returnVals[1]); } async function reserveState(billBroker: Contract) { @@ -77,16 +75,16 @@ describe("BillBroker", function () { await usd.init("USD token", "usd", 6); const perp = await Token.deploy(); await perp.init("Perp token", "perp", 9); - const pricingStrategy = new DMock("SpotAppraiser"); - await pricingStrategy.deploy(); - await pricingStrategy.mockMethod("decimals()", [18]); - await pricingStrategy.mockMethod("perpPrice()", [priceFP("1.15"), true]); - await pricingStrategy.mockMethod("usdPrice()", [priceFP("1"), true]); + const oracle = new DMock("IPerpPricer"); + await oracle.deploy(); + await oracle.mockMethod("decimals()", [18]); + await oracle.mockMethod("perpFmvUsdPrice()", [priceFP("1.15"), true]); + await oracle.mockMethod("usdPrice()", [priceFP("1"), true]); const BillBroker = await ethers.getContractFactory("BillBroker"); const billBroker = await upgrades.deployProxy( BillBroker.connect(deployer), - ["BillBroker LP", "LP token", usd.target, perp.target, pricingStrategy.target], + ["BillBroker LP", "LP token", usd.target, perp.target, oracle.target], { initializer: "init(string,string,address,address,address)", }, @@ -94,19 +92,19 @@ describe("BillBroker", function () { await updateFees(billBroker, { mintFeePerc: 0n, burnFeePerc: 0n, - perpToUSDSwapFeePercs: { - lower: 0n, - upper: 0n, + perpToUSDSwapFeeFactors: { + lower: percFP("1"), + upper: percFP("1"), }, - usdToPerpSwapFeePercs: { - lower: 0n, - upper: 0n, + usdToPerpSwapFeeFactors: { + lower: percFP("1"), + upper: percFP("1"), }, protocolSwapSharePerc: 0n, }); await billBroker.updateARBounds( - [percentageFP("0.9"), percentageFP("1.1")], - [percentageFP("0.75"), percentageFP("1.25")], + [percFP("0.9"), percFP("1.1")], + [percFP("0.75"), percFP("1.25")], ); await usd.mint(billBroker.target, usdFP("115000")); @@ -122,7 +120,7 @@ describe("BillBroker", function () { expect(r.usdPrice).to.eq(priceFP("1")); expect(r.perpPrice).to.eq(priceFP("1.15")); - return { deployer, feeCollector, usd, perp, pricingStrategy, billBroker }; + return { deployer, feeCollector, usd, perp, oracle, billBroker }; } describe("#computeUSDToPerpSwapAmt", function () { @@ -132,7 +130,7 @@ describe("BillBroker", function () { billBroker, usdFP("115"), [usdFP("115000"), perpFP("100000"), priceFP("1"), priceFP("1.15")], - [perpFP("100"), 0n, 0n], + [perpFP("100"), 0n], ); }); @@ -142,7 +140,7 @@ describe("BillBroker", function () { billBroker, usdFP("100"), [usdFP("110000"), perpFP("100000"), priceFP("1"), priceFP("1")], - [perpFP("100"), 0n, 0n], + [perpFP("100"), 0n], ); }); @@ -152,7 +150,7 @@ describe("BillBroker", function () { billBroker, usdFP("11111"), [usdFP("100000"), perpFP("100000"), priceFP("1"), priceFP("1")], - [perpFP("11111"), 0n, 0n], + [perpFP("11111"), 0n], ); }); @@ -162,7 +160,8 @@ describe("BillBroker", function () { billBroker, usdFP("11112"), [usdFP("100000"), perpFP("100000"), priceFP("1"), priceFP("1")], - [0n, 0n, 0n], + + [0n, 0n], ); }); @@ -172,7 +171,7 @@ describe("BillBroker", function () { billBroker, usdFP("100"), [usdFP("100000"), perpFP("100000"), priceFP("1"), priceFP("0.9")], - [perpFP("111.111111"), 0n, 0n], + [perpFP("111.111111"), 0n], ); }); @@ -180,80 +179,104 @@ describe("BillBroker", function () { it("should return the perp amount and fees", async function () { const { billBroker } = await loadFixture(setupContracts); await updateFees(billBroker, { - usdToPerpSwapFeePercs: { - lower: percentageFP("0.05"), - upper: percentageFP("0.5"), + usdToPerpSwapFeeFactors: { + lower: percFP("1.05"), + upper: percFP("1.2"), }, }); await checkUSDToPerpSwapAmt( billBroker, usdFP("115"), [usdFP("115000"), perpFP("100000"), priceFP("1"), priceFP("1.15")], - [perpFP("95"), perpFP("5"), 0n], + [perpFP("95"), 0n], ); }); it("should return the perp amount and fees", async function () { const { billBroker } = await loadFixture(setupContracts); await updateFees(billBroker, { - usdToPerpSwapFeePercs: { - lower: percentageFP("0.05"), - upper: percentageFP("0.5"), + usdToPerpSwapFeeFactors: { + lower: percFP("1.05"), + upper: percFP("1.2"), }, }); await checkUSDToPerpSwapAmt( billBroker, usdFP("100"), [usdFP("100000"), perpFP("100000"), priceFP("1"), priceFP("1")], - [perpFP("95"), perpFP("5"), 0n], + [perpFP("95"), 0n], ); }); it("should return the perp amount and fees", async function () { const { billBroker } = await loadFixture(setupContracts); await updateFees(billBroker, { - usdToPerpSwapFeePercs: { - lower: percentageFP("0.05"), - upper: percentageFP("0.5"), + usdToPerpSwapFeeFactors: { + lower: percFP("1.05"), + upper: percFP("1.2"), }, }); await checkUSDToPerpSwapAmt( billBroker, usdFP("100"), [usdFP("100000"), perpFP("100000"), priceFP("1"), priceFP("0.9")], - [perpFP("101.460470381"), perpFP("9.650640619"), 0n], + [perpFP("104.190527093"), 0n], ); }); it("should return the perp amount and fees", async function () { const { billBroker } = await loadFixture(setupContracts); await updateFees(billBroker, { - usdToPerpSwapFeePercs: { - lower: percentageFP("0.05"), - upper: percentageFP("0.5"), + usdToPerpSwapFeeFactors: { + lower: percFP("1.05"), + upper: percFP("1.2"), }, }); await checkUSDToPerpSwapAmt( billBroker, usdFP("10000"), [usdFP("100000"), perpFP("100000"), priceFP("1"), priceFP("1")], - [perpFP("8491.666666667"), perpFP("1508.333333333"), 0n], + [perpFP("9163.888888888"), 0n], ); }); it("should return the perp amount and fees", async function () { const { billBroker } = await loadFixture(setupContracts); await updateFees(billBroker, { - usdToPerpSwapFeePercs: { - lower: percentageFP("0.05"), - upper: percentageFP("0.5"), + usdToPerpSwapFeeFactors: { + lower: percFP("1.05"), + upper: percFP("1.2"), }, }); await checkUSDToPerpSwapAmt( billBroker, usdFP("20000"), [usdFP("100000"), perpFP("100000"), priceFP("1"), priceFP("1")], - [0n, 0n, 0n], + [0n, 0n], + ); + }); + + it("should return the perp amount and fees", async function () { + const { billBroker } = await loadFixture(setupContracts); + await updateFees(billBroker, { + perpToUSDSwapFeeFactors: { + lower: percFP("1.025"), + upper: percFP("1.1"), + }, + usdToPerpSwapFeeFactors: { + lower: percFP("1.05"), + upper: percFP("1.2"), + }, + }); + await billBroker.updateARBounds( + [percFP("0.25"), percFP("4")], + [percFP("0.01"), percFP("100")], + ); + await checkUSDToPerpSwapAmt( + billBroker, + usdFP("10000"), + [usdFP("1000"), perpFP("100000"), priceFP("1"), priceFP("1")], + [perpFP("10649.305555555"), 0n], ); }); }); @@ -262,17 +285,17 @@ describe("BillBroker", function () { it("should return the perp amount and fees", async function () { const { billBroker } = await loadFixture(setupContracts); await updateFees(billBroker, { - usdToPerpSwapFeePercs: { - lower: percentageFP("0.05"), - upper: percentageFP("0.5"), + usdToPerpSwapFeeFactors: { + lower: percFP("1.05"), + upper: percFP("1.2"), }, - protocolSwapSharePerc: percentageFP("0.1"), + protocolSwapSharePerc: percFP("0.1"), }); await checkUSDToPerpSwapAmt( billBroker, usdFP("115"), [usdFP("115000"), perpFP("100000"), priceFP("1"), priceFP("1.15")], - [perpFP("95"), perpFP("4.5"), perpFP("0.5")], + [perpFP("95"), perpFP("0.5")], ); }); }); @@ -281,7 +304,7 @@ describe("BillBroker", function () { it("should revert", async function () { const { billBroker, usd, perp } = await loadFixture(setupContracts); - await billBroker.updateARBounds([0n, ethers.MaxUint256], [0n, ethers.MaxUint256]); + await billBroker.updateARBounds([0n, ethers.MaxInt256], [0n, ethers.MaxInt256]); await usd.approve(billBroker.target, usdFP("115000")); await billBroker.swapUSDForPerps(usdFP("115000"), 0n); expect(await perp.balanceOf(billBroker.target)).to.eq(0n); @@ -298,7 +321,7 @@ describe("BillBroker", function () { it("should return the swap amount", async function () { const { billBroker, usd, perp } = await loadFixture(setupContracts); - await billBroker.updateARBounds([0n, ethers.MaxUint256], [0n, ethers.MaxUint256]); + await billBroker.updateARBounds([0n, ethers.MaxInt256], [0n, ethers.MaxInt256]); await perp.approve(billBroker.target, perpFP("100000")); await billBroker.swapPerpsForUSD(perpFP("100000"), 0n); expect(await usd.balanceOf(billBroker.target)).to.eq(0n); @@ -307,7 +330,7 @@ describe("BillBroker", function () { billBroker, usdFP("100"), [0n, perpFP("100000"), priceFP("1"), priceFP("1")], - [perpFP("100"), 0n, 0n], + [perpFP("100"), 0n], ); }); }); @@ -316,37 +339,37 @@ describe("BillBroker", function () { describe("#computePerpToUSDSwapAmt", function () { it("should return the perp amount and fees", async function () { const { billBroker } = await loadFixture(setupContracts); - await checkPerpTpUSDSwapAmt( + await checkPerpToUSDSwapAmt( billBroker, perpFP("100"), [usdFP("115000"), perpFP("100000"), priceFP("1"), priceFP("1.15")], - [usdFP("115"), 0n, 0n], + [usdFP("115"), 0n], ); }); it("should return the perp amount and fees", async function () { const { billBroker } = await loadFixture(setupContracts); - await checkPerpTpUSDSwapAmt( + await checkPerpToUSDSwapAmt( billBroker, perpFP("100"), [usdFP("110000"), perpFP("100000"), priceFP("1"), priceFP("1")], - [usdFP("100"), 0n, 0n], + [usdFP("100"), 0n], ); }); it("should return the perp amount and fees", async function () { const { billBroker } = await loadFixture(setupContracts); - await checkPerpTpUSDSwapAmt( + await checkPerpToUSDSwapAmt( billBroker, perpFP("14285"), [usdFP("100000"), perpFP("100000"), priceFP("1"), priceFP("1")], - [usdFP("14285"), 0n, 0n], + [usdFP("14285"), 0n], ); }); it("should return the perp amount and fees", async function () { const { billBroker } = await loadFixture(setupContracts); - await checkPerpTpUSDSwapAmt( + await checkPerpToUSDSwapAmt( billBroker, perpFP("14286"), [usdFP("100000"), perpFP("100000"), priceFP("1"), priceFP("1")], @@ -356,11 +379,11 @@ describe("BillBroker", function () { it("should return the perp amount and fees", async function () { const { billBroker } = await loadFixture(setupContracts); - await checkPerpTpUSDSwapAmt( + await checkPerpToUSDSwapAmt( billBroker, perpFP("100"), [usdFP("100000"), perpFP("100000"), priceFP("1"), priceFP("0.9")], - [usdFP("90"), 0n, 0n], + [usdFP("90"), 0n], ); }); @@ -368,80 +391,104 @@ describe("BillBroker", function () { it("should return the perp amount and fees", async function () { const { billBroker } = await loadFixture(setupContracts); await updateFees(billBroker, { - perpToUSDSwapFeePercs: { - lower: percentageFP("0.1"), - upper: percentageFP("0.5"), + perpToUSDSwapFeeFactors: { + lower: percFP("1.1"), + upper: percFP("1.2"), }, }); - await checkPerpTpUSDSwapAmt( + await checkPerpToUSDSwapAmt( billBroker, perpFP("100"), [usdFP("115000"), perpFP("100000"), priceFP("1"), priceFP("1.15")], - [usdFP("103.5"), usdFP("11.5"), 0n], + [usdFP("103.5"), 0n], ); }); it("should return the perp amount and fees", async function () { const { billBroker } = await loadFixture(setupContracts); await updateFees(billBroker, { - perpToUSDSwapFeePercs: { - lower: percentageFP("0.1"), - upper: percentageFP("0.5"), + perpToUSDSwapFeeFactors: { + lower: percFP("1.1"), + upper: percFP("1.2"), }, }); - await checkPerpTpUSDSwapAmt( + await checkPerpToUSDSwapAmt( billBroker, perpFP("100"), [usdFP("110000"), perpFP("100000"), priceFP("1"), priceFP("1")], - [usdFP("90"), usdFP("10"), 0n], + [usdFP("90"), 0n], ); }); it("should return the perp amount and fees", async function () { const { billBroker } = await loadFixture(setupContracts); await updateFees(billBroker, { - perpToUSDSwapFeePercs: { - lower: percentageFP("0.1"), - upper: percentageFP("0.5"), + perpToUSDSwapFeeFactors: { + lower: percFP("1.1"), + upper: percFP("1.2"), }, }); - await checkPerpTpUSDSwapAmt( + await checkPerpToUSDSwapAmt( billBroker, perpFP("14285"), [usdFP("100000"), perpFP("100000"), priceFP("1"), priceFP("1")], - [usdFP("11142.474991"), usdFP("3142.525009"), 0n], + [usdFP("12427.993747"), 0n], ); }); it("should return the perp amount and fees", async function () { const { billBroker } = await loadFixture(setupContracts); await updateFees(billBroker, { - perpToUSDSwapFeePercs: { - lower: percentageFP("0.1"), - upper: percentageFP("0.5"), + perpToUSDSwapFeeFactors: { + lower: percFP("1.1"), + upper: percFP("1.2"), }, }); - await checkPerpTpUSDSwapAmt( + await checkPerpToUSDSwapAmt( billBroker, perpFP("14286"), [usdFP("100000"), perpFP("100000"), priceFP("1"), priceFP("1")], - [0n, 0n, 0n], + [0n, 0n], ); }); it("should return the perp amount and fees", async function () { const { billBroker } = await loadFixture(setupContracts); await updateFees(billBroker, { - perpToUSDSwapFeePercs: { - lower: percentageFP("0.1"), - upper: percentageFP("0.5"), + perpToUSDSwapFeeFactors: { + lower: percFP("1.1"), + upper: percFP("1.2"), }, }); - await checkPerpTpUSDSwapAmt( + await checkPerpToUSDSwapAmt( billBroker, perpFP("100"), [usdFP("100000"), perpFP("100000"), priceFP("1"), priceFP("0.9")], - [usdFP("81"), usdFP("9"), 0n], + [usdFP("81.603396"), 0n], + ); + }); + + it("should return the perp amount and fees", async function () { + const { billBroker } = await loadFixture(setupContracts); + await updateFees(billBroker, { + perpToUSDSwapFeeFactors: { + lower: percFP("1.1"), + upper: percFP("1.2"), + }, + usdToPerpSwapFeeFactors: { + lower: percFP("1.025"), + upper: percFP("1.2"), + }, + }); + await billBroker.updateARBounds( + [percFP("0.25"), percFP("4")], + [percFP("0.01"), percFP("100")], + ); + await checkPerpToUSDSwapAmt( + billBroker, + perpFP("50000"), + [usdFP("100000"), perpFP("1000"), priceFP("1"), priceFP("1")], + [usdFP("52271.287128"), 0n], ); }); }); @@ -450,17 +497,17 @@ describe("BillBroker", function () { it("should return the perp amount and fees", async function () { const { billBroker } = await loadFixture(setupContracts); await updateFees(billBroker, { - perpToUSDSwapFeePercs: { - lower: percentageFP("0.1"), - upper: percentageFP("0.5"), + perpToUSDSwapFeeFactors: { + lower: percFP("1.1"), + upper: percFP("1.2"), }, - protocolSwapSharePerc: percentageFP("0.1"), + protocolSwapSharePerc: percFP("0.1"), }); - await checkPerpTpUSDSwapAmt( + await checkPerpToUSDSwapAmt( billBroker, perpFP("100"), [usdFP("110000"), perpFP("100000"), priceFP("1"), priceFP("1")], - [usdFP("90"), usdFP("9"), usdFP("1")], + [usdFP("90"), usdFP("1")], ); }); }); @@ -468,16 +515,16 @@ describe("BillBroker", function () { describe("when the pool has only usd", function () { it("should return the swap amount", async function () { const { billBroker, usd, perp } = await loadFixture(setupContracts); - await billBroker.updateARBounds([0n, ethers.MaxUint256], [0n, ethers.MaxUint256]); + await billBroker.updateARBounds([0n, ethers.MaxInt256], [0n, ethers.MaxInt256]); await usd.approve(billBroker.target, usdFP("115000")); await billBroker.swapUSDForPerps(usdFP("115000"), 0n); expect(await perp.balanceOf(billBroker.target)).to.eq(0n); - await checkPerpTpUSDSwapAmt( + await checkPerpToUSDSwapAmt( billBroker, perpFP("100"), [usdFP("100000"), 0n, priceFP("1"), priceFP("1")], - [usdFP("100"), 0n, 0n], + [usdFP("100"), 0n], ); }); }); @@ -485,7 +532,7 @@ describe("BillBroker", function () { describe("when the pool has only perps", function () { it("should return the swap amount", async function () { const { billBroker, usd, perp } = await loadFixture(setupContracts); - await billBroker.updateARBounds([0n, ethers.MaxUint256], [0n, ethers.MaxUint256]); + await billBroker.updateARBounds([0n, ethers.MaxInt256], [0n, ethers.MaxInt256]); await perp.approve(billBroker.target, perpFP("100000")); await billBroker.swapPerpsForUSD(perpFP("100000"), 0n); expect(await usd.balanceOf(billBroker.target)).to.eq(0n); @@ -529,15 +576,15 @@ describe("BillBroker", function () { describe("when oracle price is unreliable", function () { it("should revert", async function () { - const { billBroker, pricingStrategy } = await loadFixture(setupContracts); - await pricingStrategy.mockMethod("perpPrice()", [0n, false]); + const { billBroker, oracle } = await loadFixture(setupContracts); + await oracle.mockMethod("perpFmvUsdPrice()", [0n, false]); await expect( billBroker.swapUSDForPerps(usdFP("115"), perpFP("100")), ).to.be.revertedWithCustomError(billBroker, "UnreliablePrice"); }); it("should revert", async function () { - const { billBroker, pricingStrategy } = await loadFixture(setupContracts); - await pricingStrategy.mockMethod("usdPrice()", [0n, false]); + const { billBroker, oracle } = await loadFixture(setupContracts); + await oracle.mockMethod("usdPrice()", [0n, false]); await expect( billBroker.swapUSDForPerps(usdFP("115"), perpFP("100")), ).to.be.revertedWithCustomError(billBroker, "UnreliablePrice"); @@ -559,9 +606,9 @@ describe("BillBroker", function () { }); it("should increase the reserve ar", async function () { const { billBroker } = await loadFixture(setupContracts); - expect(await assetRatio(billBroker)).to.eq(percentageFP("1")); + expect(await assetRatio(billBroker)).to.eq(percFP("1")); await billBroker.swapUSDForPerps(usdFP("115"), perpFP("100")); - expect(await assetRatio(billBroker)).to.eq(percentageFP("1.002002002002002002")); + expect(await assetRatio(billBroker)).to.eq(percFP("1.002002002002002002")); }); it("should update the reserve", async function () { const { billBroker } = await loadFixture(setupContracts); @@ -584,9 +631,9 @@ describe("BillBroker", function () { it("should transfer usd from the user", async function () { const { billBroker, deployer, usd } = await loadFixture(setupContracts); await updateFees(billBroker, { - usdToPerpSwapFeePercs: { - lower: percentageFP("0.05"), - upper: percentageFP("0.5"), + usdToPerpSwapFeeFactors: { + lower: percFP("1.05"), + upper: percFP("1.2"), }, }); await expect(() => @@ -596,9 +643,9 @@ describe("BillBroker", function () { it("should transfer perps to the user", async function () { const { billBroker, deployer, perp } = await loadFixture(setupContracts); await updateFees(billBroker, { - usdToPerpSwapFeePercs: { - lower: percentageFP("0.05"), - upper: percentageFP("0.5"), + usdToPerpSwapFeeFactors: { + lower: percFP("1.05"), + upper: percFP("1.2"), }, }); await expect(() => @@ -608,21 +655,21 @@ describe("BillBroker", function () { it("should increase the reserve ar", async function () { const { billBroker } = await loadFixture(setupContracts); await updateFees(billBroker, { - usdToPerpSwapFeePercs: { - lower: percentageFP("0.05"), - upper: percentageFP("0.5"), + usdToPerpSwapFeeFactors: { + lower: percFP("1.05"), + upper: percFP("1.2"), }, }); - expect(await assetRatio(billBroker)).to.eq(percentageFP("1")); + expect(await assetRatio(billBroker)).to.eq(percFP("1")); await billBroker.swapUSDForPerps(usdFP("115"), perpFP("95")); - expect(await assetRatio(billBroker)).to.eq(percentageFP("1.001951854261548471")); + expect(await assetRatio(billBroker)).to.eq(percFP("1.001951854261548471")); }); it("should update the reserve", async function () { const { billBroker } = await loadFixture(setupContracts); await updateFees(billBroker, { - usdToPerpSwapFeePercs: { - lower: percentageFP("0.05"), - upper: percentageFP("0.5"), + usdToPerpSwapFeeFactors: { + lower: percFP("1.05"), + upper: percFP("1.2"), }, }); await billBroker.swapUSDForPerps(usdFP("115"), perpFP("95")); @@ -633,9 +680,9 @@ describe("BillBroker", function () { it("should emit SwapUSDForPerps", async function () { const { billBroker } = await loadFixture(setupContracts); await updateFees(billBroker, { - usdToPerpSwapFeePercs: { - lower: percentageFP("0.05"), - upper: percentageFP("0.5"), + usdToPerpSwapFeeFactors: { + lower: percFP("1.05"), + upper: percFP("1.2"), }, }); const r = await billBroker.reserveState.staticCall(); @@ -649,11 +696,11 @@ describe("BillBroker", function () { it("should transfer usd from the user", async function () { const { billBroker, deployer, usd } = await loadFixture(setupContracts); await updateFees(billBroker, { - usdToPerpSwapFeePercs: { - lower: percentageFP("0.05"), - upper: percentageFP("0.5"), + usdToPerpSwapFeeFactors: { + lower: percFP("1.05"), + upper: percFP("1.2"), }, - protocolSwapSharePerc: percentageFP("0.1"), + protocolSwapSharePerc: percFP("0.1"), }); await expect(() => billBroker.swapUSDForPerps(usdFP("115"), perpFP("95")), @@ -664,11 +711,11 @@ describe("BillBroker", function () { setupContracts, ); await updateFees(billBroker, { - usdToPerpSwapFeePercs: { - lower: percentageFP("0.05"), - upper: percentageFP("0.5"), + usdToPerpSwapFeeFactors: { + lower: percFP("1.05"), + upper: percFP("1.2"), }, - protocolSwapSharePerc: percentageFP("0.1"), + protocolSwapSharePerc: percFP("0.1"), }); await billBroker .connect(deployer) @@ -680,11 +727,11 @@ describe("BillBroker", function () { it("should transfer protocol fee to the owner", async function () { const { billBroker, perp, feeCollector } = await loadFixture(setupContracts); await updateFees(billBroker, { - usdToPerpSwapFeePercs: { - lower: percentageFP("0.05"), - upper: percentageFP("0.5"), + usdToPerpSwapFeeFactors: { + lower: percFP("1.05"), + upper: percFP("1.2"), }, - protocolSwapSharePerc: percentageFP("0.1"), + protocolSwapSharePerc: percFP("0.1"), }); await billBroker.transferOwnership(await feeCollector.getAddress()); await expect(() => @@ -694,24 +741,24 @@ describe("BillBroker", function () { it("should increase the reserve ar", async function () { const { billBroker } = await loadFixture(setupContracts); await updateFees(billBroker, { - usdToPerpSwapFeePercs: { - lower: percentageFP("0.05"), - upper: percentageFP("0.5"), + usdToPerpSwapFeeFactors: { + lower: percFP("1.05"), + upper: percFP("1.2"), }, - protocolSwapSharePerc: percentageFP("0.1"), + protocolSwapSharePerc: percFP("0.1"), }); - expect(await assetRatio(billBroker)).to.eq(percentageFP("1")); + expect(await assetRatio(billBroker)).to.eq(percFP("1")); await billBroker.swapUSDForPerps(usdFP("115"), perpFP("95")); - expect(await assetRatio(billBroker)).to.eq(percentageFP("1.001956868809713276")); + expect(await assetRatio(billBroker)).to.eq(percFP("1.001956868809713276")); }); it("should update the reserve", async function () { const { billBroker } = await loadFixture(setupContracts); await updateFees(billBroker, { - usdToPerpSwapFeePercs: { - lower: percentageFP("0.05"), - upper: percentageFP("0.5"), + usdToPerpSwapFeeFactors: { + lower: percFP("1.05"), + upper: percFP("1.2"), }, - protocolSwapSharePerc: percentageFP("0.1"), + protocolSwapSharePerc: percFP("0.1"), }); await billBroker.swapUSDForPerps(usdFP("115"), perpFP("95")); const r = await reserveState(billBroker); @@ -721,11 +768,11 @@ describe("BillBroker", function () { it("should emit SwapUSDForPerps", async function () { const { billBroker } = await loadFixture(setupContracts); await updateFees(billBroker, { - usdToPerpSwapFeePercs: { - lower: percentageFP("0.05"), - upper: percentageFP("0.5"), + usdToPerpSwapFeeFactors: { + lower: percFP("1.05"), + upper: percFP("1.2"), }, - protocolSwapSharePerc: percentageFP("0.1"), + protocolSwapSharePerc: percFP("0.1"), }); const r = await billBroker.reserveState.staticCall(); await expect(billBroker.swapUSDForPerps(usdFP("115"), perpFP("95"))) @@ -738,9 +785,9 @@ describe("BillBroker", function () { it("should transfer usd from the user", async function () { const { billBroker, deployer, usd } = await loadFixture(setupContracts); await updateFees(billBroker, { - usdToPerpSwapFeePercs: { - lower: percentageFP("0.05"), - upper: percentageFP("0.5"), + usdToPerpSwapFeeFactors: { + lower: percFP("1.05"), + upper: percFP("1.2"), }, }); await expect(() => @@ -750,9 +797,9 @@ describe("BillBroker", function () { it("should transfer perps to the user", async function () { const { billBroker, deployer, perp } = await loadFixture(setupContracts); await updateFees(billBroker, { - usdToPerpSwapFeePercs: { - lower: percentageFP("0.05"), - upper: percentageFP("0.5"), + usdToPerpSwapFeeFactors: { + lower: percFP("1.05"), + upper: percFP("1.2"), }, }); await expect(() => @@ -763,21 +810,21 @@ describe("BillBroker", function () { it("should increase the reserve ar", async function () { const { billBroker } = await loadFixture(setupContracts); await updateFees(billBroker, { - usdToPerpSwapFeePercs: { - lower: percentageFP("0.05"), - upper: percentageFP("0.5"), + usdToPerpSwapFeeFactors: { + lower: percFP("1.05"), + upper: percFP("1.2"), }, }); - expect(await assetRatio(billBroker)).to.eq(percentageFP("1")); + expect(await assetRatio(billBroker)).to.eq(percFP("1")); await billBroker.swapUSDForPerps(usdFP("3795"), perpFP("3130")); - expect(await assetRatio(billBroker)).to.eq(percentageFP("1.066432664016930779")); + expect(await assetRatio(billBroker)).to.eq(percFP("1.066432664016930779")); }); it("should update the reserve", async function () { const { billBroker } = await loadFixture(setupContracts); await updateFees(billBroker, { - usdToPerpSwapFeePercs: { - lower: percentageFP("0.05"), - upper: percentageFP("0.5"), + usdToPerpSwapFeeFactors: { + lower: percFP("1.05"), + upper: percFP("1.2"), }, }); await billBroker.swapUSDForPerps(usdFP("3795"), perpFP("3130")); @@ -788,9 +835,9 @@ describe("BillBroker", function () { it("should emit SwapUSDForPerps", async function () { const { billBroker } = await loadFixture(setupContracts); await updateFees(billBroker, { - usdToPerpSwapFeePercs: { - lower: percentageFP("0.05"), - upper: percentageFP("0.5"), + usdToPerpSwapFeeFactors: { + lower: percFP("1.05"), + upper: percFP("1.2"), }, }); const r = await billBroker.reserveState.staticCall(); @@ -804,13 +851,13 @@ describe("BillBroker", function () { it("should revert", async function () { const { billBroker } = await loadFixture(setupContracts); await billBroker.updateARBounds( - [percentageFP("0.8"), percentageFP("1")], - [percentageFP("0.75"), percentageFP("1.05")], + [percFP("0.8"), percFP("1")], + [percFP("0.75"), percFP("1.05")], ); await updateFees(billBroker, { - usdToPerpSwapFeePercs: { - lower: percentageFP("0.05"), - upper: percentageFP("0.5"), + usdToPerpSwapFeeFactors: { + lower: percFP("1.05"), + upper: percFP("1.2"), }, }); await expect( @@ -822,7 +869,7 @@ describe("BillBroker", function () { describe("when the pool has only usd", function () { it("should revert", async function () { const { billBroker, usd, perp } = await loadFixture(setupContracts); - await billBroker.updateARBounds([0n, ethers.MaxUint256], [0n, ethers.MaxUint256]); + await billBroker.updateARBounds([0n, ethers.MaxInt256], [0n, ethers.MaxInt256]); await usd.approve(billBroker.target, usdFP("115000")); await billBroker.swapUSDForPerps(usdFP("115000"), 0n); expect(await perp.balanceOf(billBroker.target)).to.eq(0n); @@ -836,7 +883,7 @@ describe("BillBroker", function () { describe("when the pool has only perps", function () { it("should execute swap", async function () { const { billBroker, usd, perp, deployer } = await loadFixture(setupContracts); - await billBroker.updateARBounds([0n, ethers.MaxUint256], [0n, ethers.MaxUint256]); + await billBroker.updateARBounds([0n, ethers.MaxInt256], [0n, ethers.MaxInt256]); await perp.approve(billBroker.target, perpFP("100000")); await billBroker.swapPerpsForUSD(perpFP("100000"), 0n); expect(await usd.balanceOf(billBroker.target)).to.eq(0n); @@ -879,15 +926,15 @@ describe("BillBroker", function () { describe("when oracle price is unreliable", function () { it("should revert", async function () { - const { billBroker, pricingStrategy } = await loadFixture(setupContracts); - await pricingStrategy.mockMethod("perpPrice()", [0n, false]); + const { billBroker, oracle } = await loadFixture(setupContracts); + await oracle.mockMethod("perpFmvUsdPrice()", [0n, false]); await expect( billBroker.swapPerpsForUSD(perpFP("115"), usdFP("100")), ).to.be.revertedWithCustomError(billBroker, "UnreliablePrice"); }); it("should revert", async function () { - const { billBroker, pricingStrategy } = await loadFixture(setupContracts); - await pricingStrategy.mockMethod("usdPrice()", [0n, false]); + const { billBroker, oracle } = await loadFixture(setupContracts); + await oracle.mockMethod("usdPrice()", [0n, false]); await expect( billBroker.swapPerpsForUSD(perpFP("115"), usdFP("100")), ).to.be.revertedWithCustomError(billBroker, "UnreliablePrice"); @@ -910,9 +957,9 @@ describe("BillBroker", function () { it("should decrease the reserve ar", async function () { const { billBroker } = await loadFixture(setupContracts); - expect(await assetRatio(billBroker)).to.eq(percentageFP("1")); + expect(await assetRatio(billBroker)).to.eq(percFP("1")); await billBroker.swapPerpsForUSD(perpFP("100"), usdFP("115")); - expect(await assetRatio(billBroker)).to.eq(percentageFP("0.998001998001998001")); + expect(await assetRatio(billBroker)).to.eq(percFP("0.998001998001998001")); }); it("should update the reserve", async function () { const { billBroker } = await loadFixture(setupContracts); @@ -934,9 +981,9 @@ describe("BillBroker", function () { it("should transfer perps from the user", async function () { const { billBroker, deployer, perp } = await loadFixture(setupContracts); await updateFees(billBroker, { - perpToUSDSwapFeePercs: { - lower: percentageFP("0.1"), - upper: percentageFP("0.5"), + perpToUSDSwapFeeFactors: { + lower: percFP("1.1"), + upper: percFP("1.2"), }, }); await expect(() => @@ -946,9 +993,9 @@ describe("BillBroker", function () { it("should transfer usd to the user", async function () { const { billBroker, deployer, usd } = await loadFixture(setupContracts); await updateFees(billBroker, { - perpToUSDSwapFeePercs: { - lower: percentageFP("0.1"), - upper: percentageFP("0.5"), + perpToUSDSwapFeeFactors: { + lower: percFP("1.1"), + upper: percFP("1.2"), }, }); await expect(() => @@ -958,21 +1005,21 @@ describe("BillBroker", function () { it("should increase the reserve ar", async function () { const { billBroker } = await loadFixture(setupContracts); await updateFees(billBroker, { - perpToUSDSwapFeePercs: { - lower: percentageFP("0.1"), - upper: percentageFP("0.5"), + perpToUSDSwapFeeFactors: { + lower: percFP("1.1"), + upper: percFP("1.2"), }, }); - expect(await assetRatio(billBroker)).to.eq(percentageFP("1")); + expect(await assetRatio(billBroker)).to.eq(percFP("1")); await billBroker.swapPerpsForUSD(perpFP("100"), usdFP("103")); - expect(await assetRatio(billBroker)).to.eq(percentageFP("0.998101898101898101")); + expect(await assetRatio(billBroker)).to.eq(percFP("0.998101898101898101")); }); it("should update the reserve", async function () { const { billBroker } = await loadFixture(setupContracts); await updateFees(billBroker, { - perpToUSDSwapFeePercs: { - lower: percentageFP("0.1"), - upper: percentageFP("0.5"), + perpToUSDSwapFeeFactors: { + lower: percFP("1.1"), + upper: percFP("1.2"), }, }); await billBroker.swapPerpsForUSD(perpFP("100"), usdFP("103")); @@ -983,9 +1030,9 @@ describe("BillBroker", function () { it("should emit SwapPerpsForUSD", async function () { const { billBroker } = await loadFixture(setupContracts); await updateFees(billBroker, { - perpToUSDSwapFeePercs: { - lower: percentageFP("0.1"), - upper: percentageFP("0.5"), + perpToUSDSwapFeeFactors: { + lower: percFP("1.1"), + upper: percFP("1.2"), }, }); const r = await billBroker.reserveState.staticCall(); @@ -999,11 +1046,11 @@ describe("BillBroker", function () { it("should transfer perps from the user", async function () { const { billBroker, deployer, perp } = await loadFixture(setupContracts); await updateFees(billBroker, { - perpToUSDSwapFeePercs: { - lower: percentageFP("0.1"), - upper: percentageFP("0.5"), + perpToUSDSwapFeeFactors: { + lower: percFP("1.1"), + upper: percFP("1.2"), }, - protocolSwapSharePerc: percentageFP("0.1"), + protocolSwapSharePerc: percFP("0.1"), }); await expect(() => billBroker.swapPerpsForUSD(perpFP("100"), usdFP("103")), @@ -1014,11 +1061,11 @@ describe("BillBroker", function () { setupContracts, ); await updateFees(billBroker, { - perpToUSDSwapFeePercs: { - lower: percentageFP("0.1"), - upper: percentageFP("0.5"), + perpToUSDSwapFeeFactors: { + lower: percFP("1.1"), + upper: percFP("1.2"), }, - protocolSwapSharePerc: percentageFP("0.1"), + protocolSwapSharePerc: percFP("0.1"), }); await billBroker.transferOwnership(await feeCollector.getAddress()); await expect(() => @@ -1028,11 +1075,11 @@ describe("BillBroker", function () { it("should transfer protocol fee to the owner", async function () { const { billBroker, usd, feeCollector } = await loadFixture(setupContracts); await updateFees(billBroker, { - perpToUSDSwapFeePercs: { - lower: percentageFP("0.1"), - upper: percentageFP("0.5"), + perpToUSDSwapFeeFactors: { + lower: percFP("1.1"), + upper: percFP("1.2"), }, - protocolSwapSharePerc: percentageFP("0.1"), + protocolSwapSharePerc: percFP("0.1"), }); await billBroker.transferOwnership(await feeCollector.getAddress()); await expect(() => @@ -1042,24 +1089,24 @@ describe("BillBroker", function () { it("should increase the reserve ar", async function () { const { billBroker } = await loadFixture(setupContracts); await updateFees(billBroker, { - perpToUSDSwapFeePercs: { - lower: percentageFP("0.1"), - upper: percentageFP("0.5"), + perpToUSDSwapFeeFactors: { + lower: percFP("1.1"), + upper: percFP("1.2"), }, - protocolSwapSharePerc: percentageFP("0.1"), + protocolSwapSharePerc: percFP("0.1"), }); - expect(await assetRatio(billBroker)).to.eq(percentageFP("1")); + expect(await assetRatio(billBroker)).to.eq(percFP("1")); await billBroker.swapPerpsForUSD(perpFP("100"), usdFP("103")); - expect(await assetRatio(billBroker)).to.eq(percentageFP("0.998091908091908091")); + expect(await assetRatio(billBroker)).to.eq(percFP("0.998091908091908091")); }); it("should update the reserve", async function () { const { billBroker } = await loadFixture(setupContracts); await updateFees(billBroker, { - perpToUSDSwapFeePercs: { - lower: percentageFP("0.1"), - upper: percentageFP("0.5"), + perpToUSDSwapFeeFactors: { + lower: percFP("1.1"), + upper: percFP("1.2"), }, - protocolSwapSharePerc: percentageFP("0.1"), + protocolSwapSharePerc: percFP("0.1"), }); await billBroker.swapPerpsForUSD(perpFP("100"), usdFP("103")); const r = await reserveState(billBroker); @@ -1069,11 +1116,11 @@ describe("BillBroker", function () { it("should emit SwapPerpsForUSD", async function () { const { billBroker } = await loadFixture(setupContracts); await updateFees(billBroker, { - perpToUSDSwapFeePercs: { - lower: percentageFP("0.1"), - upper: percentageFP("0.5"), + perpToUSDSwapFeeFactors: { + lower: percFP("1.1"), + upper: percFP("1.2"), }, - protocolSwapSharePerc: percentageFP("0.1"), + protocolSwapSharePerc: percFP("0.1"), }); const r = await billBroker.reserveState.staticCall(); await expect(billBroker.swapPerpsForUSD(perpFP("100"), usdFP("103"))) @@ -1086,9 +1133,9 @@ describe("BillBroker", function () { it("should transfer perps from the user", async function () { const { billBroker, deployer, perp } = await loadFixture(setupContracts); await updateFees(billBroker, { - perpToUSDSwapFeePercs: { - lower: percentageFP("0.1"), - upper: percentageFP("0.5"), + perpToUSDSwapFeeFactors: { + lower: percFP("1.1"), + upper: percFP("1.2"), }, }); await expect(() => @@ -1098,9 +1145,9 @@ describe("BillBroker", function () { it("should transfer usd to the user", async function () { const { billBroker, deployer, usd } = await loadFixture(setupContracts); await updateFees(billBroker, { - perpToUSDSwapFeePercs: { - lower: percentageFP("0.1"), - upper: percentageFP("0.5"), + perpToUSDSwapFeeFactors: { + lower: percFP("1.1"), + upper: percFP("1.2"), }, }); await expect(() => @@ -1110,21 +1157,21 @@ describe("BillBroker", function () { it("should decrease the reserve ar", async function () { const { billBroker } = await loadFixture(setupContracts); await updateFees(billBroker, { - perpToUSDSwapFeePercs: { - lower: percentageFP("0.1"), - upper: percentageFP("0.5"), + perpToUSDSwapFeeFactors: { + lower: percFP("1.1"), + upper: percFP("1.2"), }, }); - expect(await assetRatio(billBroker)).to.eq(percentageFP("1")); + expect(await assetRatio(billBroker)).to.eq(percFP("1")); await billBroker.swapPerpsForUSD(perpFP("3600"), usdFP("3700")); - expect(await assetRatio(billBroker)).to.eq(percentageFP("0.933976833976833976")); + expect(await assetRatio(billBroker)).to.eq(percFP("0.933976833976833976")); }); it("should update the reserve", async function () { const { billBroker } = await loadFixture(setupContracts); await updateFees(billBroker, { - perpToUSDSwapFeePercs: { - lower: percentageFP("0.1"), - upper: percentageFP("0.5"), + perpToUSDSwapFeeFactors: { + lower: percFP("1.1"), + upper: percFP("1.2"), }, }); await billBroker.swapPerpsForUSD(perpFP("3600"), usdFP("3700")); @@ -1138,13 +1185,13 @@ describe("BillBroker", function () { it("should revert", async function () { const { billBroker } = await loadFixture(setupContracts); await billBroker.updateARBounds( - [percentageFP("1"), percentageFP("1.1")], - [percentageFP("0.95"), percentageFP("1.25")], + [percFP("1"), percFP("1.1")], + [percFP("0.95"), percFP("1.25")], ); await updateFees(billBroker, { - perpToUSDSwapFeePercs: { - lower: percentageFP("0.1"), - upper: percentageFP("0.5"), + perpToUSDSwapFeeFactors: { + lower: percFP("1.1"), + upper: percFP("1.2"), }, }); await expect( @@ -1154,11 +1201,11 @@ describe("BillBroker", function () { it("should emit SwapPerpsForUSD", async function () { const { billBroker } = await loadFixture(setupContracts); await updateFees(billBroker, { - perpToUSDSwapFeePercs: { - lower: percentageFP("0.1"), - upper: percentageFP("0.5"), + perpToUSDSwapFeeFactors: { + lower: percFP("1.1"), + upper: percFP("1.2"), }, - protocolSwapSharePerc: percentageFP("0.1"), + protocolSwapSharePerc: percFP("0.1"), }); const r = await billBroker.reserveState.staticCall(); await expect(billBroker.swapPerpsForUSD(perpFP("5000"), usdFP("4000"))) @@ -1170,7 +1217,7 @@ describe("BillBroker", function () { describe("when the pool has only usd", function () { it("should execute swap", async function () { const { billBroker, usd, perp, deployer } = await loadFixture(setupContracts); - await billBroker.updateARBounds([0n, ethers.MaxUint256], [0n, ethers.MaxUint256]); + await billBroker.updateARBounds([0n, ethers.MaxInt256], [0n, ethers.MaxInt256]); await usd.approve(billBroker.target, usdFP("115000")); await billBroker.swapUSDForPerps(usdFP("115000"), 0n); expect(await perp.balanceOf(billBroker.target)).to.eq(0n); @@ -1185,7 +1232,7 @@ describe("BillBroker", function () { describe("when the pool has only perps", function () { it("should revert", async function () { const { billBroker, usd, perp } = await loadFixture(setupContracts); - await billBroker.updateARBounds([0n, ethers.MaxUint256], [0n, ethers.MaxUint256]); + await billBroker.updateARBounds([0n, ethers.MaxInt256], [0n, ethers.MaxInt256]); await perp.approve(billBroker.target, perpFP("100000")); await billBroker.swapPerpsForUSD(perpFP("100000"), 0n); expect(await usd.balanceOf(billBroker.target)).to.eq(0n); diff --git a/spot-vaults/test/LineHelpers.ts b/spot-vaults/test/LineHelpers.ts new file mode 100644 index 00000000..b3ec16d6 --- /dev/null +++ b/spot-vaults/test/LineHelpers.ts @@ -0,0 +1,310 @@ +import { expect } from "chai"; +import { ethers } from "hardhat"; +import { Contract } from "ethers"; + +// AI generated +describe("LineHelpers", function () { + let testLineHelpers: Contract; + + // Deploy the test contract before running the suite + before(async () => { + const LineHelpersTester = await ethers.getContractFactory("LineHelpersTester"); + testLineHelpers = await LineHelpersTester.deploy(); + }); + + // + // Helper for constructing the `Line` struct in TypeScript + // + function makeLine(x1: number, y1: number, x2: number, y2: number) { + return { x1, y1, x2, y2 }; + } + + // + // Helper for constructing the `Range` struct in TypeScript + // + function makeRange(lower: number, upper: number) { + return { lower, upper }; + } + + // --------------------------------------------------------------------- + // 1. Tests for `avgY` + // --------------------------------------------------------------------- + describe("avgY", function () { + it("handles zero slope correctly", async () => { + const fn = makeLine(0, 100, 10, 100); // zero slope + const yAvg = await testLineHelpers.testAvgY(fn, 0, 10); + expect(yAvg).to.equal(100); + + // Subrange + const yAvgSub = await testLineHelpers.testAvgY(fn, 2, 5); + expect(yAvgSub).to.equal(100); + }); + + it("handles positive slope", async () => { + // slope = (200 - 100)/(10 - 0) = 10 + const fn = makeLine(0, 100, 10, 200); + // avg from x=0..10 => (100 + 200)/2 = 150 + const yAvg = await testLineHelpers.testAvgY(fn, 0, 10); + expect(yAvg).to.equal(150); + }); + + it("handles negative slope", async () => { + // slope = (50 - 100)/(10 - 0) = -5 + const fn = makeLine(0, 100, 10, 50); + // avg from x=0..10 => (100 + 50)/2 = 75 + const yAvg = await testLineHelpers.testAvgY(fn, 0, 10); + expect(yAvg).to.equal(75); + }); + + it("handles partial subrange", async () => { + // slope = 10 + // from x=2 => y=120, x=5 => y=150 => avg=135 + const fn = makeLine(0, 100, 10, 200); + const yAvg = await testLineHelpers.testAvgY(fn, 2, 5); + expect(yAvg).to.equal(135); + }); + }); + + // --------------------------------------------------------------------- + // 2. Tests for `computeY` + // --------------------------------------------------------------------- + describe("computeY", function () { + it("handles zero slope", async () => { + const fn = makeLine(0, 100, 10, 100); + const yAt5 = await testLineHelpers.testComputeY(fn, 5); + expect(yAt5).to.equal(100); + }); + + it("handles positive slope", async () => { + // slope=10 => line eq: y=10*x + 100 + const fn = makeLine(0, 100, 10, 200); + const yAt5 = await testLineHelpers.testComputeY(fn, 5); + expect(yAt5).to.equal(150); + }); + + it("handles negative slope", async () => { + // slope=-5 => line eq: y=-5*x + 100 + const fn = makeLine(0, 100, 10, 50); + const yAt2 = await testLineHelpers.testComputeY(fn, 2); + expect(yAt2).to.equal(90); + }); + }); + + // --------------------------------------------------------------------- + // 3. Tests for `computePiecewiseAvgY` + // --------------------------------------------------------------------- + describe("computePiecewiseAvgY", function () { + // Reusable lines and ranges in multiple tests + let fn1, fn2, fn3; + let xBreakPt; + + beforeEach(async () => { + fn1 = makeLine(0, 50, 10, 100); + fn2 = makeLine(0, 100, 10, 200); + fn3 = makeLine(0, 200, 10, 300); + xBreakPt = makeRange(2, 8); + }); + + it("reverts when xRange.lower > xRange.upper", async () => { + const xRange = makeRange(10, 5); // invalid + await expect( + testLineHelpers.testComputePiecewiseAvgY(fn1, fn2, fn3, xBreakPt, xRange), + ).to.be.revertedWithCustomError(testLineHelpers, "InvalidRange"); + }); + + it("reverts when xRange straddles from below to above breakpoints", async () => { + // crosses [2..8] from 1..9 + const xRange = makeRange(1, 9); + await expect( + testLineHelpers.testComputePiecewiseAvgY(fn1, fn2, fn3, xBreakPt, xRange), + ).to.be.revertedWithCustomError(testLineHelpers, "UnexpectedRangeDelta"); + }); + + it("uses fn1 entirely when xRange is below xBreakPt.lower", async () => { + // xBreakPt= [2..8], xRange= [0..1] + const localBreak = makeRange(2, 8); + const localRange = makeRange(0, 1); + const localFn1 = makeLine(0, 50, 10, 70); // slope ~ 2/unit + const localFn2 = makeLine(10, 60, 20, 200); + const localFn3 = makeLine(20, 200, 30, 500); + + const result = await testLineHelpers.testComputePiecewiseAvgY( + localFn1, + localFn2, + localFn3, + localBreak, + localRange, + ); + expect(result).to.equal(51); + }); + + it("uses fn3 entirely when xRange is above xBreakPt.upper", async () => { + // xBreakPt= [2..8], xRange= [9..10] + const localBreak = makeRange(2, 8); + const localRange = makeRange(9, 10); + + // fn3 from (8,200) to (10,300) + // y(9)=250, y(10)=300 => avg=275 + const localFn1 = makeLine(0, 0, 10, 0); + const localFn2 = makeLine(10, 0, 20, 100); + const localFn3 = makeLine(8, 200, 10, 300); + + const result = await testLineHelpers.testComputePiecewiseAvgY( + localFn1, + localFn2, + localFn3, + localBreak, + localRange, + ); + expect(result).to.equal(275); + }); + + it("splits range across fn1 & fn2 when straddling xBreakPt.lower", async () => { + // xBreakPt= [2..8], xRange= [1..5] + const localBreak = makeRange(2, 8); + const localRange = makeRange(1, 5); + + // fn1 => (0,10)->(2,30), slope=10 + // x=1 => y=20, x=2 => y=30 => avg=25 + // fn2 => (2,30)->(8,90), slope=10 + // x=2 => y=30, x=5 => y=60 => avg=45 + // Weighted sum => (25*1) + (45*3)=160 => /4=40 + const localFn1 = makeLine(0, 10, 2, 30); + const localFn2 = makeLine(2, 30, 8, 90); + const localFn3 = makeLine(8, 90, 10, 100); + + const result = await testLineHelpers.testComputePiecewiseAvgY( + localFn1, + localFn2, + localFn3, + localBreak, + localRange, + ); + expect(result).to.equal(40); + }); + + it("splits range across fn2 & fn3 when straddling xBreakPt.upper", async () => { + // xBreakPt= [2..8], xRange= [5..9] + const localBreak = makeRange(2, 8); + const localRange = makeRange(5, 9); + + // fn2 => (2,30)->(8,90), slope=10 + // x=5 => y=60, x=8 => y=90 => avg=75 + // fn3 => (8,90)->(10,110), slope=10 + // x=8 => y=90, x=9 => y=100 => avg=95 + // Weighted sum => (75*3)+(95*1)=320 => /4=80 + const localFn1 = makeLine(0, 10, 2, 30); + const localFn2 = makeLine(2, 30, 8, 90); + const localFn3 = makeLine(8, 90, 10, 110); + + const result = await testLineHelpers.testComputePiecewiseAvgY( + localFn1, + localFn2, + localFn3, + localBreak, + localRange, + ); + expect(result).to.equal(80); + }); + + it("uses only fn2 when xRange is fully within breakpoints", async () => { + // xBreakPt= [2..8], xRange= [3..7] + // fn2 => (2,20)->(8,80), slope=10 + // x=3 => y=30, x=7 => y=70 => avg=50 + const localBreak = makeRange(2, 8); + const localRange = makeRange(3, 7); + + const localFn1 = makeLine(0, 10, 2, 20); + const localFn2 = makeLine(2, 20, 8, 80); + const localFn3 = makeLine(8, 80, 10, 100); + + const result = await testLineHelpers.testComputePiecewiseAvgY( + localFn1, + localFn2, + localFn3, + localBreak, + localRange, + ); + expect(result).to.equal(50); + }); + + it("handles zero-length xRange exactly at xBreakPt.lower", async () => { + // xRange= [2..2] => a single x-value + // Expect to take fn1 vs fn2? + // Typically, a single x==2 is the boundary => By definition, + // if `upper <= breakPt.lower` => we are in fn1 + // OR if `lower >= breakPt.lower` => we might be in fn2. + // This might require clarity in your design or the function. + // For demonstration, let's assume we define: + // if x == bpl => treat as fn2 (since "below" is strictly < bpl). + const localRange = makeRange(2, 2); + // We'll set the lines so we can easily compute y(2). + const localFn1 = makeLine(0, 10, 2, 30); // y(2)=30 + const localFn2 = makeLine(2, 30, 8, 90); // y(2)=30 + // We'll see which one the code picks based on your piecewise logic + // For a zero-length range, the "average" is just y(2). + + const result = await testLineHelpers.testComputePiecewiseAvgY( + localFn1, + localFn2, + fn3, + xBreakPt, + localRange, + ); + // Depending on your code logic: + // If your code lumps x=breakPt.lower in fn1, expect 30 + // If lumps it in fn2, also 30 in this example (coincidentally the same). + // If you want to ensure it's definitely fn2, you could change lines: + // localFn2 = makeLine(2, 50, 8, 90) => y(2)=50 + // Then check if result==50 => means it's definitely fn2. + expect(result).to.equal(30); + }); + + it("handles zero-length xRange exactly at xBreakPt.upper", async () => { + // xBreakPt= [2..8], xRange= [8..8] + // Single point at x=8 + // By your design, x=8 could be considered "upper edge" of fn2 or "start" of fn3. + const localRange = makeRange(8, 8); + + // Distinguish the lines so we can confirm which is used + const localFn2 = makeLine(2, 20, 8, 80); // y(8)=80 + const localFn3 = makeLine(8, 999, 10, 1000); // y(8)=999 + + const result = await testLineHelpers.testComputePiecewiseAvgY( + fn1, + localFn2, + localFn3, + xBreakPt, + localRange, + ); + // Depending on how your piecewise function is coded: + // - If x=breakPt.upper is still "within" fn2 => expect 80 + // - If your code lumps it with fn3 => expect 999 + // In *your* logic, it looks like "if (xRange.lower <= bpu && xRange.upper > bpu)" + // is the condition for partial in fn2/fn3. + // But here, 8..8 is exactly <=bpu and not >bpu => might remain in fn2 + // So I'd expect 80 given the code snippet above. + expect(result).to.equal(80); + }); + + it("uses only fn2 when xRange = xBreakPt exactly", async () => { + // xRange= [2..8], which is exactly the break range + // Should use fn2 entirely, no partial + const localRange = makeRange(2, 8); + // We'll define fn2 so we can test the integral average from 2..8 + // Let's pick slope=10 again => + // y(2)=20, y(8)=80 => average => (20+80)/2=50 + const localFn2 = makeLine(2, 20, 8, 80); + + const result = await testLineHelpers.testComputePiecewiseAvgY( + fn1, + localFn2, + fn3, + xBreakPt, + localRange, + ); + // If the code lumps [2..8] wholly into fn2, we get 50 + expect(result).to.equal(50); + }); + }); +}); diff --git a/spot-vaults/test/SpotAppraiser.ts b/spot-vaults/test/SpotAppraiser.ts deleted file mode 100644 index 80f1e85b..00000000 --- a/spot-vaults/test/SpotAppraiser.ts +++ /dev/null @@ -1,277 +0,0 @@ -import { ethers } from "hardhat"; -import { loadFixture } from "@nomicfoundation/hardhat-toolbox/network-helpers"; -import { expect } from "chai"; -import { oracleAnsFP, perpFP, percentageFP, priceFP, DMock } from "./helpers"; - -const nowTS = () => parseInt(Date.now() / 1000); - -describe("SpotAppraiser", function () { - async function setupContracts() { - const accounts = await ethers.getSigners(); - const deployer = accounts[0]; - - const amplTargetOracle = new DMock("MedianOracle"); - await amplTargetOracle.deploy(); - await amplTargetOracle.mockMethod("getData()", [priceFP("1.15"), true]); - await amplTargetOracle.mockMethod("DECIMALS()", [18]); - - const policy = new DMock("UFragmentsPolicy"); - await policy.deploy(); - await policy.mockMethod("cpiOracle()", [amplTargetOracle.target]); - - const ampl = new DMock("UFragments"); - await ampl.deploy(); - await ampl.mockMethod("decimals()", [9]); - await ampl.mockMethod("monetaryPolicy()", [policy.target]); - - const bond = new DMock("BondController"); - await bond.deploy(); - await bond.mockMethod("isMature()", [false]); - await bond.mockMethod("trancheCount()", [2]); - await bond.mockMethod("totalDebt()", [perpFP("500000")]); - await ampl.mockCall("balanceOf(address)", [bond.target], [perpFP("500000")]); - - const tranche = new DMock("Tranche"); - await tranche.deploy(); - await tranche.mockMethod("bond()", [bond.target]); - await tranche.mockMethod("totalSupply()", [perpFP("100000")]); - await bond.mockCall("tranches(uint256)", [0], [tranche.target, 200]); - await bond.mockCall("tranches(uint256)", [1], [ethers.ZeroAddress, 800]); - - const spot = new DMock("PerpetualTranche"); - await spot.deploy(); - await spot.mockMethod("underlying()", [ampl.target]); - await spot.mockMethod("getTVL()", [perpFP("1000000")]); - await spot.mockMethod("totalSupply()", [perpFP("1000000")]); - await spot.mockMethod("deviationRatio()", [oracleAnsFP("1.5")]); - await spot.mockMethod("getReserveCount()", [2]); - await spot.mockCall("getReserveAt(uint256)", [0], [ampl.target]); - await spot.mockCall("getReserveAt(uint256)", [1], [tranche.target]); - await ampl.mockCall("balanceOf(address)", [spot.target], [perpFP("1000")]); - - const usdPriceOrcle = new DMock("IChainlinkOracle"); - await usdPriceOrcle.deploy(); - await usdPriceOrcle.mockMethod("decimals()", [8]); - await usdPriceOrcle.mockMethod("latestRoundData()", [ - 0, - oracleAnsFP("1"), - 0, - nowTS(), - 0, - ]); - - const SpotAppraiser = await ethers.getContractFactory("SpotAppraiser"); - const strategy = await SpotAppraiser.deploy( - spot.target, - usdPriceOrcle.target, - amplTargetOracle.target, - ); - return { - deployer, - ampl, - spot, - usdPriceOrcle, - amplTargetOracle, - bond, - tranche, - strategy, - }; - } - - describe("init", function () { - it("should initial params", async function () { - const { deployer, strategy, ampl, spot, usdPriceOrcle, amplTargetOracle } = - await loadFixture(setupContracts); - expect(await strategy.AMPL()).to.eq(ampl.target); - expect(await strategy.SPOT()).to.eq(spot.target); - expect(await strategy.USD_ORACLE()).to.eq(usdPriceOrcle.target); - expect(await strategy.AMPL_CPI_ORACLE()).to.eq(amplTargetOracle.target); - expect(await strategy.AMPL_DUST_AMT()).to.eq(perpFP("25000")); - expect(await strategy.minSPOTDR()).to.eq(percentageFP("0.8")); - expect(await strategy.minSeniorCDR()).to.eq(percentageFP("1.1")); - expect(await strategy.owner()).to.eq(await deployer.getAddress()); - expect(await strategy.decimals()).to.eq(18); - }); - }); - - describe("#updateMinSPOTDR", function () { - describe("when triggered by non-owner", function () { - it("should revert", async function () { - const { strategy } = await loadFixture(setupContracts); - await strategy.renounceOwnership(); - await expect(strategy.updateMinSPOTDR(percentageFP("1.15"))).to.be.revertedWith( - "Ownable: caller is not the owner", - ); - }); - }); - - describe("when triggered by owner", function () { - it("should update value", async function () { - const { strategy } = await loadFixture(setupContracts); - await strategy.updateMinSPOTDR(percentageFP("1.15")); - expect(await strategy.minSPOTDR()).to.eq(percentageFP("1.15")); - }); - }); - }); - - describe("#updateMinPerpCollateralCDR", function () { - describe("when triggered by non-owner", function () { - it("should revert", async function () { - const { strategy } = await loadFixture(setupContracts); - await strategy.renounceOwnership(); - await expect( - strategy.updateMinPerpCollateralCDR(percentageFP("1.25")), - ).to.be.revertedWith("Ownable: caller is not the owner"); - }); - }); - - describe("when cdr is invalid", function () { - it("should revert", async function () { - const { strategy } = await loadFixture(setupContracts); - await expect( - strategy.updateMinPerpCollateralCDR(percentageFP("0.9")), - ).to.be.revertedWithCustomError(strategy, "InvalidSeniorCDRBound"); - }); - }); - - describe("when triggered by owner", function () { - it("should update value", async function () { - const { strategy } = await loadFixture(setupContracts); - await strategy.updateMinPerpCollateralCDR(percentageFP("1.25")); - expect(await strategy.minSeniorCDR()).to.eq(percentageFP("1.25")); - }); - }); - }); - - describe("#usdPrice", function () { - describe("when data is stale", function () { - it("should return invalid", async function () { - const { strategy, usdPriceOrcle } = await loadFixture(setupContracts); - await usdPriceOrcle.mockMethod("latestRoundData()", [ - 0, - oracleAnsFP("1"), - 0, - nowTS() - 50 * 3600, - 0, - ]); - const p = await strategy.usdPrice(); - expect(p[0]).to.eq(priceFP("1")); - expect(p[1]).to.eq(false); - }); - }); - - describe("when oracle price is below thresh", function () { - it("should return invalid", async function () { - const { strategy, usdPriceOrcle } = await loadFixture(setupContracts); - await usdPriceOrcle.mockMethod("latestRoundData()", [ - 0, - oracleAnsFP("0.98"), - 0, - nowTS(), - 0, - ]); - const p = await strategy.usdPrice(); - expect(p[0]).to.eq(priceFP("1")); - expect(p[1]).to.eq(false); - }); - }); - - describe("when oracle price is above thresh", function () { - it("should return invalid", async function () { - const { strategy, usdPriceOrcle } = await loadFixture(setupContracts); - await usdPriceOrcle.mockMethod("latestRoundData()", [ - 0, - oracleAnsFP("1.02"), - 0, - nowTS(), - 0, - ]); - const p = await strategy.usdPrice(); - expect(p[0]).to.eq(priceFP("1")); - expect(p[1]).to.eq(false); - }); - }); - - it("should return price", async function () { - const { strategy } = await loadFixture(setupContracts); - const p = await strategy.usdPrice(); - expect(p[0]).to.eq(priceFP("1")); - expect(p[1]).to.eq(true); - }); - }); - - describe("#perpPrice", function () { - describe("when AMPL target data is invalid", function () { - it("should return invalid", async function () { - const { strategy, amplTargetOracle } = await loadFixture(setupContracts); - await amplTargetOracle.mockMethod("getData()", [priceFP("1.2"), false]); - const p = await strategy.perpPrice.staticCall(); - expect(p[0]).to.eq(priceFP("1.2")); - expect(p[1]).to.eq(false); - }); - }); - - describe("when balancer DR is too low", function () { - it("should return invalid", async function () { - const { strategy, spot } = await loadFixture(setupContracts); - await spot.mockMethod("deviationRatio()", [oracleAnsFP("0.79999")]); - const p = await strategy.perpPrice.staticCall(); - expect(p[0]).to.eq(priceFP("1.15")); - expect(p[1]).to.eq(false); - }); - }); - - describe("when spot senior cdr is too low", function () { - it("should return invalid", async function () { - const { strategy, ampl, bond } = await loadFixture(setupContracts); - await ampl.mockCall("balanceOf(address)", [bond.target], [perpFP("109999")]); - const p = await strategy.perpPrice.staticCall(); - expect(p[0]).to.eq(priceFP("1.15")); - expect(p[1]).to.eq(false); - }); - it("should return invalid", async function () { - const { strategy, bond } = await loadFixture(setupContracts); - await bond.mockMethod("isMature()", [true]); - const p = await strategy.perpPrice.staticCall(); - expect(p[0]).to.eq(priceFP("1.15")); - expect(p[1]).to.eq(false); - }); - }); - - describe("when spot has mature AMPL", function () { - it("should return invalid", async function () { - const { strategy, ampl, spot } = await loadFixture(setupContracts); - await ampl.mockCall("balanceOf(address)", [spot.target], [perpFP("25001")]); - const p = await strategy.perpPrice.staticCall(); - expect(p[0]).to.eq(priceFP("1.15")); - expect(p[1]).to.eq(false); - }); - }); - - it("should return price", async function () { - const { strategy } = await loadFixture(setupContracts); - const p = await strategy.perpPrice.staticCall(); - expect(p[0]).to.eq(priceFP("1.15")); - expect(p[1]).to.eq(true); - }); - - describe("when debasement/enrichment multiplier is not 1", function () { - it("should return price", async function () { - const { strategy, spot } = await loadFixture(setupContracts); - await spot.mockMethod("getTVL()", [perpFP("1500000")]); - await spot.mockMethod("totalSupply()", [perpFP("1000000")]); - const p = await strategy.perpPrice.staticCall(); - expect(p[0]).to.eq(priceFP("1.725")); - expect(p[1]).to.eq(true); - }); - it("should return price", async function () { - const { strategy, spot } = await loadFixture(setupContracts); - await spot.mockMethod("getTVL()", [perpFP("900000")]); - await spot.mockMethod("totalSupply()", [perpFP("1000000")]); - const p = await strategy.perpPrice.staticCall(); - expect(p[0]).to.eq(priceFP("1.035")); - expect(p[1]).to.eq(true); - }); - }); - }); -}); diff --git a/spot-vaults/test/SpotCDRPricer.ts b/spot-vaults/test/SpotCDRPricer.ts deleted file mode 100644 index b3095ee7..00000000 --- a/spot-vaults/test/SpotCDRPricer.ts +++ /dev/null @@ -1,167 +0,0 @@ -import { ethers } from "hardhat"; -import { loadFixture } from "@nomicfoundation/hardhat-toolbox/network-helpers"; -import { expect } from "chai"; -import { oracleAnsFP, perpFP, priceFP, DMock } from "./helpers"; - -const nowTS = () => parseInt(Date.now() / 1000); - -describe("SpotCDRPricer", function () { - async function setupContracts() { - const accounts = await ethers.getSigners(); - const deployer = accounts[0]; - - const amplTargetOracle = new DMock("MedianOracle"); - await amplTargetOracle.deploy(); - await amplTargetOracle.mockMethod("getData()", [priceFP("1.15"), true]); - await amplTargetOracle.mockMethod("DECIMALS()", [18]); - - const policy = new DMock("UFragmentsPolicy"); - await policy.deploy(); - await policy.mockMethod("cpiOracle()", [amplTargetOracle.target]); - - const ampl = new DMock("UFragments"); - await ampl.deploy(); - await ampl.mockMethod("decimals()", [9]); - await ampl.mockMethod("monetaryPolicy()", [policy.target]); - - const spot = new DMock("PerpetualTranche"); - await spot.deploy(); - await spot.mockMethod("underlying()", [ampl.target]); - await spot.mockMethod("getTVL()", [perpFP("1000000")]); - await spot.mockMethod("totalSupply()", [perpFP("1000000")]); - - const usdPriceOrcle = new DMock("IChainlinkOracle"); - await usdPriceOrcle.deploy(); - await usdPriceOrcle.mockMethod("decimals()", [8]); - await usdPriceOrcle.mockMethod("latestRoundData()", [ - 0, - oracleAnsFP("1"), - 0, - nowTS(), - 0, - ]); - - const SpotCDRPricer = await ethers.getContractFactory("SpotCDRPricer"); - const strategy = await SpotCDRPricer.deploy( - spot.target, - usdPriceOrcle.target, - amplTargetOracle.target, - ); - return { - deployer, - ampl, - spot, - usdPriceOrcle, - amplTargetOracle, - strategy, - }; - } - - describe("init", function () { - it("should initial params", async function () { - const { strategy, ampl, spot, usdPriceOrcle, amplTargetOracle } = await loadFixture( - setupContracts, - ); - expect(await strategy.AMPL()).to.eq(ampl.target); - expect(await strategy.SPOT()).to.eq(spot.target); - expect(await strategy.USD_ORACLE()).to.eq(usdPriceOrcle.target); - expect(await strategy.AMPL_CPI_ORACLE()).to.eq(amplTargetOracle.target); - expect(await strategy.decimals()).to.eq(18); - }); - }); - - describe("#usdPrice", function () { - describe("when data is stale", function () { - it("should return invalid", async function () { - const { strategy, usdPriceOrcle } = await loadFixture(setupContracts); - await usdPriceOrcle.mockMethod("latestRoundData()", [ - 0, - oracleAnsFP("1"), - 0, - nowTS() - 50 * 3600, - 0, - ]); - const p = await strategy.usdPrice(); - expect(p[0]).to.eq(priceFP("1")); - expect(p[1]).to.eq(false); - }); - }); - - describe("when oracle price is below thresh", function () { - it("should return invalid", async function () { - const { strategy, usdPriceOrcle } = await loadFixture(setupContracts); - await usdPriceOrcle.mockMethod("latestRoundData()", [ - 0, - oracleAnsFP("0.98"), - 0, - nowTS(), - 0, - ]); - const p = await strategy.usdPrice(); - expect(p[0]).to.eq(priceFP("1")); - expect(p[1]).to.eq(false); - }); - }); - - describe("when oracle price is above thresh", function () { - it("should return invalid", async function () { - const { strategy, usdPriceOrcle } = await loadFixture(setupContracts); - await usdPriceOrcle.mockMethod("latestRoundData()", [ - 0, - oracleAnsFP("1.02"), - 0, - nowTS(), - 0, - ]); - const p = await strategy.usdPrice(); - expect(p[0]).to.eq(priceFP("1")); - expect(p[1]).to.eq(false); - }); - }); - - it("should return price", async function () { - const { strategy } = await loadFixture(setupContracts); - const p = await strategy.usdPrice(); - expect(p[0]).to.eq(priceFP("1")); - expect(p[1]).to.eq(true); - }); - }); - - describe("#perpPrice", function () { - describe("when AMPL target data is invalid", function () { - it("should return invalid", async function () { - const { strategy, amplTargetOracle } = await loadFixture(setupContracts); - await amplTargetOracle.mockMethod("getData()", [priceFP("1.2"), false]); - const p = await strategy.perpPrice.staticCall(); - expect(p[0]).to.eq(priceFP("1.2")); - expect(p[1]).to.eq(false); - }); - }); - - it("should return price", async function () { - const { strategy } = await loadFixture(setupContracts); - const p = await strategy.perpPrice.staticCall(); - expect(p[0]).to.eq(priceFP("1.15")); - expect(p[1]).to.eq(true); - }); - - describe("when debasement/enrichment multiplier is not 1", function () { - it("should return price", async function () { - const { strategy, spot } = await loadFixture(setupContracts); - await spot.mockMethod("getTVL()", [perpFP("1500000")]); - await spot.mockMethod("totalSupply()", [perpFP("1000000")]); - const p = await strategy.perpPrice.staticCall(); - expect(p[0]).to.eq(priceFP("1.725")); - expect(p[1]).to.eq(true); - }); - it("should return price", async function () { - const { strategy, spot } = await loadFixture(setupContracts); - await spot.mockMethod("getTVL()", [perpFP("900000")]); - await spot.mockMethod("totalSupply()", [perpFP("1000000")]); - const p = await strategy.perpPrice.staticCall(); - expect(p[0]).to.eq(priceFP("1.035")); - expect(p[1]).to.eq(true); - }); - }); - }); -}); diff --git a/spot-vaults/test/SpotPricer.ts b/spot-vaults/test/SpotPricer.ts new file mode 100644 index 00000000..e1f3f1b8 --- /dev/null +++ b/spot-vaults/test/SpotPricer.ts @@ -0,0 +1,379 @@ +import { ethers } from "hardhat"; +import { loadFixture } from "@nomicfoundation/hardhat-toolbox/network-helpers"; +import { expect } from "chai"; +import { + amplOracleFP, + usdOracleFP, + ethOracleFP, + perpFP, + percFP, + priceFP, + wamplFP, + amplFP, + drFP, + DMock, +} from "./helpers"; + +const nowTS = () => parseInt(Date.now() / 1000); + +describe("SpotPricer", function () { + async function setupContracts() { + const amplPolicy = new DMock("IAmpleforth"); + await amplPolicy.deploy(); + await amplPolicy.mockMethod("getTargetRate()", [priceFP("1.15"), true]); + + const ampl = new DMock("UFragments"); + await ampl.deploy(); + await ampl.mockMethod("decimals()", [9]); + await ampl.mockMethod("monetaryPolicy()", [amplPolicy.target]); + + const usdcPriceOrcle = new DMock("IChainlinkOracle"); + await usdcPriceOrcle.deploy(); + await usdcPriceOrcle.mockMethod("decimals()", [8]); + await usdcPriceOrcle.mockMethod("latestRoundData()", [ + 0, + usdOracleFP("1"), + 0, + nowTS(), + 0, + ]); + + const ethPriceOrcle = new DMock("IChainlinkOracle"); + await ethPriceOrcle.deploy(); + await ethPriceOrcle.mockMethod("decimals()", [18]); + await ethPriceOrcle.mockMethod("latestRoundData()", [ + 0, + ethOracleFP("2357.76"), + 0, + nowTS(), + 0, + ]); + + const usdc = new DMock("contracts/_interfaces/external/IERC20.sol:IERC20"); + await usdc.deploy(); + + const wampl = new DMock("IWAMPL"); + await wampl.deploy(); + await wampl.mockCall( + "wrapperToUnderlying(uint256)", + [wamplFP("1")], + [amplFP("7.692284616")], + ); + + const bond = new DMock( + "contracts/_interfaces/external/IBondController.sol:IBondController", + ); + await bond.deploy(); + await bond.mockMethod("collateralBalance()", [perpFP("2000")]); + + const tranche = new DMock("Tranche"); + await tranche.deploy(); + await tranche.mockMethod("bond()", [bond.target]); + + const feePolicy = new DMock("IPerpFeePolicy"); + await feePolicy.deploy(); + await feePolicy.mockMethod("decimals()", [8]); + await feePolicy.mockMethod("deviationRatio()", [drFP("1")]); + await feePolicy.mockMethod("computePerpRolloverFeePerc(uint256)", [0]); + + const spot = new DMock("PerpetualTranche"); + await spot.deploy(); + await spot.mockMethod("feePolicy()", [feePolicy.target]); + await spot.mockMethod("underlying()", [ampl.target]); + await spot.mockMethod("getTVL()", [perpFP("1000")]); + await spot.mockMethod("totalSupply()", [perpFP("1000")]); + await spot.mockMethod("getReserveCount()", [2]); + await spot.mockCall("getReserveAt(uint256)", [0], [ampl.target]); + await spot.mockCall("getReserveTokenBalance(address)", [ampl.target], ["0"]); + await spot.mockCall("getReserveAt(uint256)", [1], [tranche.target]); + await spot.mockCall( + "getReserveTokenBalance(address)", + [tranche.target], + [perpFP("1000")], + ); + await spot.mockCall( + "getReserveTokenValue(address)", + [tranche.target], + [perpFP("1000")], + ); + + const wamplPool = new DMock("IUniswapV3Pool"); + await wamplPool.deploy(); + await wamplPool.mockMethod("token1()", [wampl.target]); + await wamplPool.mockMethod("observe(uint32[])", [ + ["376921685400", "377121673968"], + ["5338479444003340079488911551", "5338479669430834262798687400"], + ]); + + const spotPool = new DMock("IUniswapV3Pool"); + await spotPool.deploy(); + await spotPool.mockMethod("token0()", [usdc.target]); + await spotPool.mockMethod("token1()", [spot.target]); + await spotPool.mockMethod("observe(uint32[])", [ + ["3780978019944", "3781218388344"], + [ + "15033345577239143106349258268248842184594399522", + "15033345577239143129748458314415242759127803748", + ], + ]); + + const SpotPricer = await ethers.getContractFactory("SpotPricer"); + const strategy = await SpotPricer.deploy( + wamplPool.target, + spotPool.target, + ethPriceOrcle.target, + usdcPriceOrcle.target, + ); + return { + amplPolicy, + ethPriceOrcle, + usdcPriceOrcle, + usdc, + ampl, + wampl, + spot, + feePolicy, + bond, + tranche, + wamplPool, + spotPool, + strategy, + }; + } + + describe("init", function () { + it("should initial params", async function () { + const { + amplPolicy, + ethPriceOrcle, + usdcPriceOrcle, + usdc, + ampl, + wampl, + spot, + wamplPool, + spotPool, + strategy, + } = await loadFixture(setupContracts); + expect(await strategy.WETH_WAMPL_POOL()).to.eq(wamplPool.target); + expect(await strategy.USDC_SPOT_POOL()).to.eq(spotPool.target); + + expect(await strategy.ETH_ORACLE()).to.eq(ethPriceOrcle.target); + expect(await strategy.USDC_ORACLE()).to.eq(usdcPriceOrcle.target); + expect(await strategy.AMPLEFORTH_POLICY()).to.eq(amplPolicy.target); + + expect(await strategy.WAMPL()).to.eq(wampl.target); + expect(await strategy.USDC()).to.eq(usdc.target); + expect(await strategy.AMPL()).to.eq(ampl.target); + expect(await strategy.SPOT()).to.eq(spot.target); + expect(await strategy.decimals()).to.eq(18); + }); + }); + + describe("#usdPrice", function () { + describe("when data is stale", function () { + it("should return invalid", async function () { + const { strategy, usdcPriceOrcle } = await loadFixture(setupContracts); + await usdcPriceOrcle.mockMethod("latestRoundData()", [ + 0, + usdOracleFP("1"), + 0, + nowTS() - 50 * 3600, + 0, + ]); + const p = await strategy.usdPrice(); + expect(p[0]).to.eq(amplOracleFP("1")); + expect(p[1]).to.eq(false); + }); + }); + + describe("when oracle price is below thresh", function () { + it("should return invalid", async function () { + const { strategy, usdcPriceOrcle } = await loadFixture(setupContracts); + await usdcPriceOrcle.mockMethod("latestRoundData()", [ + 0, + usdOracleFP("0.98"), + 0, + nowTS(), + 0, + ]); + const p = await strategy.usdPrice(); + expect(p[0]).to.eq(amplOracleFP("1")); + expect(p[1]).to.eq(false); + }); + }); + + describe("when oracle price is above thresh", function () { + it("should return invalid", async function () { + const { strategy, usdcPriceOrcle } = await loadFixture(setupContracts); + await usdcPriceOrcle.mockMethod("latestRoundData()", [ + 0, + usdOracleFP("1.02"), + 0, + nowTS(), + 0, + ]); + const p = await strategy.usdPrice(); + expect(p[0]).to.eq(amplOracleFP("1")); + expect(p[1]).to.eq(false); + }); + }); + + it("should return price", async function () { + const { strategy } = await loadFixture(setupContracts); + const p = await strategy.usdPrice(); + expect(p[0]).to.eq(amplOracleFP("1")); + expect(p[1]).to.eq(true); + }); + }); + + describe("#perpFmvUsdPrice", function () { + describe("when AMPL target data is invalid", function () { + it("should return invalid", async function () { + const { strategy, amplPolicy } = await loadFixture(setupContracts); + await amplPolicy.mockMethod("getTargetRate()", [amplOracleFP("1.2"), false]); + const p = await strategy.perpFmvUsdPrice.staticCall(); + expect(p[0]).to.eq(amplOracleFP("1.2")); + expect(p[1]).to.eq(false); + }); + }); + + it("should return price", async function () { + const { strategy } = await loadFixture(setupContracts); + const p = await strategy.perpFmvUsdPrice.staticCall(); + expect(p[0]).to.eq(amplOracleFP("1.15")); + expect(p[1]).to.eq(true); + }); + + describe("when debasement/enrichment multiplier is not 1", function () { + it("should return price", async function () { + const { strategy, spot } = await loadFixture(setupContracts); + await spot.mockMethod("getTVL()", [perpFP("1500000")]); + await spot.mockMethod("totalSupply()", [perpFP("1000000")]); + const p = await strategy.perpFmvUsdPrice.staticCall(); + expect(p[0]).to.eq(amplOracleFP("1.725")); + expect(p[1]).to.eq(true); + }); + it("should return price", async function () { + const { strategy, spot } = await loadFixture(setupContracts); + await spot.mockMethod("getTVL()", [perpFP("900000")]); + await spot.mockMethod("totalSupply()", [perpFP("1000000")]); + const p = await strategy.perpFmvUsdPrice.staticCall(); + expect(p[0]).to.eq(amplOracleFP("1.035")); + expect(p[1]).to.eq(true); + }); + }); + }); + + describe("#perpUsdPrice", function () { + describe("when usdc price is invalid", function () { + it("should return invalid", async function () { + const { strategy, usdcPriceOrcle } = await loadFixture(setupContracts); + await usdcPriceOrcle.mockMethod("latestRoundData()", [ + 0, + usdOracleFP("1"), + 0, + nowTS() - 50 * 3600, + 0, + ]); + const p = await strategy.perpUsdPrice.staticCall(); + expect(p[0]).to.eq(priceFP("1.260097503535148000")); + expect(p[1]).to.eq(false); + }); + }); + + it("should compute spot usd price", async function () { + const { strategy } = await loadFixture(setupContracts); + const p = await strategy.perpUsdPrice.staticCall(); + expect(p[0]).to.eq(priceFP("1.260097503535148000")); + expect(p[1]).to.eq(true); + }); + }); + + describe("#underlyingUsdPrice", function () { + describe("when eth price is invalid", function () { + it("should return invalid", async function () { + const { strategy, ethPriceOrcle } = await loadFixture(setupContracts); + await ethPriceOrcle.mockMethod("latestRoundData()", [ + 0, + ethOracleFP("3000"), + 0, + nowTS() - 50 * 3600, + 0, + ]); + const p = await strategy.underlyingUsdPrice.staticCall(); + expect(p[0]).to.eq(priceFP("1.508668510241881174")); + expect(p[1]).to.eq(false); + }); + }); + + it("should compute ampl price", async function () { + const { strategy } = await loadFixture(setupContracts); + const p = await strategy.underlyingUsdPrice.staticCall(); + expect(p[0]).to.eq(priceFP("1.185692755569299252")); + expect(p[1]).to.eq(true); + }); + }); + + describe("intermediate prices", function () { + it("should compute eth price", async function () { + const { strategy } = await loadFixture(setupContracts); + const p = await strategy.ethUsdPrice.staticCall(); + expect(p[0]).to.eq(priceFP("2357.76")); + expect(p[1]).to.eq(true); + }); + + it("should compute wampl price", async function () { + const { strategy } = await loadFixture(setupContracts); + const p = await strategy.wamplUsdPrice.staticCall(); + expect(p[0]).to.eq(priceFP("9.120686142968368965")); + expect(p[1]).to.eq(true); + }); + + it("should compute spot price deviation", async function () { + const { strategy } = await loadFixture(setupContracts); + const p = await strategy.spotPriceDeviation.staticCall(); + expect(p[0]).to.eq(percFP("1.095736959595780869")); + expect(p[1]).to.eq(true); + }); + + it("should compute spot price deviation", async function () { + const { strategy, amplPolicy } = await loadFixture(setupContracts); + await amplPolicy.mockMethod("getTargetRate()", [amplOracleFP("2"), true]); + const p = await strategy.spotPriceDeviation.staticCall(); + expect(p[0]).to.eq(percFP("0.630048751767574000")); + expect(p[1]).to.eq(true); + }); + + it("should compute spot price deviation", async function () { + const { strategy, amplPolicy } = await loadFixture(setupContracts); + await amplPolicy.mockMethod("getTargetRate()", [amplOracleFP("0"), false]); + const p = await strategy.spotPriceDeviation.staticCall(); + expect(p[0]).to.eq(percFP("100")); + expect(p[1]).to.eq(false); + }); + + it("should compute ampl price deviation", async function () { + const { strategy } = await loadFixture(setupContracts); + const p = await strategy.amplPriceDeviation.staticCall(); + expect(p[0]).to.eq(percFP("1.031037178755912393")); + expect(p[1]).to.eq(true); + }); + + it("should compute spot price deviation", async function () { + const { strategy, amplPolicy } = await loadFixture(setupContracts); + await amplPolicy.mockMethod("getTargetRate()", [amplOracleFP("1.5"), true]); + const p = await strategy.amplPriceDeviation.staticCall(); + expect(p[0]).to.eq(percFP("0.790461837046199501")); + expect(p[1]).to.eq(true); + }); + + it("should compute spot price deviation", async function () { + const { strategy, amplPolicy } = await loadFixture(setupContracts); + await amplPolicy.mockMethod("getTargetRate()", [amplOracleFP("0"), false]); + const p = await strategy.amplPriceDeviation.staticCall(); + expect(p[0]).to.eq(percFP("100")); + expect(p[1]).to.eq(false); + }); + }); +}); diff --git a/spot-vaults/test/UsdcSpotManager.ts b/spot-vaults/test/UsdcSpotManager.ts index e4e437a2..3f38c72a 100644 --- a/spot-vaults/test/UsdcSpotManager.ts +++ b/spot-vaults/test/UsdcSpotManager.ts @@ -17,22 +17,37 @@ describe("UsdcSpotManager", function () { // Deploy mock contracts const mockVault = new DMock("IAlphaProVault"); await mockVault.deploy(); - await mockVault.mockMethod("fullLower()", [-800000]); - await mockVault.mockMethod("fullUpper()", [800000]); - await mockVault.mockMethod("baseLower()", [45000]); - await mockVault.mockMethod("baseUpper()", [55000]); - await mockVault.mockMethod("getTwap()", [67200]); - await mockVault.mockMethod("limitThreshold()", [800000]); const mockPool = new DMock("IUniswapV3Pool"); await mockPool.deploy(); + await mockPool.mockCall( + "positions(bytes32)", + [univ3PositionKey(mockVault.target, -800000, 800000)], + [100000, 0, 0, 0, 0], + ); + await mockPool.mockCall( + "positions(bytes32)", + [univ3PositionKey(mockVault.target, -1000, 1000)], + [0, 0, 0, 0, 0], + ); + await mockPool.mockCall( + "positions(bytes32)", + [univ3PositionKey(mockVault.target, 20000, 40000)], + [50000, 0, 0, 0, 0], + ); + await mockVault.mockMethod("baseLower()", [-1000]); + await mockVault.mockMethod("baseUpper()", [1000]); + await mockVault.mockMethod("fullLower()", [-800000]); + await mockVault.mockMethod("fullUpper()", [800000]); + await mockVault.mockMethod("limitLower()", [20000]); + await mockVault.mockMethod("limitUpper()", [40000]); await mockVault.mockMethod("pool()", [mockPool.target]); + await mockVault.mockMethod("getTotalAmounts()", [usdcFP("500000"), spotFP("500000")]); - const mockAppraiser = new DMock("ISpotPricingStrategy"); - await mockAppraiser.deploy(); - await mockAppraiser.mockMethod("decimals()", [18]); - await mockAppraiser.mockMethod("perpPrice()", [priceFP("1.2"), true]); - await mockAppraiser.mockMethod("usdPrice()", [priceFP("1"), true]); + const mockOracle = new DMock("IMetaOracle"); + await mockOracle.deploy(); + await mockOracle.mockMethod("decimals()", [18]); + await mockOracle.mockMethod("spotPriceDeviation()", [priceFP("1.2"), true]); const mockUsdc = new DMock("IERC20Upgradeable"); await mockUsdc.deploy(); @@ -44,13 +59,13 @@ describe("UsdcSpotManager", function () { // Deploy Manager contract const Manager = await ethers.getContractFactory("UsdcSpotManager"); - const manager = await Manager.deploy(mockVault.target, mockAppraiser.target); + const manager = await Manager.deploy(mockVault.target, mockOracle.target); return { owner, addr1, mockVault, - mockAppraiser, + mockOracle, mockUsdc, mockSpot, mockPool, @@ -58,6 +73,56 @@ describe("UsdcSpotManager", function () { }; } + async function stubRebalance(mockVault) { + await mockVault.clearMockMethod("setPeriod(uint32)"); + await mockVault.clearMockMethod("period()"); + await mockVault.mockMethod("rebalance()", []); + } + + async function stubForceRebalance(mockVault) { + await mockVault.mockMethod("period()", [86400]); + await mockVault.mockCall("setPeriod(uint32)", [0], []); + await mockVault.mockCall("setPeriod(uint32)", [86400], []); + await mockVault.mockMethod("rebalance()", []); + } + + async function stubOverweightSpot(mockVault) { + await mockVault.mockMethod("getTwap()", [30001]); + } + + async function stubOverweightUsdc(mockVault) { + await mockVault.mockMethod("getTwap()", [29999]); + } + + async function stubActiveZoneLiq(mockVault, fr, base, limit) { + await mockVault.mockCall("setFullRangeWeight(uint24)", [fr], []); + await mockVault.mockCall("setBaseThreshold(int24)", [base], []); + await mockVault.mockCall("setLimitThreshold(int24)", [limit], []); + } + + async function stubInactiveLiq(mockVault) { + await mockVault.mockCall("setFullRangeWeight(uint24)", [1000000], []); + await mockVault.mockCall("setBaseThreshold(int24)", [48000], []); + await mockVault.mockCall("setLimitThreshold(int24)", [48000], []); + } + + async function stubTrimFullRangeLiq(mockVault, burntLiq) { + await mockVault.mockCall( + "emergencyBurn(int24,int24,uint128)", + [-800000, 800000, burntLiq], + [], + ); + } + + async function stubRemovedLimitRange(mockVault) { + await mockVault.clearMockMethod("emergencyBurn(int24,int24,uint128)"); + await mockVault.mockCall( + "emergencyBurn(int24,int24,uint128)", + [20000, 40000, 50000], + [], + ); + } + describe("Initialization", function () { it("should set the correct owner", async function () { const { manager, owner } = await loadFixture(setupContracts); @@ -70,67 +135,114 @@ describe("UsdcSpotManager", function () { }); it("should set the appraiser address", async function () { - const { manager, mockAppraiser } = await loadFixture(setupContracts); - expect(await manager.pricingStrategy()).to.eq(mockAppraiser.target); + const { manager, mockOracle } = await loadFixture(setupContracts); + expect(await manager.oracle()).to.eq(mockOracle.target); }); it("should set the token refs", async function () { - const { manager, mockUsdc, mockSpot, mockPool } = await loadFixture(setupContracts); + const { manager, mockPool } = await loadFixture(setupContracts); expect(await manager.POOL()).to.eq(mockPool.target); - expect(await manager.USDC()).to.eq(mockUsdc.target); - expect(await manager.SPOT()).to.eq(mockSpot.target); }); it("should return the decimals", async function () { const { manager } = await loadFixture(setupContracts); expect(await manager.decimals()).to.eq(18); }); + + it("should set initial parameters", async function () { + const { manager } = await loadFixture(setupContracts); + expect(await manager.prevWithinActiveZone()).to.eq(false); + const r = await manager.activeZoneDeviation(); + expect(r[0]).to.eq(percFP("0.95")); + expect(r[1]).to.eq(percFP("1.05")); + expect(await manager.concBandDeviationWidth()).to.eq(percFP("0.05")); + expect(await manager.fullRangeMaxUsdcBal()).to.eq(usdcFP("250000")); + }); }); - describe("#transferOwnership", function () { + describe("#updateOracle", function () { it("should fail to when called by non-owner", async function () { const { manager, addr1 } = await loadFixture(setupContracts); + const mockOracle = new DMock("IMetaOracle"); + await mockOracle.deploy(); + await mockOracle.mockMethod("decimals()", [18]); await expect( - manager.connect(addr1).transferOwnership(addr1.address), - ).to.be.revertedWith("Unauthorized caller"); + manager.connect(addr1).updateOracle(mockOracle.target), + ).to.be.revertedWith("Ownable: caller is not the owner"); + }); + + it("should fail when decimals dont match", async function () { + const { manager } = await loadFixture(setupContracts); + const mockOracle = new DMock("IMetaOracle"); + await mockOracle.deploy(); + await mockOracle.mockMethod("decimals()", [9]); + await expect(manager.updateOracle(mockOracle.target)).to.be.revertedWith( + "UnexpectedDecimals", + ); }); it("should succeed when called by owner", async function () { - const { manager, addr1 } = await loadFixture(setupContracts); - await manager.transferOwnership(addr1.address); - expect(await manager.owner()).to.eq(await addr1.getAddress()); + const { manager } = await loadFixture(setupContracts); + const mockOracle = new DMock("IMetaOracle"); + await mockOracle.deploy(); + await mockOracle.mockMethod("decimals()", [18]); + await manager.updateOracle(mockOracle.target); + expect(await manager.oracle()).to.eq(mockOracle.target); }); }); - describe("#updatePricingStrategy", function () { + describe("#updateActiveZone", function () { it("should fail to when called by non-owner", async function () { const { manager, addr1 } = await loadFixture(setupContracts); await expect( - manager.connect(addr1).updatePricingStrategy(addr1.address), - ).to.be.revertedWith("Unauthorized caller"); + manager.connect(addr1).updateActiveZone([percFP("0.9"), percFP("1.1")]), + ).to.be.revertedWith("Ownable: caller is not the owner"); }); it("should succeed when called by owner", async function () { + const { manager } = await loadFixture(setupContracts); + await manager.updateActiveZone([percFP("0.9"), percFP("1.1")]); + const r = await manager.activeZoneDeviation(); + expect(r[0]).to.eq(percFP("0.9")); + expect(r[1]).to.eq(percFP("1.1")); + }); + }); + + describe("#updateConcentratedBand", function () { + it("should fail to when called by non-owner", async function () { const { manager, addr1 } = await loadFixture(setupContracts); - await manager.updatePricingStrategy(addr1.address); - expect(await manager.pricingStrategy()).to.eq(await addr1.getAddress()); + await expect( + manager.connect(addr1).updateConcentratedBand(percFP("0.1")), + ).to.be.revertedWith("Ownable: caller is not the owner"); + }); + + it("should succeed when called by owner", async function () { + const { manager } = await loadFixture(setupContracts); + await manager.updateConcentratedBand(percFP("0.1")); + expect(await manager.concBandDeviationWidth()).to.eq(percFP("0.1")); }); }); - describe("#setLiquidityRanges", function () { + describe("#updateFullRangeLiquidity", function () { it("should fail to when called by non-owner", async function () { const { manager, addr1 } = await loadFixture(setupContracts); await expect( - manager.connect(addr1).setLiquidityRanges(7200, 330000, 1200), - ).to.be.revertedWith("Unauthorized caller"); + manager.connect(addr1).updateFullRangeLiquidity(usdcFP("1000000"), percFP("0.2")), + ).to.be.revertedWith("Ownable: caller is not the owner"); + }); + + it("should fail to when param is invalid", async function () { + const { manager } = await loadFixture(setupContracts); + await expect( + manager.updateFullRangeLiquidity(usdcFP("1000000"), percFP("1.2")), + ).to.be.revertedWith("InvalidPerc"); }); it("should succeed when called by owner", async function () { - const { manager, mockVault } = await loadFixture(setupContracts); - await mockVault.mockCall("setBaseThreshold(int24)", [7200], []); - await mockVault.mockCall("setFullRangeWeight(uint24)", [330000], []); - await mockVault.mockCall("setLimitThreshold(int24)", [1200], []); - await manager.setLiquidityRanges(7200, 330000, 1200); + const { manager } = await loadFixture(setupContracts); + await manager.updateFullRangeLiquidity(usdcFP("1000000"), percFP("0.2")); + expect(await manager.fullRangeMaxUsdcBal()).to.eq(usdcFP("1000000")); + expect(await manager.fullRangeMaxPerc()).to.eq(percFP("0.2")); }); }); @@ -143,7 +255,7 @@ describe("UsdcSpotManager", function () { .execOnVault( mockVault.refFactory.interface.encodeFunctionData("acceptManager"), ), - ).to.be.revertedWith("Unauthorized caller"); + ).to.be.revertedWith("Ownable: caller is not the owner"); }); it("should succeed when called by owner", async function () { @@ -162,7 +274,7 @@ describe("UsdcSpotManager", function () { manager.execOnVault( mockVault.refFactory.interface.encodeFunctionData("acceptManager"), ), - ).to.be.revertedWith("Vault call failed"); + ).to.be.revertedWith("VaultExecutionFailed"); await mockVault.mockCall("acceptManager()", [], []); await manager.execOnVault( mockVault.refFactory.interface.encodeFunctionData("acceptManager"), @@ -170,274 +282,212 @@ describe("UsdcSpotManager", function () { }); }); - describe("#computeDeviationFactor", function () { - describe("when spot price is invalid", function () { - it("should return invalid", async function () { - const { manager, mockAppraiser } = await loadFixture(setupContracts); - await mockAppraiser.mockMethod("perpPrice()", [priceFP("1.2"), false]); - const r = await manager.computeDeviationFactor.staticCall(); - expect(r[0]).to.eq(percFP("1.0057863765655975")); - expect(r[1]).to.eq(false); + describe("isOverweightSpot", function () { + describe("when spot sell", function () { + it("should return true", async function () { + const { manager, mockVault } = await loadFixture(setupContracts); + await stubOverweightSpot(mockVault); + expect(await manager.isOverweightSpot()).to.eq(true); }); }); - describe("when usd price is invalid", function () { - it("should return invalid", async function () { - const { manager, mockAppraiser } = await loadFixture(setupContracts); - await mockAppraiser.mockMethod("usdPrice()", [priceFP("0.8"), false]); - const r = await manager.computeDeviationFactor.staticCall(); - expect(r[0]).to.eq(percFP("1.0057863765655975")); - expect(r[1]).to.eq(false); + describe("when spot buy", function () { + it("should return false", async function () { + const { manager, mockVault } = await loadFixture(setupContracts); + await stubOverweightUsdc(mockVault); + expect(await manager.isOverweightSpot()).to.eq(false); }); }); + }); - it("should return deviation factor", async function () { + describe("activeZone", function () { + it("should return state", async function () { const { manager } = await loadFixture(setupContracts); - const r = await manager.computeDeviationFactor.staticCall(); - expect(r[0]).to.eq(percFP("1.0057863765655975")); - expect(r[1]).to.eq(true); + expect(await manager.activeZone(percFP("0.949"))).to.eq(false); + expect(await manager.activeZone(percFP("0.95"))).to.eq(true); + expect(await manager.activeZone(percFP("0.975"))).to.eq(true); + expect(await manager.activeZone(percFP("1"))).to.eq(true); + expect(await manager.activeZone(percFP("1.025"))).to.eq(true); + expect(await manager.activeZone(percFP("1.05"))).to.eq(true); + expect(await manager.activeZone(percFP("1.051"))).to.eq(false); }); + }); - it("should return deviation factor", async function () { + describe("activeFullRangePerc", function () { + it("should calculate full range perc", async function () { const { manager, mockVault } = await loadFixture(setupContracts); - await mockVault.mockMethod("getTwap()", [65800]); - const r = await manager.computeDeviationFactor.staticCall(); - expect(r[0]).to.eq(percFP("1.1569216182711425")); - expect(r[1]).to.eq(true); + await manager.updateFullRangeLiquidity(usdcFP("25000"), percFP("0.2")); + await mockVault.mockMethod("getTotalAmounts()", [usdcFP("500000"), spotFP("0")]); + expect(await manager.activeFullRangePerc()).to.eq(percFP("0.05")); }); - - it("should return deviation factor", async function () { + it("should calculate full range perc", async function () { const { manager, mockVault } = await loadFixture(setupContracts); - await mockVault.mockMethod("getTwap()", [67800]); - const r = await manager.computeDeviationFactor.staticCall(); - expect(r[0]).to.eq(percFP("0.947216779268338333")); - expect(r[1]).to.eq(true); - }); - - it("should return deviation factor", async function () { - const { manager, mockAppraiser } = await loadFixture(setupContracts); - await mockAppraiser.mockMethod("perpPrice()", [priceFP("1.5"), true]); - const r = await manager.computeDeviationFactor.staticCall(); - expect(r[0]).to.eq(percFP("0.804629101252478")); - expect(r[1]).to.eq(true); + await manager.updateFullRangeLiquidity(usdcFP("250000"), percFP("0.1")); + await mockVault.mockMethod("getTotalAmounts()", [usdcFP("500000"), spotFP("10")]); + expect(await manager.activeFullRangePerc()).to.eq(percFP("0.1")); }); - - it("should return deviation factor", async function () { - const { manager, mockAppraiser } = await loadFixture(setupContracts); - await mockAppraiser.mockMethod("perpPrice()", [priceFP("1"), true]); - const r = await manager.computeDeviationFactor.staticCall(); - expect(r[0]).to.eq(percFP("1.206943651878717")); - expect(r[1]).to.eq(true); + it("should calculate full range perc", async function () { + const { manager, mockVault } = await loadFixture(setupContracts); + await manager.updateFullRangeLiquidity(usdcFP("250000"), percFP("1")); + await mockVault.mockMethod("getTotalAmounts()", [ + usdcFP("500000"), + spotFP("10000"), + ]); + expect(await manager.activeFullRangePerc()).to.eq(percFP("0.5")); }); + }); - it("should return deviation factor when perp price is invalid", async function () { - const { manager, mockAppraiser } = await loadFixture(setupContracts); - await mockAppraiser.mockMethod("perpPrice()", [priceFP("0"), true]); - const r = await manager.computeDeviationFactor.staticCall(); - expect(r[0]).to.eq(percFP("100")); - expect(r[1]).to.eq(true); + describe("deviationToTicks", function () { + it("should return ticks", async function () { + const { manager } = await loadFixture(setupContracts); + expect(await manager.deviationToTicks(percFP("0.1"))).to.eq(1000); + expect(await manager.deviationToTicks(percFP("0.05"))).to.eq(400); + expect(await manager.deviationToTicks(percFP("0.025"))).to.eq(200); + expect(await manager.deviationToTicks(percFP("0.01"))).to.eq(200); + expect(await manager.deviationToTicks(percFP("0"))).to.eq(200); }); }); - describe("isOverweightSpot", function () { - describe("when spot sell", function () { - it("should return true", async function () { - const { manager, mockVault } = await loadFixture(setupContracts); - await mockVault.mockMethod("getTwap()", [30001]); - await mockVault.mockMethod("limitLower()", [20000]); - await mockVault.mockMethod("limitUpper()", [40000]); + describe("#rebalance", function () { + describe("when price is inside active range, previously outside", function () { + it("should force rebalance and update liquidity", async function () { + const { manager, mockVault, mockOracle } = await loadFixture(setupContracts); + await mockOracle.mockMethod("spotPriceDeviation()", [priceFP("0.98"), true]); + + await stubOverweightUsdc(mockVault); + await stubActiveZoneLiq(mockVault, 500000, 400, 200); + await stubForceRebalance(mockVault); + + expect(await manager.isOverweightSpot()).to.eq(false); + expect(await manager.prevWithinActiveZone()).to.eq(false); + await expect(manager.rebalance()).not.to.be.reverted; + expect(await manager.prevWithinActiveZone()).to.eq(true); + }); + + it("should force rebalance and update liquidity", async function () { + const { manager, mockVault, mockOracle } = await loadFixture(setupContracts); + await mockOracle.mockMethod("spotPriceDeviation()", [priceFP("0.98"), true]); + + await stubOverweightSpot(mockVault); + await stubActiveZoneLiq(mockVault, 500000, 400, 600); + await stubForceRebalance(mockVault); + expect(await manager.isOverweightSpot()).to.eq(true); + expect(await manager.prevWithinActiveZone()).to.eq(false); + await expect(manager.rebalance()).not.to.be.reverted; + expect(await manager.prevWithinActiveZone()).to.eq(true); }); }); - describe("when spot buy", function () { - it("should return false", async function () { - const { manager, mockVault } = await loadFixture(setupContracts); - await mockVault.mockMethod("getTwap()", [29999]); - await mockVault.mockMethod("limitLower()", [20000]); - await mockVault.mockMethod("limitUpper()", [40000]); + describe("when price is outside active range, previously inside", function () { + it("should rebalance and update liquidity", async function () { + const { manager, mockVault, mockOracle } = await loadFixture(setupContracts); + + await mockOracle.mockMethod("spotPriceDeviation()", [priceFP("1"), true]); + await stubOverweightUsdc(mockVault); + await stubActiveZoneLiq(mockVault, 500000, 400, 400); + await stubForceRebalance(mockVault); + await manager.rebalance(); + + await mockVault.mockMethod("getTotalAmounts()", [ + usdcFP("1000000"), + spotFP("500000"), + ]); + await mockOracle.mockMethod("spotPriceDeviation()", [priceFP("0.5"), true]); + await stubInactiveLiq(mockVault); + await stubTrimFullRangeLiq(mockVault, 75000); + await stubRemovedLimitRange(mockVault); + await stubForceRebalance(mockVault); + expect(await manager.isOverweightSpot()).to.eq(false); + expect(await manager.prevWithinActiveZone()).to.eq(true); + await expect(manager.rebalance()).not.to.be.reverted; + expect(await manager.prevWithinActiveZone()).to.eq(false); }); }); - }); - describe("#rebalance", function () { - describe("when deviation is < 1 and goes > 1", function () { - describe("when overweight spot", function () { - it("should keep limit range", async function () { - const { manager, mockVault } = await loadFixture(setupContracts); - - await mockVault.mockMethod("getTwap()", [66200]); - await mockVault.mockMethod("limitLower()", [40000]); - await mockVault.mockMethod("limitUpper()", [45000]); - - await mockVault.mockMethod("period()", [86400]); - await mockVault.mockCall("setPeriod(uint32)", [0], []); - await mockVault.mockCall("setPeriod(uint32)", [86400], []); - await mockVault.mockMethod("rebalance()", []); - - expect(await manager.prevDeviation()).to.eq("0"); - expect(await manager.isOverweightSpot()).to.eq(true); - await expect(manager.rebalance()).not.to.be.reverted; - expect(await manager.prevDeviation()).to.eq(percFP("1.111560295732100833")); - }); - }); + describe("when price is inside active range, previously inside", function () { + it("should rebalance and update liquidity", async function () { + const { manager, mockVault, mockOracle } = await loadFixture(setupContracts); - describe("when overweight usdc", function () { - it("should remove limit range", async function () { - const { manager, mockVault, mockPool } = await loadFixture(setupContracts); - - await mockVault.mockMethod("getTwap()", [66200]); - await mockVault.mockMethod("limitLower()", [73000]); - await mockVault.mockMethod("limitUpper()", [75000]); - await mockPool.mockCall( - "positions(bytes32)", - [univ3PositionKey(mockVault.target, 73000, 75000)], - [50000, 0, 0, 0, 0], - ); - - await mockVault.mockMethod("period()", [86400]); - await mockVault.mockCall("setPeriod(uint32)", [0], []); - await mockVault.mockCall("setPeriod(uint32)", [86400], []); - await mockVault.mockMethod("rebalance()", []); - await mockVault.mockCall( - "emergencyBurn(int24,int24,uint128)", - [73000, 75000, 50000], - [], - ); - - expect(await manager.prevDeviation()).to.eq("0"); - expect(await manager.isOverweightSpot()).to.eq(false); - await expect(manager.rebalance()).not.to.be.reverted; - expect(await manager.prevDeviation()).to.eq(percFP("1.111560295732100833")); - }); - }); - }); + await mockOracle.mockMethod("spotPriceDeviation()", [priceFP("1"), true]); + await stubOverweightUsdc(mockVault); + await stubActiveZoneLiq(mockVault, 500000, 400, 400); + await stubForceRebalance(mockVault); + await manager.rebalance(); + + await mockOracle.mockMethod("spotPriceDeviation()", [priceFP("1.02"), true]); + await stubActiveZoneLiq(mockVault, 500000, 400, 600); + await stubRebalance(mockVault); - describe("when deviation is > 1 and goes < 1", function () { - describe("when overweight spot", function () { - it("should remove limit range", async function () { - const { manager, mockVault, mockPool } = await loadFixture(setupContracts); - - await mockVault.mockMethod("getTwap()", [66200]); - await mockVault.mockMethod("limitLower()", [40000]); - await mockVault.mockMethod("limitUpper()", [45000]); - await mockVault.mockMethod("period()", [86400]); - await mockVault.mockCall("setPeriod(uint32)", [0], []); - await mockVault.mockCall("setPeriod(uint32)", [86400], []); - await mockVault.mockMethod("rebalance()", []); - await manager.rebalance(); - - await mockVault.mockMethod("getTwap()", [67800]); - await mockVault.mockMethod("limitLower()", [60000]); - await mockVault.mockMethod("limitUpper()", [65000]); - await mockPool.mockCall( - "positions(bytes32)", - [univ3PositionKey(mockVault.target, 60000, 65000)], - [50000, 0, 0, 0, 0], - ); - await mockVault.clearMockMethod("emergencyBurn(int24,int24,uint128)"); - await mockVault.mockCall( - "emergencyBurn(int24,int24,uint128)", - [60000, 65000, 50000], - [], - ); - - expect(await manager.prevDeviation()).to.eq(percFP("1.111560295732100833")); - expect(await manager.isOverweightSpot()).to.eq(true); - await expect(manager.rebalance()).not.to.be.reverted; - expect(await manager.prevDeviation()).to.eq(percFP("0.947216779268338333")); - }); + expect(await manager.isOverweightSpot()).to.eq(false); + expect(await manager.prevWithinActiveZone()).to.eq(true); + await expect(manager.rebalance()).not.to.be.reverted; + expect(await manager.prevWithinActiveZone()).to.eq(true); }); - describe("when overweight usdc", function () { - it("should keep limit range", async function () { - const { manager, mockVault } = await loadFixture(setupContracts); - - await mockVault.mockMethod("getTwap()", [66200]); - await mockVault.mockMethod("limitLower()", [40000]); - await mockVault.mockMethod("limitUpper()", [45000]); - await mockVault.mockMethod("period()", [86400]); - await mockVault.mockCall("setPeriod(uint32)", [0], []); - await mockVault.mockCall("setPeriod(uint32)", [86400], []); - await mockVault.mockMethod("rebalance()", []); - await manager.rebalance(); - - await mockVault.mockMethod("getTwap()", [67800]); - await mockVault.mockMethod("limitLower()", [75000]); - await mockVault.mockMethod("limitUpper()", [80000]); - await mockVault.clearMockMethod("emergencyBurn(int24,int24,uint128)"); - - expect(await manager.prevDeviation()).to.eq(percFP("1.111560295732100833")); - expect(await manager.isOverweightSpot()).to.eq(false); - await expect(manager.rebalance()).not.to.be.reverted; - expect(await manager.prevDeviation()).to.eq(percFP("0.947216779268338333")); - }); + it("should rebalance and update liquidity", async function () { + const { manager, mockVault, mockOracle } = await loadFixture(setupContracts); + + await mockOracle.mockMethod("spotPriceDeviation()", [priceFP("1"), true]); + await stubOverweightUsdc(mockVault); + await stubActiveZoneLiq(mockVault, 500000, 400, 400); + await stubForceRebalance(mockVault); + await manager.rebalance(); + + await mockOracle.mockMethod("spotPriceDeviation()", [priceFP("1.02"), true]); + await stubOverweightSpot(mockVault); + await stubActiveZoneLiq(mockVault, 500000, 400, 200); + await stubRebalance(mockVault); + + expect(await manager.isOverweightSpot()).to.eq(true); + expect(await manager.prevWithinActiveZone()).to.eq(true); + await expect(manager.rebalance()).not.to.be.reverted; + expect(await manager.prevWithinActiveZone()).to.eq(true); }); }); - describe("when deviation remains below 1", function () { - describe("when overweight spot", function () { - it("should not force rebalance", async function () { - const { manager, mockVault, mockPool } = await loadFixture(setupContracts); - - await mockVault.mockMethod("getTwap()", [67800]); - await mockVault.mockMethod("limitLower()", [40000]); - await mockVault.mockMethod("limitUpper()", [45000]); - await mockVault.mockMethod("rebalance()", []); - await mockPool.mockCall( - "positions(bytes32)", - [univ3PositionKey(mockVault.target, 40000, 45000)], - [50000, 0, 0, 0, 0], - ); - await mockVault.mockCall( - "emergencyBurn(int24,int24,uint128)", - [40000, 45000, 50000], - [], - ); - - expect(await manager.prevDeviation()).to.eq("0"); - expect(await manager.isOverweightSpot()).to.eq(true); - await expect(manager.rebalance()).not.to.be.reverted; - expect(await manager.prevDeviation()).to.eq(percFP("0.947216779268338333")); - }); + describe("when price is outside active range, previously outside", function () { + it("should rebalance and update liquidity", async function () { + const { manager, mockVault, mockOracle } = await loadFixture(setupContracts); + + await mockVault.mockMethod("getTotalAmounts()", [ + usdcFP("2500000"), + spotFP("500000"), + ]); + await mockOracle.mockMethod("spotPriceDeviation()", [priceFP("0.75"), true]); + await stubOverweightUsdc(mockVault); + await stubInactiveLiq(mockVault); + await stubTrimFullRangeLiq(mockVault, 90000); + await stubRemovedLimitRange(mockVault); + await stubRebalance(mockVault); + + expect(await manager.isOverweightSpot()).to.eq(false); + expect(await manager.prevWithinActiveZone()).to.eq(false); + await expect(manager.rebalance()).not.to.be.reverted; + expect(await manager.prevWithinActiveZone()).to.eq(false); }); }); - describe("when deviation remains above 1", function () { - describe("when overweight usdc", function () { - it("should not force rebalance", async function () { - const { manager, mockVault, mockPool } = await loadFixture(setupContracts); - - await mockVault.mockMethod("getTwap()", [66200]); - await mockVault.mockMethod("limitLower()", [40000]); - await mockVault.mockMethod("limitUpper()", [45000]); - await mockVault.mockMethod("period()", [86400]); - await mockVault.mockCall("setPeriod(uint32)", [0], []); - await mockVault.mockCall("setPeriod(uint32)", [86400], []); - await mockVault.mockMethod("rebalance()", []); - await manager.rebalance(); - - await mockVault.clearMockCall("setPeriod(uint32)", [0]); - await mockVault.clearMockCall("setPeriod(uint32)", [86400]); - await mockVault.clearMockCall("period()", []); - await mockVault.clearMockMethod("emergencyBurn(int24,int24,uint128)"); - - await mockVault.mockMethod("getTwap()", [66800]); - await mockVault.mockMethod("limitLower()", [75000]); - await mockVault.mockMethod("limitUpper()", [80000]); - await mockPool.mockCall( - "positions(bytes32)", - [univ3PositionKey(mockVault.target, 75000, 80000)], - [50000, 0, 0, 0, 0], - ); - await mockVault.mockMethod("emergencyBurn(int24,int24,uint128)", []); - - expect(await manager.prevDeviation()).to.eq(percFP("1.111560295732100833")); - expect(await manager.isOverweightSpot()).to.eq(false); - await expect(manager.rebalance()).not.to.be.reverted; - expect(await manager.prevDeviation()).to.eq(percFP("1.0468312037404625")); - }); + describe("when price is invalid", function () { + it("should rebalance and update liquidity", async function () { + const { manager, mockVault, mockOracle } = await loadFixture(setupContracts); + + await mockVault.mockMethod("getTotalAmounts()", [ + usdcFP("2500000"), + spotFP("500000"), + ]); + await mockOracle.mockMethod("spotPriceDeviation()", [priceFP("0.75"), false]); + await stubOverweightUsdc(mockVault); + await stubInactiveLiq(mockVault); + await stubTrimFullRangeLiq(mockVault, 90000); + await stubRemovedLimitRange(mockVault); + await stubRebalance(mockVault); + + expect(await manager.isOverweightSpot()).to.eq(false); + expect(await manager.prevWithinActiveZone()).to.eq(false); + await expect(manager.rebalance()).not.to.be.reverted; + expect(await manager.prevWithinActiveZone()).to.eq(false); }); }); }); diff --git a/spot-vaults/test/WethWamplManager.ts b/spot-vaults/test/WethWamplManager.ts index 2506d5c6..71b1593a 100644 --- a/spot-vaults/test/WethWamplManager.ts +++ b/spot-vaults/test/WethWamplManager.ts @@ -4,12 +4,7 @@ import { expect } from "chai"; import { DMock, sciParseFloat, univ3PositionKey } from "./helpers"; export const percFP = (a: string): BigInt => ethers.parseUnits(sciParseFloat(a), 18); -export const amplFP = (a: string): BigInt => ethers.parseUnits(sciParseFloat(a), 9); -export const wamplFP = (a: string): BigInt => ethers.parseUnits(sciParseFloat(a), 18); -export const ethOracleFP = (a: string): BigInt => ethers.parseUnits(sciParseFloat(a), 8); -export const amplOracleFP = (a: string): BigInt => - ethers.parseUnits(sciParseFloat(a), 18); -const nowTS = () => parseInt(Date.now() / 1000); +export const priceFP = (a: string): BigInt => ethers.parseUnits(sciParseFloat(a), 18); describe("WethWamplManager", function () { async function setupContracts() { @@ -20,12 +15,6 @@ describe("WethWamplManager", function () { // Deploy mock contracts const mockVault = new DMock("IAlphaProVault"); await mockVault.deploy(); - await mockVault.mockMethod("fullLower()", [-800000]); - await mockVault.mockMethod("fullUpper()", [800000]); - await mockVault.mockMethod("baseLower()", [45000]); - await mockVault.mockMethod("baseUpper()", [55000]); - await mockVault.mockMethod("getTwap()", [49875]); - await mockVault.mockMethod("limitThreshold()", [800000]); const mockPool = new DMock("IUniswapV3Pool"); await mockPool.deploy(); @@ -36,26 +25,26 @@ describe("WethWamplManager", function () { ); await mockPool.mockCall( "positions(bytes32)", - [univ3PositionKey(mockVault.target, 45000, 55000)], - [20000, 0, 0, 0, 0], + [univ3PositionKey(mockVault.target, -100000, 100000)], + [100000, 0, 0, 0, 0], ); + await mockPool.mockCall( + "positions(bytes32)", + [univ3PositionKey(mockVault.target, 20000, 40000)], + [50000, 0, 0, 0, 0], + ); + await mockVault.mockMethod("baseLower()", [-100000]); + await mockVault.mockMethod("baseUpper()", [100000]); + await mockVault.mockMethod("fullLower()", [-800000]); + await mockVault.mockMethod("fullUpper()", [800000]); + await mockVault.mockMethod("limitLower()", [20000]); + await mockVault.mockMethod("limitUpper()", [40000]); await mockVault.mockMethod("pool()", [mockPool.target]); - const mockCPIOracle = new DMock("IAmpleforthOracle"); - await mockCPIOracle.deploy(); - await mockCPIOracle.mockMethod("DECIMALS()", [18]); - await mockCPIOracle.mockMethod("getData()", [amplOracleFP("1.19"), true]); - - const mockETHOracle = new DMock("IChainlinkOracle"); - await mockETHOracle.deploy(); - await mockETHOracle.mockMethod("decimals()", [8]); - await mockETHOracle.mockMethod("latestRoundData()", [ - 0, - ethOracleFP("3300"), - 0, - nowTS(), - 0, - ]); + const mockOracle = new DMock("IMetaOracle"); + await mockOracle.deploy(); + await mockOracle.mockMethod("decimals()", [18]); + await mockOracle.mockMethod("amplPriceDeviation()", [priceFP("1.2"), true]); const mockWeth = new DMock("IERC20Upgradeable"); await mockWeth.deploy(); @@ -63,27 +52,17 @@ describe("WethWamplManager", function () { const mockWampl = new DMock("IWAMPL"); await mockWampl.deploy(); - await mockWampl.mockCall( - "wrapperToUnderlying(uint256)", - [wamplFP("1")], - [amplFP("18")], - ); await mockVault.mockMethod("token1()", [mockWampl.target]); // Deploy Manager contract const Manager = await ethers.getContractFactory("WethWamplManager"); - const manager = await Manager.deploy( - mockVault.target, - mockCPIOracle.target, - mockETHOracle.target, - ); + const manager = await Manager.deploy(mockVault.target, mockOracle.target); return { owner, addr1, mockVault, - mockCPIOracle, - mockETHOracle, + mockOracle, mockWeth, mockWampl, mockPool, @@ -91,6 +70,56 @@ describe("WethWamplManager", function () { }; } + async function stubRebalance(mockVault) { + await mockVault.clearMockMethod("setPeriod(uint32)"); + await mockVault.clearMockMethod("period()"); + await mockVault.mockMethod("rebalance()", []); + } + + async function stubForceRebalance(mockVault) { + await mockVault.mockMethod("period()", [86400]); + await mockVault.mockCall("setPeriod(uint32)", [0], []); + await mockVault.mockCall("setPeriod(uint32)", [86400], []); + await mockVault.mockMethod("rebalance()", []); + } + + async function stubOverweightWampl(mockVault) { + await mockVault.mockMethod("getTwap()", [30001]); + } + async function stubOverweightWeth(mockVault) { + await mockVault.mockMethod("getTwap()", [29999]); + await mockVault.mockMethod("limitLower()", [20000]); + await mockVault.mockMethod("limitUpper()", [40000]); + } + + async function stubTrimLiquidity(mockVault, burntLiq) { + await mockVault.mockCall( + "emergencyBurn(int24,int24,uint128)", + [-800000, 800000, burntLiq], + [], + ); + await mockVault.mockCall( + "emergencyBurn(int24,int24,uint128)", + [-100000, 100000, burntLiq], + [], + ); + } + + async function stubUnchangedLimitRange(mockVault) { + await mockVault.clearMockCall( + "emergencyBurn(int24,int24,uint128)", + [20000, 40000, 50000], + ); + } + + async function stubRemovedLimitRange(mockVault) { + await mockVault.mockCall( + "emergencyBurn(int24,int24,uint128)", + [20000, 40000, 50000], + [], + ); + } + describe("Initialization", function () { it("should set the correct owner", async function () { const { manager, owner } = await loadFixture(setupContracts); @@ -102,23 +131,14 @@ describe("WethWamplManager", function () { expect(await manager.VAULT()).to.eq(mockVault.target); }); - it("should set the correct CPI oracle address", async function () { - const { manager, mockCPIOracle } = await loadFixture(setupContracts); - expect(await manager.cpiOracle()).to.eq(mockCPIOracle.target); - }); - - it("should set the correct ETH oracle address", async function () { - const { manager, mockETHOracle } = await loadFixture(setupContracts); - expect(await manager.ethOracle()).to.eq(mockETHOracle.target); + it("should set the correct oracle address", async function () { + const { manager, mockOracle } = await loadFixture(setupContracts); + expect(await manager.oracle()).to.eq(mockOracle.target); }); it("should set the token refs", async function () { - const { manager, mockWeth, mockWampl, mockPool } = await loadFixture( - setupContracts, - ); + const { manager, mockPool } = await loadFixture(setupContracts); expect(await manager.POOL()).to.eq(mockPool.target); - expect(await manager.WETH()).to.eq(mockWeth.target); - expect(await manager.WAMPL()).to.eq(mockWampl.target); }); it("should set the active perc calculation params", async function () { @@ -145,48 +165,34 @@ describe("WethWamplManager", function () { }); }); - describe("#transferOwnership", function () { + describe("#updateOracle", function () { it("should fail to when called by non-owner", async function () { const { manager, addr1 } = await loadFixture(setupContracts); + const mockOracle = new DMock("IMetaOracle"); + await mockOracle.deploy(); + await mockOracle.mockMethod("decimals()", [18]); await expect( - manager.connect(addr1).transferOwnership(addr1.address), - ).to.be.revertedWith("Unauthorized caller"); - }); - - it("should succeed when called by owner", async function () { - const { manager, addr1 } = await loadFixture(setupContracts); - await manager.transferOwnership(addr1.address); - expect(await manager.owner()).to.eq(await addr1.getAddress()); - }); - }); - - describe("#setCpiOracle", function () { - it("should fail to when called by non-owner", async function () { - const { manager, addr1 } = await loadFixture(setupContracts); - await expect(manager.connect(addr1).setCpiOracle(addr1.address)).to.be.revertedWith( - "Unauthorized caller", - ); + manager.connect(addr1).updateOracle(mockOracle.target), + ).to.be.revertedWith("Ownable: caller is not the owner"); }); - it("should succeed when called by owner", async function () { - const { manager, addr1 } = await loadFixture(setupContracts); - await manager.setCpiOracle(addr1.address); - expect(await manager.cpiOracle()).to.eq(await addr1.getAddress()); - }); - }); - - describe("#setEthOracle", function () { - it("should fail to when called by non-owner", async function () { - const { manager, addr1 } = await loadFixture(setupContracts); - await expect(manager.connect(addr1).setEthOracle(addr1.address)).to.be.revertedWith( - "Unauthorized caller", + it("should fail when decimals dont match", async function () { + const { manager } = await loadFixture(setupContracts); + const mockOracle = new DMock("IMetaOracle"); + await mockOracle.deploy(); + await mockOracle.mockMethod("decimals()", [9]); + await expect(manager.updateOracle(mockOracle.target)).to.be.revertedWith( + "UnexpectedDecimals", ); }); it("should succeed when called by owner", async function () { - const { manager, addr1 } = await loadFixture(setupContracts); - await manager.setEthOracle(addr1.address); - expect(await manager.ethOracle()).to.eq(await addr1.getAddress()); + const { manager } = await loadFixture(setupContracts); + const mockOracle = new DMock("IMetaOracle"); + await mockOracle.deploy(); + await mockOracle.mockMethod("decimals()", [18]); + await manager.updateOracle(mockOracle.target); + expect(await manager.oracle()).to.eq(mockOracle.target); }); }); @@ -201,7 +207,7 @@ describe("WethWamplManager", function () { [percFP("0.5"), percFP("0.2"), percFP("1"), percFP("1")], [percFP("1"), percFP("1"), percFP("2"), percFP("0.2")], ), - ).to.be.revertedWith("Unauthorized caller"); + ).to.be.revertedWith("Ownable: caller is not the owner"); }); it("should succeed when called by owner", async function () { @@ -233,7 +239,7 @@ describe("WethWamplManager", function () { const { manager, addr1 } = await loadFixture(setupContracts); await expect( manager.connect(addr1).setLiquidityRanges(7200, 330000, 1200), - ).to.be.revertedWith("Unauthorized caller"); + ).to.be.revertedWith("Ownable: caller is not the owner"); }); it("should succeed when called by owner", async function () { @@ -254,7 +260,7 @@ describe("WethWamplManager", function () { .execOnVault( mockVault.refFactory.interface.encodeFunctionData("acceptManager"), ), - ).to.be.revertedWith("Unauthorized caller"); + ).to.be.revertedWith("Ownable: caller is not the owner"); }); it("should succeed when called by owner", async function () { @@ -273,7 +279,7 @@ describe("WethWamplManager", function () { manager.execOnVault( mockVault.refFactory.interface.encodeFunctionData("acceptManager"), ), - ).to.be.revertedWith("Vault call failed"); + ).to.be.revertedWith("VaultExecutionFailed"); await mockVault.mockCall("acceptManager()", [], []); await manager.execOnVault( mockVault.refFactory.interface.encodeFunctionData("acceptManager"), @@ -298,145 +304,9 @@ describe("WethWamplManager", function () { expect(await manager.computeActiveLiqPerc(percFP("5"))).to.eq(percFP("0.2")); expect(await manager.computeActiveLiqPerc(percFP("10"))).to.eq(percFP("0.2")); expect(await manager.computeActiveLiqPerc(percFP("100000"))).to.eq(percFP("0.2")); - expect(await manager.computeActiveLiqPerc(ethers.MaxUint256)).to.eq(percFP("0.2")); - }); - }); - - describe("#computeDeviationFactor", function () { - describe("when cpi is invalid", function () { - it("should return invalid", async function () { - const { manager, mockETHOracle, mockCPIOracle, mockWampl } = await loadFixture( - setupContracts, - ); - await mockETHOracle.mockMethod("latestRoundData()", [ - 0, - ethOracleFP("3300"), - 0, - nowTS(), - 0, - ]); - await mockCPIOracle.mockMethod("getData()", [amplOracleFP("1.19"), false]); - await mockWampl.mockCall( - "wrapperToUnderlying(uint256)", - [wamplFP("1")], - [amplFP("18")], - ); - const r = await manager.computeDeviationFactor.staticCall(); - expect(r[0]).to.eq(percFP("1.051378374404781289")); - expect(r[1]).to.eq(false); - }); - }); - - describe("when eth price is invalid", function () { - it("should return invalid", async function () { - const { manager, mockETHOracle, mockCPIOracle, mockWampl } = await loadFixture( - setupContracts, - ); - await mockETHOracle.mockMethod("latestRoundData()", [ - 0, - ethOracleFP("3300"), - 0, - nowTS() - 86400 * 7, - 0, - ]); - await mockCPIOracle.mockMethod("getData()", [amplOracleFP("1.19"), true]); - await mockWampl.mockCall( - "wrapperToUnderlying(uint256)", - [wamplFP("1")], - [amplFP("18")], - ); - const r = await manager.computeDeviationFactor.staticCall(); - expect(r[0]).to.eq(percFP("1.051378374404781289")); - expect(r[1]).to.eq(false); - }); - }); - - it("should return deviation factor", async function () { - const { manager, mockETHOracle, mockCPIOracle, mockWampl } = await loadFixture( - setupContracts, - ); - await mockETHOracle.mockMethod("latestRoundData()", [ - 0, - ethOracleFP("3300"), - 0, - nowTS(), - 0, - ]); - await mockCPIOracle.mockMethod("getData()", [amplOracleFP("1.19"), true]); - await mockWampl.mockCall( - "wrapperToUnderlying(uint256)", - [wamplFP("1")], - [amplFP("18")], - ); - const r = await manager.computeDeviationFactor.staticCall(); - expect(r[0]).to.eq(percFP("1.051378374404781289")); - expect(r[1]).to.eq(true); - }); - - it("should return deviation factor", async function () { - const { manager, mockETHOracle, mockCPIOracle, mockWampl } = await loadFixture( - setupContracts, - ); - await mockETHOracle.mockMethod("latestRoundData()", [ - 0, - ethOracleFP("3300"), - 0, - nowTS(), - 0, - ]); - await mockCPIOracle.mockMethod("getData()", [amplOracleFP("1.19"), true]); - await mockWampl.mockCall( - "wrapperToUnderlying(uint256)", - [wamplFP("1")], - [amplFP("10")], - ); - const r = await manager.computeDeviationFactor.staticCall(); - expect(r[0]).to.eq(percFP("1.892481073928606322")); - expect(r[1]).to.eq(true); - }); - - it("should return deviation factor", async function () { - const { manager, mockETHOracle, mockCPIOracle, mockWampl } = await loadFixture( - setupContracts, - ); - await mockETHOracle.mockMethod("latestRoundData()", [ - 0, - ethOracleFP("3300"), - 0, - nowTS(), - 0, - ]); - await mockCPIOracle.mockMethod("getData()", [amplOracleFP("1.19"), true]); - await mockWampl.mockCall( - "wrapperToUnderlying(uint256)", - [wamplFP("1")], - [amplFP("25")], - ); - const r = await manager.computeDeviationFactor.staticCall(); - expect(r[0]).to.eq(percFP("0.756992429571442528")); - expect(r[1]).to.eq(true); - }); - - it("should return max deviation when price is too high", async function () { - const { manager, mockVault, mockETHOracle, mockCPIOracle, mockWampl } = - await loadFixture(setupContracts); - await mockVault.mockMethod("getTwap()", [1]); - await mockETHOracle.mockMethod("latestRoundData()", [ - 0, - ethOracleFP("3300"), - 0, - nowTS(), - 0, - ]); - await mockCPIOracle.mockMethod("getData()", [amplOracleFP("1.19"), true]); - await mockWampl.mockCall( - "wrapperToUnderlying(uint256)", - [wamplFP("1")], - [amplFP("18")], - ); - const r = await manager.computeDeviationFactor.staticCall(); - expect(r[0]).to.eq(percFP("100")); - expect(r[1]).to.eq(true); + expect( + await manager.computeActiveLiqPerc(percFP("1000000000000000000000000")), + ).to.eq(percFP("0.2")); }); }); @@ -444,9 +314,7 @@ describe("WethWamplManager", function () { describe("when wampl sell", function () { it("should return true", async function () { const { manager, mockVault } = await loadFixture(setupContracts); - await mockVault.mockMethod("getTwap()", [30001]); - await mockVault.mockMethod("limitLower()", [20000]); - await mockVault.mockMethod("limitUpper()", [40000]); + await stubOverweightWampl(mockVault); expect(await manager.isOverweightWampl()).to.eq(true); }); }); @@ -454,427 +322,166 @@ describe("WethWamplManager", function () { describe("when wampl buy", function () { it("should return false", async function () { const { manager, mockVault } = await loadFixture(setupContracts); - await mockVault.mockMethod("getTwap()", [29999]); - await mockVault.mockMethod("limitLower()", [20000]); - await mockVault.mockMethod("limitUpper()", [40000]); + await stubOverweightWeth(mockVault); expect(await manager.isOverweightWampl()).to.eq(false); }); }); }); - describe("#rebalance", function () { - describe("when activePercDelta is within threshold", function () { - describe("when deviation is < 1 and goes > 1", function () { - describe("when overweight wampl", function () { - it("should trim liquidity & keep limit range", async function () { - const { manager, mockVault } = await loadFixture(setupContracts); - await manager.setActivePercParams( - percFP("1"), - [percFP("0.5"), percFP("0.2"), percFP("1"), percFP("1")], - [percFP("1"), percFP("1"), percFP("2"), percFP("0.2")], - ); - - await mockVault.mockMethod("getTwap()", [49500]); - await mockVault.mockMethod("limitLower()", [40000]); - await mockVault.mockMethod("limitUpper()", [45000]); - await mockVault.mockMethod("period()", [86400]); - await mockVault.mockCall("setPeriod(uint32)", [0], []); - await mockVault.mockCall("setPeriod(uint32)", [86400], []); - await mockVault.mockMethod("rebalance()", []); - - await mockVault.mockCall( - "emergencyBurn(int24,int24,uint128)", - [-800000, 800000, 7324], - [], - ); - await mockVault.mockCall( - "emergencyBurn(int24,int24,uint128)", - [45000, 55000, 1464], - [], - ); - - expect(await manager.prevDeviation()).to.eq("0"); - expect(await manager.isOverweightWampl()).to.eq(true); - await expect(manager.rebalance()).not.to.be.reverted; - expect(await manager.prevDeviation()).to.eq(percFP("1.091551595254704898")); - }); - }); - - describe("when overweight weth", function () { - it("should trim liquidity & remove limit range", async function () { - const { manager, mockVault, mockPool } = await loadFixture(setupContracts); - await manager.setActivePercParams( - percFP("1"), - [percFP("0.5"), percFP("0.2"), percFP("1"), percFP("1")], - [percFP("1"), percFP("1"), percFP("2"), percFP("0.2")], - ); - - await mockVault.mockMethod("getTwap()", [49500]); - await mockVault.mockMethod("limitLower()", [50000]); - await mockVault.mockMethod("limitUpper()", [55000]); - await mockPool.mockCall( - "positions(bytes32)", - [univ3PositionKey(mockVault.target, 50000, 55000)], - [50000, 0, 0, 0, 0], - ); - - await mockVault.mockMethod("period()", [86400]); - await mockVault.mockCall("setPeriod(uint32)", [0], []); - await mockVault.mockCall("setPeriod(uint32)", [86400], []); - await mockVault.mockMethod("rebalance()", []); - - await mockVault.clearMockMethod("emergencyBurn(int24,int24,uint128)"); - await mockVault.mockCall( - "emergencyBurn(int24,int24,uint128)", - [-800000, 800000, 7324], - [], - ); - await mockVault.mockCall( - "emergencyBurn(int24,int24,uint128)", - [45000, 55000, 1464], - [], - ); - await mockVault.mockCall( - "emergencyBurn(int24,int24,uint128)", - [50000, 55000, 50000], - [], - ); - - expect(await manager.prevDeviation()).to.eq("0"); - expect(await manager.isOverweightWampl()).to.eq(false); - await expect(manager.rebalance()).not.to.be.reverted; - expect(await manager.prevDeviation()).to.eq(percFP("1.091551595254704898")); - }); - }); + describe("shouldRemoveLimitRange", function () { + describe("is overweight wampl", function () { + it("should return bool", async function () { + const { manager, mockVault } = await loadFixture(setupContracts); + await stubOverweightWampl(mockVault); + expect(await manager.shouldRemoveLimitRange(percFP("1.01"))).to.eq(false); + expect(await manager.shouldRemoveLimitRange(percFP("1"))).to.eq(false); + expect(await manager.shouldRemoveLimitRange(percFP("0.99"))).to.eq(true); }); + }); - describe("when deviation is > 1 and goes < 1", function () { - describe("when overweight wampl", function () { - it("should trim liquidity & remove limit range", async function () { - const { manager, mockVault, mockPool } = await loadFixture(setupContracts); - await manager.setActivePercParams( - percFP("1"), - [percFP("0.5"), percFP("0.2"), percFP("1"), percFP("1")], - [percFP("1"), percFP("1"), percFP("2"), percFP("0.2")], - ); - - await mockVault.mockMethod("getTwap()", [49500]); - await mockVault.mockMethod("limitLower()", [40000]); - await mockVault.mockMethod("limitUpper()", [45000]); - await mockVault.mockMethod("period()", [86400]); - await mockVault.mockCall("setPeriod(uint32)", [0], []); - await mockVault.mockCall("setPeriod(uint32)", [86400], []); - await mockVault.mockMethod("rebalance()", []); - await mockVault.mockMethod("emergencyBurn(int24,int24,uint128)", []); - await manager.rebalance(); - - await mockVault.mockMethod("getTwap()", [52000]); - await mockVault.mockMethod("limitLower()", [50000]); - await mockVault.mockMethod("limitUpper()", [51000]); - await mockPool.mockCall( - "positions(bytes32)", - [univ3PositionKey(mockVault.target, 50000, 51000)], - [50000, 0, 0, 0, 0], - ); - - await mockVault.clearMockMethod("emergencyBurn(int24,int24,uint128)"); - await mockVault.mockCall( - "emergencyBurn(int24,int24,uint128)", - [-800000, 800000, 23982], - [], - ); - await mockVault.mockCall( - "emergencyBurn(int24,int24,uint128)", - [45000, 55000, 4796], - [], - ); - await mockVault.mockCall( - "emergencyBurn(int24,int24,uint128)", - [50000, 51000, 50000], - [], - ); - - expect(await manager.prevDeviation()).to.eq(percFP("1.091551595254704898")); - expect(await manager.isOverweightWampl()).to.eq(true); - await expect(manager.rebalance()).not.to.be.reverted; - expect(await manager.prevDeviation()).to.eq(percFP("0.850111862770710708")); - }); - }); - - describe("when overweight weth", function () { - it("should trim liquidity & keep limit range", async function () { - const { manager, mockVault } = await loadFixture(setupContracts); - await manager.setActivePercParams( - percFP("1"), - [percFP("0.5"), percFP("0.2"), percFP("1"), percFP("1")], - [percFP("1"), percFP("1"), percFP("2"), percFP("0.2")], - ); - - await mockVault.mockMethod("getTwap()", [49500]); - await mockVault.mockMethod("limitLower()", [40000]); - await mockVault.mockMethod("limitUpper()", [45000]); - await mockVault.mockMethod("period()", [86400]); - await mockVault.mockCall("setPeriod(uint32)", [0], []); - await mockVault.mockCall("setPeriod(uint32)", [86400], []); - await mockVault.mockMethod("rebalance()", []); - await mockVault.mockMethod("emergencyBurn(int24,int24,uint128)", []); - await manager.rebalance(); - - await mockVault.mockMethod("getTwap()", [52000]); - await mockVault.mockMethod("limitLower()", [53000]); - await mockVault.mockMethod("limitUpper()", [55000]); - - await mockVault.clearMockMethod("emergencyBurn(int24,int24,uint128)"); - await mockVault.mockCall( - "emergencyBurn(int24,int24,uint128)", - [-800000, 800000, 23982], - [], - ); - await mockVault.mockCall( - "emergencyBurn(int24,int24,uint128)", - [45000, 55000, 4796], - [], - ); - - expect(await manager.prevDeviation()).to.eq(percFP("1.091551595254704898")); - expect(await manager.isOverweightWampl()).to.eq(false); - await expect(manager.rebalance()).not.to.be.reverted; - expect(await manager.prevDeviation()).to.eq(percFP("0.850111862770710708")); - }); - }); + describe("is overweight weth", function () { + it("should return bool", async function () { + const { manager, mockVault } = await loadFixture(setupContracts); + await stubOverweightWeth(mockVault); + expect(await manager.shouldRemoveLimitRange(percFP("1.01"))).to.eq(true); + expect(await manager.shouldRemoveLimitRange(percFP("1"))).to.eq(false); + expect(await manager.shouldRemoveLimitRange(percFP("0.99"))).to.eq(false); }); }); + }); - describe("when activePercDelta is outside threshold", function () { - describe("when deviation is < 1 and goes > 1", function () { - describe("when overweight wampl", function () { - it("should trim liquidity & keep limit range", async function () { - const { manager, mockVault } = await loadFixture(setupContracts); - - await mockVault.mockMethod("getTwap()", [49500]); - await mockVault.mockMethod("limitLower()", [40000]); - await mockVault.mockMethod("limitUpper()", [45000]); - await mockVault.mockMethod("period()", [86400]); - await mockVault.mockCall("setPeriod(uint32)", [0], []); - await mockVault.mockCall("setPeriod(uint32)", [86400], []); - await mockVault.mockMethod("rebalance()", []); - - await mockVault.mockCall( - "emergencyBurn(int24,int24,uint128)", - [-800000, 800000, 7324], - [], - ); - await mockVault.mockCall( - "emergencyBurn(int24,int24,uint128)", - [45000, 55000, 1464], - [], - ); - - expect(await manager.prevDeviation()).to.eq("0"); - expect(await manager.isOverweightWampl()).to.eq(true); - await expect(manager.rebalance()).not.to.be.reverted; - expect(await manager.prevDeviation()).to.eq(percFP("1.091551595254704898")); - }); - }); - - describe("when overweight weth", function () { - it("should trim liquidity & remove limit range", async function () { - const { manager, mockVault, mockPool } = await loadFixture(setupContracts); - - await mockVault.mockMethod("getTwap()", [49500]); - await mockVault.mockMethod("limitLower()", [50000]); - await mockVault.mockMethod("limitUpper()", [55000]); - await mockPool.mockCall( - "positions(bytes32)", - [univ3PositionKey(mockVault.target, 50000, 55000)], - [50000, 0, 0, 0, 0], - ); - - await mockVault.mockMethod("period()", [86400]); - await mockVault.mockCall("setPeriod(uint32)", [0], []); - await mockVault.mockCall("setPeriod(uint32)", [86400], []); - await mockVault.mockMethod("rebalance()", []); - - await mockVault.mockCall( - "emergencyBurn(int24,int24,uint128)", - [-800000, 800000, 7324], - [], - ); - await mockVault.mockCall( - "emergencyBurn(int24,int24,uint128)", - [45000, 55000, 1464], - [], - ); - await mockVault.mockCall( - "emergencyBurn(int24,int24,uint128)", - [50000, 55000, 50000], - [], - ); - - expect(await manager.prevDeviation()).to.eq("0"); - expect(await manager.isOverweightWampl()).to.eq(false); - await expect(manager.rebalance()).not.to.be.reverted; - expect(await manager.prevDeviation()).to.eq(percFP("1.091551595254704898")); - }); - }); - }); + describe("shouldForceRebalance", function () { + it("should return bool", async function () { + const { manager } = await loadFixture(setupContracts); - describe("when deviation is > 1 and goes < 1", function () { - describe("when overweight wampl", function () { - it("should trim liquidity & remove limit range", async function () { - const { manager, mockVault, mockPool } = await loadFixture(setupContracts); - - await mockVault.mockMethod("getTwap()", [49500]); - await mockVault.mockMethod("limitLower()", [40000]); - await mockVault.mockMethod("limitUpper()", [45000]); - await mockVault.mockMethod("period()", [86400]); - await mockVault.mockCall("setPeriod(uint32)", [0], []); - await mockVault.mockCall("setPeriod(uint32)", [86400], []); - await mockVault.mockMethod("rebalance()", []); - await mockVault.mockMethod("emergencyBurn(int24,int24,uint128)", []); - await manager.rebalance(); - - await mockVault.mockMethod("getTwap()", [52000]); - await mockVault.mockMethod("limitLower()", [50000]); - await mockVault.mockMethod("limitUpper()", [51000]); - await mockPool.mockCall( - "positions(bytes32)", - [univ3PositionKey(mockVault.target, 50000, 51000)], - [50000, 0, 0, 0, 0], - ); - await mockVault.clearMockMethod("emergencyBurn(int24,int24,uint128)"); - await mockVault.mockCall( - "emergencyBurn(int24,int24,uint128)", - [-800000, 800000, 23982], - [], - ); - await mockVault.mockCall( - "emergencyBurn(int24,int24,uint128)", - [45000, 55000, 4796], - [], - ); - await mockVault.mockCall( - "emergencyBurn(int24,int24,uint128)", - [50000, 51000, 50000], - [], - ); - - expect(await manager.prevDeviation()).to.eq(percFP("1.091551595254704898")); - expect(await manager.isOverweightWampl()).to.eq(true); - await expect(manager.rebalance()).not.to.be.reverted; - expect(await manager.prevDeviation()).to.eq(percFP("0.850111862770710708")); - }); - }); - - describe("when overweight weth", function () { - it("should trim liquidity & keep limit range", async function () { - const { manager, mockVault } = await loadFixture(setupContracts); - - await mockVault.mockMethod("getTwap()", [49500]); - await mockVault.mockMethod("limitLower()", [40000]); - await mockVault.mockMethod("limitUpper()", [45000]); - await mockVault.mockMethod("period()", [86400]); - await mockVault.mockCall("setPeriod(uint32)", [0], []); - await mockVault.mockCall("setPeriod(uint32)", [86400], []); - await mockVault.mockMethod("rebalance()", []); - await mockVault.mockMethod("emergencyBurn(int24,int24,uint128)", []); - await manager.rebalance(); - - await mockVault.mockMethod("getTwap()", [52000]); - await mockVault.mockMethod("limitLower()", [53000]); - await mockVault.mockMethod("limitUpper()", [55000]); - - await mockVault.clearMockMethod("emergencyBurn(int24,int24,uint128)"); - await mockVault.mockCall( - "emergencyBurn(int24,int24,uint128)", - [-800000, 800000, 23982], - [], - ); - await mockVault.mockCall( - "emergencyBurn(int24,int24,uint128)", - [45000, 55000, 4796], - [], - ); - - expect(await manager.prevDeviation()).to.eq(percFP("1.091551595254704898")); - expect(await manager.isOverweightWampl()).to.eq(false); - await expect(manager.rebalance()).not.to.be.reverted; - expect(await manager.prevDeviation()).to.eq(percFP("0.850111862770710708")); - }); - }); - }); + // inside active delta + expect( + await manager.shouldForceRebalance(percFP("0.5"), percFP("0.8"), percFP("0.09")), + ).to.eq(false); + expect( + await manager.shouldForceRebalance(percFP("0.9"), percFP("1.1"), percFP("0.09")), + ).to.eq(true); + expect( + await manager.shouldForceRebalance(percFP("1.0"), percFP("1.1"), percFP("0.09")), + ).to.eq(true); + expect( + await manager.shouldForceRebalance(percFP("1.05"), percFP("1.1"), percFP("0.09")), + ).to.eq(false); + expect( + await manager.shouldForceRebalance(percFP("1.1"), percFP("1"), percFP("0.09")), + ).to.eq(false); + expect( + await manager.shouldForceRebalance(percFP("1.1"), percFP("0.99"), percFP("0.09")), + ).to.eq(true); + expect( + await manager.shouldForceRebalance(percFP("1"), percFP("0.8"), percFP("0.09")), + ).to.eq(true); + expect( + await manager.shouldForceRebalance(percFP("0.9"), percFP("0.8"), percFP("0.09")), + ).to.eq(false); + + // outside active delta + expect( + await manager.shouldForceRebalance(percFP("0.5"), percFP("0.8"), percFP("1.1")), + ).to.eq(true); + expect( + await manager.shouldForceRebalance(percFP("0.9"), percFP("1.1"), percFP("1.1")), + ).to.eq(true); + expect( + await manager.shouldForceRebalance(percFP("1.0"), percFP("1.1"), percFP("1.1")), + ).to.eq(true); + expect( + await manager.shouldForceRebalance(percFP("1.05"), percFP("1.1"), percFP("1.1")), + ).to.eq(true); + expect( + await manager.shouldForceRebalance(percFP("1.1"), percFP("1"), percFP("1.1")), + ).to.eq(true); + expect( + await manager.shouldForceRebalance(percFP("1.1"), percFP("0.99"), percFP("1.1")), + ).to.eq(true); + expect( + await manager.shouldForceRebalance(percFP("1"), percFP("0.8"), percFP("1.1")), + ).to.eq(true); + expect( + await manager.shouldForceRebalance(percFP("0.9"), percFP("0.8"), percFP("1.1")), + ).to.eq(true); }); + }); - describe("when deviation remains below 1", function () { - describe("when overweight wampl", function () { - it("should not force rebalance", async function () { - const { manager, mockVault, mockPool } = await loadFixture(setupContracts); - await manager.setActivePercParams( - percFP("1"), - [percFP("0.5"), percFP("0.2"), percFP("1"), percFP("1")], - [percFP("1"), percFP("1"), percFP("2"), percFP("0.2")], - ); - - await mockVault.mockMethod("getTwap()", [51500]); - await mockVault.mockMethod("limitLower()", [40000]); - await mockVault.mockMethod("limitUpper()", [45000]); - await mockPool.mockCall( - "positions(bytes32)", - [univ3PositionKey(mockVault.target, 40000, 45000)], - [50000, 0, 0, 0, 0], - ); - await mockVault.mockMethod("rebalance()", []); - await mockVault.mockMethod("emergencyBurn(int24,int24,uint128)", []); - - expect(await manager.prevDeviation()).to.eq("0"); - expect(await manager.isOverweightWampl()).to.eq(true); - await expect(manager.rebalance()).not.to.be.reverted; - expect(await manager.prevDeviation()).to.eq(percFP("0.893695795923885030")); - }); - }); + describe("#rebalance", function () { + it("should rebalance, trim liquidity and prev_deviation", async function () { + const { manager, mockVault, mockOracle } = await loadFixture(setupContracts); + + await stubOverweightWeth(mockVault); + await stubForceRebalance(mockVault); + await stubTrimLiquidity(mockVault, 1600); + await stubUnchangedLimitRange(mockVault); + await mockOracle.mockMethod("amplPriceDeviation()", [priceFP("0.99"), true]); + + expect(await manager.isOverweightWampl()).to.eq(false); + expect(await manager.prevDeviation()).to.eq("0"); + await expect(manager.rebalance()).not.to.be.reverted; + expect(await manager.prevDeviation()).to.eq(percFP("0.99")); }); - describe("when deviation remains above 1", function () { - describe("when overweight weth", function () { - it("should not force rebalance", async function () { - const { manager, mockVault, mockPool } = await loadFixture(setupContracts); - await manager.setActivePercParams( - percFP("1"), - [percFP("0.5"), percFP("0.2"), percFP("1"), percFP("1")], - [percFP("1"), percFP("1"), percFP("2"), percFP("0.2")], - ); - - await mockVault.mockMethod("getTwap()", [49500]); - await mockVault.mockMethod("limitLower()", [40000]); - await mockVault.mockMethod("limitUpper()", [45000]); - await mockVault.mockMethod("period()", [86400]); - await mockVault.mockCall("setPeriod(uint32)", [0], []); - await mockVault.mockCall("setPeriod(uint32)", [86400], []); - await mockVault.mockMethod("rebalance()", []); - await mockVault.mockMethod("emergencyBurn(int24,int24,uint128)", []); - await manager.rebalance(); - - await mockVault.clearMockCall("setPeriod(uint32)", [0]); - await mockVault.clearMockCall("setPeriod(uint32)", [86400]); - await mockVault.clearMockCall("period()", []); - await mockVault.clearMockMethod("emergencyBurn(int24,int24,uint128)"); - - await mockVault.mockMethod("getTwap()", [50000]); - await mockVault.mockMethod("limitLower()", [53000]); - await mockVault.mockMethod("limitUpper()", [55000]); - await mockPool.mockCall( - "positions(bytes32)", - [univ3PositionKey(mockVault.target, 53000, 55000)], - [50000, 0, 0, 0, 0], - ); - await mockVault.mockMethod("emergencyBurn(int24,int24,uint128)", []); - - expect(await manager.prevDeviation()).to.eq(percFP("1.091551595254704898")); - expect(await manager.isOverweightWampl()).to.eq(false); - await expect(manager.rebalance()).not.to.be.reverted; - expect(await manager.prevDeviation()).to.eq(percFP("1.038318591387163286")); - }); - }); + it("should rebalance, trim liquidity and prev_deviation", async function () { + const { manager, mockVault, mockOracle } = await loadFixture(setupContracts); + + await stubOverweightWampl(mockVault); + await stubForceRebalance(mockVault); + await stubTrimLiquidity(mockVault, 1600); + await stubRemovedLimitRange(mockVault); + await mockOracle.mockMethod("amplPriceDeviation()", [priceFP("0.99"), true]); + + expect(await manager.isOverweightWampl()).to.eq(true); + expect(await manager.prevDeviation()).to.eq("0"); + await expect(manager.rebalance()).not.to.be.reverted; + expect(await manager.prevDeviation()).to.eq(percFP("0.99")); + }); + + it("should rebalance, trim liquidity and prev_deviation", async function () { + const { manager, mockVault, mockOracle } = await loadFixture(setupContracts); + + await stubOverweightWeth(mockVault); + await stubForceRebalance(mockVault); + await stubTrimLiquidity(mockVault, 16000); + await stubRemovedLimitRange(mockVault); + await mockOracle.mockMethod("amplPriceDeviation()", [priceFP("1.2"), true]); + + expect(await manager.isOverweightWampl()).to.eq(false); + expect(await manager.prevDeviation()).to.eq("0"); + await expect(manager.rebalance()).not.to.be.reverted; + expect(await manager.prevDeviation()).to.eq(percFP("1.2")); + }); + + it("should rebalance, trim liquidity and prev_deviation", async function () { + const { manager, mockVault, mockOracle } = await loadFixture(setupContracts); + + await stubOverweightWampl(mockVault); + await stubForceRebalance(mockVault); + await stubTrimLiquidity(mockVault, 16000); + await stubUnchangedLimitRange(mockVault); + await mockOracle.mockMethod("amplPriceDeviation()", [priceFP("1.2"), true]); + + expect(await manager.isOverweightWampl()).to.eq(true); + expect(await manager.prevDeviation()).to.eq("0"); + await expect(manager.rebalance()).not.to.be.reverted; + expect(await manager.prevDeviation()).to.eq(percFP("1.2")); + }); + + it("should rebalance, trim liquidity and not change prev_deviation", async function () { + const { manager, mockVault, mockOracle } = await loadFixture(setupContracts); + + await stubOverweightWampl(mockVault); + await stubRebalance(mockVault); + await stubTrimLiquidity(mockVault, 80000); + await stubRemovedLimitRange(mockVault); + await mockOracle.mockMethod("amplPriceDeviation()", [priceFP("1.2"), false]); + + expect(await manager.isOverweightWampl()).to.eq(true); + expect(await manager.prevDeviation()).to.eq("0"); + await expect(manager.rebalance()).not.to.be.reverted; + expect(await manager.prevDeviation()).to.eq(percFP("0")); }); }); }); diff --git a/spot-vaults/test/helpers.ts b/spot-vaults/test/helpers.ts index aa3bfa14..141635fd 100644 --- a/spot-vaults/test/helpers.ts +++ b/spot-vaults/test/helpers.ts @@ -3,13 +3,20 @@ import { Contract, ContractFactory } from "ethers"; export const sciParseFloat = (a: string): BigInt => a.includes("e") ? parseFloat(a).toFixed(18) : a; +export const percFP = (a: string): BigInt => ethers.parseUnits(sciParseFloat(a), 18); +export const priceFP = (a: string): BigInt => ethers.parseUnits(sciParseFloat(a), 18); + export const usdFP = (a: string): BigInt => ethers.parseUnits(sciParseFloat(a), 6); export const perpFP = (a: string): BigInt => ethers.parseUnits(sciParseFloat(a), 9); -export const percentageFP = (a: string): BigInt => - ethers.parseUnits(sciParseFloat(a), 18); -export const priceFP = (a: string): BigInt => ethers.parseUnits(sciParseFloat(a), 18); export const lpAmtFP = (a: string): BigInt => ethers.parseUnits(sciParseFloat(a), 24); -export const oracleAnsFP = (a: string): BigInt => ethers.parseUnits(sciParseFloat(a), 8); +export const amplFP = (a: string): BigInt => ethers.parseUnits(sciParseFloat(a), 9); +export const wamplFP = (a: string): BigInt => ethers.parseUnits(sciParseFloat(a), 18); +export const wethFP = (a: string): BigInt => ethers.parseUnits(sciParseFloat(a), 18); +export const usdOracleFP = (a: string): BigInt => ethers.parseUnits(sciParseFloat(a), 8); +export const ethOracleFP = (a: string): BigInt => ethers.parseUnits(sciParseFloat(a), 18); +export const amplOracleFP = (a: string): BigInt => + ethers.parseUnits(sciParseFloat(a), 18); +export const drFP = (a: string): BigInt => ethers.parseUnits(sciParseFloat(a), 8); export class DMock { private refArtifact: string; diff --git a/yarn.lock b/yarn.lock index 50ffa547..9e3dcae1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5,13 +5,6 @@ __metadata: version: 6 cacheKey: 8 -"@adraffy/ens-normalize@npm:1.10.0": - version: 1.10.0 - resolution: "@adraffy/ens-normalize@npm:1.10.0" - checksum: af0540f963a2632da2bbc37e36ea6593dcfc607b937857133791781e246d47f870d5e3d21fa70d5cfe94e772c284588c81ea3f5b7f4ea8fbb824369444e4dbcb - languageName: node - linkType: hard - "@adraffy/ens-normalize@npm:1.10.1": version: 1.10.1 resolution: "@adraffy/ens-normalize@npm:1.10.1" @@ -19,24 +12,30 @@ __metadata: languageName: node linkType: hard +"@adraffy/ens-normalize@npm:^1.10.1": + version: 1.11.0 + resolution: "@adraffy/ens-normalize@npm:1.11.0" + checksum: b2911269e3e0ec6396a2e5433a99e0e1f9726befc6c167994448cd0e53dbdd0be22b4835b4f619558b568ed9aa7312426b8fa6557a13999463489daa88169ee5 + languageName: node + linkType: hard + "@ampleforthorg/spot-contracts@workspace:spot-contracts, @ampleforthorg/spot-contracts@workspaces:*": version: 0.0.0-use.local resolution: "@ampleforthorg/spot-contracts@workspace:spot-contracts" dependencies: - "@defi-wonderland/smock": ^2.3.4 "@ethersproject/abi": ^5.6.4 "@ethersproject/abstract-provider": ^5.7.0 "@ethersproject/abstract-signer": ^5.7.0 "@ethersproject/bytes": ^5.6.1 "@ethersproject/providers": ^5.6.8 - "@nomicfoundation/hardhat-chai-matchers": ^1.0.6 - "@nomicfoundation/hardhat-verify": ^1.1.0 - "@nomiclabs/hardhat-ethers": ^2.2.1 - "@nomiclabs/hardhat-waffle": ^2.0.3 - "@openzeppelin/contracts-upgradeable": ^4.7.3 - "@openzeppelin/hardhat-upgrades": ^1.19.0 + "@nomicfoundation/hardhat-chai-matchers": latest + "@nomicfoundation/hardhat-ethers": ^3.0.0 + "@nomicfoundation/hardhat-verify": latest + "@nomiclabs/hardhat-waffle": ^2.0.6 + "@openzeppelin/contracts-upgradeable": 4.7.3 + "@openzeppelin/hardhat-upgrades": ^3.0.4 "@openzeppelin/upgrades-core": latest - "@typechain/ethers-v5": ^10.1.0 + "@typechain/ethers-v6": ^0.5.1 "@typechain/hardhat": ^6.1.2 "@types/chai": ^4.3.1 "@types/mocha": ^9.1.1 @@ -56,11 +55,12 @@ __metadata: eslint-plugin-prettier: ^4.2.1 eslint-plugin-promise: ^6.0.0 eslint-plugin-unused-imports: ^3.0.0 - ethereum-waffle: ^3.4.4 - ethers: ^5.6.9 - ganache-cli: ^6.12.2 - hardhat: ^2.19.4 - hardhat-gas-reporter: ^1.0.9 + ethereum-waffle: latest + ethers: ^6.6.0 + ethers-v5: "npm:ethers@^5.7.0" + ganache-cli: latest + hardhat: ^2.23.0 + hardhat-gas-reporter: latest lodash: ^4.17.21 prettier: ^2.7.1 prettier-plugin-solidity: ^1.0.0-dev.23 @@ -157,7 +157,7 @@ __metadata: ethers: ^6.6.0 ethers-v5: "npm:ethers@^5.7.0" ganache-cli: latest - hardhat: ^2.22.8 + hardhat: ^2.22.18 hardhat-gas-reporter: latest lodash: ^4.17.21 prettier: ^2.7.1 @@ -171,6 +171,32 @@ __metadata: languageName: unknown linkType: soft +"@aws-crypto/crc32@npm:5.2.0": + version: 5.2.0 + resolution: "@aws-crypto/crc32@npm:5.2.0" + dependencies: + "@aws-crypto/util": ^5.2.0 + "@aws-sdk/types": ^3.222.0 + tslib: ^2.6.2 + checksum: 1ddf7ec3fccf106205ff2476d90ae1d6625eabd47752f689c761b71e41fe451962b7a1c9ed25fe54e17dd747a62fbf4de06030fe56fe625f95285f6f70b96c57 + languageName: node + linkType: hard + +"@aws-crypto/sha256-browser@npm:5.2.0": + version: 5.2.0 + resolution: "@aws-crypto/sha256-browser@npm:5.2.0" + dependencies: + "@aws-crypto/sha256-js": ^5.2.0 + "@aws-crypto/supports-web-crypto": ^5.2.0 + "@aws-crypto/util": ^5.2.0 + "@aws-sdk/types": ^3.222.0 + "@aws-sdk/util-locate-window": ^3.0.0 + "@smithy/util-utf8": ^2.0.0 + tslib: ^2.6.2 + checksum: 773f12f2026d82a6bb4a23a8f491894a6d32525bd9b8bfbc12896526cf11882a7607a671c478c45f9cd7d6ba1caaed48a62b67c6f725244bd83a1275108f46c7 + languageName: node + linkType: hard + "@aws-crypto/sha256-js@npm:1.2.2": version: 1.2.2 resolution: "@aws-crypto/sha256-js@npm:1.2.2" @@ -182,6 +208,26 @@ __metadata: languageName: node linkType: hard +"@aws-crypto/sha256-js@npm:5.2.0, @aws-crypto/sha256-js@npm:^5.2.0": + version: 5.2.0 + resolution: "@aws-crypto/sha256-js@npm:5.2.0" + dependencies: + "@aws-crypto/util": ^5.2.0 + "@aws-sdk/types": ^3.222.0 + tslib: ^2.6.2 + checksum: 007fbe0436d714d0d0d282e2b61c90e45adcb9ad75eac9ac7ba03d32b56624afd09b2a9ceb4d659661cf17c51d74d1900ab6b00eacafc002da1101664955ca53 + languageName: node + linkType: hard + +"@aws-crypto/supports-web-crypto@npm:^5.2.0": + version: 5.2.0 + resolution: "@aws-crypto/supports-web-crypto@npm:5.2.0" + dependencies: + tslib: ^2.6.2 + checksum: 6ffc21de48b2b2c3e918193101d7e8fe949d47b37688892e1c39eaedaa938be80c0f404fe1c874c30cce16781026777a53bf47d5d90143ca91d0feb7c4a6f830 + languageName: node + linkType: hard + "@aws-crypto/util@npm:^1.2.2": version: 1.2.2 resolution: "@aws-crypto/util@npm:1.2.2" @@ -193,13 +239,432 @@ __metadata: languageName: node linkType: hard -"@aws-sdk/types@npm:^3.1.0": - version: 3.598.0 - resolution: "@aws-sdk/types@npm:3.598.0" +"@aws-crypto/util@npm:^5.2.0": + version: 5.2.0 + resolution: "@aws-crypto/util@npm:5.2.0" + dependencies: + "@aws-sdk/types": ^3.222.0 + "@smithy/util-utf8": ^2.0.0 + tslib: ^2.6.2 + checksum: f0f81d9d2771c59946cfec48b86cb23d39f78a966c4a1f89d4753abdc3cb38de06f907d1e6450059b121d48ac65d612ab88bdb70014553a077fc3dabddfbf8d6 + languageName: node + linkType: hard + +"@aws-sdk/client-lambda@npm:^3.563.0": + version: 3.804.0 + resolution: "@aws-sdk/client-lambda@npm:3.804.0" + dependencies: + "@aws-crypto/sha256-browser": 5.2.0 + "@aws-crypto/sha256-js": 5.2.0 + "@aws-sdk/core": 3.804.0 + "@aws-sdk/credential-provider-node": 3.804.0 + "@aws-sdk/middleware-host-header": 3.804.0 + "@aws-sdk/middleware-logger": 3.804.0 + "@aws-sdk/middleware-recursion-detection": 3.804.0 + "@aws-sdk/middleware-user-agent": 3.804.0 + "@aws-sdk/region-config-resolver": 3.804.0 + "@aws-sdk/types": 3.804.0 + "@aws-sdk/util-endpoints": 3.804.0 + "@aws-sdk/util-user-agent-browser": 3.804.0 + "@aws-sdk/util-user-agent-node": 3.804.0 + "@smithy/config-resolver": ^4.1.0 + "@smithy/core": ^3.3.1 + "@smithy/eventstream-serde-browser": ^4.0.2 + "@smithy/eventstream-serde-config-resolver": ^4.1.0 + "@smithy/eventstream-serde-node": ^4.0.2 + "@smithy/fetch-http-handler": ^5.0.2 + "@smithy/hash-node": ^4.0.2 + "@smithy/invalid-dependency": ^4.0.2 + "@smithy/middleware-content-length": ^4.0.2 + "@smithy/middleware-endpoint": ^4.1.2 + "@smithy/middleware-retry": ^4.1.3 + "@smithy/middleware-serde": ^4.0.3 + "@smithy/middleware-stack": ^4.0.2 + "@smithy/node-config-provider": ^4.0.2 + "@smithy/node-http-handler": ^4.0.4 + "@smithy/protocol-http": ^5.1.0 + "@smithy/smithy-client": ^4.2.2 + "@smithy/types": ^4.2.0 + "@smithy/url-parser": ^4.0.2 + "@smithy/util-base64": ^4.0.0 + "@smithy/util-body-length-browser": ^4.0.0 + "@smithy/util-body-length-node": ^4.0.0 + "@smithy/util-defaults-mode-browser": ^4.0.10 + "@smithy/util-defaults-mode-node": ^4.0.10 + "@smithy/util-endpoints": ^3.0.2 + "@smithy/util-middleware": ^4.0.2 + "@smithy/util-retry": ^4.0.3 + "@smithy/util-stream": ^4.2.0 + "@smithy/util-utf8": ^4.0.0 + "@smithy/util-waiter": ^4.0.3 + tslib: ^2.6.2 + checksum: 6b3ed01415d82cc77327d978cb8ed5ca814a949ab7fd6430c20fff4783b6129a6fb5d3cd6e88084faaacb336ae482c31995a08874e6d631de145424c0b7130dc + languageName: node + linkType: hard + +"@aws-sdk/client-sso@npm:3.804.0": + version: 3.804.0 + resolution: "@aws-sdk/client-sso@npm:3.804.0" + dependencies: + "@aws-crypto/sha256-browser": 5.2.0 + "@aws-crypto/sha256-js": 5.2.0 + "@aws-sdk/core": 3.804.0 + "@aws-sdk/middleware-host-header": 3.804.0 + "@aws-sdk/middleware-logger": 3.804.0 + "@aws-sdk/middleware-recursion-detection": 3.804.0 + "@aws-sdk/middleware-user-agent": 3.804.0 + "@aws-sdk/region-config-resolver": 3.804.0 + "@aws-sdk/types": 3.804.0 + "@aws-sdk/util-endpoints": 3.804.0 + "@aws-sdk/util-user-agent-browser": 3.804.0 + "@aws-sdk/util-user-agent-node": 3.804.0 + "@smithy/config-resolver": ^4.1.0 + "@smithy/core": ^3.3.1 + "@smithy/fetch-http-handler": ^5.0.2 + "@smithy/hash-node": ^4.0.2 + "@smithy/invalid-dependency": ^4.0.2 + "@smithy/middleware-content-length": ^4.0.2 + "@smithy/middleware-endpoint": ^4.1.2 + "@smithy/middleware-retry": ^4.1.3 + "@smithy/middleware-serde": ^4.0.3 + "@smithy/middleware-stack": ^4.0.2 + "@smithy/node-config-provider": ^4.0.2 + "@smithy/node-http-handler": ^4.0.4 + "@smithy/protocol-http": ^5.1.0 + "@smithy/smithy-client": ^4.2.2 + "@smithy/types": ^4.2.0 + "@smithy/url-parser": ^4.0.2 + "@smithy/util-base64": ^4.0.0 + "@smithy/util-body-length-browser": ^4.0.0 + "@smithy/util-body-length-node": ^4.0.0 + "@smithy/util-defaults-mode-browser": ^4.0.10 + "@smithy/util-defaults-mode-node": ^4.0.10 + "@smithy/util-endpoints": ^3.0.2 + "@smithy/util-middleware": ^4.0.2 + "@smithy/util-retry": ^4.0.3 + "@smithy/util-utf8": ^4.0.0 + tslib: ^2.6.2 + checksum: ddd097f5a4cb1617aa07f33c70878659d7b7e794a3c19a9a75b4da631a3306bf72d9585d8092040ab097e4a973c05a2bfab8ec4bebe1806e50548710b88e4ae3 + languageName: node + linkType: hard + +"@aws-sdk/core@npm:3.804.0": + version: 3.804.0 + resolution: "@aws-sdk/core@npm:3.804.0" + dependencies: + "@aws-sdk/types": 3.804.0 + "@smithy/core": ^3.3.1 + "@smithy/node-config-provider": ^4.0.2 + "@smithy/property-provider": ^4.0.2 + "@smithy/protocol-http": ^5.1.0 + "@smithy/signature-v4": ^5.1.0 + "@smithy/smithy-client": ^4.2.2 + "@smithy/types": ^4.2.0 + "@smithy/util-middleware": ^4.0.2 + fast-xml-parser: 4.4.1 + tslib: ^2.6.2 + checksum: 338efb8f2c7f2798f78450be8401334339f9662e9b9f654099123903a06ef7f45d2edd8b99ad4895e33969ad1d2e33153033950f9360795231a2cb4021c65065 + languageName: node + linkType: hard + +"@aws-sdk/credential-provider-env@npm:3.804.0": + version: 3.804.0 + resolution: "@aws-sdk/credential-provider-env@npm:3.804.0" + dependencies: + "@aws-sdk/core": 3.804.0 + "@aws-sdk/types": 3.804.0 + "@smithy/property-provider": ^4.0.2 + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + checksum: 76cae825be7bb350492f682488b13031d4799bd193a60d5dbd31ec2dbaf7bd79fac1d800293b49bec1d151580e9d1ab0245c7429599fd6e6a57385679b62957b + languageName: node + linkType: hard + +"@aws-sdk/credential-provider-http@npm:3.804.0": + version: 3.804.0 + resolution: "@aws-sdk/credential-provider-http@npm:3.804.0" + dependencies: + "@aws-sdk/core": 3.804.0 + "@aws-sdk/types": 3.804.0 + "@smithy/fetch-http-handler": ^5.0.2 + "@smithy/node-http-handler": ^4.0.4 + "@smithy/property-provider": ^4.0.2 + "@smithy/protocol-http": ^5.1.0 + "@smithy/smithy-client": ^4.2.2 + "@smithy/types": ^4.2.0 + "@smithy/util-stream": ^4.2.0 + tslib: ^2.6.2 + checksum: 2084f21c0be8799741cc584856f530e188dedda062656e292ed57035ea6cf2a5926e2e6cdf9f84d9d47c3228a86edfca493af3682a4ca3841c801b1728623dc2 + languageName: node + linkType: hard + +"@aws-sdk/credential-provider-ini@npm:3.804.0": + version: 3.804.0 + resolution: "@aws-sdk/credential-provider-ini@npm:3.804.0" + dependencies: + "@aws-sdk/core": 3.804.0 + "@aws-sdk/credential-provider-env": 3.804.0 + "@aws-sdk/credential-provider-http": 3.804.0 + "@aws-sdk/credential-provider-process": 3.804.0 + "@aws-sdk/credential-provider-sso": 3.804.0 + "@aws-sdk/credential-provider-web-identity": 3.804.0 + "@aws-sdk/nested-clients": 3.804.0 + "@aws-sdk/types": 3.804.0 + "@smithy/credential-provider-imds": ^4.0.2 + "@smithy/property-provider": ^4.0.2 + "@smithy/shared-ini-file-loader": ^4.0.2 + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + checksum: 3e65387b962bbef19d68584de762e13f1dceddc0507f9d59b15edea35380c49669226446c62d3c041fa48a86dd80f3f6d06c4d01ec07ec4f858e9879be2aa116 + languageName: node + linkType: hard + +"@aws-sdk/credential-provider-node@npm:3.804.0": + version: 3.804.0 + resolution: "@aws-sdk/credential-provider-node@npm:3.804.0" + dependencies: + "@aws-sdk/credential-provider-env": 3.804.0 + "@aws-sdk/credential-provider-http": 3.804.0 + "@aws-sdk/credential-provider-ini": 3.804.0 + "@aws-sdk/credential-provider-process": 3.804.0 + "@aws-sdk/credential-provider-sso": 3.804.0 + "@aws-sdk/credential-provider-web-identity": 3.804.0 + "@aws-sdk/types": 3.804.0 + "@smithy/credential-provider-imds": ^4.0.2 + "@smithy/property-provider": ^4.0.2 + "@smithy/shared-ini-file-loader": ^4.0.2 + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + checksum: 89a4013f6e2a22d7577a9e3ff6000392fccccb1dc21c0ac7c39c3024774d33ebddb3a092495976ebcd77fc9ee1bfbc37230b0e92ce34b1df8cb1866732cff1ac + languageName: node + linkType: hard + +"@aws-sdk/credential-provider-process@npm:3.804.0": + version: 3.804.0 + resolution: "@aws-sdk/credential-provider-process@npm:3.804.0" + dependencies: + "@aws-sdk/core": 3.804.0 + "@aws-sdk/types": 3.804.0 + "@smithy/property-provider": ^4.0.2 + "@smithy/shared-ini-file-loader": ^4.0.2 + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + checksum: 9f193dfa0244c1be42bfdbb9a4d2f77d8553501085db4f73a92176260795d24f5f8d4cbf4c974634c0ad968910c3dd7ee4eb4bc6ce84cbe516a61d6c78203430 + languageName: node + linkType: hard + +"@aws-sdk/credential-provider-sso@npm:3.804.0": + version: 3.804.0 + resolution: "@aws-sdk/credential-provider-sso@npm:3.804.0" + dependencies: + "@aws-sdk/client-sso": 3.804.0 + "@aws-sdk/core": 3.804.0 + "@aws-sdk/token-providers": 3.804.0 + "@aws-sdk/types": 3.804.0 + "@smithy/property-provider": ^4.0.2 + "@smithy/shared-ini-file-loader": ^4.0.2 + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + checksum: 66d97bbe361829079248ca2dcabc1968889908825827c03ef504b0d4d95e8d58da210b8053ef11c7bc29a463af5d2b391c0dd99d25ac3fcda5e51dfbcf997782 + languageName: node + linkType: hard + +"@aws-sdk/credential-provider-web-identity@npm:3.804.0": + version: 3.804.0 + resolution: "@aws-sdk/credential-provider-web-identity@npm:3.804.0" + dependencies: + "@aws-sdk/core": 3.804.0 + "@aws-sdk/nested-clients": 3.804.0 + "@aws-sdk/types": 3.804.0 + "@smithy/property-provider": ^4.0.2 + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + checksum: e643f9fa13c5a180844ecaf4e0293bb9d78d800d73eec25bdf781c8db991a0c723d37d350368904b1874e34b8a1e1e7997dd0248a6ca249007c50cd0ed6d0148 + languageName: node + linkType: hard + +"@aws-sdk/middleware-host-header@npm:3.804.0": + version: 3.804.0 + resolution: "@aws-sdk/middleware-host-header@npm:3.804.0" + dependencies: + "@aws-sdk/types": 3.804.0 + "@smithy/protocol-http": ^5.1.0 + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + checksum: 3310bf3c88b2db2d179ec8c7feff5e6429b3f4ef2535ffcfb492fdfce265362f132a502a06a8743b4ff6118083a5da4bd4219d2f3743863da75e594d39a50f6e + languageName: node + linkType: hard + +"@aws-sdk/middleware-logger@npm:3.804.0": + version: 3.804.0 + resolution: "@aws-sdk/middleware-logger@npm:3.804.0" + dependencies: + "@aws-sdk/types": 3.804.0 + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + checksum: 11c62cf5670eeb035f87ea95ce6e8b8205bd407b0a5d8c7a73a5b0e30ccfa6e11d4595d9aba6d61ef628377555447ca25704afdd8e916d6a6ba67b7a7fd0f078 + languageName: node + linkType: hard + +"@aws-sdk/middleware-recursion-detection@npm:3.804.0": + version: 3.804.0 + resolution: "@aws-sdk/middleware-recursion-detection@npm:3.804.0" + dependencies: + "@aws-sdk/types": 3.804.0 + "@smithy/protocol-http": ^5.1.0 + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + checksum: e762ca615372584ec4fea95b50f4476457edd36c8b433238df8c6c7143ae91da17fe1d3209eca425e89e799a73879e76510121d9235975c46d644e37a17e5350 + languageName: node + linkType: hard + +"@aws-sdk/middleware-user-agent@npm:3.804.0": + version: 3.804.0 + resolution: "@aws-sdk/middleware-user-agent@npm:3.804.0" + dependencies: + "@aws-sdk/core": 3.804.0 + "@aws-sdk/types": 3.804.0 + "@aws-sdk/util-endpoints": 3.804.0 + "@smithy/core": ^3.3.1 + "@smithy/protocol-http": ^5.1.0 + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + checksum: 3b51dd159b51a640203c8ca7055be6cf3290b60a1490b6b9970bfa975ca7033e0d13b307dbc2630663b027ae1bb088deb5ad6f3a64e8d1e6324980b781c2781b + languageName: node + linkType: hard + +"@aws-sdk/nested-clients@npm:3.804.0": + version: 3.804.0 + resolution: "@aws-sdk/nested-clients@npm:3.804.0" + dependencies: + "@aws-crypto/sha256-browser": 5.2.0 + "@aws-crypto/sha256-js": 5.2.0 + "@aws-sdk/core": 3.804.0 + "@aws-sdk/middleware-host-header": 3.804.0 + "@aws-sdk/middleware-logger": 3.804.0 + "@aws-sdk/middleware-recursion-detection": 3.804.0 + "@aws-sdk/middleware-user-agent": 3.804.0 + "@aws-sdk/region-config-resolver": 3.804.0 + "@aws-sdk/types": 3.804.0 + "@aws-sdk/util-endpoints": 3.804.0 + "@aws-sdk/util-user-agent-browser": 3.804.0 + "@aws-sdk/util-user-agent-node": 3.804.0 + "@smithy/config-resolver": ^4.1.0 + "@smithy/core": ^3.3.1 + "@smithy/fetch-http-handler": ^5.0.2 + "@smithy/hash-node": ^4.0.2 + "@smithy/invalid-dependency": ^4.0.2 + "@smithy/middleware-content-length": ^4.0.2 + "@smithy/middleware-endpoint": ^4.1.2 + "@smithy/middleware-retry": ^4.1.3 + "@smithy/middleware-serde": ^4.0.3 + "@smithy/middleware-stack": ^4.0.2 + "@smithy/node-config-provider": ^4.0.2 + "@smithy/node-http-handler": ^4.0.4 + "@smithy/protocol-http": ^5.1.0 + "@smithy/smithy-client": ^4.2.2 + "@smithy/types": ^4.2.0 + "@smithy/url-parser": ^4.0.2 + "@smithy/util-base64": ^4.0.0 + "@smithy/util-body-length-browser": ^4.0.0 + "@smithy/util-body-length-node": ^4.0.0 + "@smithy/util-defaults-mode-browser": ^4.0.10 + "@smithy/util-defaults-mode-node": ^4.0.10 + "@smithy/util-endpoints": ^3.0.2 + "@smithy/util-middleware": ^4.0.2 + "@smithy/util-retry": ^4.0.3 + "@smithy/util-utf8": ^4.0.0 + tslib: ^2.6.2 + checksum: 1dbc0c7e4764a845a81af012cb39a3e2eae1dd6eb08eb8d33a765401b114db6a91ff84259e0cf68b6408b32d644d616bf76f8b4d9432d04ac256f58b4cdba9ee + languageName: node + linkType: hard + +"@aws-sdk/region-config-resolver@npm:3.804.0": + version: 3.804.0 + resolution: "@aws-sdk/region-config-resolver@npm:3.804.0" + dependencies: + "@aws-sdk/types": 3.804.0 + "@smithy/node-config-provider": ^4.0.2 + "@smithy/types": ^4.2.0 + "@smithy/util-config-provider": ^4.0.0 + "@smithy/util-middleware": ^4.0.2 + tslib: ^2.6.2 + checksum: 9af63a819979d581630b11232a81e345c3cdbd9aa006642ce9a68b9e8a288674cdc3c873aead78406be93fca5cc5a2448ad6add0d4f7ffc14c0fda618f83140f + languageName: node + linkType: hard + +"@aws-sdk/token-providers@npm:3.804.0": + version: 3.804.0 + resolution: "@aws-sdk/token-providers@npm:3.804.0" + dependencies: + "@aws-sdk/nested-clients": 3.804.0 + "@aws-sdk/types": 3.804.0 + "@smithy/property-provider": ^4.0.2 + "@smithy/shared-ini-file-loader": ^4.0.2 + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + checksum: 912830754585df1c759979a7769730798cb769474c5746f02a134a0c44cbe138ad2b88d1982fcf46295f071cd950312414bf7d987cd4e3a6879fa27248be4a8b + languageName: node + linkType: hard + +"@aws-sdk/types@npm:3.804.0, @aws-sdk/types@npm:^3.1.0, @aws-sdk/types@npm:^3.222.0": + version: 3.804.0 + resolution: "@aws-sdk/types@npm:3.804.0" + dependencies: + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + checksum: 6e15b214b96e3f1a158ad5144093cd6cbc765984b8ddc00492e2274218b00d43921aaf1340c8a75dd1878c981528257663c053c28d7a47146620122af4f45cca + languageName: node + linkType: hard + +"@aws-sdk/util-endpoints@npm:3.804.0": + version: 3.804.0 + resolution: "@aws-sdk/util-endpoints@npm:3.804.0" + dependencies: + "@aws-sdk/types": 3.804.0 + "@smithy/types": ^4.2.0 + "@smithy/util-endpoints": ^3.0.2 + tslib: ^2.6.2 + checksum: 4bdce464c42183663eb4d6d6cd55c8186475aaaad302e3c9e61210c2bd4f67e05db0fecf2b2c150bfa291e345598b41d8491b429fd4bef2dac47563d1adc7d47 + languageName: node + linkType: hard + +"@aws-sdk/util-locate-window@npm:^3.0.0": + version: 3.804.0 + resolution: "@aws-sdk/util-locate-window@npm:3.804.0" dependencies: - "@smithy/types": ^3.1.0 tslib: ^2.6.2 - checksum: 9b2bd50d6935422dd1046e6eaa48c4c774d06aa1374bf4600a3af2c7a52432b5e25ec111cf49976b07b03d7cb5f4fa6fd44b7ce8a67dd0b3a4cee4abaf9e6fa5 + checksum: 87b384533ba5ceade6e212f5783b6134551ade3ecb413c93ea453c2d5af76651137c4dc7b270b643e8ac810b072119a273790046c31921aaf0f6a664d1a31c99 + languageName: node + linkType: hard + +"@aws-sdk/util-user-agent-browser@npm:3.804.0": + version: 3.804.0 + resolution: "@aws-sdk/util-user-agent-browser@npm:3.804.0" + dependencies: + "@aws-sdk/types": 3.804.0 + "@smithy/types": ^4.2.0 + bowser: ^2.11.0 + tslib: ^2.6.2 + checksum: 6216ac4936631696c596a57a762683575b173efca7af5a8bb805402c6527e8caa0b5f75b3da3f73e354581f04dd19a5e5d09bca7c2f55c7c2b8fba61086f4e86 + languageName: node + linkType: hard + +"@aws-sdk/util-user-agent-node@npm:3.804.0": + version: 3.804.0 + resolution: "@aws-sdk/util-user-agent-node@npm:3.804.0" + dependencies: + "@aws-sdk/middleware-user-agent": 3.804.0 + "@aws-sdk/types": 3.804.0 + "@smithy/node-config-provider": ^4.0.2 + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + peerDependencies: + aws-crt: ">=1.0.0" + peerDependenciesMeta: + aws-crt: + optional: true + checksum: 335d78b11bbda03e82e47de7e014ef2dfa0194ae24aa8f9b188e9295fbc3da23f8b703de9a95ad085aaec72527d9b83a01f288b6c13fdd020dcae19822bb394e languageName: node linkType: hard @@ -213,31 +678,27 @@ __metadata: linkType: hard "@babel/code-frame@npm:^7.0.0": - version: 7.24.7 - resolution: "@babel/code-frame@npm:7.24.7" + version: 7.27.1 + resolution: "@babel/code-frame@npm:7.27.1" dependencies: - "@babel/highlight": ^7.24.7 - picocolors: ^1.0.0 - checksum: 830e62cd38775fdf84d612544251ce773d544a8e63df667728cc9e0126eeef14c6ebda79be0f0bc307e8318316b7f58c27ce86702e0a1f5c321d842eb38ffda4 + "@babel/helper-validator-identifier": ^7.27.1 + js-tokens: ^4.0.0 + picocolors: ^1.1.1 + checksum: 5874edc5d37406c4a0bb14cf79c8e51ad412fb0423d176775ac14fc0259831be1bf95bdda9c2aa651126990505e09a9f0ed85deaa99893bc316d2682c5115bdc languageName: node linkType: hard -"@babel/helper-validator-identifier@npm:^7.24.7": - version: 7.24.7 - resolution: "@babel/helper-validator-identifier@npm:7.24.7" - checksum: 6799ab117cefc0ecd35cd0b40ead320c621a298ecac88686a14cffceaac89d80cdb3c178f969861bf5fa5e4f766648f9161ea0752ecfe080d8e89e3147270257 +"@babel/helper-validator-identifier@npm:^7.27.1": + version: 7.27.1 + resolution: "@babel/helper-validator-identifier@npm:7.27.1" + checksum: 3c7e8391e59d6c85baeefe9afb86432f2ab821c6232b00ea9082a51d3e7e95a2f3fb083d74dc1f49ac82cf238e1d2295dafcb001f7b0fab479f3f56af5eaaa47 languageName: node linkType: hard -"@babel/highlight@npm:^7.24.7": - version: 7.24.7 - resolution: "@babel/highlight@npm:7.24.7" - dependencies: - "@babel/helper-validator-identifier": ^7.24.7 - chalk: ^2.4.2 - js-tokens: ^4.0.0 - picocolors: ^1.0.0 - checksum: 5cd3a89f143671c4ac129960024ba678b669e6fc673ce078030f5175002d1d3d52bc10b22c5b916a6faf644b5028e9a4bd2bb264d053d9b05b6a98690f1d46f1 +"@bytecodealliance/preview2-shim@npm:0.17.0": + version: 0.17.0 + resolution: "@bytecodealliance/preview2-shim@npm:0.17.0" + checksum: b5561ccb27dad50698ee82c3735453fa9bb84c18658c45707402a473ca81cde338d1a7965e507d63ef1ac90ee395a134f250c910c83d09c2205142c2e939bdfe languageName: node linkType: hard @@ -257,62 +718,21 @@ __metadata: languageName: node linkType: hard -"@defi-wonderland/smock@npm:^2.3.4": - version: 2.4.0 - resolution: "@defi-wonderland/smock@npm:2.4.0" - dependencies: - "@nomicfoundation/ethereumjs-util": ^9.0.4 - diff: ^5.0.0 - lodash.isequal: ^4.5.0 - lodash.isequalwith: ^4.4.0 - rxjs: ^7.2.0 - semver: ^7.3.5 - peerDependencies: - "@ethersproject/abi": ^5 - "@ethersproject/abstract-provider": ^5 - "@ethersproject/abstract-signer": ^5 - "@nomiclabs/hardhat-ethers": ^2 - ethers: ^5 - hardhat: ^2.21.0 - checksum: 421f97cfa9a8f7bbdafc6521723f5ed0c3b7cd0462dc7d1a143a2de9cbdac46dd6acd7db619aa03a09d62695c5337fb17699259db2d5e4ddb530f5f55ef4ef30 - languageName: node - linkType: hard - -"@ensdomains/ens@npm:^0.4.4": - version: 0.4.5 - resolution: "@ensdomains/ens@npm:0.4.5" - dependencies: - bluebird: ^3.5.2 - eth-ens-namehash: ^2.0.8 - solc: ^0.4.20 - testrpc: 0.0.1 - web3-utils: ^1.0.0-beta.31 - checksum: 3b4f6e34f3376f1b3cc60927d53d5951c4da0a9ff0f8856aaedba5a73bceccb7c08632bf6709b3bb9e43d6e83223d23928f574fc62dec12b2b1a692bcd3d45c6 - languageName: node - linkType: hard - -"@ensdomains/resolver@npm:^0.2.4": - version: 0.2.4 - resolution: "@ensdomains/resolver@npm:0.2.4" - checksum: 3827a3430cc8935a0839dac9dafcfa6011c6f71af229ff91cbc6cdcbaa35d20c6dbb1a8a901cdb00e66428578ce1675bd6fe6901778b5d0d828321fbec9e0f7f - languageName: node - linkType: hard - "@eslint-community/eslint-utils@npm:^4.2.0": - version: 4.4.0 - resolution: "@eslint-community/eslint-utils@npm:4.4.0" + version: 4.7.0 + resolution: "@eslint-community/eslint-utils@npm:4.7.0" dependencies: - eslint-visitor-keys: ^3.3.0 + eslint-visitor-keys: ^3.4.3 peerDependencies: eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 - checksum: cdfe3ae42b4f572cbfb46d20edafe6f36fc5fb52bf2d90875c58aefe226892b9677fef60820e2832caf864a326fe4fc225714c46e8389ccca04d5f9288aabd22 + checksum: b177e3b75c0b8d0e5d71f1c532edb7e40b31313db61f0c879f9bf19c3abb2783c6c372b5deb2396dab4432f2946b9972122ac682e77010376c029dfd0149c681 languageName: node linkType: hard "@eslint-community/regexpp@npm:^4.4.0, @eslint-community/regexpp@npm:^4.6.1": - version: 4.11.0 - resolution: "@eslint-community/regexpp@npm:4.11.0" - checksum: 97d2fe46690b69417a551bd19a3dc53b6d9590d2295c43cc4c4e44e64131af541e2f4a44d5c12e87de990403654d3dae9d33600081f3a2f0386b368abc9111ec + version: 4.12.1 + resolution: "@eslint-community/regexpp@npm:4.12.1" + checksum: 0d628680e204bc316d545b4993d3658427ca404ae646ce541fcc65306b8c712c340e5e573e30fb9f85f4855c0c5f6dca9868931f2fcced06417fbe1a0c6cd2d6 languageName: node linkType: hard @@ -333,10 +753,10 @@ __metadata: languageName: node linkType: hard -"@eslint/js@npm:8.57.0": - version: 8.57.0 - resolution: "@eslint/js@npm:8.57.0" - checksum: 315dc65b0e9893e2bff139bddace7ea601ad77ed47b4550e73da8c9c2d2766c7a575c3cddf17ef85b8fd6a36ff34f91729d0dcca56e73ca887c10df91a41b0bb +"@eslint/js@npm:8.57.1": + version: 8.57.1 + resolution: "@eslint/js@npm:8.57.1" + checksum: 2afb77454c06e8316793d2e8e79a0154854d35e6782a1217da274ca60b5044d2c69d6091155234ed0551a1e408f86f09dd4ece02752c59568fa403e60611e880 languageName: node linkType: hard @@ -353,16 +773,6 @@ __metadata: languageName: node linkType: hard -"@ethereum-waffle/chai@npm:^3.4.4": - version: 3.4.4 - resolution: "@ethereum-waffle/chai@npm:3.4.4" - dependencies: - "@ethereum-waffle/provider": ^3.4.4 - ethers: ^5.5.2 - checksum: b2b9b6b839c3f6b4abf8489fe50549e6fda07bd81ae8e4250b20d9a76ce4a729ef47c741364387b1d2dbc7fac14b46a5d6dcc4d404344b9cce5f9698ff012251 - languageName: node - linkType: hard - "@ethereum-waffle/compiler@npm:4.0.3": version: 4.0.3 resolution: "@ethereum-waffle/compiler@npm:4.0.3" @@ -382,25 +792,6 @@ __metadata: languageName: node linkType: hard -"@ethereum-waffle/compiler@npm:^3.4.4": - version: 3.4.4 - resolution: "@ethereum-waffle/compiler@npm:3.4.4" - dependencies: - "@resolver-engine/imports": ^0.3.3 - "@resolver-engine/imports-fs": ^0.3.3 - "@typechain/ethers-v5": ^2.0.0 - "@types/mkdirp": ^0.5.2 - "@types/node-fetch": ^2.5.5 - ethers: ^5.0.1 - mkdirp: ^0.5.1 - node-fetch: ^2.6.1 - solc: ^0.6.3 - ts-generator: ^0.1.1 - typechain: ^3.0.0 - checksum: ebffca732969253934c1e8cca6cc1f12d6294f848d44e6595af81460bc3230bc69096d0965b9deb2c7eecd472a1d536d8cbe993f95bfc76fbbe2114ddbabff70 - languageName: node - linkType: hard - "@ethereum-waffle/ens@npm:4.0.3": version: 4.0.3 resolution: "@ethereum-waffle/ens@npm:4.0.3" @@ -412,17 +803,6 @@ __metadata: languageName: node linkType: hard -"@ethereum-waffle/ens@npm:^3.4.4": - version: 3.4.4 - resolution: "@ethereum-waffle/ens@npm:3.4.4" - dependencies: - "@ensdomains/ens": ^0.4.4 - "@ensdomains/resolver": ^0.2.4 - ethers: ^5.5.2 - checksum: 71d93c09ef3ab89a46f05b9e2a06e129e2109d160c3a819e4bf3b4414fc4707e7fc646c87c1d82f9ba769dc1ac3c6f4934fd72499654fcfc9db4abf46c21d118 - languageName: node - linkType: hard - "@ethereum-waffle/mock-contract@npm:4.0.4": version: 4.0.4 resolution: "@ethereum-waffle/mock-contract@npm:4.0.4" @@ -432,16 +812,6 @@ __metadata: languageName: node linkType: hard -"@ethereum-waffle/mock-contract@npm:^3.4.4": - version: 3.4.4 - resolution: "@ethereum-waffle/mock-contract@npm:3.4.4" - dependencies: - "@ethersproject/abi": ^5.5.0 - ethers: ^5.5.2 - checksum: 6e5c62b342e424cd1937f2f7eb424056ad143b238320880f378c0db61c6d694617f968687321a2f030d546aa5b4dde42681cbb419589d7f87452c82844a4488b - languageName: node - linkType: hard - "@ethereum-waffle/provider@npm:4.0.5": version: 4.0.5 resolution: "@ethereum-waffle/provider@npm:4.0.5" @@ -456,19 +826,6 @@ __metadata: languageName: node linkType: hard -"@ethereum-waffle/provider@npm:^3.4.4": - version: 3.4.4 - resolution: "@ethereum-waffle/provider@npm:3.4.4" - dependencies: - "@ethereum-waffle/ens": ^3.4.4 - ethers: ^5.5.2 - ganache-core: ^2.13.2 - patch-package: ^6.2.2 - postinstall-postinstall: ^2.1.0 - checksum: 9e251d7b0198c22e337b18368e3893de766a821e818702dbef0e0d603bad550c6e3a29676cff11272bc82762833586ee9659593d957ec8759a8cc93c2b0f3d00 - languageName: node - linkType: hard - "@ethereumjs/block@npm:^3.5.0, @ethereumjs/block@npm:^3.6.0, @ethereumjs/block@npm:^3.6.2": version: 3.6.3 resolution: "@ethereumjs/block@npm:3.6.3" @@ -539,6 +896,15 @@ __metadata: languageName: node linkType: hard +"@ethereumjs/rlp@npm:^5.0.2": + version: 5.0.2 + resolution: "@ethereumjs/rlp@npm:5.0.2" + bin: + rlp: bin/rlp.cjs + checksum: b569061ddb1f4cf56a82f7a677c735ba37f9e94e2bbaf567404beb9e2da7aa1f595e72fc12a17c61f7aec67fd5448443efe542967c685a2fe0ffc435793dcbab + languageName: node + linkType: hard + "@ethereumjs/tx@npm:3.4.0": version: 3.4.0 resolution: "@ethereumjs/tx@npm:3.4.0" @@ -570,6 +936,16 @@ __metadata: languageName: node linkType: hard +"@ethereumjs/util@npm:^9.1.0": + version: 9.1.0 + resolution: "@ethereumjs/util@npm:9.1.0" + dependencies: + "@ethereumjs/rlp": ^5.0.2 + ethereum-cryptography: ^2.2.1 + checksum: 594e009c3001ca1ca658b4ded01b38e72f5dd5dd76389efd90cb020de099176a3327685557df268161ac3144333cfe8abaae68cda8ae035d9cc82409d386d79a + languageName: node + linkType: hard + "@ethereumjs/vm@npm:5.6.0": version: 5.6.0 resolution: "@ethereumjs/vm@npm:5.6.0" @@ -590,422 +966,405 @@ __metadata: languageName: node linkType: hard -"@ethersproject/abi@npm:5.0.0-beta.153": - version: 5.0.0-beta.153 - resolution: "@ethersproject/abi@npm:5.0.0-beta.153" - dependencies: - "@ethersproject/address": ">=5.0.0-beta.128" - "@ethersproject/bignumber": ">=5.0.0-beta.130" - "@ethersproject/bytes": ">=5.0.0-beta.129" - "@ethersproject/constants": ">=5.0.0-beta.128" - "@ethersproject/hash": ">=5.0.0-beta.128" - "@ethersproject/keccak256": ">=5.0.0-beta.127" - "@ethersproject/logger": ">=5.0.0-beta.129" - "@ethersproject/properties": ">=5.0.0-beta.131" - "@ethersproject/strings": ">=5.0.0-beta.130" - checksum: 9f5c3c986a47c2bcc066e0ea1d8190be4358de6722d0eb75eaaacbc1f7610169691cc369085aa390bd88c731c6e539f309cb81face594feffac9336e369444c5 - languageName: node - linkType: hard - -"@ethersproject/abi@npm:5.7.0, @ethersproject/abi@npm:^5.0.9, @ethersproject/abi@npm:^5.1.2, @ethersproject/abi@npm:^5.5.0, @ethersproject/abi@npm:^5.6.3, @ethersproject/abi@npm:^5.6.4, @ethersproject/abi@npm:^5.7.0": - version: 5.7.0 - resolution: "@ethersproject/abi@npm:5.7.0" +"@ethersproject/abi@npm:5.8.0, @ethersproject/abi@npm:^5.0.9, @ethersproject/abi@npm:^5.1.2, @ethersproject/abi@npm:^5.6.4, @ethersproject/abi@npm:^5.7.0, @ethersproject/abi@npm:^5.8.0": + version: 5.8.0 + resolution: "@ethersproject/abi@npm:5.8.0" dependencies: - "@ethersproject/address": ^5.7.0 - "@ethersproject/bignumber": ^5.7.0 - "@ethersproject/bytes": ^5.7.0 - "@ethersproject/constants": ^5.7.0 - "@ethersproject/hash": ^5.7.0 - "@ethersproject/keccak256": ^5.7.0 - "@ethersproject/logger": ^5.7.0 - "@ethersproject/properties": ^5.7.0 - "@ethersproject/strings": ^5.7.0 - checksum: bc6962bb6cb854e4d2a4d65b2c49c716477675b131b1363312234bdbb7e19badb7d9ce66f4ca2a70ae2ea84f7123dbc4e300a1bfe5d58864a7eafabc1466627e + "@ethersproject/address": ^5.8.0 + "@ethersproject/bignumber": ^5.8.0 + "@ethersproject/bytes": ^5.8.0 + "@ethersproject/constants": ^5.8.0 + "@ethersproject/hash": ^5.8.0 + "@ethersproject/keccak256": ^5.8.0 + "@ethersproject/logger": ^5.8.0 + "@ethersproject/properties": ^5.8.0 + "@ethersproject/strings": ^5.8.0 + checksum: cdab990d520fdbfd63d4a8829e78a2d2d2cc110dc3461895bd9014a49d3a9028c2005a11e2569c3fd620cb7780dcb5c71402630a8082a9ca5f85d4f8700d4549 languageName: node linkType: hard -"@ethersproject/abstract-provider@npm:5.7.0, @ethersproject/abstract-provider@npm:^5.7.0": - version: 5.7.0 - resolution: "@ethersproject/abstract-provider@npm:5.7.0" +"@ethersproject/abstract-provider@npm:5.8.0, @ethersproject/abstract-provider@npm:^5.7.0, @ethersproject/abstract-provider@npm:^5.8.0": + version: 5.8.0 + resolution: "@ethersproject/abstract-provider@npm:5.8.0" dependencies: - "@ethersproject/bignumber": ^5.7.0 - "@ethersproject/bytes": ^5.7.0 - "@ethersproject/logger": ^5.7.0 - "@ethersproject/networks": ^5.7.0 - "@ethersproject/properties": ^5.7.0 - "@ethersproject/transactions": ^5.7.0 - "@ethersproject/web": ^5.7.0 - checksum: 74cf4696245cf03bb7cc5b6cbf7b4b89dd9a79a1c4688126d214153a938126d4972d42c93182198653ce1de35f2a2cad68be40337d4774b3698a39b28f0228a8 + "@ethersproject/bignumber": ^5.8.0 + "@ethersproject/bytes": ^5.8.0 + "@ethersproject/logger": ^5.8.0 + "@ethersproject/networks": ^5.8.0 + "@ethersproject/properties": ^5.8.0 + "@ethersproject/transactions": ^5.8.0 + "@ethersproject/web": ^5.8.0 + checksum: 4fd00d770552af53be297c676f31d938f5dc44d73c24970036a11237a53f114cc1c551fd95937b9eca790f77087da1ed3ec54f97071df088d5861f575fd4f9be languageName: node linkType: hard -"@ethersproject/abstract-signer@npm:5.7.0, @ethersproject/abstract-signer@npm:^5.7.0": - version: 5.7.0 - resolution: "@ethersproject/abstract-signer@npm:5.7.0" +"@ethersproject/abstract-signer@npm:5.8.0, @ethersproject/abstract-signer@npm:^5.7.0, @ethersproject/abstract-signer@npm:^5.8.0": + version: 5.8.0 + resolution: "@ethersproject/abstract-signer@npm:5.8.0" dependencies: - "@ethersproject/abstract-provider": ^5.7.0 - "@ethersproject/bignumber": ^5.7.0 - "@ethersproject/bytes": ^5.7.0 - "@ethersproject/logger": ^5.7.0 - "@ethersproject/properties": ^5.7.0 - checksum: a823dac9cfb761e009851050ebebd5b229d1b1cc4a75b125c2da130ff37e8218208f7f9d1386f77407705b889b23d4a230ad67185f8872f083143e0073cbfbe3 + "@ethersproject/abstract-provider": ^5.8.0 + "@ethersproject/bignumber": ^5.8.0 + "@ethersproject/bytes": ^5.8.0 + "@ethersproject/logger": ^5.8.0 + "@ethersproject/properties": ^5.8.0 + checksum: 3f7a98caf7c01e58da45d879c08449d1443bced36ac81938789c90d8f9ff86a1993655bae9805fc7b31a723b7bd7b4f1f768a9ec65dff032d0ebdc93133c14f3 languageName: node linkType: hard -"@ethersproject/address@npm:5.7.0, @ethersproject/address@npm:>=5.0.0-beta.128, @ethersproject/address@npm:^5.0.2, @ethersproject/address@npm:^5.7.0": - version: 5.7.0 - resolution: "@ethersproject/address@npm:5.7.0" +"@ethersproject/address@npm:5.8.0, @ethersproject/address@npm:^5.0.2, @ethersproject/address@npm:^5.8.0": + version: 5.8.0 + resolution: "@ethersproject/address@npm:5.8.0" dependencies: - "@ethersproject/bignumber": ^5.7.0 - "@ethersproject/bytes": ^5.7.0 - "@ethersproject/keccak256": ^5.7.0 - "@ethersproject/logger": ^5.7.0 - "@ethersproject/rlp": ^5.7.0 - checksum: 64ea5ebea9cc0e845c413e6cb1e54e157dd9fc0dffb98e239d3a3efc8177f2ff798cd4e3206cf3660ee8faeb7bef1a47dc0ebef0d7b132c32e61e550c7d4c843 + "@ethersproject/bignumber": ^5.8.0 + "@ethersproject/bytes": ^5.8.0 + "@ethersproject/keccak256": ^5.8.0 + "@ethersproject/logger": ^5.8.0 + "@ethersproject/rlp": ^5.8.0 + checksum: fa48e16403b656207f996ee7796f0978a146682f10f345b75aa382caa4a70fbfdc6ff585e9955e4779f4f15a31628929b665d288b895cea5df206c070266aea1 languageName: node linkType: hard -"@ethersproject/base64@npm:5.7.0, @ethersproject/base64@npm:^5.7.0": - version: 5.7.0 - resolution: "@ethersproject/base64@npm:5.7.0" +"@ethersproject/base64@npm:5.8.0, @ethersproject/base64@npm:^5.8.0": + version: 5.8.0 + resolution: "@ethersproject/base64@npm:5.8.0" dependencies: - "@ethersproject/bytes": ^5.7.0 - checksum: 7dd5d734d623582f08f665434f53685041a3d3b334a0e96c0c8afa8bbcaab934d50e5b6b980e826a8fde8d353e0b18f11e61faf17468177274b8e7c69cd9742b + "@ethersproject/bytes": ^5.8.0 + checksum: f0c2136c99b2fd2f93b7e110958eacc5990e88274b1f38eb73d8eaa31bdead75fc0c4608dac23cb5718ae455b965de9dc5023446b96de62ef1fa945cbf212096 languageName: node linkType: hard -"@ethersproject/basex@npm:5.7.0, @ethersproject/basex@npm:^5.7.0": - version: 5.7.0 - resolution: "@ethersproject/basex@npm:5.7.0" +"@ethersproject/basex@npm:5.8.0, @ethersproject/basex@npm:^5.8.0": + version: 5.8.0 + resolution: "@ethersproject/basex@npm:5.8.0" dependencies: - "@ethersproject/bytes": ^5.7.0 - "@ethersproject/properties": ^5.7.0 - checksum: 326087b7e1f3787b5fe6cd1cf2b4b5abfafbc355a45e88e22e5e9d6c845b613ffc5301d629b28d5c4d5e2bfe9ec424e6782c804956dff79be05f0098cb5817de + "@ethersproject/bytes": ^5.8.0 + "@ethersproject/properties": ^5.8.0 + checksum: 7b502b91011d3aac9bf38d77aad113632440a1eab6a966ffbe2c23f9e3758a4dcb2a4189ab2948d6996250d0cb716d7445e7e2103d03b94097a77c0e128f9ab7 languageName: node linkType: hard -"@ethersproject/bignumber@npm:5.7.0, @ethersproject/bignumber@npm:>=5.0.0-beta.130, @ethersproject/bignumber@npm:^5.7.0": - version: 5.7.0 - resolution: "@ethersproject/bignumber@npm:5.7.0" +"@ethersproject/bignumber@npm:5.8.0, @ethersproject/bignumber@npm:^5.8.0": + version: 5.8.0 + resolution: "@ethersproject/bignumber@npm:5.8.0" dependencies: - "@ethersproject/bytes": ^5.7.0 - "@ethersproject/logger": ^5.7.0 + "@ethersproject/bytes": ^5.8.0 + "@ethersproject/logger": ^5.8.0 bn.js: ^5.2.1 - checksum: 8c9a134b76f3feb4ec26a5a27379efb4e156b8fb2de0678a67788a91c7f4e30abe9d948638458e4b20f2e42380da0adacc7c9389d05fce070692edc6ae9b4904 + checksum: c87017f466b32d482e4b39370016cfc3edafc2feb89377011c54cd2e7dd011072ef4f275df59cd9fe080a187066082c1808b2682d97547c4fb9e6912331200c3 languageName: node linkType: hard -"@ethersproject/bytes@npm:5.7.0, @ethersproject/bytes@npm:>=5.0.0-beta.129, @ethersproject/bytes@npm:^5.6.1, @ethersproject/bytes@npm:^5.7.0": - version: 5.7.0 - resolution: "@ethersproject/bytes@npm:5.7.0" +"@ethersproject/bytes@npm:5.8.0, @ethersproject/bytes@npm:^5.6.1, @ethersproject/bytes@npm:^5.7.0, @ethersproject/bytes@npm:^5.8.0": + version: 5.8.0 + resolution: "@ethersproject/bytes@npm:5.8.0" dependencies: - "@ethersproject/logger": ^5.7.0 - checksum: 66ad365ceaab5da1b23b72225c71dce472cf37737af5118181fa8ab7447d696bea15ca22e3a0e8836fdd8cfac161afe321a7c67d0dde96f9f645ddd759676621 + "@ethersproject/logger": ^5.8.0 + checksum: 507e8ef1f1559590b4e78e3392a2b16090e96fb1091e0b08d3a8491df65976b313c29cdb412594454f68f9f04d5f77ea5a400b489d80a3e46a608156ef31b251 languageName: node linkType: hard -"@ethersproject/constants@npm:5.7.0, @ethersproject/constants@npm:>=5.0.0-beta.128, @ethersproject/constants@npm:^5.7.0": - version: 5.7.0 - resolution: "@ethersproject/constants@npm:5.7.0" +"@ethersproject/constants@npm:5.8.0, @ethersproject/constants@npm:^5.8.0": + version: 5.8.0 + resolution: "@ethersproject/constants@npm:5.8.0" dependencies: - "@ethersproject/bignumber": ^5.7.0 - checksum: 6d4b1355747cce837b3e76ec3bde70e4732736f23b04f196f706ebfa5d4d9c2be50904a390d4d40ce77803b98d03d16a9b6898418e04ba63491933ce08c4ba8a + "@ethersproject/bignumber": ^5.8.0 + checksum: 74830c44f4315a1058b905c73be7a9bb92850e45213cb28a957447b8a100f22a514f4500b0ea5ac7a995427cecef9918af39ae4e0e0ecf77aa4835b1ea5c3432 languageName: node linkType: hard -"@ethersproject/contracts@npm:5.7.0": - version: 5.7.0 - resolution: "@ethersproject/contracts@npm:5.7.0" +"@ethersproject/contracts@npm:5.8.0": + version: 5.8.0 + resolution: "@ethersproject/contracts@npm:5.8.0" dependencies: - "@ethersproject/abi": ^5.7.0 - "@ethersproject/abstract-provider": ^5.7.0 - "@ethersproject/abstract-signer": ^5.7.0 - "@ethersproject/address": ^5.7.0 - "@ethersproject/bignumber": ^5.7.0 - "@ethersproject/bytes": ^5.7.0 - "@ethersproject/constants": ^5.7.0 - "@ethersproject/logger": ^5.7.0 - "@ethersproject/properties": ^5.7.0 - "@ethersproject/transactions": ^5.7.0 - checksum: 6ccf1121cba01b31e02f8c507cb971ab6bfed85706484a9ec09878ef1594a62215f43c4fdef8f4a4875b99c4a800bc95e3be69b1803f8ce479e07634b5a740c0 + "@ethersproject/abi": ^5.8.0 + "@ethersproject/abstract-provider": ^5.8.0 + "@ethersproject/abstract-signer": ^5.8.0 + "@ethersproject/address": ^5.8.0 + "@ethersproject/bignumber": ^5.8.0 + "@ethersproject/bytes": ^5.8.0 + "@ethersproject/constants": ^5.8.0 + "@ethersproject/logger": ^5.8.0 + "@ethersproject/properties": ^5.8.0 + "@ethersproject/transactions": ^5.8.0 + checksum: cb181012bd55cc19c08f136e56e28e922f1ca66af66747a1b3f58a2aea5b3332bc7ecfe2d23fa14245e7fd45a4fdc4f3427a345c2e9873a9792838cdfe4c62d5 languageName: node linkType: hard -"@ethersproject/hash@npm:5.7.0, @ethersproject/hash@npm:>=5.0.0-beta.128, @ethersproject/hash@npm:^5.7.0": - version: 5.7.0 - resolution: "@ethersproject/hash@npm:5.7.0" +"@ethersproject/hash@npm:5.8.0, @ethersproject/hash@npm:^5.8.0": + version: 5.8.0 + resolution: "@ethersproject/hash@npm:5.8.0" dependencies: - "@ethersproject/abstract-signer": ^5.7.0 - "@ethersproject/address": ^5.7.0 - "@ethersproject/base64": ^5.7.0 - "@ethersproject/bignumber": ^5.7.0 - "@ethersproject/bytes": ^5.7.0 - "@ethersproject/keccak256": ^5.7.0 - "@ethersproject/logger": ^5.7.0 - "@ethersproject/properties": ^5.7.0 - "@ethersproject/strings": ^5.7.0 - checksum: 6e9fa8d14eb08171cd32f17f98cc108ec2aeca74a427655f0d689c550fee0b22a83b3b400fad7fb3f41cf14d4111f87f170aa7905bcbcd1173a55f21b06262ef + "@ethersproject/abstract-signer": ^5.8.0 + "@ethersproject/address": ^5.8.0 + "@ethersproject/base64": ^5.8.0 + "@ethersproject/bignumber": ^5.8.0 + "@ethersproject/bytes": ^5.8.0 + "@ethersproject/keccak256": ^5.8.0 + "@ethersproject/logger": ^5.8.0 + "@ethersproject/properties": ^5.8.0 + "@ethersproject/strings": ^5.8.0 + checksum: e1feb47a98c631548b0f98ef0b1eb1b964bc643d5dea12a0eeb533165004cfcfe6f1d2bb32f31941f0b91e6a82212ad5c8577d6d465fba62c38fc0c410941feb languageName: node linkType: hard -"@ethersproject/hdnode@npm:5.7.0, @ethersproject/hdnode@npm:^5.7.0": - version: 5.7.0 - resolution: "@ethersproject/hdnode@npm:5.7.0" +"@ethersproject/hdnode@npm:5.8.0, @ethersproject/hdnode@npm:^5.8.0": + version: 5.8.0 + resolution: "@ethersproject/hdnode@npm:5.8.0" dependencies: - "@ethersproject/abstract-signer": ^5.7.0 - "@ethersproject/basex": ^5.7.0 - "@ethersproject/bignumber": ^5.7.0 - "@ethersproject/bytes": ^5.7.0 - "@ethersproject/logger": ^5.7.0 - "@ethersproject/pbkdf2": ^5.7.0 - "@ethersproject/properties": ^5.7.0 - "@ethersproject/sha2": ^5.7.0 - "@ethersproject/signing-key": ^5.7.0 - "@ethersproject/strings": ^5.7.0 - "@ethersproject/transactions": ^5.7.0 - "@ethersproject/wordlists": ^5.7.0 - checksum: bfe5ca2d89a42de73655f853170ef4766b933c5f481cddad709b3aca18823275b096e572f92d1602a052f80b426edde44ad6b9d028799775a7dad4a5bbed2133 + "@ethersproject/abstract-signer": ^5.8.0 + "@ethersproject/basex": ^5.8.0 + "@ethersproject/bignumber": ^5.8.0 + "@ethersproject/bytes": ^5.8.0 + "@ethersproject/logger": ^5.8.0 + "@ethersproject/pbkdf2": ^5.8.0 + "@ethersproject/properties": ^5.8.0 + "@ethersproject/sha2": ^5.8.0 + "@ethersproject/signing-key": ^5.8.0 + "@ethersproject/strings": ^5.8.0 + "@ethersproject/transactions": ^5.8.0 + "@ethersproject/wordlists": ^5.8.0 + checksum: 72cc6bd218dbe3565b915f3fd8654562003b1b160a5ace8c8959e319333712a0951887641f6888ef91017a39bb804204fc09fb7e5064e3acf76ad701c2ff1266 languageName: node linkType: hard -"@ethersproject/json-wallets@npm:5.7.0, @ethersproject/json-wallets@npm:^5.7.0": - version: 5.7.0 - resolution: "@ethersproject/json-wallets@npm:5.7.0" +"@ethersproject/json-wallets@npm:5.8.0, @ethersproject/json-wallets@npm:^5.8.0": + version: 5.8.0 + resolution: "@ethersproject/json-wallets@npm:5.8.0" dependencies: - "@ethersproject/abstract-signer": ^5.7.0 - "@ethersproject/address": ^5.7.0 - "@ethersproject/bytes": ^5.7.0 - "@ethersproject/hdnode": ^5.7.0 - "@ethersproject/keccak256": ^5.7.0 - "@ethersproject/logger": ^5.7.0 - "@ethersproject/pbkdf2": ^5.7.0 - "@ethersproject/properties": ^5.7.0 - "@ethersproject/random": ^5.7.0 - "@ethersproject/strings": ^5.7.0 - "@ethersproject/transactions": ^5.7.0 + "@ethersproject/abstract-signer": ^5.8.0 + "@ethersproject/address": ^5.8.0 + "@ethersproject/bytes": ^5.8.0 + "@ethersproject/hdnode": ^5.8.0 + "@ethersproject/keccak256": ^5.8.0 + "@ethersproject/logger": ^5.8.0 + "@ethersproject/pbkdf2": ^5.8.0 + "@ethersproject/properties": ^5.8.0 + "@ethersproject/random": ^5.8.0 + "@ethersproject/strings": ^5.8.0 + "@ethersproject/transactions": ^5.8.0 aes-js: 3.0.0 scrypt-js: 3.0.1 - checksum: f583458d22db62efaaf94d38dd243482776a45bf90f9f3882fbad5aa0b8fd288b41eb7c1ff8ec0b99c9b751088e43d6173530db64dd33c59f9d8daa8d7ad5aa2 + checksum: 8e0f8529f683d0a3fab1c76173bfccf7fc03a27e291344c86797815872722770be787e91f8fa83c37b0abfc47d5f2a2d0eca0ab862effb5539ad545e317f8d83 languageName: node linkType: hard -"@ethersproject/keccak256@npm:5.7.0, @ethersproject/keccak256@npm:>=5.0.0-beta.127, @ethersproject/keccak256@npm:^5.7.0": - version: 5.7.0 - resolution: "@ethersproject/keccak256@npm:5.7.0" +"@ethersproject/keccak256@npm:5.8.0, @ethersproject/keccak256@npm:^5.8.0": + version: 5.8.0 + resolution: "@ethersproject/keccak256@npm:5.8.0" dependencies: - "@ethersproject/bytes": ^5.7.0 + "@ethersproject/bytes": ^5.8.0 js-sha3: 0.8.0 - checksum: ff70950d82203aab29ccda2553422cbac2e7a0c15c986bd20a69b13606ed8bb6e4fdd7b67b8d3b27d4f841e8222cbaccd33ed34be29f866fec7308f96ed244c6 + checksum: af3621d2b18af6c8f5181dacad91e1f6da4e8a6065668b20e4c24684bdb130b31e45e0d4dbaed86d4f1314d01358aa119f05be541b696e455424c47849d81913 languageName: node linkType: hard -"@ethersproject/logger@npm:5.7.0, @ethersproject/logger@npm:>=5.0.0-beta.129, @ethersproject/logger@npm:^5.7.0": - version: 5.7.0 - resolution: "@ethersproject/logger@npm:5.7.0" - checksum: 075ab2f605f1fd0813f2e39c3308f77b44a67732b36e712d9bc085f22a84aac4da4f71b39bee50fe78da3e1c812673fadc41180c9970fe5e486e91ea17befe0d +"@ethersproject/logger@npm:5.8.0, @ethersproject/logger@npm:^5.8.0": + version: 5.8.0 + resolution: "@ethersproject/logger@npm:5.8.0" + checksum: 6249885a7fd4a5806e4c8700b76ffcc8f1ff00d71f31aa717716a89fa6b391de19fbb0cb5ae2560b9f57ec0c2e8e0a11ebc2099124c73d3b42bc58e3eedc41d1 languageName: node linkType: hard -"@ethersproject/networks@npm:5.7.1, @ethersproject/networks@npm:^5.7.0": - version: 5.7.1 - resolution: "@ethersproject/networks@npm:5.7.1" +"@ethersproject/networks@npm:5.8.0, @ethersproject/networks@npm:^5.8.0": + version: 5.8.0 + resolution: "@ethersproject/networks@npm:5.8.0" dependencies: - "@ethersproject/logger": ^5.7.0 - checksum: 0339f312304c17d9a0adce550edb825d4d2c8c9468c1634c44172c67a9ed256f594da62c4cda5c3837a0f28b7fabc03aca9b492f68ff1fdad337ee861b27bd5d + "@ethersproject/logger": ^5.8.0 + checksum: b1d43fdab13e32be74b5547968c7e54786915a1c3543025c628f634872038750171bef15db0cf42a27e568175b185ac9c185a9aae8f93839452942c5a867c908 languageName: node linkType: hard -"@ethersproject/pbkdf2@npm:5.7.0, @ethersproject/pbkdf2@npm:^5.7.0": - version: 5.7.0 - resolution: "@ethersproject/pbkdf2@npm:5.7.0" +"@ethersproject/pbkdf2@npm:5.8.0, @ethersproject/pbkdf2@npm:^5.8.0": + version: 5.8.0 + resolution: "@ethersproject/pbkdf2@npm:5.8.0" dependencies: - "@ethersproject/bytes": ^5.7.0 - "@ethersproject/sha2": ^5.7.0 - checksum: b895adb9e35a8a127e794f7aadc31a2424ef355a70e51cde10d457e3e888bb8102373199a540cf61f2d6b9a32e47358f9c65b47d559f42bf8e596b5fd67901e9 + "@ethersproject/bytes": ^5.8.0 + "@ethersproject/sha2": ^5.8.0 + checksum: 79e06ec6063e745a714c7c3f8ecfb7a8d2db2d19d45ad0e84e59526f685a2704f06e8c8fbfaf3aca85d15037bead7376d704529aac783985e1ff7b90c2d6e714 languageName: node linkType: hard -"@ethersproject/properties@npm:5.7.0, @ethersproject/properties@npm:>=5.0.0-beta.131, @ethersproject/properties@npm:^5.7.0": - version: 5.7.0 - resolution: "@ethersproject/properties@npm:5.7.0" +"@ethersproject/properties@npm:5.8.0, @ethersproject/properties@npm:^5.8.0": + version: 5.8.0 + resolution: "@ethersproject/properties@npm:5.8.0" dependencies: - "@ethersproject/logger": ^5.7.0 - checksum: 6ab0ccf0c3aadc9221e0cdc5306ce6cd0df7f89f77d77bccdd1277182c9ead0202cd7521329ba3acde130820bf8af299e17cf567d0d497c736ee918207bbf59f + "@ethersproject/logger": ^5.8.0 + checksum: 2bb0369a3c25a7c1999e990f73a9db149a5e514af253e3945c7728eaea5d864144da6a81661c0c414b97be75db7fb15c34f719169a3adb09e585a3286ea78b9c languageName: node linkType: hard -"@ethersproject/providers@npm:5.7.2, @ethersproject/providers@npm:^5.6.8": - version: 5.7.2 - resolution: "@ethersproject/providers@npm:5.7.2" +"@ethersproject/providers@npm:5.8.0, @ethersproject/providers@npm:^5.6.8": + version: 5.8.0 + resolution: "@ethersproject/providers@npm:5.8.0" dependencies: - "@ethersproject/abstract-provider": ^5.7.0 - "@ethersproject/abstract-signer": ^5.7.0 - "@ethersproject/address": ^5.7.0 - "@ethersproject/base64": ^5.7.0 - "@ethersproject/basex": ^5.7.0 - "@ethersproject/bignumber": ^5.7.0 - "@ethersproject/bytes": ^5.7.0 - "@ethersproject/constants": ^5.7.0 - "@ethersproject/hash": ^5.7.0 - "@ethersproject/logger": ^5.7.0 - "@ethersproject/networks": ^5.7.0 - "@ethersproject/properties": ^5.7.0 - "@ethersproject/random": ^5.7.0 - "@ethersproject/rlp": ^5.7.0 - "@ethersproject/sha2": ^5.7.0 - "@ethersproject/strings": ^5.7.0 - "@ethersproject/transactions": ^5.7.0 - "@ethersproject/web": ^5.7.0 + "@ethersproject/abstract-provider": ^5.8.0 + "@ethersproject/abstract-signer": ^5.8.0 + "@ethersproject/address": ^5.8.0 + "@ethersproject/base64": ^5.8.0 + "@ethersproject/basex": ^5.8.0 + "@ethersproject/bignumber": ^5.8.0 + "@ethersproject/bytes": ^5.8.0 + "@ethersproject/constants": ^5.8.0 + "@ethersproject/hash": ^5.8.0 + "@ethersproject/logger": ^5.8.0 + "@ethersproject/networks": ^5.8.0 + "@ethersproject/properties": ^5.8.0 + "@ethersproject/random": ^5.8.0 + "@ethersproject/rlp": ^5.8.0 + "@ethersproject/sha2": ^5.8.0 + "@ethersproject/strings": ^5.8.0 + "@ethersproject/transactions": ^5.8.0 + "@ethersproject/web": ^5.8.0 bech32: 1.1.4 - ws: 7.4.6 - checksum: 1754c731a5ca6782ae9677f4a9cd8b6246c4ef21a966c9a01b133750f3c578431ec43ec254e699969c4a0f87e84463ded50f96b415600aabd37d2056aee58c19 + ws: 8.18.0 + checksum: 2970ee03fe61bc941555b57075d4a12fbb6342ee56181ad75250a75e9418403e85821bbea1b6e17b25ef35e9eaa1c2b2c564dad7d20af2c1f28ba6db9d0c7ce3 languageName: node linkType: hard -"@ethersproject/random@npm:5.7.0, @ethersproject/random@npm:^5.7.0": - version: 5.7.0 - resolution: "@ethersproject/random@npm:5.7.0" +"@ethersproject/random@npm:5.8.0, @ethersproject/random@npm:^5.8.0": + version: 5.8.0 + resolution: "@ethersproject/random@npm:5.8.0" dependencies: - "@ethersproject/bytes": ^5.7.0 - "@ethersproject/logger": ^5.7.0 - checksum: 017829c91cff6c76470852855108115b0b52c611b6be817ed1948d56ba42d6677803ec2012aa5ae298a7660024156a64c11fcf544e235e239ab3f89f0fff7345 + "@ethersproject/bytes": ^5.8.0 + "@ethersproject/logger": ^5.8.0 + checksum: c3bec10516b433eca7ddbd5d97cf2c24153f8fb9615225ea2e3b7fab95a6d6434ab8af55ce55527c3aeb00546ee4363a43aecdc0b5a9970a207ab1551783ddef languageName: node linkType: hard -"@ethersproject/rlp@npm:5.7.0, @ethersproject/rlp@npm:^5.7.0": - version: 5.7.0 - resolution: "@ethersproject/rlp@npm:5.7.0" +"@ethersproject/rlp@npm:5.8.0, @ethersproject/rlp@npm:^5.8.0": + version: 5.8.0 + resolution: "@ethersproject/rlp@npm:5.8.0" dependencies: - "@ethersproject/bytes": ^5.7.0 - "@ethersproject/logger": ^5.7.0 - checksum: bce165b0f7e68e4d091c9d3cf47b247cac33252df77a095ca4281d32d5eeaaa3695d9bc06b2b057c5015353a68df89f13a4a54a72e888e4beeabbe56b15dda6e + "@ethersproject/bytes": ^5.8.0 + "@ethersproject/logger": ^5.8.0 + checksum: 9d6f646072b3dd61de993210447d35744a851d24d4fe6262856e372f47a1e9d90976031a9fa28c503b1a4f39dd5ab7c20fc9b651b10507a09b40a33cb04a19f1 languageName: node linkType: hard -"@ethersproject/sha2@npm:5.7.0, @ethersproject/sha2@npm:^5.7.0": - version: 5.7.0 - resolution: "@ethersproject/sha2@npm:5.7.0" +"@ethersproject/sha2@npm:5.8.0, @ethersproject/sha2@npm:^5.8.0": + version: 5.8.0 + resolution: "@ethersproject/sha2@npm:5.8.0" dependencies: - "@ethersproject/bytes": ^5.7.0 - "@ethersproject/logger": ^5.7.0 + "@ethersproject/bytes": ^5.8.0 + "@ethersproject/logger": ^5.8.0 hash.js: 1.1.7 - checksum: 09321057c022effbff4cc2d9b9558228690b5dd916329d75c4b1ffe32ba3d24b480a367a7cc92d0f0c0b1c896814d03351ae4630e2f1f7160be2bcfbde435dbc + checksum: ef8916e3033502476fba9358ba1993722ac3bb99e756d5681e4effa3dfa0f0bf0c29d3fa338662830660b45dd359cccb06ba40bc7b62cfd44f4a177b25829404 languageName: node linkType: hard -"@ethersproject/signing-key@npm:5.7.0, @ethersproject/signing-key@npm:^5.7.0": - version: 5.7.0 - resolution: "@ethersproject/signing-key@npm:5.7.0" +"@ethersproject/signing-key@npm:5.8.0, @ethersproject/signing-key@npm:^5.8.0": + version: 5.8.0 + resolution: "@ethersproject/signing-key@npm:5.8.0" dependencies: - "@ethersproject/bytes": ^5.7.0 - "@ethersproject/logger": ^5.7.0 - "@ethersproject/properties": ^5.7.0 + "@ethersproject/bytes": ^5.8.0 + "@ethersproject/logger": ^5.8.0 + "@ethersproject/properties": ^5.8.0 bn.js: ^5.2.1 - elliptic: 6.5.4 + elliptic: 6.6.1 hash.js: 1.1.7 - checksum: 8f8de09b0aac709683bbb49339bc0a4cd2f95598f3546436c65d6f3c3a847ffa98e06d35e9ed2b17d8030bd2f02db9b7bd2e11c5cf8a71aad4537487ab4cf03a + checksum: 8c07741bc8275568130d97da5d37535c813c842240d0b3409d5e057321595eaf65660c207abdee62e2d7ba225d9b82f0b711ac0324c8c9ceb09a815b231b9f55 languageName: node linkType: hard -"@ethersproject/solidity@npm:5.7.0": - version: 5.7.0 - resolution: "@ethersproject/solidity@npm:5.7.0" +"@ethersproject/solidity@npm:5.8.0": + version: 5.8.0 + resolution: "@ethersproject/solidity@npm:5.8.0" dependencies: - "@ethersproject/bignumber": ^5.7.0 - "@ethersproject/bytes": ^5.7.0 - "@ethersproject/keccak256": ^5.7.0 - "@ethersproject/logger": ^5.7.0 - "@ethersproject/sha2": ^5.7.0 - "@ethersproject/strings": ^5.7.0 - checksum: 9a02f37f801c96068c3e7721f83719d060175bc4e80439fe060e92bd7acfcb6ac1330c7e71c49f4c2535ca1308f2acdcb01e00133129aac00581724c2d6293f3 + "@ethersproject/bignumber": ^5.8.0 + "@ethersproject/bytes": ^5.8.0 + "@ethersproject/keccak256": ^5.8.0 + "@ethersproject/logger": ^5.8.0 + "@ethersproject/sha2": ^5.8.0 + "@ethersproject/strings": ^5.8.0 + checksum: 305166f3f8e8c2f5ad7b0b03ab96d52082fc79b5136601175e1c76d7abd8fd8e3e4b56569dea745dfa2b7fcbfd180c5d824b03fea7e08dd53d515738a35e51dd languageName: node linkType: hard -"@ethersproject/strings@npm:5.7.0, @ethersproject/strings@npm:>=5.0.0-beta.130, @ethersproject/strings@npm:^5.7.0": - version: 5.7.0 - resolution: "@ethersproject/strings@npm:5.7.0" +"@ethersproject/strings@npm:5.8.0, @ethersproject/strings@npm:^5.8.0": + version: 5.8.0 + resolution: "@ethersproject/strings@npm:5.8.0" dependencies: - "@ethersproject/bytes": ^5.7.0 - "@ethersproject/constants": ^5.7.0 - "@ethersproject/logger": ^5.7.0 - checksum: 5ff78693ae3fdf3cf23e1f6dc047a61e44c8197d2408c42719fef8cb7b7b3613a4eec88ac0ed1f9f5558c74fe0de7ae3195a29ca91a239c74b9f444d8e8b50df + "@ethersproject/bytes": ^5.8.0 + "@ethersproject/constants": ^5.8.0 + "@ethersproject/logger": ^5.8.0 + checksum: 997396cf1b183ae66ebfd97b9f98fd50415489f9246875e7769e57270ffa1bffbb62f01430eaac3a0c9cb284e122040949efe632a0221012ee47de252a44a483 languageName: node linkType: hard -"@ethersproject/transactions@npm:5.7.0, @ethersproject/transactions@npm:^5.0.0-beta.135, @ethersproject/transactions@npm:^5.7.0": - version: 5.7.0 - resolution: "@ethersproject/transactions@npm:5.7.0" +"@ethersproject/transactions@npm:5.8.0, @ethersproject/transactions@npm:^5.8.0": + version: 5.8.0 + resolution: "@ethersproject/transactions@npm:5.8.0" dependencies: - "@ethersproject/address": ^5.7.0 - "@ethersproject/bignumber": ^5.7.0 - "@ethersproject/bytes": ^5.7.0 - "@ethersproject/constants": ^5.7.0 - "@ethersproject/keccak256": ^5.7.0 - "@ethersproject/logger": ^5.7.0 - "@ethersproject/properties": ^5.7.0 - "@ethersproject/rlp": ^5.7.0 - "@ethersproject/signing-key": ^5.7.0 - checksum: a31b71996d2b283f68486241bff0d3ea3f1ba0e8f1322a8fffc239ccc4f4a7eb2ea9994b8fd2f093283fd75f87bae68171e01b6265261f821369aca319884a79 + "@ethersproject/address": ^5.8.0 + "@ethersproject/bignumber": ^5.8.0 + "@ethersproject/bytes": ^5.8.0 + "@ethersproject/constants": ^5.8.0 + "@ethersproject/keccak256": ^5.8.0 + "@ethersproject/logger": ^5.8.0 + "@ethersproject/properties": ^5.8.0 + "@ethersproject/rlp": ^5.8.0 + "@ethersproject/signing-key": ^5.8.0 + checksum: e867516ccc692c3642bfbd34eab6d2acecabb3b964d8e1cced8e450ec4fa490bcf2513efb6252637bc3157ecd5e0250dadd1a08d3ec3150c14478b9ec7715570 languageName: node linkType: hard -"@ethersproject/units@npm:5.7.0, @ethersproject/units@npm:^5.7.0": - version: 5.7.0 - resolution: "@ethersproject/units@npm:5.7.0" +"@ethersproject/units@npm:5.8.0, @ethersproject/units@npm:^5.7.0": + version: 5.8.0 + resolution: "@ethersproject/units@npm:5.8.0" dependencies: - "@ethersproject/bignumber": ^5.7.0 - "@ethersproject/constants": ^5.7.0 - "@ethersproject/logger": ^5.7.0 - checksum: 304714f848cd32e57df31bf545f7ad35c2a72adae957198b28cbc62166daa929322a07bff6e9c9ac4577ab6aa0de0546b065ed1b2d20b19e25748b7d475cb0fc + "@ethersproject/bignumber": ^5.8.0 + "@ethersproject/constants": ^5.8.0 + "@ethersproject/logger": ^5.8.0 + checksum: cc7180c85f695449c20572602971145346fc5c169ee32f23d79ac31cc8c9c66a2049e3ac852b940ddccbe39ab1db3b81e3e093b604d9ab7ab27639ecb933b270 languageName: node linkType: hard -"@ethersproject/wallet@npm:5.7.0": - version: 5.7.0 - resolution: "@ethersproject/wallet@npm:5.7.0" +"@ethersproject/wallet@npm:5.8.0": + version: 5.8.0 + resolution: "@ethersproject/wallet@npm:5.8.0" dependencies: - "@ethersproject/abstract-provider": ^5.7.0 - "@ethersproject/abstract-signer": ^5.7.0 - "@ethersproject/address": ^5.7.0 - "@ethersproject/bignumber": ^5.7.0 - "@ethersproject/bytes": ^5.7.0 - "@ethersproject/hash": ^5.7.0 - "@ethersproject/hdnode": ^5.7.0 - "@ethersproject/json-wallets": ^5.7.0 - "@ethersproject/keccak256": ^5.7.0 - "@ethersproject/logger": ^5.7.0 - "@ethersproject/properties": ^5.7.0 - "@ethersproject/random": ^5.7.0 - "@ethersproject/signing-key": ^5.7.0 - "@ethersproject/transactions": ^5.7.0 - "@ethersproject/wordlists": ^5.7.0 - checksum: a4009bf7331eddab38e3015b5e9101ef92de7f705b00a6196b997db0e5635b6d83561674d46c90c6f77b87c0500fe4a6b0183ba13749efc22db59c99deb82fbd + "@ethersproject/abstract-provider": ^5.8.0 + "@ethersproject/abstract-signer": ^5.8.0 + "@ethersproject/address": ^5.8.0 + "@ethersproject/bignumber": ^5.8.0 + "@ethersproject/bytes": ^5.8.0 + "@ethersproject/hash": ^5.8.0 + "@ethersproject/hdnode": ^5.8.0 + "@ethersproject/json-wallets": ^5.8.0 + "@ethersproject/keccak256": ^5.8.0 + "@ethersproject/logger": ^5.8.0 + "@ethersproject/properties": ^5.8.0 + "@ethersproject/random": ^5.8.0 + "@ethersproject/signing-key": ^5.8.0 + "@ethersproject/transactions": ^5.8.0 + "@ethersproject/wordlists": ^5.8.0 + checksum: d2921c3212c30a49048e0cba7a8287e0d53a5346ad5a15d46d9932991dc54e541a3da063c47addc1347a4b65142d7239f7056c8716d6f85c8ec4a1bf6b5d2f69 languageName: node linkType: hard -"@ethersproject/web@npm:5.7.1, @ethersproject/web@npm:^5.7.0": - version: 5.7.1 - resolution: "@ethersproject/web@npm:5.7.1" +"@ethersproject/web@npm:5.8.0, @ethersproject/web@npm:^5.8.0": + version: 5.8.0 + resolution: "@ethersproject/web@npm:5.8.0" dependencies: - "@ethersproject/base64": ^5.7.0 - "@ethersproject/bytes": ^5.7.0 - "@ethersproject/logger": ^5.7.0 - "@ethersproject/properties": ^5.7.0 - "@ethersproject/strings": ^5.7.0 - checksum: 7028c47103f82fd2e2c197ce0eecfacaa9180ffeec7de7845b1f4f9b19d84081b7a48227aaddde05a4aaa526af574a9a0ce01cc0fc75e3e371f84b38b5b16b2b + "@ethersproject/base64": ^5.8.0 + "@ethersproject/bytes": ^5.8.0 + "@ethersproject/logger": ^5.8.0 + "@ethersproject/properties": ^5.8.0 + "@ethersproject/strings": ^5.8.0 + checksum: d8ca89bde8777ed1eec81527f8a989b939b4625b2f6c275eea90031637a802ad68bf46911fdd43c5e84ea2962b8a3cb4801ab51f5393ae401a163c17c774123f languageName: node linkType: hard -"@ethersproject/wordlists@npm:5.7.0, @ethersproject/wordlists@npm:^5.7.0": - version: 5.7.0 - resolution: "@ethersproject/wordlists@npm:5.7.0" +"@ethersproject/wordlists@npm:5.8.0, @ethersproject/wordlists@npm:^5.8.0": + version: 5.8.0 + resolution: "@ethersproject/wordlists@npm:5.8.0" dependencies: - "@ethersproject/bytes": ^5.7.0 - "@ethersproject/hash": ^5.7.0 - "@ethersproject/logger": ^5.7.0 - "@ethersproject/properties": ^5.7.0 - "@ethersproject/strings": ^5.7.0 - checksum: 30eb6eb0731f9ef5faa44bf9c0c6e950bcaaef61e4d2d9ce0ae6d341f4e2d6d1f4ab4f8880bfce03b7aac4b862fb740e1421170cfbf8e2aafc359277d49e6e97 + "@ethersproject/bytes": ^5.8.0 + "@ethersproject/hash": ^5.8.0 + "@ethersproject/logger": ^5.8.0 + "@ethersproject/properties": ^5.8.0 + "@ethersproject/strings": ^5.8.0 + checksum: ba24300927a3c9cb85ae8ace84a6be73f3c43aac6eab7a3abe58a7dfd3b168caf3f01a4528efa8193e269dd3d5efe9d4533bdf3b29d5c55743edcb2e864d25d9 languageName: node linkType: hard @@ -1131,14 +1490,14 @@ __metadata: languageName: node linkType: hard -"@humanwhocodes/config-array@npm:^0.11.14": - version: 0.11.14 - resolution: "@humanwhocodes/config-array@npm:0.11.14" +"@humanwhocodes/config-array@npm:^0.13.0": + version: 0.13.0 + resolution: "@humanwhocodes/config-array@npm:0.13.0" dependencies: - "@humanwhocodes/object-schema": ^2.0.2 + "@humanwhocodes/object-schema": ^2.0.3 debug: ^4.3.1 minimatch: ^3.0.5 - checksum: 861ccce9eaea5de19546653bccf75bf09fe878bc39c3aab00aeee2d2a0e654516adad38dd1098aab5e3af0145bbcbf3f309bdf4d964f8dab9dcd5834ae4c02f2 + checksum: eae69ff9134025dd2924f0b430eb324981494be26f0fddd267a33c28711c4db643242cf9fddf7dadb9d16c96b54b2d2c073e60a56477df86e0173149313bd5d6 languageName: node linkType: hard @@ -1149,7 +1508,7 @@ __metadata: languageName: node linkType: hard -"@humanwhocodes/object-schema@npm:^2.0.2": +"@humanwhocodes/object-schema@npm:^2.0.3": version: 2.0.3 resolution: "@humanwhocodes/object-schema@npm:2.0.3" checksum: d3b78f6c5831888c6ecc899df0d03bcc25d46f3ad26a11d7ea52944dc36a35ef543fad965322174238d677a43d5c694434f6607532cff7077062513ad7022631 @@ -1199,6 +1558,15 @@ __metadata: languageName: node linkType: hard +"@isaacs/fs-minipass@npm:^4.0.0": + version: 4.0.1 + resolution: "@isaacs/fs-minipass@npm:4.0.1" + dependencies: + minipass: ^7.0.4 + checksum: 5d36d289960e886484362d9eb6a51d1ea28baed5f5d0140bbe62b99bac52eaf06cc01c2bc0d3575977962f84f6b2c4387b043ee632216643d4787b0999465bf2 + languageName: node + linkType: hard + "@jridgewell/resolve-uri@npm:^3.0.3": version: 3.1.2 resolution: "@jridgewell/resolve-uri@npm:3.1.2" @@ -1207,9 +1575,9 @@ __metadata: linkType: hard "@jridgewell/sourcemap-codec@npm:^1.4.10": - version: 1.4.15 - resolution: "@jridgewell/sourcemap-codec@npm:1.4.15" - checksum: b881c7e503db3fc7f3c1f35a1dd2655a188cc51a3612d76efc8a6eb74728bef5606e6758ee77423e564092b4a518aba569bbb21c9bac5ab7a35b0c6ae7e344c8 + version: 1.5.0 + resolution: "@jridgewell/sourcemap-codec@npm:1.5.0" + checksum: 05df4f2538b3b0f998ea4c1cd34574d0feba216fa5d4ccaef0187d12abf82eafe6021cec8b49f9bb4d90f2ba4582ccc581e72986a5fcf4176ae0cfeb04cf52ec languageName: node linkType: hard @@ -1223,52 +1591,39 @@ __metadata: languageName: node linkType: hard -"@ljharb/resumer@npm:~0.0.1": - version: 0.0.1 - resolution: "@ljharb/resumer@npm:0.0.1" +"@noble/curves@npm:1.2.0": + version: 1.2.0 + resolution: "@noble/curves@npm:1.2.0" dependencies: - "@ljharb/through": ^2.3.9 - checksum: 1cff0a485cb857933d2921cb05a349f8fe894fa2bb6b31a347010ecccc4a2b369e43ebe5383a32a60ee6c9572d2c83fcab383eb01727e1507bf29c59f312dae6 - languageName: node - linkType: hard - -"@ljharb/through@npm:^2.3.9, @ljharb/through@npm:~2.3.9": - version: 2.3.13 - resolution: "@ljharb/through@npm:2.3.13" - dependencies: - call-bind: ^1.0.7 - checksum: 0255464a0ec7901b08cff3e99370b87e66663f46249505959c0cb4f6121095d533bbb7c7cda338063d3e134cbdd721e2705bc18eac7611b4f9ead6e7935d13ba + "@noble/hashes": 1.3.2 + checksum: bb798d7a66d8e43789e93bc3c2ddff91a1e19fdb79a99b86cd98f1e5eff0ee2024a2672902c2576ef3577b6f282f3b5c778bebd55761ddbb30e36bf275e83dd0 languageName: node linkType: hard -"@metamask/eth-sig-util@npm:^4.0.0": - version: 4.0.1 - resolution: "@metamask/eth-sig-util@npm:4.0.1" +"@noble/curves@npm:1.4.2, @noble/curves@npm:~1.4.0": + version: 1.4.2 + resolution: "@noble/curves@npm:1.4.2" dependencies: - ethereumjs-abi: ^0.6.8 - ethereumjs-util: ^6.2.1 - ethjs-util: ^0.1.6 - tweetnacl: ^1.0.3 - tweetnacl-util: ^0.15.1 - checksum: 740df4c92a1282e6be4c00c86c1a8ccfb93e767596e43f6da895aa5bab4a28fc3c2209f0327db34924a4a1e9db72bc4d3dddfcfc45cca0b218c9ccbf7d1b1445 + "@noble/hashes": 1.4.0 + checksum: c475a83c4263e2c970eaba728895b9b5d67e0ca880651e9c6e3efdc5f6a4f07ceb5b043bf71c399fc80fada0b8706e69d0772bffdd7b9de2483b988973a34cba languageName: node linkType: hard -"@noble/curves@npm:1.2.0, @noble/curves@npm:~1.2.0": - version: 1.2.0 - resolution: "@noble/curves@npm:1.2.0" +"@noble/curves@npm:1.8.2, @noble/curves@npm:~1.8.1": + version: 1.8.2 + resolution: "@noble/curves@npm:1.8.2" dependencies: - "@noble/hashes": 1.3.2 - checksum: bb798d7a66d8e43789e93bc3c2ddff91a1e19fdb79a99b86cd98f1e5eff0ee2024a2672902c2576ef3577b6f282f3b5c778bebd55761ddbb30e36bf275e83dd0 + "@noble/hashes": 1.7.2 + checksum: f26fd77b4d78fe26dba2754cbcaddee5da23a711a0c9778ee57764eb0084282d97659d9b0a760718f42493adf68665dbffdca9d6213950f03f079d09c465c096 languageName: node linkType: hard -"@noble/curves@npm:1.4.2, @noble/curves@npm:~1.4.0": - version: 1.4.2 - resolution: "@noble/curves@npm:1.4.2" +"@noble/curves@npm:^1.6.0, @noble/curves@npm:~1.9.0": + version: 1.9.0 + resolution: "@noble/curves@npm:1.9.0" dependencies: - "@noble/hashes": 1.4.0 - checksum: c475a83c4263e2c970eaba728895b9b5d67e0ca880651e9c6e3efdc5f6a4f07ceb5b043bf71c399fc80fada0b8706e69d0772bffdd7b9de2483b988973a34cba + "@noble/hashes": 1.8.0 + checksum: dc82f8c095e90ab0d88f4bfcdf3a6f8500444dac3644b02d7b81a268f516573f18fae66aa3030f5e8886d86dff63dd57a5bb639d968d6cdfadae10436680840c languageName: node linkType: hard @@ -1286,27 +1641,41 @@ __metadata: languageName: node linkType: hard -"@noble/hashes@npm:1.4.0, @noble/hashes@npm:^1.4.0, @noble/hashes@npm:~1.4.0": +"@noble/hashes@npm:1.4.0, @noble/hashes@npm:~1.4.0": version: 1.4.0 resolution: "@noble/hashes@npm:1.4.0" checksum: 8ba816ae26c90764b8c42493eea383716396096c5f7ba6bea559993194f49d80a73c081f315f4c367e51bd2d5891700bcdfa816b421d24ab45b41cb03e4f3342 languageName: node linkType: hard -"@noble/hashes@npm:~1.3.0, @noble/hashes@npm:~1.3.2": - version: 1.3.3 - resolution: "@noble/hashes@npm:1.3.3" - checksum: 8a6496d1c0c64797339bc694ad06cdfaa0f9e56cd0c3f68ae3666cfb153a791a55deb0af9c653c7ed2db64d537aa3e3054629740d2f2338bb1dcb7ab60cd205b +"@noble/hashes@npm:1.7.2, @noble/hashes@npm:~1.7.1": + version: 1.7.2 + resolution: "@noble/hashes@npm:1.7.2" + checksum: f9e3c2e62c2850073f8d6ac30cc33b03a25cae859eb2209b33ae90ed3d1e003cb2a1ddacd2aacd6b7c98a5ad70795a234ccce04b0526657cd8020ce4ffdb491f languageName: node linkType: hard -"@noble/secp256k1@npm:1.7.1, @noble/secp256k1@npm:~1.7.0": +"@noble/hashes@npm:1.8.0, @noble/hashes@npm:^1.4.0, @noble/hashes@npm:^1.5.0, @noble/hashes@npm:~1.8.0": + version: 1.8.0 + resolution: "@noble/hashes@npm:1.8.0" + checksum: c94e98b941963676feaba62475b1ccfa8341e3f572adbb3b684ee38b658df44100187fa0ef4220da580b13f8d27e87d5492623c8a02ecc61f23fb9960c7918f5 + languageName: node + linkType: hard + +"@noble/secp256k1@npm:1.7.1": version: 1.7.1 resolution: "@noble/secp256k1@npm:1.7.1" checksum: d2301f1f7690368d8409a3152450458f27e54df47e3f917292de3de82c298770890c2de7c967d237eff9c95b70af485389a9695f73eb05a43e2bd562d18b18cb languageName: node linkType: hard +"@noble/secp256k1@npm:~1.7.0": + version: 1.7.2 + resolution: "@noble/secp256k1@npm:1.7.2" + checksum: 34c80b862996e215b9abb4faa53c30155bbf4338bfb973218f91139fd882dbeff01dde63de3745485664aee539621c13e11fc4ee55c87a462a30e414db6459fc + languageName: node + linkType: hard + "@nodelib/fs.scandir@npm:2.1.5": version: 2.1.5 resolution: "@nodelib/fs.scandir@npm:2.1.5" @@ -1334,205 +1703,73 @@ __metadata: languageName: node linkType: hard -"@nomicfoundation/edr-darwin-arm64@npm:0.4.1": - version: 0.4.1 - resolution: "@nomicfoundation/edr-darwin-arm64@npm:0.4.1" - checksum: 087e0e51a6181d85269097f1be667d7f07898b712d506c2c32218bde5f4e194a748165fa3fada3f827d2d47d1cf1b1374f34825468a41a3dd702f0476569b7f3 - languageName: node - linkType: hard - -"@nomicfoundation/edr-darwin-arm64@npm:0.5.2": - version: 0.5.2 - resolution: "@nomicfoundation/edr-darwin-arm64@npm:0.5.2" - checksum: f6ab386603c6e080fe7f611b739eb6d1d6a370220318b725cb582702563577150b3be14b6d0be71cb72bdb854e6992c587ecfc6833216f750eae8e7cd96de46f - languageName: node - linkType: hard - -"@nomicfoundation/edr-darwin-x64@npm:0.4.1": - version: 0.4.1 - resolution: "@nomicfoundation/edr-darwin-x64@npm:0.4.1" - checksum: bd02d7f19f762efe92c7abc7b56372c85689d810de0c97c74467f5431547d593b8ce69244675d96e682db8be4ff487c29c63b163e8878f5b541b21cb713fa9ab - languageName: node - linkType: hard - -"@nomicfoundation/edr-darwin-x64@npm:0.5.2": - version: 0.5.2 - resolution: "@nomicfoundation/edr-darwin-x64@npm:0.5.2" - checksum: 6f91f6d0294c0450e0501983f1de34a48582fe93f48428bc4b798ac93bb5483a96d626c2b4c62ac91102f00c826a3f9bfa16d748301440ebe1bbb2920ba3ba6d - languageName: node - linkType: hard - -"@nomicfoundation/edr-linux-arm64-gnu@npm:0.4.1": - version: 0.4.1 - resolution: "@nomicfoundation/edr-linux-arm64-gnu@npm:0.4.1" - checksum: 9cdb065a35680e808717195321d412e500bbb0e8867579c9026194485774356e3203cfc757fc6e8b28371810a07184272f4e71001345f0cdc08cd577468a33e8 - languageName: node - linkType: hard - -"@nomicfoundation/edr-linux-arm64-gnu@npm:0.5.2": - version: 0.5.2 - resolution: "@nomicfoundation/edr-linux-arm64-gnu@npm:0.5.2" - checksum: bd84cc2741bb2be3c3a60bae9dbb8ca7794a68b8675684c97f2c6e7310e5cba7efd1cf18d392d42481cda83fb478f83c0bd605104c5cf08bab44ec07669c3010 - languageName: node - linkType: hard - -"@nomicfoundation/edr-linux-arm64-musl@npm:0.4.1": - version: 0.4.1 - resolution: "@nomicfoundation/edr-linux-arm64-musl@npm:0.4.1" - checksum: d4fb68393f93b0dca040ae3aff339ca83c94a4e12b54b3839b67ba699cc2ef4431cad6af38ae0c7c4c7a0fce0880cbf86d2092743e87e8dbb40074ec63431154 - languageName: node - linkType: hard - -"@nomicfoundation/edr-linux-arm64-musl@npm:0.5.2": - version: 0.5.2 - resolution: "@nomicfoundation/edr-linux-arm64-musl@npm:0.5.2" - checksum: e7f7d82f16be1b26805bd90964c456aecb4a6a1397e87d507810d37bd383064271fa63932564e725fdb30868925334338ec459fe32f84fc11206644b7b37825c - languageName: node - linkType: hard - -"@nomicfoundation/edr-linux-x64-gnu@npm:0.4.1": - version: 0.4.1 - resolution: "@nomicfoundation/edr-linux-x64-gnu@npm:0.4.1" - checksum: cff5ebd95f8bc86438d8d4294f8d41f6db92ca03d3b1f21dcac90617f51835901e83421ce5e3ff95d9e20e31e2f25733681a2fe92c560ab9f431fc138ff9c267 - languageName: node - linkType: hard - -"@nomicfoundation/edr-linux-x64-gnu@npm:0.5.2": - version: 0.5.2 - resolution: "@nomicfoundation/edr-linux-x64-gnu@npm:0.5.2" - checksum: ec025bf75227638b6b2cd01b7ba01b3ddaddf54c4d18d25e9d0364ac621981be2aaf124f4e60a88da5c9e267adb41a660a42668e2d6c9a6a57e55e8671fc76f1 - languageName: node - linkType: hard - -"@nomicfoundation/edr-linux-x64-musl@npm:0.4.1": - version: 0.4.1 - resolution: "@nomicfoundation/edr-linux-x64-musl@npm:0.4.1" - checksum: e4ee7c195b60f3d90fe710d1d5e15289e5fa56c0af485089d31f35fb3f8c98e3fb1494762c66790fa867c0b7dad26bdcbe1956697a9578015d31997ee564147a - languageName: node - linkType: hard - -"@nomicfoundation/edr-linux-x64-musl@npm:0.5.2": - version: 0.5.2 - resolution: "@nomicfoundation/edr-linux-x64-musl@npm:0.5.2" - checksum: c9ff47f72645492383b2a598675878abc029b86325e2c457db1b2c4281916e11e4ef6336c355d40ae3c1736595bc43da51cfcf1e923464011f526f4db64c245b - languageName: node - linkType: hard - -"@nomicfoundation/edr-win32-x64-msvc@npm:0.4.1": - version: 0.4.1 - resolution: "@nomicfoundation/edr-win32-x64-msvc@npm:0.4.1" - checksum: 0c2081ad3d2ce60f0ef8fd5aa876d070568fa038b371859d9d253c072c8db7d66674fa9ea1c722915a434e04a0a46463821bbea97e6bf577c50ec3def3819309 - languageName: node - linkType: hard - -"@nomicfoundation/edr-win32-x64-msvc@npm:0.5.2": - version: 0.5.2 - resolution: "@nomicfoundation/edr-win32-x64-msvc@npm:0.5.2" - checksum: 56da7a1283470dede413cda5f2fef96e10250ec7a25562254ca0cd8045a653212c91e40fbcf37330e7af4e036d3c3aed83ea617831f9c7a5424389c73c53ed4e +"@nomicfoundation/edr-darwin-arm64@npm:0.11.0": + version: 0.11.0 + resolution: "@nomicfoundation/edr-darwin-arm64@npm:0.11.0" + checksum: ee4df930bdd9adb3e6ff6485326da101ac52347fe6639b5a0d185df40664c1973ac906a28ee6b3d3d683d91c7dae7c8368425a8daf6bd138d5d799b4d40ff6cb languageName: node linkType: hard -"@nomicfoundation/edr@npm:^0.4.0": - version: 0.4.1 - resolution: "@nomicfoundation/edr@npm:0.4.1" - dependencies: - "@nomicfoundation/edr-darwin-arm64": 0.4.1 - "@nomicfoundation/edr-darwin-x64": 0.4.1 - "@nomicfoundation/edr-linux-arm64-gnu": 0.4.1 - "@nomicfoundation/edr-linux-arm64-musl": 0.4.1 - "@nomicfoundation/edr-linux-x64-gnu": 0.4.1 - "@nomicfoundation/edr-linux-x64-musl": 0.4.1 - "@nomicfoundation/edr-win32-x64-msvc": 0.4.1 - checksum: e3798101748df5d158a509e331c47754646071738721e10a30da95046066a61d4435de4e47e179279ce51ebb2f6e81bd0c9125f367c58bd46fca1abb0d0ee0dd +"@nomicfoundation/edr-darwin-x64@npm:0.11.0": + version: 0.11.0 + resolution: "@nomicfoundation/edr-darwin-x64@npm:0.11.0" + checksum: 0e71ea9cb2fd5ce57a4704b2118254a46528cfe057299490615245ad420fc3381c0f659714b3d5445b9265b140418d62f9a11d40b7a638687732e3e80bf8c8b0 languageName: node linkType: hard -"@nomicfoundation/edr@npm:^0.5.2": - version: 0.5.2 - resolution: "@nomicfoundation/edr@npm:0.5.2" - dependencies: - "@nomicfoundation/edr-darwin-arm64": 0.5.2 - "@nomicfoundation/edr-darwin-x64": 0.5.2 - "@nomicfoundation/edr-linux-arm64-gnu": 0.5.2 - "@nomicfoundation/edr-linux-arm64-musl": 0.5.2 - "@nomicfoundation/edr-linux-x64-gnu": 0.5.2 - "@nomicfoundation/edr-linux-x64-musl": 0.5.2 - "@nomicfoundation/edr-win32-x64-msvc": 0.5.2 - checksum: 336b1c7cad96fa78410f0c9cc9524abe9fb1e56384fe990b98bfd17f15f25b4665ad8f0525ccd9511f7c19173841fe712d50db993078629e2fc4047fda4665dc +"@nomicfoundation/edr-linux-arm64-gnu@npm:0.11.0": + version: 0.11.0 + resolution: "@nomicfoundation/edr-linux-arm64-gnu@npm:0.11.0" + checksum: 72168c713b2ef501d05a28cd73c8dd48539b42708b72ea0f5350cfb7d51056b5b6d8a38bce4039928b01aee40b94d5829fba47e2b4c68a7e011c2334a2c81152 languageName: node linkType: hard -"@nomicfoundation/ethereumjs-common@npm:4.0.4": - version: 4.0.4 - resolution: "@nomicfoundation/ethereumjs-common@npm:4.0.4" - dependencies: - "@nomicfoundation/ethereumjs-util": 9.0.4 - checksum: ce3f6e4ae15b976efdb7ccda27e19aadb62b5ffee209f9503e68b4fd8633715d4d697c0cc10ccd35f5e4e977edd05100d0f214e28880ec64fff77341dc34fcdf +"@nomicfoundation/edr-linux-arm64-musl@npm:0.11.0": + version: 0.11.0 + resolution: "@nomicfoundation/edr-linux-arm64-musl@npm:0.11.0" + checksum: 3030bd1cce2342132ee4fdd2e287611a057bd82fb66d792204f3051d0f68454444f2664c9716a3dce692a7cd4c6053d229edd4b3862194c22212d6c51a9f77e7 languageName: node linkType: hard -"@nomicfoundation/ethereumjs-rlp@npm:5.0.4": - version: 5.0.4 - resolution: "@nomicfoundation/ethereumjs-rlp@npm:5.0.4" - bin: - rlp: bin/rlp.cjs - checksum: ee2c2e5776c73801dc5ed636f4988b599b4563c2d0037da542ea57eb237c69dd1ac555f6bcb5e06f70515b6459779ba0d68252a6e105132b4659ab4bf62919b0 +"@nomicfoundation/edr-linux-x64-gnu@npm:0.11.0": + version: 0.11.0 + resolution: "@nomicfoundation/edr-linux-x64-gnu@npm:0.11.0" + checksum: d4fcc0d81610995d61389f099d640322462d298e111a45b715e6a890722fa85023d29c1d618290a846fb82b9cbfef6f5ccdd71258321031cc21d389fdc3ec945 languageName: node linkType: hard -"@nomicfoundation/ethereumjs-tx@npm:5.0.4": - version: 5.0.4 - resolution: "@nomicfoundation/ethereumjs-tx@npm:5.0.4" - dependencies: - "@nomicfoundation/ethereumjs-common": 4.0.4 - "@nomicfoundation/ethereumjs-rlp": 5.0.4 - "@nomicfoundation/ethereumjs-util": 9.0.4 - ethereum-cryptography: 0.1.3 - peerDependencies: - c-kzg: ^2.1.2 - peerDependenciesMeta: - c-kzg: - optional: true - checksum: 0f1c87716682ccbcf4d92ffc6cf8ab557e658b90319d82be3219a091a736859f8803c73c98e4863682e3e86d264751c472d33ff6d3c3daf4e75b5f01d0af8fa3 +"@nomicfoundation/edr-linux-x64-musl@npm:0.11.0": + version: 0.11.0 + resolution: "@nomicfoundation/edr-linux-x64-musl@npm:0.11.0" + checksum: 558e73fb58f7a79fd6fd1867a1d45b54ae963288a110f9bde5c96d62de2d818ba92faea5bb97dc24aa4b81f36ba83e1a341a72179f04cd649210bff85936fe97 languageName: node linkType: hard -"@nomicfoundation/ethereumjs-util@npm:9.0.4, @nomicfoundation/ethereumjs-util@npm:^9.0.4": - version: 9.0.4 - resolution: "@nomicfoundation/ethereumjs-util@npm:9.0.4" - dependencies: - "@nomicfoundation/ethereumjs-rlp": 5.0.4 - ethereum-cryptography: 0.1.3 - peerDependencies: - c-kzg: ^2.1.2 - peerDependenciesMeta: - c-kzg: - optional: true - checksum: 754439f72b11cad2d8986707ad020077dcc763c4055f73e2668a0b4cadb22aa4407faa9b3c587d9eb5b97ac337afbe037eb642bc1d5a16197284f83db3462cbe +"@nomicfoundation/edr-win32-x64-msvc@npm:0.11.0": + version: 0.11.0 + resolution: "@nomicfoundation/edr-win32-x64-msvc@npm:0.11.0" + checksum: 2f32f8857fe32634b92ed6f30728b316e1da2268a0e7100de2794b35552f75fd8be5e5a610b46aa88fba9903d8b889c82e1a40a9287c967cb22a961bf5f96bba languageName: node linkType: hard -"@nomicfoundation/hardhat-chai-matchers@npm:^1.0.6": - version: 1.0.6 - resolution: "@nomicfoundation/hardhat-chai-matchers@npm:1.0.6" +"@nomicfoundation/edr@npm:^0.11.0": + version: 0.11.0 + resolution: "@nomicfoundation/edr@npm:0.11.0" dependencies: - "@ethersproject/abi": ^5.1.2 - "@types/chai-as-promised": ^7.1.3 - chai-as-promised: ^7.1.1 - deep-eql: ^4.0.1 - ordinal: ^1.0.3 - peerDependencies: - "@nomiclabs/hardhat-ethers": ^2.0.0 - chai: ^4.2.0 - ethers: ^5.0.0 - hardhat: ^2.9.4 - checksum: c388e5ed9068f2ba7c227737ab7312dd03405d5fab195247b061f2fa52e700fbd0fb65359c2d4f2086f2905bfca642c19a9122d034533edd936f89aea65ac7f2 + "@nomicfoundation/edr-darwin-arm64": 0.11.0 + "@nomicfoundation/edr-darwin-x64": 0.11.0 + "@nomicfoundation/edr-linux-arm64-gnu": 0.11.0 + "@nomicfoundation/edr-linux-arm64-musl": 0.11.0 + "@nomicfoundation/edr-linux-x64-gnu": 0.11.0 + "@nomicfoundation/edr-linux-x64-musl": 0.11.0 + "@nomicfoundation/edr-win32-x64-msvc": 0.11.0 + checksum: ed264aa20ef535b6d82dd135360dfbd0ce3a14aa4f18f0db71bbbd96478360360ab8274d7c93eab2f042abd3252071e9a9a58d868f59a7614b88220d6a884e2a languageName: node linkType: hard "@nomicfoundation/hardhat-chai-matchers@npm:latest": - version: 2.0.7 - resolution: "@nomicfoundation/hardhat-chai-matchers@npm:2.0.7" + version: 2.0.8 + resolution: "@nomicfoundation/hardhat-chai-matchers@npm:2.0.8" dependencies: "@types/chai-as-promised": ^7.1.3 chai-as-promised: ^7.1.1 @@ -1543,44 +1780,44 @@ __metadata: chai: ^4.2.0 ethers: ^6.1.0 hardhat: ^2.9.4 - checksum: 7162187522d441cd06643d926fa06b36bdea9029cbd7b9d735a2642dd343e6f9d93ea7a01d3d2efe06d9696c0035911d299574014a27d2c8521ab2387cfc83f8 + checksum: bcf2efcf98e1e889e4566b3ff23099313c67a4c765367f702672890e0d3e6f38ad8de415ee6e9f65d038f6dcd879cc080ca0dda07109acc7d3fc249e8fdb79f5 languageName: node linkType: hard "@nomicfoundation/hardhat-ethers@npm:^3.0.0": - version: 3.0.6 - resolution: "@nomicfoundation/hardhat-ethers@npm:3.0.6" + version: 3.0.8 + resolution: "@nomicfoundation/hardhat-ethers@npm:3.0.8" dependencies: debug: ^4.1.1 lodash.isequal: ^4.5.0 peerDependencies: ethers: ^6.1.0 hardhat: ^2.0.0 - checksum: 31a9b5aeb7b42cf3d8bcd1f11e680ce7018874a4c63b16b01a928fb34d2bd3e0f046fc4c7180e01bcd8b8b398874fc370317165284b3f543c4f3d1fbdcfbf05d + checksum: 6ad6da6713fa25e653cef894ec10762fc3d728a50461a63c169eac248b5b1ea81bb3d42e8017601bbd231c9fee034336e1f2dc25375d5dcf9926ec4d4389034a languageName: node linkType: hard "@nomicfoundation/hardhat-ignition-ethers@npm:^0.15.0": - version: 0.15.5 - resolution: "@nomicfoundation/hardhat-ignition-ethers@npm:0.15.5" + version: 0.15.11 + resolution: "@nomicfoundation/hardhat-ignition-ethers@npm:0.15.11" peerDependencies: "@nomicfoundation/hardhat-ethers": ^3.0.4 - "@nomicfoundation/hardhat-ignition": ^0.15.5 - "@nomicfoundation/ignition-core": ^0.15.5 + "@nomicfoundation/hardhat-ignition": ^0.15.11 + "@nomicfoundation/ignition-core": ^0.15.11 ethers: ^6.7.0 hardhat: ^2.18.0 - checksum: 4fb0b7a88f907d51b6f28b3fb5f8c245659d49490f7976e421bf18fba331723be0292b35ac59f350f32fa75aef92d15e0926a3c811a3e15fd04942e22379d6d4 + checksum: 0333f26d7b2d0f625e3b7974d720dc63ca2b7fe0de7933ef17792d95b0821b803498ea75e294699fa3cb4c63245716e25ac49dcf74a356e62f921119fe7431be languageName: node linkType: hard "@nomicfoundation/hardhat-network-helpers@npm:^1.0.0": - version: 1.0.11 - resolution: "@nomicfoundation/hardhat-network-helpers@npm:1.0.11" + version: 1.0.12 + resolution: "@nomicfoundation/hardhat-network-helpers@npm:1.0.12" dependencies: ethereumjs-util: ^7.1.4 peerDependencies: hardhat: ^2.9.5 - checksum: b1566de2b0ff6de0fa825b13befd9a3318538e45c2d7e54b52dbf724b9ea5019365f1cf6962f4b89313747da847b575692783cfe03b60dbff3a2e419e135c3fb + checksum: 7e1b91789dd4e73464b4eec919b1e67c6d482dd7534f4f7cae73fb5bdddd69f2a47143754b34385b098a1df0f4875cd4d2e1109fc3d847db76f4b0a9a44bd959 languageName: node linkType: hard @@ -1610,41 +1847,31 @@ __metadata: languageName: node linkType: hard -"@nomicfoundation/hardhat-verify@npm:^1.1.0": - version: 1.1.1 - resolution: "@nomicfoundation/hardhat-verify@npm:1.1.1" +"@nomicfoundation/hardhat-verify@npm:latest": + version: 2.0.13 + resolution: "@nomicfoundation/hardhat-verify@npm:2.0.13" dependencies: "@ethersproject/abi": ^5.1.2 "@ethersproject/address": ^5.0.2 cbor: ^8.1.0 - chalk: ^2.4.2 debug: ^4.1.1 lodash.clonedeep: ^4.5.0 + picocolors: ^1.1.0 semver: ^6.3.0 table: ^6.8.0 undici: ^5.14.0 peerDependencies: hardhat: ^2.0.4 - checksum: 2d83d32d6833f23fb62c30c68c9a2ab3956098030edcf459e69639960f059c72572d203bcf92f191c69c9cb0fbbf011a1113bacde1e3cbb28d5e812334f04f32 + checksum: 59a4d0f1fb93fcce91a4c318aaa69c8de6a857deb983e3976e9c20f09ce204f5a4e8a4e2ccae63018ee83ce5dbaa954b1f182a2c02e29d1a77f8673b03b498f9 languageName: node linkType: hard -"@nomicfoundation/hardhat-verify@npm:latest": - version: 2.0.8 - resolution: "@nomicfoundation/hardhat-verify@npm:2.0.8" +"@nomicfoundation/slang@npm:^0.18.3": + version: 0.18.3 + resolution: "@nomicfoundation/slang@npm:0.18.3" dependencies: - "@ethersproject/abi": ^5.1.2 - "@ethersproject/address": ^5.0.2 - cbor: ^8.1.0 - chalk: ^2.4.2 - debug: ^4.1.1 - lodash.clonedeep: ^4.5.0 - semver: ^6.3.0 - table: ^6.8.0 - undici: ^5.14.0 - peerDependencies: - hardhat: ^2.0.4 - checksum: 2c6d239a08e7aca26625ab8c3637e5e7c1e7c8a88f62fb80c6a008fd56352431856aaf79b7a24b1755a6ee48d1423995e02d85a58ea53ceb5552b30c03073c97 + "@bytecodealliance/preview2-shim": 0.17.0 + checksum: 3b562ae0fb4ac292699069620e94e0b5338a84a574407a23d70d4f202dd40163b17dd341fe2f3810536bd1ac8e96f78ab6a35a1f0bc64d386d572b2511c791e7 languageName: node linkType: hard @@ -1727,17 +1954,7 @@ __metadata: languageName: node linkType: hard -"@nomiclabs/hardhat-ethers@npm:^2.2.1": - version: 2.2.3 - resolution: "@nomiclabs/hardhat-ethers@npm:2.2.3" - peerDependencies: - ethers: ^5.0.0 - hardhat: ^2.0.0 - checksum: 72321317e55eb510306e04c42353c5f7ceb42d086fc76cc740120da6e1635b7ad5bbf23a8d6b02bd590754adcf646618933111624085ab249b1ff3482e773226 - languageName: node - linkType: hard - -"@nomiclabs/hardhat-waffle@npm:^2.0.3, @nomiclabs/hardhat-waffle@npm:^2.0.6": +"@nomiclabs/hardhat-waffle@npm:^2.0.6": version: 2.0.6 resolution: "@nomiclabs/hardhat-waffle@npm:2.0.6" peerDependencies: @@ -1750,25 +1967,32 @@ __metadata: languageName: node linkType: hard -"@npmcli/agent@npm:^2.0.0": - version: 2.2.2 - resolution: "@npmcli/agent@npm:2.2.2" +"@npmcli/agent@npm:^3.0.0": + version: 3.0.0 + resolution: "@npmcli/agent@npm:3.0.0" dependencies: agent-base: ^7.1.0 http-proxy-agent: ^7.0.0 https-proxy-agent: ^7.0.1 lru-cache: ^10.0.1 socks-proxy-agent: ^8.0.3 - checksum: 67de7b88cc627a79743c88bab35e023e23daf13831a8aa4e15f998b92f5507b644d8ffc3788afc8e64423c612e0785a6a92b74782ce368f49a6746084b50d874 + checksum: e8fc25d536250ed3e669813b36e8c6d805628b472353c57afd8c4fde0fcfcf3dda4ffe22f7af8c9070812ec2e7a03fb41d7151547cef3508efe661a5a3add20f languageName: node linkType: hard -"@npmcli/fs@npm:^3.1.0": - version: 3.1.1 - resolution: "@npmcli/fs@npm:3.1.1" +"@npmcli/fs@npm:^4.0.0": + version: 4.0.0 + resolution: "@npmcli/fs@npm:4.0.0" dependencies: semver: ^7.3.5 - checksum: d960cab4b93adcb31ce223bfb75c5714edbd55747342efb67dcc2f25e023d930a7af6ece3e75f2f459b6f38fc14d031c766f116cd124fdc937fd33112579e820 + checksum: 68951c589e9a4328698a35fd82fe71909a257d6f2ede0434d236fa55634f0fbcad9bb8755553ce5849bd25ee6f019f4d435921ac715c853582c4a7f5983c8d4a + languageName: node + linkType: hard + +"@openzeppelin/contracts-upgradeable@npm:4.7.3": + version: 4.7.3 + resolution: "@openzeppelin/contracts-upgradeable@npm:4.7.3" + checksum: c9ffb40cb847a975d440204fc6a811f43af960050242f707332b984d29bd16dc242ffa0935de61867aeb9e0357fadedb16b09b276deda5e9775582face831021 languageName: node linkType: hard @@ -1793,83 +2017,47 @@ __metadata: languageName: node linkType: hard -"@openzeppelin/defender-base-client@npm:^1.46.0": - version: 1.54.6 - resolution: "@openzeppelin/defender-base-client@npm:1.54.6" - dependencies: - amazon-cognito-identity-js: ^6.0.1 - async-retry: ^1.3.3 - axios: ^1.4.0 - lodash: ^4.17.19 - node-fetch: ^2.6.0 - checksum: 75b260a545fd734b7678d5591b29847f5211466bad25caca95fc24490c36d49b419b1ef06e6abc9dc6c9b4be97ae2957e033f3050a8675ddd246da817eaedd83 - languageName: node - linkType: hard - -"@openzeppelin/defender-sdk-base-client@npm:^1.10.0, @openzeppelin/defender-sdk-base-client@npm:^1.13.4": - version: 1.13.4 - resolution: "@openzeppelin/defender-sdk-base-client@npm:1.13.4" +"@openzeppelin/defender-sdk-base-client@npm:^2.1.0, @openzeppelin/defender-sdk-base-client@npm:^2.5.0": + version: 2.5.0 + resolution: "@openzeppelin/defender-sdk-base-client@npm:2.5.0" dependencies: + "@aws-sdk/client-lambda": ^3.563.0 amazon-cognito-identity-js: ^6.3.6 async-retry: ^1.3.3 - checksum: 41d9ddbb19a1611c1c6f2f3da666c2732d32f396cf337dfbba214567daa1c52469f2a39baa88fce717353e5a9f8526aafd6af6dd15064c2aae372e24600fdfa3 + checksum: b8c2be0ffefe8ec371dc842bdb16d0b29c34ac05c9f26646e2286a3e22a3511de569e54a7bc5cdaea17eb20b7a8d5f47a44664733174e12ae190d5a5ddba4753 languageName: node linkType: hard -"@openzeppelin/defender-sdk-deploy-client@npm:^1.10.0": - version: 1.13.4 - resolution: "@openzeppelin/defender-sdk-deploy-client@npm:1.13.4" +"@openzeppelin/defender-sdk-deploy-client@npm:^2.1.0": + version: 2.5.0 + resolution: "@openzeppelin/defender-sdk-deploy-client@npm:2.5.0" dependencies: - "@openzeppelin/defender-sdk-base-client": ^1.13.4 - axios: ^1.6.8 + "@openzeppelin/defender-sdk-base-client": ^2.5.0 + axios: ^1.7.4 lodash: ^4.17.21 - checksum: 8c76a6a23cb95a923185140299fa7655e19d742fb570c252a3c5ea1d4ddb5b20909aeb6de79149825463c1c6d0ccaa153f4322417b66a2fb1bca6234a0890e3c + checksum: 620cafbb276cf7ad2eed8cde5a8349fa8be6ce7007a2fd5ee5d87ca24a46ec333396d9e3799cb501b858636519e769cec712338287ecc949b3cc0d6ab55b522c languageName: node linkType: hard -"@openzeppelin/defender-sdk-network-client@npm:^1.10.0": - version: 1.13.4 - resolution: "@openzeppelin/defender-sdk-network-client@npm:1.13.4" +"@openzeppelin/defender-sdk-network-client@npm:^2.1.0": + version: 2.5.0 + resolution: "@openzeppelin/defender-sdk-network-client@npm:2.5.0" dependencies: - "@openzeppelin/defender-sdk-base-client": ^1.13.4 - axios: ^1.6.8 + "@openzeppelin/defender-sdk-base-client": ^2.5.0 + axios: ^1.7.4 lodash: ^4.17.21 - checksum: 1e00c1cb5be3130e043e83a946bdad0cb5490a63386785a0c459654337d3352f64670004c5102c43045ab29ae8da49c0c63f2f14480d0c4622dcdef3490a6526 - languageName: node - linkType: hard - -"@openzeppelin/hardhat-upgrades@npm:^1.19.0": - version: 1.28.0 - resolution: "@openzeppelin/hardhat-upgrades@npm:1.28.0" - dependencies: - "@openzeppelin/defender-base-client": ^1.46.0 - "@openzeppelin/platform-deploy-client": ^0.8.0 - "@openzeppelin/upgrades-core": ^1.27.0 - chalk: ^4.1.0 - debug: ^4.1.1 - proper-lockfile: ^4.1.1 - peerDependencies: - "@nomiclabs/hardhat-ethers": ^2.0.0 - "@nomiclabs/hardhat-etherscan": ^3.1.0 - ethers: ^5.0.5 - hardhat: ^2.0.2 - peerDependenciesMeta: - "@nomiclabs/harhdat-etherscan": - optional: true - bin: - migrate-oz-cli-project: dist/scripts/migrate-oz-cli-project.js - checksum: b37a5eb7c3a5c1fb4ae6754f5fe1d6e93eb6bc143861f57babf5c7d66706ee3e44ca7d57db17ce2ec6c7014f09c269d506f62b3b116897407fdb0d1ff68f4925 + checksum: c1ab3d8db9f118e4da00a86803bdb1bac20a28edbc81ac1c656aafe4d2f9ad0241e8106ee6e4e9506a1c93bb09f7a5b7a82fc2c4689bfe1d32544f354642548a languageName: node linkType: hard "@openzeppelin/hardhat-upgrades@npm:^3.0.4": - version: 3.2.0 - resolution: "@openzeppelin/hardhat-upgrades@npm:3.2.0" + version: 3.9.0 + resolution: "@openzeppelin/hardhat-upgrades@npm:3.9.0" dependencies: - "@openzeppelin/defender-sdk-base-client": ^1.10.0 - "@openzeppelin/defender-sdk-deploy-client": ^1.10.0 - "@openzeppelin/defender-sdk-network-client": ^1.10.0 - "@openzeppelin/upgrades-core": ^1.32.0 + "@openzeppelin/defender-sdk-base-client": ^2.1.0 + "@openzeppelin/defender-sdk-deploy-client": ^2.1.0 + "@openzeppelin/defender-sdk-network-client": ^2.1.0 + "@openzeppelin/upgrades-core": ^1.41.0 chalk: ^4.1.0 debug: ^4.1.1 ethereumjs-util: ^7.1.5 @@ -1885,38 +2073,28 @@ __metadata: optional: true bin: migrate-oz-cli-project: dist/scripts/migrate-oz-cli-project.js - checksum: d60899fb36a8b1518ea5288a5ba3b7da54109ba1d2c2504cf66e4aa0aca36a4981a616aef877a9a543442bdec33c0e04136f89cb58fda1904295230339306f9a - languageName: node - linkType: hard - -"@openzeppelin/platform-deploy-client@npm:^0.8.0": - version: 0.8.0 - resolution: "@openzeppelin/platform-deploy-client@npm:0.8.0" - dependencies: - "@ethersproject/abi": ^5.6.3 - "@openzeppelin/defender-base-client": ^1.46.0 - axios: ^0.21.2 - lodash: ^4.17.19 - node-fetch: ^2.6.0 - checksum: 0ce050e185a812c366ceef7dcfce526815babab9396275d9724f324a548ddfdca92ea9913ce61356dcd8c014fc495890c8e21afab4a197e0e14e761c698cce68 + checksum: 3475daf67bd03dde63de86666f897a4fcdea0028c1759b70163429af5f4e83521d8de7f8c836aa08df6f0218112d31f541c5197827b04d95ef777406d2a752dc languageName: node linkType: hard -"@openzeppelin/upgrades-core@npm:^1.27.0, @openzeppelin/upgrades-core@npm:^1.32.0, @openzeppelin/upgrades-core@npm:latest": - version: 1.34.1 - resolution: "@openzeppelin/upgrades-core@npm:1.34.1" +"@openzeppelin/upgrades-core@npm:^1.41.0, @openzeppelin/upgrades-core@npm:latest": + version: 1.44.0 + resolution: "@openzeppelin/upgrades-core@npm:1.44.0" dependencies: - cbor: ^9.0.0 + "@nomicfoundation/slang": ^0.18.3 + bignumber.js: ^9.1.2 + cbor: ^10.0.0 chalk: ^4.1.0 compare-versions: ^6.0.0 debug: ^4.1.1 ethereumjs-util: ^7.0.3 + minimatch: ^9.0.5 minimist: ^1.2.7 proper-lockfile: ^4.1.1 - solidity-ast: ^0.4.51 + solidity-ast: ^0.4.60 bin: openzeppelin-upgrades-core: dist/cli/cli.js - checksum: a35024d1861c83531cc434f8d2bda346dc2133e97b6d40128c229658cf680935cf36b4eaee742ec2d7c662d3371d0ee14d6dd6dafb5e0278f661adf0066f2f0b + checksum: 44da52859525e3b63a0a4e2960ce1fec5fc7444349c7c630bb5eee41deadebd975a6a5fcb65568cc7a1b5e2c3a3c5618fab758a19854d96165c4c41c1d827f6c languageName: node linkType: hard @@ -2052,10 +2230,24 @@ __metadata: languageName: node linkType: hard -"@scure/base@npm:~1.1.0, @scure/base@npm:~1.1.2, @scure/base@npm:~1.1.6": - version: 1.1.7 - resolution: "@scure/base@npm:1.1.7" - checksum: d9084be9a2f27971df1684af9e40bb750e86f549345e1bb3227fb61673c0c83569c92c1cb0a4ddccb32650b39d3cd3c145603b926ba751c9bc60c27317549b20 +"@rtsao/scc@npm:^1.1.0": + version: 1.1.0 + resolution: "@rtsao/scc@npm:1.1.0" + checksum: 17d04adf404e04c1e61391ed97bca5117d4c2767a76ae3e879390d6dec7b317fcae68afbf9e98badee075d0b64fa60f287729c4942021b4d19cd01db77385c01 + languageName: node + linkType: hard + +"@scure/base@npm:~1.1.0, @scure/base@npm:~1.1.6": + version: 1.1.9 + resolution: "@scure/base@npm:1.1.9" + checksum: 120820a37dfe9dfe4cab2b7b7460552d08e67dee8057ed5354eb68d8e3440890ae983ce3bee957d2b45684950b454a2b6d71d5ee77c1fd3fddc022e2a510337f + languageName: node + linkType: hard + +"@scure/base@npm:~1.2.2, @scure/base@npm:~1.2.4, @scure/base@npm:~1.2.5": + version: 1.2.5 + resolution: "@scure/base@npm:1.2.5" + checksum: 79f76781d4f55fa2ce36e4d6f950a76234a81f81c9f5f33794ee82077e5c8005e84a1491684a0643e77734e3dd1cd8367930d2a165a9c0af4d3c526ffe7407f8 languageName: node linkType: hard @@ -2070,17 +2262,6 @@ __metadata: languageName: node linkType: hard -"@scure/bip32@npm:1.3.2": - version: 1.3.2 - resolution: "@scure/bip32@npm:1.3.2" - dependencies: - "@noble/curves": ~1.2.0 - "@noble/hashes": ~1.3.2 - "@scure/base": ~1.1.2 - checksum: c5ae84fae43490853693b481531132b89e056d45c945fc8b92b9d032577f753dfd79c5a7bbcbf0a7f035951006ff0311b6cf7a389e26c9ec6335e42b20c53157 - languageName: node - linkType: hard - "@scure/bip32@npm:1.4.0": version: 1.4.0 resolution: "@scure/bip32@npm:1.4.0" @@ -2092,6 +2273,28 @@ __metadata: languageName: node linkType: hard +"@scure/bip32@npm:1.6.2": + version: 1.6.2 + resolution: "@scure/bip32@npm:1.6.2" + dependencies: + "@noble/curves": ~1.8.1 + "@noble/hashes": ~1.7.1 + "@scure/base": ~1.2.2 + checksum: e7586619f8a669e522267ce71a90b2d00c3a91da658f1f50e54072cf9f432ba26d2bb4d3d91a5d06932ab96612b8bd038bc31d885bbc048cebfb6509c4a790fc + languageName: node + linkType: hard + +"@scure/bip32@npm:^1.5.0": + version: 1.7.0 + resolution: "@scure/bip32@npm:1.7.0" + dependencies: + "@noble/curves": ~1.9.0 + "@noble/hashes": ~1.8.0 + "@scure/base": ~1.2.5 + checksum: c83adca5a74ec5c4ded8ba93900d0065e4767c4759cf24c2674923aef01d45ba56f171574e3519f2341be99f53a333f01b674eb6cfeb6fa8379607c6d1bc90b5 + languageName: node + linkType: hard + "@scure/bip39@npm:1.1.1": version: 1.1.1 resolution: "@scure/bip39@npm:1.1.1" @@ -2102,16 +2305,6 @@ __metadata: languageName: node linkType: hard -"@scure/bip39@npm:1.2.1": - version: 1.2.1 - resolution: "@scure/bip39@npm:1.2.1" - dependencies: - "@noble/hashes": ~1.3.0 - "@scure/base": ~1.1.0 - checksum: c5bd6f1328fdbeae2dcdd891825b1610225310e5e62a4942714db51066866e4f7bef242c7b06a1b9dcc8043a4a13412cf5c5df76d3b10aa9e36b82e9b6e3eeaa - languageName: node - linkType: hard - "@scure/bip39@npm:1.3.0": version: 1.3.0 resolution: "@scure/bip39@npm:1.3.0" @@ -2122,6 +2315,26 @@ __metadata: languageName: node linkType: hard +"@scure/bip39@npm:1.5.4": + version: 1.5.4 + resolution: "@scure/bip39@npm:1.5.4" + dependencies: + "@noble/hashes": ~1.7.1 + "@scure/base": ~1.2.4 + checksum: 744f302559ad05ee6ea4928572ac8f0b5443e8068fd53234c9c2e158814e910a043c54f0688d05546decadd2ff66e0d0c76355d10e103a28cb8f44efe140857a + languageName: node + linkType: hard + +"@scure/bip39@npm:^1.4.0": + version: 1.6.0 + resolution: "@scure/bip39@npm:1.6.0" + dependencies: + "@noble/hashes": ~1.8.0 + "@scure/base": ~1.2.5 + checksum: 96d46420780473d6c6c9700254a0eceec60302f61d7f9d7f29024e90c7acff3e8e40a5ee52dfaf104db539a10462e531996aaf9e69f082b8540b0a25870545fc + languageName: node + linkType: hard + "@sentry/core@npm:5.30.0": version: 5.30.0 resolution: "@sentry/core@npm:5.30.0" @@ -2204,2316 +2417,1877 @@ __metadata: languageName: node linkType: hard -"@sindresorhus/is@npm:^0.14.0": - version: 0.14.0 - resolution: "@sindresorhus/is@npm:0.14.0" - checksum: 971e0441dd44ba3909b467219a5e242da0fc584048db5324cfb8048148fa8dcc9d44d71e3948972c4f6121d24e5da402ef191420d1266a95f713bb6d6e59c98a +"@smithy/abort-controller@npm:^4.0.2": + version: 4.0.2 + resolution: "@smithy/abort-controller@npm:4.0.2" + dependencies: + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + checksum: b5851bb498d7920926b844659381bd1b5b29e5741dce11daf4e4aeb14216d71d2db5f159e1ae20c538541443cee618a9d926c53b7a7693b1943689af5ca8ff5f languageName: node linkType: hard -"@sindresorhus/is@npm:^4.0.0": - version: 4.6.0 - resolution: "@sindresorhus/is@npm:4.6.0" - checksum: 83839f13da2c29d55c97abc3bc2c55b250d33a0447554997a85c539e058e57b8da092da396e252b11ec24a0279a0bed1f537fa26302209327060643e327f81d2 +"@smithy/config-resolver@npm:^4.1.0": + version: 4.1.0 + resolution: "@smithy/config-resolver@npm:4.1.0" + dependencies: + "@smithy/node-config-provider": ^4.0.2 + "@smithy/types": ^4.2.0 + "@smithy/util-config-provider": ^4.0.0 + "@smithy/util-middleware": ^4.0.2 + tslib: ^2.6.2 + checksum: 28be57094f6c8e4bfdebc78ec6df647f6155699c1706aa571ee6fecf191f41cd260d1e164872f86f434c2eb428398e376ae83a46fc9adb3eb2a3e48b972d7674 languageName: node linkType: hard -"@smithy/types@npm:^3.1.0": - version: 3.3.0 - resolution: "@smithy/types@npm:3.3.0" - dependencies: +"@smithy/core@npm:^3.3.1": + version: 3.3.1 + resolution: "@smithy/core@npm:3.3.1" + dependencies: + "@smithy/middleware-serde": ^4.0.3 + "@smithy/protocol-http": ^5.1.0 + "@smithy/types": ^4.2.0 + "@smithy/util-body-length-browser": ^4.0.0 + "@smithy/util-middleware": ^4.0.2 + "@smithy/util-stream": ^4.2.0 + "@smithy/util-utf8": ^4.0.0 tslib: ^2.6.2 - checksum: 29bb5f83c41e32f8d4094a2aba2d3dfbd763ab5943784a700f3fa22df0dcf0ccac1b1907f7a87fbb9f6f2269fcd4750524bcb48f892249e200ffe397c0981309 + checksum: 879e5e62bc7206b177d61a65e849dc4ff6fe236d1427dd45cdf63a56b9e56ada93611d75ee545215b56a219eac30fdd475dce3bd78268da0b739d35c39226f02 languageName: node linkType: hard -"@solidity-parser/parser@npm:^0.14.0": - version: 0.14.5 - resolution: "@solidity-parser/parser@npm:0.14.5" +"@smithy/credential-provider-imds@npm:^4.0.2": + version: 4.0.2 + resolution: "@smithy/credential-provider-imds@npm:4.0.2" dependencies: - antlr4ts: ^0.5.0-alpha.4 - checksum: 9e85a0d4f8a05a11db6022444b70b2f353e2358467b1cce44cdda703ae1e3c7337e1b8cbc2eec8e14a8f34f9c60b42f325e5fe9b3c934cc980e35091e292d7ee + "@smithy/node-config-provider": ^4.0.2 + "@smithy/property-provider": ^4.0.2 + "@smithy/types": ^4.2.0 + "@smithy/url-parser": ^4.0.2 + tslib: ^2.6.2 + checksum: c037a3165bf09f23faf7474c6ee035fb11b9481511519ee2f4d7db9a4fa6412d4cd03c79685662ea8fe087c678038bbfd4d7399139e093fbad7312fe91214ef3 languageName: node linkType: hard -"@solidity-parser/parser@npm:^0.16.0": - version: 0.16.2 - resolution: "@solidity-parser/parser@npm:0.16.2" +"@smithy/eventstream-codec@npm:^4.0.2": + version: 4.0.2 + resolution: "@smithy/eventstream-codec@npm:4.0.2" dependencies: - antlr4ts: ^0.5.0-alpha.4 - checksum: 109f7bec5de943c63e444fdde179d9bba6a592c18c836f585753798f428424cfcca72c715e7a345e4b79b83d6548543c9e56cb4b263e9b1e8352af2efcfd224a + "@aws-crypto/crc32": 5.2.0 + "@smithy/types": ^4.2.0 + "@smithy/util-hex-encoding": ^4.0.0 + tslib: ^2.6.2 + checksum: f870d041f44d464ec6e6b7429fcc8b40f67664e1ebe16187246dbf8d56b3cd93b43491ef849719db226ff4e658574490c2b74a7c86357c698b599560cfd3510a languageName: node linkType: hard -"@solidity-parser/parser@npm:^0.17.0": - version: 0.17.0 - resolution: "@solidity-parser/parser@npm:0.17.0" - checksum: 2f47732c9a4f6b264ce6c8a0544bd5a0805f824d3c40a8a253e59d5dbe9a98163f55c06460232f57a6b389bb5235c18d0563f94425202ec2f859d88f2378e0ac +"@smithy/eventstream-serde-browser@npm:^4.0.2": + version: 4.0.2 + resolution: "@smithy/eventstream-serde-browser@npm:4.0.2" + dependencies: + "@smithy/eventstream-serde-universal": ^4.0.2 + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + checksum: 2d212a3dc2643413699cb8e26fde77c7fea8381614a4c5c88c1de2e9fb9a6f50b7368d0689c10f3034bba48af640c465f338d1f4449d77ad531ae4fc866dd558 languageName: node linkType: hard -"@solidity-parser/parser@npm:^0.18.0": - version: 0.18.0 - resolution: "@solidity-parser/parser@npm:0.18.0" - checksum: 970d991529d632862fa88e107531339d84df35bf0374e31e8215ce301b19a01ede33fccf4d374402649814263f8bc278a8e6d62a0129bb877539fbdd16a604cc +"@smithy/eventstream-serde-config-resolver@npm:^4.1.0": + version: 4.1.0 + resolution: "@smithy/eventstream-serde-config-resolver@npm:4.1.0" + dependencies: + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + checksum: 3cdad747060f1598944b4a5f734b10cd1dfe4fac1f1207a2ccedcee75a38523c887868521da90494b6fd49ea48ba385820cb97f1034079f4c16dcc030baa85bc languageName: node linkType: hard -"@szmarczak/http-timer@npm:^1.1.2": - version: 1.1.2 - resolution: "@szmarczak/http-timer@npm:1.1.2" +"@smithy/eventstream-serde-node@npm:^4.0.2": + version: 4.0.2 + resolution: "@smithy/eventstream-serde-node@npm:4.0.2" dependencies: - defer-to-connect: ^1.0.1 - checksum: 4d9158061c5f397c57b4988cde33a163244e4f02df16364f103971957a32886beb104d6180902cbe8b38cb940e234d9f98a4e486200deca621923f62f50a06fe + "@smithy/eventstream-serde-universal": ^4.0.2 + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + checksum: 77d025e983ab72faa3613d9f1b84f917f22848e9c0889da1828f63f93f99a61962b701da6104d61844a01d23cd1082309bcf80c3a417ecc64e1493e4f1f08120 languageName: node linkType: hard -"@szmarczak/http-timer@npm:^4.0.5": - version: 4.0.6 - resolution: "@szmarczak/http-timer@npm:4.0.6" +"@smithy/eventstream-serde-universal@npm:^4.0.2": + version: 4.0.2 + resolution: "@smithy/eventstream-serde-universal@npm:4.0.2" dependencies: - defer-to-connect: ^2.0.0 - checksum: c29df3bcec6fc3bdec2b17981d89d9c9fc9bd7d0c9bcfe92821dc533f4440bc890ccde79971838b4ceed1921d456973c4180d7175ee1d0023ad0562240a58d95 + "@smithy/eventstream-codec": ^4.0.2 + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + checksum: 8e760cc5646bb8804429ad811b62d2a9308127db33dca4ac7c362ddc6f1230067cde263144830cd83152656b70c0eaf19895c649e2d406efa46c2aed6af9701b languageName: node linkType: hard -"@trufflesuite/bigint-buffer@npm:1.1.10": - version: 1.1.10 - resolution: "@trufflesuite/bigint-buffer@npm:1.1.10" +"@smithy/fetch-http-handler@npm:^5.0.2": + version: 5.0.2 + resolution: "@smithy/fetch-http-handler@npm:5.0.2" dependencies: - node-gyp: latest - node-gyp-build: 4.4.0 - checksum: e1dc5e4fbf348a55e660c0055267021eb04cbbdb7f6b0ee983ad32cd4aae1200be448a2ca3963c7d19c7c936d42f66c1ff8b5e4e2332cb1a9e3f870ff818dce4 + "@smithy/protocol-http": ^5.1.0 + "@smithy/querystring-builder": ^4.0.2 + "@smithy/types": ^4.2.0 + "@smithy/util-base64": ^4.0.0 + tslib: ^2.6.2 + checksum: da210125fdf56981bba5f456b24bd45571c8bf7140cb2f2bfa2cacb522b9fdbd785eb751632dd42e2c4eb8a14b187e113d044fd4b4e8c9a7bc446f90292df435 languageName: node linkType: hard -"@trufflesuite/bigint-buffer@npm:1.1.9": - version: 1.1.9 - resolution: "@trufflesuite/bigint-buffer@npm:1.1.9" +"@smithy/hash-node@npm:^4.0.2": + version: 4.0.2 + resolution: "@smithy/hash-node@npm:4.0.2" dependencies: - node-gyp: latest - node-gyp-build: 4.3.0 - checksum: 627dcff2cae7afe31432646232518363869e89b300f90f88ca68d903d0bdc79119975a5bc338223c03c1a4484cfac6d9cf4413ef20933a69eee48dd925519165 + "@smithy/types": ^4.2.0 + "@smithy/util-buffer-from": ^4.0.0 + "@smithy/util-utf8": ^4.0.0 + tslib: ^2.6.2 + checksum: 3bf68605d3fa033fbfd556f60966ad3fa5f4f66e902fbe2b901cfaaf7d74b545d4a5a15ceebc1b2cf69557eac02c66af3b5e7071c11341ea536d36c4c4ee755c languageName: node linkType: hard -"@tsconfig/node10@npm:^1.0.7": - version: 1.0.11 - resolution: "@tsconfig/node10@npm:1.0.11" - checksum: 51fe47d55fe1b80ec35e6e5ed30a13665fd3a531945350aa74a14a1e82875fb60b350c2f2a5e72a64831b1b6bc02acb6760c30b3738b54954ec2dea82db7a267 +"@smithy/invalid-dependency@npm:^4.0.2": + version: 4.0.2 + resolution: "@smithy/invalid-dependency@npm:4.0.2" + dependencies: + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + checksum: 96ea5e6c02c112e78655bf5538e13bca5ba374692db3e1ac73683143d0f2183958c1b8cbf4c1ed4d1357f45174f338a255352ad6d7e83fdf2601c1cb6ff73997 languageName: node linkType: hard -"@tsconfig/node12@npm:^1.0.7": - version: 1.0.11 - resolution: "@tsconfig/node12@npm:1.0.11" - checksum: 5ce29a41b13e7897a58b8e2df11269c5395999e588b9a467386f99d1d26f6c77d1af2719e407621412520ea30517d718d5192a32403b8dfcc163bf33e40a338a +"@smithy/is-array-buffer@npm:^2.2.0": + version: 2.2.0 + resolution: "@smithy/is-array-buffer@npm:2.2.0" + dependencies: + tslib: ^2.6.2 + checksum: cd12c2e27884fec89ca8966d33c9dc34d3234efe89b33a9b309c61ebcde463e6f15f6a02d31d4fddbfd6e5904743524ca5b95021b517b98fe10957c2da0cd5fc languageName: node linkType: hard -"@tsconfig/node14@npm:^1.0.0": - version: 1.0.3 - resolution: "@tsconfig/node14@npm:1.0.3" - checksum: 19275fe80c4c8d0ad0abed6a96dbf00642e88b220b090418609c4376e1cef81bf16237bf170ad1b341452feddb8115d8dd2e5acdfdea1b27422071163dc9ba9d +"@smithy/is-array-buffer@npm:^4.0.0": + version: 4.0.0 + resolution: "@smithy/is-array-buffer@npm:4.0.0" + dependencies: + tslib: ^2.6.2 + checksum: 8226fc1eca7aacd7f887f3a5ec2f15a3cafa72aa1c42d3fc759c66600481381d18ec7285a8195f24b9c4fe0ce9a565c133b2021d86a8077aebce3f86b3716802 languageName: node linkType: hard -"@tsconfig/node16@npm:^1.0.2": - version: 1.0.4 - resolution: "@tsconfig/node16@npm:1.0.4" - checksum: 202319785901f942a6e1e476b872d421baec20cf09f4b266a1854060efbf78cde16a4d256e8bc949d31e6cd9a90f1e8ef8fb06af96a65e98338a2b6b0de0a0ff +"@smithy/middleware-content-length@npm:^4.0.2": + version: 4.0.2 + resolution: "@smithy/middleware-content-length@npm:4.0.2" + dependencies: + "@smithy/protocol-http": ^5.1.0 + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + checksum: fa93318eb108e4ee32d734acbd74cbae10cce4f2d323a5399aac831a0d24ef7ca5f66c3af2c0e94238bf1a603f79d65fcfe42d87757f4aacfbdb2ee2da1d79a8 languageName: node linkType: hard -"@typechain/ethers-v5@npm:^10.0.0, @typechain/ethers-v5@npm:^10.1.0": - version: 10.2.1 - resolution: "@typechain/ethers-v5@npm:10.2.1" - dependencies: - lodash: ^4.17.15 - ts-essentials: ^7.0.1 - peerDependencies: - "@ethersproject/abi": ^5.0.0 - "@ethersproject/providers": ^5.0.0 - ethers: ^5.1.3 - typechain: ^8.1.1 - typescript: ">=4.3.0" - checksum: 852da4b1ff368ef87251111a5d50077de3d0fc12c519529269a74223740f8bda89297e67a5eb6c1f5b04ee23119566d6cbccf58264d32a83132be0f328a58d22 +"@smithy/middleware-endpoint@npm:^4.1.2": + version: 4.1.2 + resolution: "@smithy/middleware-endpoint@npm:4.1.2" + dependencies: + "@smithy/core": ^3.3.1 + "@smithy/middleware-serde": ^4.0.3 + "@smithy/node-config-provider": ^4.0.2 + "@smithy/shared-ini-file-loader": ^4.0.2 + "@smithy/types": ^4.2.0 + "@smithy/url-parser": ^4.0.2 + "@smithy/util-middleware": ^4.0.2 + tslib: ^2.6.2 + checksum: 69b38bfbaceb75f4aa84ea302cb8977d1bbc5f330ea654b93fbbed8c07edd70f86294f39b65d8011b310698f6ad7a2f0c1ea217f1d6f79b993793417f9c7dbb8 languageName: node linkType: hard -"@typechain/ethers-v5@npm:^2.0.0": - version: 2.0.0 - resolution: "@typechain/ethers-v5@npm:2.0.0" - dependencies: - ethers: ^5.0.2 - peerDependencies: - ethers: ^5.0.0 - typechain: ^3.0.0 - checksum: 785430547f11de358c4018338f6f72aac113ece70d743aad410fff4eacbc3b4876d2e0d3389e1a56123afcf156f5c044ee72275342e45218448c23fe93d23915 +"@smithy/middleware-retry@npm:^4.1.3": + version: 4.1.3 + resolution: "@smithy/middleware-retry@npm:4.1.3" + dependencies: + "@smithy/node-config-provider": ^4.0.2 + "@smithy/protocol-http": ^5.1.0 + "@smithy/service-error-classification": ^4.0.3 + "@smithy/smithy-client": ^4.2.2 + "@smithy/types": ^4.2.0 + "@smithy/util-middleware": ^4.0.2 + "@smithy/util-retry": ^4.0.3 + tslib: ^2.6.2 + uuid: ^9.0.1 + checksum: 99f9945ac64ca1193ec67c7db2633f3d1271d5eaf0041086c4f939cfea90661952ad3b5f27e30757535efcc06ead3593e5ddc56c1594b2da91adc2cb7d2311ec languageName: node linkType: hard -"@typechain/ethers-v6@npm:^0.5.1": - version: 0.5.1 - resolution: "@typechain/ethers-v6@npm:0.5.1" +"@smithy/middleware-serde@npm:^4.0.3": + version: 4.0.3 + resolution: "@smithy/middleware-serde@npm:4.0.3" dependencies: - lodash: ^4.17.15 - ts-essentials: ^7.0.1 - peerDependencies: - ethers: 6.x - typechain: ^8.3.2 - typescript: ">=4.7.0" - checksum: 44e7970ce95eeb1a02019f8a53bbe30dcb87664e1df15fe436ae48eea1bf91ca72b5b230eac1bdf9cbe9b55bc488b54c6273e6f77155eaeff885fb34cfcd1108 + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + checksum: e64fb925d2ee344ade5781b727f06619b4e2f3b0153134a5c4e9850a5598b96fe542343ce2eaca57fb85a585e43570d6d324d6c9faf8b97040d2c18c30c94806 languageName: node linkType: hard -"@typechain/hardhat@npm:^6.1.2": - version: 6.1.6 - resolution: "@typechain/hardhat@npm:6.1.6" +"@smithy/middleware-stack@npm:^4.0.2": + version: 4.0.2 + resolution: "@smithy/middleware-stack@npm:4.0.2" dependencies: - fs-extra: ^9.1.0 - peerDependencies: - "@ethersproject/abi": ^5.4.7 - "@ethersproject/providers": ^5.4.7 - "@typechain/ethers-v5": ^10.2.1 - ethers: ^5.4.7 - hardhat: ^2.9.9 - typechain: ^8.1.1 - checksum: f214bebf7860956230478cb92696ba757829cfd9dc65ac99c3bc7e539378310318d92b009054186f446595c8ffc1a81e9c6d028da0eb04253253049ea1b6e8d3 + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + checksum: 3401fc2e7fba63c71cc4dcebf489d39ece1396fccf858f9877a99b36aa625ab8c30a7866596f2f4bdf7128bd29800f06160dea0db01bde061fb63a0f43a60a20 languageName: node linkType: hard -"@types/abstract-leveldown@npm:*": - version: 7.2.5 - resolution: "@types/abstract-leveldown@npm:7.2.5" - checksum: 3a99b13c81a53a62b42bea9cff326880de3146b4eeff528b039be69a268515b3120a6c12142e96646fcb0a03c463f298998581e86d9ddb29fbea3612f40edb2b +"@smithy/node-config-provider@npm:^4.0.2": + version: 4.0.2 + resolution: "@smithy/node-config-provider@npm:4.0.2" + dependencies: + "@smithy/property-provider": ^4.0.2 + "@smithy/shared-ini-file-loader": ^4.0.2 + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + checksum: 278cf7aec9b11228b103ec2e665c9242b457a2851d38259f645b55a87bfa66ef7b0b7b30c348998178597875f36134f77ae7d924e204f01764f37a0b2426adf6 languageName: node linkType: hard -"@types/bn.js@npm:^4.11.3, @types/bn.js@npm:^4.11.5": - version: 4.11.6 - resolution: "@types/bn.js@npm:4.11.6" +"@smithy/node-http-handler@npm:^4.0.4": + version: 4.0.4 + resolution: "@smithy/node-http-handler@npm:4.0.4" dependencies: - "@types/node": "*" - checksum: 7f66f2c7b7b9303b3205a57184261974b114495736b77853af5b18d857c0b33e82ce7146911e86e87a87837de8acae28986716fd381ac7c301fd6e8d8b6c811f + "@smithy/abort-controller": ^4.0.2 + "@smithy/protocol-http": ^5.1.0 + "@smithy/querystring-builder": ^4.0.2 + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + checksum: 315f9bfeb22c3d06add4a68a7e6fd394caa9fb22422e89c7fdc564a6d3d94da2355caed18558019f0ef919385473f72e2cad71fc72f47166a14c33a69e0f0ee5 languageName: node linkType: hard -"@types/bn.js@npm:^5.1.0": - version: 5.1.5 - resolution: "@types/bn.js@npm:5.1.5" +"@smithy/property-provider@npm:^4.0.2": + version: 4.0.2 + resolution: "@smithy/property-provider@npm:4.0.2" dependencies: - "@types/node": "*" - checksum: c87b28c4af74545624f8a3dae5294b16aa190c222626e8d4b2e327b33b1a3f1eeb43e7a24d914a9774bca43d8cd6e1cb0325c1f4b3a244af6693a024e1d918e6 + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + checksum: 3038ce031036d3d055bb1c9401f30bea7f1410b2db1d0cd3565cd25f7f374f18a67792930b2e3d0f73c2b1fcbfb23d3bfbd110197f1fd15d0acaa778719fa267 languageName: node linkType: hard -"@types/cacheable-request@npm:^6.0.1": - version: 6.0.3 - resolution: "@types/cacheable-request@npm:6.0.3" +"@smithy/protocol-http@npm:^5.1.0": + version: 5.1.0 + resolution: "@smithy/protocol-http@npm:5.1.0" dependencies: - "@types/http-cache-semantics": "*" - "@types/keyv": ^3.1.4 - "@types/node": "*" - "@types/responselike": ^1.0.0 - checksum: d9b26403fe65ce6b0cb3720b7030104c352bcb37e4fac2a7089a25a97de59c355fa08940658751f2f347a8512aa9d18fdb66ab3ade835975b2f454f2d5befbd9 + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + checksum: 091e8c129411c2072e640aa6a8440fdcfd265fc7b4aef3ff52f419c24dc5f8e34009f03fc810a87a49c7e66d0bf4636b4fbd76a84be563a97b41e9c927f90337 languageName: node linkType: hard -"@types/chai-as-promised@npm:^7.1.3": - version: 7.1.8 - resolution: "@types/chai-as-promised@npm:7.1.8" +"@smithy/querystring-builder@npm:^4.0.2": + version: 4.0.2 + resolution: "@smithy/querystring-builder@npm:4.0.2" dependencies: - "@types/chai": "*" - checksum: f0e5eab451b91bc1e289ed89519faf6591932e8a28d2ec9bbe95826eb73d28fe43713633e0c18706f3baa560a7d97e7c7c20dc53ce639e5d75bac46b2a50bf21 + "@smithy/types": ^4.2.0 + "@smithy/util-uri-escape": ^4.0.0 + tslib: ^2.6.2 + checksum: d802d3af37192d574f59e71aa050ec6daa63df58f2d1b44b95ef9b0ff93e6a40960db4a91eed853be94cdbcd1faa6a658bc56c9b9d1d85449d9215137918b3dd languageName: node linkType: hard -"@types/chai@npm:*, @types/chai@npm:^4.3.1": - version: 4.3.16 - resolution: "@types/chai@npm:4.3.16" - checksum: bb5f52d1b70534ed8b4bf74bd248add003ffe1156303802ea367331607c06b494da885ffbc2b674a66b4f90c9ee88759790a5f243879f6759f124f22328f5e95 +"@smithy/querystring-parser@npm:^4.0.2": + version: 4.0.2 + resolution: "@smithy/querystring-parser@npm:4.0.2" + dependencies: + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + checksum: 4aa30d35b6cf06da6e55386afa70b8d33d3171ed9b3a303a65e23d67a9c090c302d373af4d75609a981188c9441dc81c22d4adb1018888cbd16a62c9ab363d7d languageName: node linkType: hard -"@types/concat-stream@npm:^1.6.0": - version: 1.6.1 - resolution: "@types/concat-stream@npm:1.6.1" +"@smithy/service-error-classification@npm:^4.0.3": + version: 4.0.3 + resolution: "@smithy/service-error-classification@npm:4.0.3" dependencies: - "@types/node": "*" - checksum: 7d211e74331affd3578b5469244f5cef84a93775f38332adb3ef12413559a23862bc682c6873d0a404b01c9d5d5f7d3ae091fe835b435b633eb420e3055b3e56 + "@smithy/types": ^4.2.0 + checksum: 6fa7a20dafca3e0a03d69ac0dc83749a2cc04061af4c7b8a06e8fbdff4050325536cfbe299cf0bbfc9a9cc0b2541fc22cfe923ae45a8bddce64d83927990253d languageName: node linkType: hard -"@types/connect@npm:^3.4.33": - version: 3.4.38 - resolution: "@types/connect@npm:3.4.38" +"@smithy/shared-ini-file-loader@npm:^4.0.2": + version: 4.0.2 + resolution: "@smithy/shared-ini-file-loader@npm:4.0.2" dependencies: - "@types/node": "*" - checksum: 7eb1bc5342a9604facd57598a6c62621e244822442976c443efb84ff745246b10d06e8b309b6e80130026a396f19bf6793b7cecd7380169f369dac3bfc46fb99 + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + checksum: d6304d06c3e7e252a29197fae37f827b5924dbf98e1473adebc398256cdde67f14c9afa8b0ffc2b914cbf9d257c2417f5d0ebede95f824814d1c11077e1d1721 languageName: node linkType: hard -"@types/eslint-visitor-keys@npm:^1.0.0": - version: 1.0.0 - resolution: "@types/eslint-visitor-keys@npm:1.0.0" - checksum: a90f0b023e357a59ea04268e0387cfb0ea06703068cc48fe2ca97fa158bcf3c51a6611a56bdbdf763e3451150b92bba3fb5d0b689fc55f856cae8555ec366a63 +"@smithy/signature-v4@npm:^5.1.0": + version: 5.1.0 + resolution: "@smithy/signature-v4@npm:5.1.0" + dependencies: + "@smithy/is-array-buffer": ^4.0.0 + "@smithy/protocol-http": ^5.1.0 + "@smithy/types": ^4.2.0 + "@smithy/util-hex-encoding": ^4.0.0 + "@smithy/util-middleware": ^4.0.2 + "@smithy/util-uri-escape": ^4.0.0 + "@smithy/util-utf8": ^4.0.0 + tslib: ^2.6.2 + checksum: 302741d0779c419ef13be6fd303476d1544c9ad6b531e40d7883941b72817f1e36342474b5fe1cde177b38d1b8cd89d0da59eb3b41fa1ab719e7988b3cf35155 languageName: node linkType: hard -"@types/form-data@npm:0.0.33": - version: 0.0.33 - resolution: "@types/form-data@npm:0.0.33" +"@smithy/smithy-client@npm:^4.2.2": + version: 4.2.2 + resolution: "@smithy/smithy-client@npm:4.2.2" dependencies: - "@types/node": "*" - checksum: f0c283fdef2dd7191168a37b9cb2625af3cfbd7f72b5a514f938bea0a135669f79d736186d434b9e81150b47ef1bf20d97b188014a00583556fad6ce59fb9bbf + "@smithy/core": ^3.3.1 + "@smithy/middleware-endpoint": ^4.1.2 + "@smithy/middleware-stack": ^4.0.2 + "@smithy/protocol-http": ^5.1.0 + "@smithy/types": ^4.2.0 + "@smithy/util-stream": ^4.2.0 + tslib: ^2.6.2 + checksum: 67eb6b29cde36125dd135c5facfdf57346783e8ba18e5d8b4c1677d4f7636be37b8cdeb785348f797aa8d7ed7ae0c0af60fb65511f3141483e416507a6a6c760 languageName: node linkType: hard -"@types/glob@npm:^7.1.1": - version: 7.2.0 - resolution: "@types/glob@npm:7.2.0" +"@smithy/types@npm:^4.2.0": + version: 4.2.0 + resolution: "@smithy/types@npm:4.2.0" dependencies: - "@types/minimatch": "*" - "@types/node": "*" - checksum: 6ae717fedfdfdad25f3d5a568323926c64f52ef35897bcac8aca8e19bc50c0bd84630bbd063e5d52078b2137d8e7d3c26eabebd1a2f03ff350fff8a91e79fc19 - languageName: node - linkType: hard - -"@types/http-cache-semantics@npm:*": - version: 4.0.4 - resolution: "@types/http-cache-semantics@npm:4.0.4" - checksum: 7f4dd832e618bc1e271be49717d7b4066d77c2d4eed5b81198eb987e532bb3e1c7e02f45d77918185bad936f884b700c10cebe06305f50400f382ab75055f9e8 + tslib: ^2.6.2 + checksum: 296b2122144a4edacbecf6baec138c6d4abb838b98823dbb8b94e90e89a0e1c13cf3a7bbd82900b4a229ebe58dac9cd516fc4a6ddf39b1e5190c91cce64c25a5 languageName: node linkType: hard -"@types/json-schema@npm:^7.0.3, @types/json-schema@npm:^7.0.9": - version: 7.0.15 - resolution: "@types/json-schema@npm:7.0.15" - checksum: 97ed0cb44d4070aecea772b7b2e2ed971e10c81ec87dd4ecc160322ffa55ff330dace1793489540e3e318d90942064bb697cc0f8989391797792d919737b3b98 +"@smithy/url-parser@npm:^4.0.2": + version: 4.0.2 + resolution: "@smithy/url-parser@npm:4.0.2" + dependencies: + "@smithy/querystring-parser": ^4.0.2 + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + checksum: a193c8d215756d5ee0f4fc52262f3aebba2c71a1f21e309f2d36fae79b1575379fd084383c1f159473879e72ea158650bcfa25048815378880867929fade24f1 languageName: node linkType: hard -"@types/json5@npm:^0.0.29": - version: 0.0.29 - resolution: "@types/json5@npm:0.0.29" - checksum: e60b153664572116dfea673c5bda7778dbff150498f44f998e34b5886d8afc47f16799280e4b6e241c0472aef1bc36add771c569c68fc5125fc2ae519a3eb9ac +"@smithy/util-base64@npm:^4.0.0": + version: 4.0.0 + resolution: "@smithy/util-base64@npm:4.0.0" + dependencies: + "@smithy/util-buffer-from": ^4.0.0 + "@smithy/util-utf8": ^4.0.0 + tslib: ^2.6.2 + checksum: 7fb3430d6e1cbb4bcc61458587bb0746458f0ec8e8cd008224ca984ff65c3c3307b3a528d040cef4c1fc7d1bd4111f6de8f4f1595845422f14ac7d100b3871b1 languageName: node linkType: hard -"@types/keyv@npm:^3.1.1, @types/keyv@npm:^3.1.4": - version: 3.1.4 - resolution: "@types/keyv@npm:3.1.4" +"@smithy/util-body-length-browser@npm:^4.0.0": + version: 4.0.0 + resolution: "@smithy/util-body-length-browser@npm:4.0.0" dependencies: - "@types/node": "*" - checksum: e009a2bfb50e90ca9b7c6e8f648f8464067271fd99116f881073fa6fa76dc8d0133181dd65e6614d5fb1220d671d67b0124aef7d97dc02d7e342ab143a47779d + tslib: ^2.6.2 + checksum: 72381e12de7cccbb722c60e3f3ae0f8bce7fc9a9e8064c7968ac733698a5a30bea098a3c365095c519491fe64e2e949c22f74d4f1e0d910090d6389b41c416eb languageName: node linkType: hard -"@types/level-errors@npm:*": - version: 3.0.2 - resolution: "@types/level-errors@npm:3.0.2" - checksum: 3d9b801f6499f795b60ac723c1b3f93ca105f20ed26966eeb606c804b10c65984c3233fb99914644d75a3223f80f220eca74fda316640a85a5b3d7572cd86925 +"@smithy/util-body-length-node@npm:^4.0.0": + version: 4.0.0 + resolution: "@smithy/util-body-length-node@npm:4.0.0" + dependencies: + tslib: ^2.6.2 + checksum: 12d8de9c526647f51f56804044f5847f0c7c7afee30fa368d2b7bd4b4de8fe2438a925aab51965fe8a4b2f08f68e8630cc3c54a449beae6646d99cae900ed106 languageName: node linkType: hard -"@types/levelup@npm:^4.3.0": - version: 4.3.3 - resolution: "@types/levelup@npm:4.3.3" +"@smithy/util-buffer-from@npm:^2.2.0": + version: 2.2.0 + resolution: "@smithy/util-buffer-from@npm:2.2.0" dependencies: - "@types/abstract-leveldown": "*" - "@types/level-errors": "*" - "@types/node": "*" - checksum: 04969bb805035960b8d6650e8f76893be7ba70267bb7012f6f00d67a0cf096ada552355629791b3f5925e9cdb6912d3fe08892c33c3c583e8fd02099b573bdd7 + "@smithy/is-array-buffer": ^2.2.0 + tslib: ^2.6.2 + checksum: 424c5b7368ae5880a8f2732e298d17879a19ca925f24ca45e1c6c005f717bb15b76eb28174d308d81631ad457ea0088aab0fd3255dd42f45a535c81944ad64d3 languageName: node linkType: hard -"@types/long@npm:^4.0.1": - version: 4.0.2 - resolution: "@types/long@npm:4.0.2" - checksum: d16cde7240d834cf44ba1eaec49e78ae3180e724cd667052b194a372f350d024cba8dd3f37b0864931683dab09ca935d52f0c4c1687178af5ada9fc85b0635f4 +"@smithy/util-buffer-from@npm:^4.0.0": + version: 4.0.0 + resolution: "@smithy/util-buffer-from@npm:4.0.0" + dependencies: + "@smithy/is-array-buffer": ^4.0.0 + tslib: ^2.6.2 + checksum: 8124e28d3e34b5335c08398a9081cc56a232d23e08172d488669f91a167d0871d36aba9dd3e4b70175a52f1bd70e2bf708d4c989a19512a4374d2cf67650a15e languageName: node linkType: hard -"@types/lru-cache@npm:5.1.1, @types/lru-cache@npm:^5.1.0": - version: 5.1.1 - resolution: "@types/lru-cache@npm:5.1.1" - checksum: e1d6c0085f61b16ec5b3073ec76ad1be4844ea036561c3f145fc19f71f084b58a6eb600b14128aa95809d057d28f1d147c910186ae51219f58366ffd2ff2e118 +"@smithy/util-config-provider@npm:^4.0.0": + version: 4.0.0 + resolution: "@smithy/util-config-provider@npm:4.0.0" + dependencies: + tslib: ^2.6.2 + checksum: 91bd9e0bec4c4a37c3fc286e72f3387be9272b090111edaee992d9e9619370f3f2ad88ce771ef42dbfe40a44500163b633914486e662526591f5f737d5e4ff5a languageName: node linkType: hard -"@types/minimatch@npm:*": - version: 5.1.2 - resolution: "@types/minimatch@npm:5.1.2" - checksum: 0391a282860c7cb6fe262c12b99564732401bdaa5e395bee9ca323c312c1a0f45efbf34dce974682036e857db59a5c9b1da522f3d6055aeead7097264c8705a8 +"@smithy/util-defaults-mode-browser@npm:^4.0.10": + version: 4.0.10 + resolution: "@smithy/util-defaults-mode-browser@npm:4.0.10" + dependencies: + "@smithy/property-provider": ^4.0.2 + "@smithy/smithy-client": ^4.2.2 + "@smithy/types": ^4.2.0 + bowser: ^2.11.0 + tslib: ^2.6.2 + checksum: 86a8e39eb6323b4b1b2556081c69b30418e35536a1cb97d2729f1c59d28470409a848e7da2b96bfdc6dfc4bc6b49d89acf9803ece050d75a91dc423c3c01d44a languageName: node linkType: hard -"@types/minimatch@npm:^3.0.4": - version: 3.0.5 - resolution: "@types/minimatch@npm:3.0.5" - checksum: c41d136f67231c3131cf1d4ca0b06687f4a322918a3a5adddc87ce90ed9dbd175a3610adee36b106ae68c0b92c637c35e02b58c8a56c424f71d30993ea220b92 +"@smithy/util-defaults-mode-node@npm:^4.0.10": + version: 4.0.10 + resolution: "@smithy/util-defaults-mode-node@npm:4.0.10" + dependencies: + "@smithy/config-resolver": ^4.1.0 + "@smithy/credential-provider-imds": ^4.0.2 + "@smithy/node-config-provider": ^4.0.2 + "@smithy/property-provider": ^4.0.2 + "@smithy/smithy-client": ^4.2.2 + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + checksum: 93f02b0a65f6410cb8931e869b83443c433565d9d1f9380436fdbd277b133400ab0d31edfc4cc9dd58c97b125202f8c6123c4c573293c4cc59b32076f99c2f0b languageName: node linkType: hard -"@types/mkdirp@npm:^0.5.2": - version: 0.5.2 - resolution: "@types/mkdirp@npm:0.5.2" +"@smithy/util-endpoints@npm:^3.0.2": + version: 3.0.2 + resolution: "@smithy/util-endpoints@npm:3.0.2" dependencies: - "@types/node": "*" - checksum: 21e6681ee18cee6314dbe0f57ada48981912b76de8266f438ba2573770d60aaa8dd376baad3f20e2346696a7cca84b0aadd1737222341553a0091831a46e6ad1 + "@smithy/node-config-provider": ^4.0.2 + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + checksum: 751b802a7e1f42e3ec70bd35ebe6a0964ee7c4fdd49da28351b28bd4c08438ea02d56230b5bd45787a21e963648453af7c69dc3d0a3a4da22758e5fa7084b2ec languageName: node linkType: hard -"@types/mocha@npm:^9.1.1": - version: 9.1.1 - resolution: "@types/mocha@npm:9.1.1" - checksum: 516077c0acd9806dc78317f88aaac0df5aaf0bdc2f63dfdadeabdf0b0137953b6ca65472e6ff7c30bc93ce4e0ae76eae70e8d46764b9a8eae4877a928b6ef49a +"@smithy/util-hex-encoding@npm:^4.0.0": + version: 4.0.0 + resolution: "@smithy/util-hex-encoding@npm:4.0.0" + dependencies: + tslib: ^2.6.2 + checksum: b932fa0e5cd2ba2598ad55ce46722bbbd15109809badaa3e4402fe4dd6f31f62b9fb49d2616e38d660363dc92a5898391f9c8f3b18507c36109e908400785e2a languageName: node linkType: hard -"@types/node-fetch@npm:^2.5.5, @types/node-fetch@npm:^2.6.1": - version: 2.6.11 - resolution: "@types/node-fetch@npm:2.6.11" +"@smithy/util-middleware@npm:^4.0.2": + version: 4.0.2 + resolution: "@smithy/util-middleware@npm:4.0.2" dependencies: - "@types/node": "*" - form-data: ^4.0.0 - checksum: 180e4d44c432839bdf8a25251ef8c47d51e37355ddd78c64695225de8bc5dc2b50b7bb855956d471c026bb84bd7295688a0960085e7158cbbba803053492568b + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + checksum: 74fdc436056b453fb9365c3c98067ae0d3e4ac0795868946dbecf3816b99996e4c5e5d02604b2bf57a1adda3669cf00b8fc9a3bb9db9af2c8c4de63be9ba9a4a languageName: node linkType: hard -"@types/node@npm:*, @types/node@npm:>=13.7.0": - version: 20.14.9 - resolution: "@types/node@npm:20.14.9" +"@smithy/util-retry@npm:^4.0.3": + version: 4.0.3 + resolution: "@smithy/util-retry@npm:4.0.3" dependencies: - undici-types: ~5.26.4 - checksum: 5e9eda1ac8c6cc6bcd1063903ae195eaede9aad1bdad00408a919409cfbcdd2d6535aa3d50346f0d385528f9e03dafc7d1b3bad25aedb1dcd79a6ad39d06c35d + "@smithy/service-error-classification": ^4.0.3 + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + checksum: 9cabe7f127729dcd93ef1fd9d5f47d5efe958cac534b51310fdfcfee6c1be2d6146a9c8f5f3bb4ba46d8be95e22d2b5b47de4dc15ab17b3c24b352ba063be0b5 languageName: node linkType: hard -"@types/node@npm:11.11.6": - version: 11.11.6 - resolution: "@types/node@npm:11.11.6" - checksum: 075f1c011cf568e49701419acbcb55c24906b3bb5a34d9412a3b88f228a7a78401a5ad4d3e1cd6855c99aaea5ef96e37fc86ca097e50f06da92cf822befc1fff +"@smithy/util-stream@npm:^4.2.0": + version: 4.2.0 + resolution: "@smithy/util-stream@npm:4.2.0" + dependencies: + "@smithy/fetch-http-handler": ^5.0.2 + "@smithy/node-http-handler": ^4.0.4 + "@smithy/types": ^4.2.0 + "@smithy/util-base64": ^4.0.0 + "@smithy/util-buffer-from": ^4.0.0 + "@smithy/util-hex-encoding": ^4.0.0 + "@smithy/util-utf8": ^4.0.0 + tslib: ^2.6.2 + checksum: b392f9464b2e93078e010d8f8e9a6bdb14633ea79eb050e5adcce143721ea2386447e5c565469d636029415d7466e7886c5367750b1d10033a8534ab23121404 languageName: node linkType: hard -"@types/node@npm:18.15.13": - version: 18.15.13 - resolution: "@types/node@npm:18.15.13" - checksum: 79cc5a2b5f98e8973061a4260a781425efd39161a0e117a69cd089603964816c1a14025e1387b4590c8e82d05133b7b4154fa53a7dffb3877890a66145e76515 +"@smithy/util-uri-escape@npm:^4.0.0": + version: 4.0.0 + resolution: "@smithy/util-uri-escape@npm:4.0.0" + dependencies: + tslib: ^2.6.2 + checksum: 7ea350545971f8a009d56e085c34c949c9045862cfab233ee7adc16e111a076a814bb5d9279b2b85ee382e0ed204a1c673ac32e3e28f1073b62a2c53a5dd6d19 languageName: node linkType: hard -"@types/node@npm:^10.0.3": - version: 10.17.60 - resolution: "@types/node@npm:10.17.60" - checksum: 2cdb3a77d071ba8513e5e8306fa64bf50e3c3302390feeaeff1fd325dd25c8441369715dfc8e3701011a72fed5958c7dfa94eb9239a81b3c286caa4d97db6eef +"@smithy/util-utf8@npm:^2.0.0": + version: 2.3.0 + resolution: "@smithy/util-utf8@npm:2.3.0" + dependencies: + "@smithy/util-buffer-from": ^2.2.0 + tslib: ^2.6.2 + checksum: 00e55d4b4e37d48be0eef3599082402b933c52a1407fed7e8e8ad76d94d81a0b30b8bfaf2047c59d9c3af31e5f20e7a8c959cb7ae270f894255e05a2229964f0 languageName: node linkType: hard -"@types/node@npm:^12.12.54, @types/node@npm:^12.12.6": - version: 12.20.55 - resolution: "@types/node@npm:12.20.55" - checksum: e4f86785f4092706e0d3b0edff8dca5a13b45627e4b36700acd8dfe6ad53db71928c8dee914d4276c7fd3b6ccd829aa919811c9eb708a2c8e4c6eb3701178c37 +"@smithy/util-utf8@npm:^4.0.0": + version: 4.0.0 + resolution: "@smithy/util-utf8@npm:4.0.0" + dependencies: + "@smithy/util-buffer-from": ^4.0.0 + tslib: ^2.6.2 + checksum: 08811c5a18c341782b3b65acc4640a9f559aeba61c889dbdc56e5153a3b7f395e613bfb1ade25cf15311d6237f291e1fce8af197c6313065e0cb084fd2148c64 languageName: node linkType: hard -"@types/node@npm:^18.6.1": - version: 18.19.39 - resolution: "@types/node@npm:18.19.39" +"@smithy/util-waiter@npm:^4.0.3": + version: 4.0.3 + resolution: "@smithy/util-waiter@npm:4.0.3" dependencies: - undici-types: ~5.26.4 - checksum: d1de755983127b405458c427ae2cf77c89d120a617ca70999086a75fb0b6c6dbc1bdddfe1a8a7374c9ae55ed0589a2bd023ffb3b09ee25440c013afc6502dfe6 + "@smithy/abort-controller": ^4.0.2 + "@smithy/types": ^4.2.0 + tslib: ^2.6.2 + checksum: 90611e62bc70ae03c4de672cdf34f2beb8ac54bfa76ff22b5acbcb4302d9ba7207541a9e5a0145028c8d8aa99e6b276cad300b1a7d2af675661ff942401f5ddb languageName: node linkType: hard -"@types/node@npm:^8.0.0": - version: 8.10.66 - resolution: "@types/node@npm:8.10.66" - checksum: c52039de862654a139abdc6a51de532a69dd80516ac35a959c3b3a2831ecbaaf065b0df5f9db943f5e28b544ebb9a891730d52b52f7a169b86a82bc060210000 +"@solidity-parser/parser@npm:^0.16.0": + version: 0.16.2 + resolution: "@solidity-parser/parser@npm:0.16.2" + dependencies: + antlr4ts: ^0.5.0-alpha.4 + checksum: 109f7bec5de943c63e444fdde179d9bba6a592c18c836f585753798f428424cfcca72c715e7a345e4b79b83d6548543c9e56cb4b263e9b1e8352af2efcfd224a languageName: node linkType: hard -"@types/parse-json@npm:^4.0.0": - version: 4.0.2 - resolution: "@types/parse-json@npm:4.0.2" - checksum: 5bf62eec37c332ad10059252fc0dab7e7da730764869c980b0714777ad3d065e490627be9f40fc52f238ffa3ac4199b19de4127196910576c2fe34dd47c7a470 +"@solidity-parser/parser@npm:^0.19.0": + version: 0.19.0 + resolution: "@solidity-parser/parser@npm:0.19.0" + checksum: b1c556eeb83ac99f066ea4b0eb0bee45321a667f76dbafef95f8bc6adf32d1f8f52f752fb47620c61d1a264d3acb7534d75a8daa6d21099f55bc52b0af13ad83 languageName: node linkType: hard -"@types/pbkdf2@npm:^3.0.0": - version: 3.1.2 - resolution: "@types/pbkdf2@npm:3.1.2" - dependencies: - "@types/node": "*" - checksum: bebe1e596cbbe5f7d2726a58859e61986c5a42459048e29cb7f2d4d764be6bbb0844572fd5d70ca8955a8a17e8b4ed80984fc4903e165d9efb8807a3fbb051aa +"@solidity-parser/parser@npm:^0.20.1": + version: 0.20.1 + resolution: "@solidity-parser/parser@npm:0.20.1" + checksum: a05152e54be574b3b75cc6ad059bec01e4ff26c6bc68a0fa4fb9aca3542058c6c657a65d9f3cfb553b986e4143724a8ce98500b3b5453d2f7b2f4397cc32cf63 languageName: node linkType: hard -"@types/prettier@npm:^2.1.1": - version: 2.7.3 - resolution: "@types/prettier@npm:2.7.3" - checksum: 705384209cea6d1433ff6c187c80dcc0b95d99d5c5ce21a46a9a58060c527973506822e428789d842761e0280d25e3359300f017fbe77b9755bc772ab3dc2f83 +"@trufflesuite/bigint-buffer@npm:1.1.10": + version: 1.1.10 + resolution: "@trufflesuite/bigint-buffer@npm:1.1.10" + dependencies: + node-gyp: latest + node-gyp-build: 4.4.0 + checksum: e1dc5e4fbf348a55e660c0055267021eb04cbbdb7f6b0ee983ad32cd4aae1200be448a2ca3963c7d19c7c936d42f66c1ff8b5e4e2332cb1a9e3f870ff818dce4 languageName: node linkType: hard -"@types/qs@npm:^6.2.31": - version: 6.9.15 - resolution: "@types/qs@npm:6.9.15" - checksum: 97d8208c2b82013b618e7a9fc14df6bd40a73e1385ac479b6896bafc7949a46201c15f42afd06e86a05e914f146f495f606b6fb65610cc60cf2e0ff743ec38a2 +"@trufflesuite/bigint-buffer@npm:1.1.9": + version: 1.1.9 + resolution: "@trufflesuite/bigint-buffer@npm:1.1.9" + dependencies: + node-gyp: latest + node-gyp-build: 4.3.0 + checksum: 627dcff2cae7afe31432646232518363869e89b300f90f88ca68d903d0bdc79119975a5bc338223c03c1a4484cfac6d9cf4413ef20933a69eee48dd925519165 languageName: node linkType: hard -"@types/resolve@npm:^0.0.8": - version: 0.0.8 - resolution: "@types/resolve@npm:0.0.8" - dependencies: - "@types/node": "*" - checksum: f241bb773ab14b14500623ac3b57c52006ce32b20426b6d8bf2fe5fdc0344f42c77ac0f94ff57b443ae1d320a1a86c62b4e47239f0321699404402fbeb24bad6 +"@tsconfig/node10@npm:^1.0.7": + version: 1.0.11 + resolution: "@tsconfig/node10@npm:1.0.11" + checksum: 51fe47d55fe1b80ec35e6e5ed30a13665fd3a531945350aa74a14a1e82875fb60b350c2f2a5e72a64831b1b6bc02acb6760c30b3738b54954ec2dea82db7a267 languageName: node linkType: hard -"@types/responselike@npm:^1.0.0": - version: 1.0.3 - resolution: "@types/responselike@npm:1.0.3" - dependencies: - "@types/node": "*" - checksum: 6ac4b35723429b11b117e813c7acc42c3af8b5554caaf1fc750404c1ae59f9b7376bc69b9e9e194a5a97357a597c2228b7173d317320f0360d617b6425212f58 +"@tsconfig/node12@npm:^1.0.7": + version: 1.0.11 + resolution: "@tsconfig/node12@npm:1.0.11" + checksum: 5ce29a41b13e7897a58b8e2df11269c5395999e588b9a467386f99d1d26f6c77d1af2719e407621412520ea30517d718d5192a32403b8dfcc163bf33e40a338a languageName: node linkType: hard -"@types/secp256k1@npm:^4.0.1": - version: 4.0.6 - resolution: "@types/secp256k1@npm:4.0.6" - dependencies: - "@types/node": "*" - checksum: 984494caf49a4ce99fda2b9ea1840eb47af946b8c2737314108949bcc0c06b4880e871296bd49ed6ea4c8423e3a302ad79fec43abfc987330e7eb98f0c4e8ba4 +"@tsconfig/node14@npm:^1.0.0": + version: 1.0.3 + resolution: "@tsconfig/node14@npm:1.0.3" + checksum: 19275fe80c4c8d0ad0abed6a96dbf00642e88b220b090418609c4376e1cef81bf16237bf170ad1b341452feddb8115d8dd2e5acdfdea1b27422071163dc9ba9d languageName: node linkType: hard -"@types/seedrandom@npm:3.0.1": - version: 3.0.1 - resolution: "@types/seedrandom@npm:3.0.1" - checksum: d9755452f224a4f5072a1d8738da6c9de3039fc59a2a449b1f658e51087be7b48ada49bcabc8b0f16633c095f55598c32fcd072c448858422a2f6a0566569e4c +"@tsconfig/node16@npm:^1.0.2": + version: 1.0.4 + resolution: "@tsconfig/node16@npm:1.0.4" + checksum: 202319785901f942a6e1e476b872d421baec20cf09f4b266a1854060efbf78cde16a4d256e8bc949d31e6cd9a90f1e8ef8fb06af96a65e98338a2b6b0de0a0ff languageName: node linkType: hard -"@types/semver@npm:^7.3.12": - version: 7.5.8 - resolution: "@types/semver@npm:7.5.8" - checksum: ea6f5276f5b84c55921785a3a27a3cd37afee0111dfe2bcb3e03c31819c197c782598f17f0b150a69d453c9584cd14c4c4d7b9a55d2c5e6cacd4d66fdb3b3663 +"@typechain/ethers-v5@npm:^10.0.0": + version: 10.2.1 + resolution: "@typechain/ethers-v5@npm:10.2.1" + dependencies: + lodash: ^4.17.15 + ts-essentials: ^7.0.1 + peerDependencies: + "@ethersproject/abi": ^5.0.0 + "@ethersproject/providers": ^5.0.0 + ethers: ^5.1.3 + typechain: ^8.1.1 + typescript: ">=4.3.0" + checksum: 852da4b1ff368ef87251111a5d50077de3d0fc12c519529269a74223740f8bda89297e67a5eb6c1f5b04ee23119566d6cbccf58264d32a83132be0f328a58d22 languageName: node linkType: hard -"@types/sinon-chai@npm:^3.2.12": - version: 3.2.12 - resolution: "@types/sinon-chai@npm:3.2.12" +"@typechain/ethers-v6@npm:^0.5.1": + version: 0.5.1 + resolution: "@typechain/ethers-v6@npm:0.5.1" dependencies: - "@types/chai": "*" - "@types/sinon": "*" - checksum: d906f2f766613534c5e9fe1437ec740fb6a9a550f02d1a0abe180c5f18fe73a99f0c12935195404d42f079f5f72a371e16b81e2aef963a6ef0ee0ed9d5d7f391 + lodash: ^4.17.15 + ts-essentials: ^7.0.1 + peerDependencies: + ethers: 6.x + typechain: ^8.3.2 + typescript: ">=4.7.0" + checksum: 44e7970ce95eeb1a02019f8a53bbe30dcb87664e1df15fe436ae48eea1bf91ca72b5b230eac1bdf9cbe9b55bc488b54c6273e6f77155eaeff885fb34cfcd1108 languageName: node linkType: hard -"@types/sinon@npm:*": - version: 17.0.3 - resolution: "@types/sinon@npm:17.0.3" +"@typechain/hardhat@npm:^6.1.2": + version: 6.1.6 + resolution: "@typechain/hardhat@npm:6.1.6" dependencies: - "@types/sinonjs__fake-timers": "*" - checksum: c8e9956d9c90fe1ec1cc43085ae48897f93f9ea86e909ab47f255ea71f5229651faa070393950fb6923aef426c84e92b375503f9f8886ef44668b82a8ee49e9a + fs-extra: ^9.1.0 + peerDependencies: + "@ethersproject/abi": ^5.4.7 + "@ethersproject/providers": ^5.4.7 + "@typechain/ethers-v5": ^10.2.1 + ethers: ^5.4.7 + hardhat: ^2.9.9 + typechain: ^8.1.1 + checksum: f214bebf7860956230478cb92696ba757829cfd9dc65ac99c3bc7e539378310318d92b009054186f446595c8ffc1a81e9c6d028da0eb04253253049ea1b6e8d3 languageName: node linkType: hard -"@types/sinonjs__fake-timers@npm:*": - version: 8.1.5 - resolution: "@types/sinonjs__fake-timers@npm:8.1.5" - checksum: 7e3c08f6c13df44f3ea7d9a5155ddf77e3f7314c156fa1c5a829a4f3763bafe2f75b1283b887f06e6b4296996a2f299b70f64ff82625f9af5885436e2524d10c +"@types/abstract-leveldown@npm:*": + version: 7.2.5 + resolution: "@types/abstract-leveldown@npm:7.2.5" + checksum: 3a99b13c81a53a62b42bea9cff326880de3146b4eeff528b039be69a268515b3120a6c12142e96646fcb0a03c463f298998581e86d9ddb29fbea3612f40edb2b languageName: node linkType: hard -"@types/ws@npm:^7.4.4": - version: 7.4.7 - resolution: "@types/ws@npm:7.4.7" +"@types/bn.js@npm:^4.11.3": + version: 4.11.6 + resolution: "@types/bn.js@npm:4.11.6" dependencies: "@types/node": "*" - checksum: b4c9b8ad209620c9b21e78314ce4ff07515c0cadab9af101c1651e7bfb992d7fd933bd8b9c99d110738fd6db523ed15f82f29f50b45510288da72e964dedb1a3 + checksum: 7f66f2c7b7b9303b3205a57184261974b114495736b77853af5b18d857c0b33e82ce7146911e86e87a87837de8acae28986716fd381ac7c301fd6e8d8b6c811f languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:^2.0.0": - version: 2.34.0 - resolution: "@typescript-eslint/eslint-plugin@npm:2.34.0" +"@types/bn.js@npm:^5.1.0": + version: 5.1.6 + resolution: "@types/bn.js@npm:5.1.6" dependencies: - "@typescript-eslint/experimental-utils": 2.34.0 - functional-red-black-tree: ^1.0.1 - regexpp: ^3.0.0 - tsutils: ^3.17.1 - peerDependencies: - "@typescript-eslint/parser": ^2.0.0 - eslint: ^5.0.0 || ^6.0.0 - peerDependenciesMeta: - typescript: - optional: true - checksum: 028adcb70015fec8198f801524223b3fa53d807fabd91e44e438e02df5cc4eac0ae53fcaeb8627f14a84fd72a2dcfbab561bdb8d4969cbb810849c789ae66548 + "@types/node": "*" + checksum: 887411126d40e3d28aef2df8075cda2832db2b0e926bb4046039bbb026f2e3cfbcf1a3ce90bd935be0fcc039f8009e32026dfbb84a11c1f5d051cd7f8194ba23 languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:^5.0.0": - version: 5.62.0 - resolution: "@typescript-eslint/eslint-plugin@npm:5.62.0" +"@types/chai-as-promised@npm:^7.1.3": + version: 7.1.8 + resolution: "@types/chai-as-promised@npm:7.1.8" dependencies: - "@eslint-community/regexpp": ^4.4.0 - "@typescript-eslint/scope-manager": 5.62.0 - "@typescript-eslint/type-utils": 5.62.0 - "@typescript-eslint/utils": 5.62.0 - debug: ^4.3.4 - graphemer: ^1.4.0 - ignore: ^5.2.0 - natural-compare-lite: ^1.4.0 - semver: ^7.3.7 - tsutils: ^3.21.0 - peerDependencies: - "@typescript-eslint/parser": ^5.0.0 - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - peerDependenciesMeta: - typescript: - optional: true - checksum: fc104b389c768f9fa7d45a48c86d5c1ad522c1d0512943e782a56b1e3096b2cbcc1eea3fcc590647bf0658eef61aac35120a9c6daf979bf629ad2956deb516a1 + "@types/chai": "*" + checksum: f0e5eab451b91bc1e289ed89519faf6591932e8a28d2ec9bbe95826eb73d28fe43713633e0c18706f3baa560a7d97e7c7c20dc53ce639e5d75bac46b2a50bf21 languageName: node linkType: hard -"@typescript-eslint/experimental-utils@npm:2.34.0": - version: 2.34.0 - resolution: "@typescript-eslint/experimental-utils@npm:2.34.0" +"@types/chai@npm:*": + version: 5.2.2 + resolution: "@types/chai@npm:5.2.2" dependencies: - "@types/json-schema": ^7.0.3 - "@typescript-eslint/typescript-estree": 2.34.0 - eslint-scope: ^5.0.0 - eslint-utils: ^2.0.0 - peerDependencies: - eslint: "*" - checksum: 3d267185a727dad276921d4b7b9d95247ffc50740f944c8f3f66ae1556b9f3529632bff4e921a9bfe0d0b0c55542ff2ff6479615a4f4a01645e49893f32b6350 + "@types/deep-eql": "*" + checksum: 386887bd55ba684572cececd833ed91aba6cce2edd8cc1d8cefa78800b3a74db6dbf5c5c41af041d1d1f3ce672ea30b45c9520f948cdc75431eb7df3fbba8405 languageName: node linkType: hard -"@typescript-eslint/parser@npm:^2.0.0": - version: 2.34.0 - resolution: "@typescript-eslint/parser@npm:2.34.0" - dependencies: - "@types/eslint-visitor-keys": ^1.0.0 - "@typescript-eslint/experimental-utils": 2.34.0 - "@typescript-eslint/typescript-estree": 2.34.0 - eslint-visitor-keys: ^1.1.0 - peerDependencies: - eslint: ^5.0.0 || ^6.0.0 - peerDependenciesMeta: - typescript: - optional: true - checksum: 2cd9890760bc1be48102e8cc2404b2c9323f049990de07b356d9f97b9d29b3cf905ef06b69eea8e0834b67eb54e1f58dcc67e20edd8c98f10cd11b8732fb6894 +"@types/chai@npm:^4.3.1": + version: 4.3.20 + resolution: "@types/chai@npm:4.3.20" + checksum: 7c5b0c9148f1a844a8d16cb1e16c64f2e7749cab2b8284155b9e494a6b34054846e22fb2b38df6b290f9bf57e6beebb2e121940c5896bc086ad7bab7ed429f06 languageName: node linkType: hard -"@typescript-eslint/parser@npm:^5.0.0": - version: 5.62.0 - resolution: "@typescript-eslint/parser@npm:5.62.0" +"@types/connect@npm:^3.4.33": + version: 3.4.38 + resolution: "@types/connect@npm:3.4.38" dependencies: - "@typescript-eslint/scope-manager": 5.62.0 - "@typescript-eslint/types": 5.62.0 - "@typescript-eslint/typescript-estree": 5.62.0 - debug: ^4.3.4 - peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - peerDependenciesMeta: - typescript: - optional: true - checksum: d168f4c7f21a7a63f47002e2d319bcbb6173597af5c60c1cf2de046b46c76b4930a093619e69faf2d30214c29ab27b54dcf1efc7046a6a6bd6f37f59a990e752 + "@types/node": "*" + checksum: 7eb1bc5342a9604facd57598a6c62621e244822442976c443efb84ff745246b10d06e8b309b6e80130026a396f19bf6793b7cecd7380169f369dac3bfc46fb99 languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:5.62.0": - version: 5.62.0 - resolution: "@typescript-eslint/scope-manager@npm:5.62.0" - dependencies: - "@typescript-eslint/types": 5.62.0 - "@typescript-eslint/visitor-keys": 5.62.0 - checksum: 6062d6b797fe1ce4d275bb0d17204c827494af59b5eaf09d8a78cdd39dadddb31074dded4297aaf5d0f839016d601032857698b0e4516c86a41207de606e9573 +"@types/deep-eql@npm:*": + version: 4.0.2 + resolution: "@types/deep-eql@npm:4.0.2" + checksum: 249a27b0bb22f6aa28461db56afa21ec044fa0e303221a62dff81831b20c8530502175f1a49060f7099e7be06181078548ac47c668de79ff9880241968d43d0c languageName: node linkType: hard -"@typescript-eslint/type-utils@npm:5.62.0": - version: 5.62.0 - resolution: "@typescript-eslint/type-utils@npm:5.62.0" +"@types/eslint-visitor-keys@npm:^1.0.0": + version: 1.0.0 + resolution: "@types/eslint-visitor-keys@npm:1.0.0" + checksum: a90f0b023e357a59ea04268e0387cfb0ea06703068cc48fe2ca97fa158bcf3c51a6611a56bdbdf763e3451150b92bba3fb5d0b689fc55f856cae8555ec366a63 + languageName: node + linkType: hard + +"@types/glob@npm:^7.1.1": + version: 7.2.0 + resolution: "@types/glob@npm:7.2.0" dependencies: - "@typescript-eslint/typescript-estree": 5.62.0 - "@typescript-eslint/utils": 5.62.0 - debug: ^4.3.4 - tsutils: ^3.21.0 - peerDependencies: - eslint: "*" - peerDependenciesMeta: - typescript: - optional: true - checksum: fc41eece5f315dfda14320be0da78d3a971d650ea41300be7196934b9715f3fe1120a80207551eb71d39568275dbbcf359bde540d1ca1439d8be15e9885d2739 + "@types/minimatch": "*" + "@types/node": "*" + checksum: 6ae717fedfdfdad25f3d5a568323926c64f52ef35897bcac8aca8e19bc50c0bd84630bbd063e5d52078b2137d8e7d3c26eabebd1a2f03ff350fff8a91e79fc19 languageName: node linkType: hard -"@typescript-eslint/types@npm:5.62.0": - version: 5.62.0 - resolution: "@typescript-eslint/types@npm:5.62.0" - checksum: 48c87117383d1864766486f24de34086155532b070f6264e09d0e6139449270f8a9559cfef3c56d16e3bcfb52d83d42105d61b36743626399c7c2b5e0ac3b670 +"@types/json-schema@npm:^7.0.3, @types/json-schema@npm:^7.0.9": + version: 7.0.15 + resolution: "@types/json-schema@npm:7.0.15" + checksum: 97ed0cb44d4070aecea772b7b2e2ed971e10c81ec87dd4ecc160322ffa55ff330dace1793489540e3e318d90942064bb697cc0f8989391797792d919737b3b98 languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:2.34.0": - version: 2.34.0 - resolution: "@typescript-eslint/typescript-estree@npm:2.34.0" - dependencies: - debug: ^4.1.1 - eslint-visitor-keys: ^1.1.0 - glob: ^7.1.6 - is-glob: ^4.0.1 - lodash: ^4.17.15 - semver: ^7.3.2 - tsutils: ^3.17.1 - peerDependenciesMeta: - typescript: - optional: true - checksum: 6eb689513765350daaf0ba12ef204061e12a8add557b4eafcc63fb0ab9345eee6ca68e64e4b88625a2b844802cfc44cbad47468840cfc990a40d27457ec75390 +"@types/json5@npm:^0.0.29": + version: 0.0.29 + resolution: "@types/json5@npm:0.0.29" + checksum: e60b153664572116dfea673c5bda7778dbff150498f44f998e34b5886d8afc47f16799280e4b6e241c0472aef1bc36add771c569c68fc5125fc2ae519a3eb9ac languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:5.62.0": - version: 5.62.0 - resolution: "@typescript-eslint/typescript-estree@npm:5.62.0" - dependencies: - "@typescript-eslint/types": 5.62.0 - "@typescript-eslint/visitor-keys": 5.62.0 - debug: ^4.3.4 - globby: ^11.1.0 - is-glob: ^4.0.3 - semver: ^7.3.7 - tsutils: ^3.21.0 - peerDependenciesMeta: - typescript: - optional: true - checksum: 3624520abb5807ed8f57b1197e61c7b1ed770c56dfcaca66372d584ff50175225798bccb701f7ef129d62c5989070e1ee3a0aa2d84e56d9524dcf011a2bb1a52 +"@types/level-errors@npm:*": + version: 3.0.2 + resolution: "@types/level-errors@npm:3.0.2" + checksum: 3d9b801f6499f795b60ac723c1b3f93ca105f20ed26966eeb606c804b10c65984c3233fb99914644d75a3223f80f220eca74fda316640a85a5b3d7572cd86925 languageName: node linkType: hard -"@typescript-eslint/utils@npm:5.62.0": - version: 5.62.0 - resolution: "@typescript-eslint/utils@npm:5.62.0" +"@types/levelup@npm:^4.3.0": + version: 4.3.3 + resolution: "@types/levelup@npm:4.3.3" dependencies: - "@eslint-community/eslint-utils": ^4.2.0 - "@types/json-schema": ^7.0.9 - "@types/semver": ^7.3.12 - "@typescript-eslint/scope-manager": 5.62.0 - "@typescript-eslint/types": 5.62.0 - "@typescript-eslint/typescript-estree": 5.62.0 - eslint-scope: ^5.1.1 - semver: ^7.3.7 - peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - checksum: ee9398c8c5db6d1da09463ca7bf36ed134361e20131ea354b2da16a5fdb6df9ba70c62a388d19f6eebb421af1786dbbd79ba95ddd6ab287324fc171c3e28d931 + "@types/abstract-leveldown": "*" + "@types/level-errors": "*" + "@types/node": "*" + checksum: 04969bb805035960b8d6650e8f76893be7ba70267bb7012f6f00d67a0cf096ada552355629791b3f5925e9cdb6912d3fe08892c33c3c583e8fd02099b573bdd7 languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:5.62.0": - version: 5.62.0 - resolution: "@typescript-eslint/visitor-keys@npm:5.62.0" - dependencies: - "@typescript-eslint/types": 5.62.0 - eslint-visitor-keys: ^3.3.0 - checksum: 976b05d103fe8335bef5c93ad3f76d781e3ce50329c0243ee0f00c0fcfb186c81df50e64bfdd34970148113f8ade90887f53e3c4938183afba830b4ba8e30a35 +"@types/long@npm:^4.0.1": + version: 4.0.2 + resolution: "@types/long@npm:4.0.2" + checksum: d16cde7240d834cf44ba1eaec49e78ae3180e724cd667052b194a372f350d024cba8dd3f37b0864931683dab09ca935d52f0c4c1687178af5ada9fc85b0635f4 languageName: node linkType: hard -"@ungap/structured-clone@npm:^1.2.0": - version: 1.2.0 - resolution: "@ungap/structured-clone@npm:1.2.0" - checksum: 4f656b7b4672f2ce6e272f2427d8b0824ed11546a601d8d5412b9d7704e83db38a8d9f402ecdf2b9063fc164af842ad0ec4a55819f621ed7e7ea4d1efcc74524 +"@types/lru-cache@npm:5.1.1, @types/lru-cache@npm:^5.1.0": + version: 5.1.1 + resolution: "@types/lru-cache@npm:5.1.1" + checksum: e1d6c0085f61b16ec5b3073ec76ad1be4844ea036561c3f145fc19f71f084b58a6eb600b14128aa95809d057d28f1d147c910186ae51219f58366ffd2ff2e118 languageName: node linkType: hard -"@uniswap/lib@npm:1.1.1": - version: 1.1.1 - resolution: "@uniswap/lib@npm:1.1.1" - checksum: 2ec6689f606a0cf7dc7acd8b7471997638b2c89202c52743dcb4dfc0df182f6e058ec1a5e4d94a872c81bb85cbcde9e4a46b6de45eea0d34582627d97e743c7b +"@types/minimatch@npm:*": + version: 5.1.2 + resolution: "@types/minimatch@npm:5.1.2" + checksum: 0391a282860c7cb6fe262c12b99564732401bdaa5e395bee9ca323c312c1a0f45efbf34dce974682036e857db59a5c9b1da522f3d6055aeead7097264c8705a8 languageName: node linkType: hard -"@uniswap/lib@npm:^4.0.1-alpha": - version: 4.0.1-alpha - resolution: "@uniswap/lib@npm:4.0.1-alpha" - checksum: d7bbacccef40966af16c7e215ab085f575686d316b2802c9e1cfd03f7ad351970e547535670a28b2279c3cfcc4fb02888614c46f94efe2987af2309f3ec86127 +"@types/minimatch@npm:^3.0.4": + version: 3.0.5 + resolution: "@types/minimatch@npm:3.0.5" + checksum: c41d136f67231c3131cf1d4ca0b06687f4a322918a3a5adddc87ce90ed9dbd175a3610adee36b106ae68c0b92c637c35e02b58c8a56c424f71d30993ea220b92 languageName: node linkType: hard -"@uniswap/v2-core@npm:1.0.0": - version: 1.0.0 - resolution: "@uniswap/v2-core@npm:1.0.0" - checksum: 41e42ad801dbc058ebf0ab38a8ce3195990e21eff4b2d49cd0a8c8fd25ac067feed55c379f2be22d915a7601d94966ae66127b748b2d3acde20eeb2351e51703 +"@types/mkdirp@npm:^0.5.2": + version: 0.5.2 + resolution: "@types/mkdirp@npm:0.5.2" + dependencies: + "@types/node": "*" + checksum: 21e6681ee18cee6314dbe0f57ada48981912b76de8266f438ba2573770d60aaa8dd376baad3f20e2346696a7cca84b0aadd1737222341553a0091831a46e6ad1 languageName: node linkType: hard -"@uniswap/v2-core@npm:^1.0.1": - version: 1.0.1 - resolution: "@uniswap/v2-core@npm:1.0.1" - checksum: eaa118fe45eac2e80b7468547ce2cde12bd3c8157555d2e40e0462a788c9506c6295247b511382da85e44a89ad92aff7bb3433b23bfbd2eeea23942ecd46e979 +"@types/mocha@npm:^9.1.1": + version: 9.1.1 + resolution: "@types/mocha@npm:9.1.1" + checksum: 516077c0acd9806dc78317f88aaac0df5aaf0bdc2f63dfdadeabdf0b0137953b6ca65472e6ff7c30bc93ce4e0ae76eae70e8d46764b9a8eae4877a928b6ef49a languageName: node linkType: hard -"@uniswap/v2-periphery@npm:^1.1.0-beta.0": - version: 1.1.0-beta.0 - resolution: "@uniswap/v2-periphery@npm:1.1.0-beta.0" +"@types/node-fetch@npm:^2.6.1": + version: 2.6.12 + resolution: "@types/node-fetch@npm:2.6.12" dependencies: - "@uniswap/lib": 1.1.1 - "@uniswap/v2-core": 1.0.0 - checksum: af13224c9f28f817be6e5794a7590b8433788e5387912343a8d61227a42b494b431fe6e549505e87d96a6896e96e289f80d92c68788eea4917596ec7fd94734e - languageName: node - linkType: hard - -"@uniswap/v3-core@npm:^1.0.0, @uniswap/v3-core@npm:^1.0.1": - version: 1.0.1 - resolution: "@uniswap/v3-core@npm:1.0.1" - checksum: 4bfd8b218391a3d9efde44e0f984cfec3bc25889cd4d1386766828521006e71b210a3583ee32b52f3c81d384af9e8c39f471f2229e9af4d50da6801446ecb3e4 + "@types/node": "*" + form-data: ^4.0.0 + checksum: 9647e68f9a125a090220c38d77b3c8e669c488658ae7506f1b4f9568214beba087624b1705bba1dc76649a65281ce3fd5b400e15266cbef8088027fb88777557 languageName: node linkType: hard -"@uniswap/v3-periphery@npm:^1.1.0": - version: 1.4.4 - resolution: "@uniswap/v3-periphery@npm:1.4.4" +"@types/node@npm:*, @types/node@npm:>=13.7.0": + version: 22.15.16 + resolution: "@types/node@npm:22.15.16" dependencies: - "@openzeppelin/contracts": 3.4.2-solc-0.7 - "@uniswap/lib": ^4.0.1-alpha - "@uniswap/v2-core": ^1.0.1 - "@uniswap/v3-core": ^1.0.0 - base64-sol: 1.0.1 - checksum: 48b57f1f648cb002935421ac1770666ab3c0263885a03c769985b06501b88d513a435c8edc439b41ac5aef7ad40a11038a3561f7e828cce5ae6ec2c77742f1af + undici-types: ~6.21.0 + checksum: a90136c365f47da329cc41814dedfb9e8484c1429baf8d8f99c2d427181319bce933371940eb1377b9f73ab0f8c4d40621fece878eee36222283b9982ddf7227 languageName: node linkType: hard -"@yarnpkg/lockfile@npm:^1.1.0": - version: 1.1.0 - resolution: "@yarnpkg/lockfile@npm:1.1.0" - checksum: 05b881b4866a3546861fee756e6d3812776ea47fa6eb7098f983d6d0eefa02e12b66c3fff931574120f196286a7ad4879ce02743c8bb2be36c6a576c7852083a +"@types/node@npm:11.11.6": + version: 11.11.6 + resolution: "@types/node@npm:11.11.6" + checksum: 075f1c011cf568e49701419acbcb55c24906b3bb5a34d9412a3b88f228a7a78401a5ad4d3e1cd6855c99aaea5ef96e37fc86ca097e50f06da92cf822befc1fff languageName: node linkType: hard -"JSONStream@npm:1.3.2": - version: 1.3.2 - resolution: "JSONStream@npm:1.3.2" +"@types/node@npm:22.7.5": + version: 22.7.5 + resolution: "@types/node@npm:22.7.5" dependencies: - jsonparse: ^1.2.0 - through: ">=2.2.7 <3" - bin: - JSONStream: ./bin.js - checksum: d83b86f846eaeba7b947181245b977bb7e32c49e25d210234ecbf6b2d9128924610224e150558deeb65d063b07b8c28e5a1a4ab8daeb89d4c34e718047f046fd + undici-types: ~6.19.2 + checksum: 1a8bbb504efaffcef7b8491074a428e5c0b5425b0c0ffb13e7262cb8462c275e8cc5eaf90a38d8fbf52a1eeda7c01ab3b940673c43fc2414140779c973e40ec6 languageName: node linkType: hard -"JSONStream@npm:^1.3.5": - version: 1.3.5 - resolution: "JSONStream@npm:1.3.5" - dependencies: - jsonparse: ^1.2.0 - through: ">=2.2.7 <3" - bin: - JSONStream: ./bin.js - checksum: 2605fa124260c61bad38bb65eba30d2f72216a78e94d0ab19b11b4e0327d572b8d530c0c9cc3b0764f727ad26d39e00bf7ebad57781ca6368394d73169c59e46 +"@types/node@npm:^12.12.54": + version: 12.20.55 + resolution: "@types/node@npm:12.20.55" + checksum: e4f86785f4092706e0d3b0edff8dca5a13b45627e4b36700acd8dfe6ad53db71928c8dee914d4276c7fd3b6ccd829aa919811c9eb708a2c8e4c6eb3701178c37 languageName: node linkType: hard -"abbrev@npm:1": - version: 1.1.1 - resolution: "abbrev@npm:1.1.1" - checksum: a4a97ec07d7ea112c517036882b2ac22f3109b7b19077dc656316d07d308438aac28e4d9746dc4d84bf6b1e75b4a7b0a5f3cb30592419f128ca9a8cee3bcfa17 +"@types/node@npm:^18.6.1": + version: 18.19.99 + resolution: "@types/node@npm:18.19.99" + dependencies: + undici-types: ~5.26.4 + checksum: 59a77f2cd576e852b320d9e4c769cd50ffcad03da6b7311584d56aaf49d007b5fc942492e67cb6bdd5e737d1b5fde56f81c604c4a625e208e19d5828900c079f languageName: node linkType: hard -"abbrev@npm:1.0.x": - version: 1.0.9 - resolution: "abbrev@npm:1.0.9" - checksum: 46460c897b4ce62cd9b1bd4a853cc46e771a1f1d929f5443f3945a976f8be5388891bf9e5f8a9862baa29587349e16c48596b6a621404d46d3b184fe9bd9fb26 +"@types/parse-json@npm:^4.0.0": + version: 4.0.2 + resolution: "@types/parse-json@npm:4.0.2" + checksum: 5bf62eec37c332ad10059252fc0dab7e7da730764869c980b0714777ad3d065e490627be9f40fc52f238ffa3ac4199b19de4127196910576c2fe34dd47c7a470 languageName: node linkType: hard -"abbrev@npm:^2.0.0": - version: 2.0.0 - resolution: "abbrev@npm:2.0.0" - checksum: 0e994ad2aa6575f94670d8a2149afe94465de9cedaaaac364e7fb43a40c3691c980ff74899f682f4ca58fa96b4cbd7421a015d3a6defe43a442117d7821a2f36 +"@types/pbkdf2@npm:^3.0.0": + version: 3.1.2 + resolution: "@types/pbkdf2@npm:3.1.2" + dependencies: + "@types/node": "*" + checksum: bebe1e596cbbe5f7d2726a58859e61986c5a42459048e29cb7f2d4d764be6bbb0844572fd5d70ca8955a8a17e8b4ed80984fc4903e165d9efb8807a3fbb051aa languageName: node linkType: hard -"abitype@npm:1.0.0": - version: 1.0.0 - resolution: "abitype@npm:1.0.0" - peerDependencies: - typescript: ">=5.0.4" - zod: ^3 >=3.22.0 - peerDependenciesMeta: - typescript: - optional: true - zod: - optional: true - checksum: ea2c0548c3ba58c37a6de7483d63389074da498e63d803b742bbe94eb4eaa1f51a35d000c424058b2583aef56698cf07c696eb3bc4dd0303bc20c6f0826a241a +"@types/prettier@npm:^2.1.1": + version: 2.7.3 + resolution: "@types/prettier@npm:2.7.3" + checksum: 705384209cea6d1433ff6c187c80dcc0b95d99d5c5ce21a46a9a58060c527973506822e428789d842761e0280d25e3359300f017fbe77b9755bc772ab3dc2f83 languageName: node linkType: hard -"abort-controller@npm:^3.0.0": - version: 3.0.0 - resolution: "abort-controller@npm:3.0.0" +"@types/secp256k1@npm:^4.0.1": + version: 4.0.6 + resolution: "@types/secp256k1@npm:4.0.6" dependencies: - event-target-shim: ^5.0.0 - checksum: 170bdba9b47b7e65906a28c8ce4f38a7a369d78e2271706f020849c1bfe0ee2067d4261df8bbb66eb84f79208fd5b710df759d64191db58cfba7ce8ef9c54b75 + "@types/node": "*" + checksum: 984494caf49a4ce99fda2b9ea1840eb47af946b8c2737314108949bcc0c06b4880e871296bd49ed6ea4c8423e3a302ad79fec43abfc987330e7eb98f0c4e8ba4 languageName: node linkType: hard -"abstract-leveldown@npm:3.0.0": - version: 3.0.0 - resolution: "abstract-leveldown@npm:3.0.0" - dependencies: - xtend: ~4.0.0 - checksum: 1d3e65fc2288fd17955df3b0887fdd3d4fa7fcd816062014f872ea12a1e86e886151cbdc36abd2f243a810b7999252eaa30adf636ffe1be3103493ab37277e49 +"@types/seedrandom@npm:3.0.1": + version: 3.0.1 + resolution: "@types/seedrandom@npm:3.0.1" + checksum: d9755452f224a4f5072a1d8738da6c9de3039fc59a2a449b1f658e51087be7b48ada49bcabc8b0f16633c095f55598c32fcd072c448858422a2f6a0566569e4c languageName: node linkType: hard -"abstract-leveldown@npm:^2.4.1, abstract-leveldown@npm:~2.7.1": - version: 2.7.2 - resolution: "abstract-leveldown@npm:2.7.2" - dependencies: - xtend: ~4.0.0 - checksum: 97c45a05d8b5d24edf3855c1f9a19f919c4a189e387929745289a53116c80638339a7d4e50ad76d0ad2900166adaeaf2e0350dcdcd453e783cd8f04fd9bea17a +"@types/semver@npm:^7.3.12": + version: 7.7.0 + resolution: "@types/semver@npm:7.7.0" + checksum: d488eaeddb23879a0a8a759bed667e1a76cb0dd4d23e3255538e24c189db387357953ca9e7a3bda2bb7f95e84cac8fe0db4fbe6b3456e893043337732d1d23cc languageName: node linkType: hard -"abstract-leveldown@npm:^5.0.0, abstract-leveldown@npm:~5.0.0": - version: 5.0.0 - resolution: "abstract-leveldown@npm:5.0.0" +"@types/sinon-chai@npm:^3.2.12": + version: 3.2.12 + resolution: "@types/sinon-chai@npm:3.2.12" dependencies: - xtend: ~4.0.0 - checksum: d55d03cc7fad011d5fea30d26504b1a76123ec8edd3623d21f80ce0561c610b7ed1e00eb037c14746ec2b7ad8638586024f11d4a1476beee2c470c8cf27e3586 + "@types/chai": "*" + "@types/sinon": "*" + checksum: d906f2f766613534c5e9fe1437ec740fb6a9a550f02d1a0abe180c5f18fe73a99f0c12935195404d42f079f5f72a371e16b81e2aef963a6ef0ee0ed9d5d7f391 languageName: node linkType: hard -"abstract-leveldown@npm:^6.2.1": - version: 6.3.0 - resolution: "abstract-leveldown@npm:6.3.0" +"@types/sinon@npm:*": + version: 17.0.4 + resolution: "@types/sinon@npm:17.0.4" dependencies: - buffer: ^5.5.0 - immediate: ^3.2.3 - level-concat-iterator: ~2.0.0 - level-supports: ~1.0.0 - xtend: ~4.0.0 - checksum: 121a8509d8c6a540e656c2a69e5b8d853d4df71072011afefc868b98076991bb00120550e90643de9dc18889c675f62413409eeb4c8c204663124c7d215e4ec3 + "@types/sinonjs__fake-timers": "*" + checksum: 487f43bda8d8b2ef32d1b3c08e5a68e17705d2c7470ea89c8fd62e3a086f9a35faf65d37a57bf189004c4e7adbc5f9562dfaa332c54e06a8d99fc7361f3ac004 languageName: node linkType: hard -"abstract-leveldown@npm:^7.2.0": - version: 7.2.0 - resolution: "abstract-leveldown@npm:7.2.0" - dependencies: - buffer: ^6.0.3 - catering: ^2.0.0 - is-buffer: ^2.0.5 - level-concat-iterator: ^3.0.0 - level-supports: ^2.0.1 - queue-microtask: ^1.2.3 - checksum: d558111f2d123da95ac80b8ba3b9b0a5bc8cd87296e64b05dca693f5f4839aa0e2fc97bad56a101766f499824e2962611750f8a76bbac4a5db35801968fbbe02 +"@types/sinonjs__fake-timers@npm:*": + version: 8.1.5 + resolution: "@types/sinonjs__fake-timers@npm:8.1.5" + checksum: 7e3c08f6c13df44f3ea7d9a5155ddf77e3f7314c156fa1c5a829a4f3763bafe2f75b1283b887f06e6b4296996a2f299b70f64ff82625f9af5885436e2524d10c languageName: node linkType: hard -"abstract-leveldown@npm:~2.6.0": - version: 2.6.3 - resolution: "abstract-leveldown@npm:2.6.3" +"@types/ws@npm:^7.4.4": + version: 7.4.7 + resolution: "@types/ws@npm:7.4.7" dependencies: - xtend: ~4.0.0 - checksum: 87b18580467c303c34c305620e2c3227010f64187d6b1cd60c2d1b9adc058b0c4de716e111e9493aaad0080cb7836601032c5084990cd713f86b6a78f1fab791 + "@types/node": "*" + checksum: b4c9b8ad209620c9b21e78314ce4ff07515c0cadab9af101c1651e7bfb992d7fd933bd8b9c99d110738fd6db523ed15f82f29f50b45510288da72e964dedb1a3 languageName: node linkType: hard -"abstract-leveldown@npm:~6.2.1": - version: 6.2.3 - resolution: "abstract-leveldown@npm:6.2.3" - dependencies: - buffer: ^5.5.0 - immediate: ^3.2.3 - level-concat-iterator: ~2.0.0 - level-supports: ~1.0.0 - xtend: ~4.0.0 - checksum: 00202b2eb7955dd7bc04f3e44d225e60160cedb8f96fe6ae0e6dca9c356d57071f001ece8ae1d53f48095c4c036d92b3440f2bc7666730610ddea030f9fbde4a - languageName: node - linkType: hard - -"accepts@npm:~1.3.8": - version: 1.3.8 - resolution: "accepts@npm:1.3.8" +"@typescript-eslint/eslint-plugin@npm:^2.0.0": + version: 2.34.0 + resolution: "@typescript-eslint/eslint-plugin@npm:2.34.0" dependencies: - mime-types: ~2.1.34 - negotiator: 0.6.3 - checksum: 50c43d32e7b50285ebe84b613ee4a3aa426715a7d131b65b786e2ead0fd76b6b60091b9916d3478a75f11f162628a2139991b6c03ab3f1d9ab7c86075dc8eab4 - languageName: node - linkType: hard - -"acorn-jsx@npm:^5.2.0, acorn-jsx@npm:^5.3.2": - version: 5.3.2 - resolution: "acorn-jsx@npm:5.3.2" + "@typescript-eslint/experimental-utils": 2.34.0 + functional-red-black-tree: ^1.0.1 + regexpp: ^3.0.0 + tsutils: ^3.17.1 peerDependencies: - acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 - checksum: c3d3b2a89c9a056b205b69530a37b972b404ee46ec8e5b341666f9513d3163e2a4f214a71f4dfc7370f5a9c07472d2fd1c11c91c3f03d093e37637d95da98950 - languageName: node - linkType: hard - -"acorn-walk@npm:^8.1.1": - version: 8.3.3 - resolution: "acorn-walk@npm:8.3.3" - dependencies: - acorn: ^8.11.0 - checksum: 0f09d351fc30b69b2b9982bf33dc30f3d35a34e030e5f1ed3c49fc4e3814a192bf3101e4c30912a0595410f5e91bb70ddba011ea73398b3ecbfe41c7334c6dd0 - languageName: node - linkType: hard - -"acorn@npm:^7.1.1": - version: 7.4.1 - resolution: "acorn@npm:7.4.1" - bin: - acorn: bin/acorn - checksum: 1860f23c2107c910c6177b7b7be71be350db9e1080d814493fae143ae37605189504152d1ba8743ba3178d0b37269ce1ffc42b101547fdc1827078f82671e407 - languageName: node - linkType: hard - -"acorn@npm:^8.11.0, acorn@npm:^8.4.1, acorn@npm:^8.9.0": - version: 8.12.0 - resolution: "acorn@npm:8.12.0" - bin: - acorn: bin/acorn - checksum: ae142de8739ef15a5d936c550c1d267fc4dedcdbe62ad1aa2c0009afed1de84dd0a584684a5d200bb55d8db14f3e09a95c6e92a5303973c04b9a7413c36d1df0 - languageName: node - linkType: hard - -"adm-zip@npm:^0.4.16": - version: 0.4.16 - resolution: "adm-zip@npm:0.4.16" - checksum: 5ea46664d8b3b073fffeb7f934705fea288708745e708cffc1dd732ce3d2672cecd476b243f9d051892fd12952db2b6bd061975e1ff40057246f6d0cb6534a50 - languageName: node - linkType: hard - -"aes-js@npm:3.0.0": - version: 3.0.0 - resolution: "aes-js@npm:3.0.0" - checksum: 251e26d533cd1a915b44896b17d5ed68c24a02484cfdd2e74ec700a309267db96651ea4eb657bf20aac32a3baa61f6e34edf8e2fec2de440a655da9942d334b8 - languageName: node - linkType: hard - -"aes-js@npm:4.0.0-beta.5": - version: 4.0.0-beta.5 - resolution: "aes-js@npm:4.0.0-beta.5" - checksum: cc2ea969d77df939c32057f7e361b6530aa6cb93cb10617a17a45cd164e6d761002f031ff6330af3e67e58b1f0a3a8fd0b63a720afd591a653b02f649470e15b - languageName: node - linkType: hard - -"aes-js@npm:^3.1.1": - version: 3.1.2 - resolution: "aes-js@npm:3.1.2" - checksum: 062154d50b1e433cc8c3b8ca7879f3a6375d5e79c2a507b2b6c4ec920b4cd851bf2afa7f65c98761a9da89c0ab618cbe6529e8e9a1c71f93290b53128fb8f712 - languageName: node - linkType: hard - -"agent-base@npm:6": - version: 6.0.2 - resolution: "agent-base@npm:6.0.2" - dependencies: - debug: 4 - checksum: f52b6872cc96fd5f622071b71ef200e01c7c4c454ee68bc9accca90c98cfb39f2810e3e9aa330435835eedc8c23f4f8a15267f67c6e245d2b33757575bdac49d + "@typescript-eslint/parser": ^2.0.0 + eslint: ^5.0.0 || ^6.0.0 + peerDependenciesMeta: + typescript: + optional: true + checksum: 028adcb70015fec8198f801524223b3fa53d807fabd91e44e438e02df5cc4eac0ae53fcaeb8627f14a84fd72a2dcfbab561bdb8d4969cbb810849c789ae66548 languageName: node linkType: hard -"agent-base@npm:^7.0.2, agent-base@npm:^7.1.0, agent-base@npm:^7.1.1": - version: 7.1.1 - resolution: "agent-base@npm:7.1.1" +"@typescript-eslint/eslint-plugin@npm:^5.0.0": + version: 5.62.0 + resolution: "@typescript-eslint/eslint-plugin@npm:5.62.0" dependencies: + "@eslint-community/regexpp": ^4.4.0 + "@typescript-eslint/scope-manager": 5.62.0 + "@typescript-eslint/type-utils": 5.62.0 + "@typescript-eslint/utils": 5.62.0 debug: ^4.3.4 - checksum: 51c158769c5c051482f9ca2e6e1ec085ac72b5a418a9b31b4e82fe6c0a6699adb94c1c42d246699a587b3335215037091c79e0de512c516f73b6ea844202f037 - languageName: node - linkType: hard - -"aggregate-error@npm:^3.0.0": - version: 3.1.0 - resolution: "aggregate-error@npm:3.1.0" - dependencies: - clean-stack: ^2.0.0 - indent-string: ^4.0.0 - checksum: 1101a33f21baa27a2fa8e04b698271e64616b886795fd43c31068c07533c7b3facfcaf4e9e0cab3624bd88f729a592f1c901a1a229c9e490eafce411a8644b79 - languageName: node - linkType: hard - -"ajv@npm:^6.10.0, ajv@npm:^6.10.2, ajv@npm:^6.12.3, ajv@npm:^6.12.4, ajv@npm:^6.12.6": - version: 6.12.6 - resolution: "ajv@npm:6.12.6" - dependencies: - fast-deep-equal: ^3.1.1 - fast-json-stable-stringify: ^2.0.0 - json-schema-traverse: ^0.4.1 - uri-js: ^4.2.2 - checksum: 874972efe5c4202ab0a68379481fbd3d1b5d0a7bd6d3cc21d40d3536ebff3352a2a1fabb632d4fd2cc7fe4cbdcd5ed6782084c9bbf7f32a1536d18f9da5007d4 - languageName: node - linkType: hard - -"ajv@npm:^8.0.1": - version: 8.16.0 - resolution: "ajv@npm:8.16.0" - dependencies: - fast-deep-equal: ^3.1.3 - json-schema-traverse: ^1.0.0 - require-from-string: ^2.0.2 - uri-js: ^4.4.1 - checksum: bdf3d4c9f1d11e220850051ef4cd89346e951cfb933d6d41be36d45053c1092af1523ee6c62525cce567355caf0a4f4c19a08a93851649c1fa32b4a39b7c4858 - languageName: node - linkType: hard - -"amazon-cognito-identity-js@npm:^6.0.1, amazon-cognito-identity-js@npm:^6.3.6": - version: 6.3.13 - resolution: "amazon-cognito-identity-js@npm:6.3.13" - dependencies: - "@aws-crypto/sha256-js": 1.2.2 - buffer: 4.9.2 - fast-base64-decode: ^1.0.0 - isomorphic-unfetch: ^3.0.0 - js-cookie: ^2.2.1 - checksum: 8a608ef1b99fca57d87103ceb2706d38e499a548d7724f194d50a709fa564ec63dbc703ded6a106e112d5443d06859f40e242815c25c465fdee4806bbce79459 - languageName: node - linkType: hard - -"amdefine@npm:>=0.0.4": - version: 1.0.1 - resolution: "amdefine@npm:1.0.1" - checksum: 9d4e15b94641643a9385b2841b4cb2bcf4e8e2f741ea4bd475c93ad7bab261ad4ed827a32e9c549b38b98759c4526c173ae4e6dde8caeb75ee5cebedc9863762 - languageName: node - linkType: hard - -"ampleforth-contracts@https://github.com/ampleforth/ampleforth-contracts#master": - version: 0.0.1 - resolution: "ampleforth-contracts@https://github.com/ampleforth/ampleforth-contracts.git#commit=d6cbb023e670159edf85fb6386c47fd7b6b0f6e9" - dependencies: - "@openzeppelin/contracts-upgradeable": ^4.7.3 - checksum: c5d1283826fd8057d1c14ca37e83c5a918d8da2e330b5da7ebb6cd944027285f4fd01009e72bbf496769aff7303e776c81067654246a8b25c8c1b0de494efb5d - languageName: node - linkType: hard - -"ansi-align@npm:^3.0.0": - version: 3.0.1 - resolution: "ansi-align@npm:3.0.1" - dependencies: - string-width: ^4.1.0 - checksum: 6abfa08f2141d231c257162b15292467081fa49a208593e055c866aa0455b57f3a86b5a678c190c618faa79b4c59e254493099cb700dd9cf2293c6be2c8f5d8d - languageName: node - linkType: hard - -"ansi-colors@npm:4.1.1": - version: 4.1.1 - resolution: "ansi-colors@npm:4.1.1" - checksum: 138d04a51076cb085da0a7e2d000c5c0bb09f6e772ed5c65c53cb118d37f6c5f1637506d7155fb5f330f0abcf6f12fa2e489ac3f8cdab9da393bf1bb4f9a32b0 - languageName: node - linkType: hard - -"ansi-colors@npm:^3.2.1": - version: 3.2.4 - resolution: "ansi-colors@npm:3.2.4" - checksum: 026c51880e9f8eb59b112669a87dbea4469939ff94b131606303bbd697438a6691b16b9db3027aa9bf132a244214e83ab1508b998496a34d2aea5b437ac9e62d - languageName: node - linkType: hard - -"ansi-colors@npm:^4.1.1": - version: 4.1.3 - resolution: "ansi-colors@npm:4.1.3" - checksum: a9c2ec842038a1fabc7db9ece7d3177e2fe1c5dc6f0c51ecfbf5f39911427b89c00b5dc6b8bd95f82a26e9b16aaae2e83d45f060e98070ce4d1333038edceb0e - languageName: node - linkType: hard - -"ansi-escapes@npm:^4.2.1, ansi-escapes@npm:^4.3.0": - version: 4.3.2 - resolution: "ansi-escapes@npm:4.3.2" - dependencies: - type-fest: ^0.21.3 - checksum: 93111c42189c0a6bed9cdb4d7f2829548e943827ee8479c74d6e0b22ee127b2a21d3f8b5ca57723b8ef78ce011fbfc2784350eb2bde3ccfccf2f575fa8489815 - languageName: node - linkType: hard - -"ansi-regex@npm:^2.0.0": - version: 2.1.1 - resolution: "ansi-regex@npm:2.1.1" - checksum: 190abd03e4ff86794f338a31795d262c1dfe8c91f7e01d04f13f646f1dcb16c5800818f886047876f1272f065570ab86b24b99089f8b68a0e11ff19aed4ca8f1 - languageName: node - linkType: hard - -"ansi-regex@npm:^3.0.0": - version: 3.0.1 - resolution: "ansi-regex@npm:3.0.1" - checksum: 09daf180c5f59af9850c7ac1bd7fda85ba596cc8cbeb210826e90755f06c818af86d9fa1e6e8322fab2c3b9e9b03f56c537b42241139f824dd75066a1e7257cc - languageName: node - linkType: hard - -"ansi-regex@npm:^4.1.0": - version: 4.1.1 - resolution: "ansi-regex@npm:4.1.1" - checksum: b1a6ee44cb6ecdabaa770b2ed500542714d4395d71c7e5c25baa631f680fb2ad322eb9ba697548d498a6fd366949fc8b5bfcf48d49a32803611f648005b01888 - languageName: node - linkType: hard - -"ansi-regex@npm:^5.0.1": - version: 5.0.1 - resolution: "ansi-regex@npm:5.0.1" - checksum: 2aa4bb54caf2d622f1afdad09441695af2a83aa3fe8b8afa581d205e57ed4261c183c4d3877cee25794443fde5876417d859c108078ab788d6af7e4fe52eb66b - languageName: node - linkType: hard - -"ansi-regex@npm:^6.0.1": - version: 6.0.1 - resolution: "ansi-regex@npm:6.0.1" - checksum: 1ff8b7667cded1de4fa2c9ae283e979fc87036864317da86a2e546725f96406746411d0d85e87a2d12fa5abd715d90006de7fa4fa0477c92321ad3b4c7d4e169 - languageName: node - linkType: hard - -"ansi-styles@npm:^2.2.1": - version: 2.2.1 - resolution: "ansi-styles@npm:2.2.1" - checksum: ebc0e00381f2a29000d1dac8466a640ce11943cef3bda3cd0020dc042e31e1058ab59bf6169cd794a54c3a7338a61ebc404b7c91e004092dd20e028c432c9c2c - languageName: node - linkType: hard - -"ansi-styles@npm:^3.2.0, ansi-styles@npm:^3.2.1": - version: 3.2.1 - resolution: "ansi-styles@npm:3.2.1" - dependencies: - color-convert: ^1.9.0 - checksum: d85ade01c10e5dd77b6c89f34ed7531da5830d2cb5882c645f330079975b716438cd7ebb81d0d6e6b4f9c577f19ae41ab55f07f19786b02f9dfd9e0377395665 - languageName: node - linkType: hard - -"ansi-styles@npm:^4.0.0, ansi-styles@npm:^4.1.0": - version: 4.3.0 - resolution: "ansi-styles@npm:4.3.0" - dependencies: - color-convert: ^2.0.1 - checksum: 513b44c3b2105dd14cc42a19271e80f386466c4be574bccf60b627432f9198571ebf4ab1e4c3ba17347658f4ee1711c163d574248c0c1cdc2d5917a0ad582ec4 - languageName: node - linkType: hard - -"ansi-styles@npm:^6.1.0": - version: 6.2.1 - resolution: "ansi-styles@npm:6.2.1" - checksum: ef940f2f0ced1a6347398da88a91da7930c33ecac3c77b72c5905f8b8fe402c52e6fde304ff5347f616e27a742da3f1dc76de98f6866c69251ad0b07a66776d9 - languageName: node - linkType: hard - -"antlr4@npm:^4.11.0": - version: 4.13.1 - resolution: "antlr4@npm:4.13.1" - checksum: 76dcb0c8ed2d0b83a16641579668088919f51d1288551604e3cdff46c67955b3eef25892aead9de1eca203b3968536fa952e6931f35ba877780af37971c055f1 - languageName: node - linkType: hard - -"antlr4ts@npm:^0.5.0-alpha.4": - version: 0.5.0-dev - resolution: "antlr4ts@npm:0.5.0-dev" - dependencies: - source-map-support: ^0.5.16 - checksum: 640dae2229124372b0329315e9614ae983bb80b1af237d8c0b3e90a2d85fb534e851c51d65d1897c92b36d27851d041ad8d95aab44af19cf7355b3ad11a3ddbf - languageName: node - linkType: hard - -"any-signal@npm:^2.1.2": - version: 2.1.2 - resolution: "any-signal@npm:2.1.2" - dependencies: - abort-controller: ^3.0.0 - native-abort-controller: ^1.0.3 - checksum: 498603e30357f82e438ddc972086b3180ddbaf5ea9772f535d103b754711eb13d4c24577e497d5a1146e571ee38f167c316ace7dc1a03b62a8a8c7677e9d660f - languageName: node - linkType: hard - -"any-signal@npm:^3.0.0": - version: 3.0.1 - resolution: "any-signal@npm:3.0.1" - checksum: 073eb14c365b7552f9f16fbf36cd76171e4a0fe156a8faa865fe1d5ac4ed2f5c5ab6e3faad0ac0d4c69511b5892971c5573baa8a1cbf85fe250d0c54ff0734ff - languageName: node - linkType: hard - -"anymatch@npm:~3.1.2": - version: 3.1.3 - resolution: "anymatch@npm:3.1.3" - dependencies: - normalize-path: ^3.0.0 - picomatch: ^2.0.4 - checksum: 3e044fd6d1d26545f235a9fe4d7a534e2029d8e59fa7fd9f2a6eb21230f6b5380ea1eaf55136e60cbf8e613544b3b766e7a6fa2102e2a3a117505466e3025dc2 + graphemer: ^1.4.0 + ignore: ^5.2.0 + natural-compare-lite: ^1.4.0 + semver: ^7.3.7 + tsutils: ^3.21.0 + peerDependencies: + "@typescript-eslint/parser": ^5.0.0 + eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + peerDependenciesMeta: + typescript: + optional: true + checksum: fc104b389c768f9fa7d45a48c86d5c1ad522c1d0512943e782a56b1e3096b2cbcc1eea3fcc590647bf0658eef61aac35120a9c6daf979bf629ad2956deb516a1 languageName: node linkType: hard -"apisauce@npm:^2.1.5": - version: 2.1.6 - resolution: "apisauce@npm:2.1.6" +"@typescript-eslint/experimental-utils@npm:2.34.0": + version: 2.34.0 + resolution: "@typescript-eslint/experimental-utils@npm:2.34.0" dependencies: - axios: ^0.21.4 - checksum: 3db1447f03ecfa0d8fb9be0991bd4732a8eb4a5c96282c964c0b5f9d215dc1bca1e0fec7f5187080286368c1028deb0de8fb69cd7bccb92441b327aa1028598a - languageName: node - linkType: hard - -"app-module-path@npm:^2.2.0": - version: 2.2.0 - resolution: "app-module-path@npm:2.2.0" - checksum: b52aa49cfa809efbad41b514222e8ef3f8ee9e147f5eccf79280b45eddcc61f7aeb302b0049474e3f42072dd53a28348c57dd96f36cd461d2e31cc8ab1ef56b5 - languageName: node - linkType: hard - -"arg@npm:^4.1.0": - version: 4.1.3 - resolution: "arg@npm:4.1.3" - checksum: 544af8dd3f60546d3e4aff084d451b96961d2267d668670199692f8d054f0415d86fc5497d0e641e91546f0aa920e7c29e5250e99fc89f5552a34b5d93b77f43 + "@types/json-schema": ^7.0.3 + "@typescript-eslint/typescript-estree": 2.34.0 + eslint-scope: ^5.0.0 + eslint-utils: ^2.0.0 + peerDependencies: + eslint: "*" + checksum: 3d267185a727dad276921d4b7b9d95247ffc50740f944c8f3f66ae1556b9f3529632bff4e921a9bfe0d0b0c55542ff2ff6479615a4f4a01645e49893f32b6350 languageName: node linkType: hard -"argparse@npm:^1.0.7": - version: 1.0.10 - resolution: "argparse@npm:1.0.10" +"@typescript-eslint/parser@npm:^2.0.0": + version: 2.34.0 + resolution: "@typescript-eslint/parser@npm:2.34.0" dependencies: - sprintf-js: ~1.0.2 - checksum: 7ca6e45583a28de7258e39e13d81e925cfa25d7d4aacbf806a382d3c02fcb13403a07fb8aeef949f10a7cfe4a62da0e2e807b348a5980554cc28ee573ef95945 - languageName: node - linkType: hard - -"argparse@npm:^2.0.1": - version: 2.0.1 - resolution: "argparse@npm:2.0.1" - checksum: 83644b56493e89a254bae05702abf3a1101b4fa4d0ca31df1c9985275a5a5bd47b3c27b7fa0b71098d41114d8ca000e6ed90cad764b306f8a503665e4d517ced - languageName: node - linkType: hard - -"arr-diff@npm:^4.0.0": - version: 4.0.0 - resolution: "arr-diff@npm:4.0.0" - checksum: ea7c8834842ad3869297f7915689bef3494fd5b102ac678c13ffccab672d3d1f35802b79e90c4cfec2f424af3392e44112d1ccf65da34562ed75e049597276a0 - languageName: node - linkType: hard - -"arr-flatten@npm:^1.1.0": - version: 1.1.0 - resolution: "arr-flatten@npm:1.1.0" - checksum: 963fe12564fca2f72c055f3f6c206b9e031f7c433a0c66ca9858b484821f248c5b1e5d53c8e4989d80d764cd776cf6d9b160ad05f47bdc63022bfd63b5455e22 - languageName: node - linkType: hard - -"arr-union@npm:^3.1.0": - version: 3.1.0 - resolution: "arr-union@npm:3.1.0" - checksum: b5b0408c6eb7591143c394f3be082fee690ddd21f0fdde0a0a01106799e847f67fcae1b7e56b0a0c173290e29c6aca9562e82b300708a268bc8f88f3d6613cb9 + "@types/eslint-visitor-keys": ^1.0.0 + "@typescript-eslint/experimental-utils": 2.34.0 + "@typescript-eslint/typescript-estree": 2.34.0 + eslint-visitor-keys: ^1.1.0 + peerDependencies: + eslint: ^5.0.0 || ^6.0.0 + peerDependenciesMeta: + typescript: + optional: true + checksum: 2cd9890760bc1be48102e8cc2404b2c9323f049990de07b356d9f97b9d29b3cf905ef06b69eea8e0834b67eb54e1f58dcc67e20edd8c98f10cd11b8732fb6894 languageName: node linkType: hard -"array-back@npm:^1.0.3, array-back@npm:^1.0.4": - version: 1.0.4 - resolution: "array-back@npm:1.0.4" +"@typescript-eslint/parser@npm:^5.0.0": + version: 5.62.0 + resolution: "@typescript-eslint/parser@npm:5.62.0" dependencies: - typical: ^2.6.0 - checksum: 37a8be4cd4920b3d07bdbef40dae83bb37948f5d49601da98a6e48ba5496e9a0008e7f3f2184bcf4d3501bd371a048c9bdca7dc3cc5c3d5b1eb189bbba7b55db + "@typescript-eslint/scope-manager": 5.62.0 + "@typescript-eslint/types": 5.62.0 + "@typescript-eslint/typescript-estree": 5.62.0 + debug: ^4.3.4 + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + peerDependenciesMeta: + typescript: + optional: true + checksum: d168f4c7f21a7a63f47002e2d319bcbb6173597af5c60c1cf2de046b46c76b4930a093619e69faf2d30214c29ab27b54dcf1efc7046a6a6bd6f37f59a990e752 languageName: node linkType: hard -"array-back@npm:^2.0.0": - version: 2.0.0 - resolution: "array-back@npm:2.0.0" +"@typescript-eslint/scope-manager@npm:5.62.0": + version: 5.62.0 + resolution: "@typescript-eslint/scope-manager@npm:5.62.0" dependencies: - typical: ^2.6.1 - checksum: ab36ab3504b25116b47541fb0ac78ff13d1e991f33d98c361edd3aada3ed818a900b619bd67b195dd4e41b9256c27e8cdd6a69ece507e482f1207d07670ed6bd - languageName: node - linkType: hard - -"array-back@npm:^3.0.1, array-back@npm:^3.1.0": - version: 3.1.0 - resolution: "array-back@npm:3.1.0" - checksum: 7205004fcd0f9edd926db921af901b083094608d5b265738d0290092f9822f73accb468e677db74c7c94ef432d39e5ed75a7b1786701e182efb25bbba9734209 - languageName: node - linkType: hard - -"array-back@npm:^4.0.1, array-back@npm:^4.0.2": - version: 4.0.2 - resolution: "array-back@npm:4.0.2" - checksum: f30603270771eeb54e5aad5f54604c62b3577a18b6db212a7272b2b6c32049121b49431f656654790ed1469411e45f387e7627c0de8fd0515995cc40df9b9294 + "@typescript-eslint/types": 5.62.0 + "@typescript-eslint/visitor-keys": 5.62.0 + checksum: 6062d6b797fe1ce4d275bb0d17204c827494af59b5eaf09d8a78cdd39dadddb31074dded4297aaf5d0f839016d601032857698b0e4516c86a41207de606e9573 languageName: node linkType: hard -"array-buffer-byte-length@npm:^1.0.1": - version: 1.0.1 - resolution: "array-buffer-byte-length@npm:1.0.1" +"@typescript-eslint/type-utils@npm:5.62.0": + version: 5.62.0 + resolution: "@typescript-eslint/type-utils@npm:5.62.0" dependencies: - call-bind: ^1.0.5 - is-array-buffer: ^3.0.4 - checksum: 53524e08f40867f6a9f35318fafe467c32e45e9c682ba67b11943e167344d2febc0f6977a17e699b05699e805c3e8f073d876f8bbf1b559ed494ad2cd0fae09e + "@typescript-eslint/typescript-estree": 5.62.0 + "@typescript-eslint/utils": 5.62.0 + debug: ^4.3.4 + tsutils: ^3.21.0 + peerDependencies: + eslint: "*" + peerDependenciesMeta: + typescript: + optional: true + checksum: fc41eece5f315dfda14320be0da78d3a971d650ea41300be7196934b9715f3fe1120a80207551eb71d39568275dbbcf359bde540d1ca1439d8be15e9885d2739 languageName: node linkType: hard -"array-flatten@npm:1.1.1": - version: 1.1.1 - resolution: "array-flatten@npm:1.1.1" - checksum: a9925bf3512d9dce202112965de90c222cd59a4fbfce68a0951d25d965cf44642931f40aac72309c41f12df19afa010ecadceb07cfff9ccc1621e99d89ab5f3b +"@typescript-eslint/types@npm:5.62.0": + version: 5.62.0 + resolution: "@typescript-eslint/types@npm:5.62.0" + checksum: 48c87117383d1864766486f24de34086155532b070f6264e09d0e6139449270f8a9559cfef3c56d16e3bcfb52d83d42105d61b36743626399c7c2b5e0ac3b670 languageName: node linkType: hard -"array-includes@npm:^3.1.7": - version: 3.1.8 - resolution: "array-includes@npm:3.1.8" +"@typescript-eslint/typescript-estree@npm:2.34.0": + version: 2.34.0 + resolution: "@typescript-eslint/typescript-estree@npm:2.34.0" dependencies: - call-bind: ^1.0.7 - define-properties: ^1.2.1 - es-abstract: ^1.23.2 - es-object-atoms: ^1.0.0 - get-intrinsic: ^1.2.4 - is-string: ^1.0.7 - checksum: eb39ba5530f64e4d8acab39297c11c1c5be2a4ea188ab2b34aba5fb7224d918f77717a9d57a3e2900caaa8440e59431bdaf5c974d5212ef65d97f132e38e2d91 - languageName: node - linkType: hard - -"array-union@npm:^2.1.0": - version: 2.1.0 - resolution: "array-union@npm:2.1.0" - checksum: 5bee12395cba82da674931df6d0fea23c4aa4660cb3b338ced9f828782a65caa232573e6bf3968f23e0c5eb301764a382cef2f128b170a9dc59de0e36c39f98d + debug: ^4.1.1 + eslint-visitor-keys: ^1.1.0 + glob: ^7.1.6 + is-glob: ^4.0.1 + lodash: ^4.17.15 + semver: ^7.3.2 + tsutils: ^3.17.1 + peerDependenciesMeta: + typescript: + optional: true + checksum: 6eb689513765350daaf0ba12ef204061e12a8add557b4eafcc63fb0ab9345eee6ca68e64e4b88625a2b844802cfc44cbad47468840cfc990a40d27457ec75390 languageName: node linkType: hard -"array-uniq@npm:1.0.3": - version: 1.0.3 - resolution: "array-uniq@npm:1.0.3" - checksum: 1625f06b093d8bf279b81adfec6e72951c0857d65b5e3f65f053fffe9f9dd61c2fc52cff57e38a4700817e7e3f01a4faa433d505ea9e33cdae4514c334e0bf9e +"@typescript-eslint/typescript-estree@npm:5.62.0": + version: 5.62.0 + resolution: "@typescript-eslint/typescript-estree@npm:5.62.0" + dependencies: + "@typescript-eslint/types": 5.62.0 + "@typescript-eslint/visitor-keys": 5.62.0 + debug: ^4.3.4 + globby: ^11.1.0 + is-glob: ^4.0.3 + semver: ^7.3.7 + tsutils: ^3.21.0 + peerDependenciesMeta: + typescript: + optional: true + checksum: 3624520abb5807ed8f57b1197e61c7b1ed770c56dfcaca66372d584ff50175225798bccb701f7ef129d62c5989070e1ee3a0aa2d84e56d9524dcf011a2bb1a52 languageName: node linkType: hard -"array-unique@npm:^0.3.2": - version: 0.3.2 - resolution: "array-unique@npm:0.3.2" - checksum: da344b89cfa6b0a5c221f965c21638bfb76b57b45184a01135382186924f55973cd9b171d4dad6bf606c6d9d36b0d721d091afdc9791535ead97ccbe78f8a888 +"@typescript-eslint/utils@npm:5.62.0": + version: 5.62.0 + resolution: "@typescript-eslint/utils@npm:5.62.0" + dependencies: + "@eslint-community/eslint-utils": ^4.2.0 + "@types/json-schema": ^7.0.9 + "@types/semver": ^7.3.12 + "@typescript-eslint/scope-manager": 5.62.0 + "@typescript-eslint/types": 5.62.0 + "@typescript-eslint/typescript-estree": 5.62.0 + eslint-scope: ^5.1.1 + semver: ^7.3.7 + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + checksum: ee9398c8c5db6d1da09463ca7bf36ed134361e20131ea354b2da16a5fdb6df9ba70c62a388d19f6eebb421af1786dbbd79ba95ddd6ab287324fc171c3e28d931 languageName: node linkType: hard -"array.prototype.findlast@npm:^1.2.2": - version: 1.2.5 - resolution: "array.prototype.findlast@npm:1.2.5" +"@typescript-eslint/visitor-keys@npm:5.62.0": + version: 5.62.0 + resolution: "@typescript-eslint/visitor-keys@npm:5.62.0" dependencies: - call-bind: ^1.0.7 - define-properties: ^1.2.1 - es-abstract: ^1.23.2 - es-errors: ^1.3.0 - es-object-atoms: ^1.0.0 - es-shim-unscopables: ^1.0.2 - checksum: 83ce4ad95bae07f136d316f5a7c3a5b911ac3296c3476abe60225bc4a17938bf37541972fcc37dd5adbc99cbb9c928c70bbbfc1c1ce549d41a415144030bb446 + "@typescript-eslint/types": 5.62.0 + eslint-visitor-keys: ^3.3.0 + checksum: 976b05d103fe8335bef5c93ad3f76d781e3ce50329c0243ee0f00c0fcfb186c81df50e64bfdd34970148113f8ade90887f53e3c4938183afba830b4ba8e30a35 languageName: node linkType: hard -"array.prototype.findlastindex@npm:^1.2.3": - version: 1.2.5 - resolution: "array.prototype.findlastindex@npm:1.2.5" - dependencies: - call-bind: ^1.0.7 - define-properties: ^1.2.1 - es-abstract: ^1.23.2 - es-errors: ^1.3.0 - es-object-atoms: ^1.0.0 - es-shim-unscopables: ^1.0.2 - checksum: 2c81cff2a75deb95bf1ed89b6f5f2bfbfb882211e3b7cc59c3d6b87df774cd9d6b36949a8ae39ac476e092c1d4a4905f5ee11a86a456abb10f35f8211ae4e710 +"@ungap/structured-clone@npm:^1.2.0": + version: 1.3.0 + resolution: "@ungap/structured-clone@npm:1.3.0" + checksum: 64ed518f49c2b31f5b50f8570a1e37bde3b62f2460042c50f132430b2d869c4a6586f13aa33a58a4722715b8158c68cae2827389d6752ac54da2893c83e480fc languageName: node linkType: hard -"array.prototype.flat@npm:^1.3.2": - version: 1.3.2 - resolution: "array.prototype.flat@npm:1.3.2" - dependencies: - call-bind: ^1.0.2 - define-properties: ^1.2.0 - es-abstract: ^1.22.1 - es-shim-unscopables: ^1.0.0 - checksum: 5d6b4bf102065fb3f43764bfff6feb3295d372ce89591e6005df3d0ce388527a9f03c909af6f2a973969a4d178ab232ffc9236654149173e0e187ec3a1a6b87b +"@uniswap/lib@npm:1.1.1": + version: 1.1.1 + resolution: "@uniswap/lib@npm:1.1.1" + checksum: 2ec6689f606a0cf7dc7acd8b7471997638b2c89202c52743dcb4dfc0df182f6e058ec1a5e4d94a872c81bb85cbcde9e4a46b6de45eea0d34582627d97e743c7b languageName: node linkType: hard -"array.prototype.flatmap@npm:^1.3.2": - version: 1.3.2 - resolution: "array.prototype.flatmap@npm:1.3.2" - dependencies: - call-bind: ^1.0.2 - define-properties: ^1.2.0 - es-abstract: ^1.22.1 - es-shim-unscopables: ^1.0.0 - checksum: ce09fe21dc0bcd4f30271f8144083aa8c13d4639074d6c8dc82054b847c7fc9a0c97f857491f4da19d4003e507172a78f4bcd12903098adac8b9cd374f734be3 +"@uniswap/lib@npm:^4.0.1-alpha": + version: 4.0.1-alpha + resolution: "@uniswap/lib@npm:4.0.1-alpha" + checksum: d7bbacccef40966af16c7e215ab085f575686d316b2802c9e1cfd03f7ad351970e547535670a28b2279c3cfcc4fb02888614c46f94efe2987af2309f3ec86127 languageName: node linkType: hard -"array.prototype.reduce@npm:^1.0.6": - version: 1.0.7 - resolution: "array.prototype.reduce@npm:1.0.7" - dependencies: - call-bind: ^1.0.7 - define-properties: ^1.2.1 - es-abstract: ^1.23.2 - es-array-method-boxes-properly: ^1.0.0 - es-errors: ^1.3.0 - es-object-atoms: ^1.0.0 - is-string: ^1.0.7 - checksum: 90303617bd70c8e9a81ebff041d3e10fad1a97f163699cb015b7c84a3f9e6960d9bb161a30f1d0309d6e476f166af5668c1e24f7add3202213d25f7c7f15475d +"@uniswap/v2-core@npm:1.0.0": + version: 1.0.0 + resolution: "@uniswap/v2-core@npm:1.0.0" + checksum: 41e42ad801dbc058ebf0ab38a8ce3195990e21eff4b2d49cd0a8c8fd25ac067feed55c379f2be22d915a7601d94966ae66127b748b2d3acde20eeb2351e51703 languageName: node linkType: hard -"arraybuffer.prototype.slice@npm:^1.0.3": - version: 1.0.3 - resolution: "arraybuffer.prototype.slice@npm:1.0.3" - dependencies: - array-buffer-byte-length: ^1.0.1 - call-bind: ^1.0.5 - define-properties: ^1.2.1 - es-abstract: ^1.22.3 - es-errors: ^1.2.1 - get-intrinsic: ^1.2.3 - is-array-buffer: ^3.0.4 - is-shared-array-buffer: ^1.0.2 - checksum: 352259cba534dcdd969c92ab002efd2ba5025b2e3b9bead3973150edbdf0696c629d7f4b3f061c5931511e8207bdc2306da614703c820b45dabce39e3daf7e3e +"@uniswap/v2-core@npm:^1.0.1": + version: 1.0.1 + resolution: "@uniswap/v2-core@npm:1.0.1" + checksum: eaa118fe45eac2e80b7468547ce2cde12bd3c8157555d2e40e0462a788c9506c6295247b511382da85e44a89ad92aff7bb3433b23bfbd2eeea23942ecd46e979 languageName: node linkType: hard -"asap@npm:~2.0.6": - version: 2.0.6 - resolution: "asap@npm:2.0.6" - checksum: b296c92c4b969e973260e47523207cd5769abd27c245a68c26dc7a0fe8053c55bb04360237cb51cab1df52be939da77150ace99ad331fb7fb13b3423ed73ff3d +"@uniswap/v2-periphery@npm:^1.1.0-beta.0": + version: 1.1.0-beta.0 + resolution: "@uniswap/v2-periphery@npm:1.1.0-beta.0" + dependencies: + "@uniswap/lib": 1.1.1 + "@uniswap/v2-core": 1.0.0 + checksum: af13224c9f28f817be6e5794a7590b8433788e5387912343a8d61227a42b494b431fe6e549505e87d96a6896e96e289f80d92c68788eea4917596ec7fd94734e languageName: node linkType: hard -"asn1.js@npm:^4.10.1": - version: 4.10.1 - resolution: "asn1.js@npm:4.10.1" - dependencies: - bn.js: ^4.0.0 - inherits: ^2.0.1 - minimalistic-assert: ^1.0.0 - checksum: 9289a1a55401238755e3142511d7b8f6fc32f08c86ff68bd7100da8b6c186179dd6b14234fba2f7f6099afcd6758a816708485efe44bc5b2a6ec87d9ceeddbb5 +"@uniswap/v3-core@npm:^1.0.0, @uniswap/v3-core@npm:^1.0.1": + version: 1.0.1 + resolution: "@uniswap/v3-core@npm:1.0.1" + checksum: 4bfd8b218391a3d9efde44e0f984cfec3bc25889cd4d1386766828521006e71b210a3583ee32b52f3c81d384af9e8c39f471f2229e9af4d50da6801446ecb3e4 languageName: node linkType: hard -"asn1@npm:~0.2.3": - version: 0.2.6 - resolution: "asn1@npm:0.2.6" +"@uniswap/v3-periphery@npm:^1.1.0": + version: 1.4.4 + resolution: "@uniswap/v3-periphery@npm:1.4.4" dependencies: - safer-buffer: ~2.1.0 - checksum: 39f2ae343b03c15ad4f238ba561e626602a3de8d94ae536c46a4a93e69578826305366dc09fbb9b56aec39b4982a463682f259c38e59f6fa380cd72cd61e493d + "@openzeppelin/contracts": 3.4.2-solc-0.7 + "@uniswap/lib": ^4.0.1-alpha + "@uniswap/v2-core": ^1.0.1 + "@uniswap/v3-core": ^1.0.0 + base64-sol: 1.0.1 + checksum: 48b57f1f648cb002935421ac1770666ab3c0263885a03c769985b06501b88d513a435c8edc439b41ac5aef7ad40a11038a3561f7e828cce5ae6ec2c77742f1af languageName: node linkType: hard -"assemblyscript@git+https://github.com/AssemblyScript/assemblyscript.git#v0.6": - version: 0.6.0 - resolution: "assemblyscript@https://github.com/AssemblyScript/assemblyscript.git#commit=3ed76a97f05335504166fce1653da75f4face28f" +"JSONStream@npm:1.3.2": + version: 1.3.2 + resolution: "JSONStream@npm:1.3.2" dependencies: - "@protobufjs/utf8": ^1.1.0 - binaryen: 77.0.0-nightly.20190407 - glob: ^7.1.3 - long: ^4.0.0 - opencollective-postinstall: ^2.0.0 - source-map-support: ^0.5.11 + jsonparse: ^1.2.0 + through: ">=2.2.7 <3" bin: - asc: bin/asc - asinit: bin/asinit - checksum: 08fde3fd50e3c67c2e057c83963f65f9f4a710380b6040727fd87b3a162795c498de603a3bc68ceb1da7ec4b5e31e9d61ec6ea961a0ba228b91584f18c197e98 + JSONStream: ./bin.js + checksum: d83b86f846eaeba7b947181245b977bb7e32c49e25d210234ecbf6b2d9128924610224e150558deeb65d063b07b8c28e5a1a4ab8daeb89d4c34e718047f046fd languageName: node linkType: hard -"assert-plus@npm:1.0.0, assert-plus@npm:^1.0.0": - version: 1.0.0 - resolution: "assert-plus@npm:1.0.0" - checksum: 19b4340cb8f0e6a981c07225eacac0e9d52c2644c080198765d63398f0075f83bbc0c8e95474d54224e297555ad0d631c1dcd058adb1ddc2437b41a6b424ac64 +"JSONStream@npm:^1.3.5": + version: 1.3.5 + resolution: "JSONStream@npm:1.3.5" + dependencies: + jsonparse: ^1.2.0 + through: ">=2.2.7 <3" + bin: + JSONStream: ./bin.js + checksum: 2605fa124260c61bad38bb65eba30d2f72216a78e94d0ab19b11b4e0327d572b8d530c0c9cc3b0764f727ad26d39e00bf7ebad57781ca6368394d73169c59e46 languageName: node linkType: hard -"assertion-error@npm:^1.1.0": - version: 1.1.0 - resolution: "assertion-error@npm:1.1.0" - checksum: fd9429d3a3d4fd61782eb3962ae76b6d08aa7383123fca0596020013b3ebd6647891a85b05ce821c47d1471ed1271f00b0545cf6a4326cf2fc91efcc3b0fbecf +"abbrev@npm:1": + version: 1.1.1 + resolution: "abbrev@npm:1.1.1" + checksum: a4a97ec07d7ea112c517036882b2ac22f3109b7b19077dc656316d07d308438aac28e4d9746dc4d84bf6b1e75b4a7b0a5f3cb30592419f128ca9a8cee3bcfa17 languageName: node linkType: hard -"assign-symbols@npm:^1.0.0": - version: 1.0.0 - resolution: "assign-symbols@npm:1.0.0" - checksum: c0eb895911d05b6b2d245154f70461c5e42c107457972e5ebba38d48967870dee53bcdf6c7047990586daa80fab8dab3cc6300800fbd47b454247fdedd859a2c +"abbrev@npm:1.0.x": + version: 1.0.9 + resolution: "abbrev@npm:1.0.9" + checksum: 46460c897b4ce62cd9b1bd4a853cc46e771a1f1d929f5443f3945a976f8be5388891bf9e5f8a9862baa29587349e16c48596b6a621404d46d3b184fe9bd9fb26 languageName: node linkType: hard -"ast-parents@npm:^0.0.1": - version: 0.0.1 - resolution: "ast-parents@npm:0.0.1" - checksum: 51360afb9f7b939eb0330fdd0d5d855d0242f273f63478d30d9053069120492173719fb3c03ba372bccf1a7c1a9041c3c6bf2ab700de8c0f8c14792b045c3b23 +"abbrev@npm:^3.0.0": + version: 3.0.1 + resolution: "abbrev@npm:3.0.1" + checksum: e70b209f5f408dd3a3bbd0eec4b10a2ffd64704a4a3821d0969d84928cc490a8eb60f85b78a95622c1841113edac10161c62e52f5e7d0027aa26786a8136e02e languageName: node linkType: hard -"astral-regex@npm:^1.0.0": - version: 1.0.0 - resolution: "astral-regex@npm:1.0.0" - checksum: 93417fc0879531cd95ace2560a54df865c9461a3ac0714c60cbbaa5f1f85d2bee85489e78d82f70b911b71ac25c5f05fc5a36017f44c9bb33c701bee229ff848 +"abitype@npm:1.0.8, abitype@npm:^1.0.6": + version: 1.0.8 + resolution: "abitype@npm:1.0.8" + peerDependencies: + typescript: ">=5.0.4" + zod: ^3 >=3.22.0 + peerDependenciesMeta: + typescript: + optional: true + zod: + optional: true + checksum: 104bc2f6820ced8d2cb61521916f7f22c0981a846216f5b6144f69461265f7da137a4ae108bf4b84cd8743f2dd1e9fdadffc0f95371528e15a59e0a369e08438 languageName: node linkType: hard -"astral-regex@npm:^2.0.0": - version: 2.0.0 - resolution: "astral-regex@npm:2.0.0" - checksum: 876231688c66400473ba505731df37ea436e574dd524520294cc3bbc54ea40334865e01fa0d074d74d036ee874ee7e62f486ea38bc421ee8e6a871c06f011766 +"abort-controller@npm:^3.0.0": + version: 3.0.0 + resolution: "abort-controller@npm:3.0.0" + dependencies: + event-target-shim: ^5.0.0 + checksum: 170bdba9b47b7e65906a28c8ce4f38a7a369d78e2271706f020849c1bfe0ee2067d4261df8bbb66eb84f79208fd5b710df759d64191db58cfba7ce8ef9c54b75 languageName: node linkType: hard -"async-eventemitter@npm:^0.2.2, async-eventemitter@npm:^0.2.4": - version: 0.2.4 - resolution: "async-eventemitter@npm:0.2.4" +"abstract-leveldown@npm:^6.2.1": + version: 6.3.0 + resolution: "abstract-leveldown@npm:6.3.0" dependencies: - async: ^2.4.0 - checksum: b9e77e0f58ebd7188c50c23d613d1263e0ab501f5e677e02b57cc97d7032beaf60aafa189887e7105569c791e212df4af00b608be1e9a4c425911d577124911e + buffer: ^5.5.0 + immediate: ^3.2.3 + level-concat-iterator: ~2.0.0 + level-supports: ~1.0.0 + xtend: ~4.0.0 + checksum: 121a8509d8c6a540e656c2a69e5b8d853d4df71072011afefc868b98076991bb00120550e90643de9dc18889c675f62413409eeb4c8c204663124c7d215e4ec3 languageName: node linkType: hard -"async-limiter@npm:~1.0.0": - version: 1.0.1 - resolution: "async-limiter@npm:1.0.1" - checksum: 2b849695b465d93ad44c116220dee29a5aeb63adac16c1088983c339b0de57d76e82533e8e364a93a9f997f28bbfc6a92948cefc120652bd07f3b59f8d75cf2b +"abstract-leveldown@npm:^7.2.0": + version: 7.2.0 + resolution: "abstract-leveldown@npm:7.2.0" + dependencies: + buffer: ^6.0.3 + catering: ^2.0.0 + is-buffer: ^2.0.5 + level-concat-iterator: ^3.0.0 + level-supports: ^2.0.1 + queue-microtask: ^1.2.3 + checksum: d558111f2d123da95ac80b8ba3b9b0a5bc8cd87296e64b05dca693f5f4839aa0e2fc97bad56a101766f499824e2962611750f8a76bbac4a5db35801968fbbe02 languageName: node linkType: hard -"async-retry@npm:^1.3.3": - version: 1.3.3 - resolution: "async-retry@npm:1.3.3" +"abstract-leveldown@npm:~6.2.1": + version: 6.2.3 + resolution: "abstract-leveldown@npm:6.2.3" dependencies: - retry: 0.13.1 - checksum: 38a7152ff7265a9321ea214b9c69e8224ab1febbdec98efbbde6e562f17ff68405569b796b1c5271f354aef8783665d29953f051f68c1fc45306e61aec82fdc4 + buffer: ^5.5.0 + immediate: ^3.2.3 + level-concat-iterator: ~2.0.0 + level-supports: ~1.0.0 + xtend: ~4.0.0 + checksum: 00202b2eb7955dd7bc04f3e44d225e60160cedb8f96fe6ae0e6dca9c356d57071f001ece8ae1d53f48095c4c036d92b3440f2bc7666730610ddea030f9fbde4a languageName: node linkType: hard -"async@npm:1.x, async@npm:^1.4.2": - version: 1.5.2 - resolution: "async@npm:1.5.2" - checksum: fe5d6214d8f15bd51eee5ae8ec5079b228b86d2d595f47b16369dec2e11b3ff75a567bb5f70d12d79006665fbbb7ee0a7ec0e388524eefd454ecbe651c124ebd +"acorn-jsx@npm:^5.2.0, acorn-jsx@npm:^5.3.2": + version: 5.3.2 + resolution: "acorn-jsx@npm:5.3.2" + peerDependencies: + acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 + checksum: c3d3b2a89c9a056b205b69530a37b972b404ee46ec8e5b341666f9513d3163e2a4f214a71f4dfc7370f5a9c07472d2fd1c11c91c3f03d093e37637d95da98950 languageName: node linkType: hard -"async@npm:2.6.2": - version: 2.6.2 - resolution: "async@npm:2.6.2" +"acorn-walk@npm:^8.1.1": + version: 8.3.4 + resolution: "acorn-walk@npm:8.3.4" dependencies: - lodash: ^4.17.11 - checksum: e5e90a3bcc4d9bf964bfc6b77d63b8f5bee8c14e9a51c3317dbcace44d5b6b1fe01cd4fd347449704a107da7fcd25e1382ee8545957b2702782ae720605cf7a4 + acorn: ^8.11.0 + checksum: 4ff03f42323e7cf90f1683e08606b0f460e1e6ac263d2730e3df91c7665b6f64e696db6ea27ee4bed18c2599569be61f28a8399fa170c611161a348c402ca19c languageName: node linkType: hard -"async@npm:^2.0.1, async@npm:^2.1.2, async@npm:^2.4.0, async@npm:^2.5.0, async@npm:^2.6.1": - version: 2.6.4 - resolution: "async@npm:2.6.4" - dependencies: - lodash: ^4.17.14 - checksum: a52083fb32e1ebe1d63e5c5624038bb30be68ff07a6c8d7dfe35e47c93fc144bd8652cbec869e0ac07d57dde387aa5f1386be3559cdee799cb1f789678d88e19 +"acorn@npm:^7.1.1": + version: 7.4.1 + resolution: "acorn@npm:7.4.1" + bin: + acorn: bin/acorn + checksum: 1860f23c2107c910c6177b7b7be71be350db9e1080d814493fae143ae37605189504152d1ba8743ba3178d0b37269ce1ffc42b101547fdc1827078f82671e407 languageName: node linkType: hard -"asynckit@npm:^0.4.0": - version: 0.4.0 - resolution: "asynckit@npm:0.4.0" - checksum: 7b78c451df768adba04e2d02e63e2d0bf3b07adcd6e42b4cf665cb7ce899bedd344c69a1dcbce355b5f972d597b25aaa1c1742b52cffd9caccb22f348114f6be +"acorn@npm:^8.11.0, acorn@npm:^8.4.1, acorn@npm:^8.9.0": + version: 8.14.1 + resolution: "acorn@npm:8.14.1" + bin: + acorn: bin/acorn + checksum: 260d9bb6017a1b6e42d31364687f0258f78eb20210b36ef2baad38fd619d78d4e95ff7dde9b3dbe0d81f137f79a8d651a845363a26e6985997f7b71145dc5e94 languageName: node linkType: hard -"at-least-node@npm:^1.0.0": - version: 1.0.0 - resolution: "at-least-node@npm:1.0.0" - checksum: 463e2f8e43384f1afb54bc68485c436d7622acec08b6fad269b421cb1d29cebb5af751426793d0961ed243146fe4dc983402f6d5a51b720b277818dbf6f2e49e +"adm-zip@npm:^0.4.16": + version: 0.4.16 + resolution: "adm-zip@npm:0.4.16" + checksum: 5ea46664d8b3b073fffeb7f934705fea288708745e708cffc1dd732ce3d2672cecd476b243f9d051892fd12952db2b6bd061975e1ff40057246f6d0cb6534a50 languageName: node linkType: hard -"atob@npm:^2.1.2": - version: 2.1.2 - resolution: "atob@npm:2.1.2" - bin: - atob: bin/atob.js - checksum: dfeeeb70090c5ebea7be4b9f787f866686c645d9f39a0d184c817252d0cf08455ed25267d79c03254d3be1f03ac399992a792edcd5ffb9c91e097ab5ef42833a +"aes-js@npm:3.0.0": + version: 3.0.0 + resolution: "aes-js@npm:3.0.0" + checksum: 251e26d533cd1a915b44896b17d5ed68c24a02484cfdd2e74ec700a309267db96651ea4eb657bf20aac32a3baa61f6e34edf8e2fec2de440a655da9942d334b8 languageName: node linkType: hard -"available-typed-arrays@npm:^1.0.7": - version: 1.0.7 - resolution: "available-typed-arrays@npm:1.0.7" - dependencies: - possible-typed-array-names: ^1.0.0 - checksum: 1aa3ffbfe6578276996de660848b6e95669d9a95ad149e3dd0c0cda77db6ee1dbd9d1dd723b65b6d277b882dd0c4b91a654ae9d3cf9e1254b7e93e4908d78fd3 +"aes-js@npm:4.0.0-beta.5": + version: 4.0.0-beta.5 + resolution: "aes-js@npm:4.0.0-beta.5" + checksum: cc2ea969d77df939c32057f7e361b6530aa6cb93cb10617a17a45cd164e6d761002f031ff6330af3e67e58b1f0a3a8fd0b63a720afd591a653b02f649470e15b languageName: node linkType: hard -"aws-sign2@npm:~0.7.0": - version: 0.7.0 - resolution: "aws-sign2@npm:0.7.0" - checksum: b148b0bb0778098ad8cf7e5fc619768bcb51236707ca1d3e5b49e41b171166d8be9fdc2ea2ae43d7decf02989d0aaa3a9c4caa6f320af95d684de9b548a71525 +"agent-base@npm:6": + version: 6.0.2 + resolution: "agent-base@npm:6.0.2" + dependencies: + debug: 4 + checksum: f52b6872cc96fd5f622071b71ef200e01c7c4c454ee68bc9accca90c98cfb39f2810e3e9aa330435835eedc8c23f4f8a15267f67c6e245d2b33757575bdac49d languageName: node linkType: hard -"aws4@npm:^1.8.0": - version: 1.13.0 - resolution: "aws4@npm:1.13.0" - checksum: 71594a17a5f7b1a9151ef515500c18f1029caa51e2cb65c1b5b324d9bd8dac89896a9e296825d4e6befdcd612d7fc3b0d8042c667555a56df3ee1ab15d4d9b35 +"agent-base@npm:^7.1.0, agent-base@npm:^7.1.2": + version: 7.1.3 + resolution: "agent-base@npm:7.1.3" + checksum: 87bb7ee54f5ecf0ccbfcba0b07473885c43ecd76cb29a8db17d6137a19d9f9cd443a2a7c5fd8a3f24d58ad8145f9eb49116344a66b107e1aeab82cf2383f4753 languageName: node linkType: hard -"axios@npm:^0.21.2, axios@npm:^0.21.4": - version: 0.21.4 - resolution: "axios@npm:0.21.4" +"aggregate-error@npm:^3.0.0": + version: 3.1.0 + resolution: "aggregate-error@npm:3.1.0" dependencies: - follow-redirects: ^1.14.0 - checksum: 44245f24ac971e7458f3120c92f9d66d1fc695e8b97019139de5b0cc65d9b8104647db01e5f46917728edfc0cfd88eb30fc4c55e6053eef4ace76768ce95ff3c + clean-stack: ^2.0.0 + indent-string: ^4.0.0 + checksum: 1101a33f21baa27a2fa8e04b698271e64616b886795fd43c31068c07533c7b3facfcaf4e9e0cab3624bd88f729a592f1c901a1a229c9e490eafce411a8644b79 languageName: node linkType: hard -"axios@npm:^1.4.0, axios@npm:^1.5.1, axios@npm:^1.6.7, axios@npm:^1.6.8": - version: 1.7.2 - resolution: "axios@npm:1.7.2" +"ajv@npm:^6.10.0, ajv@npm:^6.10.2, ajv@npm:^6.12.3, ajv@npm:^6.12.4, ajv@npm:^6.12.6": + version: 6.12.6 + resolution: "ajv@npm:6.12.6" dependencies: - follow-redirects: ^1.15.6 - form-data: ^4.0.0 - proxy-from-env: ^1.1.0 - checksum: e457e2b0ab748504621f6fa6609074ac08c824bf0881592209dfa15098ece7e88495300e02cd22ba50b3468fd712fe687e629dcb03d6a3f6a51989727405aedf + fast-deep-equal: ^3.1.1 + fast-json-stable-stringify: ^2.0.0 + json-schema-traverse: ^0.4.1 + uri-js: ^4.2.2 + checksum: 874972efe5c4202ab0a68379481fbd3d1b5d0a7bd6d3cc21d40d3536ebff3352a2a1fabb632d4fd2cc7fe4cbdcd5ed6782084c9bbf7f32a1536d18f9da5007d4 languageName: node linkType: hard -"babel-code-frame@npm:^6.26.0": - version: 6.26.0 - resolution: "babel-code-frame@npm:6.26.0" +"ajv@npm:^8.0.1": + version: 8.17.1 + resolution: "ajv@npm:8.17.1" dependencies: - chalk: ^1.1.3 - esutils: ^2.0.2 - js-tokens: ^3.0.2 - checksum: 9410c3d5a921eb02fa409675d1a758e493323a49e7b9dddb7a2a24d47e61d39ab1129dd29f9175836eac9ce8b1d4c0a0718fcdc57ce0b865b529fd250dbab313 - languageName: node - linkType: hard - -"babel-core@npm:^6.0.14, babel-core@npm:^6.26.0": - version: 6.26.3 - resolution: "babel-core@npm:6.26.3" - dependencies: - babel-code-frame: ^6.26.0 - babel-generator: ^6.26.0 - babel-helpers: ^6.24.1 - babel-messages: ^6.23.0 - babel-register: ^6.26.0 - babel-runtime: ^6.26.0 - babel-template: ^6.26.0 - babel-traverse: ^6.26.0 - babel-types: ^6.26.0 - babylon: ^6.18.0 - convert-source-map: ^1.5.1 - debug: ^2.6.9 - json5: ^0.5.1 - lodash: ^4.17.4 - minimatch: ^3.0.4 - path-is-absolute: ^1.0.1 - private: ^0.1.8 - slash: ^1.0.0 - source-map: ^0.5.7 - checksum: 3d6a37e5c69ea7f7d66c2a261cbd7219197f2f938700e6ebbabb6d84a03f2bf86691ffa066866dcb49ba6c4bd702d347c9e0e147660847d709705cf43c964752 + fast-deep-equal: ^3.1.3 + fast-uri: ^3.0.1 + json-schema-traverse: ^1.0.0 + require-from-string: ^2.0.2 + checksum: 1797bf242cfffbaf3b870d13565bd1716b73f214bb7ada9a497063aada210200da36e3ed40237285f3255acc4feeae91b1fb183625331bad27da95973f7253d9 languageName: node linkType: hard -"babel-generator@npm:^6.26.0": - version: 6.26.1 - resolution: "babel-generator@npm:6.26.1" +"amazon-cognito-identity-js@npm:^6.3.6": + version: 6.3.15 + resolution: "amazon-cognito-identity-js@npm:6.3.15" dependencies: - babel-messages: ^6.23.0 - babel-runtime: ^6.26.0 - babel-types: ^6.26.0 - detect-indent: ^4.0.0 - jsesc: ^1.3.0 - lodash: ^4.17.4 - source-map: ^0.5.7 - trim-right: ^1.0.1 - checksum: 5397f4d4d1243e7157e3336be96c10fcb1f29f73bf2d9842229c71764d9a6431397d249483a38c4d8b1581459e67be4df6f32d26b1666f02d0f5bfc2c2f25193 + "@aws-crypto/sha256-js": 1.2.2 + buffer: 4.9.2 + fast-base64-decode: ^1.0.0 + isomorphic-unfetch: ^3.0.0 + js-cookie: ^2.2.1 + checksum: d440f180f46fac797023841c2d9a2087abad3814788cbe179bab0934a4524b2af844da6fe0d89a4dea8ddedec74fb93d0facc1839988516495cb0b982339bb6e languageName: node linkType: hard -"babel-helper-builder-binary-assignment-operator-visitor@npm:^6.24.1": - version: 6.24.1 - resolution: "babel-helper-builder-binary-assignment-operator-visitor@npm:6.24.1" - dependencies: - babel-helper-explode-assignable-expression: ^6.24.1 - babel-runtime: ^6.22.0 - babel-types: ^6.24.1 - checksum: 6ef49597837d042980e78284df014972daac7f1f1f2635d978bb2d13990304322f5135f27b8f2d6eb8c4c2459b496ec76e21544e26afbb5dec88f53089e17476 +"amdefine@npm:>=0.0.4": + version: 1.0.1 + resolution: "amdefine@npm:1.0.1" + checksum: 9d4e15b94641643a9385b2841b4cb2bcf4e8e2f741ea4bd475c93ad7bab261ad4ed827a32e9c549b38b98759c4526c173ae4e6dde8caeb75ee5cebedc9863762 languageName: node linkType: hard -"babel-helper-call-delegate@npm:^6.24.1": - version: 6.24.1 - resolution: "babel-helper-call-delegate@npm:6.24.1" +"ampleforth-contracts@https://github.com/ampleforth/ampleforth-contracts#master": + version: 0.0.1 + resolution: "ampleforth-contracts@https://github.com/ampleforth/ampleforth-contracts.git#commit=1d13ed3bcd32772ddba91355579b87d07e3551db" dependencies: - babel-helper-hoist-variables: ^6.24.1 - babel-runtime: ^6.22.0 - babel-traverse: ^6.24.1 - babel-types: ^6.24.1 - checksum: b6277d6e48c10cf416632f6dfbac77bdf6ba8ec4ac2f6359a77d6b731dae941c2a3ec7f35e1eba78aad2a7e0838197731d1ef75af529055096c4cb7d96432c88 + "@openzeppelin/contracts-upgradeable": ^4.7.3 + checksum: af4cf9b611cdb3005adebbb33cb7c636056335cae8dd0b02a87a1a2a21f5eeebba7c141fd80119ed02926379938de567f72ea69ccfc55dd36a77c88dfab66422 languageName: node linkType: hard -"babel-helper-define-map@npm:^6.24.1": - version: 6.26.0 - resolution: "babel-helper-define-map@npm:6.26.0" +"ansi-align@npm:^3.0.0": + version: 3.0.1 + resolution: "ansi-align@npm:3.0.1" dependencies: - babel-helper-function-name: ^6.24.1 - babel-runtime: ^6.26.0 - babel-types: ^6.26.0 - lodash: ^4.17.4 - checksum: 08e201eb009a7dbd020232fb7468ac772ebb8cfd33ec9a41113a54f4c90fd1e3474497783d635b8f87d797706323ca0c1758c516a630b0c95277112fc2fe4f13 + string-width: ^4.1.0 + checksum: 6abfa08f2141d231c257162b15292467081fa49a208593e055c866aa0455b57f3a86b5a678c190c618faa79b4c59e254493099cb700dd9cf2293c6be2c8f5d8d languageName: node linkType: hard -"babel-helper-explode-assignable-expression@npm:^6.24.1": - version: 6.24.1 - resolution: "babel-helper-explode-assignable-expression@npm:6.24.1" - dependencies: - babel-runtime: ^6.22.0 - babel-traverse: ^6.24.1 - babel-types: ^6.24.1 - checksum: 1bafdb51ce3dd95cf25d712d24a0c3c2ae02ff58118c77462f14ede4d8161aaee42c5c759c3d3a3344a5851b8b0f8d16b395713413b8194e1c3264fc5b12b754 +"ansi-colors@npm:^3.2.1": + version: 3.2.4 + resolution: "ansi-colors@npm:3.2.4" + checksum: 026c51880e9f8eb59b112669a87dbea4469939ff94b131606303bbd697438a6691b16b9db3027aa9bf132a244214e83ab1508b998496a34d2aea5b437ac9e62d languageName: node linkType: hard -"babel-helper-function-name@npm:^6.24.1": - version: 6.24.1 - resolution: "babel-helper-function-name@npm:6.24.1" - dependencies: - babel-helper-get-function-arity: ^6.24.1 - babel-runtime: ^6.22.0 - babel-template: ^6.24.1 - babel-traverse: ^6.24.1 - babel-types: ^6.24.1 - checksum: d651db9e0b29e135877e90e7858405750a684220d22a6f7c78bb163305a1b322cc1c8bea1bc617625c34d92d0927fdbaa49ee46822e2f86b524eced4c88c7ff0 +"ansi-colors@npm:^4.1.1, ansi-colors@npm:^4.1.3": + version: 4.1.3 + resolution: "ansi-colors@npm:4.1.3" + checksum: a9c2ec842038a1fabc7db9ece7d3177e2fe1c5dc6f0c51ecfbf5f39911427b89c00b5dc6b8bd95f82a26e9b16aaae2e83d45f060e98070ce4d1333038edceb0e languageName: node linkType: hard -"babel-helper-get-function-arity@npm:^6.24.1": - version: 6.24.1 - resolution: "babel-helper-get-function-arity@npm:6.24.1" +"ansi-escapes@npm:^4.2.1, ansi-escapes@npm:^4.3.0": + version: 4.3.2 + resolution: "ansi-escapes@npm:4.3.2" dependencies: - babel-runtime: ^6.22.0 - babel-types: ^6.24.1 - checksum: 37e344d6c5c00b67a3b378490a5d7ba924bab1c2ccd6ecf1b7da96ca679be12d75fbec6279366ae9772e482fb06a7b48293954dd79cbeba9b947e2db67252fbd + type-fest: ^0.21.3 + checksum: 93111c42189c0a6bed9cdb4d7f2829548e943827ee8479c74d6e0b22ee127b2a21d3f8b5ca57723b8ef78ce011fbfc2784350eb2bde3ccfccf2f575fa8489815 languageName: node linkType: hard -"babel-helper-hoist-variables@npm:^6.24.1": - version: 6.24.1 - resolution: "babel-helper-hoist-variables@npm:6.24.1" - dependencies: - babel-runtime: ^6.22.0 - babel-types: ^6.24.1 - checksum: 6af1c165d5f0ad192df07daa194d13de77572bd914d2fc9a270d56b93b2705d98eebabf412b1211505535af131fbe95886fcfad8b3a07b4d501c24b9cb8e57fe +"ansi-regex@npm:^3.0.0": + version: 3.0.1 + resolution: "ansi-regex@npm:3.0.1" + checksum: 09daf180c5f59af9850c7ac1bd7fda85ba596cc8cbeb210826e90755f06c818af86d9fa1e6e8322fab2c3b9e9b03f56c537b42241139f824dd75066a1e7257cc languageName: node linkType: hard -"babel-helper-optimise-call-expression@npm:^6.24.1": - version: 6.24.1 - resolution: "babel-helper-optimise-call-expression@npm:6.24.1" - dependencies: - babel-runtime: ^6.22.0 - babel-types: ^6.24.1 - checksum: 16e6aba819b473dbf013391f759497df9f57bc7060bc4e5f7f6b60fb03670eb1dec65dd2227601d58f151e9d647e1f676a12466f5e6674379978820fa02c0fbb +"ansi-regex@npm:^4.1.0": + version: 4.1.1 + resolution: "ansi-regex@npm:4.1.1" + checksum: b1a6ee44cb6ecdabaa770b2ed500542714d4395d71c7e5c25baa631f680fb2ad322eb9ba697548d498a6fd366949fc8b5bfcf48d49a32803611f648005b01888 languageName: node linkType: hard -"babel-helper-regex@npm:^6.24.1": - version: 6.26.0 - resolution: "babel-helper-regex@npm:6.26.0" - dependencies: - babel-runtime: ^6.26.0 - babel-types: ^6.26.0 - lodash: ^4.17.4 - checksum: ab949a4c90ab255abaafd9ec11a4a6dc77dba360875af2bb0822b699c058858773792c1e969c425c396837f61009f30c9ee5ba4b9a8ca87b0779ae1622f89fb3 +"ansi-regex@npm:^5.0.1": + version: 5.0.1 + resolution: "ansi-regex@npm:5.0.1" + checksum: 2aa4bb54caf2d622f1afdad09441695af2a83aa3fe8b8afa581d205e57ed4261c183c4d3877cee25794443fde5876417d859c108078ab788d6af7e4fe52eb66b languageName: node linkType: hard -"babel-helper-remap-async-to-generator@npm:^6.24.1": - version: 6.24.1 - resolution: "babel-helper-remap-async-to-generator@npm:6.24.1" - dependencies: - babel-helper-function-name: ^6.24.1 - babel-runtime: ^6.22.0 - babel-template: ^6.24.1 - babel-traverse: ^6.24.1 - babel-types: ^6.24.1 - checksum: f330943104b61e7f9248d222bd5fe5d3238904ee20643b76197571e14a724723d64a8096b292a60f64788f0efe30176882c376eeebde00657925678e304324f0 +"ansi-regex@npm:^6.0.1": + version: 6.1.0 + resolution: "ansi-regex@npm:6.1.0" + checksum: 495834a53b0856c02acd40446f7130cb0f8284f4a39afdab20d5dc42b2e198b1196119fe887beed8f9055c4ff2055e3b2f6d4641d0be018cdfb64fedf6fc1aac languageName: node linkType: hard -"babel-helper-replace-supers@npm:^6.24.1": - version: 6.24.1 - resolution: "babel-helper-replace-supers@npm:6.24.1" +"ansi-styles@npm:^3.2.0, ansi-styles@npm:^3.2.1": + version: 3.2.1 + resolution: "ansi-styles@npm:3.2.1" dependencies: - babel-helper-optimise-call-expression: ^6.24.1 - babel-messages: ^6.23.0 - babel-runtime: ^6.22.0 - babel-template: ^6.24.1 - babel-traverse: ^6.24.1 - babel-types: ^6.24.1 - checksum: ca1d216c5c6afc6af2ef55ea16777ba99e108780ea25da61d93edb09fd85f5e96c756306e2a21e737c3b0c7a16c99762b62a0e5f529d3865b14029fef7351cba + color-convert: ^1.9.0 + checksum: d85ade01c10e5dd77b6c89f34ed7531da5830d2cb5882c645f330079975b716438cd7ebb81d0d6e6b4f9c577f19ae41ab55f07f19786b02f9dfd9e0377395665 languageName: node linkType: hard -"babel-helpers@npm:^6.24.1": - version: 6.24.1 - resolution: "babel-helpers@npm:6.24.1" +"ansi-styles@npm:^4.0.0, ansi-styles@npm:^4.1.0": + version: 4.3.0 + resolution: "ansi-styles@npm:4.3.0" dependencies: - babel-runtime: ^6.22.0 - babel-template: ^6.24.1 - checksum: 751c6010e18648eebae422adfea5f3b5eff70d592d693bfe0f53346227d74b38e6cd2553c4c18de1e64faac585de490eccbd3ab86ba0885bdac42ed4478bc6b0 + color-convert: ^2.0.1 + checksum: 513b44c3b2105dd14cc42a19271e80f386466c4be574bccf60b627432f9198571ebf4ab1e4c3ba17347658f4ee1711c163d574248c0c1cdc2d5917a0ad582ec4 languageName: node linkType: hard -"babel-messages@npm:^6.23.0": - version: 6.23.0 - resolution: "babel-messages@npm:6.23.0" - dependencies: - babel-runtime: ^6.22.0 - checksum: c8075c17587a33869e1a5bd0a5b73bbe395b68188362dacd5418debbc7c8fd784bcd3295e81ee7e410dc2c2655755add6af03698c522209f6a68334c15e6d6ca +"ansi-styles@npm:^6.1.0": + version: 6.2.1 + resolution: "ansi-styles@npm:6.2.1" + checksum: ef940f2f0ced1a6347398da88a91da7930c33ecac3c77b72c5905f8b8fe402c52e6fde304ff5347f616e27a742da3f1dc76de98f6866c69251ad0b07a66776d9 languageName: node linkType: hard -"babel-plugin-check-es2015-constants@npm:^6.22.0": - version: 6.22.0 - resolution: "babel-plugin-check-es2015-constants@npm:6.22.0" - dependencies: - babel-runtime: ^6.22.0 - checksum: 39168cb4ff078911726bfaf9d111d1e18f3e99d8b6f6101d343249b28346c3869e415c97fe7e857e7f34b913f8a052634b2b9dcfb4c0272e5f64ed22df69c735 +"antlr4@npm:^4.11.0": + version: 4.13.2 + resolution: "antlr4@npm:4.13.2" + checksum: 3e42659f9b84af84c21f194e625d220bd958278a5481800bb4f5929149c603fad4d492f8b6d04f7c2ab87dd3df88e63ba097fbe7bfa92a060942da713d783e0a languageName: node linkType: hard -"babel-plugin-syntax-async-functions@npm:^6.8.0": - version: 6.13.0 - resolution: "babel-plugin-syntax-async-functions@npm:6.13.0" - checksum: e982d9756869fa83eb6a4502490a90b0d31e8a41e2ee582045934f022ac8ff5fa6a3386366976fab3a391d5a7ab8ea5f9da623f35ed8ab328b8ab6d9b2feb1d3 +"antlr4ts@npm:^0.5.0-alpha.4": + version: 0.5.0-dev + resolution: "antlr4ts@npm:0.5.0-dev" + dependencies: + source-map-support: ^0.5.16 + checksum: 640dae2229124372b0329315e9614ae983bb80b1af237d8c0b3e90a2d85fb534e851c51d65d1897c92b36d27851d041ad8d95aab44af19cf7355b3ad11a3ddbf languageName: node linkType: hard -"babel-plugin-syntax-exponentiation-operator@npm:^6.8.0": - version: 6.13.0 - resolution: "babel-plugin-syntax-exponentiation-operator@npm:6.13.0" - checksum: cbcb3aeae7005240325f72d55c3c90575033123e8a1ddfa6bf9eac4ee7e246c2a23f5b5ab1144879590d947a3ed1d88838169d125e5d7c4f53678526482b020e +"any-signal@npm:^2.1.2": + version: 2.1.2 + resolution: "any-signal@npm:2.1.2" + dependencies: + abort-controller: ^3.0.0 + native-abort-controller: ^1.0.3 + checksum: 498603e30357f82e438ddc972086b3180ddbaf5ea9772f535d103b754711eb13d4c24577e497d5a1146e571ee38f167c316ace7dc1a03b62a8a8c7677e9d660f languageName: node linkType: hard -"babel-plugin-syntax-trailing-function-commas@npm:^6.22.0": - version: 6.22.0 - resolution: "babel-plugin-syntax-trailing-function-commas@npm:6.22.0" - checksum: d8b9039ded835bb128e8e14eeeb6e0ac2a876b85250924bdc3a8dc2a6984d3bfade4de04d40fb15ea04a86d561ac280ae0d7306d7d4ef7a8c52c43b6a23909c6 +"any-signal@npm:^3.0.0": + version: 3.0.1 + resolution: "any-signal@npm:3.0.1" + checksum: 073eb14c365b7552f9f16fbf36cd76171e4a0fe156a8faa865fe1d5ac4ed2f5c5ab6e3faad0ac0d4c69511b5892971c5573baa8a1cbf85fe250d0c54ff0734ff languageName: node linkType: hard -"babel-plugin-transform-async-to-generator@npm:^6.22.0": - version: 6.24.1 - resolution: "babel-plugin-transform-async-to-generator@npm:6.24.1" +"anymatch@npm:~3.1.2": + version: 3.1.3 + resolution: "anymatch@npm:3.1.3" dependencies: - babel-helper-remap-async-to-generator: ^6.24.1 - babel-plugin-syntax-async-functions: ^6.8.0 - babel-runtime: ^6.22.0 - checksum: ffe8b4b2ed6db1f413ede385bd1a36f39e02a64ed79ce02779440049af75215c98f8debdc70eb01430bfd889f792682b0136576fe966f7f9e1b30e2a54695a8d + normalize-path: ^3.0.0 + picomatch: ^2.0.4 + checksum: 3e044fd6d1d26545f235a9fe4d7a534e2029d8e59fa7fd9f2a6eb21230f6b5380ea1eaf55136e60cbf8e613544b3b766e7a6fa2102e2a3a117505466e3025dc2 languageName: node linkType: hard -"babel-plugin-transform-es2015-arrow-functions@npm:^6.22.0": - version: 6.22.0 - resolution: "babel-plugin-transform-es2015-arrow-functions@npm:6.22.0" +"apisauce@npm:^2.1.5": + version: 2.1.6 + resolution: "apisauce@npm:2.1.6" dependencies: - babel-runtime: ^6.22.0 - checksum: 746e2be0fed20771c07f0984ba79ef0bab37d6e98434267ec96cef57272014fe53a180bfb9047bf69ed149d367a2c97baad54d6057531cd037684f371aab2333 + axios: ^0.21.4 + checksum: 3db1447f03ecfa0d8fb9be0991bd4732a8eb4a5c96282c964c0b5f9d215dc1bca1e0fec7f5187080286368c1028deb0de8fb69cd7bccb92441b327aa1028598a languageName: node linkType: hard -"babel-plugin-transform-es2015-block-scoped-functions@npm:^6.22.0": - version: 6.22.0 - resolution: "babel-plugin-transform-es2015-block-scoped-functions@npm:6.22.0" - dependencies: - babel-runtime: ^6.22.0 - checksum: f251611f723d94b4068d2a873a2783e019bd81bd7144cfdbcfc31ef166f4d82fa2f1efba64342ba2630dab93a2b12284067725c0aa08315712419a2bc3b92a75 +"app-module-path@npm:^2.2.0": + version: 2.2.0 + resolution: "app-module-path@npm:2.2.0" + checksum: b52aa49cfa809efbad41b514222e8ef3f8ee9e147f5eccf79280b45eddcc61f7aeb302b0049474e3f42072dd53a28348c57dd96f36cd461d2e31cc8ab1ef56b5 languageName: node linkType: hard -"babel-plugin-transform-es2015-block-scoping@npm:^6.23.0": - version: 6.26.0 - resolution: "babel-plugin-transform-es2015-block-scoping@npm:6.26.0" - dependencies: - babel-runtime: ^6.26.0 - babel-template: ^6.26.0 - babel-traverse: ^6.26.0 - babel-types: ^6.26.0 - lodash: ^4.17.4 - checksum: 5e4dee33bf4aab0ce7751a9ae845c25d3bf03944ffdfc8d784e1de2123a3eec19657dd59274c9969461757f5e2ab75c517e978bafe5309a821a41e278ad38a63 +"arg@npm:^4.1.0": + version: 4.1.3 + resolution: "arg@npm:4.1.3" + checksum: 544af8dd3f60546d3e4aff084d451b96961d2267d668670199692f8d054f0415d86fc5497d0e641e91546f0aa920e7c29e5250e99fc89f5552a34b5d93b77f43 languageName: node linkType: hard -"babel-plugin-transform-es2015-classes@npm:^6.23.0": - version: 6.24.1 - resolution: "babel-plugin-transform-es2015-classes@npm:6.24.1" +"argparse@npm:^1.0.7": + version: 1.0.10 + resolution: "argparse@npm:1.0.10" dependencies: - babel-helper-define-map: ^6.24.1 - babel-helper-function-name: ^6.24.1 - babel-helper-optimise-call-expression: ^6.24.1 - babel-helper-replace-supers: ^6.24.1 - babel-messages: ^6.23.0 - babel-runtime: ^6.22.0 - babel-template: ^6.24.1 - babel-traverse: ^6.24.1 - babel-types: ^6.24.1 - checksum: 999392b47a83cf9297e49fbde00bc9b15fb6d71bc041f7b3d621ac45361486ec4b66f55c47f98dca6c398ceaa8bfc9f3c21257854822c4523e7475a92e6c000a + sprintf-js: ~1.0.2 + checksum: 7ca6e45583a28de7258e39e13d81e925cfa25d7d4aacbf806a382d3c02fcb13403a07fb8aeef949f10a7cfe4a62da0e2e807b348a5980554cc28ee573ef95945 languageName: node linkType: hard -"babel-plugin-transform-es2015-computed-properties@npm:^6.22.0": - version: 6.24.1 - resolution: "babel-plugin-transform-es2015-computed-properties@npm:6.24.1" - dependencies: - babel-runtime: ^6.22.0 - babel-template: ^6.24.1 - checksum: 34e466bfd4b021aa3861db66cf10a9093fa6a4fcedbc8c82a55f6ca1fcbd212a9967f2df6c5f9e9a20046fa43c8967633a476f2bbc15cb8d3769cbba948a5c16 +"argparse@npm:^2.0.1": + version: 2.0.1 + resolution: "argparse@npm:2.0.1" + checksum: 83644b56493e89a254bae05702abf3a1101b4fa4d0ca31df1c9985275a5a5bd47b3c27b7fa0b71098d41114d8ca000e6ed90cad764b306f8a503665e4d517ced languageName: node linkType: hard -"babel-plugin-transform-es2015-destructuring@npm:^6.23.0": - version: 6.23.0 - resolution: "babel-plugin-transform-es2015-destructuring@npm:6.23.0" - dependencies: - babel-runtime: ^6.22.0 - checksum: 1343d27f09846e6e1e48da7b83d0d4f2d5571559c468ad8ad4c3715b8ff3e21b2d553e90ad420dc6840de260b7f3b9f9c057606d527e3d838a52a3a7c5fffdbe +"array-back@npm:^3.0.1, array-back@npm:^3.1.0": + version: 3.1.0 + resolution: "array-back@npm:3.1.0" + checksum: 7205004fcd0f9edd926db921af901b083094608d5b265738d0290092f9822f73accb468e677db74c7c94ef432d39e5ed75a7b1786701e182efb25bbba9734209 languageName: node linkType: hard -"babel-plugin-transform-es2015-duplicate-keys@npm:^6.22.0": - version: 6.24.1 - resolution: "babel-plugin-transform-es2015-duplicate-keys@npm:6.24.1" - dependencies: - babel-runtime: ^6.22.0 - babel-types: ^6.24.1 - checksum: 756a7a13517c3e80c8312137b9872b9bc32fbfbb905e9f1e45bf321e2b464d0e6a6e6deca22c61b62377225bd8136b73580897cccb394995d6e00bc8ce882ba4 +"array-back@npm:^4.0.1, array-back@npm:^4.0.2": + version: 4.0.2 + resolution: "array-back@npm:4.0.2" + checksum: f30603270771eeb54e5aad5f54604c62b3577a18b6db212a7272b2b6c32049121b49431f656654790ed1469411e45f387e7627c0de8fd0515995cc40df9b9294 languageName: node linkType: hard -"babel-plugin-transform-es2015-for-of@npm:^6.23.0": - version: 6.23.0 - resolution: "babel-plugin-transform-es2015-for-of@npm:6.23.0" +"array-buffer-byte-length@npm:^1.0.1, array-buffer-byte-length@npm:^1.0.2": + version: 1.0.2 + resolution: "array-buffer-byte-length@npm:1.0.2" dependencies: - babel-runtime: ^6.22.0 - checksum: 0124e320c32b25de84ddaba951a6f0ad031fa5019de54de32bd317d2a97b3f967026008f32e8c88728330c1cce7c4f1d0ecb15007020d50bd5ca1438a882e205 + call-bound: ^1.0.3 + is-array-buffer: ^3.0.5 + checksum: 0ae3786195c3211b423e5be8dd93357870e6fb66357d81da968c2c39ef43583ef6eece1f9cb1caccdae4806739c65dea832b44b8593414313cd76a89795fca63 languageName: node linkType: hard -"babel-plugin-transform-es2015-function-name@npm:^6.22.0": - version: 6.24.1 - resolution: "babel-plugin-transform-es2015-function-name@npm:6.24.1" +"array-includes@npm:^3.1.8": + version: 3.1.8 + resolution: "array-includes@npm:3.1.8" dependencies: - babel-helper-function-name: ^6.24.1 - babel-runtime: ^6.22.0 - babel-types: ^6.24.1 - checksum: 629ecd824d53ec973a3ef85e74d9fd8c710203084ca2f7ac833879ddfa3b83a28f0270fe2ee5f3b8c078bb4b3e4b843173a646a7cd4abc49e8c1c563d31fb711 + call-bind: ^1.0.7 + define-properties: ^1.2.1 + es-abstract: ^1.23.2 + es-object-atoms: ^1.0.0 + get-intrinsic: ^1.2.4 + is-string: ^1.0.7 + checksum: eb39ba5530f64e4d8acab39297c11c1c5be2a4ea188ab2b34aba5fb7224d918f77717a9d57a3e2900caaa8440e59431bdaf5c974d5212ef65d97f132e38e2d91 languageName: node linkType: hard -"babel-plugin-transform-es2015-literals@npm:^6.22.0": - version: 6.22.0 - resolution: "babel-plugin-transform-es2015-literals@npm:6.22.0" - dependencies: - babel-runtime: ^6.22.0 - checksum: 40e270580a0236990f2555f5dc7ae24b4db9f4709ca455ed1a6724b0078592482274be7448579b14122bd06481641a38e7b2e48d0b49b8c81c88e154a26865b4 +"array-union@npm:^2.1.0": + version: 2.1.0 + resolution: "array-union@npm:2.1.0" + checksum: 5bee12395cba82da674931df6d0fea23c4aa4660cb3b338ced9f828782a65caa232573e6bf3968f23e0c5eb301764a382cef2f128b170a9dc59de0e36c39f98d languageName: node linkType: hard -"babel-plugin-transform-es2015-modules-amd@npm:^6.22.0, babel-plugin-transform-es2015-modules-amd@npm:^6.24.1": - version: 6.24.1 - resolution: "babel-plugin-transform-es2015-modules-amd@npm:6.24.1" +"array.prototype.findlastindex@npm:^1.2.5": + version: 1.2.6 + resolution: "array.prototype.findlastindex@npm:1.2.6" dependencies: - babel-plugin-transform-es2015-modules-commonjs: ^6.24.1 - babel-runtime: ^6.22.0 - babel-template: ^6.24.1 - checksum: 084c7a1ef3bd0b2b9f4851b27cfb65f8ea1408349af05b4d88f994c23844a0754abfa4799bbc5f3f0ec94232b3a54a2e46d7f1dff1bdd40fa66a46f645197dfa + call-bind: ^1.0.8 + call-bound: ^1.0.4 + define-properties: ^1.2.1 + es-abstract: ^1.23.9 + es-errors: ^1.3.0 + es-object-atoms: ^1.1.1 + es-shim-unscopables: ^1.1.0 + checksum: bd2665bd51f674d4e1588ce5d5848a8adb255f414070e8e652585598b801480516df2c6cef2c60b6ea1a9189140411c49157a3f112d52e9eabb4e9fc80936ea6 languageName: node linkType: hard -"babel-plugin-transform-es2015-modules-commonjs@npm:^6.23.0, babel-plugin-transform-es2015-modules-commonjs@npm:^6.24.1": - version: 6.26.2 - resolution: "babel-plugin-transform-es2015-modules-commonjs@npm:6.26.2" +"array.prototype.flat@npm:^1.3.2": + version: 1.3.3 + resolution: "array.prototype.flat@npm:1.3.3" dependencies: - babel-plugin-transform-strict-mode: ^6.24.1 - babel-runtime: ^6.26.0 - babel-template: ^6.26.0 - babel-types: ^6.26.0 - checksum: 9cd93a84037855c1879bcc100229bee25b44c4805a9a9f040e8927f772c4732fa17a0706c81ea0db77b357dd9baf84388eec03ceb36597932c48fe32fb3d4171 + call-bind: ^1.0.8 + define-properties: ^1.2.1 + es-abstract: ^1.23.5 + es-shim-unscopables: ^1.0.2 + checksum: 5d5a7829ab2bb271a8d30a1c91e6271cef0ec534593c0fe6d2fb9ebf8bb62c1e5326e2fddcbbcbbe5872ca04f5e6b54a1ecf092e0af704fb538da9b2bfd95b40 languageName: node linkType: hard -"babel-plugin-transform-es2015-modules-systemjs@npm:^6.23.0": - version: 6.24.1 - resolution: "babel-plugin-transform-es2015-modules-systemjs@npm:6.24.1" +"array.prototype.flatmap@npm:^1.3.2": + version: 1.3.3 + resolution: "array.prototype.flatmap@npm:1.3.3" dependencies: - babel-helper-hoist-variables: ^6.24.1 - babel-runtime: ^6.22.0 - babel-template: ^6.24.1 - checksum: b34877e201d7b4d293d87c04962a3575fe7727a9593e99ce3a7f8deea3da8883a08bd87a6a12927083ac26f47f6944a31cdbfe3d6eb4d18dd884cb2d304ee943 + call-bind: ^1.0.8 + define-properties: ^1.2.1 + es-abstract: ^1.23.5 + es-shim-unscopables: ^1.0.2 + checksum: 11b4de09b1cf008be6031bb507d997ad6f1892e57dc9153583de6ebca0f74ea403fffe0f203461d359de05048d609f3f480d9b46fed4099652d8b62cc972f284 languageName: node linkType: hard -"babel-plugin-transform-es2015-modules-umd@npm:^6.23.0": - version: 6.24.1 - resolution: "babel-plugin-transform-es2015-modules-umd@npm:6.24.1" +"arraybuffer.prototype.slice@npm:^1.0.4": + version: 1.0.4 + resolution: "arraybuffer.prototype.slice@npm:1.0.4" dependencies: - babel-plugin-transform-es2015-modules-amd: ^6.24.1 - babel-runtime: ^6.22.0 - babel-template: ^6.24.1 - checksum: 735857b9f2ad0c41ceda31a1594fe2a063025f4428f9e243885a437b5bd415aca445a5e8495ff34b7120617735b1c3a2158033f0be23f1f5a90e655fff742a01 + array-buffer-byte-length: ^1.0.1 + call-bind: ^1.0.8 + define-properties: ^1.2.1 + es-abstract: ^1.23.5 + es-errors: ^1.3.0 + get-intrinsic: ^1.2.6 + is-array-buffer: ^3.0.4 + checksum: b1d1fd20be4e972a3779b1569226f6740170dca10f07aa4421d42cefeec61391e79c557cda8e771f5baefe47d878178cd4438f60916ce831813c08132bced765 languageName: node linkType: hard -"babel-plugin-transform-es2015-object-super@npm:^6.22.0": - version: 6.24.1 - resolution: "babel-plugin-transform-es2015-object-super@npm:6.24.1" +"asn1@npm:~0.2.3": + version: 0.2.6 + resolution: "asn1@npm:0.2.6" dependencies: - babel-helper-replace-supers: ^6.24.1 - babel-runtime: ^6.22.0 - checksum: 97b2968f699ac94cb55f4f1e7ea53dc9e4264ec99cab826f40f181da9f6db5980cd8b4985f05c7b6f1e19fbc31681e6e63894dfc5ecf4b3a673d736c4ef0f9db + safer-buffer: ~2.1.0 + checksum: 39f2ae343b03c15ad4f238ba561e626602a3de8d94ae536c46a4a93e69578826305366dc09fbb9b56aec39b4982a463682f259c38e59f6fa380cd72cd61e493d languageName: node linkType: hard -"babel-plugin-transform-es2015-parameters@npm:^6.23.0": - version: 6.24.1 - resolution: "babel-plugin-transform-es2015-parameters@npm:6.24.1" +"assemblyscript@git+https://github.com/AssemblyScript/assemblyscript.git#v0.6": + version: 0.6.0 + resolution: "assemblyscript@https://github.com/AssemblyScript/assemblyscript.git#commit=3ed76a97f05335504166fce1653da75f4face28f" dependencies: - babel-helper-call-delegate: ^6.24.1 - babel-helper-get-function-arity: ^6.24.1 - babel-runtime: ^6.22.0 - babel-template: ^6.24.1 - babel-traverse: ^6.24.1 - babel-types: ^6.24.1 - checksum: bb6c047dc10499be8ccebdffac22c77f14aee5d3106da8f2e96c801d2746403c809d8c6922e8ebd2eb31d8827b4bb2321ba43378fcdc9dca206417bb345c4f93 + "@protobufjs/utf8": ^1.1.0 + binaryen: 77.0.0-nightly.20190407 + glob: ^7.1.3 + long: ^4.0.0 + opencollective-postinstall: ^2.0.0 + source-map-support: ^0.5.11 + bin: + asc: bin/asc + asinit: bin/asinit + checksum: 08fde3fd50e3c67c2e057c83963f65f9f4a710380b6040727fd87b3a162795c498de603a3bc68ceb1da7ec4b5e31e9d61ec6ea961a0ba228b91584f18c197e98 languageName: node linkType: hard -"babel-plugin-transform-es2015-shorthand-properties@npm:^6.22.0": - version: 6.24.1 - resolution: "babel-plugin-transform-es2015-shorthand-properties@npm:6.24.1" - dependencies: - babel-runtime: ^6.22.0 - babel-types: ^6.24.1 - checksum: 9302c5de158a28432e932501a783560094c624c3659f4e0a472b6b2e9d6e8ab2634f82ef74d3e75363d46ccff6aad119267dbc34f67464c70625e24a651ad9e5 +"assert-plus@npm:1.0.0, assert-plus@npm:^1.0.0": + version: 1.0.0 + resolution: "assert-plus@npm:1.0.0" + checksum: 19b4340cb8f0e6a981c07225eacac0e9d52c2644c080198765d63398f0075f83bbc0c8e95474d54224e297555ad0d631c1dcd058adb1ddc2437b41a6b424ac64 + languageName: node + linkType: hard + +"assertion-error@npm:^1.1.0": + version: 1.1.0 + resolution: "assertion-error@npm:1.1.0" + checksum: fd9429d3a3d4fd61782eb3962ae76b6d08aa7383123fca0596020013b3ebd6647891a85b05ce821c47d1471ed1271f00b0545cf6a4326cf2fc91efcc3b0fbecf languageName: node linkType: hard -"babel-plugin-transform-es2015-spread@npm:^6.22.0": - version: 6.22.0 - resolution: "babel-plugin-transform-es2015-spread@npm:6.22.0" - dependencies: - babel-runtime: ^6.22.0 - checksum: 8694a8a7802d905503194ab81c155354b36d39fc819ad2148f83146518dd37d2c6926c8568712f5aa890169afc9353fd4bcc49397959c6dc9da3480b449c0ae9 +"ast-parents@npm:^0.0.1": + version: 0.0.1 + resolution: "ast-parents@npm:0.0.1" + checksum: 51360afb9f7b939eb0330fdd0d5d855d0242f273f63478d30d9053069120492173719fb3c03ba372bccf1a7c1a9041c3c6bf2ab700de8c0f8c14792b045c3b23 languageName: node linkType: hard -"babel-plugin-transform-es2015-sticky-regex@npm:^6.22.0": - version: 6.24.1 - resolution: "babel-plugin-transform-es2015-sticky-regex@npm:6.24.1" - dependencies: - babel-helper-regex: ^6.24.1 - babel-runtime: ^6.22.0 - babel-types: ^6.24.1 - checksum: d9c45401caf0d74779a1170e886976d4c865b7de2e90dfffc7557481b9e73b6e37e9f1028aa07b813896c4df88f4d7e89968249a74547c7875e6c499c90c801d +"astral-regex@npm:^1.0.0": + version: 1.0.0 + resolution: "astral-regex@npm:1.0.0" + checksum: 93417fc0879531cd95ace2560a54df865c9461a3ac0714c60cbbaa5f1f85d2bee85489e78d82f70b911b71ac25c5f05fc5a36017f44c9bb33c701bee229ff848 languageName: node linkType: hard -"babel-plugin-transform-es2015-template-literals@npm:^6.22.0": - version: 6.22.0 - resolution: "babel-plugin-transform-es2015-template-literals@npm:6.22.0" - dependencies: - babel-runtime: ^6.22.0 - checksum: 4fad2b7b383a2e784858ee7bf837419ee8ff9602afe218e1472f8c33a0c008f01d06f23ff2f2322fb23e1ed17e37237a818575fe88ecc5417d85331973b0ea4d +"astral-regex@npm:^2.0.0": + version: 2.0.0 + resolution: "astral-regex@npm:2.0.0" + checksum: 876231688c66400473ba505731df37ea436e574dd524520294cc3bbc54ea40334865e01fa0d074d74d036ee874ee7e62f486ea38bc421ee8e6a871c06f011766 languageName: node linkType: hard -"babel-plugin-transform-es2015-typeof-symbol@npm:^6.23.0": - version: 6.23.0 - resolution: "babel-plugin-transform-es2015-typeof-symbol@npm:6.23.0" +"async-eventemitter@npm:^0.2.4": + version: 0.2.4 + resolution: "async-eventemitter@npm:0.2.4" dependencies: - babel-runtime: ^6.22.0 - checksum: 68a1609c6abcddf5f138c56bafcd9fad7c6b3b404fe40910148ab70eb21d6c7807a343a64eb81ce45daf4b70c384c528c55fad45e0d581e4b09efa4d574a6a1b + async: ^2.4.0 + checksum: b9e77e0f58ebd7188c50c23d613d1263e0ab501f5e677e02b57cc97d7032beaf60aafa189887e7105569c791e212df4af00b608be1e9a4c425911d577124911e languageName: node linkType: hard -"babel-plugin-transform-es2015-unicode-regex@npm:^6.22.0": - version: 6.24.1 - resolution: "babel-plugin-transform-es2015-unicode-regex@npm:6.24.1" - dependencies: - babel-helper-regex: ^6.24.1 - babel-runtime: ^6.22.0 - regexpu-core: ^2.0.0 - checksum: 739ddb02e5f77904f83ea45323c9a636e3aed34b2a49c7c68208b5f2834eecb6b655e772f870f16a7aaf09ac8219f754ad69d61741d088f5b681d13cda69265d +"async-function@npm:^1.0.0": + version: 1.0.0 + resolution: "async-function@npm:1.0.0" + checksum: 9102e246d1ed9b37ac36f57f0a6ca55226876553251a31fc80677e71471f463a54c872dc78d5d7f80740c8ba624395cccbe8b60f7b690c4418f487d8e9fd1106 languageName: node linkType: hard -"babel-plugin-transform-exponentiation-operator@npm:^6.22.0": - version: 6.24.1 - resolution: "babel-plugin-transform-exponentiation-operator@npm:6.24.1" +"async-retry@npm:^1.3.3": + version: 1.3.3 + resolution: "async-retry@npm:1.3.3" dependencies: - babel-helper-builder-binary-assignment-operator-visitor: ^6.24.1 - babel-plugin-syntax-exponentiation-operator: ^6.8.0 - babel-runtime: ^6.22.0 - checksum: 533ad53ba2cd6ff3c0f751563e1beea429c620038dc2efeeb8348ab4752ebcc95d1521857abfd08047400f1921b2d4df5e0cd266e65ddbe4c3edc58b9ad6fd3c + retry: 0.13.1 + checksum: 38a7152ff7265a9321ea214b9c69e8224ab1febbdec98efbbde6e562f17ff68405569b796b1c5271f354aef8783665d29953f051f68c1fc45306e61aec82fdc4 languageName: node linkType: hard -"babel-plugin-transform-regenerator@npm:^6.22.0": - version: 6.26.0 - resolution: "babel-plugin-transform-regenerator@npm:6.26.0" - dependencies: - regenerator-transform: ^0.10.0 - checksum: 41a51d8f692bf4a5cbd705fa70f3cb6abebae66d9ba3dccfb5921da262f8c30f630e1fe9f7b132e29b96fe0d99385a801f6aa204278c5bd0af4284f7f93a665a +"async@npm:1.x": + version: 1.5.2 + resolution: "async@npm:1.5.2" + checksum: fe5d6214d8f15bd51eee5ae8ec5079b228b86d2d595f47b16369dec2e11b3ff75a567bb5f70d12d79006665fbbb7ee0a7ec0e388524eefd454ecbe651c124ebd languageName: node linkType: hard -"babel-plugin-transform-strict-mode@npm:^6.24.1": - version: 6.24.1 - resolution: "babel-plugin-transform-strict-mode@npm:6.24.1" +"async@npm:^2.4.0": + version: 2.6.4 + resolution: "async@npm:2.6.4" dependencies: - babel-runtime: ^6.22.0 - babel-types: ^6.24.1 - checksum: 32d70ce9d8c8918a6a840e46df03dfe1e265eb9b25df5a800fedb5065ef1b4b5f24d7c62d92fca0e374db8b0b9b6f84e68edd02ad21883d48f608583ec29f638 + lodash: ^4.17.14 + checksum: a52083fb32e1ebe1d63e5c5624038bb30be68ff07a6c8d7dfe35e47c93fc144bd8652cbec869e0ac07d57dde387aa5f1386be3559cdee799cb1f789678d88e19 languageName: node linkType: hard -"babel-preset-env@npm:^1.7.0": - version: 1.7.0 - resolution: "babel-preset-env@npm:1.7.0" - dependencies: - babel-plugin-check-es2015-constants: ^6.22.0 - babel-plugin-syntax-trailing-function-commas: ^6.22.0 - babel-plugin-transform-async-to-generator: ^6.22.0 - babel-plugin-transform-es2015-arrow-functions: ^6.22.0 - babel-plugin-transform-es2015-block-scoped-functions: ^6.22.0 - babel-plugin-transform-es2015-block-scoping: ^6.23.0 - babel-plugin-transform-es2015-classes: ^6.23.0 - babel-plugin-transform-es2015-computed-properties: ^6.22.0 - babel-plugin-transform-es2015-destructuring: ^6.23.0 - babel-plugin-transform-es2015-duplicate-keys: ^6.22.0 - babel-plugin-transform-es2015-for-of: ^6.23.0 - babel-plugin-transform-es2015-function-name: ^6.22.0 - babel-plugin-transform-es2015-literals: ^6.22.0 - babel-plugin-transform-es2015-modules-amd: ^6.22.0 - babel-plugin-transform-es2015-modules-commonjs: ^6.23.0 - babel-plugin-transform-es2015-modules-systemjs: ^6.23.0 - babel-plugin-transform-es2015-modules-umd: ^6.23.0 - babel-plugin-transform-es2015-object-super: ^6.22.0 - babel-plugin-transform-es2015-parameters: ^6.23.0 - babel-plugin-transform-es2015-shorthand-properties: ^6.22.0 - babel-plugin-transform-es2015-spread: ^6.22.0 - babel-plugin-transform-es2015-sticky-regex: ^6.22.0 - babel-plugin-transform-es2015-template-literals: ^6.22.0 - babel-plugin-transform-es2015-typeof-symbol: ^6.23.0 - babel-plugin-transform-es2015-unicode-regex: ^6.22.0 - babel-plugin-transform-exponentiation-operator: ^6.22.0 - babel-plugin-transform-regenerator: ^6.22.0 - browserslist: ^3.2.6 - invariant: ^2.2.2 - semver: ^5.3.0 - checksum: 6e459a6c76086a2a377707680148b94c3d0aba425b039b427ca01171ebada7f5db5d336b309548462f6ba015e13176a4724f912875c15084d4aa88d77020d185 - languageName: node - linkType: hard - -"babel-register@npm:^6.26.0": - version: 6.26.0 - resolution: "babel-register@npm:6.26.0" - dependencies: - babel-core: ^6.26.0 - babel-runtime: ^6.26.0 - core-js: ^2.5.0 - home-or-tmp: ^2.0.0 - lodash: ^4.17.4 - mkdirp: ^0.5.1 - source-map-support: ^0.4.15 - checksum: 75d5fe060e4850dbdbd5f56db2928cd0b6b6c93a65ba5f2a991465af4dc3f4adf46d575138f228b2169b1e25e3b4a7cdd16515a355fea41b873321bf56467583 +"asynckit@npm:^0.4.0": + version: 0.4.0 + resolution: "asynckit@npm:0.4.0" + checksum: 7b78c451df768adba04e2d02e63e2d0bf3b07adcd6e42b4cf665cb7ce899bedd344c69a1dcbce355b5f972d597b25aaa1c1742b52cffd9caccb22f348114f6be languageName: node linkType: hard -"babel-runtime@npm:^6.18.0, babel-runtime@npm:^6.22.0, babel-runtime@npm:^6.26.0": - version: 6.26.0 - resolution: "babel-runtime@npm:6.26.0" - dependencies: - core-js: ^2.4.0 - regenerator-runtime: ^0.11.0 - checksum: 8aeade94665e67a73c1ccc10f6fd42ba0c689b980032b70929de7a6d9a12eb87ef51902733f8fefede35afea7a5c3ef7e916a64d503446c1eedc9e3284bd3d50 +"at-least-node@npm:^1.0.0": + version: 1.0.0 + resolution: "at-least-node@npm:1.0.0" + checksum: 463e2f8e43384f1afb54bc68485c436d7622acec08b6fad269b421cb1d29cebb5af751426793d0961ed243146fe4dc983402f6d5a51b720b277818dbf6f2e49e languageName: node linkType: hard -"babel-template@npm:^6.24.1, babel-template@npm:^6.26.0": - version: 6.26.0 - resolution: "babel-template@npm:6.26.0" +"available-typed-arrays@npm:^1.0.7": + version: 1.0.7 + resolution: "available-typed-arrays@npm:1.0.7" dependencies: - babel-runtime: ^6.26.0 - babel-traverse: ^6.26.0 - babel-types: ^6.26.0 - babylon: ^6.18.0 - lodash: ^4.17.4 - checksum: 028dd57380f09b5641b74874a19073c53c4fb3f1696e849575aae18f8c80eaf21db75209057db862f3b893ce2cd9b795d539efa591b58f4a0fb011df0a56fbed + possible-typed-array-names: ^1.0.0 + checksum: 1aa3ffbfe6578276996de660848b6e95669d9a95ad149e3dd0c0cda77db6ee1dbd9d1dd723b65b6d277b882dd0c4b91a654ae9d3cf9e1254b7e93e4908d78fd3 languageName: node linkType: hard -"babel-traverse@npm:^6.24.1, babel-traverse@npm:^6.26.0": - version: 6.26.0 - resolution: "babel-traverse@npm:6.26.0" - dependencies: - babel-code-frame: ^6.26.0 - babel-messages: ^6.23.0 - babel-runtime: ^6.26.0 - babel-types: ^6.26.0 - babylon: ^6.18.0 - debug: ^2.6.8 - globals: ^9.18.0 - invariant: ^2.2.2 - lodash: ^4.17.4 - checksum: fca037588d2791ae0409f1b7aa56075b798699cccc53ea04d82dd1c0f97b9e7ab17065f7dd3ecd69101d7874c9c8fd5e0f88fa53abbae1fe94e37e6b81ebcb8d +"aws-sign2@npm:~0.7.0": + version: 0.7.0 + resolution: "aws-sign2@npm:0.7.0" + checksum: b148b0bb0778098ad8cf7e5fc619768bcb51236707ca1d3e5b49e41b171166d8be9fdc2ea2ae43d7decf02989d0aaa3a9c4caa6f320af95d684de9b548a71525 languageName: node linkType: hard -"babel-types@npm:^6.19.0, babel-types@npm:^6.24.1, babel-types@npm:^6.26.0": - version: 6.26.0 - resolution: "babel-types@npm:6.26.0" - dependencies: - babel-runtime: ^6.26.0 - esutils: ^2.0.2 - lodash: ^4.17.4 - to-fast-properties: ^1.0.3 - checksum: d16b0fa86e9b0e4c2623be81d0a35679faff24dd2e43cde4ca58baf49f3e39415a011a889e6c2259ff09e1228e4c3a3db6449a62de59e80152fe1ce7398fde76 +"aws4@npm:^1.8.0": + version: 1.13.2 + resolution: "aws4@npm:1.13.2" + checksum: 9ac924e4a91c088b4928ea86b68d8c4558b0e6289ccabaae0e3e96a611bd75277c2eab6e3965821028768700516f612b929a5ce822f33a8771f74ba2a8cedb9c languageName: node linkType: hard -"babelify@npm:^7.3.0": - version: 7.3.0 - resolution: "babelify@npm:7.3.0" +"axios@npm:^0.21.4": + version: 0.21.4 + resolution: "axios@npm:0.21.4" dependencies: - babel-core: ^6.0.14 - object-assign: ^4.0.0 - checksum: 4e169606ed0f2ff6f886d2367c72243d36b3b354490ccc916b913f6b4afd14102c91f771d71d485857feb134581dd48702f25431e19b5c7035f474f9898c3c2e - languageName: node - linkType: hard - -"babylon@npm:^6.18.0": - version: 6.18.0 - resolution: "babylon@npm:6.18.0" - bin: - babylon: ./bin/babylon.js - checksum: 0777ae0c735ce1cbfc856d627589ed9aae212b84fb0c03c368b55e6c5d3507841780052808d0ad46e18a2ba516e93d55eeed8cd967f3b2938822dfeccfb2a16d + follow-redirects: ^1.14.0 + checksum: 44245f24ac971e7458f3120c92f9d66d1fc695e8b97019139de5b0cc65d9b8104647db01e5f46917728edfc0cfd88eb30fc4c55e6053eef4ace76768ce95ff3c languageName: node linkType: hard -"backoff@npm:^2.5.0": - version: 2.5.0 - resolution: "backoff@npm:2.5.0" +"axios@npm:^1.6.7, axios@npm:^1.7.4": + version: 1.9.0 + resolution: "axios@npm:1.9.0" dependencies: - precond: 0.2 - checksum: ccdcf2a26acd9379d0d4f09e3fb3b7ee34dee94f07ab74d1e38b38f89a3675d9f3cbebb142d9c61c655f4c9eb63f1d6ec28cebeb3dc9215efd8fe7cef92725b9 + follow-redirects: ^1.15.6 + form-data: ^4.0.0 + proxy-from-env: ^1.1.0 + checksum: 631f02c9c279f2ae90637a4989cc9d75c1c27aefd16b6e8eb90f98a4d0bddaccfd1cb1387be12101d1ab0f9bbf0c47e2451b4de0cf2870462a7d9ed3de8da3f2 languageName: node linkType: hard @@ -4524,12 +4298,12 @@ __metadata: languageName: node linkType: hard -"base-x@npm:^3.0.2, base-x@npm:^3.0.8": - version: 3.0.9 - resolution: "base-x@npm:3.0.9" +"base-x@npm:^3.0.2": + version: 3.0.11 + resolution: "base-x@npm:3.0.11" dependencies: safe-buffer: ^5.0.1 - checksum: 957101d6fd09e1903e846fd8f69fd7e5e3e50254383e61ab667c725866bec54e5ece5ba49ce385128ae48f9ec93a26567d1d5ebb91f4d56ef4a9cc0d5a5481e8 + checksum: c2e3c443fd07cb9b9d3e179a9e9c581daa31881005841fe8d6a834e534505890fedf03465ccf14512da60e3f7be00fe66167806b159ba076d2c03952ae7460c4 languageName: node linkType: hard @@ -4547,21 +4321,6 @@ __metadata: languageName: node linkType: hard -"base@npm:^0.11.1": - version: 0.11.2 - resolution: "base@npm:0.11.2" - dependencies: - cache-base: ^1.0.1 - class-utils: ^0.3.5 - component-emitter: ^1.2.1 - define-property: ^1.0.0 - isobject: ^3.0.1 - mixin-deep: ^1.2.0 - pascalcase: ^0.1.1 - checksum: a4a146b912e27eea8f66d09cb0c9eab666f32ce27859a7dfd50f38cd069a2557b39f16dba1bc2aecb3b44bf096738dd207b7970d99b0318423285ab1b1994edd - languageName: node - linkType: hard - "bcrypt-pbkdf@npm:^1.0.0": version: 1.0.2 resolution: "bcrypt-pbkdf@npm:1.0.2" @@ -4578,10 +4337,10 @@ __metadata: languageName: node linkType: hard -"bignumber.js@npm:^9.0.0": - version: 9.1.2 - resolution: "bignumber.js@npm:9.1.2" - checksum: 582c03af77ec9cb0ebd682a373ee6c66475db94a4325f92299621d544aa4bd45cb45fd60001610e94aef8ae98a0905fa538241d9638d4422d57abbeeac6fadaf +"bignumber.js@npm:^9.0.0, bignumber.js@npm:^9.1.2": + version: 9.3.0 + resolution: "bignumber.js@npm:9.3.0" + checksum: 580d783d60246e758e527fa879ae0d282d8f250f555dd0fcee1227d680186ceba49ed7964c6d14e2e8d8eac7a2f4dd6ef1b7925dc52f5fc28a5a87639dd2dbd1 languageName: node linkType: hard @@ -4603,19 +4362,6 @@ __metadata: languageName: node linkType: hard -"bip39@npm:2.5.0": - version: 2.5.0 - resolution: "bip39@npm:2.5.0" - dependencies: - create-hash: ^1.1.0 - pbkdf2: ^3.0.9 - randombytes: ^2.0.1 - safe-buffer: ^5.0.1 - unorm: ^1.3.3 - checksum: 26e83583c43a8430afea1c385328b447005c74ddaf997cd8d3e416057f4968360b08ebf7de32374d605295c3abdd7ddd448d8078a2aa3d951735f4499c23875b - languageName: node - linkType: hard - "bip39@npm:3.0.4": version: 3.0.4 resolution: "bip39@npm:3.0.4" @@ -4654,13 +4400,6 @@ __metadata: languageName: node linkType: hard -"bluebird@npm:^3.5.0, bluebird@npm:^3.5.2": - version: 3.7.2 - resolution: "bluebird@npm:3.7.2" - checksum: 869417503c722e7dc54ca46715f70e15f4d9c602a423a02c825570862d12935be59ed9c7ba34a9b31f186c017c23cac6b54e35446f8353059c101da73eac22ef - languageName: node - linkType: hard - "bn.js@npm:4.11.6": version: 4.11.6 resolution: "bn.js@npm:4.11.6" @@ -4668,37 +4407,24 @@ __metadata: languageName: node linkType: hard -"bn.js@npm:^4.0.0, bn.js@npm:^4.1.0, bn.js@npm:^4.10.0, bn.js@npm:^4.11.0, bn.js@npm:^4.11.1, bn.js@npm:^4.11.6, bn.js@npm:^4.11.8, bn.js@npm:^4.11.9, bn.js@npm:^4.8.0": - version: 4.12.0 - resolution: "bn.js@npm:4.12.0" - checksum: 39afb4f15f4ea537b55eaf1446c896af28ac948fdcf47171961475724d1bb65118cca49fa6e3d67706e4790955ec0e74de584e45c8f1ef89f46c812bee5b5a12 +"bn.js@npm:^4.0.0, bn.js@npm:^4.11.0, bn.js@npm:^4.11.1, bn.js@npm:^4.11.8, bn.js@npm:^4.11.9": + version: 4.12.2 + resolution: "bn.js@npm:4.12.2" + checksum: dd224afda6f5a7d15f2fe5154e1a1c245576a725584ea1852c8c42f9748dfe847bc63a48b2885360023389a24cfebb3653ca97f4c69742f3c22bc63da6565030 languageName: node linkType: hard -"bn.js@npm:^5.0.0, bn.js@npm:^5.1.2, bn.js@npm:^5.2.0, bn.js@npm:^5.2.1": - version: 5.2.1 - resolution: "bn.js@npm:5.2.1" - checksum: 3dd8c8d38055fedfa95c1d5fc3c99f8dd547b36287b37768db0abab3c239711f88ff58d18d155dd8ad902b0b0cee973747b7ae20ea12a09473272b0201c9edd3 +"bn.js@npm:^5.1.2, bn.js@npm:^5.2.0, bn.js@npm:^5.2.1": + version: 5.2.2 + resolution: "bn.js@npm:5.2.2" + checksum: 4384d35fef785c757eb050bc1f13d60dd8e37662ca72392ae6678b35cfa2a2ae8f0494291086294683a7d977609c7878ac3cff08ecca7f74c3ca73f3acbadbe8 languageName: node linkType: hard -"body-parser@npm:1.20.2, body-parser@npm:^1.16.0": - version: 1.20.2 - resolution: "body-parser@npm:1.20.2" - dependencies: - bytes: 3.1.2 - content-type: ~1.0.5 - debug: 2.6.9 - depd: 2.0.0 - destroy: 1.2.0 - http-errors: 2.0.0 - iconv-lite: 0.4.24 - on-finished: 2.4.1 - qs: 6.11.0 - raw-body: 2.5.2 - type-is: ~1.6.18 - unpipe: 1.0.0 - checksum: 14d37ec638ab5c93f6099ecaed7f28f890d222c650c69306872e00b9efa081ff6c596cd9afb9930656aae4d6c4e1c17537bea12bb73c87a217cb3cfea8896737 +"bowser@npm:^2.11.0": + version: 2.11.0 + resolution: "bowser@npm:2.11.0" + checksum: 29c3f01f22e703fa6644fc3b684307442df4240b6e10f6cfe1b61c6ca5721073189ca97cdeedb376081148c8518e33b1d818a57f781d70b0b70e1f31fb48814f languageName: node linkType: hard @@ -4737,24 +4463,6 @@ __metadata: languageName: node linkType: hard -"braces@npm:^2.3.1": - version: 2.3.2 - resolution: "braces@npm:2.3.2" - dependencies: - arr-flatten: ^1.1.0 - array-unique: ^0.3.2 - extend-shallow: ^2.0.1 - fill-range: ^4.0.0 - isobject: ^3.0.1 - repeat-element: ^1.1.2 - snapdragon: ^0.8.1 - snapdragon-node: ^2.0.1 - split-string: ^3.0.2 - to-regex: ^3.0.1 - checksum: e30dcb6aaf4a31c8df17d848aa283a65699782f75ad61ae93ec25c9729c66cf58e66f0000a9fec84e4add1135bb7da40f7cb9601b36bebcfa9ca58e8d5c07de0 - languageName: node - linkType: hard - "braces@npm:^3.0.3, braces@npm:~3.0.2": version: 3.0.3 resolution: "braces@npm:3.0.3" @@ -4785,14 +4493,14 @@ __metadata: languageName: node linkType: hard -"browser-stdout@npm:1.3.1": +"browser-stdout@npm:^1.3.1": version: 1.3.1 resolution: "browser-stdout@npm:1.3.1" checksum: b717b19b25952dd6af483e368f9bcd6b14b87740c3d226c2977a65e84666ffd67000bddea7d911f111a9b6ddc822b234de42d52ab6507bce4119a4cc003ef7b3 languageName: node linkType: hard -"browserify-aes@npm:^1.0.4, browserify-aes@npm:^1.2.0": +"browserify-aes@npm:^1.2.0": version: 1.2.0 resolution: "browserify-aes@npm:1.2.0" dependencies: @@ -4806,69 +4514,6 @@ __metadata: languageName: node linkType: hard -"browserify-cipher@npm:^1.0.0": - version: 1.0.1 - resolution: "browserify-cipher@npm:1.0.1" - dependencies: - browserify-aes: ^1.0.4 - browserify-des: ^1.0.0 - evp_bytestokey: ^1.0.0 - checksum: 2d8500acf1ee535e6bebe808f7a20e4c3a9e2ed1a6885fff1facbfd201ac013ef030422bec65ca9ece8ffe82b03ca580421463f9c45af6c8415fd629f4118c13 - languageName: node - linkType: hard - -"browserify-des@npm:^1.0.0": - version: 1.0.2 - resolution: "browserify-des@npm:1.0.2" - dependencies: - cipher-base: ^1.0.1 - des.js: ^1.0.0 - inherits: ^2.0.1 - safe-buffer: ^5.1.2 - checksum: b15a3e358a1d78a3b62ddc06c845d02afde6fc826dab23f1b9c016e643e7b1fda41de628d2110b712f6a44fb10cbc1800bc6872a03ddd363fb50768e010395b7 - languageName: node - linkType: hard - -"browserify-rsa@npm:^4.0.0, browserify-rsa@npm:^4.1.0": - version: 4.1.0 - resolution: "browserify-rsa@npm:4.1.0" - dependencies: - bn.js: ^5.0.0 - randombytes: ^2.0.1 - checksum: 155f0c135873efc85620571a33d884aa8810e40176125ad424ec9d85016ff105a07f6231650914a760cca66f29af0494087947b7be34880dd4599a0cd3c38e54 - languageName: node - linkType: hard - -"browserify-sign@npm:^4.0.0": - version: 4.2.3 - resolution: "browserify-sign@npm:4.2.3" - dependencies: - bn.js: ^5.2.1 - browserify-rsa: ^4.1.0 - create-hash: ^1.2.0 - create-hmac: ^1.1.7 - elliptic: ^6.5.5 - hash-base: ~3.0 - inherits: ^2.0.4 - parse-asn1: ^5.1.7 - readable-stream: ^2.3.8 - safe-buffer: ^5.2.1 - checksum: 403a8061d229ae31266670345b4a7c00051266761d2c9bbeb68b1a9bcb05f68143b16110cf23a171a5d6716396a1f41296282b3e73eeec0a1871c77f0ff4ee6b - languageName: node - linkType: hard - -"browserslist@npm:^3.2.6": - version: 3.2.8 - resolution: "browserslist@npm:3.2.8" - dependencies: - caniuse-lite: ^1.0.30000844 - electron-to-chromium: ^1.3.47 - bin: - browserslist: ./cli.js - checksum: 74d9ab1089a3813f54a7c4f9f6612faa6256799c8e42c7e00e4aae626c17f199049a01707a525a05b1673cd1493936583e51aad295e25249166e7e8fbd0273ba - languageName: node - linkType: hard - "bs58@npm:^4.0.0": version: 4.0.1 resolution: "bs58@npm:4.0.1" @@ -4920,13 +4565,6 @@ __metadata: languageName: node linkType: hard -"buffer-to-arraybuffer@npm:^0.0.5": - version: 0.0.5 - resolution: "buffer-to-arraybuffer@npm:0.0.5" - checksum: b2e6493a6679e03d0e0e146b4258b9a6d92649d528d8fc4a74423b77f0d4f9398c9f965f3378d1683a91738054bae2761196cfe233f41ab3695126cb58cb25f9 - languageName: node - linkType: hard - "buffer-xor@npm:^1.0.3": version: 1.0.3 resolution: "buffer-xor@npm:1.0.3" @@ -4954,7 +4592,7 @@ __metadata: languageName: node linkType: hard -"buffer@npm:^5.0.5, buffer@npm:^5.2.1, buffer@npm:^5.5.0, buffer@npm:^5.6.0": +"buffer@npm:^5.5.0, buffer@npm:^5.6.0": version: 5.7.1 resolution: "buffer@npm:5.7.1" dependencies: @@ -4984,16 +4622,6 @@ __metadata: languageName: node linkType: hard -"bufferutil@npm:^4.0.1": - version: 4.0.8 - resolution: "bufferutil@npm:4.0.8" - dependencies: - node-gyp: latest - node-gyp-build: ^4.3.0 - checksum: 7e9a46f1867dca72fda350966eb468eca77f4d623407b0650913fadf73d5750d883147d6e5e21c56f9d3b0bdc35d5474e80a600b9f31ec781315b4d2469ef087 - languageName: node - linkType: hard - "builtins@npm:^5.0.1": version: 5.1.0 resolution: "builtins@npm:5.1.0" @@ -5010,30 +4638,11 @@ __metadata: languageName: node linkType: hard -"bytewise-core@npm:^1.2.2": - version: 1.2.3 - resolution: "bytewise-core@npm:1.2.3" - dependencies: - typewise-core: ^1.2 - checksum: e0d28fb7ff5bb6fd9320eef31c6b37e98da3b9a24d9893e2c17e0ee544457e0c76c2d3fc642c99d82daa0f18dcd49e7dce8dcc338711200e9ced79107cb78e8e - languageName: node - linkType: hard - -"bytewise@npm:~1.1.0": - version: 1.1.0 - resolution: "bytewise@npm:1.1.0" - dependencies: - bytewise-core: ^1.2.2 - typewise: ^1.0.3 - checksum: 20d7387ecf8c29adc4740e626fb02eaa27f34ae4c5ca881657d403e792730c0625ba4fed824462b3ddb7d3ebe41b7abbfe24f1cd3bf07cecc5a631f154d2d8d2 - languageName: node - linkType: hard - -"cacache@npm:^18.0.0": - version: 18.0.3 - resolution: "cacache@npm:18.0.3" +"cacache@npm:^19.0.1": + version: 19.0.1 + resolution: "cacache@npm:19.0.1" dependencies: - "@npmcli/fs": ^3.1.0 + "@npmcli/fs": ^4.0.0 fs-minipass: ^3.0.0 glob: ^10.2.2 lru-cache: ^10.0.1 @@ -5041,88 +4650,43 @@ __metadata: minipass-collect: ^2.0.1 minipass-flush: ^1.0.5 minipass-pipeline: ^1.2.4 - p-map: ^4.0.0 - ssri: ^10.0.0 - tar: ^6.1.11 - unique-filename: ^3.0.0 - checksum: b717fd9b36e9c3279bfde4545c3a8f6d5a539b084ee26a9504d48f83694beb724057d26e090b97540f9cc62bea18b9f6cf671c50e18fb7dac60eda9db691714f - languageName: node - linkType: hard - -"cache-base@npm:^1.0.1": - version: 1.0.1 - resolution: "cache-base@npm:1.0.1" - dependencies: - collection-visit: ^1.0.0 - component-emitter: ^1.2.1 - get-value: ^2.0.6 - has-value: ^1.0.0 - isobject: ^3.0.1 - set-value: ^2.0.0 - to-object-path: ^0.3.0 - union-value: ^1.0.0 - unset-value: ^1.0.0 - checksum: 9114b8654fe2366eedc390bad0bcf534e2f01b239a888894e2928cb58cdc1e6ea23a73c6f3450dcfd2058aa73a8a981e723cd1e7c670c047bf11afdc65880107 + p-map: ^7.0.2 + ssri: ^12.0.0 + tar: ^7.4.3 + unique-filename: ^4.0.0 + checksum: e95684717de6881b4cdaa949fa7574e3171946421cd8291769dd3d2417dbf7abf4aa557d1f968cca83dcbc95bed2a281072b09abfc977c942413146ef7ed4525 languageName: node linkType: hard -"cacheable-lookup@npm:^5.0.3": - version: 5.0.4 - resolution: "cacheable-lookup@npm:5.0.4" - checksum: 763e02cf9196bc9afccacd8c418d942fc2677f22261969a4c2c2e760fa44a2351a81557bd908291c3921fe9beb10b976ba8fa50c5ca837c5a0dd945f16468f2d - languageName: node - linkType: hard - -"cacheable-request@npm:^6.0.0": - version: 6.1.0 - resolution: "cacheable-request@npm:6.1.0" - dependencies: - clone-response: ^1.0.2 - get-stream: ^5.1.0 - http-cache-semantics: ^4.0.0 - keyv: ^3.0.0 - lowercase-keys: ^2.0.0 - normalize-url: ^4.1.0 - responselike: ^1.0.2 - checksum: b510b237b18d17e89942e9ee2d2a077cb38db03f12167fd100932dfa8fc963424bfae0bfa1598df4ae16c944a5484e43e03df8f32105b04395ee9495e9e4e9f1 - languageName: node - linkType: hard - -"cacheable-request@npm:^7.0.2": - version: 7.0.4 - resolution: "cacheable-request@npm:7.0.4" +"call-bind-apply-helpers@npm:^1.0.0, call-bind-apply-helpers@npm:^1.0.1, call-bind-apply-helpers@npm:^1.0.2": + version: 1.0.2 + resolution: "call-bind-apply-helpers@npm:1.0.2" dependencies: - clone-response: ^1.0.2 - get-stream: ^5.1.0 - http-cache-semantics: ^4.0.0 - keyv: ^4.0.0 - lowercase-keys: ^2.0.0 - normalize-url: ^6.0.1 - responselike: ^2.0.0 - checksum: 0de9df773fd4e7dd9bd118959878f8f2163867e2e1ab3575ffbecbe6e75e80513dd0c68ba30005e5e5a7b377cc6162bbc00ab1db019bb4e9cb3c2f3f7a6f1ee4 + es-errors: ^1.3.0 + function-bind: ^1.1.2 + checksum: b2863d74fcf2a6948221f65d95b91b4b2d90cfe8927650b506141e669f7d5de65cea191bf788838bc40d13846b7886c5bc5c84ab96c3adbcf88ad69a72fcdc6b languageName: node linkType: hard -"cachedown@npm:1.0.0": - version: 1.0.0 - resolution: "cachedown@npm:1.0.0" +"call-bind@npm:^1.0.7, call-bind@npm:^1.0.8": + version: 1.0.8 + resolution: "call-bind@npm:1.0.8" dependencies: - abstract-leveldown: ^2.4.1 - lru-cache: ^3.2.0 - checksum: ffd229839ca7efbfa14e35321fb8df444421e192bdf7be16048a303d2a24f3ed86cbe6c7a8cca91761423e4c53c3ed1098d337bbb9d3448801d4792172b4ab3e + call-bind-apply-helpers: ^1.0.0 + es-define-property: ^1.0.0 + get-intrinsic: ^1.2.4 + set-function-length: ^1.2.2 + checksum: aa2899bce917a5392fd73bd32e71799c37c0b7ab454e0ed13af7f6727549091182aade8bbb7b55f304a5bc436d543241c14090fb8a3137e9875e23f444f4f5a9 languageName: node linkType: hard -"call-bind@npm:^1.0.2, call-bind@npm:^1.0.5, call-bind@npm:^1.0.6, call-bind@npm:^1.0.7, call-bind@npm:~1.0.2": - version: 1.0.7 - resolution: "call-bind@npm:1.0.7" +"call-bound@npm:^1.0.2, call-bound@npm:^1.0.3, call-bound@npm:^1.0.4": + version: 1.0.4 + resolution: "call-bound@npm:1.0.4" dependencies: - es-define-property: ^1.0.0 - es-errors: ^1.3.0 - function-bind: ^1.1.2 - get-intrinsic: ^1.2.4 - set-function-length: ^1.2.1 - checksum: 295c0c62b90dd6522e6db3b0ab1ce26bdf9e7404215bda13cfee25b626b5ff1a7761324d58d38b1ef1607fc65aca2d06e44d2e18d0dfc6c14b465b00d8660029 + call-bind-apply-helpers: ^1.0.2 + get-intrinsic: ^1.3.0 + checksum: 2f6399488d1c272f56306ca60ff696575e2b7f31daf23bc11574798c84d9f2759dceb0cb1f471a85b77f28962a7ac6411f51d283ea2e45319009a19b6ccab3b2 languageName: node linkType: hard @@ -5133,13 +4697,6 @@ __metadata: languageName: node linkType: hard -"camelcase@npm:^3.0.0": - version: 3.0.0 - resolution: "camelcase@npm:3.0.0" - checksum: ae4fe1c17c8442a3a345a6b7d2393f028ab7a7601af0c352ad15d1ab97ca75112e19e29c942b2a214898e160194829b68923bce30e018d62149c6d84187f1673 - languageName: node - linkType: hard - "camelcase@npm:^5.0.0": version: 5.3.1 resolution: "camelcase@npm:5.3.1" @@ -5154,14 +4711,7 @@ __metadata: languageName: node linkType: hard -"caniuse-lite@npm:^1.0.30000844": - version: 1.0.30001639 - resolution: "caniuse-lite@npm:1.0.30001639" - checksum: 0d9291cc47ffaad5806716bff6fef41eec21f86a448370bc30a72823fcaf24ba5ccb4704841e6a60f078ddf2e9987e3d23f4d3ca0fffc51f6cb0400b7411ad28 - languageName: node - linkType: hard - -"caseless@npm:^0.12.0, caseless@npm:~0.12.0": +"caseless@npm:~0.12.0": version: 0.12.0 resolution: "caseless@npm:0.12.0" checksum: b43bd4c440aa1e8ee6baefee8063b4850fd0d7b378f6aabc796c9ec8cb26d27fb30b46885350777d9bd079c5256c0e1329ad0dc7c2817e0bb466810ebb353751 @@ -5175,21 +4725,21 @@ __metadata: languageName: node linkType: hard -"cbor@npm:^8.1.0": - version: 8.1.0 - resolution: "cbor@npm:8.1.0" +"cbor@npm:^10.0.0": + version: 10.0.3 + resolution: "cbor@npm:10.0.3" dependencies: - nofilter: ^3.1.0 - checksum: a90338435dc7b45cc01461af979e3bb6ddd4f2a08584c437586039cd5f2235014c06e49d664295debbfb3514d87b2f06728092ab6aa6175e2e85e9cd7dc0c1fd + nofilter: ^3.0.2 + checksum: 8bb589fae51a43b041f645c64ee5d8c0da77ed67ffaa5b1087f1bd5aac28714fe67b6865054148335d62bff979c44139767b47fdb6033b0f7b30f06d9923c43e languageName: node linkType: hard -"cbor@npm:^9.0.0": - version: 9.0.2 - resolution: "cbor@npm:9.0.2" +"cbor@npm:^8.1.0": + version: 8.1.0 + resolution: "cbor@npm:8.1.0" dependencies: nofilter: ^3.1.0 - checksum: 925edae7bf964be5a26dba1b7ba6311ac12b6a66234dc958958997a0576cdc740632dc19852a5b84d8a75101936bea1fe122dc22539d6e11f4539c731853ba2e + checksum: a90338435dc7b45cc01461af979e3bb6ddd4f2a08584c437586039cd5f2235014c06e49d664295debbfb3514d87b2f06728092ab6aa6175e2e85e9cd7dc0c1fd languageName: node linkType: hard @@ -5214,8 +4764,8 @@ __metadata: linkType: hard "chai@npm:^4.3.6": - version: 4.4.1 - resolution: "chai@npm:4.4.1" + version: 4.5.0 + resolution: "chai@npm:4.5.0" dependencies: assertion-error: ^1.1.0 check-error: ^1.0.3 @@ -5223,8 +4773,8 @@ __metadata: get-func-name: ^2.0.2 loupe: ^2.3.6 pathval: ^1.1.1 - type-detect: ^4.0.8 - checksum: 9ab84f36eb8e0b280c56c6c21ca4da5933132cd8a0c89c384f1497f77953640db0bc151edd47f81748240a9fab57b78f7d925edfeedc8e8fc98016d71f40c36e + type-detect: ^4.1.0 + checksum: 70e5a8418a39e577e66a441cc0ce4f71fd551a650a71de30dd4e3e31e75ed1f5aa7119cf4baf4a2cb5e85c0c6befdb4d8a05811fad8738c1a6f3aa6a23803821 languageName: node linkType: hard @@ -5238,20 +4788,7 @@ __metadata: languageName: node linkType: hard -"chalk@npm:^1.1.3": - version: 1.1.3 - resolution: "chalk@npm:1.1.3" - dependencies: - ansi-styles: ^2.2.1 - escape-string-regexp: ^1.0.2 - has-ansi: ^2.0.0 - strip-ansi: ^3.0.0 - supports-color: ^2.0.0 - checksum: 9d2ea6b98fc2b7878829eec223abcf404622db6c48396a9b9257f6d0ead2acf18231ae368d6a664a83f272b0679158da12e97b5229f794939e555cc574478acd - languageName: node - linkType: hard - -"chalk@npm:^2.1.0, chalk@npm:^2.4.1, chalk@npm:^2.4.2": +"chalk@npm:^2.1.0, chalk@npm:^2.4.2": version: 2.4.2 resolution: "chalk@npm:2.4.2" dependencies: @@ -5295,16 +4832,7 @@ __metadata: languageName: node linkType: hard -"checkpoint-store@npm:^1.1.0": - version: 1.1.0 - resolution: "checkpoint-store@npm:1.1.0" - dependencies: - functional-red-black-tree: ^1.0.1 - checksum: 94e921ccb222c7970615e8b2bcd956dbd52f15a1c397af0447dbdef8ecd32ffe342e394d39e55f2912278a460f3736de777b5b57a5baf229c0a6bd04d2465511 - languageName: node - linkType: hard - -"chokidar@npm:^3.0.2, chokidar@npm:^3.4.0, chokidar@npm:^3.5.3": +"chokidar@npm:^3.0.2, chokidar@npm:^3.5.3": version: 3.6.0 resolution: "chokidar@npm:3.6.0" dependencies: @@ -5323,17 +4851,26 @@ __metadata: languageName: node linkType: hard -"chownr@npm:^1.0.1, chownr@npm:^1.1.4": +"chokidar@npm:^4.0.0": + version: 4.0.3 + resolution: "chokidar@npm:4.0.3" + dependencies: + readdirp: ^4.0.1 + checksum: a8765e452bbafd04f3f2fad79f04222dd65f43161488bb6014a41099e6ca18d166af613d59a90771908c1c823efa3f46ba36b86ac50b701c20c1b9908c5fe36e + languageName: node + linkType: hard + +"chownr@npm:^1.0.1": version: 1.1.4 resolution: "chownr@npm:1.1.4" checksum: 115648f8eb38bac5e41c3857f3e663f9c39ed6480d1349977c4d96c95a47266fcacc5a5aabf3cb6c481e22d72f41992827db47301851766c4fd77ac21a4f081d languageName: node linkType: hard -"chownr@npm:^2.0.0": - version: 2.0.0 - resolution: "chownr@npm:2.0.0" - checksum: c57cf9dd0791e2f18a5ee9c1a299ae6e801ff58fee96dc8bfd0dcb4738a6ce58dd252a3605b1c93c6418fe4f9d5093b28ffbf4d66648cb2a9c67eaef9679be2f +"chownr@npm:^3.0.0": + version: 3.0.0 + resolution: "chownr@npm:3.0.0" + checksum: fd73a4bab48b79e66903fe1cafbdc208956f41ea4f856df883d0c7277b7ab29fd33ee65f93b2ec9192fc0169238f2f8307b7735d27c155821d886b84aa97aa8d languageName: node linkType: hard @@ -5344,45 +4881,13 @@ __metadata: languageName: node linkType: hard -"cids@npm:^0.7.1": - version: 0.7.5 - resolution: "cids@npm:0.7.5" - dependencies: - buffer: ^5.5.0 - class-is: ^1.1.0 - multibase: ~0.6.0 - multicodec: ^1.0.0 - multihashes: ~0.4.15 - checksum: 54aa031bef76b08a2c934237696a4af2cfc8afb5d2727cb39ab69f6ac142ef312b9a0c6070dc2b4be0a43076d8961339d8bf85287773c647b3d1d25ce203f325 - languageName: node - linkType: hard - "cipher-base@npm:^1.0.0, cipher-base@npm:^1.0.1, cipher-base@npm:^1.0.3": - version: 1.0.4 - resolution: "cipher-base@npm:1.0.4" - dependencies: - inherits: ^2.0.1 - safe-buffer: ^5.0.1 - checksum: 47d3568dbc17431a339bad1fe7dff83ac0891be8206911ace3d3b818fc695f376df809bea406e759cdea07fff4b454fa25f1013e648851bec790c1d75763032e - languageName: node - linkType: hard - -"class-is@npm:^1.1.0": - version: 1.1.0 - resolution: "class-is@npm:1.1.0" - checksum: 49024de3b264fc501a38dd59d8668f1a2b4973fa6fcef6b83d80fe6fe99a2000a8fbea5b50d4607169c65014843c9f6b41a4f8473df806c1b4787b4d47521880 - languageName: node - linkType: hard - -"class-utils@npm:^0.3.5": - version: 0.3.6 - resolution: "class-utils@npm:0.3.6" + version: 1.0.6 + resolution: "cipher-base@npm:1.0.6" dependencies: - arr-union: ^3.1.0 - define-property: ^0.2.5 - isobject: ^3.0.0 - static-extend: ^0.1.1 - checksum: be108900801e639e50f96a7e4bfa8867c753a7750a7603879f3981f8b0a89cba657497a2d5f40cd4ea557ff15d535a100818bb486baf6e26fe5d7872e75f1078 + inherits: ^2.0.4 + safe-buffer: ^5.2.1 + checksum: 64a1738a8583163cf096bc85321a69ef3075bb0873f34cf89dc705e62b9eee058dd6b2e5c672f774ede0b6bdbe56fe7b710e0d38c4f08a2f355d8ab828f05c6f languageName: node linkType: hard @@ -5416,30 +4921,30 @@ __metadata: languageName: node linkType: hard -"cli-table3@npm:^0.5.0, cli-table3@npm:~0.5.0": - version: 0.5.1 - resolution: "cli-table3@npm:0.5.1" +"cli-table3@npm:^0.6.3": + version: 0.6.5 + resolution: "cli-table3@npm:0.6.5" dependencies: - colors: ^1.1.2 - object-assign: ^4.1.0 - string-width: ^2.1.1 + "@colors/colors": 1.5.0 + string-width: ^4.2.0 dependenciesMeta: - colors: + "@colors/colors": optional: true - checksum: 3ff8c821440a2a0e655a01f04e5b54a0365b3814676cd93cec2b2b0b9952a08311797ad242a181733fcff714fa7d776f8bb45ad812f296390bfa5ef584fb231d + checksum: ab7afbf4f8597f1c631f3ee6bb3481d0bfeac8a3b81cffb5a578f145df5c88003b6cfff46046a7acae86596fdd03db382bfa67f20973b6b57425505abc47e42c languageName: node linkType: hard - -"cli-table3@npm:^0.6.3": - version: 0.6.5 - resolution: "cli-table3@npm:0.6.5" + +"cli-table3@npm:~0.5.0": + version: 0.5.1 + resolution: "cli-table3@npm:0.5.1" dependencies: - "@colors/colors": 1.5.0 - string-width: ^4.2.0 + colors: ^1.1.2 + object-assign: ^4.1.0 + string-width: ^2.1.1 dependenciesMeta: - "@colors/colors": + colors: optional: true - checksum: ab7afbf4f8597f1c631f3ee6bb3481d0bfeac8a3b81cffb5a578f145df5c88003b6cfff46046a7acae86596fdd03db382bfa67f20973b6b57425505abc47e42c + checksum: 3ff8c821440a2a0e655a01f04e5b54a0365b3814676cd93cec2b2b0b9952a08311797ad242a181733fcff714fa7d776f8bb45ad812f296390bfa5ef584fb231d languageName: node linkType: hard @@ -5450,17 +4955,6 @@ __metadata: languageName: node linkType: hard -"cliui@npm:^3.2.0": - version: 3.2.0 - resolution: "cliui@npm:3.2.0" - dependencies: - string-width: ^1.0.1 - strip-ansi: ^3.0.1 - wrap-ansi: ^2.0.0 - checksum: c68d1dbc3e347bfe79ed19cc7f48007d5edd6cd8438342e32073e0b4e311e3c44e1f4f19221462bc6590de56c2df520e427533a9dde95dee25710bec322746ad - languageName: node - linkType: hard - "cliui@npm:^5.0.0": version: 5.0.0 resolution: "cliui@npm:5.0.0" @@ -5483,22 +4977,6 @@ __metadata: languageName: node linkType: hard -"clone-response@npm:^1.0.2": - version: 1.0.3 - resolution: "clone-response@npm:1.0.3" - dependencies: - mimic-response: ^1.0.0 - checksum: 4e671cac39b11c60aa8ba0a450657194a5d6504df51bca3fac5b3bd0145c4f8e8464898f87c8406b83232e3bc5cca555f51c1f9c8ac023969ebfbf7f6bdabb2e - languageName: node - linkType: hard - -"clone@npm:2.1.2, clone@npm:^2.0.0": - version: 2.1.2 - resolution: "clone@npm:2.1.2" - checksum: aaf106e9bc025b21333e2f4c12da539b568db4925c0501a1bf4070836c9e848c892fa22c35548ce0d1132b08bbbfa17a00144fe58fccdab6fa900fec4250f67d - languageName: node - linkType: hard - "clone@npm:^1.0.2": version: 1.0.4 resolution: "clone@npm:1.0.4" @@ -5506,23 +4984,6 @@ __metadata: languageName: node linkType: hard -"code-point-at@npm:^1.0.0": - version: 1.1.0 - resolution: "code-point-at@npm:1.1.0" - checksum: 17d5666611f9b16d64fdf48176d9b7fb1c7d1c1607a189f7e600040a11a6616982876af148230336adb7d8fe728a559f743a4e29db3747e3b1a32fa7f4529681 - languageName: node - linkType: hard - -"collection-visit@npm:^1.0.0": - version: 1.0.0 - resolution: "collection-visit@npm:1.0.0" - dependencies: - map-visit: ^1.0.0 - object-visit: ^1.0.0 - checksum: 15d9658fe6eb23594728346adad5433b86bb7a04fd51bbab337755158722f9313a5376ef479de5b35fbc54140764d0d39de89c339f5d25b959ed221466981da9 - languageName: node - linkType: hard - "color-convert@npm:^1.9.0": version: 1.9.3 resolution: "color-convert@npm:1.9.3" @@ -5555,7 +5016,7 @@ __metadata: languageName: node linkType: hard -"colors@npm:1.4.0, colors@npm:^1.1.2, colors@npm:^1.3.3": +"colors@npm:^1.1.2, colors@npm:^1.3.3": version: 1.4.0 resolution: "colors@npm:1.4.0" checksum: 98aa2c2418ad87dedf25d781be69dc5fc5908e279d9d30c34d8b702e586a0474605b3a189511482b9d5ed0d20c867515d22749537f7bc546256c6014f3ebdcec @@ -5578,19 +5039,6 @@ __metadata: languageName: node linkType: hard -"command-line-args@npm:^4.0.7": - version: 4.0.7 - resolution: "command-line-args@npm:4.0.7" - dependencies: - array-back: ^2.0.0 - find-replace: ^1.0.3 - typical: ^2.6.1 - bin: - command-line-args: bin/cli.js - checksum: 618109143fbca741048d54a5d31a2a5e166fbda318ed1419c1ca66877ce92ed80d6768a52a2e6392eb751f16ca7755d4014ced6f5f858a68d0cbe793bab6e3ee - languageName: node - linkType: hard - "command-line-args@npm:^5.1.1": version: 5.2.1 resolution: "command-line-args@npm:5.2.1" @@ -5615,13 +5063,6 @@ __metadata: languageName: node linkType: hard -"commander@npm:3.0.2": - version: 3.0.2 - resolution: "commander@npm:3.0.2" - checksum: 6d14ad030d1904428139487ed31febcb04c1604db2b8d9fae711f60ee6718828dc0e11602249e91c8a97b0e721e9c6d53edbc166bad3cde1596851d59a8f824d - languageName: node - linkType: hard - "commander@npm:^10.0.0": version: 10.0.1 resolution: "commander@npm:10.0.1" @@ -5644,16 +5085,9 @@ __metadata: linkType: hard "compare-versions@npm:^6.0.0": - version: 6.1.0 - resolution: "compare-versions@npm:6.1.0" - checksum: d4e2a45706a023d8d0b6680338b66b79e20bd02d1947f0ac6531dab634cbed89fa373b3f03d503c5e489761194258d6e1bae67a07f88b1efc61648454f2d47e7 - languageName: node - linkType: hard - -"component-emitter@npm:^1.2.1": - version: 1.3.1 - resolution: "component-emitter@npm:1.3.1" - checksum: 94550aa462c7bd5a61c1bc480e28554aa306066930152d1b1844a0dd3845d4e5db7e261ddec62ae184913b3e59b55a2ad84093b9d3596a8f17c341514d6c483d + version: 6.1.1 + resolution: "compare-versions@npm:6.1.1" + checksum: 73fe6c4f52d22efe28f0a3be10df2afd704e10b3593360cd963e86b33a7a263c263b41a1361b69c30a0fe68bfa70fef90860c1cf2ef41502629d4402890fcd57 languageName: node linkType: hard @@ -5664,7 +5098,7 @@ __metadata: languageName: node linkType: hard -"concat-stream@npm:^1.5.1, concat-stream@npm:^1.6.0, concat-stream@npm:^1.6.2, concat-stream@npm:~1.6.2": +"concat-stream@npm:~1.6.2": version: 1.6.2 resolution: "concat-stream@npm:1.6.2" dependencies: @@ -5676,54 +5110,6 @@ __metadata: languageName: node linkType: hard -"content-disposition@npm:0.5.4": - version: 0.5.4 - resolution: "content-disposition@npm:0.5.4" - dependencies: - safe-buffer: 5.2.1 - checksum: afb9d545e296a5171d7574fcad634b2fdf698875f4006a9dd04a3e1333880c5c0c98d47b560d01216fb6505a54a2ba6a843ee3a02ec86d7e911e8315255f56c3 - languageName: node - linkType: hard - -"content-hash@npm:^2.5.2": - version: 2.5.2 - resolution: "content-hash@npm:2.5.2" - dependencies: - cids: ^0.7.1 - multicodec: ^0.5.5 - multihashes: ^0.4.15 - checksum: 31869e4d137b59d02003df0c0f0ad080744d878ed12a57f7d20b2cfd526d59d6317e9f52fa6e49cba59df7f9ab49ceb96d6a832685b85bae442e0c906f7193be - languageName: node - linkType: hard - -"content-type@npm:~1.0.4, content-type@npm:~1.0.5": - version: 1.0.5 - resolution: "content-type@npm:1.0.5" - checksum: 566271e0a251642254cde0f845f9dd4f9856e52d988f4eb0d0dcffbb7a1f8ec98de7a5215fc628f3bce30fe2fb6fd2bc064b562d721658c59b544e2d34ea2766 - languageName: node - linkType: hard - -"convert-source-map@npm:^1.5.1": - version: 1.9.0 - resolution: "convert-source-map@npm:1.9.0" - checksum: dc55a1f28ddd0e9485ef13565f8f756b342f9a46c4ae18b843fe3c30c675d058d6a4823eff86d472f187b176f0adf51ea7b69ea38be34be4a63cbbf91b0593c8 - languageName: node - linkType: hard - -"cookie-signature@npm:1.0.6": - version: 1.0.6 - resolution: "cookie-signature@npm:1.0.6" - checksum: f4e1b0a98a27a0e6e66fd7ea4e4e9d8e038f624058371bf4499cfcd8f3980be9a121486995202ba3fca74fbed93a407d6d54d43a43f96fd28d0bd7a06761591a - languageName: node - linkType: hard - -"cookie@npm:0.6.0": - version: 0.6.0 - resolution: "cookie@npm:0.6.0" - checksum: f56a7d32a07db5458e79c726b77e3c2eff655c36792f2b6c58d351fb5f61531e5b1ab7f46987150136e366c65213cbe31729e02a3eaed630c3bf7334635fb410 - languageName: node - linkType: hard - "cookie@npm:^0.4.1": version: 0.4.2 resolution: "cookie@npm:0.4.2" @@ -5731,31 +5117,10 @@ __metadata: languageName: node linkType: hard -"cookiejar@npm:^2.1.1": - version: 2.1.4 - resolution: "cookiejar@npm:2.1.4" - checksum: c4442111963077dc0e5672359956d6556a195d31cbb35b528356ce5f184922b99ac48245ac05ed86cf993f7df157c56da10ab3efdadfed79778a0d9b1b092d5b - languageName: node - linkType: hard - -"copy-descriptor@npm:^0.1.0": - version: 0.1.1 - resolution: "copy-descriptor@npm:0.1.1" - checksum: d4b7b57b14f1d256bb9aa0b479241048afd7f5bcf22035fc7b94e8af757adeae247ea23c1a774fe44869fd5694efba4a969b88d966766c5245fdee59837fe45b - languageName: node - linkType: hard - "core-js-pure@npm:^3.0.1": - version: 3.37.1 - resolution: "core-js-pure@npm:3.37.1" - checksum: a13a40e3951975cffef12a0933d3dbf1ecedbf9821e1ec8024884b587744951ad30e3762a86bcb8e2a18fdd4b8d7c8971b2391605329799fc04e1fc1e1397dc1 - languageName: node - linkType: hard - -"core-js@npm:^2.4.0, core-js@npm:^2.5.0": - version: 2.6.12 - resolution: "core-js@npm:2.6.12" - checksum: 44fa9934a85f8c78d61e0c8b7b22436330471ffe59ec5076fe7f324d6e8cf7f824b14b1c81ca73608b13bdb0fef035bd820989bf059767ad6fa13123bb8bd016 + version: 3.42.0 + resolution: "core-js-pure@npm:3.42.0" + checksum: 37f2488e810db5ea23f623458b8d5861a5a858cde1b4d5777c89b531b00775a3df2cf814f69af0d9d16a421094f6c640c4466b9f86a8580d65263e3219c75440 languageName: node linkType: hard @@ -5773,16 +5138,6 @@ __metadata: languageName: node linkType: hard -"cors@npm:^2.8.1": - version: 2.8.5 - resolution: "cors@npm:2.8.5" - dependencies: - object-assign: ^4 - vary: ^1 - checksum: ced838404ccd184f61ab4fdc5847035b681c90db7ac17e428f3d81d69e2989d2b680cc254da0e2554f5ed4f8a341820a1ce3d1c16b499f6e2f47a1b9b07b5006 - languageName: node - linkType: hard - "cosmiconfig@npm:6.0.0": version: 6.0.0 resolution: "cosmiconfig@npm:6.0.0" @@ -5822,16 +5177,6 @@ __metadata: languageName: node linkType: hard -"create-ecdh@npm:^4.0.0": - version: 4.0.4 - resolution: "create-ecdh@npm:4.0.4" - dependencies: - bn.js: ^4.1.0 - elliptic: ^6.5.3 - checksum: 0dd7fca9711d09e152375b79acf1e3f306d1a25ba87b8ff14c2fd8e68b83aafe0a7dd6c4e540c9ffbdd227a5fa1ad9b81eca1f233c38bb47770597ba247e614b - languageName: node - linkType: hard - "create-hash@npm:^1.1.0, create-hash@npm:^1.1.2, create-hash@npm:^1.2.0": version: 1.2.0 resolution: "create-hash@npm:1.2.0" @@ -5845,7 +5190,7 @@ __metadata: languageName: node linkType: hard -"create-hmac@npm:^1.1.0, create-hmac@npm:^1.1.4, create-hmac@npm:^1.1.7": +"create-hmac@npm:^1.1.4, create-hmac@npm:^1.1.7": version: 1.1.7 resolution: "create-hmac@npm:1.1.7" dependencies: @@ -5866,37 +5211,27 @@ __metadata: languageName: node linkType: hard -"cross-fetch@npm:^2.1.0, cross-fetch@npm:^2.1.1": - version: 2.2.6 - resolution: "cross-fetch@npm:2.2.6" - dependencies: - node-fetch: ^2.6.7 - whatwg-fetch: ^2.0.4 - checksum: df9c6728b314ff96022dca468a3d2a05b4546cd318d82a7e1f1445e7160472d39029bccbe5f20d319b8ba3793930592b0b956244aef6a87a133fbcfed85fc8ca - languageName: node - linkType: hard - "cross-spawn@npm:^6.0.0, cross-spawn@npm:^6.0.5": - version: 6.0.5 - resolution: "cross-spawn@npm:6.0.5" + version: 6.0.6 + resolution: "cross-spawn@npm:6.0.6" dependencies: nice-try: ^1.0.4 path-key: ^2.0.1 semver: ^5.5.0 shebang-command: ^1.2.0 which: ^1.2.9 - checksum: f893bb0d96cd3d5751d04e67145bdddf25f99449531a72e82dcbbd42796bbc8268c1076c6b3ea51d4d455839902804b94bc45dfb37ecbb32ea8e54a6741c3ab9 + checksum: a6e2e5b04a0e0f806c1df45f92cd079b65f95fbe5a7650ee1ab60318c33a6c156a8a2f8b6898f57764f7363ec599a0625e9855dfa78d52d2d73dbd32eb11c25e languageName: node linkType: hard -"cross-spawn@npm:^7.0.0, cross-spawn@npm:^7.0.2": - version: 7.0.3 - resolution: "cross-spawn@npm:7.0.3" +"cross-spawn@npm:^7.0.0, cross-spawn@npm:^7.0.2, cross-spawn@npm:^7.0.6": + version: 7.0.6 + resolution: "cross-spawn@npm:7.0.6" dependencies: path-key: ^3.1.0 shebang-command: ^2.0.0 which: ^2.0.1 - checksum: 671cc7c7288c3a8406f3c69a3ae2fc85555c04169e9d611def9a675635472614f1c0ed0ef80955d5b6d4e724f6ced67f0ad1bb006c2ea643488fcfef994d7f52 + checksum: 8d306efacaf6f3f60e0224c287664093fa9185680b2d195852ba9a863f85d02dcc737094c6e512175f8ee0161f9b87c73c6826034c2422e39de7d6569cf4503b languageName: node linkType: hard @@ -5907,35 +5242,6 @@ __metadata: languageName: node linkType: hard -"crypto-browserify@npm:3.12.0": - version: 3.12.0 - resolution: "crypto-browserify@npm:3.12.0" - dependencies: - browserify-cipher: ^1.0.0 - browserify-sign: ^4.0.0 - create-ecdh: ^4.0.0 - create-hash: ^1.1.0 - create-hmac: ^1.1.0 - diffie-hellman: ^5.0.0 - inherits: ^2.0.1 - pbkdf2: ^3.0.3 - public-encrypt: ^4.0.0 - randombytes: ^2.0.0 - randomfill: ^1.0.3 - checksum: c1609af82605474262f3eaa07daa0b2140026bd264ab316d4bf1170272570dbe02f0c49e29407fe0d3634f96c507c27a19a6765fb856fed854a625f9d15618e2 - languageName: node - linkType: hard - -"d@npm:1, d@npm:^1.0.1, d@npm:^1.0.2": - version: 1.0.2 - resolution: "d@npm:1.0.2" - dependencies: - es5-ext: ^0.10.64 - type: ^2.7.2 - checksum: 775db1e8ced6707cddf64a5840522fcf5475d38ef49a5d615be0ac47f86ef64d15f5a73de1522b09327cc466d4dc35ea83dbfeed456f7a0fdcab138deb800355 - languageName: node - linkType: hard - "dashdash@npm:^1.12.0": version: 1.14.1 resolution: "dashdash@npm:1.14.1" @@ -5945,36 +5251,36 @@ __metadata: languageName: node linkType: hard -"data-view-buffer@npm:^1.0.1": - version: 1.0.1 - resolution: "data-view-buffer@npm:1.0.1" +"data-view-buffer@npm:^1.0.2": + version: 1.0.2 + resolution: "data-view-buffer@npm:1.0.2" dependencies: - call-bind: ^1.0.6 + call-bound: ^1.0.3 es-errors: ^1.3.0 - is-data-view: ^1.0.1 - checksum: ce24348f3c6231223b216da92e7e6a57a12b4af81a23f27eff8feabdf06acfb16c00639c8b705ca4d167f761cfc756e27e5f065d0a1f840c10b907fdaf8b988c + is-data-view: ^1.0.2 + checksum: 1e1cd509c3037ac0f8ba320da3d1f8bf1a9f09b0be09394b5e40781b8cc15ff9834967ba7c9f843a425b34f9fe14ce44cf055af6662c44263424c1eb8d65659b languageName: node linkType: hard -"data-view-byte-length@npm:^1.0.1": - version: 1.0.1 - resolution: "data-view-byte-length@npm:1.0.1" +"data-view-byte-length@npm:^1.0.2": + version: 1.0.2 + resolution: "data-view-byte-length@npm:1.0.2" dependencies: - call-bind: ^1.0.7 + call-bound: ^1.0.3 es-errors: ^1.3.0 - is-data-view: ^1.0.1 - checksum: dbb3200edcb7c1ef0d68979834f81d64fd8cab2f7691b3a4c6b97e67f22182f3ec2c8602efd7b76997b55af6ff8bce485829c1feda4fa2165a6b71fb7baa4269 + is-data-view: ^1.0.2 + checksum: 3600c91ced1cfa935f19ef2abae11029e01738de8d229354d3b2a172bf0d7e4ed08ff8f53294b715569fdf72dfeaa96aa7652f479c0f60570878d88e7e8bddf6 languageName: node linkType: hard -"data-view-byte-offset@npm:^1.0.0": - version: 1.0.0 - resolution: "data-view-byte-offset@npm:1.0.0" +"data-view-byte-offset@npm:^1.0.1": + version: 1.0.1 + resolution: "data-view-byte-offset@npm:1.0.1" dependencies: - call-bind: ^1.0.6 + call-bound: ^1.0.2 es-errors: ^1.3.0 is-data-view: ^1.0.1 - checksum: 7f0bf8720b7414ca719eedf1846aeec392f2054d7af707c5dc9a753cc77eb8625f067fa901e0b5127e831f9da9056138d894b9c2be79c27a21f6db5824f009c2 + checksum: 8dd492cd51d19970876626b5b5169fbb67ca31ec1d1d3238ee6a71820ca8b80cafb141c485999db1ee1ef02f2cc3b99424c5eda8d59e852d9ebb79ab290eb5ee languageName: node linkType: hard @@ -5985,45 +5291,24 @@ __metadata: languageName: node linkType: hard -"debug@npm:2.6.9, debug@npm:^2.2.0, debug@npm:^2.3.3, debug@npm:^2.6.8, debug@npm:^2.6.9": - version: 2.6.9 - resolution: "debug@npm:2.6.9" - dependencies: - ms: 2.0.0 - checksum: d2f51589ca66df60bf36e1fa6e4386b318c3f1e06772280eea5b1ae9fd3d05e9c2b7fd8a7d862457d00853c75b00451aa2d7459b924629ee385287a650f58fe6 - languageName: node - linkType: hard - -"debug@npm:3.2.6": - version: 3.2.6 - resolution: "debug@npm:3.2.6" - dependencies: - ms: ^2.1.1 - checksum: 07bc8b3a13ef3cfa6c06baf7871dfb174c291e5f85dbf566f086620c16b9c1a0e93bb8f1935ebbd07a683249e7e30286f2966e2ef461e8fd17b1b60732062d6b - languageName: node - linkType: hard - -"debug@npm:4, debug@npm:^4.0.1, debug@npm:^4.1.1, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4": - version: 4.3.5 - resolution: "debug@npm:4.3.5" +"debug@npm:4, debug@npm:^4.0.1, debug@npm:^4.1.1, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4, debug@npm:^4.3.5": + version: 4.4.0 + resolution: "debug@npm:4.4.0" dependencies: - ms: 2.1.2 + ms: ^2.1.3 peerDependenciesMeta: supports-color: optional: true - checksum: 7c002b51e256257f936dda09eb37167df952758c57badf6bf44bdc40b89a4bcb8e5a0a2e4c7b53f97c69e2970dd5272d33a757378a12c8f8e64ea7bf99e8e86e + checksum: fb42df878dd0e22816fc56e1fdca9da73caa85212fbe40c868b1295a6878f9101ae684f4eeef516c13acfc700f5ea07f1136954f43d4cd2d477a811144136479 languageName: node linkType: hard -"debug@npm:4.3.4": - version: 4.3.4 - resolution: "debug@npm:4.3.4" +"debug@npm:^2.2.0": + version: 2.6.9 + resolution: "debug@npm:2.6.9" dependencies: - ms: 2.1.2 - peerDependenciesMeta: - supports-color: - optional: true - checksum: 3dbad3f94ea64f34431a9cbf0bafb61853eda57bff2880036153438f50fb5a84f27683ba0d8e5426bf41a8c6ff03879488120cf5b3a761e77953169c0600a708 + ms: 2.0.0 + checksum: d2f51589ca66df60bf36e1fa6e4386b318c3f1e06772280eea5b1ae9fd3d05e9c2b7fd8a7d862457d00853c75b00451aa2d7459b924629ee385287a650f58fe6 languageName: node linkType: hard @@ -6036,7 +5321,7 @@ __metadata: languageName: node linkType: hard -"decamelize@npm:^1.1.1, decamelize@npm:^1.2.0": +"decamelize@npm:^1.2.0": version: 1.2.0 resolution: "decamelize@npm:1.2.0" checksum: ad8c51a7e7e0720c70ec2eeb1163b66da03e7616d7b98c9ef43cce2416395e84c1e9548dd94f5f6ffecfee9f8b94251fc57121a8b021f2ff2469b2bae247b8aa @@ -6050,31 +5335,6 @@ __metadata: languageName: node linkType: hard -"decode-uri-component@npm:^0.2.0": - version: 0.2.2 - resolution: "decode-uri-component@npm:0.2.2" - checksum: 95476a7d28f267292ce745eac3524a9079058bbb35767b76e3ee87d42e34cd0275d2eb19d9d08c3e167f97556e8a2872747f5e65cbebcac8b0c98d83e285f139 - languageName: node - linkType: hard - -"decompress-response@npm:^3.3.0": - version: 3.3.0 - resolution: "decompress-response@npm:3.3.0" - dependencies: - mimic-response: ^1.0.0 - checksum: 952552ac3bd7de2fc18015086b09468645c9638d98a551305e485230ada278c039c91116e946d07894b39ee53c0f0d5b6473f25a224029344354513b412d7380 - languageName: node - linkType: hard - -"decompress-response@npm:^6.0.0": - version: 6.0.0 - resolution: "decompress-response@npm:6.0.0" - dependencies: - mimic-response: ^3.1.0 - checksum: d377cf47e02d805e283866c3f50d3d21578b779731e8c5072d6ce8c13cc31493db1c2f6784da9d1d5250822120cefa44f1deab112d5981015f2e17444b763812 - languageName: node - linkType: hard - "deep-eql@npm:^4.0.1, deep-eql@npm:^4.1.3": version: 4.1.4 resolution: "deep-eql@npm:4.1.4" @@ -6084,20 +5344,6 @@ __metadata: languageName: node linkType: hard -"deep-equal@npm:~1.1.1": - version: 1.1.2 - resolution: "deep-equal@npm:1.1.2" - dependencies: - is-arguments: ^1.1.1 - is-date-object: ^1.0.5 - is-regex: ^1.1.4 - object-is: ^1.1.5 - object-keys: ^1.1.1 - regexp.prototype.flags: ^1.5.1 - checksum: 2d50f27fff785fb272cdef038ee5365ee5a30ab1aab053976e6a6add44cc60abd99b38179a46a01ac52c5e54ebb220e8f1a3a1954da20678b79c46ef4d97c9db - languageName: node - linkType: hard - "deep-extend@npm:~0.6.0": version: 0.6.0 resolution: "deep-extend@npm:0.6.0" @@ -6121,39 +5367,6 @@ __metadata: languageName: node linkType: hard -"defer-to-connect@npm:^1.0.1": - version: 1.1.3 - resolution: "defer-to-connect@npm:1.1.3" - checksum: 9491b301dcfa04956f989481ba7a43c2231044206269eb4ab64a52d6639ee15b1252262a789eb4239fb46ab63e44d4e408641bae8e0793d640aee55398cb3930 - languageName: node - linkType: hard - -"defer-to-connect@npm:^2.0.0": - version: 2.0.1 - resolution: "defer-to-connect@npm:2.0.1" - checksum: 8a9b50d2f25446c0bfefb55a48e90afd58f85b21bcf78e9207cd7b804354f6409032a1705c2491686e202e64fc05f147aa5aa45f9aa82627563f045937f5791b - languageName: node - linkType: hard - -"deferred-leveldown@npm:~1.2.1": - version: 1.2.2 - resolution: "deferred-leveldown@npm:1.2.2" - dependencies: - abstract-leveldown: ~2.6.0 - checksum: ad3a26d20dc80c702c85c4795cbb52ef25d8e500728c98098b468c499ca745051e6cc03bd12be97ff38c43466a7895879db76ffb761a75b0f009829d990a0ea9 - languageName: node - linkType: hard - -"deferred-leveldown@npm:~4.0.0": - version: 4.0.2 - resolution: "deferred-leveldown@npm:4.0.2" - dependencies: - abstract-leveldown: ~5.0.0 - inherits: ^2.0.3 - checksum: 6b3649bbb7a2617e08eecdddb516d0bde215bd376a37089df203ad78627f59c424c785afbcbfd3e53488d4f9e5d27d9d126d5645b7da53e8760cc34df2d2f13e - languageName: node - linkType: hard - "deferred-leveldown@npm:~5.3.0": version: 5.3.0 resolution: "deferred-leveldown@npm:5.3.0" @@ -6164,7 +5377,7 @@ __metadata: languageName: node linkType: hard -"define-data-property@npm:^1.0.1, define-data-property@npm:^1.1.1, define-data-property@npm:^1.1.4": +"define-data-property@npm:^1.0.1, define-data-property@npm:^1.1.4": version: 1.1.4 resolution: "define-data-property@npm:1.1.4" dependencies: @@ -6175,7 +5388,7 @@ __metadata: languageName: node linkType: hard -"define-properties@npm:^1.2.0, define-properties@npm:^1.2.1": +"define-properties@npm:^1.2.1": version: 1.2.1 resolution: "define-properties@npm:1.2.1" dependencies: @@ -6186,41 +5399,6 @@ __metadata: languageName: node linkType: hard -"define-property@npm:^0.2.5": - version: 0.2.5 - resolution: "define-property@npm:0.2.5" - dependencies: - is-descriptor: ^0.1.0 - checksum: 85af107072b04973b13f9e4128ab74ddfda48ec7ad2e54b193c0ffb57067c4ce5b7786a7b4ae1f24bd03e87c5d18766b094571810b314d7540f86d4354dbd394 - languageName: node - linkType: hard - -"define-property@npm:^1.0.0": - version: 1.0.0 - resolution: "define-property@npm:1.0.0" - dependencies: - is-descriptor: ^1.0.0 - checksum: 5fbed11dace44dd22914035ba9ae83ad06008532ca814d7936a53a09e897838acdad5b108dd0688cc8d2a7cf0681acbe00ee4136cf36743f680d10517379350a - languageName: node - linkType: hard - -"define-property@npm:^2.0.2": - version: 2.0.2 - resolution: "define-property@npm:2.0.2" - dependencies: - is-descriptor: ^1.0.2 - isobject: ^3.0.1 - checksum: 3217ed53fc9eed06ba8da6f4d33e28c68a82e2f2a8ab4d562c4920d8169a166fe7271453675e6c69301466f36a65d7f47edf0cf7f474b9aa52a5ead9c1b13c99 - languageName: node - linkType: hard - -"defined@npm:~1.0.1": - version: 1.0.1 - resolution: "defined@npm:1.0.1" - checksum: b1a852300bdb57f297289b55eafdd0c517afaa3ec8190e78fce91b9d8d0c0369d4505ecbdacfd3d98372e664f4a267d9bd793938d4a8c76209c9d9516fbe2101 - languageName: node - linkType: hard - "delay@npm:^5.0.0": version: 5.0.0 resolution: "delay@npm:5.0.0" @@ -6242,39 +5420,6 @@ __metadata: languageName: node linkType: hard -"des.js@npm:^1.0.0": - version: 1.1.0 - resolution: "des.js@npm:1.1.0" - dependencies: - inherits: ^2.0.1 - minimalistic-assert: ^1.0.0 - checksum: 0e9c1584b70d31e20f20a613fc9ef60fbc6a147dfec9e448a168794a4b97ac04d8dc47ea008f1fa93b0f8aaf7c1ead632a5e59ce1913a6079d2d244c9f5ebe33 - languageName: node - linkType: hard - -"destroy@npm:1.2.0": - version: 1.2.0 - resolution: "destroy@npm:1.2.0" - checksum: 0acb300b7478a08b92d810ab229d5afe0d2f4399272045ab22affa0d99dbaf12637659411530a6fcd597a9bdac718fc94373a61a95b4651bbc7b83684a565e38 - languageName: node - linkType: hard - -"detect-indent@npm:^4.0.0": - version: 4.0.0 - resolution: "detect-indent@npm:4.0.0" - dependencies: - repeating: ^2.0.0 - checksum: 328f273915c1610899bc7d4784ce874413d0a698346364cd3ee5d79afba1c5cf4dbc97b85a801e20f4d903c0598bd5096af32b800dfb8696b81464ccb3dfda2c - languageName: node - linkType: hard - -"diff@npm:5.0.0": - version: 5.0.0 - resolution: "diff@npm:5.0.0" - checksum: f19fe29284b633afdb2725c2a8bb7d25761ea54d321d8e67987ac851c5294be4afeab532bd84531e02583a3fe7f4014aa314a3eda84f5590e7a9e6b371ef3b46 - languageName: node - linkType: hard - "diff@npm:^4.0.1": version: 4.0.2 resolution: "diff@npm:4.0.2" @@ -6282,24 +5427,13 @@ __metadata: languageName: node linkType: hard -"diff@npm:^5.0.0": +"diff@npm:^5.2.0": version: 5.2.0 resolution: "diff@npm:5.2.0" checksum: 12b63ca9c36c72bafa3effa77121f0581b4015df18bc16bac1f8e263597735649f1a173c26f7eba17fb4162b073fee61788abe49610e6c70a2641fe1895443fd languageName: node linkType: hard -"diffie-hellman@npm:^5.0.0": - version: 5.0.3 - resolution: "diffie-hellman@npm:5.0.3" - dependencies: - bn.js: ^4.1.0 - miller-rabin: ^4.0.0 - randombytes: ^2.0.0 - checksum: 0e620f322170c41076e70181dd1c24e23b08b47dbb92a22a644f3b89b6d3834b0f8ee19e37916164e5eb1ee26d2aa836d6129f92723995267250a0b541811065 - languageName: node - linkType: hard - "difflib@npm:^0.2.4": version: 0.2.4 resolution: "difflib@npm:0.2.4" @@ -6379,35 +5513,21 @@ __metadata: languageName: node linkType: hard -"dom-walk@npm:^0.1.0": - version: 0.1.2 - resolution: "dom-walk@npm:0.1.2" - checksum: 19eb0ce9c6de39d5e231530685248545d9cd2bd97b2cb3486e0bfc0f2a393a9addddfd5557463a932b52fdfcf68ad2a619020cd2c74a5fe46fbecaa8e80872f3 - languageName: node - linkType: hard - "dotenv@npm:^16.0.1": - version: 16.4.5 - resolution: "dotenv@npm:16.4.5" - checksum: 301a12c3d44fd49888b74eb9ccf9f07a1f5df43f489e7fcb89647a2edcd84c42d6bc349dc8df099cd18f07c35c7b04685c1a4f3e6a6a9e6b30f8d48c15b7f49c + version: 16.5.0 + resolution: "dotenv@npm:16.5.0" + checksum: 6543fe87b5ddf2d60dd42df6616eec99148a5fc150cb4530fef5bda655db5204a3afa0e6f25f7cd64b20657ace4d79c0ef974bec32fdb462cad18754191e7a90 languageName: node linkType: hard -"dotignore@npm:~0.1.2": - version: 0.1.2 - resolution: "dotignore@npm:0.1.2" +"dunder-proto@npm:^1.0.0, dunder-proto@npm:^1.0.1": + version: 1.0.1 + resolution: "dunder-proto@npm:1.0.1" dependencies: - minimatch: ^3.0.4 - bin: - ignored: bin/ignored - checksum: 06bab15e2a2400c6f823a0edbcd73661180f6245a4041a3fe3b9fde4b22ae74b896604df4520a877093f05c656bd080087376c9f605bccdea847664c59910f37 - languageName: node - linkType: hard - -"duplexer3@npm:^0.1.4": - version: 0.1.5 - resolution: "duplexer3@npm:0.1.5" - checksum: e677cb4c48f031ca728601d6a20bf6aed4c629d69ef9643cb89c67583d673c4ec9317cc6427501f38bd8c368d3a18f173987cc02bd99d8cf8fe3d94259a22a20 + call-bind-apply-helpers: ^1.0.1 + es-errors: ^1.3.0 + gopd: ^1.2.0 + checksum: 149207e36f07bd4941921b0ca929e3a28f1da7bd6b6ff8ff7f4e2f2e460675af4576eeba359c635723dc189b64cdd4787e0255897d5b135ccc5d15cb8685fc90 languageName: node linkType: hard @@ -6428,13 +5548,6 @@ __metadata: languageName: node linkType: hard -"ee-first@npm:1.1.1": - version: 1.1.1 - resolution: "ee-first@npm:1.1.1" - checksum: 1b4cac778d64ce3b582a7e26b218afe07e207a0f9bfe13cc7395a6d307849cfe361e65033c3251e00c27dd060cab43014c2d6b2647676135e18b77d2d05b3f4f - languageName: node - linkType: hard - "ejs@npm:^2.6.1": version: 2.7.4 resolution: "ejs@npm:2.7.4" @@ -6451,31 +5564,9 @@ __metadata: languageName: node linkType: hard -"electron-to-chromium@npm:^1.3.47": - version: 1.4.815 - resolution: "electron-to-chromium@npm:1.4.815" - checksum: 049fa7eb0c9e46522bfe0cd7d025011987dbd0ac2b7418793786c6a6043af55f4f80556ede6bf0447643b274f622d69833e4557814bd2d98ce31129a6eb01afa - languageName: node - linkType: hard - -"elliptic@npm:6.5.4": - version: 6.5.4 - resolution: "elliptic@npm:6.5.4" - dependencies: - bn.js: ^4.11.9 - brorand: ^1.1.0 - hash.js: ^1.0.0 - hmac-drbg: ^1.0.1 - inherits: ^2.0.4 - minimalistic-assert: ^1.0.1 - minimalistic-crypto-utils: ^1.0.1 - checksum: d56d21fd04e97869f7ffcc92e18903b9f67f2d4637a23c860492fbbff5a3155fd9ca0184ce0c865dd6eb2487d234ce9551335c021c376cd2d3b7cb749c7d10f4 - languageName: node - linkType: hard - -"elliptic@npm:^6.4.0, elliptic@npm:^6.5.2, elliptic@npm:^6.5.3, elliptic@npm:^6.5.4, elliptic@npm:^6.5.5": - version: 6.5.5 - resolution: "elliptic@npm:6.5.5" +"elliptic@npm:6.6.1, elliptic@npm:^6.5.2, elliptic@npm:^6.5.4, elliptic@npm:^6.5.7": + version: 6.6.1 + resolution: "elliptic@npm:6.6.1" dependencies: bn.js: ^4.11.9 brorand: ^1.1.0 @@ -6484,7 +5575,7 @@ __metadata: inherits: ^2.0.4 minimalistic-assert: ^1.0.1 minimalistic-crypto-utils: ^1.0.1 - checksum: ec9105e4469eb3b32b0ee2579756c888ddf3f99d259aa0d65fccb906ee877768aaf8880caae73e3e669c9a4adeb3eb1945703aa974ec5000d2d33a239f4567eb + checksum: 27b14a52f68bbbc0720da259f712cb73e953f6d2047958cd02fb0d0ade2e83849dc39fb4af630889c67df8817e24237428cf59c4f4c07700f755b401149a7375 languageName: node linkType: hard @@ -6516,26 +5607,6 @@ __metadata: languageName: node linkType: hard -"encodeurl@npm:~1.0.2": - version: 1.0.2 - resolution: "encodeurl@npm:1.0.2" - checksum: e50e3d508cdd9c4565ba72d2012e65038e5d71bdc9198cb125beb6237b5b1ade6c0d343998da9e170fb2eae52c1bed37d4d6d98a46ea423a0cddbed5ac3f780c - languageName: node - linkType: hard - -"encoding-down@npm:5.0.4, encoding-down@npm:~5.0.0": - version: 5.0.4 - resolution: "encoding-down@npm:5.0.4" - dependencies: - abstract-leveldown: ^5.0.0 - inherits: ^2.0.3 - level-codec: ^9.0.0 - level-errors: ^2.0.0 - xtend: ^4.0.1 - checksum: b8d9d4b058622c11e33d8ec0fb6432194925e109ed8e44e93555406496e8b77b294c8c338dd5ed9ab8d7bc50250a48bb93f9af62ecee3ce8d82f4ef78b2ca880 - languageName: node - linkType: hard - "encoding-down@npm:^6.3.0": version: 6.3.0 resolution: "encoding-down@npm:6.3.0" @@ -6548,7 +5619,7 @@ __metadata: languageName: node linkType: hard -"encoding@npm:^0.1.11, encoding@npm:^0.1.13": +"encoding@npm:^0.1.13": version: 0.1.13 resolution: "encoding@npm:0.1.13" dependencies: @@ -6617,7 +5688,7 @@ __metadata: languageName: node linkType: hard -"error-ex@npm:^1.2.0, error-ex@npm:^1.3.1": +"error-ex@npm:^1.3.1": version: 1.3.2 resolution: "error-ex@npm:1.3.2" dependencies: @@ -6626,143 +5697,117 @@ __metadata: languageName: node linkType: hard -"es-abstract@npm:^1.22.1, es-abstract@npm:^1.22.3, es-abstract@npm:^1.23.0, es-abstract@npm:^1.23.2": - version: 1.23.3 - resolution: "es-abstract@npm:1.23.3" +"es-abstract@npm:^1.23.2, es-abstract@npm:^1.23.5, es-abstract@npm:^1.23.9": + version: 1.23.9 + resolution: "es-abstract@npm:1.23.9" dependencies: - array-buffer-byte-length: ^1.0.1 - arraybuffer.prototype.slice: ^1.0.3 + array-buffer-byte-length: ^1.0.2 + arraybuffer.prototype.slice: ^1.0.4 available-typed-arrays: ^1.0.7 - call-bind: ^1.0.7 - data-view-buffer: ^1.0.1 - data-view-byte-length: ^1.0.1 - data-view-byte-offset: ^1.0.0 - es-define-property: ^1.0.0 + call-bind: ^1.0.8 + call-bound: ^1.0.3 + data-view-buffer: ^1.0.2 + data-view-byte-length: ^1.0.2 + data-view-byte-offset: ^1.0.1 + es-define-property: ^1.0.1 es-errors: ^1.3.0 es-object-atoms: ^1.0.0 - es-set-tostringtag: ^2.0.3 - es-to-primitive: ^1.2.1 - function.prototype.name: ^1.1.6 - get-intrinsic: ^1.2.4 - get-symbol-description: ^1.0.2 - globalthis: ^1.0.3 - gopd: ^1.0.1 + es-set-tostringtag: ^2.1.0 + es-to-primitive: ^1.3.0 + function.prototype.name: ^1.1.8 + get-intrinsic: ^1.2.7 + get-proto: ^1.0.0 + get-symbol-description: ^1.1.0 + globalthis: ^1.0.4 + gopd: ^1.2.0 has-property-descriptors: ^1.0.2 - has-proto: ^1.0.3 - has-symbols: ^1.0.3 + has-proto: ^1.2.0 + has-symbols: ^1.1.0 hasown: ^2.0.2 - internal-slot: ^1.0.7 - is-array-buffer: ^3.0.4 + internal-slot: ^1.1.0 + is-array-buffer: ^3.0.5 is-callable: ^1.2.7 - is-data-view: ^1.0.1 - is-negative-zero: ^2.0.3 - is-regex: ^1.1.4 - is-shared-array-buffer: ^1.0.3 - is-string: ^1.0.7 - is-typed-array: ^1.1.13 - is-weakref: ^1.0.2 - object-inspect: ^1.13.1 + is-data-view: ^1.0.2 + is-regex: ^1.2.1 + is-shared-array-buffer: ^1.0.4 + is-string: ^1.1.1 + is-typed-array: ^1.1.15 + is-weakref: ^1.1.0 + math-intrinsics: ^1.1.0 + object-inspect: ^1.13.3 object-keys: ^1.1.1 - object.assign: ^4.1.5 - regexp.prototype.flags: ^1.5.2 - safe-array-concat: ^1.1.2 - safe-regex-test: ^1.0.3 - string.prototype.trim: ^1.2.9 - string.prototype.trimend: ^1.0.8 + object.assign: ^4.1.7 + own-keys: ^1.0.1 + regexp.prototype.flags: ^1.5.3 + safe-array-concat: ^1.1.3 + safe-push-apply: ^1.0.0 + safe-regex-test: ^1.1.0 + set-proto: ^1.0.0 + string.prototype.trim: ^1.2.10 + string.prototype.trimend: ^1.0.9 string.prototype.trimstart: ^1.0.8 - typed-array-buffer: ^1.0.2 - typed-array-byte-length: ^1.0.1 - typed-array-byte-offset: ^1.0.2 - typed-array-length: ^1.0.6 - unbox-primitive: ^1.0.2 - which-typed-array: ^1.1.15 - checksum: f840cf161224252512f9527306b57117192696571e07920f777cb893454e32999206198b4f075516112af6459daca282826d1735c450528470356d09eff3a9ae - languageName: node - linkType: hard - -"es-array-method-boxes-properly@npm:^1.0.0": - version: 1.0.0 - resolution: "es-array-method-boxes-properly@npm:1.0.0" - checksum: 2537fcd1cecf187083890bc6f5236d3a26bf39237433587e5bf63392e88faae929dbba78ff0120681a3f6f81c23fe3816122982c160d63b38c95c830b633b826 + typed-array-buffer: ^1.0.3 + typed-array-byte-length: ^1.0.3 + typed-array-byte-offset: ^1.0.4 + typed-array-length: ^1.0.7 + unbox-primitive: ^1.1.0 + which-typed-array: ^1.1.18 + checksum: f3ee2614159ca197f97414ab36e3f406ee748ce2f97ffbf09e420726db5a442ce13f1e574601468bff6e6eb81588e6c9ce1ac6c03868a37c7cd48ac679f8485a languageName: node linkType: hard -"es-define-property@npm:^1.0.0": - version: 1.0.0 - resolution: "es-define-property@npm:1.0.0" - dependencies: - get-intrinsic: ^1.2.4 - checksum: f66ece0a887b6dca71848fa71f70461357c0e4e7249696f81bad0a1f347eed7b31262af4a29f5d726dc026426f085483b6b90301855e647aa8e21936f07293c6 +"es-define-property@npm:^1.0.0, es-define-property@npm:^1.0.1": + version: 1.0.1 + resolution: "es-define-property@npm:1.0.1" + checksum: 0512f4e5d564021c9e3a644437b0155af2679d10d80f21adaf868e64d30efdfbd321631956f20f42d655fedb2e3a027da479fad3fa6048f768eb453a80a5f80a languageName: node linkType: hard -"es-errors@npm:^1.2.1, es-errors@npm:^1.3.0": +"es-errors@npm:^1.3.0": version: 1.3.0 resolution: "es-errors@npm:1.3.0" checksum: ec1414527a0ccacd7f15f4a3bc66e215f04f595ba23ca75cdae0927af099b5ec865f9f4d33e9d7e86f512f252876ac77d4281a7871531a50678132429b1271b5 languageName: node linkType: hard -"es-object-atoms@npm:^1.0.0": - version: 1.0.0 - resolution: "es-object-atoms@npm:1.0.0" +"es-object-atoms@npm:^1.0.0, es-object-atoms@npm:^1.1.1": + version: 1.1.1 + resolution: "es-object-atoms@npm:1.1.1" dependencies: es-errors: ^1.3.0 - checksum: 26f0ff78ab93b63394e8403c353842b2272836968de4eafe97656adfb8a7c84b9099bf0fe96ed58f4a4cddc860f6e34c77f91649a58a5daa4a9c40b902744e3c + checksum: 214d3767287b12f36d3d7267ef342bbbe1e89f899cfd67040309fc65032372a8e60201410a99a1645f2f90c1912c8c49c8668066f6bdd954bcd614dda2e3da97 languageName: node linkType: hard -"es-set-tostringtag@npm:^2.0.3": - version: 2.0.3 - resolution: "es-set-tostringtag@npm:2.0.3" +"es-set-tostringtag@npm:^2.1.0": + version: 2.1.0 + resolution: "es-set-tostringtag@npm:2.1.0" dependencies: - get-intrinsic: ^1.2.4 + es-errors: ^1.3.0 + get-intrinsic: ^1.2.6 has-tostringtag: ^1.0.2 - hasown: ^2.0.1 - checksum: 7227fa48a41c0ce83e0377b11130d324ac797390688135b8da5c28994c0165be8b252e15cd1de41e1325e5a5412511586960213e88f9ab4a5e7d028895db5129 - languageName: node - linkType: hard - -"es-shim-unscopables@npm:^1.0.0, es-shim-unscopables@npm:^1.0.2": - version: 1.0.2 - resolution: "es-shim-unscopables@npm:1.0.2" - dependencies: - hasown: ^2.0.0 - checksum: 432bd527c62065da09ed1d37a3f8e623c423683285e6188108286f4a1e8e164a5bcbfbc0051557c7d14633cd2a41ce24c7048e6bbb66a985413fd32f1be72626 - languageName: node - linkType: hard - -"es-to-primitive@npm:^1.2.1": - version: 1.2.1 - resolution: "es-to-primitive@npm:1.2.1" - dependencies: - is-callable: ^1.1.4 - is-date-object: ^1.0.1 - is-symbol: ^1.0.2 - checksum: 4ead6671a2c1402619bdd77f3503991232ca15e17e46222b0a41a5d81aebc8740a77822f5b3c965008e631153e9ef0580540007744521e72de8e33599fca2eed + hasown: ^2.0.2 + checksum: 789f35de4be3dc8d11fdcb91bc26af4ae3e6d602caa93299a8c45cf05d36cc5081454ae2a6d3afa09cceca214b76c046e4f8151e092e6fc7feeb5efb9e794fc6 languageName: node linkType: hard -"es5-ext@npm:^0.10.35, es5-ext@npm:^0.10.50, es5-ext@npm:^0.10.62, es5-ext@npm:^0.10.63, es5-ext@npm:^0.10.64, es5-ext@npm:~0.10.14": - version: 0.10.64 - resolution: "es5-ext@npm:0.10.64" +"es-shim-unscopables@npm:^1.0.2, es-shim-unscopables@npm:^1.1.0": + version: 1.1.0 + resolution: "es-shim-unscopables@npm:1.1.0" dependencies: - es6-iterator: ^2.0.3 - es6-symbol: ^3.1.3 - esniff: ^2.0.1 - next-tick: ^1.1.0 - checksum: 01179fab0769fdbef213062222f99d0346724dbaccf04b87c0e6ee7f0c97edabf14be647ca1321f0497425ea7145de0fd278d1b3f3478864b8933e7136a5c645 + hasown: ^2.0.2 + checksum: 33cfb1ebcb2f869f0bf528be1a8660b4fe8b6cec8fc641f330e508db2284b58ee2980fad6d0828882d22858c759c0806076427a3673b6daa60f753e3b558ee15 languageName: node linkType: hard -"es6-iterator@npm:^2.0.3": - version: 2.0.3 - resolution: "es6-iterator@npm:2.0.3" +"es-to-primitive@npm:^1.3.0": + version: 1.3.0 + resolution: "es-to-primitive@npm:1.3.0" dependencies: - d: 1 - es5-ext: ^0.10.35 - es6-symbol: ^3.1.1 - checksum: 6e48b1c2d962c21dee604b3d9f0bc3889f11ed5a8b33689155a2065d20e3107e2a69cc63a71bd125aeee3a589182f8bbcb5c8a05b6a8f38fa4205671b6d09697 + is-callable: ^1.2.7 + is-date-object: ^1.0.5 + is-symbol: ^1.0.4 + checksum: 966965880356486cd4d1fe9a523deda2084c81b3702d951212c098f5f2ee93605d1b7c1840062efb48a07d892641c7ed1bc194db563645c0dd2b919cb6d65b93 languageName: node linkType: hard @@ -6782,44 +5827,27 @@ __metadata: languageName: node linkType: hard -"es6-symbol@npm:^3.1.1, es6-symbol@npm:^3.1.3": - version: 3.1.4 - resolution: "es6-symbol@npm:3.1.4" - dependencies: - d: ^1.0.2 - ext: ^1.7.0 - checksum: 52125ec4b5d1b6b93b8d3d42830bb19f8da21080ffcf45253b614bc6ff3e31349be202fb745d4d1af6778cdf5e38fea30e0c7e7dc37e2aecd44acc43502055f9 - languageName: node - linkType: hard - "escalade@npm:^3.1.1": - version: 3.1.2 - resolution: "escalade@npm:3.1.2" - checksum: 1ec0977aa2772075493002bdbd549d595ff6e9393b1cb0d7d6fcaf78c750da0c158f180938365486f75cb69fba20294351caddfce1b46552a7b6c3cde52eaa02 + version: 3.2.0 + resolution: "escalade@npm:3.2.0" + checksum: 47b029c83de01b0d17ad99ed766347b974b0d628e848de404018f3abee728e987da0d2d370ad4574aa3d5b5bfc368754fd085d69a30f8e75903486ec4b5b709e languageName: node linkType: hard -"escape-html@npm:~1.0.3": - version: 1.0.3 - resolution: "escape-html@npm:1.0.3" - checksum: 6213ca9ae00d0ab8bccb6d8d4e0a98e76237b2410302cf7df70aaa6591d509a2a37ce8998008cbecae8fc8ffaadf3fb0229535e6a145f3ce0b211d060decbb24 +"escape-string-regexp@npm:^1.0.5": + version: 1.0.5 + resolution: "escape-string-regexp@npm:1.0.5" + checksum: 6092fda75c63b110c706b6a9bfde8a612ad595b628f0bd2147eea1d3406723020810e591effc7db1da91d80a71a737a313567c5abb3813e8d9c71f4aa595b410 languageName: node linkType: hard -"escape-string-regexp@npm:4.0.0, escape-string-regexp@npm:^4.0.0": +"escape-string-regexp@npm:^4.0.0": version: 4.0.0 resolution: "escape-string-regexp@npm:4.0.0" checksum: 98b48897d93060f2322108bf29db0feba7dd774be96cd069458d1453347b25ce8682ecc39859d4bca2203cc0ab19c237bcc71755eff49a0f8d90beadeeba5cc5 languageName: node linkType: hard -"escape-string-regexp@npm:^1.0.2, escape-string-regexp@npm:^1.0.5": - version: 1.0.5 - resolution: "escape-string-regexp@npm:1.0.5" - checksum: 6092fda75c63b110c706b6a9bfde8a612ad595b628f0bd2147eea1d3406723020810e591effc7db1da91d80a71a737a313567c5abb3813e8d9c71f4aa595b410 - languageName: node - linkType: hard - "escodegen@npm:1.8.x": version: 1.8.1 resolution: "escodegen@npm:1.8.1" @@ -6886,15 +5914,15 @@ __metadata: languageName: node linkType: hard -"eslint-module-utils@npm:^2.8.0": - version: 2.8.1 - resolution: "eslint-module-utils@npm:2.8.1" +"eslint-module-utils@npm:^2.12.0": + version: 2.12.0 + resolution: "eslint-module-utils@npm:2.12.0" dependencies: debug: ^3.2.7 peerDependenciesMeta: eslint: optional: true - checksum: 3cecd99b6baf45ffc269167da0f95dcb75e5aa67b93d73a3bab63e2a7eedd9cdd6f188eed048e2f57c1b77db82c9cbf2adac20b512fa70e597d863dd3720170d + checksum: be3ac52e0971c6f46daeb1a7e760e45c7c45f820c8cc211799f85f10f04ccbf7afc17039165d56cb2da7f7ca9cec2b3a777013cddf0b976784b37eb9efa24180 languageName: node linkType: hard @@ -6923,29 +5951,31 @@ __metadata: linkType: hard "eslint-plugin-import@npm:^2.26.0": - version: 2.29.1 - resolution: "eslint-plugin-import@npm:2.29.1" + version: 2.31.0 + resolution: "eslint-plugin-import@npm:2.31.0" dependencies: - array-includes: ^3.1.7 - array.prototype.findlastindex: ^1.2.3 + "@rtsao/scc": ^1.1.0 + array-includes: ^3.1.8 + array.prototype.findlastindex: ^1.2.5 array.prototype.flat: ^1.3.2 array.prototype.flatmap: ^1.3.2 debug: ^3.2.7 doctrine: ^2.1.0 eslint-import-resolver-node: ^0.3.9 - eslint-module-utils: ^2.8.0 - hasown: ^2.0.0 - is-core-module: ^2.13.1 + eslint-module-utils: ^2.12.0 + hasown: ^2.0.2 + is-core-module: ^2.15.1 is-glob: ^4.0.3 minimatch: ^3.1.2 - object.fromentries: ^2.0.7 - object.groupby: ^1.0.1 - object.values: ^1.1.7 + object.fromentries: ^2.0.8 + object.groupby: ^1.0.3 + object.values: ^1.2.0 semver: ^6.3.1 + string.prototype.trimend: ^1.0.8 tsconfig-paths: ^3.15.0 peerDependencies: - eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 - checksum: e65159aef808136d26d029b71c8c6e4cb5c628e65e5de77f1eb4c13a379315ae55c9c3afa847f43f4ff9df7e54515c77ffc6489c6a6f81f7dd7359267577468c + eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 || ^9 + checksum: b1d2ac268b3582ff1af2a72a2c476eae4d250c100f2e335b6e102036e4a35efa530b80ec578dfc36761fabb34a635b9bf5ab071abe9d4404a4bb054fdf22d415 languageName: node linkType: hard @@ -6968,9 +5998,9 @@ __metadata: linkType: hard "eslint-plugin-no-only-tests@npm:^3.1.0": - version: 3.1.0 - resolution: "eslint-plugin-no-only-tests@npm:3.1.0" - checksum: 2a5de82f3a732dbd46792661dd0f8546cf819f76d8828968166dee35741e8039904ba473dafe1eed585f401a496d260c2c38354bb887c94bd4ced0ddca00fb62 + version: 3.3.0 + resolution: "eslint-plugin-no-only-tests@npm:3.3.0" + checksum: 1b3a88e392113240758405966047ef40dd742fbd828f3c8d02a207125edaa5303ef9a0319a778551bd88789110423221fff4e9db02896c20836389b13c27b32e languageName: node linkType: hard @@ -7006,11 +6036,11 @@ __metadata: linkType: hard "eslint-plugin-promise@npm:^6.0.0": - version: 6.4.0 - resolution: "eslint-plugin-promise@npm:6.4.0" + version: 6.6.0 + resolution: "eslint-plugin-promise@npm:6.6.0" peerDependencies: eslint: ^7.0.0 || ^8.0.0 || ^9.0.0 - checksum: cf22ee739aa58a79b7ab8c8be7604dd64f96dee353346556cf04168fcd4f28657bc23ef02e1264a35ffe43bc00ff171c90d720ce9800c68a496d13687d6c02d7 + checksum: 5098fbf38585ad411737c389c462df72b11a7db2f0241eca23cf990e5535a2de3fac7fb24258c3e6bf05433ef2a59425ec1ca1cef456360614eb7cdbfefcec66 languageName: node linkType: hard @@ -7154,14 +6184,14 @@ __metadata: linkType: hard "eslint@npm:^8.20.0": - version: 8.57.0 - resolution: "eslint@npm:8.57.0" + version: 8.57.1 + resolution: "eslint@npm:8.57.1" dependencies: "@eslint-community/eslint-utils": ^4.2.0 "@eslint-community/regexpp": ^4.6.1 "@eslint/eslintrc": ^2.1.4 - "@eslint/js": 8.57.0 - "@humanwhocodes/config-array": ^0.11.14 + "@eslint/js": 8.57.1 + "@humanwhocodes/config-array": ^0.13.0 "@humanwhocodes/module-importer": ^1.0.1 "@nodelib/fs.walk": ^1.2.8 "@ungap/structured-clone": ^1.2.0 @@ -7197,19 +6227,7 @@ __metadata: text-table: ^0.2.0 bin: eslint: bin/eslint.js - checksum: 3a48d7ff85ab420a8447e9810d8087aea5b1df9ef68c9151732b478de698389ee656fd895635b5f2871c89ee5a2652b3f343d11e9db6f8486880374ebc74a2d9 - languageName: node - linkType: hard - -"esniff@npm:^2.0.1": - version: 2.0.1 - resolution: "esniff@npm:2.0.1" - dependencies: - d: ^1.0.1 - es5-ext: ^0.10.62 - event-emitter: ^0.3.5 - type: ^2.7.2 - checksum: d814c0e5c39bce9925b2e65b6d8767af72c9b54f35a65f9f3d6e8c606dce9aebe35a9599d30f15b0807743f88689f445163cfb577a425de4fb8c3c5bc16710cc + checksum: e2489bb7f86dd2011967759a09164e65744ef7688c310bc990612fc26953f34cc391872807486b15c06833bdff737726a23e9b4cdba5de144c311377dc41d91b languageName: node linkType: hard @@ -7256,11 +6274,11 @@ __metadata: linkType: hard "esquery@npm:^1.0.1, esquery@npm:^1.4.2": - version: 1.5.0 - resolution: "esquery@npm:1.5.0" + version: 1.6.0 + resolution: "esquery@npm:1.6.0" dependencies: estraverse: ^5.1.0 - checksum: aefb0d2596c230118656cd4ec7532d447333a410a48834d80ea648b1e7b5c9bc9ed8b5e33a89cb04e487b60d622f44cf5713bf4abed7c97343edefdc84a35900 + checksum: 08ec4fe446d9ab27186da274d979558557fbdbbd10968fa9758552482720c54152a5640e08b9009e5a30706b66aba510692054d4129d32d0e12e05bbc0b96fb2 languageName: node linkType: hard @@ -7301,210 +6319,16 @@ __metadata: languageName: node linkType: hard -"etag@npm:~1.8.1": - version: 1.8.1 - resolution: "etag@npm:1.8.1" - checksum: 571aeb3dbe0f2bbd4e4fadbdb44f325fc75335cd5f6f6b6a091e6a06a9f25ed5392f0863c5442acb0646787446e816f13cbfc6edce5b07658541dff573cab1ff - languageName: node - linkType: hard - -"eth-block-tracker@npm:^3.0.0": - version: 3.0.1 - resolution: "eth-block-tracker@npm:3.0.1" - dependencies: - eth-query: ^2.1.0 - ethereumjs-tx: ^1.3.3 - ethereumjs-util: ^5.1.3 - ethjs-util: ^0.1.3 - json-rpc-engine: ^3.6.0 - pify: ^2.3.0 - tape: ^4.6.3 - checksum: b68dda7a60e2c15fa7097f31277ebfce08852de83229c2c65879a5482db28610bc85248cfe6578971ad2357552d5ce6124fb0c2a29d18fd30c70f092beeda3b8 - languageName: node - linkType: hard - -"eth-ens-namehash@npm:2.0.8, eth-ens-namehash@npm:^2.0.8": - version: 2.0.8 - resolution: "eth-ens-namehash@npm:2.0.8" - dependencies: - idna-uts46-hx: ^2.3.1 - js-sha3: ^0.5.7 - checksum: 40ce4aeedaa4e7eb4485c8d8857457ecc46a4652396981d21b7e3a5f922d5beff63c71cb4b283c935293e530eba50b329d9248be3c433949c6bc40c850c202a3 - languageName: node - linkType: hard - -"eth-gas-reporter@npm:^0.2.25": - version: 0.2.27 - resolution: "eth-gas-reporter@npm:0.2.27" - dependencies: - "@solidity-parser/parser": ^0.14.0 - axios: ^1.5.1 - cli-table3: ^0.5.0 - colors: 1.4.0 - ethereum-cryptography: ^1.0.3 - ethers: ^5.7.2 - fs-readdir-recursive: ^1.1.0 - lodash: ^4.17.14 - markdown-table: ^1.1.3 - mocha: ^10.2.0 - req-cwd: ^2.0.0 - sha1: ^1.1.1 - sync-request: ^6.0.0 - peerDependencies: - "@codechecks/client": ^0.1.0 - peerDependenciesMeta: - "@codechecks/client": - optional: true - checksum: 9a26a4936693de6dbe633a9e6f9d69eb93c9d45c61ecbc20702a72f15ade424785e29ae8e62ea3a2afc49ea22a4777a71914dc8da1b8587e9d47d085a3246784 - languageName: node - linkType: hard - -"eth-json-rpc-infura@npm:^3.1.0": - version: 3.2.1 - resolution: "eth-json-rpc-infura@npm:3.2.1" - dependencies: - cross-fetch: ^2.1.1 - eth-json-rpc-middleware: ^1.5.0 - json-rpc-engine: ^3.4.0 - json-rpc-error: ^2.0.0 - checksum: 393e825986c0eedb9a1bb771b84e5b7c4037d8f870ab92cdba9dbaa52b5c7d5755ed02fd80d2a07b5db7a3af2c0b30d37756eb39cd7d2ae39173c6c2ea138e7d - languageName: node - linkType: hard - -"eth-json-rpc-middleware@npm:^1.5.0": - version: 1.6.0 - resolution: "eth-json-rpc-middleware@npm:1.6.0" - dependencies: - async: ^2.5.0 - eth-query: ^2.1.2 - eth-tx-summary: ^3.1.2 - ethereumjs-block: ^1.6.0 - ethereumjs-tx: ^1.3.3 - ethereumjs-util: ^5.1.2 - ethereumjs-vm: ^2.1.0 - fetch-ponyfill: ^4.0.0 - json-rpc-engine: ^3.6.0 - json-rpc-error: ^2.0.0 - json-stable-stringify: ^1.0.1 - promise-to-callback: ^1.0.0 - tape: ^4.6.3 - checksum: 0f6c146bdb277b3be9eef68f7424e1709a57f58330a3ae076153313be60f5026a5eee0de16d1ee6e41515e76cb1d38ef590948dd55d4b3ab1b3659af61337922 - languageName: node - linkType: hard - -"eth-lib@npm:0.2.8": - version: 0.2.8 - resolution: "eth-lib@npm:0.2.8" - dependencies: - bn.js: ^4.11.6 - elliptic: ^6.4.0 - xhr-request-promise: ^0.1.2 - checksum: be7efb0b08a78e20d12d2892363ecbbc557a367573ac82fc26a549a77a1b13c7747e6eadbb88026634828fcf9278884b555035787b575b1cab5e6958faad0fad - languageName: node - linkType: hard - -"eth-lib@npm:^0.1.26": - version: 0.1.29 - resolution: "eth-lib@npm:0.1.29" - dependencies: - bn.js: ^4.11.6 - elliptic: ^6.4.0 - nano-json-stream-parser: ^0.1.2 - servify: ^0.1.12 - ws: ^3.0.0 - xhr-request-promise: ^0.1.2 - checksum: d1494fc0af372d46d1c9e7506cfbfa81b9073d98081cf4cbe518932f88bee40cf46a764590f1f8aba03d4a534fa2b1cd794fa2a4f235f656d82b8ab185b5cb9d - languageName: node - linkType: hard - -"eth-query@npm:^2.0.2, eth-query@npm:^2.1.0, eth-query@npm:^2.1.2": - version: 2.1.2 - resolution: "eth-query@npm:2.1.2" - dependencies: - json-rpc-random-id: ^1.0.0 - xtend: ^4.0.1 - checksum: 83daa0e28452c54722aec78cd24d036bad5b6e7c08035d98e10d4bea11f71662f12cab63ebd8a848d4df46ad316503d54ecccb41c9244d2ea8b29364b0a20201 - languageName: node - linkType: hard - -"eth-sig-util@npm:3.0.0": - version: 3.0.0 - resolution: "eth-sig-util@npm:3.0.0" - dependencies: - buffer: ^5.2.1 - elliptic: ^6.4.0 - ethereumjs-abi: 0.6.5 - ethereumjs-util: ^5.1.1 - tweetnacl: ^1.0.0 - tweetnacl-util: ^0.15.0 - checksum: fbe44efb7909737b070e1e1d8c7096da3bdbd1356de242fc3458849e042e39c83a4e2dd1cbce0dc21ff3e5eca1843981751428bc160dcf3a6fcca2f1e8161be4 - languageName: node - linkType: hard - -"eth-sig-util@npm:^1.4.2": - version: 1.4.2 - resolution: "eth-sig-util@npm:1.4.2" - dependencies: - ethereumjs-abi: "git+https://github.com/ethereumjs/ethereumjs-abi.git" - ethereumjs-util: ^5.1.1 - checksum: 578f5c571c1bb0a86dc1bd4a5b56b8073b37823496d7afa74d772cf91ae6860f91bafcbee931be39a3d13f0c195df9f026a27fce350605ad5d15901a5a4ea94a - languageName: node - linkType: hard - -"eth-tx-summary@npm:^3.1.2": - version: 3.2.4 - resolution: "eth-tx-summary@npm:3.2.4" - dependencies: - async: ^2.1.2 - clone: ^2.0.0 - concat-stream: ^1.5.1 - end-of-stream: ^1.1.0 - eth-query: ^2.0.2 - ethereumjs-block: ^1.4.1 - ethereumjs-tx: ^1.1.1 - ethereumjs-util: ^5.0.1 - ethereumjs-vm: ^2.6.0 - through2: ^2.0.3 - checksum: 7df8b91bc2bd3f6941e2a5b3230cad5c5523ca3750190cd06af07983feba1bb4af893f226f01072958b00aa626869846894bcb1bfaa451d9c8f7f5b8cdf5ce0a - languageName: node - linkType: hard - -"ethashjs@npm:~0.0.7": - version: 0.0.8 - resolution: "ethashjs@npm:0.0.8" - dependencies: - async: ^2.1.2 - buffer-xor: ^2.0.1 - ethereumjs-util: ^7.0.2 - miller-rabin: ^4.0.0 - checksum: d9b6b47d32cbe017848ce5d8aec86eb6416300c6f52a68029bf6fc8fcf5429a45c14f2033d514435acd02047af16f6f804056e81587b30ed677039ac678b15f8 - languageName: node - linkType: hard - "ethereum-bloom-filters@npm:^1.0.6": - version: 1.1.0 - resolution: "ethereum-bloom-filters@npm:1.1.0" + version: 1.2.0 + resolution: "ethereum-bloom-filters@npm:1.2.0" dependencies: "@noble/hashes": ^1.4.0 - checksum: 9565cd1e2002509852a05461cc93ee6874e8f961e0f66929cfc34d05f6f451fcfa4df287f8735ee184e4ba5f6e63a76a3c69bbeda5dda5bdf486f68fb9fa61f3 + checksum: 3a4d11495a5845483b78eca6455a915835d691df09a8c5754785c6bdfb5d18382d7e65b066a1c092493c1d87850c6a77243136996a231baec82f22c727e15258 languageName: node linkType: hard -"ethereum-common@npm:0.2.0": - version: 0.2.0 - resolution: "ethereum-common@npm:0.2.0" - checksum: 5e80af27482530ac700676502cd4c02a7248c064999d01dced302f5f40a180c86f57caaab347dbd12482c2869539d321c8c0039db9e3dfb1411e6ad3d57b2547 - languageName: node - linkType: hard - -"ethereum-common@npm:^0.0.18": - version: 0.0.18 - resolution: "ethereum-common@npm:0.0.18" - checksum: 2244126199604abc17508ca249c6f8a66a2ed02e9c97115f234e311f42e2d67aedff08128569fa3dfb8a2d09e1c194eace39a1ce61bfeb2338b6d3f2ac324ee8 - languageName: node - linkType: hard - -"ethereum-cryptography@npm:0.1.3, ethereum-cryptography@npm:^0.1.3": +"ethereum-cryptography@npm:^0.1.3": version: 0.1.3 resolution: "ethereum-cryptography@npm:0.1.3" dependencies: @@ -7539,182 +6363,47 @@ __metadata: languageName: node linkType: hard -"ethereum-cryptography@npm:^2.0.0, ethereum-cryptography@npm:^2.1.2, ethereum-cryptography@npm:^2.1.3": - version: 2.2.1 - resolution: "ethereum-cryptography@npm:2.2.1" - dependencies: - "@noble/curves": 1.4.2 - "@noble/hashes": 1.4.0 - "@scure/bip32": 1.4.0 - "@scure/bip39": 1.3.0 - checksum: 1466e4c417b315a6ac67f95088b769fafac8902b495aada3c6375d827e5a7882f9e0eea5f5451600d2250283d9198b8a3d4d996e374e07a80a324e29136f25c6 - languageName: node - linkType: hard - -"ethereum-waffle@npm:^3.4.4": - version: 3.4.4 - resolution: "ethereum-waffle@npm:3.4.4" - dependencies: - "@ethereum-waffle/chai": ^3.4.4 - "@ethereum-waffle/compiler": ^3.4.4 - "@ethereum-waffle/mock-contract": ^3.4.4 - "@ethereum-waffle/provider": ^3.4.4 - ethers: ^5.0.1 - bin: - waffle: bin/waffle - checksum: 5a181b52f66f1b3c89ed1b68ef44cbd9acd4d743262de9edbe1fd57b0925576dd62c3436b1e65434d5ac03ab16da0df283972cd9aae726de0b8b9cdd7876b917 - languageName: node - linkType: hard - -"ethereum-waffle@npm:latest": - version: 4.0.10 - resolution: "ethereum-waffle@npm:4.0.10" - dependencies: - "@ethereum-waffle/chai": 4.0.10 - "@ethereum-waffle/compiler": 4.0.3 - "@ethereum-waffle/mock-contract": 4.0.4 - "@ethereum-waffle/provider": 4.0.5 - solc: 0.8.15 - typechain: ^8.0.0 - peerDependencies: - ethers: "*" - bin: - waffle: bin/waffle - checksum: 680df4f5cf61f2f64b740d7724323e0872b1b1462e7ee2f1de6a1c9732155b28c4ac25c669ba557f72e1bb20204f81696a1fd543aece03654d71a9d9ebe1fc53 - languageName: node - linkType: hard - -"ethereumjs-abi@git+https://github.com/ethereumjs/ethereumjs-abi.git": - version: 0.6.8 - resolution: "ethereumjs-abi@https://github.com/ethereumjs/ethereumjs-abi.git#commit=ee3994657fa7a427238e6ba92a84d0b529bbcde0" - dependencies: - bn.js: ^4.11.8 - ethereumjs-util: ^6.0.0 - checksum: ae074be0bb012857ab5d3ae644d1163b908a48dd724b7d2567cfde309dc72222d460438f2411936a70dc949dc604ce1ef7118f7273bd525815579143c907e336 - languageName: node - linkType: hard - -"ethereumjs-abi@npm:0.6.5": - version: 0.6.5 - resolution: "ethereumjs-abi@npm:0.6.5" - dependencies: - bn.js: ^4.10.0 - ethereumjs-util: ^4.3.0 - checksum: 3abdc79dc60614d30b1cefb5e6bfbdab3ca8252b4e742330544103f86d6e49a55921d9b8822a0a47fee3efd9dd2493ec93448b1869d82479a4c71a44001e8337 - languageName: node - linkType: hard - -"ethereumjs-abi@npm:0.6.8, ethereumjs-abi@npm:^0.6.8": - version: 0.6.8 - resolution: "ethereumjs-abi@npm:0.6.8" - dependencies: - bn.js: ^4.11.8 - ethereumjs-util: ^6.0.0 - checksum: cede2a8ae7c7e04eeaec079c2f925601a25b2ef75cf9230e7c5da63b4ea27883b35447365a47e35c1e831af520973a2252af89022c292c18a09a4607821a366b - languageName: node - linkType: hard - -"ethereumjs-account@npm:3.0.0, ethereumjs-account@npm:^3.0.0": - version: 3.0.0 - resolution: "ethereumjs-account@npm:3.0.0" - dependencies: - ethereumjs-util: ^6.0.0 - rlp: ^2.2.1 - safe-buffer: ^5.1.1 - checksum: 64dbe026d29aca12c79596cf4085fb27e209988f11b7d5bf3a1f2aadaaa517d90d722680c8b525144c26a2d9cd8494aa26ac088fa80b358cc3e28024f7ddbe81 - languageName: node - linkType: hard - -"ethereumjs-account@npm:^2.0.3": - version: 2.0.5 - resolution: "ethereumjs-account@npm:2.0.5" - dependencies: - ethereumjs-util: ^5.0.0 - rlp: ^2.0.0 - safe-buffer: ^5.1.1 - checksum: 2e4546b8b0213168eebd3a5296da904b6f55470e39b4c742d252748927d2b268f8d6374b0178c1d5b7188646f97dae74a7ac1c7485fe96ea557c152b52223f18 - languageName: node - linkType: hard - -"ethereumjs-block@npm:2.2.2, ethereumjs-block@npm:^2.2.2, ethereumjs-block@npm:~2.2.0, ethereumjs-block@npm:~2.2.2": - version: 2.2.2 - resolution: "ethereumjs-block@npm:2.2.2" - dependencies: - async: ^2.0.1 - ethereumjs-common: ^1.5.0 - ethereumjs-tx: ^2.1.1 - ethereumjs-util: ^5.0.0 - merkle-patricia-tree: ^2.1.2 - checksum: 91f7f60820394e072c9a115da2871a096414644109d2449d4a79b30be67b0080bc848dfa7e2ae7b2ab255de3be4f6736c6cb2b418c29eada794d018cc384e189 - languageName: node - linkType: hard - -"ethereumjs-block@npm:^1.2.2, ethereumjs-block@npm:^1.4.1, ethereumjs-block@npm:^1.6.0": - version: 1.7.1 - resolution: "ethereumjs-block@npm:1.7.1" - dependencies: - async: ^2.0.1 - ethereum-common: 0.2.0 - ethereumjs-tx: ^1.2.2 - ethereumjs-util: ^5.0.0 - merkle-patricia-tree: ^2.1.2 - checksum: 9967c3674af77ea8475a3c023fa160ef6b614450ec50fa32ac083909ead22d3d1c3148f9407b6593d3ccfbe0c51f889c26aa1c15b17026fc2d35cbc542822af8 - languageName: node - linkType: hard - -"ethereumjs-blockchain@npm:^4.0.3": - version: 4.0.4 - resolution: "ethereumjs-blockchain@npm:4.0.4" - dependencies: - async: ^2.6.1 - ethashjs: ~0.0.7 - ethereumjs-block: ~2.2.2 - ethereumjs-common: ^1.5.0 - ethereumjs-util: ^6.1.0 - flow-stoplight: ^1.0.0 - level-mem: ^3.0.1 - lru-cache: ^5.1.1 - rlp: ^2.2.2 - semaphore: ^1.1.0 - checksum: efa04b2e2d02ce9c524f246f862b1ca779bbfd9f795cc7a9e471f0d96229de5188f1f6b17e54948f640100116b646ed03242494c23cd66f0f7e8384a4f217ba4 - languageName: node - linkType: hard - -"ethereumjs-common@npm:1.5.0": - version: 1.5.0 - resolution: "ethereumjs-common@npm:1.5.0" - checksum: a30474986a88b8f3ee53f9fb34027528f12d1bc7ecee8b80aa8060a09ccde3b2af4dd24c928287018003e4e206cd4f6311cdd508442d1452d02ec3d8e7a0601e - languageName: node - linkType: hard - -"ethereumjs-common@npm:^1.1.0, ethereumjs-common@npm:^1.3.2, ethereumjs-common@npm:^1.5.0": - version: 1.5.2 - resolution: "ethereumjs-common@npm:1.5.2" - checksum: 3fc64faced268e0c61da50c5db76d18cfd44325d5706792f32ac8c85c0e800d52db284f042c3bd0623daf59b946176ef7dbea476d1b0252492137fa4549a3349 +"ethereum-cryptography@npm:^2.0.0, ethereum-cryptography@npm:^2.1.2, ethereum-cryptography@npm:^2.1.3, ethereum-cryptography@npm:^2.2.1": + version: 2.2.1 + resolution: "ethereum-cryptography@npm:2.2.1" + dependencies: + "@noble/curves": 1.4.2 + "@noble/hashes": 1.4.0 + "@scure/bip32": 1.4.0 + "@scure/bip39": 1.3.0 + checksum: 1466e4c417b315a6ac67f95088b769fafac8902b495aada3c6375d827e5a7882f9e0eea5f5451600d2250283d9198b8a3d4d996e374e07a80a324e29136f25c6 languageName: node linkType: hard -"ethereumjs-tx@npm:2.1.2, ethereumjs-tx@npm:^2.1.1, ethereumjs-tx@npm:^2.1.2": - version: 2.1.2 - resolution: "ethereumjs-tx@npm:2.1.2" +"ethereum-waffle@npm:latest": + version: 4.0.10 + resolution: "ethereum-waffle@npm:4.0.10" dependencies: - ethereumjs-common: ^1.5.0 - ethereumjs-util: ^6.0.0 - checksum: a5b607b4e125ed696d76a9e4db8a95e03a967323c66694912d799619b16fa43985336924221f9e7582dc1b09ff88a62116bf2290ee14d952bf7e6715e5728525 + "@ethereum-waffle/chai": 4.0.10 + "@ethereum-waffle/compiler": 4.0.3 + "@ethereum-waffle/mock-contract": 4.0.4 + "@ethereum-waffle/provider": 4.0.5 + solc: 0.8.15 + typechain: ^8.0.0 + peerDependencies: + ethers: "*" + bin: + waffle: bin/waffle + checksum: 680df4f5cf61f2f64b740d7724323e0872b1b1462e7ee2f1de6a1c9732155b28c4ac25c669ba557f72e1bb20204f81696a1fd543aece03654d71a9d9ebe1fc53 languageName: node linkType: hard -"ethereumjs-tx@npm:^1.1.1, ethereumjs-tx@npm:^1.2.0, ethereumjs-tx@npm:^1.2.2, ethereumjs-tx@npm:^1.3.3": - version: 1.3.7 - resolution: "ethereumjs-tx@npm:1.3.7" +"ethereumjs-abi@npm:0.6.8": + version: 0.6.8 + resolution: "ethereumjs-abi@npm:0.6.8" dependencies: - ethereum-common: ^0.0.18 - ethereumjs-util: ^5.0.0 - checksum: fe2323fe7db7f5dda85715dc67c31dd1f2925bf5a88e393ba939dbe699b73df008f1332f711b1aa37e943193acf3b6976202a33f2fab1f7675b6d2dd70f424d4 + bn.js: ^4.11.8 + ethereumjs-util: ^6.0.0 + checksum: cede2a8ae7c7e04eeaec079c2f925601a25b2ef75cf9230e7c5da63b4ea27883b35447365a47e35c1e831af520973a2252af89022c292c18a09a4607821a366b languageName: node linkType: hard -"ethereumjs-util@npm:6.2.1, ethereumjs-util@npm:^6.0.0, ethereumjs-util@npm:^6.1.0, ethereumjs-util@npm:^6.2.0, ethereumjs-util@npm:^6.2.1": +"ethereumjs-util@npm:6.2.1, ethereumjs-util@npm:^6.0.0": version: 6.2.1 resolution: "ethereumjs-util@npm:6.2.1" dependencies: @@ -7742,35 +6431,7 @@ __metadata: languageName: node linkType: hard -"ethereumjs-util@npm:^4.3.0": - version: 4.5.1 - resolution: "ethereumjs-util@npm:4.5.1" - dependencies: - bn.js: ^4.8.0 - create-hash: ^1.1.2 - elliptic: ^6.5.2 - ethereum-cryptography: ^0.1.3 - rlp: ^2.0.0 - checksum: ee91fbd29634d40cad9adf90f202158324c089bbc10b405d2ef139f4542090e6f76a616d16c601b52d6b5c5d59ddb6c8387cf60cc732884e732dad9a62b8a539 - languageName: node - linkType: hard - -"ethereumjs-util@npm:^5.0.0, ethereumjs-util@npm:^5.0.1, ethereumjs-util@npm:^5.1.1, ethereumjs-util@npm:^5.1.2, ethereumjs-util@npm:^5.1.3, ethereumjs-util@npm:^5.1.5, ethereumjs-util@npm:^5.2.0": - version: 5.2.1 - resolution: "ethereumjs-util@npm:5.2.1" - dependencies: - bn.js: ^4.11.0 - create-hash: ^1.1.2 - elliptic: ^6.5.2 - ethereum-cryptography: ^0.1.3 - ethjs-util: ^0.1.3 - rlp: ^2.0.0 - safe-buffer: ^5.1.1 - checksum: 20db6c639d92b35739fd5f7a71e64a92e85442ea0d176b59b5cd5828265b6cf42bd4868cf81a9b20a83738db1ffa7a2f778f1d850d663627a1a5209f7904b44f - languageName: node - linkType: hard - -"ethereumjs-util@npm:^7.0.2, ethereumjs-util@npm:^7.0.3, ethereumjs-util@npm:^7.1.1, ethereumjs-util@npm:^7.1.3, ethereumjs-util@npm:^7.1.4, ethereumjs-util@npm:^7.1.5": +"ethereumjs-util@npm:^7.0.3, ethereumjs-util@npm:^7.1.1, ethereumjs-util@npm:^7.1.3, ethereumjs-util@npm:^7.1.4, ethereumjs-util@npm:^7.1.5": version: 7.1.5 resolution: "ethereumjs-util@npm:7.1.5" dependencies: @@ -7783,115 +6444,56 @@ __metadata: languageName: node linkType: hard -"ethereumjs-vm@npm:4.2.0": - version: 4.2.0 - resolution: "ethereumjs-vm@npm:4.2.0" - dependencies: - async: ^2.1.2 - async-eventemitter: ^0.2.2 - core-js-pure: ^3.0.1 - ethereumjs-account: ^3.0.0 - ethereumjs-block: ^2.2.2 - ethereumjs-blockchain: ^4.0.3 - ethereumjs-common: ^1.5.0 - ethereumjs-tx: ^2.1.2 - ethereumjs-util: ^6.2.0 - fake-merkle-patricia-tree: ^1.0.1 - functional-red-black-tree: ^1.0.1 - merkle-patricia-tree: ^2.3.2 - rustbn.js: ~0.2.0 - safe-buffer: ^5.1.1 - util.promisify: ^1.0.0 - checksum: ca73c406d55baefacafbdd8cefce80740098e5834096042e93285dc386ee670b4fed2f7846b78e3078fdf41231d04b3f1c40e435e639d072e0529ccb560b797b - languageName: node - linkType: hard - -"ethereumjs-vm@npm:^2.1.0, ethereumjs-vm@npm:^2.3.4, ethereumjs-vm@npm:^2.6.0": - version: 2.6.0 - resolution: "ethereumjs-vm@npm:2.6.0" - dependencies: - async: ^2.1.2 - async-eventemitter: ^0.2.2 - ethereumjs-account: ^2.0.3 - ethereumjs-block: ~2.2.0 - ethereumjs-common: ^1.1.0 - ethereumjs-util: ^6.0.0 - fake-merkle-patricia-tree: ^1.0.1 - functional-red-black-tree: ^1.0.1 - merkle-patricia-tree: ^2.3.2 - rustbn.js: ~0.2.0 - safe-buffer: ^5.1.1 - checksum: 3b3098b2ac3d5335797e4d73fceb76d1b776e453abb5fa4d1cd94f6391f493e95e3c89a8ee602558bc2a3b36b89977e66473de73faa87c8540b1954aa7b8c3fd - languageName: node - linkType: hard - -"ethereumjs-wallet@npm:0.6.5": - version: 0.6.5 - resolution: "ethereumjs-wallet@npm:0.6.5" - dependencies: - aes-js: ^3.1.1 - bs58check: ^2.1.2 - ethereum-cryptography: ^0.1.3 - ethereumjs-util: ^6.0.0 - randombytes: ^2.0.6 - safe-buffer: ^5.1.2 - scryptsy: ^1.2.1 - utf8: ^3.0.0 - uuid: ^3.3.2 - checksum: 54a9cc8beb8ea55e9be9b024b6ed09349423145fd8c49b8662d60d9258039330163c830fec055f92becc71ea54b430d2ef29f6bd73fa49d93ea854af01d13e58 - languageName: node - linkType: hard - -"ethers-v5@npm:ethers@^5.7.0, ethers@npm:^5.0.1, ethers@npm:^5.0.2, ethers@npm:^5.5.2, ethers@npm:^5.6.9, ethers@npm:^5.7.2": - version: 5.7.2 - resolution: "ethers@npm:5.7.2" - dependencies: - "@ethersproject/abi": 5.7.0 - "@ethersproject/abstract-provider": 5.7.0 - "@ethersproject/abstract-signer": 5.7.0 - "@ethersproject/address": 5.7.0 - "@ethersproject/base64": 5.7.0 - "@ethersproject/basex": 5.7.0 - "@ethersproject/bignumber": 5.7.0 - "@ethersproject/bytes": 5.7.0 - "@ethersproject/constants": 5.7.0 - "@ethersproject/contracts": 5.7.0 - "@ethersproject/hash": 5.7.0 - "@ethersproject/hdnode": 5.7.0 - "@ethersproject/json-wallets": 5.7.0 - "@ethersproject/keccak256": 5.7.0 - "@ethersproject/logger": 5.7.0 - "@ethersproject/networks": 5.7.1 - "@ethersproject/pbkdf2": 5.7.0 - "@ethersproject/properties": 5.7.0 - "@ethersproject/providers": 5.7.2 - "@ethersproject/random": 5.7.0 - "@ethersproject/rlp": 5.7.0 - "@ethersproject/sha2": 5.7.0 - "@ethersproject/signing-key": 5.7.0 - "@ethersproject/solidity": 5.7.0 - "@ethersproject/strings": 5.7.0 - "@ethersproject/transactions": 5.7.0 - "@ethersproject/units": 5.7.0 - "@ethersproject/wallet": 5.7.0 - "@ethersproject/web": 5.7.1 - "@ethersproject/wordlists": 5.7.0 - checksum: b7c08cf3e257185a7946117dbbf764433b7ba0e77c27298dec6088b3bc871aff711462b0621930c56880ff0a7ceb8b1d3a361ffa259f93377b48e34107f62553 +"ethers-v5@npm:ethers@^5.7.0": + version: 5.8.0 + resolution: "ethers@npm:5.8.0" + dependencies: + "@ethersproject/abi": 5.8.0 + "@ethersproject/abstract-provider": 5.8.0 + "@ethersproject/abstract-signer": 5.8.0 + "@ethersproject/address": 5.8.0 + "@ethersproject/base64": 5.8.0 + "@ethersproject/basex": 5.8.0 + "@ethersproject/bignumber": 5.8.0 + "@ethersproject/bytes": 5.8.0 + "@ethersproject/constants": 5.8.0 + "@ethersproject/contracts": 5.8.0 + "@ethersproject/hash": 5.8.0 + "@ethersproject/hdnode": 5.8.0 + "@ethersproject/json-wallets": 5.8.0 + "@ethersproject/keccak256": 5.8.0 + "@ethersproject/logger": 5.8.0 + "@ethersproject/networks": 5.8.0 + "@ethersproject/pbkdf2": 5.8.0 + "@ethersproject/properties": 5.8.0 + "@ethersproject/providers": 5.8.0 + "@ethersproject/random": 5.8.0 + "@ethersproject/rlp": 5.8.0 + "@ethersproject/sha2": 5.8.0 + "@ethersproject/signing-key": 5.8.0 + "@ethersproject/solidity": 5.8.0 + "@ethersproject/strings": 5.8.0 + "@ethersproject/transactions": 5.8.0 + "@ethersproject/units": 5.8.0 + "@ethersproject/wallet": 5.8.0 + "@ethersproject/web": 5.8.0 + "@ethersproject/wordlists": 5.8.0 + checksum: fb107bf28dc3aedde4729f9553be066c699e0636346c095b4deeb5349a0c0c8538f48a58b5c8cbefced008706919739c5f7b8f4dd506bb471a31edee18cda228 languageName: node linkType: hard "ethers@npm:^6.6.0": - version: 6.13.1 - resolution: "ethers@npm:6.13.1" + version: 6.14.0 + resolution: "ethers@npm:6.14.0" dependencies: "@adraffy/ens-normalize": 1.10.1 "@noble/curves": 1.2.0 "@noble/hashes": 1.3.2 - "@types/node": 18.15.13 + "@types/node": 22.7.5 aes-js: 4.0.0-beta.5 - tslib: 2.4.0 + tslib: 2.7.0 ws: 8.17.1 - checksum: beef4b6d117f64c369f44be631e0f666b966374eac0cc0446fa7abe114b11d6b3019060022eec65c031f150711f4913d249de507ff3da3204e654635db80a07e + checksum: 937cab802131b289ca9a278fce595dff5977d358c5e2c72603e321a67a3ed531b4c19ddeec555d53fd474f75e101d599b6962cb3e33a691b526ecfebed9482d8 languageName: node linkType: hard @@ -7905,7 +6507,7 @@ __metadata: languageName: node linkType: hard -"ethjs-util@npm:0.1.6, ethjs-util@npm:^0.1.3, ethjs-util@npm:^0.1.6": +"ethjs-util@npm:0.1.6": version: 0.1.6 resolution: "ethjs-util@npm:0.1.6" dependencies: @@ -7915,16 +6517,6 @@ __metadata: languageName: node linkType: hard -"event-emitter@npm:^0.3.5": - version: 0.3.5 - resolution: "event-emitter@npm:0.3.5" - dependencies: - d: 1 - es5-ext: ~0.10.14 - checksum: 27c1399557d9cd7e0aa0b366c37c38a4c17293e3a10258e8b692a847dd5ba9fb90429c3a5a1eeff96f31f6fa03ccbd31d8ad15e00540b22b22f01557be706030 - languageName: node - linkType: hard - "event-target-shim@npm:^5.0.0": version: 5.0.1 resolution: "event-target-shim@npm:5.0.1" @@ -7932,21 +6524,14 @@ __metadata: languageName: node linkType: hard -"eventemitter3@npm:4.0.4": - version: 4.0.4 - resolution: "eventemitter3@npm:4.0.4" - checksum: 7afb1cd851d19898bc99cc55ca894fe18cb1f8a07b0758652830a09bd6f36082879a25345be6219b81d74764140688b1a8fa75bcd1073d96b9a6661e444bc2ea - languageName: node - linkType: hard - -"events@npm:^3.0.0": - version: 3.3.0 - resolution: "events@npm:3.3.0" - checksum: f6f487ad2198aa41d878fa31452f1a3c00958f46e9019286ff4787c84aac329332ab45c9cdc8c445928fc6d7ded294b9e005a7fce9426488518017831b272780 +"eventemitter3@npm:5.0.1": + version: 5.0.1 + resolution: "eventemitter3@npm:5.0.1" + checksum: 543d6c858ab699303c3c32e0f0f47fc64d360bf73c3daf0ac0b5079710e340d6fe9f15487f94e66c629f5f82cd1a8678d692f3dbb6f6fcd1190e1b97fcad36f8 languageName: node linkType: hard -"evp_bytestokey@npm:^1.0.0, evp_bytestokey@npm:^1.0.3": +"evp_bytestokey@npm:^1.0.3": version: 1.0.3 resolution: "evp_bytestokey@npm:1.0.3" dependencies: @@ -7990,92 +6575,10 @@ __metadata: languageName: node linkType: hard -"expand-brackets@npm:^2.1.4": - version: 2.1.4 - resolution: "expand-brackets@npm:2.1.4" - dependencies: - debug: ^2.3.3 - define-property: ^0.2.5 - extend-shallow: ^2.0.1 - posix-character-classes: ^0.1.0 - regex-not: ^1.0.0 - snapdragon: ^0.8.1 - to-regex: ^3.0.1 - checksum: 1781d422e7edfa20009e2abda673cadb040a6037f0bd30fcd7357304f4f0c284afd420d7622722ca4a016f39b6d091841ab57b401c1f7e2e5131ac65b9f14fa1 - languageName: node - linkType: hard - "exponential-backoff@npm:^3.1.1": - version: 3.1.1 - resolution: "exponential-backoff@npm:3.1.1" - checksum: 3d21519a4f8207c99f7457287291316306255a328770d320b401114ec8481986e4e467e854cb9914dd965e0a1ca810a23ccb559c642c88f4c7f55c55778a9b48 - languageName: node - linkType: hard - -"express@npm:^4.14.0": - version: 4.19.2 - resolution: "express@npm:4.19.2" - dependencies: - accepts: ~1.3.8 - array-flatten: 1.1.1 - body-parser: 1.20.2 - content-disposition: 0.5.4 - content-type: ~1.0.4 - cookie: 0.6.0 - cookie-signature: 1.0.6 - debug: 2.6.9 - depd: 2.0.0 - encodeurl: ~1.0.2 - escape-html: ~1.0.3 - etag: ~1.8.1 - finalhandler: 1.2.0 - fresh: 0.5.2 - http-errors: 2.0.0 - merge-descriptors: 1.0.1 - methods: ~1.1.2 - on-finished: 2.4.1 - parseurl: ~1.3.3 - path-to-regexp: 0.1.7 - proxy-addr: ~2.0.7 - qs: 6.11.0 - range-parser: ~1.2.1 - safe-buffer: 5.2.1 - send: 0.18.0 - serve-static: 1.15.0 - setprototypeof: 1.2.0 - statuses: 2.0.1 - type-is: ~1.6.18 - utils-merge: 1.0.1 - vary: ~1.1.2 - checksum: 212dbd6c2c222a96a61bc927639c95970a53b06257080bb9e2838adb3bffdb966856551fdad1ab5dd654a217c35db94f987d0aa88d48fb04d306340f5f34dca5 - languageName: node - linkType: hard - -"ext@npm:^1.7.0": - version: 1.7.0 - resolution: "ext@npm:1.7.0" - dependencies: - type: ^2.7.2 - checksum: ef481f9ef45434d8c867cfd09d0393b60945b7c8a1798bedc4514cb35aac342ccb8d8ecb66a513e6a2b4ec1e294a338e3124c49b29736f8e7c735721af352c31 - languageName: node - linkType: hard - -"extend-shallow@npm:^2.0.1": - version: 2.0.1 - resolution: "extend-shallow@npm:2.0.1" - dependencies: - is-extendable: ^0.1.0 - checksum: 8fb58d9d7a511f4baf78d383e637bd7d2e80843bd9cd0853649108ea835208fb614da502a553acc30208e1325240bb7cc4a68473021612496bb89725483656d8 - languageName: node - linkType: hard - -"extend-shallow@npm:^3.0.0, extend-shallow@npm:^3.0.2": - version: 3.0.2 - resolution: "extend-shallow@npm:3.0.2" - dependencies: - assign-symbols: ^1.0.0 - is-extendable: ^1.0.1 - checksum: a920b0cd5838a9995ace31dfd11ab5e79bf6e295aa566910ce53dff19f4b1c0fda2ef21f26b28586c7a2450ca2b42d97bd8c0f5cec9351a819222bf861e02461 + version: 3.1.2 + resolution: "exponential-backoff@npm:3.1.2" + checksum: 7e191e3dd6edd8c56c88f2c8037c98fbb8034fe48778be53ed8cb30ccef371a061a4e999a469aab939b92f8f12698f3b426d52f4f76b7a20da5f9f98c3cbc862 languageName: node linkType: hard @@ -8097,22 +6600,6 @@ __metadata: languageName: node linkType: hard -"extglob@npm:^2.0.4": - version: 2.0.4 - resolution: "extglob@npm:2.0.4" - dependencies: - array-unique: ^0.3.2 - define-property: ^1.0.0 - expand-brackets: ^2.1.4 - extend-shallow: ^2.0.1 - fragment-cache: ^0.2.1 - regex-not: ^1.0.0 - snapdragon: ^0.8.1 - to-regex: ^3.0.1 - checksum: a41531b8934735b684cef5e8c5a01d0f298d7d384500ceca38793a9ce098125aab04ee73e2d75d5b2901bc5dddd2b64e1b5e3bf19139ea48bac52af4a92f1d00 - languageName: node - linkType: hard - "extsprintf@npm:1.3.0": version: 1.3.0 resolution: "extsprintf@npm:1.3.0" @@ -8134,15 +6621,6 @@ __metadata: languageName: node linkType: hard -"fake-merkle-patricia-tree@npm:^1.0.1": - version: 1.0.1 - resolution: "fake-merkle-patricia-tree@npm:1.0.1" - dependencies: - checkpoint-store: ^1.1.0 - checksum: 8f9fe05bb5beabb31e4fbb8d2cfe83cfb36fd9f6ba78193dea8fab7a679470d45bb04c6f052d4f79da03e81129c5b5bed528902430184e1e11b4959f397019ac - languageName: node - linkType: hard - "fast-base64-decode@npm:^1.0.0": version: 1.0.0 resolution: "fast-base64-decode@npm:1.0.0" @@ -8172,15 +6650,15 @@ __metadata: linkType: hard "fast-glob@npm:^3.0.3, fast-glob@npm:^3.2.9": - version: 3.3.2 - resolution: "fast-glob@npm:3.3.2" + version: 3.3.3 + resolution: "fast-glob@npm:3.3.3" dependencies: "@nodelib/fs.stat": ^2.0.2 "@nodelib/fs.walk": ^1.2.3 glob-parent: ^5.1.2 merge2: ^1.3.0 - micromatch: ^4.0.4 - checksum: 900e4979f4dbc3313840078419245621259f349950411ca2fa445a2f9a1a6d98c3b5e7e0660c5ccd563aa61abe133a21765c6c0dec8e57da1ba71d8000b05ec1 + micromatch: ^4.0.8 + checksum: 0704d7b85c0305fd2cef37777337dfa26230fdd072dce9fb5c82a4b03156f3ffb8ed3e636033e65d45d2a5805a4e475825369a27404c0307f2db0c8eb3366fbd languageName: node linkType: hard @@ -8198,21 +6676,42 @@ __metadata: languageName: node linkType: hard +"fast-uri@npm:^3.0.1": + version: 3.0.6 + resolution: "fast-uri@npm:3.0.6" + checksum: 7161ba2a7944778d679ba8e5f00d6a2bb479a2142df0982f541d67be6c979b17808f7edbb0ce78161c85035974bde3fa52b5137df31da46c0828cb629ba67c4e + languageName: node + linkType: hard + +"fast-xml-parser@npm:4.4.1": + version: 4.4.1 + resolution: "fast-xml-parser@npm:4.4.1" + dependencies: + strnum: ^1.0.5 + bin: + fxparser: src/cli/cli.js + checksum: f440c01cd141b98789ae777503bcb6727393296094cc82924ae9f88a5b971baa4eec7e65306c7e07746534caa661fc83694ff437d9012dc84dee39dfbfaab947 + languageName: node + linkType: hard + "fastq@npm:^1.6.0": - version: 1.17.1 - resolution: "fastq@npm:1.17.1" + version: 1.19.1 + resolution: "fastq@npm:1.19.1" dependencies: reusify: ^1.0.4 - checksum: a8c5b26788d5a1763f88bae56a8ddeee579f935a831c5fe7a8268cea5b0a91fbfe705f612209e02d639b881d7b48e461a50da4a10cfaa40da5ca7cc9da098d88 + checksum: 7691d1794fb84ad0ec2a185f10e00f0e1713b894e2c9c4d42f0bc0ba5f8c00e6e655a202074ca0b91b9c3d977aab7c30c41a8dc069fb5368576ac0054870a0e6 languageName: node linkType: hard -"fetch-ponyfill@npm:^4.0.0": - version: 4.1.0 - resolution: "fetch-ponyfill@npm:4.1.0" - dependencies: - node-fetch: ~1.7.1 - checksum: 00c85b661a8314e18cb314640b69d3b6e9635517d54290c8f366ddcb21b506ac8fa5d92f899c0fe21bc2163238130be2cf73ffd9d5a8a41a9866a55c52f57f16 +"fdir@npm:^6.4.4": + version: 6.4.4 + resolution: "fdir@npm:6.4.4" + peerDependencies: + picomatch: ^3 || ^4 + peerDependenciesMeta: + picomatch: + optional: true + checksum: 79043610236579ffbd0647c508b43bd030a2d034a17c43cf96813a00e8e92e51acdb115c6ddecef3b5812cc2692b976155b4f6413e51e3761f1e772fa019a321 languageName: node linkType: hard @@ -8243,18 +6742,6 @@ __metadata: languageName: node linkType: hard -"fill-range@npm:^4.0.0": - version: 4.0.0 - resolution: "fill-range@npm:4.0.0" - dependencies: - extend-shallow: ^2.0.1 - is-number: ^3.0.0 - repeat-string: ^1.6.1 - to-regex-range: ^2.1.0 - checksum: dbb5102467786ab42bc7a3ec7380ae5d6bfd1b5177b2216de89e4a541193f8ba599a6db84651bd2c58c8921db41b8cc3d699ea83b477342d3ce404020f73c298 - languageName: node - linkType: hard - "fill-range@npm:^7.1.1": version: 7.1.1 resolution: "fill-range@npm:7.1.1" @@ -8264,31 +6751,6 @@ __metadata: languageName: node linkType: hard -"finalhandler@npm:1.2.0": - version: 1.2.0 - resolution: "finalhandler@npm:1.2.0" - dependencies: - debug: 2.6.9 - encodeurl: ~1.0.2 - escape-html: ~1.0.3 - on-finished: 2.4.1 - parseurl: ~1.3.3 - statuses: 2.0.1 - unpipe: ~1.0.0 - checksum: 92effbfd32e22a7dff2994acedbd9bcc3aa646a3e919ea6a53238090e87097f8ef07cced90aa2cc421abdf993aefbdd5b00104d55c7c5479a8d00ed105b45716 - languageName: node - linkType: hard - -"find-replace@npm:^1.0.3": - version: 1.0.3 - resolution: "find-replace@npm:1.0.3" - dependencies: - array-back: ^1.0.4 - test-value: ^2.1.0 - checksum: fd95f44e59bd54ea1c0169480952b339a4642cd62d81236fef7f87146d3bc00a042b17d81f896712e8542e01fe5c84e82ac37b6b77b4e3422abbcf7c13bbacfd - languageName: node - linkType: hard - "find-replace@npm:^3.0.0": version: 3.0.0 resolution: "find-replace@npm:3.0.0" @@ -8298,35 +6760,6 @@ __metadata: languageName: node linkType: hard -"find-up@npm:5.0.0, find-up@npm:^5.0.0": - version: 5.0.0 - resolution: "find-up@npm:5.0.0" - dependencies: - locate-path: ^6.0.0 - path-exists: ^4.0.0 - checksum: 07955e357348f34660bde7920783204ff5a26ac2cafcaa28bace494027158a97b9f56faaf2d89a6106211a8174db650dd9f503f9c0d526b1202d5554a00b9095 - languageName: node - linkType: hard - -"find-up@npm:^1.0.0": - version: 1.1.2 - resolution: "find-up@npm:1.1.2" - dependencies: - path-exists: ^2.0.0 - pinkie-promise: ^2.0.0 - checksum: a2cb9f4c9f06ee3a1e92ed71d5aed41ac8ae30aefa568132f6c556fac7678a5035126153b59eaec68da78ac409eef02503b2b059706bdbf232668d7245e3240a - languageName: node - linkType: hard - -"find-up@npm:^2.1.0": - version: 2.1.0 - resolution: "find-up@npm:2.1.0" - dependencies: - locate-path: ^2.0.0 - checksum: 43284fe4da09f89011f08e3c32cd38401e786b19226ea440b75386c1b12a4cb738c94969808d53a84f564ede22f732c8409e3cfc3f7fb5b5c32378ad0bbf28bd - languageName: node - linkType: hard - "find-up@npm:^3.0.0": version: 3.0.0 resolution: "find-up@npm:3.0.0" @@ -8336,22 +6769,13 @@ __metadata: languageName: node linkType: hard -"find-yarn-workspace-root@npm:^1.2.1": - version: 1.2.1 - resolution: "find-yarn-workspace-root@npm:1.2.1" - dependencies: - fs-extra: ^4.0.3 - micromatch: ^3.1.4 - checksum: a8f4565fb1ead6122acc0d324fa3257c20f7b0c91b7b266dab9eee7251fb5558fcff5b35dbfd301bfd1cbb91c1cdd1799b28ffa5b9a92efd8c7ded3663652bbe - languageName: node - linkType: hard - -"find-yarn-workspace-root@npm:^2.0.0": - version: 2.0.0 - resolution: "find-yarn-workspace-root@npm:2.0.0" +"find-up@npm:^5.0.0": + version: 5.0.0 + resolution: "find-up@npm:5.0.0" dependencies: - micromatch: ^4.0.2 - checksum: fa5ca8f9d08fe7a54ce7c0a5931ff9b7e36f9ee7b9475fb13752bcea80ec6b5f180fa5102d60b376d5526ce924ea3fc6b19301262efa0a5d248dd710f3644242 + locate-path: ^6.0.0 + path-exists: ^4.0.0 + checksum: 07955e357348f34660bde7920783204ff5a26ac2cafcaa28bace494027158a97b9f56faaf2d89a6106211a8174db650dd9f503f9c0d526b1202d5554a00b9095 languageName: node linkType: hard @@ -8394,52 +6818,38 @@ __metadata: linkType: hard "flatted@npm:^3.2.9": - version: 3.3.1 - resolution: "flatted@npm:3.3.1" - checksum: 85ae7181650bb728c221e7644cbc9f4bf28bc556f2fc89bb21266962bdf0ce1029cc7acc44bb646cd469d9baac7c317f64e841c4c4c00516afa97320cdac7f94 - languageName: node - linkType: hard - -"flow-stoplight@npm:^1.0.0": - version: 1.0.0 - resolution: "flow-stoplight@npm:1.0.0" - checksum: 2f1f34629e724afe7de7b6cb7b5f9ef1b37fa5a4b8a10e24b9c1043872777c41f4c7e09994ecfd5bc70138a04966c3153c4e15187a24771f5d5151a325a96a2e + version: 3.3.3 + resolution: "flatted@npm:3.3.3" + checksum: 8c96c02fbeadcf4e8ffd0fa24983241e27698b0781295622591fc13585e2f226609d95e422bcf2ef044146ffacb6b68b1f20871454eddf75ab3caa6ee5f4a1fe languageName: node linkType: hard "follow-redirects@npm:^1.12.1, follow-redirects@npm:^1.14.0, follow-redirects@npm:^1.15.6": - version: 1.15.6 - resolution: "follow-redirects@npm:1.15.6" + version: 1.15.9 + resolution: "follow-redirects@npm:1.15.9" peerDependenciesMeta: debug: optional: true - checksum: a62c378dfc8c00f60b9c80cab158ba54e99ba0239a5dd7c81245e5a5b39d10f0c35e249c3379eae719ff0285fff88c365dd446fab19dee771f1d76252df1bbf5 + checksum: 859e2bacc7a54506f2bf9aacb10d165df78c8c1b0ceb8023f966621b233717dab56e8d08baadc3ad3b9db58af290413d585c999694b7c146aaf2616340c3d2a6 languageName: node linkType: hard -"for-each@npm:^0.3.3, for-each@npm:~0.3.3": - version: 0.3.3 - resolution: "for-each@npm:0.3.3" +"for-each@npm:^0.3.3, for-each@npm:^0.3.5": + version: 0.3.5 + resolution: "for-each@npm:0.3.5" dependencies: - is-callable: ^1.1.3 - checksum: 6c48ff2bc63362319c65e2edca4a8e1e3483a2fabc72fbe7feaf8c73db94fc7861bd53bc02c8a66a0c1dd709da6b04eec42e0abdd6b40ce47305ae92a25e5d28 - languageName: node - linkType: hard - -"for-in@npm:^1.0.2": - version: 1.0.2 - resolution: "for-in@npm:1.0.2" - checksum: 09f4ae93ce785d253ac963d94c7f3432d89398bf25ac7a24ed034ca393bf74380bdeccc40e0f2d721a895e54211b07c8fad7132e8157827f6f7f059b70b4043d + is-callable: ^1.2.7 + checksum: 3c986d7e11f4381237cc98baa0a2f87eabe74719eee65ed7bed275163082b940ede19268c61d04c6260e0215983b12f8d885e3c8f9aa8c2113bf07c37051745c languageName: node linkType: hard "foreground-child@npm:^3.1.0": - version: 3.2.1 - resolution: "foreground-child@npm:3.2.1" + version: 3.3.1 + resolution: "foreground-child@npm:3.3.1" dependencies: - cross-spawn: ^7.0.0 + cross-spawn: ^7.0.6 signal-exit: ^4.0.1 - checksum: 3e2e844d6003c96d70affe8ae98d7eaaba269a868c14d997620c088340a8775cd5d2d9043e6ceebae1928d8d9a874911c4d664b9a267e8995945df20337aebc0 + checksum: b2c1a6fc0bf0233d645d9fefdfa999abf37db1b33e5dab172b3cbfb0662b88bfbd2c9e7ab853533d199050ec6b65c03fcf078fc212d26e4990220e98c6930eef languageName: node linkType: hard @@ -8450,25 +6860,15 @@ __metadata: languageName: node linkType: hard -"form-data@npm:^2.2.0": - version: 2.5.1 - resolution: "form-data@npm:2.5.1" - dependencies: - asynckit: ^0.4.0 - combined-stream: ^1.0.6 - mime-types: ^2.1.12 - checksum: 5134ada56cc246b293a1ac7678dba6830000603a3979cf83ff7b2f21f2e3725202237cfb89e32bcb38a1d35727efbd3c3a22e65b42321e8ade8eec01ce755d08 - languageName: node - linkType: hard - "form-data@npm:^4.0.0": - version: 4.0.0 - resolution: "form-data@npm:4.0.0" + version: 4.0.2 + resolution: "form-data@npm:4.0.2" dependencies: asynckit: ^0.4.0 combined-stream: ^1.0.8 + es-set-tostringtag: ^2.1.0 mime-types: ^2.1.12 - checksum: 01135bf8675f9d5c61ff18e2e2932f719ca4de964e3be90ef4c36aacfc7b9cb2fceb5eca0b7e0190e3383fe51c5b37f4cb80b62ca06a99aaabfcfd6ac7c9328c + checksum: e887298b22c13c7c9c5a8ba3716f295a479a13ca78bfd855ef11cbce1bcf22bc0ae2062e94808e21d46e5c667664a1a1a8a7f57d7040193c1fefbfb11af58aab languageName: node linkType: hard @@ -8483,13 +6883,6 @@ __metadata: languageName: node linkType: hard -"forwarded@npm:0.2.0": - version: 0.2.0 - resolution: "forwarded@npm:0.2.0" - checksum: fd27e2394d8887ebd16a66ffc889dc983fbbd797d5d3f01087c020283c0f019a7d05ee85669383d8e0d216b116d720fc0cef2f6e9b7eb9f4c90c6e0bc7fd28e6 - languageName: node - linkType: hard - "fp-ts@npm:1.19.3": version: 1.19.3 resolution: "fp-ts@npm:1.19.3" @@ -8504,22 +6897,6 @@ __metadata: languageName: node linkType: hard -"fragment-cache@npm:^0.2.1": - version: 0.2.1 - resolution: "fragment-cache@npm:0.2.1" - dependencies: - map-cache: ^0.2.2 - checksum: 1cbbd0b0116b67d5790175de0038a11df23c1cd2e8dcdbade58ebba5594c2d641dade6b4f126d82a7b4a6ffc2ea12e3d387dbb64ea2ae97cf02847d436f60fdc - languageName: node - linkType: hard - -"fresh@npm:0.5.2": - version: 0.5.2 - resolution: "fresh@npm:0.5.2" - checksum: 13ea8b08f91e669a64e3ba3a20eb79d7ca5379a81f1ff7f4310d54e2320645503cc0c78daedc93dfb6191287295f6479544a649c64d8e41a1c0fb0c221552346 - languageName: node - linkType: hard - "fs-constants@npm:^1.0.0": version: 1.0.0 resolution: "fs-constants@npm:1.0.0" @@ -8527,30 +6904,6 @@ __metadata: languageName: node linkType: hard -"fs-extra@npm:^0.30.0": - version: 0.30.0 - resolution: "fs-extra@npm:0.30.0" - dependencies: - graceful-fs: ^4.1.2 - jsonfile: ^2.1.0 - klaw: ^1.0.0 - path-is-absolute: ^1.0.0 - rimraf: ^2.2.8 - checksum: 6edfd65fc813baa27f1603778c0f5ec11f8c5006a20b920437813ee2023eba18aeec8bef1c89b2e6c84f9fc90fdc7c916f4a700466c8c69d22a35d018f2570f0 - languageName: node - linkType: hard - -"fs-extra@npm:^4.0.2, fs-extra@npm:^4.0.3": - version: 4.0.3 - resolution: "fs-extra@npm:4.0.3" - dependencies: - graceful-fs: ^4.1.2 - jsonfile: ^4.0.0 - universalify: ^0.1.0 - checksum: c5ae3c7043ad7187128e619c0371da01b58694c1ffa02c36fb3f5b459925d9c27c3cb1e095d9df0a34a85ca993d8b8ff6f6ecef868fd5ebb243548afa7fc0936 - languageName: node - linkType: hard - "fs-extra@npm:^7.0.0, fs-extra@npm:^7.0.1": version: 7.0.1 resolution: "fs-extra@npm:7.0.1" @@ -8590,26 +6943,8 @@ __metadata: resolution: "fs-jetpack@npm:2.4.0" dependencies: minimatch: ^3.0.2 - rimraf: ^2.6.3 - checksum: 486a2974f5bbd3181b787416ff9c5fe128e2fa4a902e7314c659f0e141431ff075da1c674b98ba96e4f5b667a5f492231c51703ac3f073920f6388221394e92b - languageName: node - linkType: hard - -"fs-minipass@npm:^1.2.7": - version: 1.2.7 - resolution: "fs-minipass@npm:1.2.7" - dependencies: - minipass: ^2.6.0 - checksum: 40fd46a2b5dcb74b3a580269f9a0c36f9098c2ebd22cef2e1a004f375b7b665c11f1507ec3f66ee6efab5664109f72d0a74ea19c3370842214c3da5168d6fdd7 - languageName: node - linkType: hard - -"fs-minipass@npm:^2.0.0": - version: 2.1.0 - resolution: "fs-minipass@npm:2.1.0" - dependencies: - minipass: ^3.0.0 - checksum: 1b8d128dae2ac6cc94230cc5ead341ba3e0efaef82dab46a33d171c044caaa6ca001364178d42069b2809c35a1c3c35079a32107c770e9ffab3901b59af8c8b1 + rimraf: ^2.6.3 + checksum: 486a2974f5bbd3181b787416ff9c5fe128e2fa4a902e7314c659f0e141431ff075da1c674b98ba96e4f5b667a5f492231c51703ac3f073920f6388221394e92b languageName: node linkType: hard @@ -8622,13 +6957,6 @@ __metadata: languageName: node linkType: hard -"fs-readdir-recursive@npm:^1.1.0": - version: 1.1.0 - resolution: "fs-readdir-recursive@npm:1.1.0" - checksum: 29d50f3d2128391c7fc9fd051c8b7ea45bcc8aa84daf31ef52b17218e20bfd2bd34d02382742801954cc8d1905832b68227f6b680a666ce525d8b6b75068ad1e - languageName: node - linkType: hard - "fs.realpath@npm:^1.0.0": version: 1.0.0 resolution: "fs.realpath@npm:1.0.0" @@ -8662,15 +6990,17 @@ __metadata: languageName: node linkType: hard -"function.prototype.name@npm:^1.1.6": - version: 1.1.6 - resolution: "function.prototype.name@npm:1.1.6" +"function.prototype.name@npm:^1.1.6, function.prototype.name@npm:^1.1.8": + version: 1.1.8 + resolution: "function.prototype.name@npm:1.1.8" dependencies: - call-bind: ^1.0.2 - define-properties: ^1.2.0 - es-abstract: ^1.22.1 + call-bind: ^1.0.8 + call-bound: ^1.0.3 + define-properties: ^1.2.1 functions-have-names: ^1.2.3 - checksum: 7a3f9bd98adab09a07f6e1f03da03d3f7c26abbdeaeee15223f6c04a9fb5674792bdf5e689dac19b97ac71de6aad2027ba3048a9b883aa1b3173eed6ab07f479 + hasown: ^2.0.2 + is-callable: ^1.2.7 + checksum: 3a366535dc08b25f40a322efefa83b2da3cd0f6da41db7775f2339679120ef63b6c7e967266182609e655b8f0a8f65596ed21c7fd72ad8bd5621c2340edd4010 languageName: node linkType: hard @@ -8688,7 +7018,7 @@ __metadata: languageName: node linkType: hard -"ganache-cli@npm:^6.12.2, ganache-cli@npm:latest": +"ganache-cli@npm:latest": version: 6.12.2 resolution: "ganache-cli@npm:6.12.2" dependencies: @@ -8701,49 +7031,6 @@ __metadata: languageName: node linkType: hard -"ganache-core@npm:^2.13.2": - version: 2.13.2 - resolution: "ganache-core@npm:2.13.2" - dependencies: - abstract-leveldown: 3.0.0 - async: 2.6.2 - bip39: 2.5.0 - cachedown: 1.0.0 - clone: 2.1.2 - debug: 3.2.6 - encoding-down: 5.0.4 - eth-sig-util: 3.0.0 - ethereumjs-abi: 0.6.8 - ethereumjs-account: 3.0.0 - ethereumjs-block: 2.2.2 - ethereumjs-common: 1.5.0 - ethereumjs-tx: 2.1.2 - ethereumjs-util: 6.2.1 - ethereumjs-vm: 4.2.0 - ethereumjs-wallet: 0.6.5 - heap: 0.2.6 - keccak: 3.0.1 - level-sublevel: 6.6.4 - levelup: 3.1.1 - lodash: 4.17.20 - lru-cache: 5.1.1 - merkle-patricia-tree: 3.0.0 - patch-package: 6.2.2 - seedrandom: 3.0.1 - source-map-support: 0.5.12 - tmp: 0.1.0 - web3: 1.2.11 - web3-provider-engine: 14.2.1 - websocket: 1.0.32 - dependenciesMeta: - ethereumjs-wallet: - optional: true - web3: - optional: true - checksum: 799b275abd09259c88a4e78c335e807d14cc12d3a1ceb9d7cdeef484cf5fab541847edf9cf209f448190199dbd0796393d308d50e6823565154c17dd0c3a4048 - languageName: node - linkType: hard - "ganache@npm:7.4.3": version: 7.4.3 resolution: "ganache@npm:7.4.3" @@ -8770,13 +7057,6 @@ __metadata: languageName: node linkType: hard -"get-caller-file@npm:^1.0.1": - version: 1.0.3 - resolution: "get-caller-file@npm:1.0.3" - checksum: 2b90a7f848896abcebcdc0acc627a435bcf05b9cd280599bc980ebfcdc222416c3df12c24c4845f69adc4346728e8966f70b758f9369f3534182791dfbc25c05 - languageName: node - linkType: hard - "get-caller-file@npm:^2.0.1, get-caller-file@npm:^2.0.5": version: 2.0.5 resolution: "get-caller-file@npm:2.0.5" @@ -8791,16 +7071,21 @@ __metadata: languageName: node linkType: hard -"get-intrinsic@npm:^1.1.3, get-intrinsic@npm:^1.2.1, get-intrinsic@npm:^1.2.3, get-intrinsic@npm:^1.2.4": - version: 1.2.4 - resolution: "get-intrinsic@npm:1.2.4" +"get-intrinsic@npm:^1.2.4, get-intrinsic@npm:^1.2.5, get-intrinsic@npm:^1.2.6, get-intrinsic@npm:^1.2.7, get-intrinsic@npm:^1.3.0": + version: 1.3.0 + resolution: "get-intrinsic@npm:1.3.0" dependencies: + call-bind-apply-helpers: ^1.0.2 + es-define-property: ^1.0.1 es-errors: ^1.3.0 + es-object-atoms: ^1.1.1 function-bind: ^1.1.2 - has-proto: ^1.0.1 - has-symbols: ^1.0.3 - hasown: ^2.0.0 - checksum: 414e3cdf2c203d1b9d7d33111df746a4512a1aa622770b361dadddf8ed0b5aeb26c560f49ca077e24bfafb0acb55ca908d1f709216ccba33ffc548ec8a79a951 + get-proto: ^1.0.1 + gopd: ^1.2.0 + has-symbols: ^1.1.0 + hasown: ^2.0.2 + math-intrinsics: ^1.1.0 + checksum: 301008e4482bb9a9cb49e132b88fee093bff373b4e6def8ba219b1e96b60158a6084f273ef5cafe832e42cd93462f4accb46a618d35fe59a2b507f2388c5b79d languageName: node linkType: hard @@ -8811,10 +7096,13 @@ __metadata: languageName: node linkType: hard -"get-port@npm:^3.1.0": - version: 3.2.0 - resolution: "get-port@npm:3.2.0" - checksum: 31f530326569683ac4b7452eb7573c40e9dbe52aec14d80745c35475261e6389160da153d5b8ae911150b4ce99003472b30c69ba5be0cedeaa7865b95542d168 +"get-proto@npm:^1.0.0, get-proto@npm:^1.0.1": + version: 1.0.1 + resolution: "get-proto@npm:1.0.1" + dependencies: + dunder-proto: ^1.0.1 + es-object-atoms: ^1.0.0 + checksum: 4fc96afdb58ced9a67558698b91433e6b037aaa6f1493af77498d7c85b141382cf223c0e5946f334fb328ee85dfe6edd06d218eaf09556f4bc4ec6005d7f5f7b languageName: node linkType: hard @@ -8825,7 +7113,7 @@ __metadata: languageName: node linkType: hard -"get-stream@npm:^4.0.0, get-stream@npm:^4.1.0": +"get-stream@npm:^4.0.0": version: 4.1.0 resolution: "get-stream@npm:4.1.0" dependencies: @@ -8834,7 +7122,7 @@ __metadata: languageName: node linkType: hard -"get-stream@npm:^5.0.0, get-stream@npm:^5.1.0": +"get-stream@npm:^5.0.0": version: 5.2.0 resolution: "get-stream@npm:5.2.0" dependencies: @@ -8843,21 +7131,14 @@ __metadata: languageName: node linkType: hard -"get-symbol-description@npm:^1.0.2": - version: 1.0.2 - resolution: "get-symbol-description@npm:1.0.2" +"get-symbol-description@npm:^1.1.0": + version: 1.1.0 + resolution: "get-symbol-description@npm:1.1.0" dependencies: - call-bind: ^1.0.5 + call-bound: ^1.0.3 es-errors: ^1.3.0 - get-intrinsic: ^1.2.4 - checksum: e1cb53bc211f9dbe9691a4f97a46837a553c4e7caadd0488dc24ac694db8a390b93edd412b48dcdd0b4bbb4c595de1709effc75fc87c0839deedc6968f5bd973 - languageName: node - linkType: hard - -"get-value@npm:^2.0.3, get-value@npm:^2.0.6": - version: 2.0.6 - resolution: "get-value@npm:2.0.6" - checksum: 5c3b99cb5398ea8016bf46ff17afc5d1d286874d2ad38ca5edb6e87d75c0965b0094cb9a9dddef2c59c23d250702323539a7fbdd870620db38c7e7d7ec87c1eb + get-intrinsic: ^1.2.6 + checksum: 655ed04db48ee65ef2ddbe096540d4405e79ba0a7f54225775fef43a7e2afcb93a77d141c5f05fdef0afce2eb93bcbfb3597142189d562ac167ff183582683cd languageName: node linkType: hard @@ -8914,36 +7195,9 @@ __metadata: languageName: node linkType: hard -"glob@npm:7.2.0": - version: 7.2.0 - resolution: "glob@npm:7.2.0" - dependencies: - fs.realpath: ^1.0.0 - inflight: ^1.0.4 - inherits: 2 - minimatch: ^3.0.4 - once: ^1.3.0 - path-is-absolute: ^1.0.0 - checksum: 78a8ea942331f08ed2e055cb5b9e40fe6f46f579d7fd3d694f3412fe5db23223d29b7fee1575440202e9a7ff9a72ab106a39fee39934c7bedafe5e5f8ae20134 - languageName: node - linkType: hard - -"glob@npm:8.1.0, glob@npm:^8.0.3": - version: 8.1.0 - resolution: "glob@npm:8.1.0" - dependencies: - fs.realpath: ^1.0.0 - inflight: ^1.0.4 - inherits: 2 - minimatch: ^5.0.1 - once: ^1.3.0 - checksum: 92fbea3221a7d12075f26f0227abac435de868dd0736a17170663783296d0dd8d3d532a5672b4488a439bf5d7fb85cdd07c11185d6cd39184f0385cbdfb86a47 - languageName: node - linkType: hard - "glob@npm:^10.2.2, glob@npm:^10.3.10": - version: 10.4.2 - resolution: "glob@npm:10.4.2" + version: 10.4.5 + resolution: "glob@npm:10.4.5" dependencies: foreground-child: ^3.1.0 jackspeak: ^3.1.2 @@ -8953,7 +7207,7 @@ __metadata: path-scurry: ^1.11.1 bin: glob: dist/esm/bin.mjs - checksum: bd7c0e30701136e936f414e5f6f82c7f04503f01df77408f177aa584927412f0bde0338e6ec541618cd21eacc57dde33e7b3c6c0a779cc1c6e6a0e14f3d15d9b + checksum: 0bc725de5e4862f9f387fd0f2b274baf16850dcd2714502ccf471ee401803997983e2c05590cb65f9675a3c6f2a58e7a53f9e365704108c6ad3cbf1d60934c4a languageName: node linkType: hard @@ -8970,7 +7224,7 @@ __metadata: languageName: node linkType: hard -"glob@npm:^7.0.0, glob@npm:^7.1.2, glob@npm:^7.1.3, glob@npm:^7.1.6, glob@npm:~7.2.3": +"glob@npm:^7.0.0, glob@npm:^7.1.2, glob@npm:^7.1.3, glob@npm:^7.1.6": version: 7.2.3 resolution: "glob@npm:7.2.3" dependencies: @@ -8984,6 +7238,19 @@ __metadata: languageName: node linkType: hard +"glob@npm:^8.0.3, glob@npm:^8.1.0": + version: 8.1.0 + resolution: "glob@npm:8.1.0" + dependencies: + fs.realpath: ^1.0.0 + inflight: ^1.0.4 + inherits: 2 + minimatch: ^5.0.1 + once: ^1.3.0 + checksum: 92fbea3221a7d12075f26f0227abac435de868dd0736a17170663783296d0dd8d3d532a5672b4488a439bf5d7fb85cdd07c11185d6cd39184f0385cbdfb86a47 + languageName: node + linkType: hard + "global-modules@npm:^2.0.0": version: 2.0.0 resolution: "global-modules@npm:2.0.0" @@ -9004,16 +7271,6 @@ __metadata: languageName: node linkType: hard -"global@npm:~4.4.0": - version: 4.4.0 - resolution: "global@npm:4.4.0" - dependencies: - min-document: ^2.19.0 - process: ^0.11.10 - checksum: 9c057557c8f5a5bcfbeb9378ba4fe2255d04679452be504608dd5f13b54edf79f7be1db1031ea06a4ec6edd3b9f5f17d2d172fb47e6c69dae57fd84b7e72b77f - languageName: node - linkType: hard - "globals@npm:^12.1.0": version: 12.4.0 resolution: "globals@npm:12.4.0" @@ -9032,14 +7289,7 @@ __metadata: languageName: node linkType: hard -"globals@npm:^9.18.0": - version: 9.18.0 - resolution: "globals@npm:9.18.0" - checksum: e9c066aecfdc5ea6f727344a4246ecc243aaf66ede3bffee10ddc0c73351794c25e727dd046090dcecd821199a63b9de6af299a6e3ba292c8b22f0a80ea32073 - languageName: node - linkType: hard - -"globalthis@npm:^1.0.3": +"globalthis@npm:^1.0.4": version: 1.0.4 resolution: "globalthis@npm:1.0.4" dependencies: @@ -9119,54 +7369,14 @@ __metadata: languageName: node linkType: hard -"gopd@npm:^1.0.1": - version: 1.0.1 - resolution: "gopd@npm:1.0.1" - dependencies: - get-intrinsic: ^1.1.3 - checksum: a5ccfb8806e0917a94e0b3de2af2ea4979c1da920bc381667c260e00e7cafdbe844e2cb9c5bcfef4e5412e8bf73bab837285bc35c7ba73aaaf0134d4583393a6 - languageName: node - linkType: hard - -"got@npm:9.6.0": - version: 9.6.0 - resolution: "got@npm:9.6.0" - dependencies: - "@sindresorhus/is": ^0.14.0 - "@szmarczak/http-timer": ^1.1.2 - cacheable-request: ^6.0.0 - decompress-response: ^3.3.0 - duplexer3: ^0.1.4 - get-stream: ^4.1.0 - lowercase-keys: ^1.0.1 - mimic-response: ^1.0.1 - p-cancelable: ^1.0.0 - to-readable-stream: ^1.0.0 - url-parse-lax: ^3.0.0 - checksum: 941807bd9704bacf5eb401f0cc1212ffa1f67c6642f2d028fd75900471c221b1da2b8527f4553d2558f3faeda62ea1cf31665f8b002c6137f5de8732f07370b0 - languageName: node - linkType: hard - -"got@npm:^11.8.5": - version: 11.8.6 - resolution: "got@npm:11.8.6" - dependencies: - "@sindresorhus/is": ^4.0.0 - "@szmarczak/http-timer": ^4.0.5 - "@types/cacheable-request": ^6.0.1 - "@types/responselike": ^1.0.0 - cacheable-lookup: ^5.0.3 - cacheable-request: ^7.0.2 - decompress-response: ^6.0.0 - http2-wrapper: ^1.0.0-beta.5.2 - lowercase-keys: ^2.0.0 - p-cancelable: ^2.0.0 - responselike: ^2.0.0 - checksum: bbc783578a8d5030c8164ef7f57ce41b5ad7db2ed13371e1944bef157eeca5a7475530e07c0aaa71610d7085474d0d96222c9f4268d41db333a17e39b463f45d +"gopd@npm:^1.0.1, gopd@npm:^1.2.0": + version: 1.2.0 + resolution: "gopd@npm:1.2.0" + checksum: cc6d8e655e360955bdccaca51a12a474268f95bb793fc3e1f2bdadb075f28bfd1fd988dab872daf77a61d78cbaf13744bc8727a17cfb1d150d76047d805375f3 languageName: node linkType: hard -"graceful-fs@npm:^4.1.11, graceful-fs@npm:^4.1.2, graceful-fs@npm:^4.1.6, graceful-fs@npm:^4.1.9, graceful-fs@npm:^4.2.0, graceful-fs@npm:^4.2.4, graceful-fs@npm:^4.2.6": +"graceful-fs@npm:^4.1.2, graceful-fs@npm:^4.1.6, graceful-fs@npm:^4.2.0, graceful-fs@npm:^4.2.4, graceful-fs@npm:^4.2.6": version: 4.2.11 resolution: "graceful-fs@npm:4.2.11" checksum: ac85f94da92d8eb6b7f5a8b20ce65e43d66761c55ce85ac96df6865308390da45a8d3f0296dd3a663de65d30ba497bd46c696cc1e248c72b13d6d567138a4fc7 @@ -9181,9 +7391,9 @@ __metadata: linkType: hard "graphql@npm:^15.5.0": - version: 15.9.0 - resolution: "graphql@npm:15.9.0" - checksum: fecf48b878baf8bd1d943b79860554f9e0bdf8d23a8f014356209fedcc1f1353729388538842d8a4a79078ea75b3f24d504d074223c815acf9b6059837c5c934 + version: 15.10.1 + resolution: "graphql@npm:15.10.1" + checksum: 03e67181eaf803a6248806259a24d221333a05360e8952d155dba57c63691eec5e23969c52deea1d7314e7cdfe8bfef8857d9427e321ed615fc1400a8504ff59 languageName: node linkType: hard @@ -9222,27 +7432,14 @@ __metadata: languageName: node linkType: hard -"hardhat-gas-reporter@npm:^1.0.9": - version: 1.0.10 - resolution: "hardhat-gas-reporter@npm:1.0.10" - dependencies: - array-uniq: 1.0.3 - eth-gas-reporter: ^0.2.25 - sha1: ^1.1.1 - peerDependencies: - hardhat: ^2.0.2 - checksum: caaec13ab3fcda47b8768257e4416b5fd0e8ef3aca5369aa8195419d3d4a948cc182075333651df44215cfc629d088f5ed9f762c8c14ae5a4b4a4f2613e583d0 - languageName: node - linkType: hard - "hardhat-gas-reporter@npm:latest": - version: 2.2.0 - resolution: "hardhat-gas-reporter@npm:2.2.0" + version: 2.2.3 + resolution: "hardhat-gas-reporter@npm:2.2.3" dependencies: "@ethersproject/abi": ^5.7.0 "@ethersproject/bytes": ^5.7.0 "@ethersproject/units": ^5.7.0 - "@solidity-parser/parser": ^0.18.0 + "@solidity-parser/parser": ^0.19.0 axios: ^1.6.7 brotli-wasm: ^2.0.1 chalk: 4.1.2 @@ -9253,84 +7450,20 @@ __metadata: lodash: ^4.17.21 markdown-table: 2.0.0 sha1: ^1.1.1 - viem: 2.7.14 + viem: ^2.27.0 peerDependencies: hardhat: ^2.16.0 - checksum: b0f07ac3dcbfb88cd1a77385755fe23d8af467fc4110021bc1f890f8672a9a005f547592976ef92de3948377ab5405265ced6a40966e991ed859fa22abbde8ea - languageName: node - linkType: hard - -"hardhat@npm:^2.19.4": - version: 2.22.5 - resolution: "hardhat@npm:2.22.5" - dependencies: - "@ethersproject/abi": ^5.1.2 - "@metamask/eth-sig-util": ^4.0.0 - "@nomicfoundation/edr": ^0.4.0 - "@nomicfoundation/ethereumjs-common": 4.0.4 - "@nomicfoundation/ethereumjs-tx": 5.0.4 - "@nomicfoundation/ethereumjs-util": 9.0.4 - "@nomicfoundation/solidity-analyzer": ^0.1.0 - "@sentry/node": ^5.18.1 - "@types/bn.js": ^5.1.0 - "@types/lru-cache": ^5.1.0 - adm-zip: ^0.4.16 - aggregate-error: ^3.0.0 - ansi-escapes: ^4.3.0 - boxen: ^5.1.2 - chalk: ^2.4.2 - chokidar: ^3.4.0 - ci-info: ^2.0.0 - debug: ^4.1.1 - enquirer: ^2.3.0 - env-paths: ^2.2.0 - ethereum-cryptography: ^1.0.3 - ethereumjs-abi: ^0.6.8 - find-up: ^2.1.0 - fp-ts: 1.19.3 - fs-extra: ^7.0.1 - glob: 7.2.0 - immutable: ^4.0.0-rc.12 - io-ts: 1.10.4 - keccak: ^3.0.2 - lodash: ^4.17.11 - mnemonist: ^0.38.0 - mocha: ^10.0.0 - p-map: ^4.0.0 - raw-body: ^2.4.1 - resolve: 1.17.0 - semver: ^6.3.0 - solc: 0.7.3 - source-map-support: ^0.5.13 - stacktrace-parser: ^0.1.10 - tsort: 0.0.1 - undici: ^5.14.0 - uuid: ^8.3.2 - ws: ^7.4.6 - peerDependencies: - ts-node: "*" - typescript: "*" - peerDependenciesMeta: - ts-node: - optional: true - typescript: - optional: true - bin: - hardhat: internal/cli/bootstrap.js - checksum: 34ab9ae3820c26ea4c92db43aefb15668d0575787d214a408b3274d445a7626775f2966dca2cf82a8fa8d9f39ebfdc90f3fb7189409b9582e373ce5b66ec3855 + checksum: fcbc73ad000b2fdd18eb430f2ecaa5e74e6d7a7795a5c9631999bf2f826c20702f96793af92d6b14916e76729be19086b84b5fb8327db1c54b542ec4f48dfb61 languageName: node linkType: hard -"hardhat@npm:^2.22.8": - version: 2.22.8 - resolution: "hardhat@npm:2.22.8" +"hardhat@npm:^2.22.18, hardhat@npm:^2.23.0": + version: 2.24.0 + resolution: "hardhat@npm:2.24.0" dependencies: + "@ethereumjs/util": ^9.1.0 "@ethersproject/abi": ^5.1.2 - "@metamask/eth-sig-util": ^4.0.0 - "@nomicfoundation/edr": ^0.5.2 - "@nomicfoundation/ethereumjs-common": 4.0.4 - "@nomicfoundation/ethereumjs-tx": 5.0.4 - "@nomicfoundation/ethereumjs-util": 9.0.4 + "@nomicfoundation/edr": ^0.11.0 "@nomicfoundation/solidity-analyzer": ^0.1.0 "@sentry/node": ^5.18.1 "@types/bn.js": ^5.1.0 @@ -9339,31 +7472,32 @@ __metadata: aggregate-error: ^3.0.0 ansi-escapes: ^4.3.0 boxen: ^5.1.2 - chalk: ^2.4.2 - chokidar: ^3.4.0 + chokidar: ^4.0.0 ci-info: ^2.0.0 debug: ^4.1.1 enquirer: ^2.3.0 env-paths: ^2.2.0 ethereum-cryptography: ^1.0.3 - ethereumjs-abi: ^0.6.8 - find-up: ^2.1.0 + find-up: ^5.0.0 fp-ts: 1.19.3 fs-extra: ^7.0.1 - glob: 7.2.0 immutable: ^4.0.0-rc.12 io-ts: 1.10.4 + json-stream-stringify: ^3.1.4 keccak: ^3.0.2 lodash: ^4.17.11 + micro-eth-signer: ^0.14.0 mnemonist: ^0.38.0 mocha: ^10.0.0 p-map: ^4.0.0 + picocolors: ^1.1.0 raw-body: ^2.4.1 resolve: 1.17.0 semver: ^6.3.0 solc: 0.8.26 source-map-support: ^0.5.13 stacktrace-parser: ^0.1.10 + tinyglobby: ^0.2.6 tsort: 0.0.1 undici: ^5.14.0 uuid: ^8.3.2 @@ -9378,23 +7512,14 @@ __metadata: optional: true bin: hardhat: internal/cli/bootstrap.js - checksum: 3731b510540f800b3b931e3ad7db4510dbd35eff18f34382875778db43de2a5ce1c52596c392aa694324f66392e844fede85954ab3cdc08df3da10f2a810135f + checksum: 405b10e5ac074389c4b14b412b681eee04ad92451e786ea6ffe1448337c40a9b27ee4a881707f976e49bd972876e6e41933a09ded3270b35a2bcbba0d76d2326 languageName: node linkType: hard -"has-ansi@npm:^2.0.0": - version: 2.0.0 - resolution: "has-ansi@npm:2.0.0" - dependencies: - ansi-regex: ^2.0.0 - checksum: 1b51daa0214440db171ff359d0a2d17bc20061164c57e76234f614c91dbd2a79ddd68dfc8ee73629366f7be45a6df5f2ea9de83f52e1ca24433f2cc78c35d8ec - languageName: node - linkType: hard - -"has-bigints@npm:^1.0.1, has-bigints@npm:^1.0.2": - version: 1.0.2 - resolution: "has-bigints@npm:1.0.2" - checksum: 390e31e7be7e5c6fe68b81babb73dfc35d413604d7ee5f56da101417027a4b4ce6a27e46eff97ad040c835b5d228676eae99a9b5c3bc0e23c8e81a49241ff45b +"has-bigints@npm:^1.0.2": + version: 1.1.0 + resolution: "has-bigints@npm:1.1.0" + checksum: 79730518ae02c77e4af6a1d1a0b6a2c3e1509785532771f9baf0241e83e36329542c3d7a0e723df8cbc85f74eff4f177828a2265a01ba576adbdc2d40d86538b languageName: node linkType: hard @@ -9428,21 +7553,23 @@ __metadata: languageName: node linkType: hard -"has-proto@npm:^1.0.1, has-proto@npm:^1.0.3": - version: 1.0.3 - resolution: "has-proto@npm:1.0.3" - checksum: fe7c3d50b33f50f3933a04413ed1f69441d21d2d2944f81036276d30635cad9279f6b43bc8f32036c31ebdfcf6e731150f46c1907ad90c669ffe9b066c3ba5c4 +"has-proto@npm:^1.2.0": + version: 1.2.0 + resolution: "has-proto@npm:1.2.0" + dependencies: + dunder-proto: ^1.0.0 + checksum: f55010cb94caa56308041d77967c72a02ffd71386b23f9afa8447e58bc92d49d15c19bf75173713468e92fe3fb1680b03b115da39c21c32c74886d1d50d3e7ff languageName: node linkType: hard -"has-symbols@npm:^1.0.2, has-symbols@npm:^1.0.3": - version: 1.0.3 - resolution: "has-symbols@npm:1.0.3" - checksum: a054c40c631c0d5741a8285010a0777ea0c068f99ed43e5d6eb12972da223f8af553a455132fdb0801bdcfa0e0f443c0c03a68d8555aa529b3144b446c3f2410 +"has-symbols@npm:^1.0.3, has-symbols@npm:^1.1.0": + version: 1.1.0 + resolution: "has-symbols@npm:1.1.0" + checksum: b2316c7302a0e8ba3aaba215f834e96c22c86f192e7310bdf689dd0e6999510c89b00fbc5742571507cebf25764d68c988b3a0da217369a73596191ac0ce694b languageName: node linkType: hard -"has-tostringtag@npm:^1.0.0, has-tostringtag@npm:^1.0.2": +"has-tostringtag@npm:^1.0.2": version: 1.0.2 resolution: "has-tostringtag@npm:1.0.2" dependencies: @@ -9451,52 +7578,6 @@ __metadata: languageName: node linkType: hard -"has-value@npm:^0.3.1": - version: 0.3.1 - resolution: "has-value@npm:0.3.1" - dependencies: - get-value: ^2.0.3 - has-values: ^0.1.4 - isobject: ^2.0.0 - checksum: 29e2a1e6571dad83451b769c7ce032fce6009f65bccace07c2962d3ad4d5530b6743d8f3229e4ecf3ea8e905d23a752c5f7089100c1f3162039fa6dc3976558f - languageName: node - linkType: hard - -"has-value@npm:^1.0.0": - version: 1.0.0 - resolution: "has-value@npm:1.0.0" - dependencies: - get-value: ^2.0.6 - has-values: ^1.0.0 - isobject: ^3.0.0 - checksum: b9421d354e44f03d3272ac39fd49f804f19bc1e4fa3ceef7745df43d6b402053f828445c03226b21d7d934a21ac9cf4bc569396dc312f496ddff873197bbd847 - languageName: node - linkType: hard - -"has-values@npm:^0.1.4": - version: 0.1.4 - resolution: "has-values@npm:0.1.4" - checksum: ab1c4bcaf811ccd1856c11cfe90e62fca9e2b026ebe474233a3d282d8d67e3b59ed85b622c7673bac3db198cb98bd1da2b39300a2f98e453729b115350af49bc - languageName: node - linkType: hard - -"has-values@npm:^1.0.0": - version: 1.0.0 - resolution: "has-values@npm:1.0.0" - dependencies: - is-number: ^3.0.0 - kind-of: ^4.0.0 - checksum: 77e6693f732b5e4cf6c38dfe85fdcefad0fab011af74995c3e83863fabf5e3a836f406d83565816baa0bc0a523c9410db8b990fe977074d61aeb6d8f4fcffa11 - languageName: node - linkType: hard - -"has@npm:~1.0.3": - version: 1.0.4 - resolution: "has@npm:1.0.4" - checksum: 8a11ba062e0627c9578a1d08285401e39f1d071a9692ddf793199070edb5648b21c774dd733e2a181edd635bf6862731885f476f4ccf67c998d7a5ff7cef2550 - languageName: node - linkType: hard - "hash-base@npm:^3.0.0": version: 3.1.0 resolution: "hash-base@npm:3.1.0" @@ -9508,16 +7589,6 @@ __metadata: languageName: node linkType: hard -"hash-base@npm:~3.0": - version: 3.0.4 - resolution: "hash-base@npm:3.0.4" - dependencies: - inherits: ^2.0.1 - safe-buffer: ^5.0.1 - checksum: 878465a0dfcc33cce195c2804135352c590d6d10980adc91a9005fd377e77f2011256c2b7cfce472e3f2e92d561d1bf3228d2da06348a9017ce9a258b3b49764 - languageName: node - linkType: hard - "hash.js@npm:1.1.7, hash.js@npm:^1.0.0, hash.js@npm:^1.0.3, hash.js@npm:^1.1.7": version: 1.1.7 resolution: "hash.js@npm:1.1.7" @@ -9528,7 +7599,7 @@ __metadata: languageName: node linkType: hard -"hasown@npm:^2.0.0, hasown@npm:^2.0.1, hasown@npm:^2.0.2": +"hasown@npm:^2.0.2": version: 2.0.2 resolution: "hasown@npm:2.0.2" dependencies: @@ -9537,7 +7608,7 @@ __metadata: languageName: node linkType: hard -"he@npm:1.2.0": +"he@npm:^1.2.0": version: 1.2.0 resolution: "he@npm:1.2.0" bin: @@ -9546,13 +7617,6 @@ __metadata: languageName: node linkType: hard -"heap@npm:0.2.6": - version: 0.2.6 - resolution: "heap@npm:0.2.6" - checksum: 1291b9b9efb5090d01c6d04a89c91ca6e0e0eb7f3694d8254f7a5effcc5ab9249bc3d16767b276645ffe86d9b2bbd82ed977f8988f55375e9f2a2c80647ebbdc - languageName: node - linkType: hard - "heap@npm:>= 0.2.0": version: 0.2.7 resolution: "heap@npm:0.2.7" @@ -9571,36 +7635,14 @@ __metadata: languageName: node linkType: hard -"home-or-tmp@npm:^2.0.0": - version: 2.0.0 - resolution: "home-or-tmp@npm:2.0.0" - dependencies: - os-homedir: ^1.0.0 - os-tmpdir: ^1.0.1 - checksum: b783c6ffd22f716d82f53e8c781cbe49bc9f4109a89ea86a27951e54c0bd335caf06bd828be2958cd9f4681986df1739558ae786abda6298cdd6d3edc2c362f1 - languageName: node - linkType: hard - -"hosted-git-info@npm:^2.1.4, hosted-git-info@npm:^2.6.0": +"hosted-git-info@npm:^2.6.0": version: 2.8.9 resolution: "hosted-git-info@npm:2.8.9" checksum: c955394bdab888a1e9bb10eb33029e0f7ce5a2ac7b3f158099dc8c486c99e73809dca609f5694b223920ca2174db33d32b12f9a2a47141dc59607c29da5a62dd languageName: node linkType: hard -"http-basic@npm:^8.1.1": - version: 8.1.3 - resolution: "http-basic@npm:8.1.3" - dependencies: - caseless: ^0.12.0 - concat-stream: ^1.6.2 - http-response-object: ^3.0.1 - parse-cache-control: ^1.0.1 - checksum: 7df5dc4d4b6eb8cc3beaa77f8e5c3074288ec3835abd83c85e5bb66d8a95a0ef97664d862caf5e225698cb795f78f9a5abd0d39404e5356ccd3e5e10c87936a5 - languageName: node - linkType: hard - -"http-cache-semantics@npm:^4.0.0, http-cache-semantics@npm:^4.1.1": +"http-cache-semantics@npm:^4.1.1": version: 4.1.1 resolution: "http-cache-semantics@npm:4.1.1" checksum: 83ac0bc60b17a3a36f9953e7be55e5c8f41acc61b22583060e8dedc9dd5e3607c823a88d0926f9150e571f90946835c7fe150732801010845c72cd8bbff1a236 @@ -9620,13 +7662,6 @@ __metadata: languageName: node linkType: hard -"http-https@npm:^1.0.0": - version: 1.0.0 - resolution: "http-https@npm:1.0.0" - checksum: 82fc4d2e512c64b35680944d1ae13e68220acfa05b06329832e271fd199c5c7fcff1f53fc1f91a1cd65a737ee4de14004dd3ba9a73cce33da970940c6e6ca774 - languageName: node - linkType: hard - "http-proxy-agent@npm:^7.0.0": version: 7.0.2 resolution: "http-proxy-agent@npm:7.0.2" @@ -9637,15 +7672,6 @@ __metadata: languageName: node linkType: hard -"http-response-object@npm:^3.0.1": - version: 3.0.2 - resolution: "http-response-object@npm:3.0.2" - dependencies: - "@types/node": ^10.0.3 - checksum: 6cbdcb4ce7b27c9158a131b772c903ed54add2ba831e29cc165e91c3969fa6f8105ddf924aac5b954b534ad15a1ae697b693331b2be5281ee24d79aae20c3264 - languageName: node - linkType: hard - "http-signature@npm:~1.2.0": version: 1.2.0 resolution: "http-signature@npm:1.2.0" @@ -9657,16 +7683,6 @@ __metadata: languageName: node linkType: hard -"http2-wrapper@npm:^1.0.0-beta.5.2": - version: 1.0.3 - resolution: "http2-wrapper@npm:1.0.3" - dependencies: - quick-lru: ^5.1.1 - resolve-alpn: ^1.0.0 - checksum: 74160b862ec699e3f859739101ff592d52ce1cb207b7950295bf7962e4aa1597ef709b4292c673bece9c9b300efad0559fc86c71b1409c7a1e02b7229456003e - languageName: node - linkType: hard - "https-proxy-agent@npm:^5.0.0": version: 5.0.1 resolution: "https-proxy-agent@npm:5.0.1" @@ -9678,12 +7694,12 @@ __metadata: linkType: hard "https-proxy-agent@npm:^7.0.1": - version: 7.0.5 - resolution: "https-proxy-agent@npm:7.0.5" + version: 7.0.6 + resolution: "https-proxy-agent@npm:7.0.6" dependencies: - agent-base: ^7.0.2 + agent-base: ^7.1.2 debug: 4 - checksum: 2e1a28960f13b041a50702ee74f240add8e75146a5c37fc98f1960f0496710f6918b3a9fe1e5aba41e50f58e6df48d107edd9c405c5f0d73ac260dabf2210857 + checksum: b882377a120aa0544846172e5db021fa8afbf83fea2a897d397bd2ddd8095ab268c24bc462f40a15f2a8c600bf4aa05ce52927f70038d4014e68aefecfa94e8d languageName: node linkType: hard @@ -9712,15 +7728,6 @@ __metadata: languageName: node linkType: hard -"idna-uts46-hx@npm:^2.3.1": - version: 2.3.1 - resolution: "idna-uts46-hx@npm:2.3.1" - dependencies: - punycode: 2.1.0 - checksum: d434c3558d2bc1090eb90f978f995101f469cb26593414ac57aa082c9352e49972b332c6e4188b9b15538172ccfeae3121e5a19b96972a97e6aeb0676d86639c - languageName: node - linkType: hard - "ieee754@npm:^1.1.13, ieee754@npm:^1.1.4, ieee754@npm:^1.2.1": version: 1.2.1 resolution: "ieee754@npm:1.2.1" @@ -9736,9 +7743,9 @@ __metadata: linkType: hard "ignore@npm:^5.1.1, ignore@npm:^5.2.0, ignore@npm:^5.2.4": - version: 5.3.1 - resolution: "ignore@npm:5.3.1" - checksum: 71d7bb4c1dbe020f915fd881108cbe85a0db3d636a0ea3ba911393c53946711d13a9b1143c7e70db06d571a5822c0a324a6bcde5c9904e7ca5047f01f1bf8cd3 + version: 5.3.2 + resolution: "ignore@npm:5.3.2" + checksum: 2acfd32a573260ea522ea0bfeff880af426d68f6831f973129e2ba7363f422923cf53aab62f8369cbf4667c7b25b6f8a3761b34ecdb284ea18e87a5262a865be languageName: node linkType: hard @@ -9764,19 +7771,19 @@ __metadata: linkType: hard "immutable@npm:^4.0.0-rc.12": - version: 4.3.6 - resolution: "immutable@npm:4.3.6" - checksum: 3afd020be988ec9ba42c1e585b88858970beba91332ac04ac11446722c7e5da03d5956f5049806573d29dfee25f69262297cb7f3bd6b16fc83a175a0176c6c2a + version: 4.3.7 + resolution: "immutable@npm:4.3.7" + checksum: 1c50eb053bb300796551604afff554066f041aa8e15926cf98f6d11d9736b62ad12531c06515dd96375258653878b4736f8051cd20b640f5f976d09fa640e3ec languageName: node linkType: hard "import-fresh@npm:^3.0.0, import-fresh@npm:^3.1.0, import-fresh@npm:^3.2.1, import-fresh@npm:^3.3.0": - version: 3.3.0 - resolution: "import-fresh@npm:3.3.0" + version: 3.3.1 + resolution: "import-fresh@npm:3.3.1" dependencies: parent-module: ^1.0.0 resolve-from: ^4.0.0 - checksum: 2cacfad06e652b1edc50be650f7ec3be08c5e5a6f6d12d035c440a42a8cc028e60a5b99ca08a77ab4d6b1346da7d971915828f33cdab730d3d42f08242d09baa + checksum: a06b19461b4879cc654d46f8a6244eb55eb053437afd4cbb6613cad6be203811849ed3e4ea038783092879487299fda24af932b86bdfff67c9055ba3612b8c87 languageName: node linkType: hard @@ -9804,7 +7811,7 @@ __metadata: languageName: node linkType: hard -"inherits@npm:2, inherits@npm:2.0.4, inherits@npm:^2.0.1, inherits@npm:^2.0.3, inherits@npm:^2.0.4, inherits@npm:~2.0.1, inherits@npm:~2.0.3, inherits@npm:~2.0.4": +"inherits@npm:2, inherits@npm:2.0.4, inherits@npm:^2.0.1, inherits@npm:^2.0.3, inherits@npm:^2.0.4, inherits@npm:~2.0.1, inherits@npm:~2.0.3": version: 2.0.4 resolution: "inherits@npm:2.0.4" checksum: 4a48a733847879d6cf6691860a6b1e3f0f4754176e4d71494c41f3475553768b10f84b5ce1d40fbd0e34e6bfbb864ee35858ad4dd2cf31e02fc4a154b724d7f1 @@ -9857,14 +7864,14 @@ __metadata: languageName: node linkType: hard -"internal-slot@npm:^1.0.7": - version: 1.0.7 - resolution: "internal-slot@npm:1.0.7" +"internal-slot@npm:^1.1.0": + version: 1.1.0 + resolution: "internal-slot@npm:1.1.0" dependencies: es-errors: ^1.3.0 - hasown: ^2.0.0 - side-channel: ^1.0.4 - checksum: cadc5eea5d7d9bc2342e93aae9f31f04c196afebb11bde97448327049f492cd7081e18623ae71388aac9cd237b692ca3a105be9c68ac39c1dec679d7409e33eb + hasown: ^2.0.2 + side-channel: ^1.1.0 + checksum: 8e0991c2d048cc08dab0a91f573c99f6a4215075887517ea4fa32203ce8aea60fa03f95b177977fa27eb502e5168366d0f3e02c762b799691411d49900611861 languageName: node linkType: hard @@ -9875,22 +7882,6 @@ __metadata: languageName: node linkType: hard -"invariant@npm:^2.2.2": - version: 2.2.4 - resolution: "invariant@npm:2.2.4" - dependencies: - loose-envify: ^1.0.0 - checksum: cc3182d793aad82a8d1f0af697b462939cb46066ec48bbf1707c150ad5fad6406137e91a262022c269702e01621f35ef60269f6c0d7fd178487959809acdfb14 - languageName: node - linkType: hard - -"invert-kv@npm:^1.0.0": - version: 1.0.0 - resolution: "invert-kv@npm:1.0.0" - checksum: aebeee31dda3b3d25ffd242e9a050926e7fe5df642d60953ab183aca1a7d1ffb39922eb2618affb0e850cf2923116f0da1345367759d88d097df5da1f1e1590e - languageName: node - linkType: hard - "invert-kv@npm:^2.0.0": version: 2.0.0 resolution: "invert-kv@npm:2.0.0" @@ -9924,13 +7915,6 @@ __metadata: languageName: node linkType: hard -"ipaddr.js@npm:1.9.1": - version: 1.9.1 - resolution: "ipaddr.js@npm:1.9.1" - checksum: f88d3825981486f5a1942414c8d77dd6674dd71c065adcfa46f578d677edcb99fda25af42675cb59db492fdf427b34a5abfcde3982da11a8fd83a500b41cfe77 - languageName: node - linkType: hard - "ipfs-core-types@npm:^0.9.0": version: 0.9.0 resolution: "ipfs-core-types@npm:0.9.0" @@ -10027,36 +8011,18 @@ __metadata: node-fetch: ^2.6.8 react-native-fetch-api: ^3.0.0 stream-to-it: ^0.2.2 - checksum: 08108e03ea7b90e0fa11b76a4e24bd29d7e027c603494b53c1cc37b367fb559eaeea7b0f10b2e83ee419d50cdcb4d8105febdf185cab75c7e55afd4c8ed51aba - languageName: node - linkType: hard - -"is-accessor-descriptor@npm:^1.0.1": - version: 1.0.1 - resolution: "is-accessor-descriptor@npm:1.0.1" - dependencies: - hasown: ^2.0.0 - checksum: 8db44c02230a5e9b9dec390a343178791f073d5d5556a400527d2fd67a72d93b226abab2bd4123305c268f5dc22831bfdbd38430441fda82ea9e0b95ddc6b267 - languageName: node - linkType: hard - -"is-arguments@npm:^1.1.1": - version: 1.1.1 - resolution: "is-arguments@npm:1.1.1" - dependencies: - call-bind: ^1.0.2 - has-tostringtag: ^1.0.0 - checksum: 7f02700ec2171b691ef3e4d0e3e6c0ba408e8434368504bb593d0d7c891c0dbfda6d19d30808b904a6cb1929bca648c061ba438c39f296c2a8ca083229c49f27 + checksum: 08108e03ea7b90e0fa11b76a4e24bd29d7e027c603494b53c1cc37b367fb559eaeea7b0f10b2e83ee419d50cdcb4d8105febdf185cab75c7e55afd4c8ed51aba languageName: node linkType: hard -"is-array-buffer@npm:^3.0.4": - version: 3.0.4 - resolution: "is-array-buffer@npm:3.0.4" +"is-array-buffer@npm:^3.0.4, is-array-buffer@npm:^3.0.5": + version: 3.0.5 + resolution: "is-array-buffer@npm:3.0.5" dependencies: - call-bind: ^1.0.2 - get-intrinsic: ^1.2.1 - checksum: e4e3e6ef0ff2239e75371d221f74bc3c26a03564a22efb39f6bb02609b598917ddeecef4e8c877df2a25888f247a98198959842a5e73236bc7f22cabdf6351a7 + call-bind: ^1.0.8 + call-bound: ^1.0.3 + get-intrinsic: ^1.2.6 + checksum: f137a2a6e77af682cdbffef1e633c140cf596f72321baf8bba0f4ef22685eb4339dde23dfe9e9ca430b5f961dee4d46577dcf12b792b68518c8449b134fb9156 languageName: node linkType: hard @@ -10067,12 +8033,25 @@ __metadata: languageName: node linkType: hard -"is-bigint@npm:^1.0.1": - version: 1.0.4 - resolution: "is-bigint@npm:1.0.4" +"is-async-function@npm:^2.0.0": + version: 2.1.1 + resolution: "is-async-function@npm:2.1.1" + dependencies: + async-function: ^1.0.0 + call-bound: ^1.0.3 + get-proto: ^1.0.1 + has-tostringtag: ^1.0.2 + safe-regex-test: ^1.1.0 + checksum: 9bece45133da26636488ca127d7686b85ad3ca18927e2850cff1937a650059e90be1c71a48623f8791646bb7a241b0cabf602a0b9252dcfa5ab273f2399000e6 + languageName: node + linkType: hard + +"is-bigint@npm:^1.1.0": + version: 1.1.0 + resolution: "is-bigint@npm:1.1.0" dependencies: - has-bigints: ^1.0.1 - checksum: c56edfe09b1154f8668e53ebe8252b6f185ee852a50f9b41e8d921cb2bed425652049fbe438723f6cb48a63ca1aa051e948e7e401e093477c99c84eba244f666 + has-bigints: ^1.0.2 + checksum: ee1544f0e664f253306786ed1dce494b8cf242ef415d6375d8545b4d8816b0f054bd9f948a8988ae2c6325d1c28260dd02978236b2f7b8fb70dfc4838a6c9fa7 languageName: node linkType: hard @@ -10085,20 +8064,13 @@ __metadata: languageName: node linkType: hard -"is-boolean-object@npm:^1.1.0": - version: 1.1.2 - resolution: "is-boolean-object@npm:1.1.2" +"is-boolean-object@npm:^1.2.1": + version: 1.2.2 + resolution: "is-boolean-object@npm:1.2.2" dependencies: - call-bind: ^1.0.2 - has-tostringtag: ^1.0.0 - checksum: c03b23dbaacadc18940defb12c1c0e3aaece7553ef58b162a0f6bba0c2a7e1551b59f365b91e00d2dbac0522392d576ef322628cb1d036a0fe51eb466db67222 - languageName: node - linkType: hard - -"is-buffer@npm:^1.1.5": - version: 1.1.6 - resolution: "is-buffer@npm:1.1.6" - checksum: 4a186d995d8bbf9153b4bd9ff9fd04ae75068fe695d29025d25e592d9488911eeece84eefbd8fa41b8ddcc0711058a71d4c466dcf6f1f6e1d83830052d8ca707 + call-bound: ^1.0.3 + has-tostringtag: ^1.0.2 + checksum: 0415b181e8f1bfd5d3f8a20f8108e64d372a72131674eea9c2923f39d065b6ad08d654765553bdbffbd92c3746f1007986c34087db1bd89a31f71be8359ccdaa languageName: node linkType: hard @@ -10109,86 +8081,40 @@ __metadata: languageName: node linkType: hard -"is-callable@npm:^1.1.3, is-callable@npm:^1.1.4, is-callable@npm:^1.2.7": +"is-callable@npm:^1.2.7": version: 1.2.7 resolution: "is-callable@npm:1.2.7" checksum: 61fd57d03b0d984e2ed3720fb1c7a897827ea174bd44402878e059542ea8c4aeedee0ea0985998aa5cc2736b2fa6e271c08587addb5b3959ac52cf665173d1ac languageName: node linkType: hard -"is-ci@npm:^2.0.0": - version: 2.0.0 - resolution: "is-ci@npm:2.0.0" - dependencies: - ci-info: ^2.0.0 - bin: - is-ci: bin.js - checksum: 77b869057510f3efa439bbb36e9be429d53b3f51abd4776eeea79ab3b221337fe1753d1e50058a9e2c650d38246108beffb15ccfd443929d77748d8c0cc90144 - languageName: node - linkType: hard - -"is-core-module@npm:^2.11.0, is-core-module@npm:^2.13.0, is-core-module@npm:^2.13.1": - version: 2.14.0 - resolution: "is-core-module@npm:2.14.0" +"is-core-module@npm:^2.11.0, is-core-module@npm:^2.13.0, is-core-module@npm:^2.15.1, is-core-module@npm:^2.16.0": + version: 2.16.1 + resolution: "is-core-module@npm:2.16.1" dependencies: hasown: ^2.0.2 - checksum: 6bba6c8dc99d88d6f3b2746709d82caddcd9565cafd5870e28ab320720e27e6d9d2bb953ba0839ed4d2ee264bfdd14a9fa1bbc242a916f7dacc8aa95f0322256 - languageName: node - linkType: hard - -"is-data-descriptor@npm:^1.0.1": - version: 1.0.1 - resolution: "is-data-descriptor@npm:1.0.1" - dependencies: - hasown: ^2.0.0 - checksum: fc6da5be5177149d554c5612cc382e9549418ed72f2d3ed5a3e6511b03dd119ae1b2258320ca94931df50b7e9ee012894eccd4ca45bbcadf0d5b27da6faeb15a + checksum: 6ec5b3c42d9cbf1ac23f164b16b8a140c3cec338bf8f884c076ca89950c7cc04c33e78f02b8cae7ff4751f3247e3174b2330f1fe4de194c7210deb8b1ea316a7 languageName: node linkType: hard -"is-data-view@npm:^1.0.1": - version: 1.0.1 - resolution: "is-data-view@npm:1.0.1" +"is-data-view@npm:^1.0.1, is-data-view@npm:^1.0.2": + version: 1.0.2 + resolution: "is-data-view@npm:1.0.2" dependencies: + call-bound: ^1.0.2 + get-intrinsic: ^1.2.6 is-typed-array: ^1.1.13 - checksum: 4ba4562ac2b2ec005fefe48269d6bd0152785458cd253c746154ffb8a8ab506a29d0cfb3b74af87513843776a88e4981ae25c89457bf640a33748eab1a7216b5 + checksum: 31600dd19932eae7fd304567e465709ffbfa17fa236427c9c864148e1b54eb2146357fcf3aed9b686dee13c217e1bb5a649cb3b9c479e1004c0648e9febde1b2 languageName: node linkType: hard -"is-date-object@npm:^1.0.1, is-date-object@npm:^1.0.5": - version: 1.0.5 - resolution: "is-date-object@npm:1.0.5" - dependencies: - has-tostringtag: ^1.0.0 - checksum: baa9077cdf15eb7b58c79398604ca57379b2fc4cf9aa7a9b9e295278648f628c9b201400c01c5e0f7afae56507d741185730307cbe7cad3b9f90a77e5ee342fc - languageName: node - linkType: hard - -"is-descriptor@npm:^0.1.0": - version: 0.1.7 - resolution: "is-descriptor@npm:0.1.7" - dependencies: - is-accessor-descriptor: ^1.0.1 - is-data-descriptor: ^1.0.1 - checksum: 45743109f0bb03f9fa989c34d31ece87cc15792649f147b896a7c4db2906a02fca685867619f4d312e024d7bbd53b945a47c6830d01f5e73efcc6388ac211963 - languageName: node - linkType: hard - -"is-descriptor@npm:^1.0.0, is-descriptor@npm:^1.0.2": - version: 1.0.3 - resolution: "is-descriptor@npm:1.0.3" +"is-date-object@npm:^1.0.5, is-date-object@npm:^1.1.0": + version: 1.1.0 + resolution: "is-date-object@npm:1.1.0" dependencies: - is-accessor-descriptor: ^1.0.1 - is-data-descriptor: ^1.0.1 - checksum: 316153b2fd86ac23b0a2f28b77744ae0a4e3c7a54fe52fa70b125d0971eb0a3bcfb562fa8e74537af0dad5bc405cc606726eb501fc748a241c10910deea89cfb - languageName: node - linkType: hard - -"is-docker@npm:^2.0.0": - version: 2.2.1 - resolution: "is-docker@npm:2.2.1" - bin: - is-docker: cli.js - checksum: 3fef7ddbf0be25958e8991ad941901bf5922ab2753c46980b60b05c1bf9c9c2402d35e6dc32e4380b980ef5e1970a5d9d5e5aa2e02d77727c3b6b5e918474c56 + call-bound: ^1.0.2 + has-tostringtag: ^1.0.2 + checksum: d6c36ab9d20971d65f3fc64cef940d57a4900a2ac85fb488a46d164c2072a33da1cb51eefcc039e3e5c208acbce343d3480b84ab5ff0983f617512da2742562a languageName: node linkType: hard @@ -10199,22 +8125,6 @@ __metadata: languageName: node linkType: hard -"is-extendable@npm:^0.1.0, is-extendable@npm:^0.1.1": - version: 0.1.1 - resolution: "is-extendable@npm:0.1.1" - checksum: 3875571d20a7563772ecc7a5f36cb03167e9be31ad259041b4a8f73f33f885441f778cee1f1fe0085eb4bc71679b9d8c923690003a36a6a5fdf8023e6e3f0672 - languageName: node - linkType: hard - -"is-extendable@npm:^1.0.1": - version: 1.0.1 - resolution: "is-extendable@npm:1.0.1" - dependencies: - is-plain-object: ^2.0.4 - checksum: db07bc1e9de6170de70eff7001943691f05b9d1547730b11be01c0ebfe67362912ba743cf4be6fd20a5e03b4180c685dad80b7c509fe717037e3eee30ad8e84f - languageName: node - linkType: hard - "is-extglob@npm:^2.1.1": version: 2.1.1 resolution: "is-extglob@npm:2.1.1" @@ -10222,26 +8132,12 @@ __metadata: languageName: node linkType: hard -"is-finite@npm:^1.0.0": - version: 1.1.0 - resolution: "is-finite@npm:1.1.0" - checksum: 532b97ed3d03e04c6bd203984d9e4ba3c0c390efee492bad5d1d1cd1802a68ab27adbd3ef6382f6312bed6c8bb1bd3e325ea79a8dc8fe080ed7a06f5f97b93e7 - languageName: node - linkType: hard - -"is-fn@npm:^1.0.0": - version: 1.0.0 - resolution: "is-fn@npm:1.0.0" - checksum: eeea1e536716f93a92dc1a8550b2c0909fe74bb5144d0fb6d65e0d31eb9c06c30559f69d83a9351d2288cc7293b43bc074e0fab5fae19e312ff38aa0c7672827 - languageName: node - linkType: hard - -"is-fullwidth-code-point@npm:^1.0.0": - version: 1.0.0 - resolution: "is-fullwidth-code-point@npm:1.0.0" +"is-finalizationregistry@npm:^1.1.0": + version: 1.1.1 + resolution: "is-finalizationregistry@npm:1.1.1" dependencies: - number-is-nan: ^1.0.0 - checksum: 4d46a7465a66a8aebcc5340d3b63a56602133874af576a9ca42c6f0f4bd787a743605771c5f246db77da96605fefeffb65fc1dbe862dcc7328f4b4d03edf5a57 + call-bound: ^1.0.3 + checksum: 38c646c506e64ead41a36c182d91639833311970b6b6c6268634f109eef0a1a9d2f1f2e499ef4cb43c744a13443c4cdd2f0812d5afdcee5e9b65b72b28c48557 languageName: node linkType: hard @@ -10259,10 +8155,15 @@ __metadata: languageName: node linkType: hard -"is-function@npm:^1.0.1": - version: 1.0.2 - resolution: "is-function@npm:1.0.2" - checksum: 7d564562e07b4b51359547d3ccc10fb93bb392fd1b8177ae2601ee4982a0ece86d952323fc172a9000743a3971f09689495ab78a1d49a9b14fc97a7e28521dc0 +"is-generator-function@npm:^1.0.10": + version: 1.1.0 + resolution: "is-generator-function@npm:1.1.0" + dependencies: + call-bound: ^1.0.3 + get-proto: ^1.0.0 + has-tostringtag: ^1.0.2 + safe-regex-test: ^1.1.0 + checksum: f7f7276131bdf7e28169b86ac55a5b080012a597f9d85a0cbef6fe202a7133fa450a3b453e394870e3cb3685c5a764c64a9f12f614684b46969b1e6f297bed6b languageName: node linkType: hard @@ -10298,35 +8199,20 @@ __metadata: languageName: node linkType: hard -"is-lambda@npm:^1.0.1": - version: 1.0.1 - resolution: "is-lambda@npm:1.0.1" - checksum: 93a32f01940220532e5948538699ad610d5924ac86093fcee83022252b363eb0cc99ba53ab084a04e4fb62bf7b5731f55496257a4c38adf87af9c4d352c71c35 - languageName: node - linkType: hard - -"is-negative-zero@npm:^2.0.3": +"is-map@npm:^2.0.3": version: 2.0.3 - resolution: "is-negative-zero@npm:2.0.3" - checksum: c1e6b23d2070c0539d7b36022d5a94407132411d01aba39ec549af824231f3804b1aea90b5e4e58e807a65d23ceb538ed6e355ce76b267bdd86edb757ffcbdcd - languageName: node - linkType: hard - -"is-number-object@npm:^1.0.4": - version: 1.0.7 - resolution: "is-number-object@npm:1.0.7" - dependencies: - has-tostringtag: ^1.0.0 - checksum: d1e8d01bb0a7134c74649c4e62da0c6118a0bfc6771ea3c560914d52a627873e6920dd0fd0ebc0e12ad2ff4687eac4c308f7e80320b973b2c8a2c8f97a7524f7 + resolution: "is-map@npm:2.0.3" + checksum: e6ce5f6380f32b141b3153e6ba9074892bbbbd655e92e7ba5ff195239777e767a976dcd4e22f864accaf30e53ebf961ab1995424aef91af68788f0591b7396cc languageName: node linkType: hard -"is-number@npm:^3.0.0": - version: 3.0.0 - resolution: "is-number@npm:3.0.0" +"is-number-object@npm:^1.1.1": + version: 1.1.1 + resolution: "is-number-object@npm:1.1.1" dependencies: - kind-of: ^3.0.2 - checksum: 0c62bf8e9d72c4dd203a74d8cfc751c746e75513380fef420cda8237e619a988ee43e678ddb23c87ac24d91ac0fe9f22e4ffb1301a50310c697e9d73ca3994e9 + call-bound: ^1.0.3 + has-tostringtag: ^1.0.2 + checksum: 6517f0a0e8c4b197a21afb45cd3053dc711e79d45d8878aa3565de38d0102b130ca8732485122c7b336e98c27dacd5236854e3e6526e0eb30cae64956535662f languageName: node linkType: hard @@ -10351,35 +8237,35 @@ __metadata: languageName: node linkType: hard -"is-plain-object@npm:^2.0.3, is-plain-object@npm:^2.0.4": - version: 2.0.4 - resolution: "is-plain-object@npm:2.0.4" +"is-regex@npm:^1.2.1": + version: 1.2.1 + resolution: "is-regex@npm:1.2.1" dependencies: - isobject: ^3.0.1 - checksum: 2a401140cfd86cabe25214956ae2cfee6fbd8186809555cd0e84574f88de7b17abacb2e477a6a658fa54c6083ecbda1e6ae404c7720244cd198903848fca70ca + call-bound: ^1.0.2 + gopd: ^1.2.0 + has-tostringtag: ^1.0.2 + hasown: ^2.0.2 + checksum: 99ee0b6d30ef1bb61fa4b22fae7056c6c9b3c693803c0c284ff7a8570f83075a7d38cda53b06b7996d441215c27895ea5d1af62124562e13d91b3dbec41a5e13 languageName: node linkType: hard -"is-regex@npm:^1.1.4, is-regex@npm:~1.1.4": - version: 1.1.4 - resolution: "is-regex@npm:1.1.4" - dependencies: - call-bind: ^1.0.2 - has-tostringtag: ^1.0.0 - checksum: 362399b33535bc8f386d96c45c9feb04cf7f8b41c182f54174c1a45c9abbbe5e31290bbad09a458583ff6bf3b2048672cdb1881b13289569a7c548370856a652 +"is-set@npm:^2.0.3": + version: 2.0.3 + resolution: "is-set@npm:2.0.3" + checksum: 36e3f8c44bdbe9496c9689762cc4110f6a6a12b767c5d74c0398176aa2678d4467e3bf07595556f2dba897751bde1422480212b97d973c7b08a343100b0c0dfe languageName: node linkType: hard -"is-shared-array-buffer@npm:^1.0.2, is-shared-array-buffer@npm:^1.0.3": - version: 1.0.3 - resolution: "is-shared-array-buffer@npm:1.0.3" +"is-shared-array-buffer@npm:^1.0.4": + version: 1.0.4 + resolution: "is-shared-array-buffer@npm:1.0.4" dependencies: - call-bind: ^1.0.7 - checksum: a4fff602c309e64ccaa83b859255a43bb011145a42d3f56f67d9268b55bc7e6d98a5981a1d834186ad3105d6739d21547083fe7259c76c0468483fc538e716d8 + call-bound: ^1.0.3 + checksum: 1611fedc175796eebb88f4dfc393dd969a4a8e6c69cadaff424ee9d4464f9f026399a5f84a90f7c62d6d7ee04e3626a912149726de102b0bd6c1ee6a9868fa5a languageName: node linkType: hard -"is-stream@npm:^1.0.1, is-stream@npm:^1.1.0": +"is-stream@npm:^1.1.0": version: 1.1.0 resolution: "is-stream@npm:1.1.0" checksum: 063c6bec9d5647aa6d42108d4c59723d2bd4ae42135a2d4db6eadbd49b7ea05b750fd69d279e5c7c45cf9da753ad2c00d8978be354d65aa9f6bb434969c6a2ae @@ -10393,34 +8279,37 @@ __metadata: languageName: node linkType: hard -"is-string@npm:^1.0.5, is-string@npm:^1.0.7": - version: 1.0.7 - resolution: "is-string@npm:1.0.7" +"is-string@npm:^1.0.7, is-string@npm:^1.1.1": + version: 1.1.1 + resolution: "is-string@npm:1.1.1" dependencies: - has-tostringtag: ^1.0.0 - checksum: 323b3d04622f78d45077cf89aab783b2f49d24dc641aa89b5ad1a72114cfeff2585efc8c12ef42466dff32bde93d839ad321b26884cf75e5a7892a938b089989 + call-bound: ^1.0.3 + has-tostringtag: ^1.0.2 + checksum: 2eeaaff605250f5e836ea3500d33d1a5d3aa98d008641d9d42fb941e929ffd25972326c2ef912987e54c95b6f10416281aaf1b35cdf81992cfb7524c5de8e193 languageName: node linkType: hard -"is-symbol@npm:^1.0.2, is-symbol@npm:^1.0.3": - version: 1.0.4 - resolution: "is-symbol@npm:1.0.4" +"is-symbol@npm:^1.0.4, is-symbol@npm:^1.1.1": + version: 1.1.1 + resolution: "is-symbol@npm:1.1.1" dependencies: - has-symbols: ^1.0.2 - checksum: 92805812ef590738d9de49d677cd17dfd486794773fb6fa0032d16452af46e9b91bb43ffe82c983570f015b37136f4b53b28b8523bfb10b0ece7a66c31a54510 + call-bound: ^1.0.2 + has-symbols: ^1.1.0 + safe-regex-test: ^1.1.0 + checksum: bfafacf037af6f3c9d68820b74be4ae8a736a658a3344072df9642a090016e281797ba8edbeb1c83425879aae55d1cb1f30b38bf132d703692b2570367358032 languageName: node linkType: hard -"is-typed-array@npm:^1.1.13": - version: 1.1.13 - resolution: "is-typed-array@npm:1.1.13" +"is-typed-array@npm:^1.1.13, is-typed-array@npm:^1.1.14, is-typed-array@npm:^1.1.15": + version: 1.1.15 + resolution: "is-typed-array@npm:1.1.15" dependencies: - which-typed-array: ^1.1.14 - checksum: 150f9ada183a61554c91e1c4290086d2c100b0dff45f60b028519be72a8db964da403c48760723bf5253979b8dffe7b544246e0e5351dcd05c5fdb1dcc1dc0f0 + which-typed-array: ^1.1.16 + checksum: ea7cfc46c282f805d19a9ab2084fd4542fed99219ee9dbfbc26284728bd713a51eac66daa74eca00ae0a43b61322920ba334793607dc39907465913e921e0892 languageName: node linkType: hard -"is-typedarray@npm:^1.0.0, is-typedarray@npm:~1.0.0": +"is-typedarray@npm:~1.0.0": version: 1.0.0 resolution: "is-typedarray@npm:1.0.0" checksum: 3508c6cd0a9ee2e0df2fa2e9baabcdc89e911c7bd5cf64604586697212feec525aa21050e48affb5ffc3df20f0f5d2e2cf79b08caa64e1ccc9578e251763aef7 @@ -10441,35 +8330,29 @@ __metadata: languageName: node linkType: hard -"is-utf8@npm:^0.2.0": - version: 0.2.1 - resolution: "is-utf8@npm:0.2.1" - checksum: 167ccd2be869fc228cc62c1a28df4b78c6b5485d15a29027d3b5dceb09b383e86a3522008b56dcac14b592b22f0a224388718c2505027a994fd8471465de54b3 +"is-weakmap@npm:^2.0.2": + version: 2.0.2 + resolution: "is-weakmap@npm:2.0.2" + checksum: f36aef758b46990e0d3c37269619c0a08c5b29428c0bb11ecba7f75203442d6c7801239c2f31314bc79199217ef08263787f3837d9e22610ad1da62970d6616d languageName: node linkType: hard -"is-weakref@npm:^1.0.2": - version: 1.0.2 - resolution: "is-weakref@npm:1.0.2" +"is-weakref@npm:^1.0.2, is-weakref@npm:^1.1.0": + version: 1.1.1 + resolution: "is-weakref@npm:1.1.1" dependencies: - call-bind: ^1.0.2 - checksum: 95bd9a57cdcb58c63b1c401c60a474b0f45b94719c30f548c891860f051bc2231575c290a6b420c6bc6e7ed99459d424c652bd5bf9a1d5259505dc35b4bf83de - languageName: node - linkType: hard - -"is-windows@npm:^1.0.2": - version: 1.0.2 - resolution: "is-windows@npm:1.0.2" - checksum: 438b7e52656fe3b9b293b180defb4e448088e7023a523ec21a91a80b9ff8cdb3377ddb5b6e60f7c7de4fa8b63ab56e121b6705fe081b3cf1b828b0a380009ad7 + call-bound: ^1.0.3 + checksum: 1769b9aed5d435a3a989ffc18fc4ad1947d2acdaf530eb2bd6af844861b545047ea51102f75901f89043bed0267ed61d914ee21e6e8b9aa734ec201cdfc0726f languageName: node linkType: hard -"is-wsl@npm:^2.1.1": - version: 2.2.0 - resolution: "is-wsl@npm:2.2.0" +"is-weakset@npm:^2.0.3": + version: 2.0.4 + resolution: "is-weakset@npm:2.0.4" dependencies: - is-docker: ^2.0.0 - checksum: 20849846ae414997d290b75e16868e5261e86ff5047f104027026fd61d8b5a9b0b3ade16239f35e1a067b3c7cc02f70183cb661010ed16f4b6c7c93dad1b19d8 + call-bound: ^1.0.3 + get-intrinsic: ^1.2.6 + checksum: 5c6c8415a06065d78bdd5e3a771483aa1cd928df19138aa73c4c51333226f203f22117b4325df55cc8b3085a6716870a320c2d757efee92d7a7091a039082041 languageName: node linkType: hard @@ -10480,7 +8363,7 @@ __metadata: languageName: node linkType: hard -"isarray@npm:1.0.0, isarray@npm:^1.0.0, isarray@npm:~1.0.0": +"isarray@npm:^1.0.0, isarray@npm:~1.0.0": version: 1.0.0 resolution: "isarray@npm:1.0.0" checksum: f032df8e02dce8ec565cf2eb605ea939bdccea528dbcf565cdf92bfa2da9110461159d86a537388ef1acef8815a330642d7885b29010e8f7eac967c9993b65ab @@ -10515,22 +8398,6 @@ __metadata: languageName: node linkType: hard -"isobject@npm:^2.0.0": - version: 2.1.0 - resolution: "isobject@npm:2.1.0" - dependencies: - isarray: 1.0.0 - checksum: 811c6f5a866877d31f0606a88af4a45f282544de886bf29f6a34c46616a1ae2ed17076cc6bf34c0128f33eecf7e1fcaa2c82cf3770560d3e26810894e96ae79f - languageName: node - linkType: hard - -"isobject@npm:^3.0.0, isobject@npm:^3.0.1": - version: 3.0.1 - resolution: "isobject@npm:3.0.1" - checksum: db85c4c970ce30693676487cca0e61da2ca34e8d4967c2e1309143ff910c207133a969f9e4ddb2dc6aba670aabce4e0e307146c310350b298e74a31f7d464703 - languageName: node - linkType: hard - "isomorphic-unfetch@npm:^3.0.0": version: 3.1.0 resolution: "isomorphic-unfetch@npm:3.1.0" @@ -10550,12 +8417,12 @@ __metadata: languageName: node linkType: hard -"isows@npm:1.0.3": - version: 1.0.3 - resolution: "isows@npm:1.0.3" +"isows@npm:1.0.6": + version: 1.0.6 + resolution: "isows@npm:1.0.6" peerDependencies: ws: "*" - checksum: 9cacd5cf59f67deb51e825580cd445ab1725ecb05a67c704050383fb772856f3cd5e7da8ad08f5a3bd2823680d77d099459d0c6a7037972a74d6429af61af440 + checksum: ab9e85b50bcc3d70aa5ec875aa2746c5daf9321cb376ed4e5434d3c2643c5d62b1f466d93a05cd2ad0ead5297224922748c31707cb4fbd68f5d05d0479dce99c languageName: node linkType: hard @@ -10626,15 +8493,15 @@ __metadata: linkType: hard "jackspeak@npm:^3.1.2": - version: 3.4.0 - resolution: "jackspeak@npm:3.4.0" + version: 3.4.3 + resolution: "jackspeak@npm:3.4.3" dependencies: "@isaacs/cliui": ^8.0.2 "@pkgjs/parseargs": ^0.11.0 dependenciesMeta: "@pkgjs/parseargs": optional: true - checksum: 350f6f311018bb175ffbe736b19c26ac0b134bb5a17a638169e89594eb0c24ab1c658ab3a2fda24ff63b3b19292e1a5ec19d2255bc526df704e8168d392bef85 + checksum: be31027fc72e7cc726206b9f560395604b82e0fddb46c4cbf9f97d049bcef607491a5afc0699612eaa4213ca5be8fd3e1e7cd187b3040988b65c9489838a7c00 languageName: node linkType: hard @@ -10674,27 +8541,13 @@ __metadata: languageName: node linkType: hard -"js-sha3@npm:^0.5.7": - version: 0.5.7 - resolution: "js-sha3@npm:0.5.7" - checksum: 973a28ea4b26cc7f12d2ab24f796e24ee4a71eef45a6634a052f6eb38cf8b2333db798e896e6e094ea6fa4dfe8e42a2a7942b425cf40da3f866623fd05bb91ea - languageName: node - linkType: hard - -"js-tokens@npm:^3.0.0 || ^4.0.0, js-tokens@npm:^4.0.0": +"js-tokens@npm:^4.0.0": version: 4.0.0 resolution: "js-tokens@npm:4.0.0" checksum: 8a95213a5a77deb6cbe94d86340e8d9ace2b93bc367790b260101d2f36a2eaf4e4e22d9fa9cf459b38af3a32fb4190e638024cf82ec95ef708680e405ea7cc78 languageName: node linkType: hard -"js-tokens@npm:^3.0.2": - version: 3.0.2 - resolution: "js-tokens@npm:3.0.2" - checksum: ff24cf90e6e4ac446eba56e604781c1aaf3bdaf9b13a00596a0ebd972fa3b25dc83c0f0f67289c33252abb4111e0d14e952a5d9ffb61f5c22532d555ebd8d8a9 - languageName: node - linkType: hard - "js-yaml@npm:3.x, js-yaml@npm:^3.13.1": version: 3.14.1 resolution: "js-yaml@npm:3.14.1" @@ -10707,7 +8560,7 @@ __metadata: languageName: node linkType: hard -"js-yaml@npm:4.1.0, js-yaml@npm:^4.1.0": +"js-yaml@npm:^4.1.0": version: 4.1.0 resolution: "js-yaml@npm:4.1.0" dependencies: @@ -10732,24 +8585,6 @@ __metadata: languageName: node linkType: hard -"jsesc@npm:^1.3.0": - version: 1.3.0 - resolution: "jsesc@npm:1.3.0" - bin: - jsesc: bin/jsesc - checksum: 9384cc72bf8ef7f2eb75fea64176b8b0c1c5e77604854c72cb4670b7072e112e3baaa69ef134be98cb078834a7812b0bfe676ad441ccd749a59427f5ed2127f1 - languageName: node - linkType: hard - -"jsesc@npm:~0.5.0": - version: 0.5.0 - resolution: "jsesc@npm:0.5.0" - bin: - jsesc: bin/jsesc - checksum: b8b44cbfc92f198ad972fba706ee6a1dfa7485321ee8c0b25f5cedd538dcb20cde3197de16a7265430fce8277a12db066219369e3d51055038946039f6e20e17 - languageName: node - linkType: hard - "json-bigint@npm:^1.0.0": version: 1.0.0 resolution: "json-bigint@npm:1.0.0" @@ -10759,13 +8594,6 @@ __metadata: languageName: node linkType: hard -"json-buffer@npm:3.0.0": - version: 3.0.0 - resolution: "json-buffer@npm:3.0.0" - checksum: 0cecacb8025370686a916069a2ff81f7d55167421b6aa7270ee74e244012650dd6bce22b0852202ea7ff8624fce50ff0ec1bdf95914ccb4553426e290d5a63fa - languageName: node - linkType: hard - "json-buffer@npm:3.0.1": version: 3.0.1 resolution: "json-buffer@npm:3.0.1" @@ -10780,36 +8608,6 @@ __metadata: languageName: node linkType: hard -"json-rpc-engine@npm:^3.4.0, json-rpc-engine@npm:^3.6.0": - version: 3.8.0 - resolution: "json-rpc-engine@npm:3.8.0" - dependencies: - async: ^2.0.1 - babel-preset-env: ^1.7.0 - babelify: ^7.3.0 - json-rpc-error: ^2.0.0 - promise-to-callback: ^1.0.0 - safe-event-emitter: ^1.0.1 - checksum: 4a02ddda196b68717cdcdf9bc8eac91f956b717431daf1f317e016d564bd5b8974e8a66f75fd1f069d63b8e944128020ec7c371f28cf29ac0951d3338b2f667c - languageName: node - linkType: hard - -"json-rpc-error@npm:^2.0.0": - version: 2.0.0 - resolution: "json-rpc-error@npm:2.0.0" - dependencies: - inherits: ^2.0.1 - checksum: bbfb1ff82d0605b4dfd4ac6d093e863a8f623e0e83a098ccab5711a08d2ae09ea603260d4573a524e596701e64733690a5c31901e99daebe05b09053d8702d0c - languageName: node - linkType: hard - -"json-rpc-random-id@npm:^1.0.0": - version: 1.0.1 - resolution: "json-rpc-random-id@npm:1.0.1" - checksum: fcd2e884193a129ace4002bd65a86e9cdb206733b4693baea77bd8b372cf8de3043fbea27716a2c9a716581a908ca8d978d9dfec4847eb2cf77edb4cf4b2252c - languageName: node - linkType: hard - "json-schema-traverse@npm:^0.4.1": version: 0.4.1 resolution: "json-schema-traverse@npm:0.4.1" @@ -10838,15 +8636,10 @@ __metadata: languageName: node linkType: hard -"json-stable-stringify@npm:^1.0.1": - version: 1.1.1 - resolution: "json-stable-stringify@npm:1.1.1" - dependencies: - call-bind: ^1.0.5 - isarray: ^2.0.5 - jsonify: ^0.0.1 - object-keys: ^1.1.1 - checksum: e1ba06600fd278767eeff53f28e408e29c867e79abf564e7aadc3ce8f31f667258f8db278ef28831e45884dd687388fa1910f46e599fc19fb94c9afbbe3a4de8 +"json-stream-stringify@npm:^3.1.4": + version: 3.1.6 + resolution: "json-stream-stringify@npm:3.1.6" + checksum: ce873e09fe18461960b7536f63e2f913a2cb242819513856ed1af58989d41846976e7177cb1fe3c835220023aa01e534d56b6d5c3290a5b23793a6f4cb93785e languageName: node linkType: hard @@ -10857,15 +8650,6 @@ __metadata: languageName: node linkType: hard -"json5@npm:^0.5.1": - version: 0.5.1 - resolution: "json5@npm:0.5.1" - bin: - json5: lib/cli.js - checksum: 9b85bf06955b23eaa4b7328aa8892e3887e81ca731dd27af04a5f5f1458fbc5e1de57a24442e3272f8a888dd1abe1cb68eb693324035f6b3aeba4fcab7667d62 - languageName: node - linkType: hard - "json5@npm:^1.0.2": version: 1.0.2 resolution: "json5@npm:1.0.2" @@ -10877,18 +8661,6 @@ __metadata: languageName: node linkType: hard -"jsonfile@npm:^2.1.0": - version: 2.4.0 - resolution: "jsonfile@npm:2.4.0" - dependencies: - graceful-fs: ^4.1.6 - dependenciesMeta: - graceful-fs: - optional: true - checksum: f5064aabbc9e35530dc471d8b203ae1f40dbe949ddde4391c6f6a6d310619a15f0efdae5587df594d1d70c555193aaeee9d2ed4aec9ffd5767bd5e4e62d49c3d - languageName: node - linkType: hard - "jsonfile@npm:^4.0.0": version: 4.0.0 resolution: "jsonfile@npm:4.0.0" @@ -10914,13 +8686,6 @@ __metadata: languageName: node linkType: hard -"jsonify@npm:^0.0.1": - version: 0.0.1 - resolution: "jsonify@npm:0.0.1" - checksum: 027287e1c0294fce15f18c0ff990cfc2318e7f01fb76515f784d5cd0784abfec6fc5c2355c3a2f2cb0ad7f4aa2f5b74ebbfe4e80476c35b2d13cabdb572e1134 - languageName: node - linkType: hard - "jsonparse@npm:^1.2.0": version: 1.3.1 resolution: "jsonparse@npm:1.3.1" @@ -10929,9 +8694,9 @@ __metadata: linkType: hard "jsonschema@npm:^1.2.4, jsonschema@npm:^1.4.1": - version: 1.4.1 - resolution: "jsonschema@npm:1.4.1" - checksum: 1ef02a6cd9bc32241ec86bbf1300bdbc3b5f2d8df6eb795517cf7d1cd9909e7beba1e54fdf73990fd66be98a182bda9add9607296b0cb00b1348212988e424b2 + version: 1.5.0 + resolution: "jsonschema@npm:1.5.0" + checksum: 170b9c375967bc135f4d029fedc31f5686f2c3bb07e7472cebddbb907b5369bf75a1a50287d6af9c31f61c76fe0b7786e78044c188aaddd329b77d856475e6db languageName: node linkType: hard @@ -10982,16 +8747,7 @@ __metadata: languageName: node linkType: hard -"keyv@npm:^3.0.0": - version: 3.1.0 - resolution: "keyv@npm:3.1.0" - dependencies: - json-buffer: 3.0.0 - checksum: bb7e8f3acffdbafbc2dd5b63f377fe6ec4c0e2c44fc82720449ef8ab54f4a7ce3802671ed94c0f475ae0a8549703353a2124561fcf3317010c141b32ca1ce903 - languageName: node - linkType: hard - -"keyv@npm:^4.0.0, keyv@npm:^4.5.3": +"keyv@npm:^4.5.3": version: 4.5.4 resolution: "keyv@npm:4.5.4" dependencies: @@ -11000,24 +8756,6 @@ __metadata: languageName: node linkType: hard -"kind-of@npm:^3.0.2, kind-of@npm:^3.0.3, kind-of@npm:^3.2.0": - version: 3.2.2 - resolution: "kind-of@npm:3.2.2" - dependencies: - is-buffer: ^1.1.5 - checksum: e898df8ca2f31038f27d24f0b8080da7be274f986bc6ed176f37c77c454d76627619e1681f6f9d2e8d2fd7557a18ecc419a6bb54e422abcbb8da8f1a75e4b386 - languageName: node - linkType: hard - -"kind-of@npm:^4.0.0": - version: 4.0.0 - resolution: "kind-of@npm:4.0.0" - dependencies: - is-buffer: ^1.1.5 - checksum: 1b9e7624a8771b5a2489026e820f3bbbcc67893e1345804a56b23a91e9069965854d2a223a7c6ee563c45be9d8c6ff1ef87f28ed5f0d1a8d00d9dcbb067c529f - languageName: node - linkType: hard - "kind-of@npm:^6.0.2": version: 6.0.3 resolution: "kind-of@npm:6.0.3" @@ -11025,36 +8763,6 @@ __metadata: languageName: node linkType: hard -"klaw-sync@npm:^6.0.0": - version: 6.0.0 - resolution: "klaw-sync@npm:6.0.0" - dependencies: - graceful-fs: ^4.1.11 - checksum: 0da397f8961313c3ef8f79fb63af9002cde5a8fb2aeb1a37351feff0dd6006129c790400c3f5c3b4e757bedcabb13d21ec0a5eaef5a593d59515d4f2c291e475 - languageName: node - linkType: hard - -"klaw@npm:^1.0.0": - version: 1.3.1 - resolution: "klaw@npm:1.3.1" - dependencies: - graceful-fs: ^4.1.9 - dependenciesMeta: - graceful-fs: - optional: true - checksum: 8f69e4797c26e7c3f2426bfa85f38a3da3c2cb1b4c6bd850d2377aed440d41ce9d806f2885c2e2e224372c56af4b1d43b8a499adecf9a05e7373dc6b8b7c52e4 - languageName: node - linkType: hard - -"lcid@npm:^1.0.0": - version: 1.0.0 - resolution: "lcid@npm:1.0.0" - dependencies: - invert-kv: ^1.0.0 - checksum: e8c7a4db07663068c5c44b650938a2bc41aa992037eebb69376214320f202c1250e70b50c32f939e28345fd30c2d35b8e8cd9a19d5932c398246a864ce54843d - languageName: node - linkType: hard - "lcid@npm:^2.0.0": version: 2.0.0 resolution: "lcid@npm:2.0.0" @@ -11073,87 +8781,28 @@ __metadata: languageName: node linkType: hard -"level-codec@npm:~7.0.0": - version: 7.0.1 - resolution: "level-codec@npm:7.0.1" - checksum: 2565c131d93aea0786af5eda9bb907e3f5152fade03fd7a7751e2f95301fc5241063eb927c2f7df086fac33592523aab8df86bcf7ecc46ed53de11453b600329 - languageName: node - linkType: hard - -"level-concat-iterator@npm:^3.0.0": - version: 3.1.0 - resolution: "level-concat-iterator@npm:3.1.0" - dependencies: - catering: ^2.1.0 - checksum: a15bc4c5fbbb30c1efa7fad06b72feaac84d90990b356b461593c198a833336f31f6daff8f40c3908fabd14cfd8856d1c5ecae9e1cb0575037b65fa607e760e9 - languageName: node - linkType: hard - -"level-concat-iterator@npm:~2.0.0": - version: 2.0.1 - resolution: "level-concat-iterator@npm:2.0.1" - checksum: 562583ef1292215f8e749c402510cb61c4d6fccf4541082b3d21dfa5ecde9fcccfe52bdcb5cfff9d2384e7ce5891f44df9439a6ddb39b0ffe31015600b4a828a - languageName: node - linkType: hard - -"level-errors@npm:^1.0.3": - version: 1.1.2 - resolution: "level-errors@npm:1.1.2" - dependencies: - errno: ~0.1.1 - checksum: 18c22fd574ff31567642a85d9a306604a32cbe969b8469fee29620c10488214a6b5e6bbf19e3b5e2042859e4b81041af537319c18132a1aaa56d4ed5981157b7 - languageName: node - linkType: hard - -"level-errors@npm:^2.0.0, level-errors@npm:~2.0.0": - version: 2.0.1 - resolution: "level-errors@npm:2.0.1" - dependencies: - errno: ~0.1.1 - checksum: aca5d7670e2a40609db8d7743fce289bb5202c0bc13e4a78f81f36a6642e9abc0110f48087d3d3c2c04f023d70d4ee6f2db0e20c63d29b3fda323a67bfff6526 - languageName: node - linkType: hard - -"level-errors@npm:~1.0.3": - version: 1.0.5 - resolution: "level-errors@npm:1.0.5" - dependencies: - errno: ~0.1.1 - checksum: a62df2a24987c0100855ec03f03655ddc6170b33a83987a53858ba0a7dbe125b4b5382e01068a1dc899ccf7f9d12b824702da15488bd06b4b3ee7a1e4232cb0a - languageName: node - linkType: hard - -"level-iterator-stream@npm:^2.0.3": - version: 2.0.3 - resolution: "level-iterator-stream@npm:2.0.3" +"level-concat-iterator@npm:^3.0.0": + version: 3.1.0 + resolution: "level-concat-iterator@npm:3.1.0" dependencies: - inherits: ^2.0.1 - readable-stream: ^2.0.5 - xtend: ^4.0.0 - checksum: dd4211798d032a06ebc3e9c5a3a969b003cb15f1fe6398d9c50c87dc8b0bf8b07197cada253fd7f8c4a933f3c86e12bb041df1561c89b749ac4b991d6e68b17f + catering: ^2.1.0 + checksum: a15bc4c5fbbb30c1efa7fad06b72feaac84d90990b356b461593c198a833336f31f6daff8f40c3908fabd14cfd8856d1c5ecae9e1cb0575037b65fa607e760e9 languageName: node linkType: hard -"level-iterator-stream@npm:~1.3.0": - version: 1.3.1 - resolution: "level-iterator-stream@npm:1.3.1" - dependencies: - inherits: ^2.0.1 - level-errors: ^1.0.3 - readable-stream: ^1.0.33 - xtend: ^4.0.0 - checksum: bf57d8dcee6e7ec68e6c580edc768d2e3960f93e741d7d4adcc7d86f267c741ebcfba5353b3b6551ca10d12e30939c90f1a13303313b1b719325111f0ff14540 +"level-concat-iterator@npm:~2.0.0": + version: 2.0.1 + resolution: "level-concat-iterator@npm:2.0.1" + checksum: 562583ef1292215f8e749c402510cb61c4d6fccf4541082b3d21dfa5ecde9fcccfe52bdcb5cfff9d2384e7ce5891f44df9439a6ddb39b0ffe31015600b4a828a languageName: node linkType: hard -"level-iterator-stream@npm:~3.0.0": - version: 3.0.1 - resolution: "level-iterator-stream@npm:3.0.1" +"level-errors@npm:^2.0.0, level-errors@npm:~2.0.0": + version: 2.0.1 + resolution: "level-errors@npm:2.0.1" dependencies: - inherits: ^2.0.1 - readable-stream: ^2.3.6 - xtend: ^4.0.0 - checksum: f3348316907c70163ea15319ef7e28c21c6b4b948616e11dcbbb8e3dab9ec5b39f7bf13e0d53f7d23c69641b7a2985a4911c5c9a03bd57a07f1af469aba6e3a8 + errno: ~0.1.1 + checksum: aca5d7670e2a40609db8d7743fce289bb5202c0bc13e4a78f81f36a6642e9abc0110f48087d3d3c2c04f023d70d4ee6f2db0e20c63d29b3fda323a67bfff6526 languageName: node linkType: hard @@ -11168,16 +8817,6 @@ __metadata: languageName: node linkType: hard -"level-mem@npm:^3.0.1": - version: 3.0.1 - resolution: "level-mem@npm:3.0.1" - dependencies: - level-packager: ~4.0.0 - memdown: ~3.0.0 - checksum: e4c680922afc3c8cd4502d761ab610c8aa7bcacde2550a0a463e1db069eeb55b6b7bec0bb7fda564cec82422944776f9909fe101b0d7746ad8f4f7446ec2a5cd - languageName: node - linkType: hard - "level-mem@npm:^5.0.1": version: 5.0.1 resolution: "level-mem@npm:5.0.1" @@ -11198,43 +8837,6 @@ __metadata: languageName: node linkType: hard -"level-packager@npm:~4.0.0": - version: 4.0.1 - resolution: "level-packager@npm:4.0.1" - dependencies: - encoding-down: ~5.0.0 - levelup: ^3.0.0 - checksum: af33054cfdf1f3cb409941c2e6a67190c0437f8b57a518fa1d40d3f9fd75edbb72c2c17595a52b10030fe2d64c8ef474ddb570f925d88402c94cfc95263865cb - languageName: node - linkType: hard - -"level-post@npm:^1.0.7": - version: 1.0.7 - resolution: "level-post@npm:1.0.7" - dependencies: - ltgt: ^2.1.2 - checksum: 27239cfebe2004036d7ed0ace860d03f829f099de62baf727cce53bd99cb06bfc4a202fa7cb828847fa01c421bab13d9d3e79c9554f5cffff681541dda575218 - languageName: node - linkType: hard - -"level-sublevel@npm:6.6.4": - version: 6.6.4 - resolution: "level-sublevel@npm:6.6.4" - dependencies: - bytewise: ~1.1.0 - level-codec: ^9.0.0 - level-errors: ^2.0.0 - level-iterator-stream: ^2.0.3 - ltgt: ~2.1.1 - pull-defer: ^0.2.2 - pull-level: ^2.0.3 - pull-stream: ^3.6.8 - typewiselite: ~1.0.0 - xtend: ~4.0.0 - checksum: 8370e6fbf67bf08daa23de07699d3d2ccf6a349a28db4025a890d4c07857811808372fdf5029c4afedf24e2ff828be6bb7cd9fd0b676090daba38981b2e75cff - languageName: node - linkType: hard - "level-supports@npm:^2.0.1": version: 2.1.0 resolution: "level-supports@npm:2.1.0" @@ -11251,27 +8853,6 @@ __metadata: languageName: node linkType: hard -"level-ws@npm:0.0.0": - version: 0.0.0 - resolution: "level-ws@npm:0.0.0" - dependencies: - readable-stream: ~1.0.15 - xtend: ~2.1.1 - checksum: fcc3e6993b538ed8931612a74ef26cf32b53d71c059a819bb1006c075f0c1198afb79026a69aeeafcbd4598c45b4b214315b4216b44eca68587fce1b5ad61b75 - languageName: node - linkType: hard - -"level-ws@npm:^1.0.0": - version: 1.0.0 - resolution: "level-ws@npm:1.0.0" - dependencies: - inherits: ^2.0.3 - readable-stream: ^2.2.8 - xtend: ^4.0.1 - checksum: 752fd0f89eb1ccf811c09de24ca8987437ea84f88e672d0037324fb5d71c5bc022c25ba64d6a00fca33beec48a81e3cd1ef99c2f9fff267b3a4f2233939fad35 - languageName: node - linkType: hard - "level-ws@npm:^2.0.0": version: 2.0.0 resolution: "level-ws@npm:2.0.0" @@ -11295,33 +8876,6 @@ __metadata: languageName: node linkType: hard -"levelup@npm:3.1.1, levelup@npm:^3.0.0": - version: 3.1.1 - resolution: "levelup@npm:3.1.1" - dependencies: - deferred-leveldown: ~4.0.0 - level-errors: ~2.0.0 - level-iterator-stream: ~3.0.0 - xtend: ~4.0.0 - checksum: cddcac2cf5eddcf85ade62efd21f11326cd83559619db6a78696725eac5c5cd16f62d8d49f6594fd3097d9329a1d04847f6d7df23bf4d69f18c16e49afd4a416 - languageName: node - linkType: hard - -"levelup@npm:^1.2.1": - version: 1.3.9 - resolution: "levelup@npm:1.3.9" - dependencies: - deferred-leveldown: ~1.2.1 - level-codec: ~7.0.0 - level-errors: ~1.0.3 - level-iterator-stream: ~1.3.0 - prr: ~1.0.1 - semver: ~5.4.1 - xtend: ~4.0.0 - checksum: df3b534b948c17d724050f6ecc2b21eb2fde357bd0c68582cd3a5eb4bf943a3057cd2e9db6bd7253020fcb853c83a70943bff9264f5132afa8cf3c25c3c7cd8e - languageName: node - linkType: hard - "levelup@npm:^4.3.2": version: 4.4.0 resolution: "levelup@npm:4.4.0" @@ -11362,29 +8916,6 @@ __metadata: languageName: node linkType: hard -"load-json-file@npm:^1.0.0": - version: 1.1.0 - resolution: "load-json-file@npm:1.1.0" - dependencies: - graceful-fs: ^4.1.2 - parse-json: ^2.2.0 - pify: ^2.0.0 - pinkie-promise: ^2.0.0 - strip-bom: ^2.0.0 - checksum: 0e4e4f380d897e13aa236246a917527ea5a14e4fc34d49e01ce4e7e2a1e08e2740ee463a03fb021c04f594f29a178f4adb994087549d7c1c5315fcd29bf9934b - languageName: node - linkType: hard - -"locate-path@npm:^2.0.0": - version: 2.0.0 - resolution: "locate-path@npm:2.0.0" - dependencies: - p-locate: ^2.0.0 - path-exists: ^3.0.0 - checksum: 02d581edbbbb0fa292e28d96b7de36b5b62c2fa8b5a7e82638ebb33afa74284acf022d3b1e9ae10e3ffb7658fbc49163fcd5e76e7d1baaa7801c3e05a81da755 - languageName: node - linkType: hard - "locate-path@npm:^3.0.0": version: 3.0.0 resolution: "locate-path@npm:3.0.0" @@ -11404,13 +8935,6 @@ __metadata: languageName: node linkType: hard -"lodash.assign@npm:^4.0.3, lodash.assign@npm:^4.0.6": - version: 4.2.0 - resolution: "lodash.assign@npm:4.2.0" - checksum: 75bbc6733c9f577c448031b4051f990f068802708891f94be9d4c2faffd6a9ec67a2c49671dafc908a068d35687765464853282842b4560b662e6c903d11cc90 - languageName: node - linkType: hard - "lodash.camelcase@npm:^4.3.0": version: 4.3.0 resolution: "lodash.camelcase@npm:4.3.0" @@ -11432,13 +8956,6 @@ __metadata: languageName: node linkType: hard -"lodash.isequalwith@npm:^4.4.0": - version: 4.4.0 - resolution: "lodash.isequalwith@npm:4.4.0" - checksum: 428ba7a57c47ec05e2dd18c03a4b4c45dac524a46af7ce3f412594bfc7be6a5acaa51acf9ea113d0002598e9aafc6e19ee8d20bc28363145fcb4d21808c9039f - languageName: node - linkType: hard - "lodash.kebabcase@npm:^4.1.1": version: 4.1.1 resolution: "lodash.kebabcase@npm:4.1.1" @@ -11551,30 +9068,13 @@ __metadata: languageName: node linkType: hard -"lodash@npm:4.17.20": - version: 4.17.20 - resolution: "lodash@npm:4.17.20" - checksum: b31afa09739b7292a88ec49ffdb2fcaeb41f690def010f7a067eeedffece32da6b6847bfe4d38a77e6f41778b9b2bca75eeab91209936518173271f0b69376ea - languageName: node - linkType: hard - -"lodash@npm:^4.17.11, lodash@npm:^4.17.14, lodash@npm:^4.17.15, lodash@npm:^4.17.19, lodash@npm:^4.17.21, lodash@npm:^4.17.4": +"lodash@npm:^4.17.11, lodash@npm:^4.17.14, lodash@npm:^4.17.15, lodash@npm:^4.17.19, lodash@npm:^4.17.21": version: 4.17.21 resolution: "lodash@npm:4.17.21" checksum: eb835a2e51d381e561e508ce932ea50a8e5a68f4ebdd771ea240d3048244a8d13658acbd502cd4829768c56f2e16bdd4340b9ea141297d472517b83868e677f7 languageName: node linkType: hard -"log-symbols@npm:4.1.0": - version: 4.1.0 - resolution: "log-symbols@npm:4.1.0" - dependencies: - chalk: ^4.1.0 - is-unicode-supported: ^0.1.0 - checksum: fce1497b3135a0198803f9f07464165e9eb83ed02ceb2273930a6f8a508951178d8cf4f0378e9d28300a2ed2bc49050995d2bd5f53ab716bb15ac84d58c6ef74 - languageName: node - linkType: hard - "log-symbols@npm:^3.0.0": version: 3.0.0 resolution: "log-symbols@npm:3.0.0" @@ -11584,6 +9084,16 @@ __metadata: languageName: node linkType: hard +"log-symbols@npm:^4.1.0": + version: 4.1.0 + resolution: "log-symbols@npm:4.1.0" + dependencies: + chalk: ^4.1.0 + is-unicode-supported: ^0.1.0 + checksum: fce1497b3135a0198803f9f07464165e9eb83ed02ceb2273930a6f8a508951178d8cf4f0378e9d28300a2ed2bc49050995d2bd5f53ab716bb15ac84d58c6ef74 + languageName: node + linkType: hard + "long@npm:^4.0.0": version: 4.0.0 resolution: "long@npm:4.0.0" @@ -11591,31 +9101,6 @@ __metadata: languageName: node linkType: hard -"looper@npm:^2.0.0": - version: 2.0.0 - resolution: "looper@npm:2.0.0" - checksum: ee5124d54c97cd9e778e602e297ed37dd6405b7c36830f90bb1aaa6adb8d64f2a228aa341459e6bf2db9a8d7dc9eb8c16ec9c6bffeab1c47f91efe213858ce36 - languageName: node - linkType: hard - -"looper@npm:^3.0.0": - version: 3.0.0 - resolution: "looper@npm:3.0.0" - checksum: 2ec29b4161e95d33f2257867b0b9ab7f2fef5425582362c966f8f9041a2a6032466b8be159af99323655aca9e6fe1c9da086cf208f6346bd97c9f83ab77ccce0 - languageName: node - linkType: hard - -"loose-envify@npm:^1.0.0": - version: 1.4.0 - resolution: "loose-envify@npm:1.4.0" - dependencies: - js-tokens: ^3.0.0 || ^4.0.0 - bin: - loose-envify: cli.js - checksum: 6517e24e0cad87ec9888f500c5b5947032cdfe6ef65e1c1936a0c48a524b81e65542c9c3edc91c97d5bddc806ee2a985dbc79be89215d613b1de5db6d1cfe6f4 - languageName: node - linkType: hard - "loupe@npm:^2.3.6": version: 2.3.7 resolution: "loupe@npm:2.3.7" @@ -11625,21 +9110,14 @@ __metadata: languageName: node linkType: hard -"lowercase-keys@npm:^1.0.0, lowercase-keys@npm:^1.0.1": - version: 1.0.1 - resolution: "lowercase-keys@npm:1.0.1" - checksum: 4d045026595936e09953e3867722e309415ff2c80d7701d067546d75ef698dac218a4f53c6d1d0e7368b47e45fd7529df47e6cb56fbb90523ba599f898b3d147 - languageName: node - linkType: hard - -"lowercase-keys@npm:^2.0.0": - version: 2.0.0 - resolution: "lowercase-keys@npm:2.0.0" - checksum: 24d7ebd56ccdf15ff529ca9e08863f3c54b0b9d1edb97a3ae1af34940ae666c01a1e6d200707bce730a8ef76cb57cc10e65f245ecaaf7e6bc8639f2fb460ac23 +"lru-cache@npm:^10.0.1, lru-cache@npm:^10.2.0": + version: 10.4.3 + resolution: "lru-cache@npm:10.4.3" + checksum: 6476138d2125387a6d20f100608c2583d415a4f64a0fecf30c9e2dda976614f09cad4baa0842447bd37dd459a7bd27f57d9d8f8ce558805abd487c583f3d774a languageName: node linkType: hard -"lru-cache@npm:5.1.1, lru-cache@npm:^5.1.1": +"lru-cache@npm:^5.1.1": version: 5.1.1 resolution: "lru-cache@npm:5.1.1" dependencies: @@ -11648,22 +9126,6 @@ __metadata: languageName: node linkType: hard -"lru-cache@npm:^10.0.1, lru-cache@npm:^10.2.0": - version: 10.3.0 - resolution: "lru-cache@npm:10.3.0" - checksum: f2289639bd94cf3c87bfd8a77ac991f9afe3af004ddca3548c3dae63ead1c73bba449a60a4e270992e16cf3261b3d4130943234d52ca3a4d4de2fc074a3cc7b5 - languageName: node - linkType: hard - -"lru-cache@npm:^3.2.0": - version: 3.2.0 - resolution: "lru-cache@npm:3.2.0" - dependencies: - pseudomap: ^1.0.1 - checksum: 8e5fb3d7a83401165b8dc9fe16d74828df5754aaeda1061e4f2ea1d0e984b9071a6487f1c3f6f034f935429629f94366abbfb753827ab2977a56b3f5c276e736 - languageName: node - linkType: hard - "lru_map@npm:^0.3.3": version: 0.3.3 resolution: "lru_map@npm:0.3.3" @@ -11671,20 +9133,13 @@ __metadata: languageName: node linkType: hard -"ltgt@npm:^2.1.2, ltgt@npm:~2.2.0": +"ltgt@npm:~2.2.0": version: 2.2.1 resolution: "ltgt@npm:2.2.1" checksum: 7e3874296f7538bc8087b428ac4208008d7b76916354b34a08818ca7c83958c1df10ec427eeeaad895f6b81e41e24745b18d30f89abcc21d228b94f6961d50a2 languageName: node linkType: hard -"ltgt@npm:~2.1.1": - version: 2.1.3 - resolution: "ltgt@npm:2.1.3" - checksum: b09281f6aeccb34eda52588d21f9116f6e5b7ae1c79f6180bba06edcdcba50de9c6d199be7f817a7ae59819064e3ca7d066fe0bcc67e2458006e4e45cd05cb11 - languageName: node - linkType: hard - "make-error@npm:^1.1.1": version: 1.3.6 resolution: "make-error@npm:1.3.6" @@ -11692,23 +9147,22 @@ __metadata: languageName: node linkType: hard -"make-fetch-happen@npm:^13.0.0": - version: 13.0.1 - resolution: "make-fetch-happen@npm:13.0.1" +"make-fetch-happen@npm:^14.0.3": + version: 14.0.3 + resolution: "make-fetch-happen@npm:14.0.3" dependencies: - "@npmcli/agent": ^2.0.0 - cacache: ^18.0.0 + "@npmcli/agent": ^3.0.0 + cacache: ^19.0.1 http-cache-semantics: ^4.1.1 - is-lambda: ^1.0.1 minipass: ^7.0.2 - minipass-fetch: ^3.0.0 + minipass-fetch: ^4.0.0 minipass-flush: ^1.0.5 minipass-pipeline: ^1.2.4 - negotiator: ^0.6.3 - proc-log: ^4.2.0 + negotiator: ^1.0.0 + proc-log: ^5.0.0 promise-retry: ^2.0.1 - ssri: ^10.0.0 - checksum: 5c9fad695579b79488fa100da05777213dd9365222f85e4757630f8dd2a21a79ddd3206c78cfd6f9b37346819681782b67900ac847a57cf04190f52dda5343fd + ssri: ^12.0.0 + checksum: 6fb2fee6da3d98f1953b03d315826b5c5a4ea1f908481afc113782d8027e19f080c85ae998454de4e5f27a681d3ec58d57278f0868d4e0b736f51d396b661691 languageName: node linkType: hard @@ -11721,22 +9175,6 @@ __metadata: languageName: node linkType: hard -"map-cache@npm:^0.2.2": - version: 0.2.2 - resolution: "map-cache@npm:0.2.2" - checksum: 3067cea54285c43848bb4539f978a15dedc63c03022abeec6ef05c8cb6829f920f13b94bcaf04142fc6a088318e564c4785704072910d120d55dbc2e0c421969 - languageName: node - linkType: hard - -"map-visit@npm:^1.0.0": - version: 1.0.0 - resolution: "map-visit@npm:1.0.0" - dependencies: - object-visit: ^1.0.0 - checksum: c27045a5021c344fc19b9132eb30313e441863b2951029f8f8b66f79d3d8c1e7e5091578075a996f74e417479506fe9ede28c44ca7bc351a61c9d8073daec36a - languageName: node - linkType: hard - "markdown-table@npm:2.0.0": version: 2.0.0 resolution: "markdown-table@npm:2.0.0" @@ -11746,10 +9184,10 @@ __metadata: languageName: node linkType: hard -"markdown-table@npm:^1.1.3": - version: 1.1.3 - resolution: "markdown-table@npm:1.1.3" - checksum: 292e8c956ae833c2ccb0a55cd8d87980cd657ab11cd9ff63c3fcc4d3a518d3b3882ba07410b8f477ba9e30b3f70658677e4e8acf61816dd6cfdd1f6293130664 +"math-intrinsics@npm:^1.1.0": + version: 1.1.0 + resolution: "math-intrinsics@npm:1.1.0" + checksum: 0e513b29d120f478c85a70f49da0b8b19bc638975eca466f2eeae0071f3ad00454c621bf66e16dd435896c208e719fc91ad79bbfba4e400fe0b372e7c1c9c9a2 languageName: node linkType: hard @@ -11771,13 +9209,6 @@ __metadata: languageName: node linkType: hard -"media-typer@npm:0.3.0": - version: 0.3.0 - resolution: "media-typer@npm:0.3.0" - checksum: af1b38516c28ec95d6b0826f6c8f276c58aec391f76be42aa07646b4e39d317723e869700933ca6995b056db4b09a78c92d5440dc23657e6764be5d28874bba1 - languageName: node - linkType: hard - "mem@npm:^4.0.0": version: 4.3.0 resolution: "mem@npm:4.3.0" @@ -11789,20 +9220,6 @@ __metadata: languageName: node linkType: hard -"memdown@npm:^1.0.0": - version: 1.4.1 - resolution: "memdown@npm:1.4.1" - dependencies: - abstract-leveldown: ~2.7.1 - functional-red-black-tree: ^1.0.1 - immediate: ^3.2.3 - inherits: ~2.0.1 - ltgt: ~2.2.0 - safe-buffer: ~5.1.1 - checksum: 3f89142a12389b1ebfc7adaf3be19ed57cd073f84160eb7419b61c8e188e2b82eb787dad168d7b00ca68355b6b952067d9badaa5ac88c8ee014e4b0af2bfaea0 - languageName: node - linkType: hard - "memdown@npm:^5.0.0": version: 5.1.0 resolution: "memdown@npm:5.1.0" @@ -11817,20 +9234,6 @@ __metadata: languageName: node linkType: hard -"memdown@npm:~3.0.0": - version: 3.0.0 - resolution: "memdown@npm:3.0.0" - dependencies: - abstract-leveldown: ~5.0.0 - functional-red-black-tree: ~1.0.1 - immediate: ~3.2.3 - inherits: ~2.0.1 - ltgt: ~2.2.0 - safe-buffer: ~5.1.1 - checksum: 4446fdf7198dcdbae764324200526f41738c9f2a32decb59b5a4dbb1bdfc72e2fc046e9bbe016469ab8a0a52e5d5c8b36bf3829e90dd4674a5f4c961e059d4de - languageName: node - linkType: hard - "memorystream@npm:^0.3.1": version: 0.3.1 resolution: "memorystream@npm:0.3.1" @@ -11838,13 +9241,6 @@ __metadata: languageName: node linkType: hard -"merge-descriptors@npm:1.0.1": - version: 1.0.1 - resolution: "merge-descriptors@npm:1.0.1" - checksum: 5abc259d2ae25bb06d19ce2b94a21632583c74e2a9109ee1ba7fd147aa7362b380d971e0251069f8b3eb7d48c21ac839e21fa177b335e82c76ec172e30c31a26 - languageName: node - linkType: hard - "merge-options@npm:^3.0.4": version: 3.0.4 resolution: "merge-options@npm:3.0.4" @@ -11868,37 +9264,6 @@ __metadata: languageName: node linkType: hard -"merkle-patricia-tree@npm:3.0.0": - version: 3.0.0 - resolution: "merkle-patricia-tree@npm:3.0.0" - dependencies: - async: ^2.6.1 - ethereumjs-util: ^5.2.0 - level-mem: ^3.0.1 - level-ws: ^1.0.0 - readable-stream: ^3.0.6 - rlp: ^2.0.0 - semaphore: ">=1.0.1" - checksum: a500f00e7954eea132309310c48ee2635e9a190e0a775811236a0dc375465ff7e01b230ac0ee213ca13bb995399066719eedb4218e0f47596e9cab79cebc575e - languageName: node - linkType: hard - -"merkle-patricia-tree@npm:^2.1.2, merkle-patricia-tree@npm:^2.3.2": - version: 2.3.2 - resolution: "merkle-patricia-tree@npm:2.3.2" - dependencies: - async: ^1.4.2 - ethereumjs-util: ^5.0.0 - level-ws: 0.0.0 - levelup: ^1.2.1 - memdown: ^1.0.0 - readable-stream: ^2.0.0 - rlp: ^2.0.0 - semaphore: ">=1.0.1" - checksum: f6066a16e08190b9e8d3aa28d8e861a3e884ee0be8109c4f5e879965fdfb8181cfc04bae3aaf97c7fb6d07446d94b4f3e1cce502dde4a5699a03acf6df518b12 - languageName: node - linkType: hard - "merkle-patricia-tree@npm:^4.2.2, merkle-patricia-tree@npm:^4.2.4": version: 4.2.4 resolution: "merkle-patricia-tree@npm:4.2.4" @@ -11913,10 +9278,14 @@ __metadata: languageName: node linkType: hard -"methods@npm:~1.1.2": - version: 1.1.2 - resolution: "methods@npm:1.1.2" - checksum: 0917ff4041fa8e2f2fda5425a955fe16ca411591fbd123c0d722fcf02b73971ed6f764d85f0a6f547ce49ee0221ce2c19a5fa692157931cecb422984f1dcd13a +"micro-eth-signer@npm:^0.14.0": + version: 0.14.0 + resolution: "micro-eth-signer@npm:0.14.0" + dependencies: + "@noble/curves": ~1.8.1 + "@noble/hashes": ~1.7.1 + micro-packed: ~0.7.2 + checksum: 9f49282ed8d0057c77cb65ee87a7c08909cf25ae62676c9ff8006d804bbd882dd2f56956e8589e3716ec7c647a9f308f45810c1f40416873f352a59941a17d7b languageName: node linkType: hard @@ -11927,34 +9296,22 @@ __metadata: languageName: node linkType: hard -"micromatch@npm:^3.1.4": - version: 3.1.10 - resolution: "micromatch@npm:3.1.10" +"micro-packed@npm:~0.7.2": + version: 0.7.3 + resolution: "micro-packed@npm:0.7.3" dependencies: - arr-diff: ^4.0.0 - array-unique: ^0.3.2 - braces: ^2.3.1 - define-property: ^2.0.2 - extend-shallow: ^3.0.2 - extglob: ^2.0.4 - fragment-cache: ^0.2.1 - kind-of: ^6.0.2 - nanomatch: ^1.2.9 - object.pick: ^1.3.0 - regex-not: ^1.0.0 - snapdragon: ^0.8.1 - to-regex: ^3.0.2 - checksum: ad226cba4daa95b4eaf47b2ca331c8d2e038d7b41ae7ed0697cde27f3f1d6142881ab03d4da51b65d9d315eceb5e4cdddb3fbb55f5f72cfa19cf3ea469d054dc + "@scure/base": ~1.2.5 + checksum: ad622288c56bacd9d7fe177e4b351c7a58e23f08e8cec2c9106f1c9da8e88d51101d667ed95d3f57979b520917b86edda43175ff4b5c8dcd5b96db7102865fa8 languageName: node linkType: hard -"micromatch@npm:^4.0.2, micromatch@npm:^4.0.4": - version: 4.0.7 - resolution: "micromatch@npm:4.0.7" +"micromatch@npm:^4.0.8": + version: 4.0.8 + resolution: "micromatch@npm:4.0.8" dependencies: braces: ^3.0.3 picomatch: ^2.3.1 - checksum: 3cde047d70ad80cf60c787b77198d680db3b8c25b23feb01de5e2652205d9c19f43bd81882f69a0fd1f0cde6a7a122d774998aad3271ddb1b8accf8a0f480cf7 + checksum: 79920eb634e6f400b464a954fcfa589c4e7c7143209488e44baf627f9affc8b1e306f41f4f0deedde97e69cb725920879462d3e750ab3bd3c1aed675bb3a8966 languageName: node linkType: hard @@ -11977,7 +9334,7 @@ __metadata: languageName: node linkType: hard -"mime-types@npm:^2.1.12, mime-types@npm:^2.1.16, mime-types@npm:~2.1.19, mime-types@npm:~2.1.24, mime-types@npm:~2.1.34": +"mime-types@npm:^2.1.12, mime-types@npm:~2.1.19": version: 2.1.35 resolution: "mime-types@npm:2.1.35" dependencies: @@ -11986,15 +9343,6 @@ __metadata: languageName: node linkType: hard -"mime@npm:1.6.0": - version: 1.6.0 - resolution: "mime@npm:1.6.0" - bin: - mime: cli.js - checksum: fef25e39263e6d207580bdc629f8872a3f9772c923c7f8c7e793175cee22777bbe8bba95e5d509a40aaa292d8974514ce634ae35769faa45f22d17edda5e8557 - languageName: node - linkType: hard - "mimic-fn@npm:^2.0.0, mimic-fn@npm:^2.1.0": version: 2.1.0 resolution: "mimic-fn@npm:2.1.0" @@ -12002,29 +9350,6 @@ __metadata: languageName: node linkType: hard -"mimic-response@npm:^1.0.0, mimic-response@npm:^1.0.1": - version: 1.0.1 - resolution: "mimic-response@npm:1.0.1" - checksum: 034c78753b0e622bc03c983663b1cdf66d03861050e0c8606563d149bc2b02d63f62ce4d32be4ab50d0553ae0ffe647fc34d1f5281184c6e1e8cf4d85e8d9823 - languageName: node - linkType: hard - -"mimic-response@npm:^3.1.0": - version: 3.1.0 - resolution: "mimic-response@npm:3.1.0" - checksum: 25739fee32c17f433626bf19f016df9036b75b3d84a3046c7d156e72ec963dd29d7fc8a302f55a3d6c5a4ff24259676b15d915aad6480815a969ff2ec0836867 - languageName: node - linkType: hard - -"min-document@npm:^2.19.0": - version: 2.19.0 - resolution: "min-document@npm:2.19.0" - dependencies: - dom-walk: ^0.1.0 - checksum: da6437562ea2228041542a2384528e74e22d1daa1a4ec439c165abf0b9d8a63e17e3b8a6dc6e0c731845e85301198730426932a0e813d23f932ca668340c9623 - languageName: node - linkType: hard - "minimalistic-assert@npm:^1.0.0, minimalistic-assert@npm:^1.0.1": version: 1.0.1 resolution: "minimalistic-assert@npm:1.0.1" @@ -12048,16 +9373,7 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:5.0.1": - version: 5.0.1 - resolution: "minimatch@npm:5.0.1" - dependencies: - brace-expansion: ^2.0.1 - checksum: b34b98463da4754bc526b244d680c69d4d6089451ebe512edaf6dd9eeed0279399cfa3edb19233513b8f830bf4bfcad911dddcdf125e75074100d52f724774f0 - languageName: node - linkType: hard - -"minimatch@npm:^5.0.1": +"minimatch@npm:^5.0.1, minimatch@npm:^5.1.6": version: 5.1.6 resolution: "minimatch@npm:5.1.6" dependencies: @@ -12066,7 +9382,7 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^9.0.4": +"minimatch@npm:^9.0.4, minimatch@npm:^9.0.5": version: 9.0.5 resolution: "minimatch@npm:9.0.5" dependencies: @@ -12075,7 +9391,7 @@ __metadata: languageName: node linkType: hard -"minimist@npm:^1.2.0, minimist@npm:^1.2.5, minimist@npm:^1.2.6, minimist@npm:^1.2.7, minimist@npm:~1.2.8": +"minimist@npm:^1.2.0, minimist@npm:^1.2.5, minimist@npm:^1.2.6, minimist@npm:^1.2.7": version: 1.2.8 resolution: "minimist@npm:1.2.8" checksum: 75a6d645fb122dad29c06a7597bddea977258957ed88d7a6df59b5cd3fe4a527e253e9bbf2e783e4b73657f9098b96a5fe96ab8a113655d4109108577ecf85b0 @@ -12091,18 +9407,18 @@ __metadata: languageName: node linkType: hard -"minipass-fetch@npm:^3.0.0": - version: 3.0.5 - resolution: "minipass-fetch@npm:3.0.5" +"minipass-fetch@npm:^4.0.0": + version: 4.0.1 + resolution: "minipass-fetch@npm:4.0.1" dependencies: encoding: ^0.1.13 minipass: ^7.0.3 minipass-sized: ^1.0.3 - minizlib: ^2.1.2 + minizlib: ^3.0.1 dependenciesMeta: encoding: optional: true - checksum: 8047d273236157aab27ab7cd8eab7ea79e6ecd63e8f80c3366ec076cb9a0fed550a6935bab51764369027c414647fd8256c2a20c5445fb250c483de43350de83 + checksum: 3dfca705ce887ca9ff14d73e8d8593996dea1a1ecd8101fdbb9c10549d1f9670bc8fb66ad0192769ead4c2dc01b4f9ca1cf567ded365adff17827a303b948140 languageName: node linkType: hard @@ -12133,87 +9449,32 @@ __metadata: languageName: node linkType: hard -"minipass@npm:^2.6.0, minipass@npm:^2.9.0": - version: 2.9.0 - resolution: "minipass@npm:2.9.0" - dependencies: - safe-buffer: ^5.1.2 - yallist: ^3.0.0 - checksum: 077b66f31ba44fd5a0d27d12a9e6a86bff8f97a4978dedb0373167156b5599fadb6920fdde0d9f803374164d810e05e8462ce28e86abbf7f0bea293a93711fc6 - languageName: node - linkType: hard - "minipass@npm:^3.0.0": version: 3.3.6 resolution: "minipass@npm:3.3.6" dependencies: - yallist: ^4.0.0 - checksum: a30d083c8054cee83cdcdc97f97e4641a3f58ae743970457b1489ce38ee1167b3aaf7d815cd39ec7a99b9c40397fd4f686e83750e73e652b21cb516f6d845e48 - languageName: node - linkType: hard - -"minipass@npm:^5.0.0": - version: 5.0.0 - resolution: "minipass@npm:5.0.0" - checksum: 425dab288738853fded43da3314a0b5c035844d6f3097a8e3b5b29b328da8f3c1af6fc70618b32c29ff906284cf6406b6841376f21caaadd0793c1d5a6a620ea - languageName: node - linkType: hard - -"minipass@npm:^5.0.0 || ^6.0.2 || ^7.0.0, minipass@npm:^7.0.2, minipass@npm:^7.0.3, minipass@npm:^7.1.2": - version: 7.1.2 - resolution: "minipass@npm:7.1.2" - checksum: 2bfd325b95c555f2b4d2814d49325691c7bee937d753814861b0b49d5edcda55cbbf22b6b6a60bb91eddac8668771f03c5ff647dcd9d0f798e9548b9cdc46ee3 - languageName: node - linkType: hard - -"minizlib@npm:^1.3.3": - version: 1.3.3 - resolution: "minizlib@npm:1.3.3" - dependencies: - minipass: ^2.9.0 - checksum: b0425c04d2ae6aad5027462665f07cc0d52075f7fa16e942b4611115f9b31f02924073b7221be6f75929d3c47ab93750c63f6dc2bbe8619ceacb3de1f77732c0 - languageName: node - linkType: hard - -"minizlib@npm:^2.1.1, minizlib@npm:^2.1.2": - version: 2.1.2 - resolution: "minizlib@npm:2.1.2" - dependencies: - minipass: ^3.0.0 - yallist: ^4.0.0 - checksum: f1fdeac0b07cf8f30fcf12f4b586795b97be856edea22b5e9072707be51fc95d41487faec3f265b42973a304fe3a64acd91a44a3826a963e37b37bafde0212c3 - languageName: node - linkType: hard - -"mixin-deep@npm:^1.2.0": - version: 1.3.2 - resolution: "mixin-deep@npm:1.3.2" - dependencies: - for-in: ^1.0.2 - is-extendable: ^1.0.1 - checksum: 820d5a51fcb7479f2926b97f2c3bb223546bc915e6b3a3eb5d906dda871bba569863595424a76682f2b15718252954644f3891437cb7e3f220949bed54b1750d + yallist: ^4.0.0 + checksum: a30d083c8054cee83cdcdc97f97e4641a3f58ae743970457b1489ce38ee1167b3aaf7d815cd39ec7a99b9c40397fd4f686e83750e73e652b21cb516f6d845e48 languageName: node linkType: hard -"mkdirp-promise@npm:^5.0.1": - version: 5.0.1 - resolution: "mkdirp-promise@npm:5.0.1" - dependencies: - mkdirp: "*" - checksum: 31ddc9478216adf6d6bee9ea7ce9ccfe90356d9fcd1dfb18128eac075390b4161356d64c3a7b0a75f9de01a90aadd990a0ec8c7434036563985c4b853a053ee2 +"minipass@npm:^5.0.0 || ^6.0.2 || ^7.0.0, minipass@npm:^7.0.2, minipass@npm:^7.0.3, minipass@npm:^7.0.4, minipass@npm:^7.1.2": + version: 7.1.2 + resolution: "minipass@npm:7.1.2" + checksum: 2bfd325b95c555f2b4d2814d49325691c7bee937d753814861b0b49d5edcda55cbbf22b6b6a60bb91eddac8668771f03c5ff647dcd9d0f798e9548b9cdc46ee3 languageName: node linkType: hard -"mkdirp@npm:*": - version: 3.0.1 - resolution: "mkdirp@npm:3.0.1" - bin: - mkdirp: dist/cjs/src/bin.js - checksum: 972deb188e8fb55547f1e58d66bd6b4a3623bf0c7137802582602d73e6480c1c2268dcbafbfb1be466e00cc7e56ac514d7fd9334b7cf33e3e2ab547c16f83a8d +"minizlib@npm:^3.0.1": + version: 3.0.2 + resolution: "minizlib@npm:3.0.2" + dependencies: + minipass: ^7.1.2 + checksum: 493bed14dcb6118da7f8af356a8947cf1473289c09658e5aabd69a737800a8c3b1736fb7d7931b722268a9c9bc038a6d53c049b6a6af24b34a121823bb709996 languageName: node linkType: hard -"mkdirp@npm:0.5.x, mkdirp@npm:^0.5.1, mkdirp@npm:^0.5.5": +"mkdirp@npm:0.5.x, mkdirp@npm:^0.5.1": version: 0.5.6 resolution: "mkdirp@npm:0.5.6" dependencies: @@ -12224,7 +9485,7 @@ __metadata: languageName: node linkType: hard -"mkdirp@npm:^1.0.3, mkdirp@npm:^1.0.4": +"mkdirp@npm:^1.0.4": version: 1.0.4 resolution: "mkdirp@npm:1.0.4" bin: @@ -12233,6 +9494,15 @@ __metadata: languageName: node linkType: hard +"mkdirp@npm:^3.0.1": + version: 3.0.1 + resolution: "mkdirp@npm:3.0.1" + bin: + mkdirp: dist/cjs/src/bin.js + checksum: 972deb188e8fb55547f1e58d66bd6b4a3623bf0c7137802582602d73e6480c1c2268dcbafbfb1be466e00cc7e56ac514d7fd9334b7cf33e3e2ab547c16f83a8d + languageName: node + linkType: hard + "mnemonist@npm:^0.38.0": version: 0.38.5 resolution: "mnemonist@npm:0.38.5" @@ -12243,54 +9513,33 @@ __metadata: linkType: hard "mocha@npm:^10.0.0, mocha@npm:^10.2.0": - version: 10.5.2 - resolution: "mocha@npm:10.5.2" + version: 10.8.2 + resolution: "mocha@npm:10.8.2" dependencies: - ansi-colors: 4.1.1 - browser-stdout: 1.3.1 + ansi-colors: ^4.1.3 + browser-stdout: ^1.3.1 chokidar: ^3.5.3 - debug: 4.3.4 - diff: 5.0.0 - escape-string-regexp: 4.0.0 - find-up: 5.0.0 - glob: 8.1.0 - he: 1.2.0 - js-yaml: 4.1.0 - log-symbols: 4.1.0 - minimatch: 5.0.1 - ms: 2.1.3 - serialize-javascript: 6.0.0 - strip-json-comments: 3.1.1 - supports-color: 8.1.1 - workerpool: 6.2.1 - yargs: 16.2.0 - yargs-parser: 20.2.4 - yargs-unparser: 2.0.0 + debug: ^4.3.5 + diff: ^5.2.0 + escape-string-regexp: ^4.0.0 + find-up: ^5.0.0 + glob: ^8.1.0 + he: ^1.2.0 + js-yaml: ^4.1.0 + log-symbols: ^4.1.0 + minimatch: ^5.1.6 + ms: ^2.1.3 + serialize-javascript: ^6.0.2 + strip-json-comments: ^3.1.1 + supports-color: ^8.1.1 + workerpool: ^6.5.1 + yargs: ^16.2.0 + yargs-parser: ^20.2.9 + yargs-unparser: ^2.0.0 bin: _mocha: bin/_mocha mocha: bin/mocha.js - checksum: 46925790a9d2a4049b974ac9be3af5a7004473d4e8edbb1fd119c87a2e6ff8b4f764f46dcdbfb5d03b9bd4b6f641d9277c5cfdbed7b9a2867eca72c99f41dd02 - languageName: node - linkType: hard - -"mock-fs@npm:^4.1.0": - version: 4.14.0 - resolution: "mock-fs@npm:4.14.0" - checksum: dccd976a8d753e19d3c7602ea422d1f7137def3c1128c177e1f5500fe8c50ec15fe0937cfc3a15c4577fe7adb9a37628b92da9294d13d90f08be4b669b0fca76 - languageName: node - linkType: hard - -"mock-property@npm:~1.0.0": - version: 1.0.3 - resolution: "mock-property@npm:1.0.3" - dependencies: - define-data-property: ^1.1.1 - functions-have-names: ^1.2.3 - gopd: ^1.0.1 - has-property-descriptors: ^1.0.0 - hasown: ^2.0.0 - isarray: ^2.0.5 - checksum: 835b106e38580c929def6803dad58fc8299d77ed876faed0098f9eb2076e30a2ef36fb5098adac87a4901c13532de86a859e63c8b6769fb7527e1dbbb6430cce + checksum: 68cb519503f1e8ffd9b0651e1aef75dfe4754425186756b21e53169da44b5bcb1889e2b743711205082763d3f9a42eb8eb2c13bb1a718a08cb3a5f563bfcacdc languageName: node linkType: hard @@ -12301,14 +9550,7 @@ __metadata: languageName: node linkType: hard -"ms@npm:2.1.2": - version: 2.1.2 - resolution: "ms@npm:2.1.2" - checksum: 673cdb2c3133eb050c745908d8ce632ed2c02d85640e2edb3ace856a2266a813b30c613569bf3354fdf4ea7d1a1494add3bfa95e2713baa27d0c2c71fc44f58f - languageName: node - linkType: hard - -"ms@npm:2.1.3, ms@npm:^2.1.1": +"ms@npm:^2.1.1, ms@npm:^2.1.3": version: 2.1.3 resolution: "ms@npm:2.1.3" checksum: aa92de608021b242401676e35cfa5aa42dd70cbdc082b916da7fb925c542173e36bce97ea3e804923fe92c0ad991434e4a38327e15a1b5b5f945d66df615ae6d @@ -12338,45 +9580,6 @@ __metadata: languageName: node linkType: hard -"multibase@npm:^0.7.0": - version: 0.7.0 - resolution: "multibase@npm:0.7.0" - dependencies: - base-x: ^3.0.8 - buffer: ^5.5.0 - checksum: 3a520897d706b3064b59ddee286a9e1a5b35bb19bd830f93d7ddecdbf69fa46648c8fda0fec49a5d4640b8b7ac9d5fe360417d6de2906599aa535f55bf6b8e58 - languageName: node - linkType: hard - -"multibase@npm:~0.6.0": - version: 0.6.1 - resolution: "multibase@npm:0.6.1" - dependencies: - base-x: ^3.0.8 - buffer: ^5.5.0 - checksum: 0e25a978d2b5cf73e4cce31d032bad85230ea99e9394d259210f676a76539316e7c51bd7dcc9d83523ec7ea1f0e7a3353c5f69397639d78be9acbefa29431faa - languageName: node - linkType: hard - -"multicodec@npm:^0.5.5": - version: 0.5.7 - resolution: "multicodec@npm:0.5.7" - dependencies: - varint: ^5.0.0 - checksum: 5af1febc3bb5381c303c964a4c3bacb9d0d16615599426d58c68722c46e66a7085082995479943084322028324ad692cd70ea14b5eefb2791d325fa00ead04a3 - languageName: node - linkType: hard - -"multicodec@npm:^1.0.0": - version: 1.0.4 - resolution: "multicodec@npm:1.0.4" - dependencies: - buffer: ^5.6.0 - varint: ^5.0.0 - checksum: e6a2916fa76c023b1c90b32ae74f8a781cf0727f71660b245a5ed1db46add6f2ce1586bee5713b16caf0a724e81bfe0678d89910c20d3bb5fd9649dacb2be79e - languageName: node - linkType: hard - "multiformats@npm:^9.4.13, multiformats@npm:^9.4.2, multiformats@npm:^9.4.5, multiformats@npm:^9.5.4": version: 9.9.0 resolution: "multiformats@npm:9.9.0" @@ -12384,17 +9587,6 @@ __metadata: languageName: node linkType: hard -"multihashes@npm:^0.4.15, multihashes@npm:~0.4.15": - version: 0.4.21 - resolution: "multihashes@npm:0.4.21" - dependencies: - buffer: ^5.5.0 - multibase: ^0.7.0 - varint: ^5.0.0 - checksum: 688731560cf7384e899dc75c0da51e426eb7d058c5ea5eb57b224720a1108deb8797f1cd7f45599344d512d2877de99dd6a7b7773a095812365dea4ffe6ebd4c - languageName: node - linkType: hard - "mustache@npm:^4.2.0": version: 4.2.0 resolution: "mustache@npm:4.2.0" @@ -12411,38 +9603,12 @@ __metadata: languageName: node linkType: hard -"nano-json-stream-parser@npm:^0.1.2": - version: 0.1.2 - resolution: "nano-json-stream-parser@npm:0.1.2" - checksum: 5bfe146358c659e0aa7d5e0003416be929c9bd02ba11b1e022b78dddf25be655e33d810249c1687d2c9abdcee5cd4d00856afd1b266a5a127236c0d16416d33a - languageName: node - linkType: hard - "nanoid@npm:^3.0.2, nanoid@npm:^3.1.20, nanoid@npm:^3.1.23": - version: 3.3.7 - resolution: "nanoid@npm:3.3.7" + version: 3.3.11 + resolution: "nanoid@npm:3.3.11" bin: nanoid: bin/nanoid.cjs - checksum: d36c427e530713e4ac6567d488b489a36582ef89da1d6d4e3b87eded11eb10d7042a877958c6f104929809b2ab0bafa17652b076cdf84324aa75b30b722204f2 - languageName: node - linkType: hard - -"nanomatch@npm:^1.2.9": - version: 1.2.13 - resolution: "nanomatch@npm:1.2.13" - dependencies: - arr-diff: ^4.0.0 - array-unique: ^0.3.2 - define-property: ^2.0.2 - extend-shallow: ^3.0.2 - fragment-cache: ^0.2.1 - is-windows: ^1.0.2 - kind-of: ^6.0.2 - object.pick: ^1.3.0 - regex-not: ^1.0.0 - snapdragon: ^0.8.1 - to-regex: ^3.0.1 - checksum: 54d4166d6ef08db41252eb4e96d4109ebcb8029f0374f9db873bd91a1f896c32ec780d2a2ea65c0b2d7caf1f28d5e1ea33746a470f32146ac8bba821d80d38d8 + checksum: 3be20d8866a57a6b6d218e82549711c8352ed969f9ab3c45379da28f405363ad4c9aeb0b39e9abc101a529ca65a72ff9502b00bf74a912c4b64a9d62dfd26c29 languageName: node linkType: hard @@ -12485,10 +9651,10 @@ __metadata: languageName: node linkType: hard -"negotiator@npm:0.6.3, negotiator@npm:^0.6.3": - version: 0.6.3 - resolution: "negotiator@npm:0.6.3" - checksum: b8ffeb1e262eff7968fc90a2b6767b04cfd9842582a9d0ece0af7049537266e7b2506dfb1d107a32f06dd849ab2aea834d5830f7f4d0e5cb7d36e1ae55d021d9 +"negotiator@npm:^1.0.0": + version: 1.0.0 + resolution: "negotiator@npm:1.0.0" + checksum: 20ebfe79b2d2e7cf9cbc8239a72662b584f71164096e6e8896c8325055497c96f6b80cd22c258e8a2f2aa382a787795ec3ee8b37b422a302c7d4381b0d5ecfbb languageName: node linkType: hard @@ -12499,13 +9665,6 @@ __metadata: languageName: node linkType: hard -"next-tick@npm:^1.1.0": - version: 1.1.0 - resolution: "next-tick@npm:1.1.0" - checksum: 83b5cf36027a53ee6d8b7f9c0782f2ba87f4858d977342bfc3c20c21629290a2111f8374d13a81221179603ffc4364f38374b5655d17b6a8f8a8c77bdea4fe8b - languageName: node - linkType: hard - "nice-try@npm:^1.0.4": version: 1.0.5 resolution: "nice-try@npm:1.0.5" @@ -12522,6 +9681,15 @@ __metadata: languageName: node linkType: hard +"node-addon-api@npm:^5.0.0": + version: 5.1.0 + resolution: "node-addon-api@npm:5.1.0" + dependencies: + node-gyp: latest + checksum: 2508bd2d2981945406243a7bd31362fc7af8b70b8b4d65f869c61731800058fb818cc2fd36c8eac714ddd0e568cc85becf5e165cebbdf7b5024d5151bbc75ea1 + languageName: node + linkType: hard + "node-emoji@npm:^1.10.0": version: 1.11.0 resolution: "node-emoji@npm:1.11.0" @@ -12531,7 +9699,7 @@ __metadata: languageName: node linkType: hard -"node-fetch@npm:^2.3.0, node-fetch@npm:^2.6.0, node-fetch@npm:^2.6.1, node-fetch@npm:^2.6.7, node-fetch@npm:^2.6.8": +"node-fetch@npm:^2.3.0, node-fetch@npm:^2.6.1, node-fetch@npm:^2.6.7, node-fetch@npm:^2.6.8": version: 2.7.0 resolution: "node-fetch@npm:2.7.0" dependencies: @@ -12545,16 +9713,6 @@ __metadata: languageName: node linkType: hard -"node-fetch@npm:~1.7.1": - version: 1.7.3 - resolution: "node-fetch@npm:1.7.3" - dependencies: - encoding: ^0.1.11 - is-stream: ^1.0.1 - checksum: 3bb0528c05d541316ebe52770d71ee25a6dce334df4231fd55df41a644143e07f068637488c18a5b0c43f05041dbd3346752f9e19b50df50569a802484544d5b - languageName: node - linkType: hard - "node-gyp-build@npm:4.3.0": version: 4.3.0 resolution: "node-gyp-build@npm:4.3.0" @@ -12578,37 +9736,37 @@ __metadata: linkType: hard "node-gyp-build@npm:^4.2.0, node-gyp-build@npm:^4.3.0": - version: 4.8.1 - resolution: "node-gyp-build@npm:4.8.1" + version: 4.8.4 + resolution: "node-gyp-build@npm:4.8.4" bin: node-gyp-build: bin.js node-gyp-build-optional: optional.js node-gyp-build-test: build-test.js - checksum: fe6e95da6f4608c1a98655f6bf2fe4e8dd9c877cd13256056a8acaf585cc7f98718823fe9366be11b78c2f332d5a184b00cf07a4af96c9d8fea45f640c019f98 + checksum: 8b81ca8ffd5fa257ad8d067896d07908a36918bc84fb04647af09d92f58310def2d2b8614d8606d129d9cd9b48890a5d2bec18abe7fcff54818f72bedd3a7d74 languageName: node linkType: hard "node-gyp@npm:latest": - version: 10.1.0 - resolution: "node-gyp@npm:10.1.0" + version: 11.2.0 + resolution: "node-gyp@npm:11.2.0" dependencies: env-paths: ^2.2.0 exponential-backoff: ^3.1.1 - glob: ^10.3.10 graceful-fs: ^4.2.6 - make-fetch-happen: ^13.0.0 - nopt: ^7.0.0 - proc-log: ^3.0.0 + make-fetch-happen: ^14.0.3 + nopt: ^8.0.0 + proc-log: ^5.0.0 semver: ^7.3.5 - tar: ^6.1.2 - which: ^4.0.0 + tar: ^7.4.3 + tinyglobby: ^0.2.12 + which: ^5.0.0 bin: node-gyp: bin/node-gyp.js - checksum: 72e2ab4b23fc32007a763da94018f58069fc0694bf36115d49a2b195c8831e12cf5dd1e7a3718fa85c06969aedf8fc126722d3b672ec1cb27e06ed33caee3c60 + checksum: 2536282ba81f8a94b29482d3622b6ab298611440619e46de4512a6f32396a68b5530357c474b859787069d84a4c537d99e0c71078cce5b9f808bf84eeb78e8fb languageName: node linkType: hard -"nofilter@npm:^3.1.0": +"nofilter@npm:^3.0.2, nofilter@npm:^3.1.0": version: 3.1.0 resolution: "nofilter@npm:3.1.0" checksum: 58aa85a5b4b35cbb6e42de8a8591c5e338061edc9f3e7286f2c335e9e9b9b8fa7c335ae45daa8a1f3433164dc0b9a3d187fa96f9516e04a17a1f9ce722becc4f @@ -12626,26 +9784,14 @@ __metadata: languageName: node linkType: hard -"nopt@npm:^7.0.0": - version: 7.2.1 - resolution: "nopt@npm:7.2.1" +"nopt@npm:^8.0.0": + version: 8.1.0 + resolution: "nopt@npm:8.1.0" dependencies: - abbrev: ^2.0.0 + abbrev: ^3.0.0 bin: nopt: bin/nopt.js - checksum: 6fa729cc77ce4162cfad8abbc9ba31d4a0ff6850c3af61d59b505653bef4781ec059f8890ecfe93ee8aa0c511093369cca88bfc998101616a2904e715bbbb7c9 - languageName: node - linkType: hard - -"normalize-package-data@npm:^2.3.2": - version: 2.5.0 - resolution: "normalize-package-data@npm:2.5.0" - dependencies: - hosted-git-info: ^2.1.4 - resolve: ^1.10.0 - semver: 2 || 3 || 4 || 5 - validate-npm-package-license: ^3.0.1 - checksum: 7999112efc35a6259bc22db460540cae06564aa65d0271e3bdfa86876d08b0e578b7b5b0028ee61b23f1cae9fc0e7847e4edc0948d3068a39a2a82853efc8499 + checksum: 49cfd3eb6f565e292bf61f2ff1373a457238804d5a5a63a8d786c923007498cba89f3648e3b952bc10203e3e7285752abf5b14eaf012edb821e84f24e881a92a languageName: node linkType: hard @@ -12656,20 +9802,6 @@ __metadata: languageName: node linkType: hard -"normalize-url@npm:^4.1.0": - version: 4.5.1 - resolution: "normalize-url@npm:4.5.1" - checksum: 9a9dee01df02ad23e171171893e56e22d752f7cff86fb96aafeae074819b572ea655b60f8302e2d85dbb834dc885c972cc1c573892fea24df46b2765065dd05a - languageName: node - linkType: hard - -"normalize-url@npm:^6.0.1": - version: 6.1.0 - resolution: "normalize-url@npm:6.1.0" - checksum: 4a4944631173e7d521d6b80e4c85ccaeceb2870f315584fa30121f505a6dfd86439c5e3fdd8cd9e0e291290c41d0c3599f0cb12ab356722ed242584c30348e50 - languageName: node - linkType: hard - "npm-run-path@npm:^2.0.0": version: 2.0.2 resolution: "npm-run-path@npm:2.0.2" @@ -12688,13 +9820,6 @@ __metadata: languageName: node linkType: hard -"number-is-nan@npm:^1.0.0": - version: 1.0.1 - resolution: "number-is-nan@npm:1.0.1" - checksum: 13656bc9aa771b96cef209ffca31c31a03b507ca6862ba7c3f638a283560620d723d52e626d57892c7fff475f4c36ac07f0600f14544692ff595abff214b9ffb - languageName: node - linkType: hard - "number-to-bn@npm:1.7.0": version: 1.7.0 resolution: "number-to-bn@npm:1.7.0" @@ -12712,45 +9837,17 @@ __metadata: languageName: node linkType: hard -"object-assign@npm:^4, object-assign@npm:^4.0.0, object-assign@npm:^4.1.0, object-assign@npm:^4.1.1": +"object-assign@npm:^4.1.0": version: 4.1.1 resolution: "object-assign@npm:4.1.1" checksum: fcc6e4ea8c7fe48abfbb552578b1c53e0d194086e2e6bbbf59e0a536381a292f39943c6e9628af05b5528aa5e3318bb30d6b2e53cadaf5b8fe9e12c4b69af23f languageName: node linkType: hard -"object-copy@npm:^0.1.0": - version: 0.1.0 - resolution: "object-copy@npm:0.1.0" - dependencies: - copy-descriptor: ^0.1.0 - define-property: ^0.2.5 - kind-of: ^3.0.3 - checksum: a9e35f07e3a2c882a7e979090360d1a20ab51d1fa19dfdac3aa8873b328a7c4c7683946ee97c824ae40079d848d6740a3788fa14f2185155dab7ed970a72c783 - languageName: node - linkType: hard - -"object-inspect@npm:^1.13.1": - version: 1.13.2 - resolution: "object-inspect@npm:1.13.2" - checksum: 9f850b3c045db60e0e97746e809ee4090d6ce62195af17dd1e9438ac761394a7d8ec4f7906559aea5424eaf61e35d3e53feded2ccd5f62fcc7d9670d3c8eb353 - languageName: node - linkType: hard - -"object-inspect@npm:~1.12.3": - version: 1.12.3 - resolution: "object-inspect@npm:1.12.3" - checksum: dabfd824d97a5f407e6d5d24810d888859f6be394d8b733a77442b277e0808860555176719c5905e765e3743a7cada6b8b0a3b85e5331c530fd418cc8ae991db - languageName: node - linkType: hard - -"object-is@npm:^1.1.5": - version: 1.1.6 - resolution: "object-is@npm:1.1.6" - dependencies: - call-bind: ^1.0.7 - define-properties: ^1.2.1 - checksum: 3ea22759967e6f2380a2cbbd0f737b42dc9ddb2dfefdb159a1b927fea57335e1b058b564bfa94417db8ad58cddab33621a035de6f5e5ad56d89f2dd03e66c6a1 +"object-inspect@npm:^1.13.3": + version: 1.13.4 + resolution: "object-inspect@npm:1.13.4" + checksum: 582810c6a8d2ef988ea0a39e69e115a138dad8f42dd445383b394877e5816eb4268489f316a6f74ee9c4e0a984b3eab1028e3e79d62b1ed67c726661d55c7a8b languageName: node linkType: hard @@ -12761,35 +9858,21 @@ __metadata: languageName: node linkType: hard -"object-keys@npm:~0.4.0": - version: 0.4.0 - resolution: "object-keys@npm:0.4.0" - checksum: 1be3ebe9b48c0d5eda8e4a30657d887a748cb42435e0e2eaf49faf557bdd602cd2b7558b8ce90a4eb2b8592d16b875a1900bce859cbb0f35b21c67e11a45313c - languageName: node - linkType: hard - -"object-visit@npm:^1.0.0": - version: 1.0.1 - resolution: "object-visit@npm:1.0.1" - dependencies: - isobject: ^3.0.0 - checksum: b0ee07f5bf3bb881b881ff53b467ebbde2b37ebb38649d6944a6cd7681b32eedd99da9bd1e01c55facf81f54ed06b13af61aba6ad87f0052982995e09333f790 - languageName: node - linkType: hard - -"object.assign@npm:^4.1.5": - version: 4.1.5 - resolution: "object.assign@npm:4.1.5" +"object.assign@npm:^4.1.7": + version: 4.1.7 + resolution: "object.assign@npm:4.1.7" dependencies: - call-bind: ^1.0.5 + call-bind: ^1.0.8 + call-bound: ^1.0.3 define-properties: ^1.2.1 - has-symbols: ^1.0.3 + es-object-atoms: ^1.0.0 + has-symbols: ^1.1.0 object-keys: ^1.1.1 - checksum: f9aeac0541661370a1fc86e6a8065eb1668d3e771f7dbb33ee54578201336c057b21ee61207a186dd42db0c62201d91aac703d20d12a79fc79c353eed44d4e25 + checksum: 60e07d2651cf4f5528c485f1aa4dbded9b384c47d80e8187cefd11320abb1aebebf78df5483451dfa549059f8281c21f7b4bf7d19e9e5e97d8d617df0df298de languageName: node linkType: hard -"object.fromentries@npm:^2.0.7": +"object.fromentries@npm:^2.0.8": version: 2.0.8 resolution: "object.fromentries@npm:2.0.8" dependencies: @@ -12801,22 +9884,7 @@ __metadata: languageName: node linkType: hard -"object.getownpropertydescriptors@npm:^2.1.6": - version: 2.1.8 - resolution: "object.getownpropertydescriptors@npm:2.1.8" - dependencies: - array.prototype.reduce: ^1.0.6 - call-bind: ^1.0.7 - define-properties: ^1.2.1 - es-abstract: ^1.23.2 - es-object-atoms: ^1.0.0 - gopd: ^1.0.1 - safe-array-concat: ^1.1.2 - checksum: 073e492700a7f61ff6c471a2ed96e72473b030a7a105617f03cab192fb4bbc0e6068ef76534ec56afd34baf26b5dc5408de59cb0140ec8abde781e00faa3e63e - languageName: node - linkType: hard - -"object.groupby@npm:^1.0.1": +"object.groupby@npm:^1.0.3": version: 1.0.3 resolution: "object.groupby@npm:1.0.3" dependencies: @@ -12827,48 +9895,22 @@ __metadata: languageName: node linkType: hard -"object.pick@npm:^1.3.0": - version: 1.3.0 - resolution: "object.pick@npm:1.3.0" - dependencies: - isobject: ^3.0.1 - checksum: 77fb6eed57c67adf75e9901187e37af39f052ef601cb4480386436561357eb9e459e820762f01fd02c5c1b42ece839ad393717a6d1850d848ee11fbabb3e580a - languageName: node - linkType: hard - -"object.values@npm:^1.1.7": - version: 1.2.0 - resolution: "object.values@npm:1.2.0" +"object.values@npm:^1.2.0": + version: 1.2.1 + resolution: "object.values@npm:1.2.1" dependencies: - call-bind: ^1.0.7 + call-bind: ^1.0.8 + call-bound: ^1.0.3 define-properties: ^1.2.1 es-object-atoms: ^1.0.0 - checksum: 51fef456c2a544275cb1766897f34ded968b22adfc13ba13b5e4815fdaf4304a90d42a3aee114b1f1ede048a4890381d47a5594d84296f2767c6a0364b9da8fa + checksum: f9b9a2a125ccf8ded29414d7c056ae0d187b833ee74919821fc60d7e216626db220d9cb3cf33f965c84aaaa96133626ca13b80f3c158b673976dc8cfcfcd26bb languageName: node linkType: hard "obliterator@npm:^2.0.0": - version: 2.0.4 - resolution: "obliterator@npm:2.0.4" - checksum: f28ad35b6d812089315f375dc3e6e5f9bebf958ebe4b10ccd471c7115cbcf595e74bdac4783ae758e5b1f47e3096427fdb37cfa7bed566b132df92ff317b9a7c - languageName: node - linkType: hard - -"oboe@npm:2.1.4": - version: 2.1.4 - resolution: "oboe@npm:2.1.4" - dependencies: - http-https: ^1.0.0 - checksum: b9172453fba362aec86c45d7bcb4f512302bb23ef34c7c9c498974dc4e7ec0e298931bac5a093445fd946d5604e5dd16563e2d2ae922101ac4b47be2e18e30cc - languageName: node - linkType: hard - -"on-finished@npm:2.4.1": - version: 2.4.1 - resolution: "on-finished@npm:2.4.1" - dependencies: - ee-first: 1.1.1 - checksum: d20929a25e7f0bb62f937a425b5edeb4e4cde0540d77ba146ec9357f00b0d497cdb3b9b05b9c8e46222407d1548d08166bff69cc56dfa55ba0e4469228920ff0 + version: 2.0.5 + resolution: "obliterator@npm:2.0.5" + checksum: 49575c428d66941326f265b8962bbce05c2a209c180e6ebf49d07e6d6cf2e6ab3f805289ad58aec49e74825344c97e790e5658b55e226a8cb4f57d866db3adf5 languageName: node linkType: hard @@ -12890,16 +9932,6 @@ __metadata: languageName: node linkType: hard -"open@npm:^7.4.2": - version: 7.4.2 - resolution: "open@npm:7.4.2" - dependencies: - is-docker: ^2.0.0 - is-wsl: ^2.1.1 - checksum: 3333900ec0e420d64c23b831bc3467e57031461d843c801f569b2204a1acc3cd7b3ec3c7897afc9dde86491dfa289708eb92bba164093d8bd88fb2c231843c91 - languageName: node - linkType: hard - "opencollective-postinstall@npm:^2.0.0": version: 2.0.3 resolution: "opencollective-postinstall@npm:2.0.3" @@ -12960,22 +9992,6 @@ __metadata: languageName: node linkType: hard -"os-homedir@npm:^1.0.0": - version: 1.0.2 - resolution: "os-homedir@npm:1.0.2" - checksum: af609f5a7ab72de2f6ca9be6d6b91a599777afc122ac5cad47e126c1f67c176fe9b52516b9eeca1ff6ca0ab8587fe66208bc85e40a3940125f03cdb91408e9d2 - languageName: node - linkType: hard - -"os-locale@npm:^1.4.0": - version: 1.4.0 - resolution: "os-locale@npm:1.4.0" - dependencies: - lcid: ^1.0.0 - checksum: 0161a1b6b5a8492f99f4b47fe465df9fc521c55ba5414fce6444c45e2500487b8ed5b40a47a98a2363fe83ff04ab033785300ed8df717255ec4c3b625e55b1fb - languageName: node - linkType: hard - "os-locale@npm:^3.1.0": version: 3.1.0 resolution: "os-locale@npm:3.1.0" @@ -12987,24 +10003,41 @@ __metadata: languageName: node linkType: hard -"os-tmpdir@npm:^1.0.1, os-tmpdir@npm:~1.0.2": +"os-tmpdir@npm:~1.0.2": version: 1.0.2 resolution: "os-tmpdir@npm:1.0.2" checksum: 5666560f7b9f10182548bf7013883265be33620b1c1b4a4d405c25be2636f970c5488ff3e6c48de75b55d02bde037249fe5dbfbb4c0fb7714953d56aed062e6d languageName: node linkType: hard -"p-cancelable@npm:^1.0.0": - version: 1.1.0 - resolution: "p-cancelable@npm:1.1.0" - checksum: 2db3814fef6d9025787f30afaee4496a8857a28be3c5706432cbad76c688a6db1874308f48e364a42f5317f5e41e8e7b4f2ff5c8ff2256dbb6264bc361704ece +"own-keys@npm:^1.0.1": + version: 1.0.1 + resolution: "own-keys@npm:1.0.1" + dependencies: + get-intrinsic: ^1.2.6 + object-keys: ^1.1.1 + safe-push-apply: ^1.0.0 + checksum: cc9dd7d85c4ccfbe8109fce307d581ac7ede7b26de892b537873fbce2dc6a206d89aea0630dbb98e47ce0873517cefeaa7be15fcf94aaf4764a3b34b474a5b61 languageName: node linkType: hard -"p-cancelable@npm:^2.0.0": - version: 2.1.1 - resolution: "p-cancelable@npm:2.1.1" - checksum: 3dba12b4fb4a1e3e34524535c7858fc82381bbbd0f247cc32dedc4018592a3950ce66b106d0880b4ec4c2d8d6576f98ca885dc1d7d0f274d1370be20e9523ddf +"ox@npm:0.6.9": + version: 0.6.9 + resolution: "ox@npm:0.6.9" + dependencies: + "@adraffy/ens-normalize": ^1.10.1 + "@noble/curves": ^1.6.0 + "@noble/hashes": ^1.5.0 + "@scure/bip32": ^1.5.0 + "@scure/bip39": ^1.4.0 + abitype: ^1.0.6 + eventemitter3: 5.0.1 + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 6f35c9710ab3edb8146f0d2a7c482517c8e1cb2adf0cfb7aba23a17209cf7171546ad017cce98dd9e0f60cee5d77ddaaa72961023e4456de093d985b5712c546 languageName: node linkType: hard @@ -13053,15 +10086,6 @@ __metadata: languageName: node linkType: hard -"p-limit@npm:^1.1.0": - version: 1.3.0 - resolution: "p-limit@npm:1.3.0" - dependencies: - p-try: ^1.0.0 - checksum: 281c1c0b8c82e1ac9f81acd72a2e35d402bf572e09721ce5520164e9de07d8274451378a3470707179ad13240535558f4b277f02405ad752e08c7d5b0d54fbfd - languageName: node - linkType: hard - "p-limit@npm:^2.0.0": version: 2.3.0 resolution: "p-limit@npm:2.3.0" @@ -13080,15 +10104,6 @@ __metadata: languageName: node linkType: hard -"p-locate@npm:^2.0.0": - version: 2.0.0 - resolution: "p-locate@npm:2.0.0" - dependencies: - p-limit: ^1.1.0 - checksum: e2dceb9b49b96d5513d90f715780f6f4972f46987dc32a0e18bc6c3fc74a1a5d73ec5f81b1398af5e58b99ea1ad03fd41e9181c01fa81b4af2833958696e3081 - languageName: node - linkType: hard - "p-locate@npm:^3.0.0": version: 3.0.0 resolution: "p-locate@npm:3.0.0" @@ -13116,10 +10131,10 @@ __metadata: languageName: node linkType: hard -"p-try@npm:^1.0.0": - version: 1.0.0 - resolution: "p-try@npm:1.0.0" - checksum: 3b5303f77eb7722144154288bfd96f799f8ff3e2b2b39330efe38db5dd359e4fb27012464cd85cb0a76e9b7edd1b443568cb3192c22e7cffc34989df0bafd605 +"p-map@npm:^7.0.2": + version: 7.0.3 + resolution: "p-map@npm:7.0.3" + checksum: 8c92d533acf82f0d12f7e196edccff773f384098bbb048acdd55a08778ce4fc8889d8f1bde72969487bd96f9c63212698d79744c20bedfce36c5b00b46d369f8 languageName: node linkType: hard @@ -13131,134 +10146,37 @@ __metadata: linkType: hard "package-json-from-dist@npm:^1.0.0": - version: 1.0.0 - resolution: "package-json-from-dist@npm:1.0.0" - checksum: ac706ec856a5a03f5261e4e48fa974f24feb044d51f84f8332e2af0af04fbdbdd5bbbfb9cbbe354190409bc8307c83a9e38c6672c3c8855f709afb0006a009ea - languageName: node - linkType: hard - -"parent-module@npm:^1.0.0": version: 1.0.1 - resolution: "parent-module@npm:1.0.1" - dependencies: - callsites: ^3.0.0 - checksum: 6ba8b255145cae9470cf5551eb74be2d22281587af787a2626683a6c20fbb464978784661478dd2a3f1dad74d1e802d403e1b03c1a31fab310259eec8ac560ff - languageName: node - linkType: hard - -"parse-asn1@npm:^5.0.0, parse-asn1@npm:^5.1.7": - version: 5.1.7 - resolution: "parse-asn1@npm:5.1.7" - dependencies: - asn1.js: ^4.10.1 - browserify-aes: ^1.2.0 - evp_bytestokey: ^1.0.3 - hash-base: ~3.0 - pbkdf2: ^3.1.2 - safe-buffer: ^5.2.1 - checksum: 93c7194c1ed63a13e0b212d854b5213ad1aca0ace41c66b311e97cca0519cf9240f79435a0306a3b412c257f0ea3f1953fd0d9549419a0952c9e995ab361fd6c + resolution: "package-json-from-dist@npm:1.0.1" + checksum: 58ee9538f2f762988433da00e26acc788036914d57c71c246bf0be1b60cdbd77dd60b6a3e1a30465f0b248aeb80079e0b34cb6050b1dfa18c06953bb1cbc7602 languageName: node linkType: hard -"parse-cache-control@npm:^1.0.1": +"parent-module@npm:^1.0.0": version: 1.0.1 - resolution: "parse-cache-control@npm:1.0.1" - checksum: 5a70868792124eb07c2dd07a78fcb824102e972e908254e9e59ce59a4796c51705ff28196d2b20d3b7353d14e9f98e65ed0e4eda9be072cc99b5297dc0466fee - languageName: node - linkType: hard - -"parse-duration@npm:^1.0.0": - version: 1.1.0 - resolution: "parse-duration@npm:1.1.0" - checksum: 3cfc10aa61b3a06373a347289e1704de47d5d845c79330bbab20b54c02567f3710ba84544a3a44a986c3381c68670d89542fe9de607fb0814e52f78b34893cd9 - languageName: node - linkType: hard - -"parse-headers@npm:^2.0.0": - version: 2.0.5 - resolution: "parse-headers@npm:2.0.5" - checksum: 3e97f01e4c7f960bfbfd0ee489f0bd8d3c72b6c814f1f79b66abec2cca8eaf8e4ecd89deba0b6e61266469aed87350bc932001181c01ff8c29a59e696abe251f - languageName: node - linkType: hard - -"parse-json@npm:^2.2.0": - version: 2.2.0 - resolution: "parse-json@npm:2.2.0" - dependencies: - error-ex: ^1.2.0 - checksum: dda78a63e57a47b713a038630868538f718a7ca0cd172a36887b0392ccf544ed0374902eb28f8bf3409e8b71d62b79d17062f8543afccf2745f9b0b2d2bb80ca - languageName: node - linkType: hard - -"parse-json@npm:^5.0.0, parse-json@npm:^5.2.0": - version: 5.2.0 - resolution: "parse-json@npm:5.2.0" - dependencies: - "@babel/code-frame": ^7.0.0 - error-ex: ^1.3.1 - json-parse-even-better-errors: ^2.3.0 - lines-and-columns: ^1.1.6 - checksum: 62085b17d64da57f40f6afc2ac1f4d95def18c4323577e1eced571db75d9ab59b297d1d10582920f84b15985cbfc6b6d450ccbf317644cfa176f3ed982ad87e2 - languageName: node - linkType: hard - -"parseurl@npm:~1.3.3": - version: 1.3.3 - resolution: "parseurl@npm:1.3.3" - checksum: 407cee8e0a3a4c5cd472559bca8b6a45b82c124e9a4703302326e9ab60fc1081442ada4e02628efef1eb16197ddc7f8822f5a91fd7d7c86b51f530aedb17dfa2 - languageName: node - linkType: hard - -"pascalcase@npm:^0.1.1": - version: 0.1.1 - resolution: "pascalcase@npm:0.1.1" - checksum: f83681c3c8ff75fa473a2bb2b113289952f802ff895d435edd717e7cb898b0408cbdb247117a938edcbc5d141020909846cc2b92c47213d764e2a94d2ad2b925 + resolution: "parent-module@npm:1.0.1" + dependencies: + callsites: ^3.0.0 + checksum: 6ba8b255145cae9470cf5551eb74be2d22281587af787a2626683a6c20fbb464978784661478dd2a3f1dad74d1e802d403e1b03c1a31fab310259eec8ac560ff languageName: node linkType: hard -"patch-package@npm:6.2.2": - version: 6.2.2 - resolution: "patch-package@npm:6.2.2" - dependencies: - "@yarnpkg/lockfile": ^1.1.0 - chalk: ^2.4.2 - cross-spawn: ^6.0.5 - find-yarn-workspace-root: ^1.2.1 - fs-extra: ^7.0.1 - is-ci: ^2.0.0 - klaw-sync: ^6.0.0 - minimist: ^1.2.0 - rimraf: ^2.6.3 - semver: ^5.6.0 - slash: ^2.0.0 - tmp: ^0.0.33 - bin: - patch-package: index.js - checksum: 5e2f49457b0dc56b5ce0a9d23e281e062e9f225d87a832540f02ffed29ffa7f298b1877daf13c16500ef8a759109c975e3d28d6bd63b0d953f349177abee1767 +"parse-duration@npm:^1.0.0": + version: 1.1.2 + resolution: "parse-duration@npm:1.1.2" + checksum: c31ebdee783935afe250fd79cdfab9d14e196ee2a810e6a7abbdef6d945a1b88797972437c9e5ed10e8e1cb5cd68b7cc13e9ac9721839f0cb1c2f5fe837d99d9 languageName: node linkType: hard -"patch-package@npm:^6.2.2": - version: 6.5.1 - resolution: "patch-package@npm:6.5.1" +"parse-json@npm:^5.0.0, parse-json@npm:^5.2.0": + version: 5.2.0 + resolution: "parse-json@npm:5.2.0" dependencies: - "@yarnpkg/lockfile": ^1.1.0 - chalk: ^4.1.2 - cross-spawn: ^6.0.5 - find-yarn-workspace-root: ^2.0.0 - fs-extra: ^9.0.0 - is-ci: ^2.0.0 - klaw-sync: ^6.0.0 - minimist: ^1.2.6 - open: ^7.4.2 - rimraf: ^2.6.3 - semver: ^5.6.0 - slash: ^2.0.0 - tmp: ^0.0.33 - yaml: ^1.10.2 - bin: - patch-package: index.js - checksum: 8530ffa30f11136b527c6eddf6da48fa12856ee510a47edb1f9cdf8a025636adb82968f5fae778b5e04ce8c87915ebdf5911422b54add59a5a42e372a8f30eb2 + "@babel/code-frame": ^7.0.0 + error-ex: ^1.3.1 + json-parse-even-better-errors: ^2.3.0 + lines-and-columns: ^1.1.6 + checksum: 62085b17d64da57f40f6afc2ac1f4d95def18c4323577e1eced571db75d9ab59b297d1d10582920f84b15985cbfc6b6d450ccbf317644cfa176f3ed982ad87e2 languageName: node linkType: hard @@ -13269,15 +10187,6 @@ __metadata: languageName: node linkType: hard -"path-exists@npm:^2.0.0": - version: 2.1.0 - resolution: "path-exists@npm:2.1.0" - dependencies: - pinkie-promise: ^2.0.0 - checksum: fdb734f1d00f225f7a0033ce6d73bff6a7f76ea08936abf0e5196fa6e54a645103538cd8aedcb90d6d8c3fa3705ded0c58a4da5948ae92aa8834892c1ab44a84 - languageName: node - linkType: hard - "path-exists@npm:^3.0.0": version: 3.0.0 resolution: "path-exists@npm:3.0.0" @@ -13292,7 +10201,7 @@ __metadata: languageName: node linkType: hard -"path-is-absolute@npm:^1.0.0, path-is-absolute@npm:^1.0.1": +"path-is-absolute@npm:^1.0.0": version: 1.0.1 resolution: "path-is-absolute@npm:1.0.1" checksum: 060840f92cf8effa293bcc1bea81281bd7d363731d214cbe5c227df207c34cd727430f70c6037b5159c8a870b9157cba65e775446b0ab06fd5ecc7e54615a3b8 @@ -13330,24 +10239,6 @@ __metadata: languageName: node linkType: hard -"path-to-regexp@npm:0.1.7": - version: 0.1.7 - resolution: "path-to-regexp@npm:0.1.7" - checksum: 69a14ea24db543e8b0f4353305c5eac6907917031340e5a8b37df688e52accd09e3cebfe1660b70d76b6bd89152f52183f28c74813dbf454ba1a01c82a38abce - languageName: node - linkType: hard - -"path-type@npm:^1.0.0": - version: 1.1.0 - resolution: "path-type@npm:1.1.0" - dependencies: - graceful-fs: ^4.1.2 - pify: ^2.0.0 - pinkie-promise: ^2.0.0 - checksum: 59a4b2c0e566baf4db3021a1ed4ec09a8b36fca960a490b54a6bcefdb9987dafe772852982b6011cd09579478a96e57960a01f75fa78a794192853c9d468fc79 - languageName: node - linkType: hard - "path-type@npm:^4.0.0": version: 4.0.0 resolution: "path-type@npm:4.0.0" @@ -13362,7 +10253,7 @@ __metadata: languageName: node linkType: hard -"pbkdf2@npm:^3.0.17, pbkdf2@npm:^3.0.3, pbkdf2@npm:^3.0.9, pbkdf2@npm:^3.1.2": +"pbkdf2@npm:^3.0.17, pbkdf2@npm:^3.0.9": version: 3.1.2 resolution: "pbkdf2@npm:3.1.2" dependencies: @@ -13382,10 +10273,10 @@ __metadata: languageName: node linkType: hard -"picocolors@npm:^1.0.0": - version: 1.0.1 - resolution: "picocolors@npm:1.0.1" - checksum: fa68166d1f56009fc02a34cdfd112b0dd3cf1ef57667ac57281f714065558c01828cdf4f18600ad6851cbe0093952ed0660b1e0156bddf2184b6aaf5817553a5 +"picocolors@npm:^1.1.0, picocolors@npm:^1.1.1": + version: 1.1.1 + resolution: "picocolors@npm:1.1.1" + checksum: e1cf46bf84886c79055fdfa9dcb3e4711ad259949e3565154b004b260cd356c5d54b31a1437ce9782624bf766272fe6b0154f5f0c744fb7af5d454d2b60db045 languageName: node linkType: hard @@ -13396,10 +10287,10 @@ __metadata: languageName: node linkType: hard -"pify@npm:^2.0.0, pify@npm:^2.3.0": - version: 2.3.0 - resolution: "pify@npm:2.3.0" - checksum: 9503aaeaf4577acc58642ad1d25c45c6d90288596238fb68f82811c08104c800e5a7870398e9f015d82b44ecbcbef3dc3d4251a1cbb582f6e5959fe09884b2ba +"picomatch@npm:^4.0.2": + version: 4.0.2 + resolution: "picomatch@npm:4.0.2" + checksum: a7a5188c954f82c6585720e9143297ccd0e35ad8072231608086ca950bee672d51b0ef676254af0788205e59bd4e4deb4e7708769226bed725bf13370a7d1464 languageName: node linkType: hard @@ -13410,22 +10301,6 @@ __metadata: languageName: node linkType: hard -"pinkie-promise@npm:^2.0.0": - version: 2.0.1 - resolution: "pinkie-promise@npm:2.0.1" - dependencies: - pinkie: ^2.0.0 - checksum: b53a4a2e73bf56b6f421eef711e7bdcb693d6abb474d57c5c413b809f654ba5ee750c6a96dd7225052d4b96c4d053cdcb34b708a86fceed4663303abee52fcca - languageName: node - linkType: hard - -"pinkie@npm:^2.0.0": - version: 2.0.4 - resolution: "pinkie@npm:2.0.4" - checksum: b12b10afea1177595aab036fc220785488f67b4b0fc49e7a27979472592e971614fa1c728e63ad3e7eb748b4ec3c3dbd780819331dad6f7d635c77c10537b9db - languageName: node - linkType: hard - "pkginfo@npm:^0.4.1": version: 0.4.1 resolution: "pkginfo@npm:0.4.1" @@ -13440,31 +10315,10 @@ __metadata: languageName: node linkType: hard -"posix-character-classes@npm:^0.1.0": - version: 0.1.1 - resolution: "posix-character-classes@npm:0.1.1" - checksum: dedb99913c60625a16050cfed2fb5c017648fc075be41ac18474e1c6c3549ef4ada201c8bd9bd006d36827e289c571b6092e1ef6e756cdbab2fd7046b25c6442 - languageName: node - linkType: hard - "possible-typed-array-names@npm:^1.0.0": - version: 1.0.0 - resolution: "possible-typed-array-names@npm:1.0.0" - checksum: b32d403ece71e042385cc7856385cecf1cd8e144fa74d2f1de40d1e16035dba097bc189715925e79b67bdd1472796ff168d3a90d296356c9c94d272d5b95f3ae - languageName: node - linkType: hard - -"postinstall-postinstall@npm:^2.1.0": - version: 2.1.0 - resolution: "postinstall-postinstall@npm:2.1.0" - checksum: e1d34252cf8d2c5641c7d2db7426ec96e3d7a975f01c174c68f09ef5b8327bc8d5a9aa2001a45e693db2cdbf69577094d3fe6597b564ad2d2202b65fba76134b - languageName: node - linkType: hard - -"precond@npm:0.2": - version: 0.2.3 - resolution: "precond@npm:0.2.3" - checksum: c613e7d68af3e0b43a294a994bf067cc2bc44b03fd17bc4fb133e30617a4f5b49414b08e9b392d52d7c6822d8a71f66a7fe93a8a1e7d02240177202cff3f63ef + version: 1.1.0 + resolution: "possible-typed-array-names@npm:1.1.0" + checksum: cfcd4f05264eee8fd184cd4897a17890561d1d473434b43ab66ad3673d9c9128981ec01e0cb1d65a52cd6b1eebfb2eae1e53e39b2e0eca86afc823ede7a4f41b languageName: node linkType: hard @@ -13482,13 +10336,6 @@ __metadata: languageName: node linkType: hard -"prepend-http@npm:^2.0.0": - version: 2.0.0 - resolution: "prepend-http@npm:2.0.0" - checksum: 7694a9525405447662c1ffd352fcb41b6410c705b739b6f4e3a3e21cf5fdede8377890088e8934436b8b17ba55365a615f153960f30877bf0d0392f9e93503ea - languageName: node - linkType: hard - "prettier-linter-helpers@npm:^1.0.0": version: 1.0.0 resolution: "prettier-linter-helpers@npm:1.0.0" @@ -13499,15 +10346,14 @@ __metadata: linkType: hard "prettier-plugin-solidity@npm:^1.0.0-dev.23": - version: 1.3.1 - resolution: "prettier-plugin-solidity@npm:1.3.1" + version: 1.4.3 + resolution: "prettier-plugin-solidity@npm:1.4.3" dependencies: - "@solidity-parser/parser": ^0.17.0 - semver: ^7.5.4 - solidity-comments-extractor: ^0.0.8 + "@solidity-parser/parser": ^0.20.1 + semver: ^7.7.1 peerDependencies: prettier: ">=2.3.0" - checksum: 286bf3b5899d7fad66e49c78ebac164bacfbf419f874a932ed99e491d97d77e91fa03ca068197939d3696ba7991db9e5258390dd42dee8d2184fa8c2e11921e4 + checksum: fe175497cff86fd5a7b5e31fac83111b4518d0bc98a2ca49dff42afa1ebb672ce7b23f28d40b0fbb7dda9851861cef9c4d68b94401b8a524f805c3b3319a4252 languageName: node linkType: hard @@ -13520,7 +10366,7 @@ __metadata: languageName: node linkType: hard -"prettier@npm:^2.1.2, prettier@npm:^2.3.1, prettier@npm:^2.7.1, prettier@npm:^2.8.3": +"prettier@npm:^2.3.1, prettier@npm:^2.7.1, prettier@npm:^2.8.3": version: 2.8.8 resolution: "prettier@npm:2.8.8" bin: @@ -13529,24 +10375,10 @@ __metadata: languageName: node linkType: hard -"private@npm:^0.1.6, private@npm:^0.1.8": - version: 0.1.8 - resolution: "private@npm:0.1.8" - checksum: a00abd713d25389f6de7294f0e7879b8a5d09a9ec5fd81cc2f21b29d4f9a80ec53bc4222927d3a281d4aadd4cd373d9a28726fca3935921950dc75fd71d1fdbb - languageName: node - linkType: hard - -"proc-log@npm:^3.0.0": - version: 3.0.0 - resolution: "proc-log@npm:3.0.0" - checksum: 02b64e1b3919e63df06f836b98d3af002b5cd92655cab18b5746e37374bfb73e03b84fe305454614b34c25b485cc687a9eebdccf0242cda8fda2475dd2c97e02 - languageName: node - linkType: hard - -"proc-log@npm:^4.2.0": - version: 4.2.0 - resolution: "proc-log@npm:4.2.0" - checksum: 98f6cd012d54b5334144c5255ecb941ee171744f45fca8b43b58ae5a0c1af07352475f481cadd9848e7f0250376ee584f6aa0951a856ff8f021bdfbff4eb33fc +"proc-log@npm:^5.0.0": + version: 5.0.0 + resolution: "proc-log@npm:5.0.0" + checksum: c78b26ecef6d5cce4a7489a1e9923d7b4b1679028c8654aef0463b27f4a90b0946cd598f55799da602895c52feb085ec76381d007ab8dcceebd40b89c2f9dfe0 languageName: node linkType: hard @@ -13557,13 +10389,6 @@ __metadata: languageName: node linkType: hard -"process@npm:^0.11.10": - version: 0.11.10 - resolution: "process@npm:0.11.10" - checksum: bfcce49814f7d172a6e6a14d5fa3ac92cc3d0c3b9feb1279774708a719e19acd673995226351a082a9ae99978254e320ccda4240ddc474ba31a76c79491ca7c3 - languageName: node - linkType: hard - "progress@npm:^2.0.0": version: 2.0.3 resolution: "progress@npm:2.0.3" @@ -13581,25 +10406,6 @@ __metadata: languageName: node linkType: hard -"promise-to-callback@npm:^1.0.0": - version: 1.0.0 - resolution: "promise-to-callback@npm:1.0.0" - dependencies: - is-fn: ^1.0.0 - set-immediate-shim: ^1.0.1 - checksum: 8c9e1327386e00f799589cdf96fff2586a13b52b0185222bc3199e1305ba9344589eedfd4038dcbaf5592d85d567097d1507b81e948b7fff6ffdd3de49d54e14 - languageName: node - linkType: hard - -"promise@npm:^8.0.0": - version: 8.3.0 - resolution: "promise@npm:8.3.0" - dependencies: - asap: ~2.0.6 - checksum: a69f0ddbddf78ffc529cffee7ad950d307347615970564b17988ce43fbe767af5c738a9439660b24a9a8cbea106c0dcbb6c2b20e23b7e96a8e89e5c2679e94d5 - languageName: node - linkType: hard - "proper-lockfile@npm:^4.1.1": version: 4.1.2 resolution: "proper-lockfile@npm:4.1.2" @@ -13635,16 +10441,6 @@ __metadata: languageName: node linkType: hard -"proxy-addr@npm:~2.0.7": - version: 2.0.7 - resolution: "proxy-addr@npm:2.0.7" - dependencies: - forwarded: 0.2.0 - ipaddr.js: 1.9.1 - checksum: 29c6990ce9364648255454842f06f8c46fcd124d3e6d7c5066df44662de63cdc0bad032e9bf5a3d653ff72141cc7b6019873d685708ac8210c30458ad99f2b74 - languageName: node - linkType: hard - "proxy-from-env@npm:^1.1.0": version: 1.1.0 resolution: "proxy-from-env@npm:1.1.0" @@ -13659,93 +10455,12 @@ __metadata: languageName: node linkType: hard -"pseudomap@npm:^1.0.1": - version: 1.0.2 - resolution: "pseudomap@npm:1.0.2" - checksum: 856c0aae0ff2ad60881168334448e898ad7a0e45fe7386d114b150084254c01e200c957cf378378025df4e052c7890c5bd933939b0e0d2ecfcc1dc2f0b2991f5 - languageName: node - linkType: hard - "psl@npm:^1.1.28": - version: 1.9.0 - resolution: "psl@npm:1.9.0" - checksum: 20c4277f640c93d393130673f392618e9a8044c6c7bf61c53917a0fddb4952790f5f362c6c730a9c32b124813e173733f9895add8d26f566ed0ea0654b2e711d - languageName: node - linkType: hard - -"public-encrypt@npm:^4.0.0": - version: 4.0.3 - resolution: "public-encrypt@npm:4.0.3" - dependencies: - bn.js: ^4.1.0 - browserify-rsa: ^4.0.0 - create-hash: ^1.1.0 - parse-asn1: ^5.0.0 - randombytes: ^2.0.1 - safe-buffer: ^5.1.2 - checksum: 215d446e43cef021a20b67c1df455e5eea134af0b1f9b8a35f9e850abf32991b0c307327bc5b9bc07162c288d5cdb3d4a783ea6c6640979ed7b5017e3e0c9935 - languageName: node - linkType: hard - -"pull-cat@npm:^1.1.9": - version: 1.1.11 - resolution: "pull-cat@npm:1.1.11" - checksum: 785173d94732ba5e6e65f27ee128542522aeb87519c5d72aa9b8bc510f6c4f67b91fcfd565782a20aafc116e57354f2dd0fa8fd039b45a61b8da89b0253a7440 - languageName: node - linkType: hard - -"pull-defer@npm:^0.2.2": - version: 0.2.3 - resolution: "pull-defer@npm:0.2.3" - checksum: 4ea99ed64a2d79167e87293aba5088cde91f210a319c690a65aa6704d829be33b76cecc732f8d4ed3eee47e7eb09a6f77042897ea6414862bacbd722ce182d66 - languageName: node - linkType: hard - -"pull-level@npm:^2.0.3": - version: 2.0.4 - resolution: "pull-level@npm:2.0.4" - dependencies: - level-post: ^1.0.7 - pull-cat: ^1.1.9 - pull-live: ^1.0.1 - pull-pushable: ^2.0.0 - pull-stream: ^3.4.0 - pull-window: ^2.1.4 - stream-to-pull-stream: ^1.7.1 - checksum: f4e0573b3ff3f3659eb50ac86b505aee12d5f4c1d8bafc3bf6fd67d173b3b39a3fe5161d8bfa5eba8a0c5873fbda75f3b160276cfa678d5edd517dcd3349ecc2 - languageName: node - linkType: hard - -"pull-live@npm:^1.0.1": - version: 1.0.1 - resolution: "pull-live@npm:1.0.1" - dependencies: - pull-cat: ^1.1.9 - pull-stream: ^3.4.0 - checksum: e4328771e811aec1e03996d1070ec8fecb2560cc48b96814cd9f4aebd870a710903f8693e423765d3d65d8021b3b9ccc38c8660baef3df45e217c9b1bbc5581a - languageName: node - linkType: hard - -"pull-pushable@npm:^2.0.0": - version: 2.2.0 - resolution: "pull-pushable@npm:2.2.0" - checksum: 1c88ef55f6f14799ae5cf060415d089d15452ef865d874f075c155f8224c321371cb7f04a10b3fba263b6f128158c78253efd18bcb54afbb99f9cae846f883a6 - languageName: node - linkType: hard - -"pull-stream@npm:^3.2.3, pull-stream@npm:^3.4.0, pull-stream@npm:^3.6.8": - version: 3.7.0 - resolution: "pull-stream@npm:3.7.0" - checksum: df0b864fd92bb61e84d02764a064bf023188c1c917d854029a5b8e543e163f9aaf1a9553067d4fdf5e248b0d96338e0a23fac9257e86cf740e7d03e05b7a77a3 - languageName: node - linkType: hard - -"pull-window@npm:^2.1.4": - version: 2.1.4 - resolution: "pull-window@npm:2.1.4" + version: 1.15.0 + resolution: "psl@npm:1.15.0" dependencies: - looper: ^2.0.0 - checksum: e006995108a80c81eea93dfaadf68285dc5b9b3cbaf654da39731ca3f308376f15b0546c61730cd0fa38303e273a1845c6d65f0fda35ed9c66252a65e446df18 + punycode: ^2.3.1 + checksum: 6f777d82eecfe1c2406dadbc15e77467b186fec13202ec887a45d0209a2c6fca530af94a462a477c3c4a767ad892ec9ede7c482d98f61f653dd838b50e89dc15 languageName: node linkType: hard @@ -13760,19 +10475,12 @@ __metadata: linkType: hard "pump@npm:^3.0.0": - version: 3.0.0 - resolution: "pump@npm:3.0.0" + version: 3.0.2 + resolution: "pump@npm:3.0.2" dependencies: end-of-stream: ^1.1.0 once: ^1.3.1 - checksum: e42e9229fba14732593a718b04cb5e1cfef8254544870997e0ecd9732b189a48e1256e4e5478148ecb47c8511dca2b09eae56b4d0aad8009e6fac8072923cfc9 - languageName: node - linkType: hard - -"punycode@npm:2.1.0": - version: 2.1.0 - resolution: "punycode@npm:2.1.0" - checksum: d125d8f86cd89303c33bad829388c49ca23197e16ccf8cd398dcbd81b026978f6543f5066c66825b25b1dfea7790a42edbeea82908e103474931789714ab86cd + checksum: e0c4216874b96bd25ddf31a0b61a5613e26cc7afa32379217cf39d3915b0509def3565f5f6968fafdad2894c8bbdbd67d340e84f3634b2a29b950cffb6442d9f languageName: node linkType: hard @@ -13783,28 +10491,19 @@ __metadata: languageName: node linkType: hard -"punycode@npm:^2.1.0, punycode@npm:^2.1.1": +"punycode@npm:^2.1.0, punycode@npm:^2.1.1, punycode@npm:^2.3.1": version: 2.3.1 resolution: "punycode@npm:2.3.1" checksum: bb0a0ceedca4c3c57a9b981b90601579058903c62be23c5e8e843d2c2d4148a3ecf029d5133486fb0e1822b098ba8bba09e89d6b21742d02fa26bda6441a6fb2 languageName: node linkType: hard -"qs@npm:6.11.0": - version: 6.11.0 - resolution: "qs@npm:6.11.0" - dependencies: - side-channel: ^1.0.4 - checksum: 6e1f29dd5385f7488ec74ac7b6c92f4d09a90408882d0c208414a34dd33badc1a621019d4c799a3df15ab9b1d0292f97c1dd71dc7c045e69f81a8064e5af7297 - languageName: node - linkType: hard - -"qs@npm:^6.11.2, qs@npm:^6.4.0": - version: 6.12.1 - resolution: "qs@npm:6.12.1" +"qs@npm:^6.12.3": + version: 6.14.0 + resolution: "qs@npm:6.14.0" dependencies: - side-channel: ^1.0.6 - checksum: aa761d99e65b6936ba2dd2187f2d9976afbcda38deb3ff1b3fe331d09b0c578ed79ca2abdde1271164b5be619c521ec7db9b34c23f49a074e5921372d16242d5 + side-channel: ^1.1.0 + checksum: 189b52ad4e9a0da1a16aff4c58b2a554a8dad9bd7e287c7da7446059b49ca2e33a49e570480e8be406b87fccebf134f51c373cbce36c8c83859efa0c9b71d635 languageName: node linkType: hard @@ -13815,17 +10514,6 @@ __metadata: languageName: node linkType: hard -"query-string@npm:^5.0.1": - version: 5.1.1 - resolution: "query-string@npm:5.1.1" - dependencies: - decode-uri-component: ^0.2.0 - object-assign: ^4.1.0 - strict-uri-encode: ^1.0.0 - checksum: 4ac760d9778d413ef5f94f030ed14b1a07a1708dd13fd3bc54f8b9ef7b425942c7577f30de0bf5a7d227ee65a9a0350dfa3a43d1d266880882fb7ce4c434a4dd - languageName: node - linkType: hard - "queue-microtask@npm:^1.2.2, queue-microtask@npm:^1.2.3": version: 1.2.3 resolution: "queue-microtask@npm:1.2.3" @@ -13833,14 +10521,7 @@ __metadata: languageName: node linkType: hard -"quick-lru@npm:^5.1.1": - version: 5.1.1 - resolution: "quick-lru@npm:5.1.1" - checksum: a516faa25574be7947969883e6068dbe4aa19e8ef8e8e0fd96cddd6d36485e9106d85c0041a27153286b0770b381328f4072aa40d3b18a19f5f7d2b78b94b5ed - languageName: node - linkType: hard - -"randombytes@npm:^2.0.0, randombytes@npm:^2.0.1, randombytes@npm:^2.0.5, randombytes@npm:^2.0.6, randombytes@npm:^2.1.0": +"randombytes@npm:^2.0.1, randombytes@npm:^2.1.0": version: 2.1.0 resolution: "randombytes@npm:2.1.0" dependencies: @@ -13849,24 +10530,7 @@ __metadata: languageName: node linkType: hard -"randomfill@npm:^1.0.3": - version: 1.0.4 - resolution: "randomfill@npm:1.0.4" - dependencies: - randombytes: ^2.0.5 - safe-buffer: ^5.1.0 - checksum: 33734bb578a868d29ee1b8555e21a36711db084065d94e019a6d03caa67debef8d6a1bfd06a2b597e32901ddc761ab483a85393f0d9a75838f1912461d4dbfc7 - languageName: node - linkType: hard - -"range-parser@npm:~1.2.1": - version: 1.2.1 - resolution: "range-parser@npm:1.2.1" - checksum: 0a268d4fea508661cf5743dfe3d5f47ce214fd6b7dec1de0da4d669dd4ef3d2144468ebe4179049eff253d9d27e719c88dae55be64f954e80135a0cada804ec9 - languageName: node - linkType: hard - -"raw-body@npm:2.5.2, raw-body@npm:^2.4.1": +"raw-body@npm:^2.4.1": version: 2.5.2 resolution: "raw-body@npm:2.5.2" dependencies: @@ -13887,40 +10551,7 @@ __metadata: languageName: node linkType: hard -"read-pkg-up@npm:^1.0.1": - version: 1.0.1 - resolution: "read-pkg-up@npm:1.0.1" - dependencies: - find-up: ^1.0.0 - read-pkg: ^1.0.0 - checksum: d18399a0f46e2da32beb2f041edd0cda49d2f2cc30195a05c759ef3ed9b5e6e19ba1ad1bae2362bdec8c6a9f2c3d18f4d5e8c369e808b03d498d5781cb9122c7 - languageName: node - linkType: hard - -"read-pkg@npm:^1.0.0": - version: 1.1.0 - resolution: "read-pkg@npm:1.1.0" - dependencies: - load-json-file: ^1.0.0 - normalize-package-data: ^2.3.2 - path-type: ^1.0.0 - checksum: a0f5d5e32227ec8e6a028dd5c5134eab229768dcb7a5d9a41a284ed28ad4b9284fecc47383dc1593b5694f4de603a7ffaee84b738956b9b77e0999567485a366 - languageName: node - linkType: hard - -"readable-stream@npm:^1.0.33": - version: 1.1.14 - resolution: "readable-stream@npm:1.1.14" - dependencies: - core-util-is: ~1.0.0 - inherits: ~2.0.1 - isarray: 0.0.1 - string_decoder: ~0.10.x - checksum: 17dfeae3e909945a4a1abc5613ea92d03269ef54c49288599507fc98ff4615988a1c39a999dcf9aacba70233d9b7040bc11a5f2bfc947e262dedcc0a8b32b5a0 - languageName: node - linkType: hard - -"readable-stream@npm:^2.0.0, readable-stream@npm:^2.0.5, readable-stream@npm:^2.2.2, readable-stream@npm:^2.2.8, readable-stream@npm:^2.2.9, readable-stream@npm:^2.3.0, readable-stream@npm:^2.3.5, readable-stream@npm:^2.3.6, readable-stream@npm:^2.3.8, readable-stream@npm:~2.3.6": +"readable-stream@npm:^2.2.2, readable-stream@npm:^2.3.0, readable-stream@npm:^2.3.5": version: 2.3.8 resolution: "readable-stream@npm:2.3.8" dependencies: @@ -13935,7 +10566,7 @@ __metadata: languageName: node linkType: hard -"readable-stream@npm:^3.0.6, readable-stream@npm:^3.1.0, readable-stream@npm:^3.4.0, readable-stream@npm:^3.6.0": +"readable-stream@npm:^3.1.0, readable-stream@npm:^3.4.0, readable-stream@npm:^3.6.0": version: 3.6.2 resolution: "readable-stream@npm:3.6.2" dependencies: @@ -13946,7 +10577,7 @@ __metadata: languageName: node linkType: hard -"readable-stream@npm:~1.0.15, readable-stream@npm:~1.0.26-4": +"readable-stream@npm:~1.0.26-4": version: 1.0.34 resolution: "readable-stream@npm:1.0.34" dependencies: @@ -13958,6 +10589,13 @@ __metadata: languageName: node linkType: hard +"readdirp@npm:^4.0.1": + version: 4.1.2 + resolution: "readdirp@npm:4.1.2" + checksum: 3242ee125422cb7c0e12d51452e993f507e6ed3d8c490bc8bf3366c5cdd09167562224e429b13e9cb2b98d4b8b2b11dc100d3c73883aa92d657ade5a21ded004 + languageName: node + linkType: hard + "readdirp@npm:~3.6.0": version: 3.6.0 resolution: "readdirp@npm:3.6.0" @@ -14001,138 +10639,58 @@ __metadata: languageName: node linkType: hard -"regenerate@npm:^1.2.1": - version: 1.4.2 - resolution: "regenerate@npm:1.4.2" - checksum: 3317a09b2f802da8db09aa276e469b57a6c0dd818347e05b8862959c6193408242f150db5de83c12c3fa99091ad95fb42a6db2c3329bfaa12a0ea4cbbeb30cb0 - languageName: node - linkType: hard - -"regenerator-runtime@npm:^0.11.0": - version: 0.11.1 - resolution: "regenerator-runtime@npm:0.11.1" - checksum: 3c97bd2c7b2b3247e6f8e2147a002eb78c995323732dad5dc70fac8d8d0b758d0295e7015b90d3d444446ae77cbd24b9f9123ec3a77018e81d8999818301b4f4 - languageName: node - linkType: hard - -"regenerator-transform@npm:^0.10.0": - version: 0.10.1 - resolution: "regenerator-transform@npm:0.10.1" - dependencies: - babel-runtime: ^6.18.0 - babel-types: ^6.19.0 - private: ^0.1.6 - checksum: bd366a3b0fa0d0975c48fb9eff250363a9ab28c25b472ecdc397bb19a836746640a30d8f641718a895f9178564bd8a01a0179a9c8e5813f76fc29e62a115d9d7 - languageName: node - linkType: hard - -"regex-not@npm:^1.0.0, regex-not@npm:^1.0.2": - version: 1.0.2 - resolution: "regex-not@npm:1.0.2" - dependencies: - extend-shallow: ^3.0.2 - safe-regex: ^1.1.0 - checksum: 3081403de79559387a35ef9d033740e41818a559512668cef3d12da4e8a29ef34ee13c8ed1256b07e27ae392790172e8a15c8a06b72962fd4550476cde3d8f77 - languageName: node - linkType: hard - -"regexp.prototype.flags@npm:^1.5.1, regexp.prototype.flags@npm:^1.5.2": - version: 1.5.2 - resolution: "regexp.prototype.flags@npm:1.5.2" +"reflect.getprototypeof@npm:^1.0.6, reflect.getprototypeof@npm:^1.0.9": + version: 1.0.10 + resolution: "reflect.getprototypeof@npm:1.0.10" dependencies: - call-bind: ^1.0.6 + call-bind: ^1.0.8 define-properties: ^1.2.1 + es-abstract: ^1.23.9 es-errors: ^1.3.0 - set-function-name: ^2.0.1 - checksum: d7f333667d5c564e2d7a97c56c3075d64c722c9bb51b2b4df6822b2e8096d623a5e63088fb4c83df919b6951ef8113841de8b47de7224872fa6838bc5d8a7d64 - languageName: node - linkType: hard - -"regexpp@npm:^2.0.1": - version: 2.0.1 - resolution: "regexpp@npm:2.0.1" - checksum: 1f41cf80ac08514c6665812e3dcc0673569431d3285db27053f8b237a758992fb55d6ddfbc264db399ff4f7a7db432900ca3a029daa28a75e0436231872091b1 - languageName: node - linkType: hard - -"regexpp@npm:^3.0.0": - version: 3.2.0 - resolution: "regexpp@npm:3.2.0" - checksum: a78dc5c7158ad9ddcfe01aa9144f46e192ddbfa7b263895a70a5c6c73edd9ce85faf7c0430e59ac38839e1734e275b9c3de5c57ee3ab6edc0e0b1bdebefccef8 - languageName: node - linkType: hard - -"regexpu-core@npm:^2.0.0": - version: 2.0.0 - resolution: "regexpu-core@npm:2.0.0" - dependencies: - regenerate: ^1.2.1 - regjsgen: ^0.2.0 - regjsparser: ^0.1.4 - checksum: 14a78eb4608fa991ded6a1433ee6a570f95a4cfb7fe312145a44d6ecbb3dc8c707016a099494c741aa0ac75a1329b40814d30ff134c0d67679c80187029c7d2d - languageName: node - linkType: hard - -"regjsgen@npm:^0.2.0": - version: 0.2.0 - resolution: "regjsgen@npm:0.2.0" - checksum: 1f3ae570151e2c29193cdc5a5890c0b83cd8c5029ed69315b0ea303bc2644f9ab5d536d2288fd9b70293fd351d7dd7fc1fc99ebe24554015c894dbce883bcf2b + es-object-atoms: ^1.0.0 + get-intrinsic: ^1.2.7 + get-proto: ^1.0.1 + which-builtin-type: ^1.2.1 + checksum: ccc5debeb66125e276ae73909cecb27e47c35d9bb79d9cc8d8d055f008c58010ab8cb401299786e505e4aab733a64cba9daf5f312a58e96a43df66adad221870 languageName: node linkType: hard -"regjsparser@npm:^0.1.4": - version: 0.1.5 - resolution: "regjsparser@npm:0.1.5" +"regexp.prototype.flags@npm:^1.5.3": + version: 1.5.4 + resolution: "regexp.prototype.flags@npm:1.5.4" dependencies: - jsesc: ~0.5.0 - bin: - regjsparser: bin/parser - checksum: 1feba2f3f2d4f1ef9f5f4e0f20c827cf866d4f65c51502eb64db4d4dd9c656f8c70f6c79537c892bf0fc9592c96f732519f7d8ad4a82f3b622756118ac737970 - languageName: node - linkType: hard - -"repeat-element@npm:^1.1.2": - version: 1.1.4 - resolution: "repeat-element@npm:1.1.4" - checksum: 1edd0301b7edad71808baad226f0890ba709443f03a698224c9ee4f2494c317892dc5211b2ba8cbea7194a9ddbcac01e283bd66de0467ab24ee1fc1a3711d8a9 - languageName: node - linkType: hard - -"repeat-string@npm:^1.0.0, repeat-string@npm:^1.6.1": - version: 1.6.1 - resolution: "repeat-string@npm:1.6.1" - checksum: 1b809fc6db97decdc68f5b12c4d1a671c8e3f65ec4a40c238bc5200e44e85bcc52a54f78268ab9c29fcf5fe4f1343e805420056d1f30fa9a9ee4c2d93e3cc6c0 + call-bind: ^1.0.8 + define-properties: ^1.2.1 + es-errors: ^1.3.0 + get-proto: ^1.0.1 + gopd: ^1.2.0 + set-function-name: ^2.0.2 + checksum: 18cb667e56cb328d2dda569d7f04e3ea78f2683135b866d606538cf7b1d4271f7f749f09608c877527799e6cf350e531368f3c7a20ccd1bb41048a48926bdeeb languageName: node linkType: hard -"repeating@npm:^2.0.0": +"regexpp@npm:^2.0.1": version: 2.0.1 - resolution: "repeating@npm:2.0.1" - dependencies: - is-finite: ^1.0.0 - checksum: d2db0b69c5cb0c14dd750036e0abcd6b3c3f7b2da3ee179786b755cf737ca15fa0fff417ca72de33d6966056f4695440e680a352401fc02c95ade59899afbdd0 + resolution: "regexpp@npm:2.0.1" + checksum: 1f41cf80ac08514c6665812e3dcc0673569431d3285db27053f8b237a758992fb55d6ddfbc264db399ff4f7a7db432900ca3a029daa28a75e0436231872091b1 languageName: node linkType: hard -"req-cwd@npm:^2.0.0": - version: 2.0.0 - resolution: "req-cwd@npm:2.0.0" - dependencies: - req-from: ^2.0.0 - checksum: c44f9dea0b0f7d3a72be18a04f7769e0eefbadca363e3a346c1c02b79745126c871e1f6970357b3e731c26740aad8344bf80fb3ce055a2bcf8ca85ad2b44f519 +"regexpp@npm:^3.0.0": + version: 3.2.0 + resolution: "regexpp@npm:3.2.0" + checksum: a78dc5c7158ad9ddcfe01aa9144f46e192ddbfa7b263895a70a5c6c73edd9ce85faf7c0430e59ac38839e1734e275b9c3de5c57ee3ab6edc0e0b1bdebefccef8 languageName: node linkType: hard -"req-from@npm:^2.0.0": - version: 2.0.0 - resolution: "req-from@npm:2.0.0" - dependencies: - resolve-from: ^3.0.0 - checksum: 4c369881a2296e23e71668ed089c5d93b37652fe900ec9f1e1f5c1da65f6bca4ee271e97ba2b806fdea50219e011995d1df3c80a7209015cc1e1fc622507f140 +"repeat-string@npm:^1.0.0": + version: 1.6.1 + resolution: "repeat-string@npm:1.6.1" + checksum: 1b809fc6db97decdc68f5b12c4d1a671c8e3f65ec4a40c238bc5200e44e85bcc52a54f78268ab9c29fcf5fe4f1343e805420056d1f30fa9a9ee4c2d93e3cc6c0 languageName: node linkType: hard -"request@npm:^2.79.0, request@npm:^2.85.0, request@npm:^2.88.0": +"request@npm:^2.85.0, request@npm:^2.88.0": version: 2.88.2 resolution: "request@npm:2.88.2" dependencies: @@ -14167,27 +10725,13 @@ __metadata: languageName: node linkType: hard -"require-from-string@npm:^1.1.0": - version: 1.2.1 - resolution: "require-from-string@npm:1.2.1" - checksum: d2e0b0c798fe45d86456a32425635bd9d2a75a20e87f67294fa5cce5ed61fdf41e0c7c57afa981fb836299bfb0c37c915adb4d22478dc8d12edbf80a304e9324 - languageName: node - linkType: hard - -"require-from-string@npm:^2.0.0, require-from-string@npm:^2.0.2": +"require-from-string@npm:^2.0.2": version: 2.0.2 resolution: "require-from-string@npm:2.0.2" checksum: a03ef6895445f33a4015300c426699bc66b2b044ba7b670aa238610381b56d3f07c686251740d575e22f4c87531ba662d06937508f0f3c0f1ddc04db3130560b languageName: node linkType: hard -"require-main-filename@npm:^1.0.1": - version: 1.0.1 - resolution: "require-main-filename@npm:1.0.1" - checksum: 1fef30754da961f4e13c450c3eb60c7ae898a529c6ad6fa708a70bd2eed01564ceb299187b2899f5562804d797a059f39a5789884d0ac7b7ae1defc68fba4abf - languageName: node - linkType: hard - "require-main-filename@npm:^2.0.0": version: 2.0.0 resolution: "require-main-filename@npm:2.0.0" @@ -14195,20 +10739,6 @@ __metadata: languageName: node linkType: hard -"resolve-alpn@npm:^1.0.0": - version: 1.2.1 - resolution: "resolve-alpn@npm:1.2.1" - checksum: f558071fcb2c60b04054c99aebd572a2af97ef64128d59bef7ab73bd50d896a222a056de40ffc545b633d99b304c259ea9d0c06830d5c867c34f0bfa60b8eae0 - languageName: node - linkType: hard - -"resolve-from@npm:^3.0.0": - version: 3.0.0 - resolution: "resolve-from@npm:3.0.0" - checksum: fff9819254d2d62b57f74e5c2ca9c0bdd425ca47287c4d801bc15f947533148d858229ded7793b0f59e61e49e782fffd6722048add12996e1bd4333c29669062 - languageName: node - linkType: hard - "resolve-from@npm:^4.0.0": version: 4.0.0 resolution: "resolve-from@npm:4.0.0" @@ -14216,13 +10746,6 @@ __metadata: languageName: node linkType: hard -"resolve-url@npm:^0.2.1": - version: 0.2.1 - resolution: "resolve-url@npm:0.2.1" - checksum: 7b7035b9ed6e7bc7d289e90aef1eab5a43834539695dac6416ca6e91f1a94132ae4796bbd173cdacfdc2ade90b5f38a3fb6186bebc1b221cd157777a23b9ad14 - languageName: node - linkType: hard - "resolve@npm:1.1.x": version: 1.1.7 resolution: "resolve@npm:1.1.7" @@ -14239,16 +10762,16 @@ __metadata: languageName: node linkType: hard -"resolve@npm:^1.1.6, resolve@npm:^1.10.0, resolve@npm:^1.10.1, resolve@npm:^1.22.1, resolve@npm:^1.22.4, resolve@npm:^1.8.1, resolve@npm:~1.22.6": - version: 1.22.8 - resolution: "resolve@npm:1.22.8" +"resolve@npm:^1.1.6, resolve@npm:^1.10.1, resolve@npm:^1.22.1, resolve@npm:^1.22.4": + version: 1.22.10 + resolution: "resolve@npm:1.22.10" dependencies: - is-core-module: ^2.13.0 + is-core-module: ^2.16.0 path-parse: ^1.0.7 supports-preserve-symlinks-flag: ^1.0.0 bin: resolve: bin/resolve - checksum: f8a26958aa572c9b064562750b52131a37c29d072478ea32e129063e2da7f83e31f7f11e7087a18225a8561cfe8d2f0df9dbea7c9d331a897571c0a2527dbb4c + checksum: ab7a32ff4046fcd7c6fdd525b24a7527847d03c3650c733b909b01b757f92eb23510afa9cc3e9bf3f26a3e073b48c88c706dfd4c1d2fb4a16a96b73b6328ddcf languageName: node linkType: hard @@ -14268,34 +10791,16 @@ __metadata: languageName: node linkType: hard -"resolve@patch:resolve@^1.1.6#~builtin, resolve@patch:resolve@^1.10.0#~builtin, resolve@patch:resolve@^1.10.1#~builtin, resolve@patch:resolve@^1.22.1#~builtin, resolve@patch:resolve@^1.22.4#~builtin, resolve@patch:resolve@^1.8.1#~builtin, resolve@patch:resolve@~1.22.6#~builtin": - version: 1.22.8 - resolution: "resolve@patch:resolve@npm%3A1.22.8#~builtin::version=1.22.8&hash=07638b" +"resolve@patch:resolve@^1.1.6#~builtin, resolve@patch:resolve@^1.10.1#~builtin, resolve@patch:resolve@^1.22.1#~builtin, resolve@patch:resolve@^1.22.4#~builtin": + version: 1.22.10 + resolution: "resolve@patch:resolve@npm%3A1.22.10#~builtin::version=1.22.10&hash=07638b" dependencies: - is-core-module: ^2.13.0 + is-core-module: ^2.16.0 path-parse: ^1.0.7 supports-preserve-symlinks-flag: ^1.0.0 bin: resolve: bin/resolve - checksum: 5479b7d431cacd5185f8db64bfcb7286ae5e31eb299f4c4f404ad8aa6098b77599563ac4257cb2c37a42f59dfc06a1bec2bcf283bb448f319e37f0feb9a09847 - languageName: node - linkType: hard - -"responselike@npm:^1.0.2": - version: 1.0.2 - resolution: "responselike@npm:1.0.2" - dependencies: - lowercase-keys: ^1.0.0 - checksum: 2e9e70f1dcca3da621a80ce71f2f9a9cad12c047145c6ece20df22f0743f051cf7c73505e109814915f23f9e34fb0d358e22827723ee3d56b623533cab8eafcd - languageName: node - linkType: hard - -"responselike@npm:^2.0.0": - version: 2.0.1 - resolution: "responselike@npm:2.0.1" - dependencies: - lowercase-keys: ^2.0.0 - checksum: b122535466e9c97b55e69c7f18e2be0ce3823c5d47ee8de0d9c0b114aa55741c6db8bfbfce3766a94d1272e61bfb1ebf0a15e9310ac5629fbb7446a861b4fd3a + checksum: 8aac1e4e4628bd00bf4b94b23de137dd3fe44097a8d528fd66db74484be929936e20c696e1a3edf4488f37e14180b73df6f600992baea3e089e8674291f16c9d languageName: node linkType: hard @@ -14309,13 +10814,6 @@ __metadata: languageName: node linkType: hard -"ret@npm:~0.1.10": - version: 0.1.15 - resolution: "ret@npm:0.1.15" - checksum: d76a9159eb8c946586567bd934358dfc08a36367b3257f7a3d7255fdd7b56597235af23c6afa0d7f0254159e8051f93c918809962ebd6df24ca2a83dbe4d4151 - languageName: node - linkType: hard - "retimer@npm:^3.0.0": version: 3.0.0 resolution: "retimer@npm:3.0.0" @@ -14338,9 +10836,9 @@ __metadata: linkType: hard "reusify@npm:^1.0.4": - version: 1.0.4 - resolution: "reusify@npm:1.0.4" - checksum: c3076ebcc22a6bc252cb0b9c77561795256c22b757f40c0d8110b1300723f15ec0fc8685e8d4ea6d7666f36c79ccc793b1939c748bf36f18f542744a4e379fcc + version: 1.1.0 + resolution: "reusify@npm:1.1.0" + checksum: 64cb3142ac5e9ad689aca289585cb41d22521f4571f73e9488af39f6b1bd62f0cbb3d65e2ecc768ec6494052523f473f1eb4b55c3e9014b3590c17fc6a03e22a languageName: node linkType: hard @@ -14355,7 +10853,7 @@ __metadata: languageName: node linkType: hard -"rimraf@npm:^2.2.8, rimraf@npm:^2.6.3": +"rimraf@npm:^2.6.3": version: 2.7.1 resolution: "rimraf@npm:2.7.1" dependencies: @@ -14398,7 +10896,7 @@ __metadata: languageName: node linkType: hard -"rlp@npm:^2.0.0, rlp@npm:^2.2.1, rlp@npm:^2.2.2, rlp@npm:^2.2.3, rlp@npm:^2.2.4": +"rlp@npm:^2.2.3, rlp@npm:^2.2.4": version: 2.2.7 resolution: "rlp@npm:2.2.7" dependencies: @@ -14441,28 +10939,20 @@ __metadata: languageName: node linkType: hard -"rxjs@npm:^7.2.0": - version: 7.8.1 - resolution: "rxjs@npm:7.8.1" - dependencies: - tslib: ^2.1.0 - checksum: de4b53db1063e618ec2eca0f7965d9137cabe98cf6be9272efe6c86b47c17b987383df8574861bcced18ebd590764125a901d5506082be84a8b8e364bf05f119 - languageName: node - linkType: hard - -"safe-array-concat@npm:^1.0.0, safe-array-concat@npm:^1.1.2": - version: 1.1.2 - resolution: "safe-array-concat@npm:1.1.2" +"safe-array-concat@npm:^1.1.3": + version: 1.1.3 + resolution: "safe-array-concat@npm:1.1.3" dependencies: - call-bind: ^1.0.7 - get-intrinsic: ^1.2.4 - has-symbols: ^1.0.3 + call-bind: ^1.0.8 + call-bound: ^1.0.2 + get-intrinsic: ^1.2.6 + has-symbols: ^1.1.0 isarray: ^2.0.5 - checksum: a3b259694754ddfb73ae0663829e396977b99ff21cbe8607f35a469655656da8e271753497e59da8a7575baa94d2e684bea3e10ddd74ba046c0c9b4418ffa0c4 + checksum: 00f6a68140e67e813f3ad5e73e6dedcf3e42a9fa01f04d44b0d3f7b1f4b257af876832a9bfc82ac76f307e8a6cc652e3cf95876048a26cbec451847cf6ae3707 languageName: node linkType: hard -"safe-buffer@npm:5.2.1, safe-buffer@npm:^5.0.1, safe-buffer@npm:^5.1.0, safe-buffer@npm:^5.1.1, safe-buffer@npm:^5.1.2, safe-buffer@npm:^5.2.0, safe-buffer@npm:^5.2.1, safe-buffer@npm:~5.2.0": +"safe-buffer@npm:^5.0.1, safe-buffer@npm:^5.1.0, safe-buffer@npm:^5.1.1, safe-buffer@npm:^5.1.2, safe-buffer@npm:^5.2.0, safe-buffer@npm:^5.2.1, safe-buffer@npm:~5.2.0": version: 5.2.1 resolution: "safe-buffer@npm:5.2.1" checksum: b99c4b41fdd67a6aaf280fcd05e9ffb0813654894223afb78a31f14a19ad220bba8aba1cb14eddce1fcfb037155fe6de4e861784eb434f7d11ed58d1e70dd491 @@ -14476,32 +10966,24 @@ __metadata: languageName: node linkType: hard -"safe-event-emitter@npm:^1.0.1": - version: 1.0.1 - resolution: "safe-event-emitter@npm:1.0.1" - dependencies: - events: ^3.0.0 - checksum: 2a15094bd28b0966571693f219b5a846949ae24f7ba87c6024f0ed552bef63ebe72970a784b85b77b1f03f1c95e78fabe19306d44538dbc4a3a685bed31c18c4 - languageName: node - linkType: hard - -"safe-regex-test@npm:^1.0.3": - version: 1.0.3 - resolution: "safe-regex-test@npm:1.0.3" +"safe-push-apply@npm:^1.0.0": + version: 1.0.0 + resolution: "safe-push-apply@npm:1.0.0" dependencies: - call-bind: ^1.0.6 es-errors: ^1.3.0 - is-regex: ^1.1.4 - checksum: 6c7d392ff1ae7a3ae85273450ed02d1d131f1d2c76e177d6b03eb88e6df8fa062639070e7d311802c1615f351f18dc58f9454501c58e28d5ffd9b8f502ba6489 + isarray: ^2.0.5 + checksum: 8c11cbee6dc8ff5cc0f3d95eef7052e43494591384015902e4292aef4ae9e539908288520ed97179cee17d6ffb450fe5f05a46ce7a1749685f7524fd568ab5db languageName: node linkType: hard -"safe-regex@npm:^1.1.0": +"safe-regex-test@npm:^1.1.0": version: 1.1.0 - resolution: "safe-regex@npm:1.1.0" + resolution: "safe-regex-test@npm:1.1.0" dependencies: - ret: ~0.1.10 - checksum: 9a8bba57c87a841f7997b3b951e8e403b1128c1a4fd1182f40cc1a20e2d490593d7c2a21030fadfea320c8e859219019e136f678c6689ed5960b391b822f01d5 + call-bound: ^1.0.2 + es-errors: ^1.3.0 + is-regex: ^1.2.1 + checksum: 3c809abeb81977c9ed6c869c83aca6873ea0f3ab0f806b8edbba5582d51713f8a6e9757d24d2b4b088f563801475ea946c8e77e7713e8c65cdd02305b6caedab languageName: node linkType: hard @@ -14536,23 +11018,14 @@ __metadata: languageName: node linkType: hard -"scrypt-js@npm:3.0.1, scrypt-js@npm:^3.0.0, scrypt-js@npm:^3.0.1": +"scrypt-js@npm:3.0.1, scrypt-js@npm:^3.0.0": version: 3.0.1 resolution: "scrypt-js@npm:3.0.1" checksum: b7c7d1a68d6ca946f2fbb0778e0c4ec63c65501b54023b2af7d7e9f48fdb6c6580d6f7675cd53bda5944c5ebc057560d5a6365079752546865defb3b79dea454 languageName: node linkType: hard -"scryptsy@npm:^1.2.1": - version: 1.2.1 - resolution: "scryptsy@npm:1.2.1" - dependencies: - pbkdf2: ^3.0.3 - checksum: e09cf253b0974171bbcb77fa46405bb07cb8e241e2851fc5f23b38526a33105f0f7748a4d60027642f40bd4518ada30b1dce5005c05d17a25cbcefad371d4259 - languageName: node - linkType: hard - -"secp256k1@npm:4.0.3, secp256k1@npm:^4.0.1": +"secp256k1@npm:4.0.3": version: 4.0.3 resolution: "secp256k1@npm:4.0.3" dependencies: @@ -14564,10 +11037,15 @@ __metadata: languageName: node linkType: hard -"seedrandom@npm:3.0.1": - version: 3.0.1 - resolution: "seedrandom@npm:3.0.1" - checksum: a8f5bd0e918c4d4b59afd6f5dbd28f5ab8d5f118ee59892c3712f581de51574ac6622aa38fa2d03476b661f8407e98d6ff32af3d7cfdb02c90d046e7f5f91952 +"secp256k1@npm:^4.0.1": + version: 4.0.4 + resolution: "secp256k1@npm:4.0.4" + dependencies: + elliptic: ^6.5.7 + node-addon-api: ^5.0.0 + node-gyp: latest + node-gyp-build: ^4.2.0 + checksum: 9314ddcd27506c5f8d9b21a2c131c62464762f597b82fe48ba89b50149ec95cd566d6ad2d4a922553dd0a8b4b14c1ccd83283f487229a941b6c7c02361ef5177 languageName: node linkType: hard @@ -14585,14 +11063,7 @@ __metadata: languageName: node linkType: hard -"semaphore@npm:>=1.0.1, semaphore@npm:^1.0.3, semaphore@npm:^1.1.0": - version: 1.1.0 - resolution: "semaphore@npm:1.1.0" - checksum: d2445d232ad9959048d4748ef54eb01bc7b60436be2b42fb7de20c4cffacf70eafeeecd3772c1baf408cfdce3805fa6618a4389590335671f18cde54ef3cfae4 - languageName: node - linkType: hard - -"semver@npm:2 || 3 || 4 || 5, semver@npm:^5.3.0, semver@npm:^5.5.0, semver@npm:^5.6.0": +"semver@npm:^5.5.0": version: 5.7.2 resolution: "semver@npm:5.7.2" bin: @@ -14610,76 +11081,21 @@ __metadata: languageName: node linkType: hard -"semver@npm:^7.0.0, semver@npm:^7.3.2, semver@npm:^7.3.4, semver@npm:^7.3.5, semver@npm:^7.3.7, semver@npm:^7.3.8, semver@npm:^7.5.2, semver@npm:^7.5.4": - version: 7.6.2 - resolution: "semver@npm:7.6.2" +"semver@npm:^7.0.0, semver@npm:^7.3.2, semver@npm:^7.3.4, semver@npm:^7.3.5, semver@npm:^7.3.7, semver@npm:^7.3.8, semver@npm:^7.5.2, semver@npm:^7.7.1": + version: 7.7.1 + resolution: "semver@npm:7.7.1" bin: semver: bin/semver.js - checksum: 40f6a95101e8d854357a644da1b8dd9d93ce786d5c6a77227bc69dbb17bea83d0d1d1d7c4cd5920a6df909f48e8bd8a5909869535007f90278289f2451d0292d - languageName: node - linkType: hard - -"semver@npm:~5.4.1": - version: 5.4.1 - resolution: "semver@npm:5.4.1" - bin: - semver: ./bin/semver - checksum: d4bf8cc6a95b065a545ab35082b6ac6c5f4ebe1e1c570f72c252afe9b7e622f2479fb2a5cef3e937d8807d37bfdad2d1feebcc8610e06f556e552c22cad070a2 + checksum: 586b825d36874007c9382d9e1ad8f93888d8670040add24a28e06a910aeebd673a2eb9e3bf169c6679d9245e66efb9057e0852e70d9daa6c27372aab1dda7104 languageName: node linkType: hard -"send@npm:0.18.0": - version: 0.18.0 - resolution: "send@npm:0.18.0" - dependencies: - debug: 2.6.9 - depd: 2.0.0 - destroy: 1.2.0 - encodeurl: ~1.0.2 - escape-html: ~1.0.3 - etag: ~1.8.1 - fresh: 0.5.2 - http-errors: 2.0.0 - mime: 1.6.0 - ms: 2.1.3 - on-finished: 2.4.1 - range-parser: ~1.2.1 - statuses: 2.0.1 - checksum: 74fc07ebb58566b87b078ec63e5a3e41ecd987e4272ba67b7467e86c6ad51bc6b0b0154133b6d8b08a2ddda360464f71382f7ef864700f34844a76c8027817a8 - languageName: node - linkType: hard - -"serialize-javascript@npm:6.0.0": - version: 6.0.0 - resolution: "serialize-javascript@npm:6.0.0" +"serialize-javascript@npm:^6.0.2": + version: 6.0.2 + resolution: "serialize-javascript@npm:6.0.2" dependencies: randombytes: ^2.1.0 - checksum: 56f90b562a1bdc92e55afb3e657c6397c01a902c588c0fe3d4c490efdcc97dcd2a3074ba12df9e94630f33a5ce5b76a74784a7041294628a6f4306e0ec84bf93 - languageName: node - linkType: hard - -"serve-static@npm:1.15.0": - version: 1.15.0 - resolution: "serve-static@npm:1.15.0" - dependencies: - encodeurl: ~1.0.2 - escape-html: ~1.0.3 - parseurl: ~1.3.3 - send: 0.18.0 - checksum: af57fc13be40d90a12562e98c0b7855cf6e8bd4c107fe9a45c212bf023058d54a1871b1c89511c3958f70626fff47faeb795f5d83f8cf88514dbaeb2b724464d - languageName: node - linkType: hard - -"servify@npm:^0.1.12": - version: 0.1.12 - resolution: "servify@npm:0.1.12" - dependencies: - body-parser: ^1.16.0 - cors: ^2.8.1 - express: ^4.14.0 - request: ^2.79.0 - xhr: ^2.3.3 - checksum: f90e8f4e31b2981b31e3fa8be0b570b0876136b4cf818ba3bfb65e1bfb3c54cb90a0c30898a7c2974b586800bd26ff525c838a8c170148d9e6674c2170f535d8 + checksum: c4839c6206c1d143c0f80763997a361310305751171dd95e4b57efee69b8f6edd8960a0b7fbfc45042aadff98b206d55428aee0dc276efe54f100899c7fa8ab7 languageName: node linkType: hard @@ -14690,7 +11106,7 @@ __metadata: languageName: node linkType: hard -"set-function-length@npm:^1.2.1": +"set-function-length@npm:^1.2.2": version: 1.2.2 resolution: "set-function-length@npm:1.2.2" dependencies: @@ -14704,7 +11120,7 @@ __metadata: languageName: node linkType: hard -"set-function-name@npm:^2.0.1": +"set-function-name@npm:^2.0.2": version: 2.0.2 resolution: "set-function-name@npm:2.0.2" dependencies: @@ -14716,22 +11132,14 @@ __metadata: languageName: node linkType: hard -"set-immediate-shim@npm:^1.0.1": - version: 1.0.1 - resolution: "set-immediate-shim@npm:1.0.1" - checksum: 5085c84039d1e5eee73d2bf48ce765fcec76159021d0cc7b40e23bcdf62cb6d450ffb781e3c62c1118425242c48eae96df712cba0a20a437e86b0d4a15d51a11 - languageName: node - linkType: hard - -"set-value@npm:^2.0.0, set-value@npm:^2.0.1": - version: 2.0.1 - resolution: "set-value@npm:2.0.1" +"set-proto@npm:^1.0.0": + version: 1.0.0 + resolution: "set-proto@npm:1.0.0" dependencies: - extend-shallow: ^2.0.1 - is-extendable: ^0.1.1 - is-plain-object: ^2.0.3 - split-string: ^3.0.1 - checksum: 09a4bc72c94641aeae950eb60dc2755943b863780fcc32e441eda964b64df5e3f50603d5ebdd33394ede722528bd55ed43aae26e9df469b4d32e2292b427b601 + dunder-proto: ^1.0.1 + es-errors: ^1.3.0 + es-object-atoms: ^1.0.0 + checksum: ec27cbbe334598547e99024403e96da32aca3e530583e4dba7f5db1c43cbc4affa9adfbd77c7b2c210b9b8b2e7b2e600bad2a6c44fd62e804d8233f96bbb62f4 languageName: node linkType: hard @@ -14816,61 +11224,65 @@ __metadata: languageName: node linkType: hard -"side-channel@npm:^1.0.4, side-channel@npm:^1.0.6": - version: 1.0.6 - resolution: "side-channel@npm:1.0.6" +"side-channel-list@npm:^1.0.0": + version: 1.0.0 + resolution: "side-channel-list@npm:1.0.0" dependencies: - call-bind: ^1.0.7 es-errors: ^1.3.0 - get-intrinsic: ^1.2.4 - object-inspect: ^1.13.1 - checksum: bfc1afc1827d712271453e91b7cd3878ac0efd767495fd4e594c4c2afaa7963b7b510e249572bfd54b0527e66e4a12b61b80c061389e129755f34c493aad9b97 - languageName: node - linkType: hard - -"signal-exit@npm:^3.0.0, signal-exit@npm:^3.0.2": - version: 3.0.7 - resolution: "signal-exit@npm:3.0.7" - checksum: a2f098f247adc367dffc27845853e9959b9e88b01cb301658cfe4194352d8d2bb32e18467c786a7fe15f1d44b233ea35633d076d5e737870b7139949d1ab6318 + object-inspect: ^1.13.3 + checksum: 603b928997abd21c5a5f02ae6b9cc36b72e3176ad6827fab0417ead74580cc4fb4d5c7d0a8a2ff4ead34d0f9e35701ed7a41853dac8a6d1a664fcce1a044f86f languageName: node linkType: hard -"signal-exit@npm:^4.0.1": - version: 4.1.0 - resolution: "signal-exit@npm:4.1.0" - checksum: 64c757b498cb8629ffa5f75485340594d2f8189e9b08700e69199069c8e3070fb3e255f7ab873c05dc0b3cec412aea7402e10a5990cb6a050bd33ba062a6c549 +"side-channel-map@npm:^1.0.1": + version: 1.0.1 + resolution: "side-channel-map@npm:1.0.1" + dependencies: + call-bound: ^1.0.2 + es-errors: ^1.3.0 + get-intrinsic: ^1.2.5 + object-inspect: ^1.13.3 + checksum: 42501371cdf71f4ccbbc9c9e2eb00aaaab80a4c1c429d5e8da713fd4d39ef3b8d4a4b37ed4f275798a65260a551a7131fd87fe67e922dba4ac18586d6aab8b06 languageName: node linkType: hard -"simple-concat@npm:^1.0.0": - version: 1.0.1 - resolution: "simple-concat@npm:1.0.1" - checksum: 4d211042cc3d73a718c21ac6c4e7d7a0363e184be6a5ad25c8a1502e49df6d0a0253979e3d50dbdd3f60ef6c6c58d756b5d66ac1e05cda9cacd2e9fc59e3876a +"side-channel-weakmap@npm:^1.0.2": + version: 1.0.2 + resolution: "side-channel-weakmap@npm:1.0.2" + dependencies: + call-bound: ^1.0.2 + es-errors: ^1.3.0 + get-intrinsic: ^1.2.5 + object-inspect: ^1.13.3 + side-channel-map: ^1.0.1 + checksum: a815c89bc78c5723c714ea1a77c938377ea710af20d4fb886d362b0d1f8ac73a17816a5f6640f354017d7e292a43da9c5e876c22145bac00b76cfb3468001736 languageName: node linkType: hard -"simple-get@npm:^2.7.0": - version: 2.8.2 - resolution: "simple-get@npm:2.8.2" +"side-channel@npm:^1.1.0": + version: 1.1.0 + resolution: "side-channel@npm:1.1.0" dependencies: - decompress-response: ^3.3.0 - once: ^1.3.1 - simple-concat: ^1.0.0 - checksum: 230bd931d3198f21a5a1a566687a5ee1ef651b13b61c7a01b547b2a0c2bf72769b5fe14a3b4dd518e99a18ba1002ba8af3901c0e61e8a0d1e7631a3c2eb1f7a9 + es-errors: ^1.3.0 + object-inspect: ^1.13.3 + side-channel-list: ^1.0.0 + side-channel-map: ^1.0.1 + side-channel-weakmap: ^1.0.2 + checksum: bf73d6d6682034603eb8e99c63b50155017ed78a522d27c2acec0388a792c3ede3238b878b953a08157093b85d05797217d270b7666ba1f111345fbe933380ff languageName: node linkType: hard -"slash@npm:^1.0.0": - version: 1.0.0 - resolution: "slash@npm:1.0.0" - checksum: 4b6e21b1fba6184a7e2efb1dd173f692d8a845584c1bbf9dc818ff86f5a52fc91b413008223d17cc684604ee8bb9263a420b1182027ad9762e35388434918860 +"signal-exit@npm:^3.0.0, signal-exit@npm:^3.0.2": + version: 3.0.7 + resolution: "signal-exit@npm:3.0.7" + checksum: a2f098f247adc367dffc27845853e9959b9e88b01cb301658cfe4194352d8d2bb32e18467c786a7fe15f1d44b233ea35633d076d5e737870b7139949d1ab6318 languageName: node linkType: hard -"slash@npm:^2.0.0": - version: 2.0.0 - resolution: "slash@npm:2.0.0" - checksum: 512d4350735375bd11647233cb0e2f93beca6f53441015eea241fe784d8068281c3987fbaa93e7ef1c38df68d9c60013045c92837423c69115297d6169aa85e6 +"signal-exit@npm:^4.0.1": + version: 4.1.0 + resolution: "signal-exit@npm:4.1.0" + checksum: 64c757b498cb8629ffa5f75485340594d2f8189e9b08700e69199069c8e3070fb3e255f7ab873c05dc0b3cec412aea7402e10a5990cb6a050bd33ba062a6c549 languageName: node linkType: hard @@ -14910,79 +11322,24 @@ __metadata: languageName: node linkType: hard -"snapdragon-node@npm:^2.0.1": - version: 2.1.1 - resolution: "snapdragon-node@npm:2.1.1" - dependencies: - define-property: ^1.0.0 - isobject: ^3.0.0 - snapdragon-util: ^3.0.1 - checksum: 9bb57d759f9e2a27935dbab0e4a790137adebace832b393e350a8bf5db461ee9206bb642d4fe47568ee0b44080479c8b4a9ad0ebe3712422d77edf9992a672fd - languageName: node - linkType: hard - -"snapdragon-util@npm:^3.0.1": - version: 3.0.1 - resolution: "snapdragon-util@npm:3.0.1" - dependencies: - kind-of: ^3.2.0 - checksum: 684997dbe37ec995c03fd3f412fba2b711fc34cb4010452b7eb668be72e8811a86a12938b511e8b19baf853b325178c56d8b78d655305e5cfb0bb8b21677e7b7 - languageName: node - linkType: hard - -"snapdragon@npm:^0.8.1": - version: 0.8.2 - resolution: "snapdragon@npm:0.8.2" - dependencies: - base: ^0.11.1 - debug: ^2.2.0 - define-property: ^0.2.5 - extend-shallow: ^2.0.1 - map-cache: ^0.2.2 - source-map: ^0.5.6 - source-map-resolve: ^0.5.0 - use: ^3.1.0 - checksum: a197f242a8f48b11036563065b2487e9b7068f50a20dd81d9161eca6af422174fc158b8beeadbe59ce5ef172aa5718143312b3aebaae551c124b7824387c8312 - languageName: node - linkType: hard - "socks-proxy-agent@npm:^8.0.3": - version: 8.0.4 - resolution: "socks-proxy-agent@npm:8.0.4" + version: 8.0.5 + resolution: "socks-proxy-agent@npm:8.0.5" dependencies: - agent-base: ^7.1.1 + agent-base: ^7.1.2 debug: ^4.3.4 socks: ^2.8.3 - checksum: b2ec5051d85fe49072f9a250c427e0e9571fd09d5db133819192d078fd291276e1f0f50f6dbc04329b207738b1071314cee8bdbb4b12e27de42dbcf1d4233c67 + checksum: b4fbcdb7ad2d6eec445926e255a1fb95c975db0020543fbac8dfa6c47aecc6b3b619b7fb9c60a3f82c9b2969912a5e7e174a056ae4d98cb5322f3524d6036e1d languageName: node linkType: hard "socks@npm:^2.8.3": - version: 2.8.3 - resolution: "socks@npm:2.8.3" + version: 2.8.4 + resolution: "socks@npm:2.8.4" dependencies: ip-address: ^9.0.5 smart-buffer: ^4.2.0 - checksum: 7a6b7f6eedf7482b9e4597d9a20e09505824208006ea8f2c49b71657427f3c137ca2ae662089baa73e1971c62322d535d9d0cf1c9235cf6f55e315c18203eadd - languageName: node - linkType: hard - -"solc@npm:0.7.3": - version: 0.7.3 - resolution: "solc@npm:0.7.3" - dependencies: - command-exists: ^1.2.8 - commander: 3.0.2 - follow-redirects: ^1.12.1 - fs-extra: ^0.30.0 - js-sha3: 0.8.0 - memorystream: ^0.3.1 - require-from-string: ^2.0.0 - semver: ^5.5.0 - tmp: 0.0.33 - bin: - solcjs: solcjs - checksum: 2d8eb16c6d8f648213c94dc8d977cffe5099cba7d41c82d92d769ef71ae8320a985065ce3d6c306440a85f8e8d2b27fb30bdd3ac38f69e5c1fa0ab8a3fb2f217 + checksum: cd1edc924475d5dfde534adf66038df7e62c7343e6b8c0113e52dc9bb6a0a10e25b2f136197f379d695f18e8f0f2b7f6e42977bf720ddbee912a851201c396ad languageName: node linkType: hard @@ -15020,39 +11377,6 @@ __metadata: languageName: node linkType: hard -"solc@npm:^0.4.20": - version: 0.4.26 - resolution: "solc@npm:0.4.26" - dependencies: - fs-extra: ^0.30.0 - memorystream: ^0.3.1 - require-from-string: ^1.1.0 - semver: ^5.3.0 - yargs: ^4.7.1 - bin: - solcjs: solcjs - checksum: 041da7ff725c19023ef34a17f83b3303971d2e62bcea9d0fd3c7af728d6f40ff7cdf2b806d0208a3336d3c9be18c321955e1712ab39ee57390ba00d512def946 - languageName: node - linkType: hard - -"solc@npm:^0.6.3": - version: 0.6.12 - resolution: "solc@npm:0.6.12" - dependencies: - command-exists: ^1.2.8 - commander: 3.0.2 - fs-extra: ^0.30.0 - js-sha3: 0.8.0 - memorystream: ^0.3.1 - require-from-string: ^2.0.0 - semver: ^5.5.0 - tmp: 0.0.33 - bin: - solcjs: solcjs - checksum: 1e2bf927f3ef4f3b195b7619ff64f715916d94dc59091a8a710e47bdd4b18e0bd92b55ea43a04ce7fabce9ad7a3e4e73ccaf127a50ebbf963a9de9046576e3b6 - languageName: node - linkType: hard - "solhint@npm:^3.3.7": version: 3.6.2 resolution: "solhint@npm:3.6.2" @@ -15084,28 +11408,19 @@ __metadata: languageName: node linkType: hard -"solidity-ast@npm:^0.4.51": - version: 0.4.56 - resolution: "solidity-ast@npm:0.4.56" - dependencies: - array.prototype.findlast: ^1.2.2 - checksum: 124cd54dc187860c83f4e8a3cbc41f890fbd0aaad4695356763034bdc782046eac414b161b7f354e423e075dba303d6bef213682df8932fee5d143d52135cd4e - languageName: node - linkType: hard - -"solidity-comments-extractor@npm:^0.0.8": - version: 0.0.8 - resolution: "solidity-comments-extractor@npm:0.0.8" - checksum: ad025fc968e2d744b4270710c2f7f55b43d8046ab3f155fd880a7768d6fd163a93ea98f62be3b1115a29ba815bd8b5736bb5ffd1feff79083eca1bf273108d07 +"solidity-ast@npm:^0.4.60": + version: 0.4.60 + resolution: "solidity-ast@npm:0.4.60" + checksum: 61b5c47d707f4a151b1ee73a551c96a52cfbc045b26c82f0024ad1f52b7221f360c56f37760f52ecd90a25554fe6027eb79de583f1556c08bc254db283bf1448 languageName: node linkType: hard "solidity-coverage@npm:^0.8.5": - version: 0.8.12 - resolution: "solidity-coverage@npm:0.8.12" + version: 0.8.16 + resolution: "solidity-coverage@npm:0.8.16" dependencies: "@ethersproject/abi": ^5.0.9 - "@solidity-parser/parser": ^0.18.0 + "@solidity-parser/parser": ^0.20.1 chalk: ^2.4.2 death: ^1.1.0 difflib: ^0.2.4 @@ -15127,20 +11442,7 @@ __metadata: hardhat: ^2.11.0 bin: solidity-coverage: plugins/bin.js - checksum: 8839416986fc76d27931dca885d915717fea3d7bae3cd2506f315f8b0583b50e05bd25a0d481262ad6cf2786966f603b6481b1658810e4add5761ce96cf5ffe4 - languageName: node - linkType: hard - -"source-map-resolve@npm:^0.5.0": - version: 0.5.3 - resolution: "source-map-resolve@npm:0.5.3" - dependencies: - atob: ^2.1.2 - decode-uri-component: ^0.2.0 - resolve-url: ^0.2.1 - source-map-url: ^0.4.0 - urix: ^0.1.0 - checksum: c73fa44ac00783f025f6ad9e038ab1a2e007cd6a6b86f47fe717c3d0765b4a08d264f6966f3bd7cd9dbcd69e4832783d5472e43247775b2a550d6f2155d24bae + checksum: c1b172a716a898da2b4e650cfd9446ee4612c08926f7a90923af8a23fa711d2efd228ebfea0e1cb33f7842e8f5f2133227f0c9586a68c614fdfe7e57330736ee languageName: node linkType: hard @@ -15154,15 +11456,6 @@ __metadata: languageName: node linkType: hard -"source-map-support@npm:^0.4.15": - version: 0.4.18 - resolution: "source-map-support@npm:0.4.18" - dependencies: - source-map: ^0.5.6 - checksum: 669aa7e992fec586fac0ba9a8dea8ce81b7328f92806335f018ffac5709afb2920e3870b4e56c68164282607229f04b8bbcf5d0e5c845eb1b5119b092e7585c0 - languageName: node - linkType: hard - "source-map-support@npm:^0.5.11, source-map-support@npm:^0.5.13, source-map-support@npm:^0.5.16": version: 0.5.21 resolution: "source-map-support@npm:0.5.21" @@ -15173,20 +11466,6 @@ __metadata: languageName: node linkType: hard -"source-map-url@npm:^0.4.0": - version: 0.4.1 - resolution: "source-map-url@npm:0.4.1" - checksum: 64c5c2c77aff815a6e61a4120c309ae4cac01298d9bcbb3deb1b46a4dd4c46d4a1eaeda79ec9f684766ae80e8dc86367b89326ce9dd2b89947bd9291fc1ac08c - languageName: node - linkType: hard - -"source-map@npm:^0.5.6, source-map@npm:^0.5.7": - version: 0.5.7 - resolution: "source-map@npm:0.5.7" - checksum: 5dc2043b93d2f194142c7f38f74a24670cd7a0063acdaf4bf01d2964b402257ae843c2a8fa822ad5b71013b5fcafa55af7421383da919752f22ff488bc553f4d - languageName: node - linkType: hard - "source-map@npm:^0.6.0, source-map@npm:^0.6.1": version: 0.6.1 resolution: "source-map@npm:0.6.1" @@ -15203,40 +11482,6 @@ __metadata: languageName: node linkType: hard -"spdx-correct@npm:^3.0.0": - version: 3.2.0 - resolution: "spdx-correct@npm:3.2.0" - dependencies: - spdx-expression-parse: ^3.0.0 - spdx-license-ids: ^3.0.0 - checksum: e9ae98d22f69c88e7aff5b8778dc01c361ef635580e82d29e5c60a6533cc8f4d820803e67d7432581af0cc4fb49973125076ee3b90df191d153e223c004193b2 - languageName: node - linkType: hard - -"spdx-exceptions@npm:^2.1.0": - version: 2.5.0 - resolution: "spdx-exceptions@npm:2.5.0" - checksum: bb127d6e2532de65b912f7c99fc66097cdea7d64c10d3ec9b5e96524dbbd7d20e01cba818a6ddb2ae75e62bb0c63d5e277a7e555a85cbc8ab40044984fa4ae15 - languageName: node - linkType: hard - -"spdx-expression-parse@npm:^3.0.0": - version: 3.0.1 - resolution: "spdx-expression-parse@npm:3.0.1" - dependencies: - spdx-exceptions: ^2.1.0 - spdx-license-ids: ^3.0.0 - checksum: a1c6e104a2cbada7a593eaa9f430bd5e148ef5290d4c0409899855ce8b1c39652bcc88a725259491a82601159d6dc790bedefc9016c7472f7de8de7361f8ccde - languageName: node - linkType: hard - -"spdx-license-ids@npm:^3.0.0": - version: 3.0.18 - resolution: "spdx-license-ids@npm:3.0.18" - checksum: 457825df5dd1fc0135b0bb848c896143f70945cc2da148afc71c73ed0837d1d651f809006e406d82109c9dd71a8cb39785a3604815fe46bc0548e9d3976f6b69 - languageName: node - linkType: hard - "split-ca@npm:^1.0.0": version: 1.0.1 resolution: "split-ca@npm:1.0.1" @@ -15244,15 +11489,6 @@ __metadata: languageName: node linkType: hard -"split-string@npm:^3.0.1, split-string@npm:^3.0.2": - version: 3.1.0 - resolution: "split-string@npm:3.1.0" - dependencies: - extend-shallow: ^3.0.0 - checksum: ae5af5c91bdc3633628821bde92fdf9492fa0e8a63cf6a0376ed6afde93c701422a1610916f59be61972717070119e848d10dfbbd5024b7729d6a71972d2a84c - languageName: node - linkType: hard - "sprintf-js@npm:^1.1.3": version: 1.1.3 resolution: "sprintf-js@npm:1.1.3" @@ -15288,31 +11524,21 @@ __metadata: languageName: node linkType: hard -"ssri@npm:^10.0.0": - version: 10.0.6 - resolution: "ssri@npm:10.0.6" +"ssri@npm:^12.0.0": + version: 12.0.0 + resolution: "ssri@npm:12.0.0" dependencies: minipass: ^7.0.3 - checksum: 4603d53a05bcd44188747d38f1cc43833b9951b5a1ee43ba50535bdfc5fe4a0897472dbe69837570a5417c3c073377ef4f8c1a272683b401857f72738ee57299 + checksum: ef4b6b0ae47b4a69896f5f1c4375f953b9435388c053c36d27998bc3d73e046969ccde61ab659e679142971a0b08e50478a1228f62edb994105b280f17900c98 languageName: node linkType: hard "stacktrace-parser@npm:^0.1.10": - version: 0.1.10 - resolution: "stacktrace-parser@npm:0.1.10" + version: 0.1.11 + resolution: "stacktrace-parser@npm:0.1.11" dependencies: type-fest: ^0.7.1 - checksum: f4fbddfc09121d91e587b60de4beb4941108e967d71ad3a171812dc839b010ca374d064ad0a296295fed13acd103609d99a4224a25b4e67de13cae131f1901ee - languageName: node - linkType: hard - -"static-extend@npm:^0.1.1": - version: 0.1.2 - resolution: "static-extend@npm:0.1.2" - dependencies: - define-property: ^0.2.5 - object-copy: ^0.1.0 - checksum: 8657485b831f79e388a437260baf22784540417a9b29e11572c87735df24c22b84eda42107403a64b30861b2faf13df9f7fc5525d51f9d1d2303aba5cbf4e12c + checksum: 1120cf716606ec6a8e25cc9b6ada79d7b91e6a599bba1a6664e6badc8b5f37987d7df7d9ad0344f717a042781fd8e1e999de08614a5afea451b68902421036b5 languageName: node linkType: hard @@ -15332,23 +11558,6 @@ __metadata: languageName: node linkType: hard -"stream-to-pull-stream@npm:^1.7.1": - version: 1.7.3 - resolution: "stream-to-pull-stream@npm:1.7.3" - dependencies: - looper: ^3.0.0 - pull-stream: ^3.2.3 - checksum: 2b878e3b3d5f435802866bfec8897361b9de4ce69f77669da1103cfc45f54833e7c183922468f30c046d375a1642f5a4801a808a8da0d3927c5de41d42a59bc0 - languageName: node - linkType: hard - -"strict-uri-encode@npm:^1.0.0": - version: 1.1.0 - resolution: "strict-uri-encode@npm:1.1.0" - checksum: 9466d371f7b36768d43f7803f26137657559e4c8b0161fb9e320efb8edba3ae22f8e99d4b0d91da023b05a13f62ec5412c3f4f764b5788fac11d1fea93720bb3 - languageName: node - linkType: hard - "string-format@npm:^2.0.0": version: 2.0.0 resolution: "string-format@npm:2.0.0" @@ -15367,17 +11576,6 @@ __metadata: languageName: node linkType: hard -"string-width@npm:^1.0.1": - version: 1.0.2 - resolution: "string-width@npm:1.0.2" - dependencies: - code-point-at: ^1.0.0 - is-fullwidth-code-point: ^1.0.0 - strip-ansi: ^3.0.0 - checksum: 5c79439e95bc3bd7233a332c5f5926ab2ee90b23816ed4faa380ce3b2576d7800b0a5bb15ae88ed28737acc7ea06a518c2eef39142dd727adad0e45c776cd37e - languageName: node - linkType: hard - "string-width@npm:^2.1.1": version: 2.1.1 resolution: "string-width@npm:2.1.1" @@ -15410,26 +11608,30 @@ __metadata: languageName: node linkType: hard -"string.prototype.trim@npm:^1.2.9, string.prototype.trim@npm:~1.2.8": - version: 1.2.9 - resolution: "string.prototype.trim@npm:1.2.9" +"string.prototype.trim@npm:^1.2.10": + version: 1.2.10 + resolution: "string.prototype.trim@npm:1.2.10" dependencies: - call-bind: ^1.0.7 + call-bind: ^1.0.8 + call-bound: ^1.0.2 + define-data-property: ^1.1.4 define-properties: ^1.2.1 - es-abstract: ^1.23.0 + es-abstract: ^1.23.5 es-object-atoms: ^1.0.0 - checksum: ea2df6ec1e914c9d4e2dc856fa08228e8b1be59b59e50b17578c94a66a176888f417264bb763d4aac638ad3b3dad56e7a03d9317086a178078d131aa293ba193 + has-property-descriptors: ^1.0.2 + checksum: 87659cd8561237b6c69f5376328fda934693aedde17bb7a2c57008e9d9ff992d0c253a391c7d8d50114e0e49ff7daf86a362f7961cf92f7564cd01342ca2e385 languageName: node linkType: hard -"string.prototype.trimend@npm:^1.0.8": - version: 1.0.8 - resolution: "string.prototype.trimend@npm:1.0.8" +"string.prototype.trimend@npm:^1.0.8, string.prototype.trimend@npm:^1.0.9": + version: 1.0.9 + resolution: "string.prototype.trimend@npm:1.0.9" dependencies: - call-bind: ^1.0.7 + call-bind: ^1.0.8 + call-bound: ^1.0.2 define-properties: ^1.2.1 es-object-atoms: ^1.0.0 - checksum: cc3bd2de08d8968a28787deba9a3cb3f17ca5f9f770c91e7e8fa3e7d47f079bad70fadce16f05dda9f261788be2c6e84a942f618c3bed31e42abc5c1084f8dfd + checksum: cb86f639f41d791a43627784be2175daa9ca3259c7cb83e7a207a729909b74f2ea0ec5d85de5761e6835e5f443e9420c6ff3f63a845378e4a61dd793177bc287 languageName: node linkType: hard @@ -15478,15 +11680,6 @@ __metadata: languageName: node linkType: hard -"strip-ansi@npm:^3.0.0, strip-ansi@npm:^3.0.1": - version: 3.0.1 - resolution: "strip-ansi@npm:3.0.1" - dependencies: - ansi-regex: ^2.0.0 - checksum: 9b974de611ce5075c70629c00fa98c46144043db92ae17748fb780f706f7a789e9989fd10597b7c2053ae8d1513fd707816a91f1879b2f71e6ac0b6a863db465 - languageName: node - linkType: hard - "strip-ansi@npm:^4.0.0": version: 4.0.0 resolution: "strip-ansi@npm:4.0.0" @@ -15514,15 +11707,6 @@ __metadata: languageName: node linkType: hard -"strip-bom@npm:^2.0.0": - version: 2.0.0 - resolution: "strip-bom@npm:2.0.0" - dependencies: - is-utf8: ^0.2.0 - checksum: 08efb746bc67b10814cd03d79eb31bac633393a782e3f35efbc1b61b5165d3806d03332a97f362822cf0d4dd14ba2e12707fcff44fe1c870c48a063a0c9e4944 - languageName: node - linkType: hard - "strip-bom@npm:^3.0.0": version: 3.0.0 resolution: "strip-bom@npm:3.0.0" @@ -15553,26 +11737,17 @@ __metadata: languageName: node linkType: hard -"strip-json-comments@npm:3.1.1, strip-json-comments@npm:^3.0.1, strip-json-comments@npm:^3.1.1": +"strip-json-comments@npm:^3.0.1, strip-json-comments@npm:^3.1.1": version: 3.1.1 resolution: "strip-json-comments@npm:3.1.1" checksum: 492f73e27268f9b1c122733f28ecb0e7e8d8a531a6662efbd08e22cccb3f9475e90a1b82cab06a392f6afae6d2de636f977e231296400d0ec5304ba70f166443 languageName: node linkType: hard -"supports-color@npm:8.1.1": - version: 8.1.1 - resolution: "supports-color@npm:8.1.1" - dependencies: - has-flag: ^4.0.0 - checksum: c052193a7e43c6cdc741eb7f378df605636e01ad434badf7324f17fb60c69a880d8d8fcdcb562cf94c2350e57b937d7425ab5b8326c67c2adc48f7c87c1db406 - languageName: node - linkType: hard - -"supports-color@npm:^2.0.0": - version: 2.0.0 - resolution: "supports-color@npm:2.0.0" - checksum: 602538c5812b9006404370b5a4b885d3e2a1f6567d314f8b4a41974ffe7d08e525bf92ae0f9c7030e3b4c78e4e34ace55d6a67a74f1571bc205959f5972f88f0 +"strnum@npm:^1.0.5": + version: 1.1.2 + resolution: "strnum@npm:1.1.2" + checksum: a85219eda13e97151c95e343a9e5960eacfb0a0ff98104b4c9cb7a212e3008bddf0c9714c9c37c2e508be78e741a04afc80027c2dc18509d1b5ffd4c37191fc2 languageName: node linkType: hard @@ -15603,49 +11778,19 @@ __metadata: languageName: node linkType: hard -"supports-preserve-symlinks-flag@npm:^1.0.0": - version: 1.0.0 - resolution: "supports-preserve-symlinks-flag@npm:1.0.0" - checksum: 53b1e247e68e05db7b3808b99b892bd36fb096e6fba213a06da7fab22045e97597db425c724f2bbd6c99a3c295e1e73f3e4de78592289f38431049e1277ca0ae - languageName: node - linkType: hard - -"swarm-js@npm:^0.1.40": - version: 0.1.42 - resolution: "swarm-js@npm:0.1.42" - dependencies: - bluebird: ^3.5.0 - buffer: ^5.0.5 - eth-lib: ^0.1.26 - fs-extra: ^4.0.2 - got: ^11.8.5 - mime-types: ^2.1.16 - mkdirp-promise: ^5.0.1 - mock-fs: ^4.1.0 - setimmediate: ^1.0.5 - tar: ^4.0.2 - xhr-request: ^1.0.1 - checksum: bbb54b84232ef113ee106cf8158d1c827fbf84b309799576f61603f63d7653fde7e71df981d07f9e4c41781bbbbd72be77e5a47e6b694d6a83b96a6a20641475 - languageName: node - linkType: hard - -"sync-request@npm:^6.0.0": - version: 6.1.0 - resolution: "sync-request@npm:6.1.0" +"supports-color@npm:^8.1.1": + version: 8.1.1 + resolution: "supports-color@npm:8.1.1" dependencies: - http-response-object: ^3.0.1 - sync-rpc: ^1.2.1 - then-request: ^6.0.0 - checksum: cc8438a6749f62fb501d022fae0e3af3ac4a9983f889f929c8721b328a1c3408b98ca218aad886785a02be2c34bd75eb1a5a2608bd1fcee3c8c099391ff53a11 + has-flag: ^4.0.0 + checksum: c052193a7e43c6cdc741eb7f378df605636e01ad434badf7324f17fb60c69a880d8d8fcdcb562cf94c2350e57b937d7425ab5b8326c67c2adc48f7c87c1db406 languageName: node linkType: hard -"sync-rpc@npm:^1.2.1": - version: 1.3.6 - resolution: "sync-rpc@npm:1.3.6" - dependencies: - get-port: ^3.1.0 - checksum: 4340974fb5641c2cadb9df18d6b791ed2327f28cf6d8a00c99ebc2278e37391e3f5e237596da2ff83d14d2147594c6f5b3b98a93b9327644db425d239dea172f +"supports-preserve-symlinks-flag@npm:^1.0.0": + version: 1.0.0 + resolution: "supports-preserve-symlinks-flag@npm:1.0.0" + checksum: 53b1e247e68e05db7b3808b99b892bd36fb096e6fba213a06da7fab22045e97597db425c724f2bbd6c99a3c295e1e73f3e4de78592289f38431049e1277ca0ae languageName: node linkType: hard @@ -15674,53 +11819,27 @@ __metadata: linkType: hard "table@npm:^6.8.0, table@npm:^6.8.1": - version: 6.8.2 - resolution: "table@npm:6.8.2" + version: 6.9.0 + resolution: "table@npm:6.9.0" dependencies: ajv: ^8.0.1 lodash.truncate: ^4.4.2 slice-ansi: ^4.0.0 string-width: ^4.2.3 strip-ansi: ^6.0.1 - checksum: 61188652f53a980d1759ca460ca8dea5c5322aece3210457e7084882f053c2b6a870041295e08a82cb1d676e31b056406845d94b0abf3c79a4b104777bec413b - languageName: node - linkType: hard - -"tape@npm:^4.6.3": - version: 4.17.0 - resolution: "tape@npm:4.17.0" - dependencies: - "@ljharb/resumer": ~0.0.1 - "@ljharb/through": ~2.3.9 - call-bind: ~1.0.2 - deep-equal: ~1.1.1 - defined: ~1.0.1 - dotignore: ~0.1.2 - for-each: ~0.3.3 - glob: ~7.2.3 - has: ~1.0.3 - inherits: ~2.0.4 - is-regex: ~1.1.4 - minimist: ~1.2.8 - mock-property: ~1.0.0 - object-inspect: ~1.12.3 - resolve: ~1.22.6 - string.prototype.trim: ~1.2.8 - bin: - tape: bin/tape - checksum: b785f4997f4323d9a1b6f5bda97aaea65a4c68f81296ab46bd126776f3c6f4203073187d5a4bcaa98884bf28e3cfaa50c2d8d81cc0025e4777054455837390dc + checksum: f54a7d1c11cda8c676e1e9aff5e723646905ed4579cca14b3ce12d2b12eac3e18f5dbe2549fe0b79697164858e18961145db4dd0660bbeb0fb4032af0aaf32b4 languageName: node linkType: hard "tar-fs@npm:~1.16.3": - version: 1.16.3 - resolution: "tar-fs@npm:1.16.3" + version: 1.16.4 + resolution: "tar-fs@npm:1.16.4" dependencies: chownr: ^1.0.1 mkdirp: ^0.5.1 pump: ^1.0.0 tar-stream: ^1.1.2 - checksum: 0c78aa173cde0df44e5fbbd85077240b8340444bff5ec026539e9e20806ca31b5d4b8cee58befe5c1dae7fa47cd1bb3f9a0efebf2212c2bfbad31f23de329c79 + checksum: fd8983552ff1d384f6e424f39dcd9c346847bf2bb5206b944dff4ff8d3b7540d4f26fd38f50c59ac50f93cc76ad6d8e00d83733f22be086664dce9d979123d9c languageName: node linkType: hard @@ -15739,49 +11858,17 @@ __metadata: languageName: node linkType: hard -"tar@npm:^4.0.2": - version: 4.4.19 - resolution: "tar@npm:4.4.19" - dependencies: - chownr: ^1.1.4 - fs-minipass: ^1.2.7 - minipass: ^2.9.0 - minizlib: ^1.3.3 - mkdirp: ^0.5.5 - safe-buffer: ^5.2.1 - yallist: ^3.1.1 - checksum: 423c8259b17f8f612cef9c96805d65f90ba9a28e19be582cd9d0fcb217038219f29b7547198e8fd617da5f436376d6a74b99827acd1238d2f49cf62330f9664e - languageName: node - linkType: hard - -"tar@npm:^6.1.11, tar@npm:^6.1.2": - version: 6.2.1 - resolution: "tar@npm:6.2.1" - dependencies: - chownr: ^2.0.0 - fs-minipass: ^2.0.0 - minipass: ^5.0.0 - minizlib: ^2.1.1 - mkdirp: ^1.0.3 - yallist: ^4.0.0 - checksum: f1322768c9741a25356c11373bce918483f40fa9a25c69c59410c8a1247632487edef5fe76c5f12ac51a6356d2f1829e96d2bc34098668a2fc34d76050ac2b6c - languageName: node - linkType: hard - -"test-value@npm:^2.1.0": - version: 2.1.0 - resolution: "test-value@npm:2.1.0" +"tar@npm:^7.4.3": + version: 7.4.3 + resolution: "tar@npm:7.4.3" dependencies: - array-back: ^1.0.3 - typical: ^2.6.0 - checksum: ce41ef4100c9ac84630e78d1ca06706714587faf255e44296ace1fc7bf5b888c160b8c0229d31467252a3b2b57197965194391f6ee0c54f33e0b8e3af3a33a0c - languageName: node - linkType: hard - -"testrpc@npm:0.0.1": - version: 0.0.1 - resolution: "testrpc@npm:0.0.1" - checksum: e27778552df2d0b938b062fdf41d44557f0eb3de75903cb90b87909f55a82a6345dd13e40d1498e718272b4e5225872dca66da73646c35df1031486bb0ed0fda + "@isaacs/fs-minipass": ^4.0.0 + chownr: ^3.0.0 + minipass: ^7.1.2 + minizlib: ^3.0.1 + mkdirp: ^3.0.1 + yallist: ^5.0.0 + checksum: 8485350c0688331c94493031f417df069b778aadb25598abdad51862e007c39d1dd5310702c7be4a6784731a174799d8885d2fde0484269aea205b724d7b2ffa languageName: node linkType: hard @@ -15792,35 +11879,6 @@ __metadata: languageName: node linkType: hard -"then-request@npm:^6.0.0": - version: 6.0.2 - resolution: "then-request@npm:6.0.2" - dependencies: - "@types/concat-stream": ^1.6.0 - "@types/form-data": 0.0.33 - "@types/node": ^8.0.0 - "@types/qs": ^6.2.31 - caseless: ~0.12.0 - concat-stream: ^1.6.0 - form-data: ^2.2.0 - http-basic: ^8.1.1 - http-response-object: ^3.0.1 - promise: ^8.0.0 - qs: ^6.4.0 - checksum: a24a4fc95dd8591966bf3752f024f5cd4d53c2b2c29b23b4e40c3322df6a432d939bc17b589d8e9d760b90e92ab860f6f361a4dfcfe3542019e1615fb51afccc - languageName: node - linkType: hard - -"through2@npm:^2.0.3": - version: 2.0.5 - resolution: "through2@npm:2.0.5" - dependencies: - readable-stream: ~2.3.6 - xtend: ~4.0.1 - checksum: beb0f338aa2931e5660ec7bf3ad949e6d2e068c31f4737b9525e5201b824ac40cac6a337224856b56bd1ddd866334bbfb92a9f57cd6f66bc3f18d3d86fc0fe50 - languageName: node - linkType: hard - "through@npm:>=2.2.7 <3, through@npm:^2.3.6": version: 2.3.8 resolution: "through@npm:2.3.8" @@ -15828,13 +11886,6 @@ __metadata: languageName: node linkType: hard -"timed-out@npm:^4.0.1": - version: 4.0.1 - resolution: "timed-out@npm:4.0.1" - checksum: 98efc5d6fc0d2a329277bd4d34f65c1bf44d9ca2b14fd267495df92898f522e6f563c5e9e467c418e0836f5ca1f47a84ca3ee1de79b1cc6fe433834b7f02ec54 - languageName: node - linkType: hard - "timeout-abort-controller@npm:^2.0.0": version: 2.0.0 resolution: "timeout-abort-controller@npm:2.0.0" @@ -15846,6 +11897,16 @@ __metadata: languageName: node linkType: hard +"tinyglobby@npm:^0.2.12, tinyglobby@npm:^0.2.6": + version: 0.2.13 + resolution: "tinyglobby@npm:0.2.13" + dependencies: + fdir: ^6.4.4 + picomatch: ^4.0.2 + checksum: 3a2e87a2518cb3616057b0aa58be4f17771ae78c6890556516ae1e631f8ce4cfee1ba1dcb62fcc54a64e2bdd6c3104f4f3d021e1a3e3f8fb0875bca380b913e5 + languageName: node + linkType: hard + "tmp-promise@npm:^3.0.2": version: 3.0.3 resolution: "tmp-promise@npm:3.0.3" @@ -15864,15 +11925,6 @@ __metadata: languageName: node linkType: hard -"tmp@npm:0.1.0": - version: 0.1.0 - resolution: "tmp@npm:0.1.0" - dependencies: - rimraf: ^2.6.3 - checksum: 6bab8431de9d245d4264bd8cd6bb216f9d22f179f935dada92a11d1315572c8eb7c3334201e00594b4708608bd536fad3a63bfb037e7804d827d66aa53a1afcd - languageName: node - linkType: hard - "tmp@npm:^0.2.0": version: 0.2.3 resolution: "tmp@npm:0.2.3" @@ -15887,39 +11939,6 @@ __metadata: languageName: node linkType: hard -"to-fast-properties@npm:^1.0.3": - version: 1.0.3 - resolution: "to-fast-properties@npm:1.0.3" - checksum: bd0abb58c4722851df63419de3f6d901d5118f0440d3f71293ed776dd363f2657edaaf2dc470e3f6b7b48eb84aa411193b60db8a4a552adac30de9516c5cc580 - languageName: node - linkType: hard - -"to-object-path@npm:^0.3.0": - version: 0.3.0 - resolution: "to-object-path@npm:0.3.0" - dependencies: - kind-of: ^3.0.2 - checksum: 9425effee5b43e61d720940fa2b889623f77473d459c2ce3d4a580a4405df4403eec7be6b857455908070566352f9e2417304641ed158dda6f6a365fe3e66d70 - languageName: node - linkType: hard - -"to-readable-stream@npm:^1.0.0": - version: 1.0.0 - resolution: "to-readable-stream@npm:1.0.0" - checksum: 2bd7778490b6214a2c40276065dd88949f4cf7037ce3964c76838b8cb212893aeb9cceaaf4352a4c486e3336214c350270f3263e1ce7a0c38863a715a4d9aeb5 - languageName: node - linkType: hard - -"to-regex-range@npm:^2.1.0": - version: 2.1.1 - resolution: "to-regex-range@npm:2.1.1" - dependencies: - is-number: ^3.0.0 - repeat-string: ^1.6.1 - checksum: 46093cc14be2da905cc931e442d280b2e544e2bfdb9a24b3cf821be8d342f804785e5736c108d5be026021a05d7b38144980a61917eee3c88de0a5e710e10320 - languageName: node - linkType: hard - "to-regex-range@npm:^5.0.1": version: 5.0.1 resolution: "to-regex-range@npm:5.0.1" @@ -15929,18 +11948,6 @@ __metadata: languageName: node linkType: hard -"to-regex@npm:^3.0.1, to-regex@npm:^3.0.2": - version: 3.0.2 - resolution: "to-regex@npm:3.0.2" - dependencies: - define-property: ^2.0.2 - extend-shallow: ^3.0.2 - regex-not: ^1.0.2 - safe-regex: ^1.1.0 - checksum: 4ed4a619059b64e204aad84e4e5f3ea82d97410988bcece7cf6cbfdbf193d11bff48cf53842d88b8bb00b1bfc0d048f61f20f0709e6f393fd8fe0122662d9db4 - languageName: node - linkType: hard - "toidentifier@npm:1.0.1": version: 1.0.1 resolution: "toidentifier@npm:1.0.1" @@ -15978,13 +11985,6 @@ __metadata: languageName: node linkType: hard -"trim-right@npm:^1.0.1": - version: 1.0.1 - resolution: "trim-right@npm:1.0.1" - checksum: 9120af534e006a7424a4f9358710e6e707887b6ccf7ea69e50d6ac6464db1fe22268400def01752f09769025d480395159778153fb98d4a2f6f40d4cf5d4f3b6 - languageName: node - linkType: hard - "ts-command-line-args@npm:^2.2.0": version: 2.5.1 resolution: "ts-command-line-args@npm:2.5.1" @@ -15999,22 +11999,6 @@ __metadata: languageName: node linkType: hard -"ts-essentials@npm:^1.0.0": - version: 1.0.4 - resolution: "ts-essentials@npm:1.0.4" - checksum: 2e19bbe51203707ca732dcc6c3f238b2cf22bb9213d26ae0246c02325fb3e5f17c32505ac79c1bd538b7951a798155b07422e263a95cb295070a48233e45a1b5 - languageName: node - linkType: hard - -"ts-essentials@npm:^6.0.3": - version: 6.0.7 - resolution: "ts-essentials@npm:6.0.7" - peerDependencies: - typescript: ">=3.7.0" - checksum: b47a1793df9ea997d50d2cc9155433952b189cfca0c534a6f3f3dce6aa782a37574d2179dee6d55ed918835aa17addda49619ff2bd2eb3e60e331db3ce30a79b - languageName: node - linkType: hard - "ts-essentials@npm:^7.0.1": version: 7.0.3 resolution: "ts-essentials@npm:7.0.3" @@ -16024,25 +12008,6 @@ __metadata: languageName: node linkType: hard -"ts-generator@npm:^0.1.1": - version: 0.1.1 - resolution: "ts-generator@npm:0.1.1" - dependencies: - "@types/mkdirp": ^0.5.2 - "@types/prettier": ^2.1.1 - "@types/resolve": ^0.0.8 - chalk: ^2.4.1 - glob: ^7.1.2 - mkdirp: ^0.5.1 - prettier: ^2.1.2 - resolve: ^1.8.1 - ts-essentials: ^1.0.0 - bin: - ts-generator: dist/cli/run.js - checksum: 3add2e76afd7a4d9d9aee1ff26477ee4e8b4cc740b35787f9ea780c11aefc88e6c7833837eacc12b944c1883680639dc9cc47fe173eff95c62112f3a41132146 - languageName: node - linkType: hard - "ts-node@npm:^10.9.1": version: 10.9.2 resolution: "ts-node@npm:10.9.2" @@ -16093,10 +12058,10 @@ __metadata: languageName: node linkType: hard -"tslib@npm:2.4.0": - version: 2.4.0 - resolution: "tslib@npm:2.4.0" - checksum: 8c4aa6a3c5a754bf76aefc38026134180c053b7bd2f81338cb5e5ebf96fefa0f417bff221592bf801077f5bf990562f6264fecbc42cd3309b33872cb6fc3b113 +"tslib@npm:2.7.0": + version: 2.7.0 + resolution: "tslib@npm:2.7.0" + checksum: 1606d5c89f88d466889def78653f3aab0f88692e80bb2066d090ca6112ae250ec1cfa9dbfaab0d17b60da15a4186e8ec4d893801c67896b277c17374e36e1d28 languageName: node linkType: hard @@ -16107,10 +12072,10 @@ __metadata: languageName: node linkType: hard -"tslib@npm:^2.1.0, tslib@npm:^2.3.1, tslib@npm:^2.6.2": - version: 2.6.3 - resolution: "tslib@npm:2.6.3" - checksum: 74fce0e100f1ebd95b8995fbbd0e6c91bdd8f4c35c00d4da62e285a3363aaa534de40a80db30ecfd388ed7c313c42d930ee0eaf108e8114214b180eec3dbe6f5 +"tslib@npm:^2.3.1, tslib@npm:^2.6.2": + version: 2.8.1 + resolution: "tslib@npm:2.8.1" + checksum: e4aba30e632b8c8902b47587fd13345e2827fa639e7c3121074d5ee0880723282411a8838f830b55100cbe4517672f84a2472667d355b81e8af165a55dc6203a languageName: node linkType: hard @@ -16141,13 +12106,6 @@ __metadata: languageName: node linkType: hard -"tweetnacl-util@npm:^0.15.0, tweetnacl-util@npm:^0.15.1": - version: 0.15.1 - resolution: "tweetnacl-util@npm:0.15.1" - checksum: ae6aa8a52cdd21a95103a4cc10657d6a2040b36c7a6da7b9d3ab811c6750a2d5db77e8c36969e75fdee11f511aa2b91c552496c6e8e989b6e490e54aca2864fc - languageName: node - linkType: hard - "tweetnacl@npm:^0.14.3, tweetnacl@npm:~0.14.0": version: 0.14.5 resolution: "tweetnacl@npm:0.14.5" @@ -16155,13 +12113,6 @@ __metadata: languageName: node linkType: hard -"tweetnacl@npm:^1.0.0, tweetnacl@npm:^1.0.3": - version: 1.0.3 - resolution: "tweetnacl@npm:1.0.3" - checksum: e4a57cac188f0c53f24c7a33279e223618a2bfb5fea426231991652a13247bea06b081fd745d71291fcae0f4428d29beba1b984b1f1ce6f66b06a6d1ab90645c - languageName: node - linkType: hard - "type-check@npm:^0.4.0, type-check@npm:~0.4.0": version: 0.4.0 resolution: "type-check@npm:0.4.0" @@ -16180,10 +12131,10 @@ __metadata: languageName: node linkType: hard -"type-detect@npm:^4.0.0, type-detect@npm:^4.0.8": - version: 4.0.8 - resolution: "type-detect@npm:4.0.8" - checksum: 62b5628bff67c0eb0b66afa371bd73e230399a8d2ad30d852716efcc4656a7516904570cd8631a49a3ce57c10225adf5d0cbdcb47f6b0255fe6557c453925a15 +"type-detect@npm:^4.0.0, type-detect@npm:^4.1.0": + version: 4.1.0 + resolution: "type-detect@npm:4.1.0" + checksum: 3b32f873cd02bc7001b00a61502b7ddc4b49278aabe68d652f732e1b5d768c072de0bc734b427abf59d0520a5f19a2e07309ab921ef02018fa1cb4af155cdb37 languageName: node linkType: hard @@ -16215,40 +12166,6 @@ __metadata: languageName: node linkType: hard -"type-is@npm:~1.6.18": - version: 1.6.18 - resolution: "type-is@npm:1.6.18" - dependencies: - media-typer: 0.3.0 - mime-types: ~2.1.24 - checksum: 2c8e47675d55f8b4e404bcf529abdf5036c537a04c2b20177bcf78c9e3c1da69da3942b1346e6edb09e823228c0ee656ef0e033765ec39a70d496ef601a0c657 - languageName: node - linkType: hard - -"type@npm:^2.7.2": - version: 2.7.3 - resolution: "type@npm:2.7.3" - checksum: 69cfda3248847998f93b9d292fd251c10facf8d29513e2047d4684509d67bae82d910d7a00c1e9d9bbf2af242d36425b6616807d6c652c5c370c2be1f0008a47 - languageName: node - linkType: hard - -"typechain@npm:^3.0.0": - version: 3.0.0 - resolution: "typechain@npm:3.0.0" - dependencies: - command-line-args: ^4.0.7 - debug: ^4.1.1 - fs-extra: ^7.0.0 - js-sha3: ^0.8.0 - lodash: ^4.17.15 - ts-essentials: ^6.0.3 - ts-generator: ^0.1.1 - bin: - typechain: ./dist/cli/cli.js - checksum: a38aff5e89c41e20e2c3a1f7b5f04666dbc94b5592eba70ba7d1e0aeb49089d22ed3d35e55a0b0d1f0bfdcea9818157fa4ee3854ef818f46f6aa899520fe7c25 - languageName: node - linkType: hard - "typechain@npm:^8.0.0, typechain@npm:^8.1.0": version: 8.3.2 resolution: "typechain@npm:8.3.2" @@ -16271,64 +12188,56 @@ __metadata: languageName: node linkType: hard -"typed-array-buffer@npm:^1.0.2": - version: 1.0.2 - resolution: "typed-array-buffer@npm:1.0.2" +"typed-array-buffer@npm:^1.0.3": + version: 1.0.3 + resolution: "typed-array-buffer@npm:1.0.3" dependencies: - call-bind: ^1.0.7 + call-bound: ^1.0.3 es-errors: ^1.3.0 - is-typed-array: ^1.1.13 - checksum: 02ffc185d29c6df07968272b15d5319a1610817916ec8d4cd670ded5d1efe72901541ff2202fcc622730d8a549c76e198a2f74e312eabbfb712ed907d45cbb0b + is-typed-array: ^1.1.14 + checksum: 3fb91f0735fb413b2bbaaca9fabe7b8fc14a3fa5a5a7546bab8a57e755be0e3788d893195ad9c2b842620592de0e68d4c077d4c2c41f04ec25b8b5bb82fa9a80 languageName: node linkType: hard -"typed-array-byte-length@npm:^1.0.1": - version: 1.0.1 - resolution: "typed-array-byte-length@npm:1.0.1" +"typed-array-byte-length@npm:^1.0.3": + version: 1.0.3 + resolution: "typed-array-byte-length@npm:1.0.3" dependencies: - call-bind: ^1.0.7 + call-bind: ^1.0.8 for-each: ^0.3.3 - gopd: ^1.0.1 - has-proto: ^1.0.3 - is-typed-array: ^1.1.13 - checksum: f65e5ecd1cf76b1a2d0d6f631f3ea3cdb5e08da106c6703ffe687d583e49954d570cc80434816d3746e18be889ffe53c58bf3e538081ea4077c26a41055b216d + gopd: ^1.2.0 + has-proto: ^1.2.0 + is-typed-array: ^1.1.14 + checksum: cda9352178ebeab073ad6499b03e938ebc30c4efaea63a26839d89c4b1da9d2640b0d937fc2bd1f049eb0a38def6fbe8a061b601292ae62fe079a410ce56e3a6 languageName: node linkType: hard -"typed-array-byte-offset@npm:^1.0.2": - version: 1.0.2 - resolution: "typed-array-byte-offset@npm:1.0.2" +"typed-array-byte-offset@npm:^1.0.4": + version: 1.0.4 + resolution: "typed-array-byte-offset@npm:1.0.4" dependencies: available-typed-arrays: ^1.0.7 - call-bind: ^1.0.7 + call-bind: ^1.0.8 for-each: ^0.3.3 - gopd: ^1.0.1 - has-proto: ^1.0.3 - is-typed-array: ^1.1.13 - checksum: c8645c8794a621a0adcc142e0e2c57b1823bbfa4d590ad2c76b266aa3823895cf7afb9a893bf6685e18454ab1b0241e1a8d885a2d1340948efa4b56add4b5f67 + gopd: ^1.2.0 + has-proto: ^1.2.0 + is-typed-array: ^1.1.15 + reflect.getprototypeof: ^1.0.9 + checksum: 670b7e6bb1d3c2cf6160f27f9f529e60c3f6f9611c67e47ca70ca5cfa24ad95415694c49d1dbfeda016d3372cab7dfc9e38c7b3e1bb8d692cae13a63d3c144d7 languageName: node linkType: hard -"typed-array-length@npm:^1.0.6": - version: 1.0.6 - resolution: "typed-array-length@npm:1.0.6" +"typed-array-length@npm:^1.0.7": + version: 1.0.7 + resolution: "typed-array-length@npm:1.0.7" dependencies: call-bind: ^1.0.7 for-each: ^0.3.3 gopd: ^1.0.1 - has-proto: ^1.0.3 is-typed-array: ^1.1.13 possible-typed-array-names: ^1.0.0 - checksum: f0315e5b8f0168c29d390ff410ad13e4d511c78e6006df4a104576844812ee447fcc32daab1f3a76c9ef4f64eff808e134528b5b2439de335586b392e9750e5c - languageName: node - linkType: hard - -"typedarray-to-buffer@npm:^3.1.5": - version: 3.1.5 - resolution: "typedarray-to-buffer@npm:3.1.5" - dependencies: - is-typedarray: ^1.0.0 - checksum: 99c11aaa8f45189fcfba6b8a4825fd684a321caa9bd7a76a27cf0c7732c174d198b99f449c52c3818107430b5f41c0ccbbfb75cb2ee3ca4a9451710986d61a60 + reflect.getprototypeof: ^1.0.6 + checksum: deb1a4ffdb27cd930b02c7030cb3e8e0993084c643208e52696e18ea6dd3953dfc37b939df06ff78170423d353dc8b10d5bae5796f3711c1b3abe52872b3774c languageName: node linkType: hard @@ -16379,36 +12288,6 @@ __metadata: languageName: node linkType: hard -"typewise-core@npm:^1.2, typewise-core@npm:^1.2.0": - version: 1.2.0 - resolution: "typewise-core@npm:1.2.0" - checksum: c21e83544546d1aba2f17377c25ae0eb571c2153b2e3705932515bef103dbe43e05d2286f238ad139341b1000da40583115a44cb5e69a2ef408572b13dab844b - languageName: node - linkType: hard - -"typewise@npm:^1.0.3": - version: 1.0.3 - resolution: "typewise@npm:1.0.3" - dependencies: - typewise-core: ^1.2.0 - checksum: eb3452b1387df8bf8e3b620720d240425a50ce402d7c064c21ac4b5d88c551ee4d1f26cd649b8a17a6d06f7a3675733de841723f8e06bb3edabfeacc4924af4a - languageName: node - linkType: hard - -"typewiselite@npm:~1.0.0": - version: 1.0.0 - resolution: "typewiselite@npm:1.0.0" - checksum: 2e13a652c041680e9e37501129715f97c2ff2b8f52b5e82acd9355c070ca7c126633ff96d2ad03945254c271c0d1cf9f4956090c93ad750717e00d100cbd0c87 - languageName: node - linkType: hard - -"typical@npm:^2.6.0, typical@npm:^2.6.1": - version: 2.6.1 - resolution: "typical@npm:2.6.1" - checksum: 6af04fefe50d90d3471f058b2cdc0f49b7436bdd605cd00acea7965926ff388a5a7d692ef144f45fccee6f8e896c065702ecc44b69057e2ce88c09e897c7d3a4 - languageName: node - linkType: hard - "typical@npm:^4.0.0": version: 4.0.0 resolution: "typical@npm:4.0.0" @@ -16424,11 +12303,11 @@ __metadata: linkType: hard "uglify-js@npm:^3.1.4": - version: 3.18.0 - resolution: "uglify-js@npm:3.18.0" + version: 3.19.3 + resolution: "uglify-js@npm:3.19.3" bin: uglifyjs: bin/uglifyjs - checksum: 887733d05d4139a94dffd04a5f07ee7d8be70201c016ea48cb82703778b5c48fadbe6e5e7ac956425522f72e657d3eade23f06ae8a0e2eeed2d684bf6cc25e36 + checksum: 7ed6272fba562eb6a3149cfd13cda662f115847865c03099e3995a0e7a910eba37b82d4fccf9e88271bb2bcbe505bb374967450f433c17fa27aa36d94a8d0553 languageName: node linkType: hard @@ -16441,29 +12320,15 @@ __metadata: languageName: node linkType: hard -"ultron@npm:~1.1.0": - version: 1.1.1 - resolution: "ultron@npm:1.1.1" - checksum: aa7b5ebb1b6e33287b9d873c6756c4b7aa6d1b23d7162ff25b0c0ce5c3c7e26e2ab141a5dc6e96c10ac4d00a372e682ce298d784f06ffcd520936590b4bc0653 - languageName: node - linkType: hard - -"unbox-primitive@npm:^1.0.2": - version: 1.0.2 - resolution: "unbox-primitive@npm:1.0.2" +"unbox-primitive@npm:^1.1.0": + version: 1.1.0 + resolution: "unbox-primitive@npm:1.1.0" dependencies: - call-bind: ^1.0.2 + call-bound: ^1.0.3 has-bigints: ^1.0.2 - has-symbols: ^1.0.3 - which-boxed-primitive: ^1.0.2 - checksum: b7a1cf5862b5e4b5deb091672ffa579aa274f648410009c81cca63fed3b62b610c4f3b773f912ce545bb4e31edc3138975b5bc777fc6e4817dca51affb6380e9 - languageName: node - linkType: hard - -"underscore@npm:1.9.1": - version: 1.9.1 - resolution: "underscore@npm:1.9.1" - checksum: bee6f587661a6a9ca2f77e611896141e0287af51d8ca6034b11d0d4163ddbdd181a9720078ddbe94d265b7694f4880bc7f4c2ad260cfb8985ee2f9adcf13df03 + has-symbols: ^1.1.0 + which-boxed-primitive: ^1.1.1 + checksum: 729f13b84a5bfa3fead1d8139cee5c38514e63a8d6a437819a473e241ba87eeb593646568621c7fc7f133db300ef18d65d1a5a60dc9c7beb9000364d93c581df languageName: node linkType: hard @@ -16474,19 +12339,33 @@ __metadata: languageName: node linkType: hard +"undici-types@npm:~6.19.2": + version: 6.19.8 + resolution: "undici-types@npm:6.19.8" + checksum: de51f1b447d22571cf155dfe14ff6d12c5bdaec237c765085b439c38ca8518fc360e88c70f99469162bf2e14188a7b0bcb06e1ed2dc031042b984b0bb9544017 + languageName: node + linkType: hard + +"undici-types@npm:~6.21.0": + version: 6.21.0 + resolution: "undici-types@npm:6.21.0" + checksum: 46331c7d6016bf85b3e8f20c159d62f5ae471aba1eb3dc52fff35a0259d58dcc7d592d4cc4f00c5f9243fa738a11cfa48bd20203040d4a9e6bc25e807fab7ab3 + languageName: node + linkType: hard + "undici@npm:^5.14.0": - version: 5.28.4 - resolution: "undici@npm:5.28.4" + version: 5.29.0 + resolution: "undici@npm:5.29.0" dependencies: "@fastify/busboy": ^2.0.0 - checksum: a8193132d84540e4dc1895ecc8dbaa176e8a49d26084d6fbe48a292e28397cd19ec5d13bc13e604484e76f94f6e334b2bdc740d5f06a6e50c44072818d0c19f9 + checksum: a25b5462c1b6ffb974f5ffc492ffd64146a9983aad0cbda6fde65e2b22f6f1acd43f09beacc66cc47624a113bd0c684ffc60366102b6a21b038fbfafb7d75195 languageName: node linkType: hard "undici@npm:^6.11.1": - version: 6.19.2 - resolution: "undici@npm:6.19.2" - checksum: 024ff60791bef86646730dc0f240e8a643219d18c6070d7e067d4f7fd311cea85b485b79ebeabff2bb60f4a7ca18fa7ae37da1cc008b23e7b6f17b289c728771 + version: 6.21.2 + resolution: "undici@npm:6.21.2" + checksum: 4d7227910bfee0703ea5c5c9d4343bcb2a80d2ce2eb64698b6fb8cc48852e29f7c7c623126161a5073fd594c9040ae7e7ecc8e093fe6e84a9394dd2595754ec5 languageName: node linkType: hard @@ -16497,33 +12376,21 @@ __metadata: languageName: node linkType: hard -"union-value@npm:^1.0.0": - version: 1.0.1 - resolution: "union-value@npm:1.0.1" - dependencies: - arr-union: ^3.1.0 - get-value: ^2.0.6 - is-extendable: ^0.1.1 - set-value: ^2.0.1 - checksum: a3464097d3f27f6aa90cf103ed9387541bccfc006517559381a10e0dffa62f465a9d9a09c9b9c3d26d0f4cbe61d4d010e2fbd710fd4bf1267a768ba8a774b0ba - languageName: node - linkType: hard - -"unique-filename@npm:^3.0.0": - version: 3.0.0 - resolution: "unique-filename@npm:3.0.0" +"unique-filename@npm:^4.0.0": + version: 4.0.0 + resolution: "unique-filename@npm:4.0.0" dependencies: - unique-slug: ^4.0.0 - checksum: 8e2f59b356cb2e54aab14ff98a51ac6c45781d15ceaab6d4f1c2228b780193dc70fae4463ce9e1df4479cb9d3304d7c2043a3fb905bdeca71cc7e8ce27e063df + unique-slug: ^5.0.0 + checksum: 6a62094fcac286b9ec39edbd1f8f64ff92383baa430af303dfed1ffda5e47a08a6b316408554abfddd9730c78b6106bef4ca4d02c1231a735ddd56ced77573df languageName: node linkType: hard -"unique-slug@npm:^4.0.0": - version: 4.0.0 - resolution: "unique-slug@npm:4.0.0" +"unique-slug@npm:^5.0.0": + version: 5.0.0 + resolution: "unique-slug@npm:5.0.0" dependencies: imurmurhash: ^0.1.4 - checksum: 0884b58365af59f89739e6f71e3feacb5b1b41f2df2d842d0757933620e6de08eff347d27e9d499b43c40476cbaf7988638d3acb2ffbcb9d35fd035591adfd15 + checksum: 222d0322bc7bbf6e45c08967863212398313ef73423f4125e075f893a02405a5ffdbaaf150f7dd1e99f8861348a486dd079186d27c5f2c60e465b7dcbb1d3e5b languageName: node linkType: hard @@ -16541,76 +12408,29 @@ __metadata: languageName: node linkType: hard -"unorm@npm:^1.3.3": - version: 1.6.0 - resolution: "unorm@npm:1.6.0" - checksum: 9a86546256a45f855b6cfe719086785d6aada94f63778cecdecece8d814ac26af76cb6da70130da0a08b8803bbf0986e56c7ec4249038198f3de02607fffd811 - languageName: node - linkType: hard - -"unpipe@npm:1.0.0, unpipe@npm:~1.0.0": +"unpipe@npm:1.0.0": version: 1.0.0 resolution: "unpipe@npm:1.0.0" checksum: 4fa18d8d8d977c55cb09715385c203197105e10a6d220087ec819f50cb68870f02942244f1017565484237f1f8c5d3cd413631b1ae104d3096f24fdfde1b4aa2 languageName: node linkType: hard -"unset-value@npm:^1.0.0": - version: 1.0.0 - resolution: "unset-value@npm:1.0.0" - dependencies: - has-value: ^0.3.1 - isobject: ^3.0.0 - checksum: 5990ecf660672be2781fc9fb322543c4aa592b68ed9a3312fa4df0e9ba709d42e823af090fc8f95775b4cd2c9a5169f7388f0cec39238b6d0d55a69fc2ab6b29 - languageName: node - linkType: hard - -"uri-js@npm:^4.2.2, uri-js@npm:^4.4.1": - version: 4.4.1 - resolution: "uri-js@npm:4.4.1" - dependencies: - punycode: ^2.1.0 - checksum: 7167432de6817fe8e9e0c9684f1d2de2bb688c94388f7569f7dbdb1587c9f4ca2a77962f134ec90be0cc4d004c939ff0d05acc9f34a0db39a3c797dada262633 - languageName: node - linkType: hard - -"urix@npm:^0.1.0": - version: 0.1.0 - resolution: "urix@npm:0.1.0" - checksum: 4c076ecfbf3411e888547fe844e52378ab5ada2d2f27625139011eada79925e77f7fbf0e4016d45e6a9e9adb6b7e64981bd49b22700c7c401c5fc15f423303b3 - languageName: node - linkType: hard - -"url-parse-lax@npm:^3.0.0": - version: 3.0.0 - resolution: "url-parse-lax@npm:3.0.0" - dependencies: - prepend-http: ^2.0.0 - checksum: 1040e357750451173132228036aff1fd04abbd43eac1fb3e4fca7495a078bcb8d33cb765fe71ad7e473d9c94d98fd67adca63bd2716c815a2da066198dd37217 - languageName: node - linkType: hard - -"url-set-query@npm:^1.0.0": - version: 1.0.0 - resolution: "url-set-query@npm:1.0.0" - checksum: 5ad73525e8f3ab55c6bf3ddc70a43912e65ff9ce655d7868fdcefdf79f509cfdddde4b07150797f76186f1a47c0ecd2b7bb3687df8f84757dee4110cf006e12d +"uri-js@npm:^4.2.2": + version: 4.4.1 + resolution: "uri-js@npm:4.4.1" + dependencies: + punycode: ^2.1.0 + checksum: 7167432de6817fe8e9e0c9684f1d2de2bb688c94388f7569f7dbdb1587c9f4ca2a77962f134ec90be0cc4d004c939ff0d05acc9f34a0db39a3c797dada262633 languageName: node linkType: hard "url@npm:^0.11.0": - version: 0.11.3 - resolution: "url@npm:0.11.3" + version: 0.11.4 + resolution: "url@npm:0.11.4" dependencies: punycode: ^1.4.1 - qs: ^6.11.2 - checksum: f9e7886f46a16f96d2e42fbcc5d682c231c55ef5442c1ff66150c0f6556f6e3a97d094a84f51be15ec2432711d212eb60426659ce418f5fcadeaa3f601532c4e - languageName: node - linkType: hard - -"use@npm:^3.1.0": - version: 3.1.1 - resolution: "use@npm:3.1.1" - checksum: 08a130289f5238fcbf8f59a18951286a6e660d17acccc9d58d9b69dfa0ee19aa038e8f95721b00b432c36d1629a9e32a464bf2e7e0ae6a244c42ddb30bdd8b33 + qs: ^6.12.3 + checksum: c25e587723d343d5d4248892393bfa5039ded9c2c07095a9d005bc64b7cb8956d623c0d8da8d1a28f71986a7a8d80fc2e9f9cf84235e48fa435a5cb4451062c6 languageName: node linkType: hard @@ -16624,17 +12444,7 @@ __metadata: languageName: node linkType: hard -"utf-8-validate@npm:^5.0.2": - version: 5.0.10 - resolution: "utf-8-validate@npm:5.0.10" - dependencies: - node-gyp: latest - node-gyp-build: ^4.3.0 - checksum: 5579350a023c66a2326752b6c8804cc7b39dcd251bb088241da38db994b8d78352e388dcc24ad398ab98385ba3c5ffcadb6b5b14b2637e43f767869055e46ba6 - languageName: node - linkType: hard - -"utf8@npm:3.0.0, utf8@npm:^3.0.0": +"utf8@npm:3.0.0": version: 3.0.0 resolution: "utf8@npm:3.0.0" checksum: cb89a69ad9ab393e3eae9b25305b3ff08bebca9adc839191a34f90777eb2942f86a96369d2839925fea58f8f722f7e27031d697f10f5f39690f8c5047303e62d @@ -16648,37 +12458,6 @@ __metadata: languageName: node linkType: hard -"util.promisify@npm:^1.0.0": - version: 1.1.2 - resolution: "util.promisify@npm:1.1.2" - dependencies: - call-bind: ^1.0.2 - define-properties: ^1.2.0 - for-each: ^0.3.3 - has-proto: ^1.0.1 - has-symbols: ^1.0.3 - object.getownpropertydescriptors: ^2.1.6 - safe-array-concat: ^1.0.0 - checksum: 9a5233e7fd067ca24abe2310f9c93e6df3adb644a662fcd826454d30539d3dd1d557b75bfed4cedd4993203012ea6add6d7dd268fed35bbdac4736dce9446373 - languageName: node - linkType: hard - -"utils-merge@npm:1.0.1": - version: 1.0.1 - resolution: "utils-merge@npm:1.0.1" - checksum: c81095493225ecfc28add49c106ca4f09cdf56bc66731aa8dabc2edbbccb1e1bfe2de6a115e5c6a380d3ea166d1636410b62ef216bb07b3feb1cfde1d95d5080 - languageName: node - linkType: hard - -"uuid@npm:3.3.2": - version: 3.3.2 - resolution: "uuid@npm:3.3.2" - bin: - uuid: ./bin/uuid - checksum: 8793629d2799f500aeea9fcd0aec6c4e9fbcc4d62ed42159ad96be345c3fffac1bbf61a23e18e2782600884fee05e6d4012ce4b70d0037c8e987533ae6a77870 - languageName: node - linkType: hard - "uuid@npm:^3.3.2": version: 3.4.0 resolution: "uuid@npm:3.4.0" @@ -16697,6 +12476,15 @@ __metadata: languageName: node linkType: hard +"uuid@npm:^9.0.1": + version: 9.0.1 + resolution: "uuid@npm:9.0.1" + bin: + uuid: dist/bin/uuid + checksum: 39931f6da74e307f51c0fb463dc2462807531dc80760a9bff1e35af4316131b4fc3203d16da60ae33f07fdca5b56f3f1dd662da0c99fea9aaeab2004780cc5f4 + languageName: node + linkType: hard + "v8-compile-cache-lib@npm:^3.0.1": version: 3.0.1 resolution: "v8-compile-cache-lib@npm:3.0.1" @@ -16711,23 +12499,6 @@ __metadata: languageName: node linkType: hard -"validate-npm-package-license@npm:^3.0.1": - version: 3.0.4 - resolution: "validate-npm-package-license@npm:3.0.4" - dependencies: - spdx-correct: ^3.0.0 - spdx-expression-parse: ^3.0.0 - checksum: 35703ac889d419cf2aceef63daeadbe4e77227c39ab6287eeb6c1b36a746b364f50ba22e88591f5d017bc54685d8137bc2d328d0a896e4d3fd22093c0f32a9ad - languageName: node - linkType: hard - -"varint@npm:^5.0.0": - version: 5.0.2 - resolution: "varint@npm:5.0.2" - checksum: e1a66bf9a6cea96d1f13259170d4d41b845833acf3a9df990ea1e760d279bd70d5b1f4c002a50197efd2168a2fd43eb0b808444600fd4d23651e8d42fe90eb05 - languageName: node - linkType: hard - "varint@npm:^6.0.0": version: 6.0.0 resolution: "varint@npm:6.0.0" @@ -16735,13 +12506,6 @@ __metadata: languageName: node linkType: hard -"vary@npm:^1, vary@npm:~1.1.2": - version: 1.1.2 - resolution: "vary@npm:1.1.2" - checksum: ae0123222c6df65b437669d63dfa8c36cee20a504101b2fcd97b8bf76f91259c17f9f2b4d70a1e3c6bbcee7f51b28392833adb6b2770b23b01abec84e369660b - languageName: node - linkType: hard - "verror@npm:1.10.0": version: 1.10.0 resolution: "verror@npm:1.10.0" @@ -16753,24 +12517,24 @@ __metadata: languageName: node linkType: hard -"viem@npm:2.7.14": - version: 2.7.14 - resolution: "viem@npm:2.7.14" - dependencies: - "@adraffy/ens-normalize": 1.10.0 - "@noble/curves": 1.2.0 - "@noble/hashes": 1.3.2 - "@scure/bip32": 1.3.2 - "@scure/bip39": 1.2.1 - abitype: 1.0.0 - isows: 1.0.3 - ws: 8.13.0 +"viem@npm:^2.27.0": + version: 2.29.1 + resolution: "viem@npm:2.29.1" + dependencies: + "@noble/curves": 1.8.2 + "@noble/hashes": 1.7.2 + "@scure/bip32": 1.6.2 + "@scure/bip39": 1.5.4 + abitype: 1.0.8 + isows: 1.0.6 + ox: 0.6.9 + ws: 8.18.1 peerDependencies: typescript: ">=5.0.4" peerDependenciesMeta: typescript: optional: true - checksum: a6bfb53a579345e92dfaadd47d38112a981284a645df45a6e7f68daff75a23d7af5458c7ee34fd36f9e7279ae3b5fc8165aea63d5323cec58ebe366b5fefe256 + checksum: ea9f591ef2cc8891480bf3cfe058f5bc5d8ef4d0d99eb3020f67f27df91af2daa4178b92be30147de2b6db95bc30619051f046de3c69b4cc1fd0e248e6e21308 languageName: node linkType: hard @@ -16783,301 +12547,7 @@ __metadata: languageName: node linkType: hard -"web3-bzz@npm:1.2.11": - version: 1.2.11 - resolution: "web3-bzz@npm:1.2.11" - dependencies: - "@types/node": ^12.12.6 - got: 9.6.0 - swarm-js: ^0.1.40 - underscore: 1.9.1 - checksum: 45136e7282819260357efdcdf6d81cb7b733b212aa1e46f1bbcaff70a33a2e3f6558936e6e1fc3bf75bb4c3220f844fc6b9d5bfaaa68a2f6ed0e8c0b02c97523 - languageName: node - linkType: hard - -"web3-core-helpers@npm:1.2.11": - version: 1.2.11 - resolution: "web3-core-helpers@npm:1.2.11" - dependencies: - underscore: 1.9.1 - web3-eth-iban: 1.2.11 - web3-utils: 1.2.11 - checksum: dac2ab85b8bec8251647d40f1dc5fcf30b2245de6d216328c51c9d619d12a567906c5bf8b542846552a56bf969edcfcb16fb67e3780461195df85cd506591f68 - languageName: node - linkType: hard - -"web3-core-method@npm:1.2.11": - version: 1.2.11 - resolution: "web3-core-method@npm:1.2.11" - dependencies: - "@ethersproject/transactions": ^5.0.0-beta.135 - underscore: 1.9.1 - web3-core-helpers: 1.2.11 - web3-core-promievent: 1.2.11 - web3-core-subscriptions: 1.2.11 - web3-utils: 1.2.11 - checksum: 7533c5b8c42df49969b9c95a2c9cb0abcd55a304ef4b276a5cc43673d27ffd9767a0caabe09271979b5afd0f788a51416f7018bc704d734ad78846c68dba15a7 - languageName: node - linkType: hard - -"web3-core-promievent@npm:1.2.11": - version: 1.2.11 - resolution: "web3-core-promievent@npm:1.2.11" - dependencies: - eventemitter3: 4.0.4 - checksum: bd3661978f252ec0033881b32a5d4dec1bfeb7fb0f018d77c077c77b60c0f965215dcbd54c5fcbef739441dd7efbdbd6c9b20e275e05f5b4d2cee762937d95cc - languageName: node - linkType: hard - -"web3-core-requestmanager@npm:1.2.11": - version: 1.2.11 - resolution: "web3-core-requestmanager@npm:1.2.11" - dependencies: - underscore: 1.9.1 - web3-core-helpers: 1.2.11 - web3-providers-http: 1.2.11 - web3-providers-ipc: 1.2.11 - web3-providers-ws: 1.2.11 - checksum: 84898bfec26319d06ccf7ae63821b7fbea8efc8a76015921530cc4eb85db39598c16598f1e51f95ed79146d7defafe7b924b5c6f6927fb2a153d01eb0862182c - languageName: node - linkType: hard - -"web3-core-subscriptions@npm:1.2.11": - version: 1.2.11 - resolution: "web3-core-subscriptions@npm:1.2.11" - dependencies: - eventemitter3: 4.0.4 - underscore: 1.9.1 - web3-core-helpers: 1.2.11 - checksum: 7c8c07ea79fc9cf4ecb15ea37c5db38cc38e4b0545247d9ccc7ff6f4257565c03bcee569695a93abe02b8a98a6a9c227df880911ae324c0c6218a9571a3811f6 - languageName: node - linkType: hard - -"web3-core@npm:1.2.11": - version: 1.2.11 - resolution: "web3-core@npm:1.2.11" - dependencies: - "@types/bn.js": ^4.11.5 - "@types/node": ^12.12.6 - bignumber.js: ^9.0.0 - web3-core-helpers: 1.2.11 - web3-core-method: 1.2.11 - web3-core-requestmanager: 1.2.11 - web3-utils: 1.2.11 - checksum: 1793affddb4fa811f9781dc644b4017d95c6084a21bb866e0dc626f6d48bfc29eacf02237608b587ca49094e9342da878b64173510d99a6e9171f7a697e8cb36 - languageName: node - linkType: hard - -"web3-eth-abi@npm:1.2.11": - version: 1.2.11 - resolution: "web3-eth-abi@npm:1.2.11" - dependencies: - "@ethersproject/abi": 5.0.0-beta.153 - underscore: 1.9.1 - web3-utils: 1.2.11 - checksum: ef96c9c0faad2634d69f1c6dbf3414d0f292c0e534e477f47a1b14512c7099237a09d6b6ba91b624cea348e51e759106b128b0fe463d62f17f447e0a47071d76 - languageName: node - linkType: hard - -"web3-eth-accounts@npm:1.2.11": - version: 1.2.11 - resolution: "web3-eth-accounts@npm:1.2.11" - dependencies: - crypto-browserify: 3.12.0 - eth-lib: 0.2.8 - ethereumjs-common: ^1.3.2 - ethereumjs-tx: ^2.1.1 - scrypt-js: ^3.0.1 - underscore: 1.9.1 - uuid: 3.3.2 - web3-core: 1.2.11 - web3-core-helpers: 1.2.11 - web3-core-method: 1.2.11 - web3-utils: 1.2.11 - checksum: 1653a7548337b538b280ced0d25dbf8b105954a5bf61726d5def25128ffc87c49d0d38b678a32e7d259e687f5e72cc452d92e14eaa8c9976a9153347e4afe7eb - languageName: node - linkType: hard - -"web3-eth-contract@npm:1.2.11": - version: 1.2.11 - resolution: "web3-eth-contract@npm:1.2.11" - dependencies: - "@types/bn.js": ^4.11.5 - underscore: 1.9.1 - web3-core: 1.2.11 - web3-core-helpers: 1.2.11 - web3-core-method: 1.2.11 - web3-core-promievent: 1.2.11 - web3-core-subscriptions: 1.2.11 - web3-eth-abi: 1.2.11 - web3-utils: 1.2.11 - checksum: 1dc74e11f09c895bd5b26c5dfb3a0818d6a38a573de9252a3a943acf6ba88a058313e2977c95564ab56c3696f1ca975237ae4f10c93d34d2978f11bb1119b4d7 - languageName: node - linkType: hard - -"web3-eth-ens@npm:1.2.11": - version: 1.2.11 - resolution: "web3-eth-ens@npm:1.2.11" - dependencies: - content-hash: ^2.5.2 - eth-ens-namehash: 2.0.8 - underscore: 1.9.1 - web3-core: 1.2.11 - web3-core-helpers: 1.2.11 - web3-core-promievent: 1.2.11 - web3-eth-abi: 1.2.11 - web3-eth-contract: 1.2.11 - web3-utils: 1.2.11 - checksum: 987999713c5c79f23a67ad244813212e9582566f6a7665312f887ce0eda77d91b85d3c0df21af14ef6ab6e970626d5d02129a2df3a8c257151f9540d6968a748 - languageName: node - linkType: hard - -"web3-eth-iban@npm:1.2.11": - version: 1.2.11 - resolution: "web3-eth-iban@npm:1.2.11" - dependencies: - bn.js: ^4.11.9 - web3-utils: 1.2.11 - checksum: 1c28b3ad2cad2af0a76b051fe2c05ed933476eaa99f2c245862f66d4e3d56e60ad26cf55120513f78648ab1ff2b8a6b751e63448cdb01b53b542334bf148286f - languageName: node - linkType: hard - -"web3-eth-personal@npm:1.2.11": - version: 1.2.11 - resolution: "web3-eth-personal@npm:1.2.11" - dependencies: - "@types/node": ^12.12.6 - web3-core: 1.2.11 - web3-core-helpers: 1.2.11 - web3-core-method: 1.2.11 - web3-net: 1.2.11 - web3-utils: 1.2.11 - checksum: a754a16aaed1e97baf963f594b69c83bc4c1cf3f5b181b18720ce292583b4a1b70c7a5c22433679c3e66166773bb43731535d085db3bcfc72af48290553f5122 - languageName: node - linkType: hard - -"web3-eth@npm:1.2.11": - version: 1.2.11 - resolution: "web3-eth@npm:1.2.11" - dependencies: - underscore: 1.9.1 - web3-core: 1.2.11 - web3-core-helpers: 1.2.11 - web3-core-method: 1.2.11 - web3-core-subscriptions: 1.2.11 - web3-eth-abi: 1.2.11 - web3-eth-accounts: 1.2.11 - web3-eth-contract: 1.2.11 - web3-eth-ens: 1.2.11 - web3-eth-iban: 1.2.11 - web3-eth-personal: 1.2.11 - web3-net: 1.2.11 - web3-utils: 1.2.11 - checksum: eaf361bc59859e7e9078e57f438564f10ea5c0cc00404d3ccf537f3c8d11d963b74f8c3981f4160f1ed2e3c4d9d97a5ff85b33744d5083afde8dfd5dde887034 - languageName: node - linkType: hard - -"web3-net@npm:1.2.11": - version: 1.2.11 - resolution: "web3-net@npm:1.2.11" - dependencies: - web3-core: 1.2.11 - web3-core-method: 1.2.11 - web3-utils: 1.2.11 - checksum: 76a99815699674709b869b60bf950d20167b999fe93f7d091b01ce3fd0e3dd9c30ef3519156c04eb01703791c049b19b295e6901dd41d208ea600149961f7ee6 - languageName: node - linkType: hard - -"web3-provider-engine@npm:14.2.1": - version: 14.2.1 - resolution: "web3-provider-engine@npm:14.2.1" - dependencies: - async: ^2.5.0 - backoff: ^2.5.0 - clone: ^2.0.0 - cross-fetch: ^2.1.0 - eth-block-tracker: ^3.0.0 - eth-json-rpc-infura: ^3.1.0 - eth-sig-util: ^1.4.2 - ethereumjs-block: ^1.2.2 - ethereumjs-tx: ^1.2.0 - ethereumjs-util: ^5.1.5 - ethereumjs-vm: ^2.3.4 - json-rpc-error: ^2.0.0 - json-stable-stringify: ^1.0.1 - promise-to-callback: ^1.0.0 - readable-stream: ^2.2.9 - request: ^2.85.0 - semaphore: ^1.0.3 - ws: ^5.1.1 - xhr: ^2.2.0 - xtend: ^4.0.1 - checksum: 45441e22633184bd5f6ea645e20f99c8002b3b64d3e564cd9d0f65bad7f0755ad2cdf9a88fcac9585e908aacea28cc6e80c0939498ee4f4c6c49107d16e011bf - languageName: node - linkType: hard - -"web3-providers-http@npm:1.2.11": - version: 1.2.11 - resolution: "web3-providers-http@npm:1.2.11" - dependencies: - web3-core-helpers: 1.2.11 - xhr2-cookies: 1.1.0 - checksum: 64760032d68826865de084c31d81be70bebc54cd82138ef724da13b60f7b341d4c0c6716912616b928680756ea6f2cef42be7d16fa9dd143a09ac55701232193 - languageName: node - linkType: hard - -"web3-providers-ipc@npm:1.2.11": - version: 1.2.11 - resolution: "web3-providers-ipc@npm:1.2.11" - dependencies: - oboe: 2.1.4 - underscore: 1.9.1 - web3-core-helpers: 1.2.11 - checksum: 0fab2f824e4c7f080fee26b76c9c8448eb51abfd285a04f3c9efe92c3b9a8742096804ec02f56bc8297e375ea12f0f2205bb6c0ae376c44c005cdfeec65d0b7e - languageName: node - linkType: hard - -"web3-providers-ws@npm:1.2.11": - version: 1.2.11 - resolution: "web3-providers-ws@npm:1.2.11" - dependencies: - eventemitter3: 4.0.4 - underscore: 1.9.1 - web3-core-helpers: 1.2.11 - websocket: ^1.0.31 - checksum: 4a4c591c2bd9724748e9dba124e59048b91239aa7cd435394f2a1d8e7914132920a17e56bc646f46912844fcfbbc38333b7023ebec298af36106ec4814d2ff5c - languageName: node - linkType: hard - -"web3-shh@npm:1.2.11": - version: 1.2.11 - resolution: "web3-shh@npm:1.2.11" - dependencies: - web3-core: 1.2.11 - web3-core-method: 1.2.11 - web3-core-subscriptions: 1.2.11 - web3-net: 1.2.11 - checksum: 64c4a1f03bc3975a2baff9fa6d89a0050a06f179f1ec4d6e28f480b761d0efe56a9a79a5a320821e1dd503e82d44e73dd69b883b9e69d96cced3f979e0a3f4ff - languageName: node - linkType: hard - -"web3-utils@npm:1.2.11": - version: 1.2.11 - resolution: "web3-utils@npm:1.2.11" - dependencies: - bn.js: ^4.11.9 - eth-lib: 0.2.8 - ethereum-bloom-filters: ^1.0.6 - ethjs-unit: 0.1.6 - number-to-bn: 1.7.0 - randombytes: ^2.1.0 - underscore: 1.9.1 - utf8: 3.0.0 - checksum: 1e43235963d5176e447b20b201a66fabccbe7bd4ef8bbb2edfa5ea80a41e8202a8e8f3db128b2a1662855a627a52d100e3207b81a739b937b5b3b4f9114c008f - languageName: node - linkType: hard - -"web3-utils@npm:^1.0.0-beta.31, web3-utils@npm:^1.3.6": +"web3-utils@npm:^1.3.6": version: 1.10.4 resolution: "web3-utils@npm:1.10.4" dependencies: @@ -17093,21 +12563,6 @@ __metadata: languageName: node linkType: hard -"web3@npm:1.2.11": - version: 1.2.11 - resolution: "web3@npm:1.2.11" - dependencies: - web3-bzz: 1.2.11 - web3-core: 1.2.11 - web3-eth: 1.2.11 - web3-eth-personal: 1.2.11 - web3-net: 1.2.11 - web3-shh: 1.2.11 - web3-utils: 1.2.11 - checksum: c4fa6ddaddc2de31c561590eb3703e9446c0a9bd87155f536fd72c3c22337056bbd045baf36fec6152e58ae67e552fffad29e794030cd87634becb99a079e91f - languageName: node - linkType: hard - "webidl-conversions@npm:^3.0.0": version: 3.0.1 resolution: "webidl-conversions@npm:3.0.1" @@ -17115,41 +12570,6 @@ __metadata: languageName: node linkType: hard -"websocket@npm:1.0.32": - version: 1.0.32 - resolution: "websocket@npm:1.0.32" - dependencies: - bufferutil: ^4.0.1 - debug: ^2.2.0 - es5-ext: ^0.10.50 - typedarray-to-buffer: ^3.1.5 - utf-8-validate: ^5.0.2 - yaeti: ^0.0.6 - checksum: a29777a1942bf802f955782c7cf948797d19731a911b81adb957873e74b1d5356c621f217a972b075ecf04417a76897ea98dbfc19394007c4cf5e97cd4d494ac - languageName: node - linkType: hard - -"websocket@npm:^1.0.31": - version: 1.0.35 - resolution: "websocket@npm:1.0.35" - dependencies: - bufferutil: ^4.0.1 - debug: ^2.2.0 - es5-ext: ^0.10.63 - typedarray-to-buffer: ^3.1.5 - utf-8-validate: ^5.0.2 - yaeti: ^0.0.6 - checksum: 760ad7b090dee914336069cdf4fb78c1a96f5a452b2a5459b68d596af088959bb48113914667123d9662388c0398980955c875c950177c51fcf0d22cc92d935c - languageName: node - linkType: hard - -"whatwg-fetch@npm:^2.0.4": - version: 2.0.4 - resolution: "whatwg-fetch@npm:2.0.4" - checksum: de7c65a68d7d62e2f144a6b30293370b3ad82b65ebcd68f2ac8e8bbe7ede90febd98ba9486b78c1cbc950e0e8838fa5c2727f939899ab3fc7b71a04be52d33a5 - languageName: node - linkType: hard - "whatwg-url@npm:^5.0.0": version: 5.0.0 resolution: "whatwg-url@npm:5.0.0" @@ -17160,23 +12580,49 @@ __metadata: languageName: node linkType: hard -"which-boxed-primitive@npm:^1.0.2": - version: 1.0.2 - resolution: "which-boxed-primitive@npm:1.0.2" +"which-boxed-primitive@npm:^1.1.0, which-boxed-primitive@npm:^1.1.1": + version: 1.1.1 + resolution: "which-boxed-primitive@npm:1.1.1" dependencies: - is-bigint: ^1.0.1 - is-boolean-object: ^1.1.0 - is-number-object: ^1.0.4 - is-string: ^1.0.5 - is-symbol: ^1.0.3 - checksum: 53ce774c7379071729533922adcca47220228405e1895f26673bbd71bdf7fb09bee38c1d6399395927c6289476b5ae0629863427fd151491b71c4b6cb04f3a5e + is-bigint: ^1.1.0 + is-boolean-object: ^1.2.1 + is-number-object: ^1.1.1 + is-string: ^1.1.1 + is-symbol: ^1.1.1 + checksum: ee41d0260e4fd39551ad77700c7047d3d281ec03d356f5e5c8393fe160ba0db53ef446ff547d05f76ffabfd8ad9df7c9a827e12d4cccdbc8fccf9239ff8ac21e languageName: node linkType: hard -"which-module@npm:^1.0.0": - version: 1.0.0 - resolution: "which-module@npm:1.0.0" - checksum: 98434f7deb36350cb543c1f15612188541737e1f12d39b23b1c371dff5cf4aa4746210f2bdec202d5fe9da8682adaf8e3f7c44c520687d30948cfc59d5534edb +"which-builtin-type@npm:^1.2.1": + version: 1.2.1 + resolution: "which-builtin-type@npm:1.2.1" + dependencies: + call-bound: ^1.0.2 + function.prototype.name: ^1.1.6 + has-tostringtag: ^1.0.2 + is-async-function: ^2.0.0 + is-date-object: ^1.1.0 + is-finalizationregistry: ^1.1.0 + is-generator-function: ^1.0.10 + is-regex: ^1.2.1 + is-weakref: ^1.0.2 + isarray: ^2.0.5 + which-boxed-primitive: ^1.1.0 + which-collection: ^1.0.2 + which-typed-array: ^1.1.16 + checksum: 7a3617ba0e7cafb795f74db418df889867d12bce39a477f3ee29c6092aa64d396955bf2a64eae3726d8578440e26777695544057b373c45a8bcf5fbe920bf633 + languageName: node + linkType: hard + +"which-collection@npm:^1.0.2": + version: 1.0.2 + resolution: "which-collection@npm:1.0.2" + dependencies: + is-map: ^2.0.3 + is-set: ^2.0.3 + is-weakmap: ^2.0.2 + is-weakset: ^2.0.3 + checksum: c51821a331624c8197916598a738fc5aeb9a857f1e00d89f5e4c03dc7c60b4032822b8ec5696d28268bb83326456a8b8216344fb84270d18ff1d7628051879d9 languageName: node linkType: hard @@ -17187,16 +12633,18 @@ __metadata: languageName: node linkType: hard -"which-typed-array@npm:^1.1.14, which-typed-array@npm:^1.1.15": - version: 1.1.15 - resolution: "which-typed-array@npm:1.1.15" +"which-typed-array@npm:^1.1.16, which-typed-array@npm:^1.1.18": + version: 1.1.19 + resolution: "which-typed-array@npm:1.1.19" dependencies: available-typed-arrays: ^1.0.7 - call-bind: ^1.0.7 - for-each: ^0.3.3 - gopd: ^1.0.1 + call-bind: ^1.0.8 + call-bound: ^1.0.4 + for-each: ^0.3.5 + get-proto: ^1.0.1 + gopd: ^1.2.0 has-tostringtag: ^1.0.2 - checksum: 65227dcbfadf5677aacc43ec84356d17b5500cb8b8753059bb4397de5cd0c2de681d24e1a7bd575633f976a95f88233abfd6549c2105ef4ebd58af8aa1807c75 + checksum: 162d2a07f68ea323f88ed9419861487ce5d02cb876f2cf9dd1e428d04a63133f93a54f89308f337b27cabd312ee3d027cae4a79002b2f0a85b79b9ef4c190670 languageName: node linkType: hard @@ -17222,14 +12670,14 @@ __metadata: languageName: node linkType: hard -"which@npm:^4.0.0": - version: 4.0.0 - resolution: "which@npm:4.0.0" +"which@npm:^5.0.0": + version: 5.0.0 + resolution: "which@npm:5.0.0" dependencies: isexe: ^3.1.1 bin: node-which: bin/which.js - checksum: f17e84c042592c21e23c8195108cff18c64050b9efb8459589116999ea9da6dd1509e6a1bac3aeebefd137be00fabbb61b5c2bc0aa0f8526f32b58ee2f545651 + checksum: 6ec99e89ba32c7e748b8a3144e64bfc74aa63e2b2eacbb61a0060ad0b961eb1a632b08fb1de067ed59b002cec3e21de18299216ebf2325ef0f78e0f121e14e90 languageName: node linkType: hard @@ -17242,15 +12690,6 @@ __metadata: languageName: node linkType: hard -"window-size@npm:^0.2.0": - version: 0.2.0 - resolution: "window-size@npm:0.2.0" - bin: - window-size: cli.js - checksum: a85e2acf156cfa194301294809867bdadd8a48ee5d972d9fa8e3e1b3420a1d0201b13ac8eb0348a0d14bbf2c3316565b6a749749c2384c5d286caf8a064c4f90 - languageName: node - linkType: hard - "word-wrap@npm:^1.2.5, word-wrap@npm:~1.2.3": version: 1.2.5 resolution: "word-wrap@npm:1.2.5" @@ -17275,10 +12714,10 @@ __metadata: languageName: node linkType: hard -"workerpool@npm:6.2.1": - version: 6.2.1 - resolution: "workerpool@npm:6.2.1" - checksum: c2c6eebbc5225f10f758d599a5c016fa04798bcc44e4c1dffb34050cd361d7be2e97891aa44419e7afe647b1f767b1dc0b85a5e046c409d890163f655028b09d +"workerpool@npm:^6.5.1": + version: 6.5.1 + resolution: "workerpool@npm:6.5.1" + checksum: f86d13f9139c3a57c5a5867e81905cd84134b499849405dec2ffe5b1acd30dabaa1809f6f6ee603a7c65e1e4325f21509db6b8398eaf202c8b8f5809e26a2e16 languageName: node linkType: hard @@ -17293,16 +12732,6 @@ __metadata: languageName: node linkType: hard -"wrap-ansi@npm:^2.0.0": - version: 2.1.0 - resolution: "wrap-ansi@npm:2.1.0" - dependencies: - string-width: ^1.0.1 - strip-ansi: ^3.0.1 - checksum: 2dacd4b3636f7a53ee13d4d0fe7fa2ed9ad81e9967e17231924ea88a286ec4619a78288de8d41881ee483f4449ab2c0287cde8154ba1bd0126c10271101b2ee3 - languageName: node - linkType: hard - "wrap-ansi@npm:^5.1.0": version: 5.1.0 resolution: "wrap-ansi@npm:5.1.0" @@ -17341,24 +12770,24 @@ __metadata: languageName: node linkType: hard -"ws@npm:7.4.6": - version: 7.4.6 - resolution: "ws@npm:7.4.6" +"ws@npm:8.17.1": + version: 8.17.1 + resolution: "ws@npm:8.17.1" peerDependencies: bufferutil: ^4.0.1 - utf-8-validate: ^5.0.2 + utf-8-validate: ">=5.0.2" peerDependenciesMeta: bufferutil: optional: true utf-8-validate: optional: true - checksum: 3a990b32ed08c72070d5e8913e14dfcd831919205be52a3ff0b4cdd998c8d554f167c9df3841605cde8b11d607768cacab3e823c58c96a5c08c987e093eb767a + checksum: 442badcce1f1178ec87a0b5372ae2e9771e07c4929a3180321901f226127f252441e8689d765aa5cfba5f50ac60dd830954afc5aeae81609aefa11d3ddf5cecf languageName: node linkType: hard -"ws@npm:8.13.0": - version: 8.13.0 - resolution: "ws@npm:8.13.0" +"ws@npm:8.18.0": + version: 8.18.0 + resolution: "ws@npm:8.18.0" peerDependencies: bufferutil: ^4.0.1 utf-8-validate: ">=5.0.2" @@ -17367,13 +12796,13 @@ __metadata: optional: true utf-8-validate: optional: true - checksum: 53e991bbf928faf5dc6efac9b8eb9ab6497c69feeb94f963d648b7a3530a720b19ec2e0ec037344257e05a4f35bd9ad04d9de6f289615ffb133282031b18c61c + checksum: 91d4d35bc99ff6df483bdf029b9ea4bfd7af1f16fc91231a96777a63d263e1eabf486e13a2353970efc534f9faa43bdbf9ee76525af22f4752cbc5ebda333975 languageName: node linkType: hard -"ws@npm:8.17.1": - version: 8.17.1 - resolution: "ws@npm:8.17.1" +"ws@npm:8.18.1": + version: 8.18.1 + resolution: "ws@npm:8.18.1" peerDependencies: bufferutil: ^4.0.1 utf-8-validate: ">=5.0.2" @@ -17382,27 +12811,7 @@ __metadata: optional: true utf-8-validate: optional: true - checksum: 442badcce1f1178ec87a0b5372ae2e9771e07c4929a3180321901f226127f252441e8689d765aa5cfba5f50ac60dd830954afc5aeae81609aefa11d3ddf5cecf - languageName: node - linkType: hard - -"ws@npm:^3.0.0": - version: 3.3.3 - resolution: "ws@npm:3.3.3" - dependencies: - async-limiter: ~1.0.0 - safe-buffer: ~5.1.0 - ultron: ~1.1.0 - checksum: 20b7bf34bb88715b9e2d435b76088d770e063641e7ee697b07543815fabdb752335261c507a973955e823229d0af8549f39cc669825e5c8404aa0422615c81d9 - languageName: node - linkType: hard - -"ws@npm:^5.1.1": - version: 5.2.4 - resolution: "ws@npm:5.2.4" - dependencies: - async-limiter: ~1.0.0 - checksum: a0c39704a752593ce603b0b3d28a3d3901839cd20560503b2c7257d63ee448677a4e00a2b7f69d775363a08700f041e84fe1f77b00931bb471f54380ab6dd50e + checksum: 4658357185d891bc45cc2d42a84f9e192d047e8476fb5cba25b604f7d75ca87ca0dd54cd0b2cc49aeee57c79045a741cb7d0b14501953ac60c790cd105c42f23 languageName: node linkType: hard @@ -17421,74 +12830,13 @@ __metadata: languageName: node linkType: hard -"xhr-request-promise@npm:^0.1.2": - version: 0.1.3 - resolution: "xhr-request-promise@npm:0.1.3" - dependencies: - xhr-request: ^1.1.0 - checksum: 2e127c0de063db0aa704b8d5b805fd34f0f07cac21284a88c81f96727eb71af7d2dfa3ad43e96ed3e851e05a1bd88933048ec183378b48594dfbead1c9043aee - languageName: node - linkType: hard - -"xhr-request@npm:^1.0.1, xhr-request@npm:^1.1.0": - version: 1.1.0 - resolution: "xhr-request@npm:1.1.0" - dependencies: - buffer-to-arraybuffer: ^0.0.5 - object-assign: ^4.1.1 - query-string: ^5.0.1 - simple-get: ^2.7.0 - timed-out: ^4.0.1 - url-set-query: ^1.0.0 - xhr: ^2.0.4 - checksum: fd8186f33e8696dabcd1ad2983f8125366f4cd799c6bf30aa8d942ac481a7e685a5ee8c38eeee6fca715a7084b432a3a326991375557dc4505c928d3f7b0f0a8 - languageName: node - linkType: hard - -"xhr2-cookies@npm:1.1.0": - version: 1.1.0 - resolution: "xhr2-cookies@npm:1.1.0" - dependencies: - cookiejar: ^2.1.1 - checksum: 6a9fc45f3490cc53e6a308bd7164dab07ecb94f6345e78951ed4a1e8f8c4c7707a1b039a6b4ef7c9d611d9465d6f94d7d4260c43bc34eed8d6f9210a775eb719 - languageName: node - linkType: hard - -"xhr@npm:^2.0.4, xhr@npm:^2.2.0, xhr@npm:^2.3.3": - version: 2.6.0 - resolution: "xhr@npm:2.6.0" - dependencies: - global: ~4.4.0 - is-function: ^1.0.1 - parse-headers: ^2.0.0 - xtend: ^4.0.0 - checksum: a1db277e37737caf3ed363d2a33ce4b4ea5b5fc190b663a6f70bc252799185b840ccaa166eaeeea4841c9c60b87741f0a24e29cbcf6708dd425986d4df186d2f - languageName: node - linkType: hard - -"xtend@npm:^4.0.0, xtend@npm:^4.0.1, xtend@npm:^4.0.2, xtend@npm:~4.0.0, xtend@npm:~4.0.1": +"xtend@npm:^4.0.0, xtend@npm:^4.0.1, xtend@npm:^4.0.2, xtend@npm:~4.0.0": version: 4.0.2 resolution: "xtend@npm:4.0.2" checksum: ac5dfa738b21f6e7f0dd6e65e1b3155036d68104e67e5d5d1bde74892e327d7e5636a076f625599dc394330a731861e87343ff184b0047fef1360a7ec0a5a36a languageName: node linkType: hard -"xtend@npm:~2.1.1": - version: 2.1.2 - resolution: "xtend@npm:2.1.2" - dependencies: - object-keys: ~0.4.0 - checksum: a8b79f31502c163205984eaa2b196051cd2fab0882b49758e30f2f9018255bc6c462e32a090bf3385d1bda04755ad8cc0052a09e049b0038f49eb9b950d9c447 - languageName: node - linkType: hard - -"y18n@npm:^3.2.1": - version: 3.2.2 - resolution: "y18n@npm:3.2.2" - checksum: 6154fd7544f8bbf5b18cdf77692ed88d389be49c87238ecb4e0d6a5276446cd2a5c29cc4bdbdddfc7e4e498b08df9d7e38df4a1453cf75eecfead392246ea74a - languageName: node - linkType: hard - "y18n@npm:^4.0.0": version: 4.0.3 resolution: "y18n@npm:4.0.3" @@ -17503,14 +12851,7 @@ __metadata: languageName: node linkType: hard -"yaeti@npm:^0.0.6": - version: 0.0.6 - resolution: "yaeti@npm:0.0.6" - checksum: 6db12c152f7c363b80071086a3ebf5032e03332604eeda988872be50d6c8469e1f13316175544fa320f72edad696c2d83843ad0ff370659045c1a68bcecfcfea - languageName: node - linkType: hard - -"yallist@npm:^3.0.0, yallist@npm:^3.0.2, yallist@npm:^3.1.1": +"yallist@npm:^3.0.2": version: 3.1.1 resolution: "yallist@npm:3.1.1" checksum: 48f7bb00dc19fc635a13a39fe547f527b10c9290e7b3e836b9a8f1ca04d4d342e85714416b3c2ab74949c9c66f9cebb0473e6bc353b79035356103b47641285d @@ -17524,6 +12865,13 @@ __metadata: languageName: node linkType: hard +"yallist@npm:^5.0.0": + version: 5.0.0 + resolution: "yallist@npm:5.0.0" + checksum: eba51182400b9f35b017daa7f419f434424410691bbc5de4f4240cc830fdef906b504424992700dc047f16b4d99100a6f8b8b11175c193f38008e9c96322b6a5 + languageName: node + linkType: hard + "yaml@npm:^1.10.2, yaml@npm:^1.5.1, yaml@npm:^1.7.2": version: 1.10.2 resolution: "yaml@npm:1.10.2" @@ -17531,13 +12879,6 @@ __metadata: languageName: node linkType: hard -"yargs-parser@npm:20.2.4": - version: 20.2.4 - resolution: "yargs-parser@npm:20.2.4" - checksum: d251998a374b2743a20271c2fd752b9fbef24eb881d53a3b99a7caa5e8227fcafd9abf1f345ac5de46435821be25ec12189a11030c12ee6481fef6863ed8b924 - languageName: node - linkType: hard - "yargs-parser@npm:^13.1.0": version: 13.1.2 resolution: "yargs-parser@npm:13.1.2" @@ -17558,24 +12899,14 @@ __metadata: languageName: node linkType: hard -"yargs-parser@npm:^2.4.1": - version: 2.4.1 - resolution: "yargs-parser@npm:2.4.1" - dependencies: - camelcase: ^3.0.0 - lodash.assign: ^4.0.6 - checksum: f57946a93a9e0986fccbc7999a3fc8179d4693e4551ef0ace3d599c38ec004a3783efb9eed9fa5d738b30db1cfa1d3a07f4dd6ae060cfce6fe61c3ae7b7a347b - languageName: node - linkType: hard - -"yargs-parser@npm:^20.2.2": +"yargs-parser@npm:^20.2.2, yargs-parser@npm:^20.2.9": version: 20.2.9 resolution: "yargs-parser@npm:20.2.9" checksum: 8bb69015f2b0ff9e17b2c8e6bfe224ab463dd00ca211eece72a4cd8a906224d2703fb8a326d36fdd0e68701e201b2a60ed7cf81ce0fd9b3799f9fe7745977ae3 languageName: node linkType: hard -"yargs-unparser@npm:2.0.0": +"yargs-unparser@npm:^2.0.0": version: 2.0.0 resolution: "yargs-unparser@npm:2.0.0" dependencies: @@ -17606,7 +12937,7 @@ __metadata: languageName: node linkType: hard -"yargs@npm:16.2.0": +"yargs@npm:^16.2.0": version: 16.2.0 resolution: "yargs@npm:16.2.0" dependencies: @@ -17621,28 +12952,6 @@ __metadata: languageName: node linkType: hard -"yargs@npm:^4.7.1": - version: 4.8.1 - resolution: "yargs@npm:4.8.1" - dependencies: - cliui: ^3.2.0 - decamelize: ^1.1.1 - get-caller-file: ^1.0.1 - lodash.assign: ^4.0.3 - os-locale: ^1.4.0 - read-pkg-up: ^1.0.1 - require-directory: ^2.1.1 - require-main-filename: ^1.0.1 - set-blocking: ^2.0.0 - string-width: ^1.0.1 - which-module: ^1.0.0 - window-size: ^0.2.0 - y18n: ^3.2.1 - yargs-parser: ^2.4.1 - checksum: 5d0a45dceaf8cff1c6a7164b2c944755a09cced3cb1d585bbc79ffed758ef9f9b54ead0879e3dacfc696ccd15fec9e6e29183c24517d7f578b47cd0614a3851d - languageName: node - linkType: hard - "yn@npm:3.1.1": version: 3.1.1 resolution: "yn@npm:3.1.1" From 896860624f76c0a03d194e022153ee8672cd0e6e Mon Sep 17 00:00:00 2001 From: Aalavandhan <6264334+aalavandhan@users.noreply.github.com> Date: Fri, 30 May 2025 12:08:35 -0400 Subject: [PATCH 03/18] Post audit fixes (#255) * added note about vault's perp handling * added dr eq range * pve 002 * pve-003 * n1 * n2 * Update spot-contracts/contracts/RolloverVault.sol Co-authored-by: Brandon Iles --------- Co-authored-by: Brandon Iles --- spot-contracts/contracts/FeePolicy.sol | 25 +++++++----- spot-contracts/contracts/PerpetualTranche.sol | 31 +++++++------- spot-contracts/contracts/RolloverVault.sol | 10 ++++- spot-contracts/test/FeePolicy.ts | 40 ++++++++++++++++++- spot-vaults/contracts/BillBroker.sol | 4 +- 5 files changed, 78 insertions(+), 32 deletions(-) diff --git a/spot-contracts/contracts/FeePolicy.sol b/spot-contracts/contracts/FeePolicy.sol index 323aad74..ba06aef5 100644 --- a/spot-contracts/contracts/FeePolicy.sol +++ b/spot-contracts/contracts/FeePolicy.sol @@ -68,6 +68,11 @@ contract FeePolicy is IFeePolicy, OwnableUpgradeable { /// is *different* from button-wood's tranche ratios. uint256 public override targetSystemRatio; + /// @notice The range of deviation ratios which define the equilibrium zone. + /// @dev When the system's dr is within the equilibrium zone, no value is transferred + /// during a rebalance operation. + Range public equilibriumDR; + //----------------------------------------------------------------------------- // Fee parameters @@ -113,6 +118,7 @@ contract FeePolicy is IFeePolicy, OwnableUpgradeable { __Ownable_init(); targetSystemRatio = 3 * ONE; // 3.0 + equilibriumDR = Range({ lower: (ONE * 95) / 100, upper: (ONE * 105) / 100 }); // initializing fees feeFnDRDown = Line({ @@ -153,6 +159,15 @@ contract FeePolicy is IFeePolicy, OwnableUpgradeable { targetSystemRatio = targetSystemRatio_; } + /// @notice Updates the equilibrium DR range. + /// @param equilibriumDR_ The new equilibrium DR range as tuple of a fixed point numbers with {DECIMALS} places. + function updateEquilibriumDR(Range memory equilibriumDR_) external onlyOwner { + if (equilibriumDR_.lower > equilibriumDR_.upper || equilibriumDR_.lower > ONE || equilibriumDR_.upper < ONE) { + revert InvalidRange(); + } + equilibriumDR = equilibriumDR_; + } + /// @notice Updates the system fee functions. /// @param feeFnDRDown_ The new fee function for operations that decrease DR. /// @param feeFnDRUp_ The new fee function for operations that increase DR. @@ -261,8 +276,7 @@ contract FeePolicy is IFeePolicy, OwnableUpgradeable { function computeRebalanceAmount(SystemTVL memory s) external view override returns (int256 underlyingAmtIntoPerp) { // We skip rebalancing if dr is close to 1.0 uint256 dr = computeDeviationRatio(s); - Range memory drEq = drEqZone(); - if (dr >= drEq.lower && dr <= drEq.upper) { + if (dr >= equilibriumDR.lower && dr <= equilibriumDR.upper) { return 0; } @@ -305,11 +319,4 @@ contract FeePolicy is IFeePolicy, OwnableUpgradeable { // NOTE: We assume that perp's TVL and vault's TVL values have the same base denomination. return s.vaultTVL.mulDiv(ONE, s.perpTVL).mulDiv(ONE, targetSystemRatio); } - - /// @return The range of deviation ratios which define the equilibrium zone. - /// @dev We infer the equilibrium from the fee function definitions, i.e) the upperDR in `feeFnDRDown` - /// and lowerDR in `feeFnDRUp`. - function drEqZone() public view returns (Range memory) { - return Range({ lower: feeFnDRDown.x2, upper: feeFnDRUp.x1 }); - } } diff --git a/spot-contracts/contracts/PerpetualTranche.sol b/spot-contracts/contracts/PerpetualTranche.sol index 6aee433c..583cd799 100644 --- a/spot-contracts/contracts/PerpetualTranche.sol +++ b/spot-contracts/contracts/PerpetualTranche.sol @@ -212,8 +212,7 @@ contract PerpetualTranche is // v2.0.0 STORAGE ADDITION /// @notice Address of the authorized rollover vault. - /// @dev If this address is set, only the rollover vault can perform rollovers. - /// If not rollovers are publicly accessible. + /// @dev Only the authorized rollover vault can perform rollovers. IRolloverVault public override vault; //-------------------------------------------------------------------------- @@ -569,9 +568,14 @@ contract PerpetualTranche is } /// @inheritdoc IPerpetualTranche - function getReserveTokensUpForRollover() external override afterStateUpdate returns (IERC20Upgradeable[] memory) { + function getReserveTokensUpForRollover() + external + override + afterStateUpdate + returns (IERC20Upgradeable[] memory activeRolloverTokens) + { uint8 reserveCount = uint8(_reserves.length()); - IERC20Upgradeable[] memory activeRolloverTokens = new IERC20Upgradeable[](reserveCount); + activeRolloverTokens = new IERC20Upgradeable[](reserveCount); // We count the number of tokens up for rollover. uint8 numTokensUpForRollover = 0; @@ -579,29 +583,22 @@ contract PerpetualTranche is // If any underlying collateral exists it can be rolled over. IERC20Upgradeable underlying_ = _reserveAt(0); if (underlying_.balanceOf(address(this)) > 0) { - activeRolloverTokens[0] = underlying_; - numTokensUpForRollover++; + activeRolloverTokens[numTokensUpForRollover++] = underlying_; } // Iterating through the reserve to find tranches that are ready to be rolled out. for (uint8 i = 1; i < reserveCount; ++i) { IERC20Upgradeable token = _reserveAt(i); if (_isTimeForRollout(ITranche(address(token)))) { - activeRolloverTokens[i] = token; - numTokensUpForRollover++; + activeRolloverTokens[numTokensUpForRollover++] = token; } } - // We recreate a smaller array with just the tokens up for rollover. - IERC20Upgradeable[] memory rolloverTokens = new IERC20Upgradeable[](numTokensUpForRollover); - uint8 j = 0; - for (uint8 i = 0; i < reserveCount; ++i) { - if (address(activeRolloverTokens[i]) != address(0)) { - rolloverTokens[j++] = activeRolloverTokens[i]; - } + // Resize array in-place + // solhint-disable-next-line no-inline-assembly + assembly { + mstore(activeRolloverTokens, numTokensUpForRollover) } - - return rolloverTokens; } /// @inheritdoc IPerpetualTranche diff --git a/spot-contracts/contracts/RolloverVault.sol b/spot-contracts/contracts/RolloverVault.sol index 96c9d3fe..ddf1ac7e 100644 --- a/spot-contracts/contracts/RolloverVault.sol +++ b/spot-contracts/contracts/RolloverVault.sol @@ -55,6 +55,12 @@ import { TrancheManager } from "./_utils/TrancheManager.sol"; * When ever a tranche token enters or leaves the system, we immediately invoke `_syncDeployedAsset` to update book-keeping. * We call `_syncAsset` at the very end of every external function which changes the vault's underlying or perp balance. * + * The perp tokens aren't considered part of the vault's asset set. However + * during the normal operations, the vault can hold transient perp tokens but they + * are immediately broken down into tranches. The vault receives perps only during rebalancing and swapping. + * At the end of those operations, the vault redeems perp tokens for the senior tranches backing them. + * + * */ contract RolloverVault is ERC20BurnableUpgradeable, @@ -604,7 +610,7 @@ contract RolloverVault is // The vault continues to hold the perp dust until the subsequent `swapPerpsForUnderlying` or manual `recover(perp)`. // We ensure that the vault's underlying token liquidity - // remains above the reserved level after swap. + // remains above the reserved level after a swap that reduces liquidity. uint256 underlyingBalPost = underlying_.balanceOf(address(this)); if ((underlyingBalPost < underlyingBalPre) && (underlyingBalPost <= _totalReservedBalance(s.vaultTVL))) { revert InsufficientLiquidity(); @@ -638,7 +644,7 @@ contract RolloverVault is // transfer underlying out underlying_.safeTransfer(msg.sender, underlyingAmtOut); - // Revert if swap reduces vault's available liquidity. + // We ensure that this swap strictly increases the vault's liquidity. uint256 underlyingBalPost = underlying_.balanceOf(address(this)); if (underlyingBalPost < underlyingBalPre) { revert InsufficientLiquidity(); diff --git a/spot-contracts/test/FeePolicy.ts b/spot-contracts/test/FeePolicy.ts index 8793edef..720aeca0 100644 --- a/spot-contracts/test/FeePolicy.ts +++ b/spot-contracts/test/FeePolicy.ts @@ -46,7 +46,7 @@ describe("FeePolicy", function () { expect(f2[2]).to.eq(toPerc("1.5")); expect(f2[3]).to.eq(toPerc("0.25")); - const drEq = await feePolicy.drEqZone(); + const drEq = await feePolicy.equilibriumDR(); expect(drEq[0]).to.eq(toPerc("0.95")); expect(drEq[1]).to.eq(toPerc("1.05")); @@ -91,6 +91,42 @@ describe("FeePolicy", function () { }); }); + describe("#updateEquilibriumDR", function () { + describe("when triggered by non-owner", function () { + it("should revert", async function () { + await expect( + feePolicy.connect(otherUser).updateEquilibriumDR([toPerc("0.9"), toPerc("1.1")]), + ).to.be.revertedWith("Ownable: caller is not the owner"); + }); + }); + + describe("when range is invalid", function () { + it("should revert", async function () { + await expect(feePolicy.updateEquilibriumDR([toPerc("1.2"), toPerc("1.1")])).to.be.revertedWithCustomError( + feePolicy, + "InvalidRange", + ); + await expect(feePolicy.updateEquilibriumDR([toPerc("1.01"), toPerc("1.1")])).to.be.revertedWithCustomError( + feePolicy, + "InvalidRange", + ); + await expect(feePolicy.updateEquilibriumDR([toPerc("0.9"), toPerc("0.99")])).to.be.revertedWithCustomError( + feePolicy, + "InvalidRange", + ); + }); + }); + + describe("when triggered by owner", function () { + it("should update the target sr", async function () { + await feePolicy.connect(deployer).updateEquilibriumDR([toPerc("0.9"), toPerc("1.1")]); + const eq = await feePolicy.equilibriumDR(); + expect(eq[0]).to.eq(toPerc("0.9")); + expect(eq[1]).to.eq(toPerc("1.1")); + }); + }); + }); + describe("#updateFees", function () { const VALID_DOWN = toLine("0.0", "1.0", "0.99", "0.0"); const VALID_UP = toLine("1.01", "0.0", "2.0", "1.0"); @@ -333,7 +369,7 @@ describe("FeePolicy", function () { describe("when deviation is within eq range", function () { it("should compute rebalance data", async function () { - await feePolicy.updateFees(toLine("0", "0.5", "0.5", "0"), toLine("2", "0", "10", "0.5")); + await feePolicy.updateEquilibriumDR([toPerc("0.5"), toPerc("2")]); const r1 = await feePolicy.computeRebalanceAmount({ perpTVL: toAmt("120"), vaultTVL: toAmt("500"), diff --git a/spot-vaults/contracts/BillBroker.sol b/spot-vaults/contracts/BillBroker.sol index 77330628..0345a5f8 100644 --- a/spot-vaults/contracts/BillBroker.sol +++ b/spot-vaults/contracts/BillBroker.sol @@ -53,8 +53,8 @@ import { InvalidARBound } from "./_interfaces/errors/BillBrokerErrors.sol"; * hold the perp tokens until the market price recovers and sell it back to the bill broker contract. * * Single Sided deposits: - * The pool also supports single sided deposits with either perps or usd tokens - * insofar as it brings the pool back into balance. + * The pool also supports single sided deposits with either perps or usd tokens. A + * single sided deposit is treated simply as an atomic swap and deposit. * */ contract BillBroker is From ece590ba11fb9c4fd2deb652c6b741ad7730b873 Mon Sep 17 00:00:00 2001 From: Aalavandhan <6264334+aalavandhan@users.noreply.github.com> Date: Mon, 2 Jun 2025 07:49:48 -0400 Subject: [PATCH 04/18] twap tick rounding (#257) --- spot-vaults/contracts/_utils/UniswapV3PoolHelpers.sol | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/spot-vaults/contracts/_utils/UniswapV3PoolHelpers.sol b/spot-vaults/contracts/_utils/UniswapV3PoolHelpers.sol index 8c44d3cd..692e03fd 100644 --- a/spot-vaults/contracts/_utils/UniswapV3PoolHelpers.sol +++ b/spot-vaults/contracts/_utils/UniswapV3PoolHelpers.sol @@ -34,15 +34,18 @@ library UniswapV3PoolHelpers { /// @notice Retrieves the Time-Weighted Average Price (TWAP) tick from a Uniswap V3 pool over a given duration. /// @param pool The Uniswap V3 pool. /// @param twapDuration The TWAP duration. - /// @return The TWAP tick. + /// @return twapTick The TWAP tick. function getTwapTick( IUniswapV3Pool pool, uint32 twapDuration - ) internal view returns (int24) { + ) internal view returns (int24 twapTick) { uint32[] memory secondsAgo = new uint32[](2); secondsAgo[0] = twapDuration; secondsAgo[1] = 0; (int56[] memory tickCumulatives, ) = pool.observe(secondsAgo); - return int24((tickCumulatives[1] - tickCumulatives[0]) / twapDuration); + int56 tickCumulativesDelta = tickCumulatives[1] - tickCumulatives[0]; + twapTick = int24(tickCumulativesDelta / twapDuration); + if (tickCumulativesDelta < 0 && (tickCumulativesDelta % twapDuration != 0)) + twapTick--; } } From 5b29e359ee919943a3e65e59dbd34ff280b17db6 Mon Sep 17 00:00:00 2001 From: Aalavandhan <6264334+aalavandhan@users.noreply.github.com> Date: Tue, 10 Jun 2025 08:08:41 -0400 Subject: [PATCH 05/18] updated fee policy to allow non-zero fees when dr is inside expected range (#258) --- spot-contracts/contracts/FeePolicy.sol | 3 --- spot-contracts/test/FeePolicy.ts | 14 -------------- 2 files changed, 17 deletions(-) diff --git a/spot-contracts/contracts/FeePolicy.sol b/spot-contracts/contracts/FeePolicy.sol index ba06aef5..3bb76149 100644 --- a/spot-contracts/contracts/FeePolicy.sol +++ b/spot-contracts/contracts/FeePolicy.sol @@ -175,9 +175,6 @@ contract FeePolicy is IFeePolicy, OwnableUpgradeable { // Expect DR to be non-decreasing, x1 <= x2 bool validFees = ((feeFnDRDown_.x1 <= feeFnDRDown_.x2) && (feeFnDRUp_.x1 <= feeFnDRUp_.x2)); - // Expect equilibrium zone to be valid - validFees = ((feeFnDRDown_.x2 <= ONE) && (feeFnDRUp_.x1 >= ONE)) && validFees; - // Expect fees to be non-decreasing when dr moves away from 1.0 validFees = ((feeFnDRDown_.y1 >= feeFnDRDown_.y2) && (feeFnDRUp_.y1 <= feeFnDRUp_.y2)) && validFees; diff --git a/spot-contracts/test/FeePolicy.ts b/spot-contracts/test/FeePolicy.ts index 720aeca0..6fcd2854 100644 --- a/spot-contracts/test/FeePolicy.ts +++ b/spot-contracts/test/FeePolicy.ts @@ -148,20 +148,6 @@ describe("FeePolicy", function () { ); }); - it("equilibrium zone crosses 1.0", async function () { - const badDown = toLine("0.0", "1.0", "1.1", "0.0"); - await expect(feePolicy.connect(deployer).updateFees(badDown, VALID_UP)).to.be.revertedWithCustomError( - feePolicy, - "InvalidFees", - ); - - const badUp = toLine("0.9", "0.0", "2.0", "1.0"); - await expect(feePolicy.connect(deployer).updateFees(VALID_DOWN, badUp)).to.be.revertedWithCustomError( - feePolicy, - "InvalidFees", - ); - }); - it("fees not monotonic wrt distance from 1.0", async function () { const badDown = toLine("0.0", "0.0", "1.0", "1.0"); await expect(feePolicy.connect(deployer).updateFees(badDown, VALID_UP)).to.be.revertedWithCustomError( From a5f82e6161da79327ac82a5ac997667384785564 Mon Sep 17 00:00:00 2001 From: Aalavandhan <6264334+aalavandhan@users.noreply.github.com> Date: Thu, 12 Jun 2025 22:03:19 -0400 Subject: [PATCH 06/18] Testnet deployment v5.0 (#256) * upgraded bill broker testnet * updated spot and stampl on testnet --- spot-contracts/.openzeppelin/sepolia.json | 1238 +++++++++++++++++ spot-contracts/README.md | 2 +- spot-contracts/tasks/helpers.ts | 4 +- spot-contracts/tasks/ops/perp.ts | 32 +- spot-contracts/tasks/ops/tranche.ts | 22 +- spot-contracts/tasks/ops/vaults.ts | 233 +++- spot-contracts/tasks/scripts/sepolia.sh | 15 +- spot-contracts/tasks/upgrade/index.ts | 48 +- spot-vaults/.openzeppelin/sepolia.json | 319 +++++ spot-vaults/README.md | 2 +- .../contracts/_test/MockSpotPricer.sol | 44 + spot-vaults/package.json | 2 +- spot-vaults/tasks/deploy.ts | 30 + spot-vaults/tasks/info.ts | 11 +- spot-vaults/tasks/ops.ts | 116 ++ spot-vaults/tasks/scripts/sepolia.sh | 8 + spot-vaults/tasks/upgrade.ts | 4 +- yarn.lock | 63 +- 18 files changed, 2082 insertions(+), 111 deletions(-) create mode 100644 spot-vaults/contracts/_test/MockSpotPricer.sol diff --git a/spot-contracts/.openzeppelin/sepolia.json b/spot-contracts/.openzeppelin/sepolia.json index 1abd075a..f2127177 100644 --- a/spot-contracts/.openzeppelin/sepolia.json +++ b/spot-contracts/.openzeppelin/sepolia.json @@ -24,6 +24,26 @@ "address": "0x3205ade922457db878039fDbF0e5A88872027A67", "txHash": "0x19de9d6b4d49a8bb03deef871232212e6c696942feb6476c98ad7a8017e0975b", "kind": "transparent" + }, + { + "address": "0x09AF412c5c133116582480cBa853e4d8493a5E6C", + "txHash": "0x24ff7a20ff3f4af25d91b9be7c88824a31f6771347d7002f0bb70e80e72639d0", + "kind": "transparent" + }, + { + "address": "0x2123119898bc0f0AA699aEa0F3f75A25523F845A", + "txHash": "0x33fbbf70adea534a61e9caa3e41aa9e5cb4adcb45e00866ab3b8589633b1166c", + "kind": "transparent" + }, + { + "address": "0x72Ff3c3F205c2AC95234199916Bee97c6b973390", + "txHash": "0x98d81c9042663a9a51a36cc8ab4c4ae1c22e63bf065394fb8c31d2eb05880a8c", + "kind": "transparent" + }, + { + "address": "0xd90FcB328D90B778D1f6719d781045bbbac8F251", + "txHash": "0x8b29769272d41c1032345366209cdcddb8abda7b8c66bfba001162c14671855e", + "kind": "transparent" } ], "impls": { @@ -1477,6 +1497,1224 @@ }, "namespaces": {} } + }, + "27615ac3f0c04782221a0e771a009ef027f8d4639b613c0b87c5311ebbfd6094": { + "address": "0x61F2c060FFe532e0dD9717D8aE06c116f6435C73", + "txHash": "0xc75479d79a82fc90b9208104633506887890566162064d5c05c65d4e0cb3c27b", + "layout": { + "solcVersion": "0.8.20", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:62", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:67" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:36" + }, + { + "label": "_balances", + "offset": 0, + "slot": "51", + "type": "t_mapping(t_address,t_uint256)", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:37" + }, + { + "label": "_allowances", + "offset": 0, + "slot": "52", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:39" + }, + { + "label": "_totalSupply", + "offset": 0, + "slot": "53", + "type": "t_uint256", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:41" + }, + { + "label": "_name", + "offset": 0, + "slot": "54", + "type": "t_string_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:43" + }, + { + "label": "_symbol", + "offset": 0, + "slot": "55", + "type": "t_string_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:44" + }, + { + "label": "__gap", + "offset": 0, + "slot": "56", + "type": "t_array(t_uint256)45_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:394" + }, + { + "label": "__gap", + "offset": 0, + "slot": "101", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC20BurnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol:51" + }, + { + "label": "_owner", + "offset": 0, + "slot": "151", + "type": "t_address", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22" + }, + { + "label": "__gap", + "offset": 0, + "slot": "152", + "type": "t_array(t_uint256)49_storage", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:94" + }, + { + "label": "_paused", + "offset": 0, + "slot": "201", + "type": "t_bool", + "contract": "PausableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:29" + }, + { + "label": "__gap", + "offset": 0, + "slot": "202", + "type": "t_array(t_uint256)49_storage", + "contract": "PausableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:116" + }, + { + "label": "_status", + "offset": 0, + "slot": "251", + "type": "t_uint256", + "contract": "ReentrancyGuardUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol:38" + }, + { + "label": "__gap", + "offset": 0, + "slot": "252", + "type": "t_array(t_uint256)49_storage", + "contract": "ReentrancyGuardUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol:74" + }, + { + "label": "_decimals", + "offset": 0, + "slot": "301", + "type": "t_uint8", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:130" + }, + { + "label": "keeper", + "offset": 1, + "slot": "301", + "type": "t_address", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:136" + }, + { + "label": "feePolicy", + "offset": 0, + "slot": "302", + "type": "t_contract(IFeePolicy)10399", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:140" + }, + { + "label": "_pricingStrategy_DEPRECATED", + "offset": 0, + "slot": "303", + "type": "t_address", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:146" + }, + { + "label": "_discountStrategy_DEPRECATED", + "offset": 0, + "slot": "304", + "type": "t_address", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:154" + }, + { + "label": "bondIssuer", + "offset": 0, + "slot": "305", + "type": "t_contract(IBondIssuer)10328", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:158" + }, + { + "label": "_depositBond", + "offset": 0, + "slot": "306", + "type": "t_contract(IBondController)10981", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:161" + }, + { + "label": "minTrancheMaturitySec", + "offset": 0, + "slot": "307", + "type": "t_uint256", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:165" + }, + { + "label": "maxTrancheMaturitySec", + "offset": 0, + "slot": "308", + "type": "t_uint256", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:169" + }, + { + "label": "_matureValueTargetPerc_DEPRECATED", + "offset": 0, + "slot": "309", + "type": "t_uint256", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:177" + }, + { + "label": "maxSupply", + "offset": 0, + "slot": "310", + "type": "t_uint256", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:180" + }, + { + "label": "maxDepositTrancheValuePerc", + "offset": 0, + "slot": "311", + "type": "t_uint256", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:184" + }, + { + "label": "_mintedSupplyPerTranche_DEPRECATED", + "offset": 0, + "slot": "312", + "type": "t_mapping(t_contract(ITranche)10993,t_uint256)", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:190" + }, + { + "label": "_appliedDiscounts_DEPRECATED", + "offset": 0, + "slot": "313", + "type": "t_mapping(t_contract(IERC20Upgradeable)1157,t_uint256)", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:197" + }, + { + "label": "_reserves", + "offset": 0, + "slot": "314", + "type": "t_struct(AddressSet)4620_storage", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:203" + }, + { + "label": "_matureTrancheBalance_DEPRECATED", + "offset": 0, + "slot": "316", + "type": "t_uint256", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:209" + }, + { + "label": "vault", + "offset": 0, + "slot": "317", + "type": "t_contract(IRolloverVault)10733", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:216" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_bytes32)dyn_storage": { + "label": "bytes32[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)45_storage": { + "label": "uint256[45]", + "numberOfBytes": "1440" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(IBondController)10981": { + "label": "contract IBondController", + "numberOfBytes": "20" + }, + "t_contract(IBondIssuer)10328": { + "label": "contract IBondIssuer", + "numberOfBytes": "20" + }, + "t_contract(IERC20Upgradeable)1157": { + "label": "contract IERC20Upgradeable", + "numberOfBytes": "20" + }, + "t_contract(IFeePolicy)10399": { + "label": "contract IFeePolicy", + "numberOfBytes": "20" + }, + "t_contract(IRolloverVault)10733": { + "label": "contract IRolloverVault", + "numberOfBytes": "20" + }, + "t_contract(ITranche)10993": { + "label": "contract ITranche", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "label": "mapping(address => mapping(address => uint256))", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes32,t_uint256)": { + "label": "mapping(bytes32 => uint256)", + "numberOfBytes": "32" + }, + "t_mapping(t_contract(IERC20Upgradeable)1157,t_uint256)": { + "label": "mapping(contract IERC20Upgradeable => uint256)", + "numberOfBytes": "32" + }, + "t_mapping(t_contract(ITranche)10993,t_uint256)": { + "label": "mapping(contract ITranche => uint256)", + "numberOfBytes": "32" + }, + "t_string_storage": { + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(AddressSet)4620_storage": { + "label": "struct EnumerableSetUpgradeable.AddressSet", + "members": [ + { + "label": "_inner", + "type": "t_struct(Set)4319_storage", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "64" + }, + "t_struct(Set)4319_storage": { + "label": "struct EnumerableSetUpgradeable.Set", + "members": [ + { + "label": "_values", + "type": "t_array(t_bytes32)dyn_storage", + "offset": 0, + "slot": "0" + }, + { + "label": "_indexes", + "type": "t_mapping(t_bytes32,t_uint256)", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + }, + "namespaces": {} + } + }, + "159ae25d796335c7f57c9a92c60aff87c124d8d64e7601e57473c63a4dceb073": { + "address": "0xe6592Efd4dD102C6bAc426046aB3927d8b2439c5", + "txHash": "0x135945e0ee578dd8c9ca9d28f0dbbfa48b020f44859a3c521632845d4fc56778", + "layout": { + "solcVersion": "0.8.20", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:62", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:67" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:36" + }, + { + "label": "_balances", + "offset": 0, + "slot": "51", + "type": "t_mapping(t_address,t_uint256)", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:37" + }, + { + "label": "_allowances", + "offset": 0, + "slot": "52", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:39" + }, + { + "label": "_totalSupply", + "offset": 0, + "slot": "53", + "type": "t_uint256", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:41" + }, + { + "label": "_name", + "offset": 0, + "slot": "54", + "type": "t_string_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:43" + }, + { + "label": "_symbol", + "offset": 0, + "slot": "55", + "type": "t_string_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:44" + }, + { + "label": "__gap", + "offset": 0, + "slot": "56", + "type": "t_array(t_uint256)45_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:394" + }, + { + "label": "__gap", + "offset": 0, + "slot": "101", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC20BurnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol:51" + }, + { + "label": "_owner", + "offset": 0, + "slot": "151", + "type": "t_address", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22" + }, + { + "label": "__gap", + "offset": 0, + "slot": "152", + "type": "t_array(t_uint256)49_storage", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:94" + }, + { + "label": "_paused", + "offset": 0, + "slot": "201", + "type": "t_bool", + "contract": "PausableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:29" + }, + { + "label": "__gap", + "offset": 0, + "slot": "202", + "type": "t_array(t_uint256)49_storage", + "contract": "PausableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:116" + }, + { + "label": "_status", + "offset": 0, + "slot": "251", + "type": "t_uint256", + "contract": "ReentrancyGuardUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol:38" + }, + { + "label": "__gap", + "offset": 0, + "slot": "252", + "type": "t_array(t_uint256)49_storage", + "contract": "ReentrancyGuardUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol:74" + }, + { + "label": "underlying", + "offset": 0, + "slot": "301", + "type": "t_contract(IERC20Upgradeable)1157", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:128" + }, + { + "label": "_deployed", + "offset": 0, + "slot": "302", + "type": "t_struct(AddressSet)4620_storage", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:132" + }, + { + "label": "minDeploymentAmt", + "offset": 0, + "slot": "304", + "type": "t_uint256", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:140" + }, + { + "label": "perp", + "offset": 0, + "slot": "305", + "type": "t_contract(IPerpetualTranche)10645", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:143" + }, + { + "label": "feePolicy", + "offset": 0, + "slot": "306", + "type": "t_contract(IFeePolicy)10399", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:149" + }, + { + "label": "keeper", + "offset": 0, + "slot": "307", + "type": "t_address", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:154" + }, + { + "label": "reservedUnderlyingBal", + "offset": 0, + "slot": "308", + "type": "t_uint256", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:165" + }, + { + "label": "reservedUnderlyingPerc", + "offset": 0, + "slot": "309", + "type": "t_uint256", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:169" + }, + { + "label": "lastRebalanceTimestampSec", + "offset": 0, + "slot": "310", + "type": "t_uint256", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:175" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_bytes32)dyn_storage": { + "label": "bytes32[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)45_storage": { + "label": "uint256[45]", + "numberOfBytes": "1440" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(IERC20Upgradeable)1157": { + "label": "contract IERC20Upgradeable", + "numberOfBytes": "20" + }, + "t_contract(IFeePolicy)10399": { + "label": "contract IFeePolicy", + "numberOfBytes": "20" + }, + "t_contract(IPerpetualTranche)10645": { + "label": "contract IPerpetualTranche", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "label": "mapping(address => mapping(address => uint256))", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes32,t_uint256)": { + "label": "mapping(bytes32 => uint256)", + "numberOfBytes": "32" + }, + "t_string_storage": { + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(AddressSet)4620_storage": { + "label": "struct EnumerableSetUpgradeable.AddressSet", + "members": [ + { + "label": "_inner", + "type": "t_struct(Set)4319_storage", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "64" + }, + "t_struct(Set)4319_storage": { + "label": "struct EnumerableSetUpgradeable.Set", + "members": [ + { + "label": "_values", + "type": "t_array(t_bytes32)dyn_storage", + "offset": 0, + "slot": "0" + }, + { + "label": "_indexes", + "type": "t_mapping(t_bytes32,t_uint256)", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + }, + "namespaces": {} + } + }, + "93bb1496a286db1e420729869f494bd24f9c548e5c6c54d099ba41c65bdf169a": { + "address": "0x63A5FaFC06963067FD55d9dbFE78c12eE5c09393", + "txHash": "0xff5b7f52f08a5754c9aa0f8099140199fc76770a312e60e6758727691c3b8af0", + "layout": { + "solcVersion": "0.8.20", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:62", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:67" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:36" + }, + { + "label": "_balances", + "offset": 0, + "slot": "51", + "type": "t_mapping(t_address,t_uint256)", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:37" + }, + { + "label": "_allowances", + "offset": 0, + "slot": "52", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:39" + }, + { + "label": "_totalSupply", + "offset": 0, + "slot": "53", + "type": "t_uint256", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:41" + }, + { + "label": "_name", + "offset": 0, + "slot": "54", + "type": "t_string_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:43" + }, + { + "label": "_symbol", + "offset": 0, + "slot": "55", + "type": "t_string_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:44" + }, + { + "label": "__gap", + "offset": 0, + "slot": "56", + "type": "t_array(t_uint256)45_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:394" + }, + { + "label": "__gap", + "offset": 0, + "slot": "101", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC20BurnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol:51" + }, + { + "label": "_owner", + "offset": 0, + "slot": "151", + "type": "t_address", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22" + }, + { + "label": "__gap", + "offset": 0, + "slot": "152", + "type": "t_array(t_uint256)49_storage", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:94" + }, + { + "label": "_paused", + "offset": 0, + "slot": "201", + "type": "t_bool", + "contract": "PausableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:29" + }, + { + "label": "__gap", + "offset": 0, + "slot": "202", + "type": "t_array(t_uint256)49_storage", + "contract": "PausableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:116" + }, + { + "label": "_status", + "offset": 0, + "slot": "251", + "type": "t_uint256", + "contract": "ReentrancyGuardUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol:38" + }, + { + "label": "__gap", + "offset": 0, + "slot": "252", + "type": "t_array(t_uint256)49_storage", + "contract": "ReentrancyGuardUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol:74" + }, + { + "label": "underlying", + "offset": 0, + "slot": "301", + "type": "t_contract(IERC20Upgradeable)1157", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:128" + }, + { + "label": "_deployed", + "offset": 0, + "slot": "302", + "type": "t_struct(AddressSet)4620_storage", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:132" + }, + { + "label": "minDeploymentAmt", + "offset": 0, + "slot": "304", + "type": "t_uint256", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:140" + }, + { + "label": "perp", + "offset": 0, + "slot": "305", + "type": "t_contract(IPerpetualTranche)10645", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:143" + }, + { + "label": "feePolicy", + "offset": 0, + "slot": "306", + "type": "t_contract(IFeePolicy)10399", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:149" + }, + { + "label": "keeper", + "offset": 0, + "slot": "307", + "type": "t_address", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:154" + }, + { + "label": "reservedUnderlyingBal", + "offset": 0, + "slot": "308", + "type": "t_uint256", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:165" + }, + { + "label": "reservedUnderlyingPerc", + "offset": 0, + "slot": "309", + "type": "t_uint256", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:169" + }, + { + "label": "lastRebalanceTimestampSec", + "offset": 0, + "slot": "310", + "type": "t_uint256", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:175" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_bytes32)dyn_storage": { + "label": "bytes32[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)45_storage": { + "label": "uint256[45]", + "numberOfBytes": "1440" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(IERC20Upgradeable)1157": { + "label": "contract IERC20Upgradeable", + "numberOfBytes": "20" + }, + "t_contract(IFeePolicy)10399": { + "label": "contract IFeePolicy", + "numberOfBytes": "20" + }, + "t_contract(IPerpetualTranche)10645": { + "label": "contract IPerpetualTranche", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "label": "mapping(address => mapping(address => uint256))", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes32,t_uint256)": { + "label": "mapping(bytes32 => uint256)", + "numberOfBytes": "32" + }, + "t_string_storage": { + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(AddressSet)4620_storage": { + "label": "struct EnumerableSetUpgradeable.AddressSet", + "members": [ + { + "label": "_inner", + "type": "t_struct(Set)4319_storage", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "64" + }, + "t_struct(Set)4319_storage": { + "label": "struct EnumerableSetUpgradeable.Set", + "members": [ + { + "label": "_values", + "type": "t_array(t_bytes32)dyn_storage", + "offset": 0, + "slot": "0" + }, + { + "label": "_indexes", + "type": "t_mapping(t_bytes32,t_uint256)", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + }, + "namespaces": {} + } + }, + "1fcc171b5bad80186617af35ff9be783276f937125cee7b0ecef70251af3f553": { + "address": "0xF42789840614C533c88B1789796D5429719017D6", + "txHash": "0xf5c2dded17b38e7ab8289f62b347267411255a0463916b75c645abbdacda6aab", + "layout": { + "solcVersion": "0.8.20", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:62", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:67" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:36" + }, + { + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22" + }, + { + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:94" + }, + { + "label": "targetSystemRatio", + "offset": 0, + "slot": "101", + "type": "t_uint256", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:69" + }, + { + "label": "equilibriumDR", + "offset": 0, + "slot": "102", + "type": "t_struct(Range)3847_storage", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:74" + }, + { + "label": "feeFnDRDown", + "offset": 0, + "slot": "104", + "type": "t_struct(Line)3857_storage", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:80" + }, + { + "label": "feeFnDRUp", + "offset": 0, + "slot": "108", + "type": "t_struct(Line)3857_storage", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:83" + }, + { + "label": "perpDebasementLag", + "offset": 0, + "slot": "112", + "type": "t_uint256", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:89" + }, + { + "label": "perpEnrichmentLag", + "offset": 0, + "slot": "113", + "type": "t_uint256", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:92" + }, + { + "label": "perpDebasementPercLimits", + "offset": 0, + "slot": "114", + "type": "t_struct(Range)3847_storage", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:95" + }, + { + "label": "perpEnrichmentPercLimits", + "offset": 0, + "slot": "116", + "type": "t_struct(Range)3847_storage", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:98" + }, + { + "label": "rebalanceFreqSec", + "offset": 0, + "slot": "118", + "type": "t_uint256", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:101" + }, + { + "label": "protocolSharePerc", + "offset": 0, + "slot": "119", + "type": "t_uint256", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:104" + }, + { + "label": "protocolFeeCollector", + "offset": 0, + "slot": "120", + "type": "t_address", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:107" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_struct(Line)3857_storage": { + "label": "struct Line", + "members": [ + { + "label": "x1", + "type": "t_uint256", + "offset": 0, + "slot": "0" + }, + { + "label": "y1", + "type": "t_uint256", + "offset": 0, + "slot": "1" + }, + { + "label": "x2", + "type": "t_uint256", + "offset": 0, + "slot": "2" + }, + { + "label": "y2", + "type": "t_uint256", + "offset": 0, + "slot": "3" + } + ], + "numberOfBytes": "128" + }, + "t_struct(Range)3847_storage": { + "label": "struct Range", + "members": [ + { + "label": "lower", + "type": "t_uint256", + "offset": 0, + "slot": "0" + }, + { + "label": "upper", + "type": "t_uint256", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + }, + "namespaces": {} + } } } } diff --git a/spot-contracts/README.md b/spot-contracts/README.md index dc7845f7..3ca2370a 100644 --- a/spot-contracts/README.md +++ b/spot-contracts/README.md @@ -32,7 +32,7 @@ There is a testnet deployment on Sepolia. - Bond issuer: [0x3838C8d4D092d40Cb27DD22Dafc6E1A81ea2DB60](https://sepolia.etherscan.io//address/0x3838C8d4D092d40Cb27DD22Dafc6E1A81ea2DB60) - Router: [0xE5b53ee8182086790C1ab79cbf801F0c5EE241BF](https://sepolia.etherscan.io//address/0xE5b53ee8182086790C1ab79cbf801F0c5EE241BF) - RolloverVault: [0x107614c6602A8e602952Da107B8fE62b5Ab13b04](https://sepolia.etherscan.io//address/0x107614c6602A8e602952Da107B8fE62b5Ab13b04) -- FeePolicy: [0x2DdF288F26490D1147296cC0FA2B3c4da5E15f10](https://sepolia.etherscan.io//address/0x2DdF288F26490D1147296cC0FA2B3c4da5E15f10) +- FeePolicy: [0xd90FcB328D90B778D1f6719d781045bbbac8F251](https://sepolia.etherscan.io//address/0xd90FcB328D90B778D1f6719d781045bbbac8F251) ## Contribute diff --git a/spot-contracts/tasks/helpers.ts b/spot-contracts/tasks/helpers.ts index 793cb9b0..4599b10b 100644 --- a/spot-contracts/tasks/helpers.ts +++ b/spot-contracts/tasks/helpers.ts @@ -9,9 +9,7 @@ export async function getContractFactoryFromExternalArtifacts(ethers: any, name: return ethers.getContractFactoryFromArtifact(artifact); } -export async function sleep(sleepSec: number) { - await new Promise(resolve => setTimeout(resolve, sleepSec)); -} +export const sleep = seconds => new Promise(resolve => setTimeout(resolve, seconds * 1000)); interface ContractInput { internalType: string; diff --git a/spot-contracts/tasks/ops/perp.ts b/spot-contracts/tasks/ops/perp.ts index f9a85970..249f4215 100644 --- a/spot-contracts/tasks/ops/perp.ts +++ b/spot-contracts/tasks/ops/perp.ts @@ -28,7 +28,7 @@ task("ops:perp:info") console.log("BondIssuer:", bondIssuer.target); console.log("bondFactory:", await bondIssuer.bondFactory()); console.log("collateral:", await bondIssuer.collateral()); - console.log("issuedCount:", hre.ethers.formatUnits(await bondIssuer.issuedCount()), 0); + console.log("issuedCount:", hre.ethers.formatUnits(await bondIssuer.issuedCount(), 0)); console.log("maxMaturityDuration:", hre.ethers.formatUnits(await bondIssuer.maxMaturityDuration(), 0)); console.log("minIssueTimeIntervalSec:", hre.ethers.formatUnits(await bondIssuer.minIssueTimeIntervalSec(), 0)); console.log("issueWindowOffsetSec:", hre.ethers.formatUnits(await bondIssuer.issueWindowOffsetSec(), 0)); @@ -47,13 +47,6 @@ task("ops:perp:info") console.log("---------------------------------------------------------------"); console.log("feePolicy:", feePolicy.target); console.log("owner", await feePolicy.owner()); - console.log("perpMintFeePerc:", hre.ethers.formatUnits(await feePolicy.perpMintFeePerc(), percDecimals)); - console.log("perpBurnFeePerc:", hre.ethers.formatUnits(await feePolicy.perpBurnFeePerc(), percDecimals)); - const r = await feePolicy.perpRolloverFee(); - console.log("minRolloverFeePerc:", hre.ethers.formatUnits(r.minRolloverFeePerc, percDecimals)); - console.log("perpDebasementSlope:", hre.ethers.formatUnits(r.perpDebasementSlope, percDecimals)); - console.log("perpEnrichmentSlope:", hre.ethers.formatUnits(r.perpEnrichmentSlope, percDecimals)); - console.log("---------------------------------------------------------------"); console.log("PerpetualTranche:", perp.target); console.log("proxyAdmin:", proxyAdminAddress); @@ -84,7 +77,7 @@ task("ops:perp:info") const tokenAddress = await perp.getReserveAt.staticCall(i); const balance = await perp.getReserveTokenBalance.staticCall(tokenAddress); const value = await perp.getReserveTokenValue.staticCall(tokenAddress); - const price = balance > 0n ? (value * balance * 1000) / 10n ** perpDecimals / 10n ** percDecimals : 0n; + const price = balance > 0n ? (value * 1000n) / balance : 0n; data.push({ token: tokenAddress, balance: hre.ethers.formatUnits(balance, await perp.decimals()), @@ -213,7 +206,7 @@ task("ops:perp:trancheAndDeposit") console.log("Preview mint:", collateralAmount); const totalMintAmt = await perp.computeMintAmt.staticCall(depositTranches[0].token, depositTranches[0].amount); console.log("mintAmt", hre.ethers.formatUnits(totalMintAmt, await perp.decimals())); - if (totalMintAmt.eq("0")) { + if (totalMintAmt <= 0n) { throw Error("No perp minted"); } @@ -225,7 +218,7 @@ task("ops:perp:trancheAndDeposit") console.log("Approving router to spend tokens:"); const allowance = await collateralToken.allowance(signerAddress, router.target); - if (allowance.lt(fixedPtCollateralAmount)) { + if (allowance < fixedPtCollateralAmount) { const tx1 = await collateralToken.connect(signer).approve(router.target, fixedPtCollateralAmount); await tx1.wait(); console.log("Tx", tx1.hash); @@ -243,13 +236,11 @@ task("ops:perp:trancheAndDeposit") task("ops:perp:redeem") .addParam("perpAddress", "the address of the perp contract", undefined, types.string, false) - .addParam("routerAddress", "the address of the router contract", undefined, types.string, false) .addParam("amount", "the total amount of perp tokens (in float) to redeem", undefined, types.string, false) .addParam("fromIdx", "the index of sender", 0, types.int) .setAction(async function (args: TaskArguments, hre) { - const { perpAddress, routerAddress, amount } = args; + const { perpAddress, amount } = args; - const router = await hre.ethers.getContractAt("RouterV2", routerAddress); const perp = await hre.ethers.getContractAt("PerpetualTranche", perpAddress); const fixedPtAmount = hre.ethers.parseUnits(amount, await perp.decimals()); @@ -272,17 +263,10 @@ task("ops:perp:redeem") const signerAddress = await signer.getAddress(); console.log("Signer", signerAddress); - console.log("Approving router to spend tokens:"); - if ((await perp.allowance(signerAddress, router.target)).lt(fixedPtAmount)) { - const tx1 = await perp.connect(signer).approve(router.target, fixedPtAmount); - await tx1.wait(); - console.log("Tx", tx1.hash); - } - console.log("Redeem:"); - const tx2 = await perp.connect(signer).redeem(fixedPtAmount); - await tx2.wait(); - console.log("Tx", tx2.hash); + const tx = await perp.connect(signer).redeem(fixedPtAmount); + await tx.wait(); + console.log("Tx", tx.hash); console.log("Signer balance", hre.ethers.formatUnits(await perp.balanceOf(signerAddress), await perp.decimals())); }); diff --git a/spot-contracts/tasks/ops/tranche.ts b/spot-contracts/tasks/ops/tranche.ts index 0db1d67f..121d03ef 100644 --- a/spot-contracts/tasks/ops/tranche.ts +++ b/spot-contracts/tasks/ops/tranche.ts @@ -1,7 +1,7 @@ import fs from "fs"; import { task, types } from "hardhat/config"; import { TaskArguments, HardhatRuntimeEnvironment } from "hardhat/types"; -import { constants, Contract, BigNumber, Signer } from "ethers"; +import { Contract, BigNumber, Signer, MaxUint256 } from "ethers"; import { generateGnosisSafeBatchFile, ProposedTransaction } from "../helpers"; async function matureBond(bond: Contract, signer: Signer) { @@ -38,17 +38,17 @@ function computeProportionalBalances(balances: BigNumber[], ratios: BigNumber[]) } const redeemableAmts: BigNumber[] = []; - let min = BigNumber.from(constants.MaxUint256); - for (let i = 0; i < balances.length && min.gt("0"); i++) { - const b = balances[i].sub(balances[i].mod(ratios[i])); - const d = b.mul("1000").div(ratios[i]); - if (d.lt(min)) { + let min = MaxUint256; + for (let i = 0; i < balances.length && min > 0n; i++) { + const b = balances[i] - (balances[i] % ratios[i]); + const d = (b * 1000n) / ratios[i]; + if (d < min) { min = d; } } for (let i = 0; i < balances.length; i++) { - redeemableAmts[i] = ratios[i].mul(min).div("1000"); + redeemableAmts[i] = (ratios[i] * min) / 1000n; } return redeemableAmts; } @@ -102,7 +102,7 @@ task("ops:redeemTranches") if (isMature) { for (let j = 0; j < bt.length; j++) { const b = await bt[j][0].balanceOf(signerAddress); - if (b.gt(0)) { + if (b > 0n) { console.log("Redeeming mature tranche", bt[j][0].target); const tx = await bond.connect(signer).redeemMature(bt[j][0].target, b); await tx.wait(); @@ -111,7 +111,7 @@ task("ops:redeemTranches") } } else { const redemptionAmounts = await computeRedeemableTrancheAmounts(bt, signerAddress); - if (redemptionAmounts[0].gt("0")) { + if (redemptionAmounts[0] > 0n) { console.log( "Redeeming immature bond", redemptionAmounts.map(a => a.toString()), @@ -144,7 +144,7 @@ task("ops:preview_tx:redeemTranches") if (isMature) { for (let j = 0; j < bt.length; j++) { const b = await bt[j][0].balanceOf(walletAddress); - if (b.gt(0)) { + if (b > 0n) { txs.push({ contract: bond, method: "redeemMature", @@ -154,7 +154,7 @@ task("ops:preview_tx:redeemTranches") } } else { const redemptionAmounts = await computeRedeemableTrancheAmounts(bt, walletAddress); - if (redemptionAmounts[0].gt("0")) { + if (redemptionAmounts[0] > 0n) { txs.push({ contract: bond, method: "redeem", diff --git a/spot-contracts/tasks/ops/vaults.ts b/spot-contracts/tasks/ops/vaults.ts index 4c547e8b..181b6567 100644 --- a/spot-contracts/tasks/ops/vaults.ts +++ b/spot-contracts/tasks/ops/vaults.ts @@ -30,6 +30,7 @@ task("ops:vault:info") console.log("RolloverVault:", vault.target); console.log("proxyAdmin:", proxyAdminAddress); console.log("implementation:", implAddress); + console.log("feePolicy:", feePolicy.target); console.log("owner:", await vault.owner()); console.log("paused:", await vault.paused()); console.log("perp:", perp.target); @@ -77,43 +78,23 @@ task("ops:vault:info") const vaultTVL = await vault.getTVL.staticCall(); const seniorTR = await perp.getDepositTrancheRatio.staticCall(); const juniorTR = 1000n - seniorTR; - const subscriptionRatio = (vaultTVL * seniorTR * feeOne) / perpTVL / juniorTR; - const targetSubscriptionRatio = await feePolicy.targetSubscriptionRatio(); - const expectedVaultTVL = (targetSubscriptionRatio * perpTVL * juniorTR) / seniorTR / feeOne; - const deviationRatio = await feePolicy["computeDeviationRatio((uint256,uint256))"]([perpTVL, vaultTVL, seniorTR]); + const systemRatio = (vaultTVL * feeOne) / perpTVL; + const targetSystemRatio = await feePolicy.targetSystemRatio(); + const expectedVaultTVL = (targetSystemRatio * perpTVL) / feeOne; + const deviationRatio = await feePolicy["computeDeviationRatio((uint256,uint256))"]([perpTVL, vaultTVL]); console.log("perpTVL:", hre.ethers.formatUnits(perpTVL, underlyingDecimals)); console.log("vaultTVL:", hre.ethers.formatUnits(vaultTVL, underlyingDecimals)); console.log("expectedVaultTVL:", hre.ethers.formatUnits(expectedVaultTVL, underlyingDecimals)); console.log("seniorTR:", hre.ethers.formatUnits(seniorTR, 3)); console.log("juniorTR:", hre.ethers.formatUnits(juniorTR, 3)); - console.log("subscriptionRatio:", hre.ethers.formatUnits(subscriptionRatio, feeDecimals)); - console.log("targetSubscriptionRatio:", hre.ethers.formatUnits(targetSubscriptionRatio, feeDecimals)); + console.log("systemRatio:", hre.ethers.formatUnits(systemRatio, feeDecimals)); + console.log("targetSystemRatio:", hre.ethers.formatUnits(targetSystemRatio, feeDecimals)); console.log("targetDeviationRatio:", hre.ethers.formatUnits(feeOne, feeDecimals)); - - const drHardBound = await feePolicy.drHardBound(); - console.log("deviationRatioBoundLower:", hre.ethers.formatUnits(drHardBound.lower, feeDecimals)); - console.log("deviationRatioBoundUpper:", hre.ethers.formatUnits(drHardBound.upper, feeDecimals)); console.log("deviationRatio:", hre.ethers.formatUnits(deviationRatio, feeDecimals)); console.log("---------------------------------------------------------------"); console.log("feePolicy:", feePolicy.target); console.log("owner", await feePolicy.owner()); - console.log("computeVaultMintFeePerc:", hre.ethers.formatUnits(await feePolicy.computeVaultMintFeePerc(), 8)); - console.log("computeVaultBurnFeePerc:", hre.ethers.formatUnits(await feePolicy.computeVaultBurnFeePerc(), 8)); - console.log( - "computeUnderlyingToPerpVaultSwapFeePerc:", - hre.ethers.formatUnits( - await feePolicy.computeUnderlyingToPerpVaultSwapFeePerc(deviationRatio, deviationRatio), - 8, - ), - ); - console.log( - "computePerpToUnderlyingVaultSwapFeePerc:", - hre.ethers.formatUnits( - await feePolicy.computePerpToUnderlyingVaultSwapFeePerc(deviationRatio, deviationRatio), - 8, - ), - ); console.log("---------------------------------------------------------------"); console.log("Swap slippage"); try { @@ -168,8 +149,9 @@ task("ops:vault:deposit") console.log("---------------------------------------------------------------"); console.log("Execution:"); - console.log("Approving router to spend tokens:"); - if ((await underlying.allowance(signerAddress, vault.target)).lt(fixedPtAmount)) { + console.log("Approving vault to spend tokens:"); + const allowance = await underlying.allowance(signerAddress, vault.target); + if (allowance < fixedPtAmount) { const tx1 = await underlying.connect(signer).approve(vault.target, fixedPtAmount); await tx1.wait(); console.log("Tx", tx1.hash); @@ -235,6 +217,170 @@ task("ops:vault:redeem") ); }); +task("ops:vault:mint2") + .addParam("vaultAddress", "the address of the vault contract", undefined, types.string, false) + .addParam( + "underlyingAmount", + "the total amount of underlying tokens (in float) to deposit", + undefined, + types.string, + false, + ) + .addParam("fromIdx", "the index of sender", 0, types.int) + .setAction(async function (args: TaskArguments, hre) { + const { vaultAddress, underlyingAmount } = args; + + const vault = await hre.ethers.getContractAt("RolloverVault", vaultAddress); + const perp = await hre.ethers.getContractAt("PerpetualTranche", await vault.perp()); + const underlying = await hre.ethers.getContractAt("MockERC20", await vault.underlying()); + const fixedPtAmount = hre.ethers.parseUnits(underlyingAmount, await underlying.decimals()); + + const signer = (await hre.ethers.getSigners())[args.fromIdx]; + const signerAddress = await signer.getAddress(); + console.log("Signer", signerAddress); + + console.log( + "Signer perp balance", + hre.ethers.formatUnits(await perp.balanceOf(signerAddress), await perp.decimals()), + ); + console.log( + "Signer note balance", + hre.ethers.formatUnits(await vault.balanceOf(signerAddress), await vault.decimals()), + ); + console.log( + "Signer underlying balance", + hre.ethers.formatUnits(await underlying.balanceOf(signerAddress), await underlying.decimals()), + ); + + console.log("---------------------------------------------------------------"); + console.log("Execution:"); + console.log("Approving vault to spend tokens:"); + const allowance = await underlying.allowance(signerAddress, vault.target); + if (allowance < fixedPtAmount) { + const tx1 = await underlying.connect(signer).approve(vault.target, fixedPtAmount); + await tx1.wait(); + console.log("Tx", tx1.hash); + } + + console.log("Mint2:"); + const tx3 = await vault.connect(signer).mint2(fixedPtAmount); + await tx3.wait(); + console.log("Tx", tx3.hash); + + console.log( + "Signer perp balance", + hre.ethers.formatUnits(await perp.balanceOf(signerAddress), await perp.decimals()), + ); + console.log( + "Signer note balance", + hre.ethers.formatUnits(await vault.balanceOf(signerAddress), await vault.decimals()), + ); + console.log( + "Signer underlying balance", + hre.ethers.formatUnits(await underlying.balanceOf(signerAddress), await underlying.decimals()), + ); + }); + +task("ops:vault:redeem2") + .addParam("vaultAddress", "the address of the vault contract", undefined, types.string, false) + .addParam("perpAmount", "the total amount of perp tokens (in float) to redeem", undefined, types.string, false) + .addParam("noteAmount", "the total amount of vault notes (in float) to redeem", undefined, types.string, false) + .addParam("fromIdx", "the index of sender", 0, types.int) + .setAction(async function (args: TaskArguments, hre) { + const { vaultAddress, perpAmount, noteAmount } = args; + + const vault = await hre.ethers.getContractAt("RolloverVault", vaultAddress); + const perp = await hre.ethers.getContractAt("PerpetualTranche", await vault.perp()); + const underlying = await hre.ethers.getContractAt("MockERC20", await vault.underlying()); + const underlyingDecimals = await underlying.decimals(); + const fixedPtPerpAmount = hre.ethers.parseUnits(perpAmount, await perp.decimals()); + const fixedPtNoteAmount = hre.ethers.parseUnits(noteAmount, await vault.decimals()); + + const signer = (await hre.ethers.getSigners())[args.fromIdx]; + const signerAddress = await signer.getAddress(); + console.log("Signer", signerAddress); + console.log( + "Signer perp balance", + hre.ethers.formatUnits(await perp.balanceOf(signerAddress), await perp.decimals()), + ); + console.log( + "Signer note balance", + hre.ethers.formatUnits(await vault.balanceOf(signerAddress), await vault.decimals()), + ); + console.log( + "Signer underlying balance", + hre.ethers.formatUnits(await underlying.balanceOf(signerAddress), await underlying.decimals()), + ); + + console.log("---------------------------------------------------------------"); + console.log("Approving vault to spend perp tokens:", perpAmount); + const allowance = await perp.allowance(signerAddress, vault.target); + if (allowance < fixedPtPerpAmount) { + const tx = await perp.connect(signer).approve(vault.target, fixedPtPerpAmount); + await tx.wait(); + console.log("Tx", tx.hash); + } + + console.log("---------------------------------------------------------------"); + console.log("Preview redeem:", perpAmount, noteAmount); + const redemptions = await vault.redeem2.staticCall(fixedPtPerpAmount, fixedPtNoteAmount); + console.log( + "Redeeming:", + hre.ethers.formatUnits(redemptions[0], await perp.decimals()), + hre.ethers.formatUnits(redemptions[1], await vault.decimals()), + ); + const redemptionData = []; + for (let i = 0; i < redemptions[2].length; i++) { + const token = await hre.ethers.getContractAt("MockERC20", redemptions[2][i].token); + redemptionData.push({ + asset: await token.symbol(), + amount: hre.ethers.formatUnits(redemptions[2][i].amount, underlyingDecimals), + }); + } + console.table(redemptionData); + + console.log("---------------------------------------------------------------"); + console.log("Execution:"); + console.log("Redeem:"); + const tx = await vault.connect(signer).redeem2(fixedPtPerpAmount, fixedPtNoteAmount); + await tx.wait(); + console.log("Tx", tx.hash); + + console.log("---------------------------------------------------------------"); + console.log( + "Signer perp balance", + hre.ethers.formatUnits(await perp.balanceOf(signerAddress), await perp.decimals()), + ); + console.log( + "Signer note balance", + hre.ethers.formatUnits(await vault.balanceOf(signerAddress), await vault.decimals()), + ); + console.log( + "Signer underlying balance", + hre.ethers.formatUnits(await underlying.balanceOf(signerAddress), await underlying.decimals()), + ); + }); + +task("ops:vault:rebalance") + .addParam("vaultAddress", "the address of the vault contract", undefined, types.string, false) + .addParam("fromIdx", "the index of sender", 0, types.int) + .setAction(async function (args: TaskArguments, hre) { + const { vaultAddress } = args; + + const vault = await hre.ethers.getContractAt("RolloverVault", vaultAddress); + + console.log("---------------------------------------------------------------"); + console.log("Execution:"); + const signer = (await hre.ethers.getSigners())[args.fromIdx]; + const signerAddress = await signer.getAddress(); + console.log("Signer", signerAddress); + + console.log("rebalance:"); + const tx = await vault.connect(signer).rebalance(); + await tx.wait(); + console.log("Tx", tx.hash); + }); + task("ops:vault:recoverAndRedeploy") .addParam("vaultAddress", "the address of the vault contract", undefined, types.string, false) .addParam("fromIdx", "the index of sender", 0, types.int) @@ -295,27 +441,6 @@ task("ops:vault:recover") console.log("Tx", tx.hash); }); -task("ops:fee:setSwapFees", "Updates swap fees in fee policy") - .addParam("address", "the fee policy contract", undefined, types.string, false) - .addParam("feePerc", "the percentage to be set as the swap fee", undefined, types.string, false) - .setAction(async function (args: TaskArguments, hre) { - const { address, feePerc } = args; - const signer = (await hre.ethers.getSigners())[0]; - const signerAddress = await signer.getAddress(); - console.log("Signer", signerAddress); - const feePolicy = await hre.ethers.getContractAt("FeePolicy", address); - console.log(`Updating both swap fees to ${feePerc}`); - const feeAmtFixedPt = hre.ethers.parseUnits(feePerc, await feePolicy.decimals()); - - const tx1 = await feePolicy.updateVaultUnderlyingToPerpSwapFeePerc(feeAmtFixedPt); - console.log(tx1.hash); - await tx1.wait(); - - const tx2 = await feePolicy.updateVaultPerpToUnderlyingSwapFeePerc(feeAmtFixedPt); - console.log(tx2.hash); - await tx2.wait(); - }); - task("ops:vault:swapUnderlyingForPerps") .addParam("vaultAddress", "the address of the vault contract", undefined, types.string, false) .addParam( @@ -349,8 +474,9 @@ task("ops:vault:swapUnderlyingForPerps") console.log("---------------------------------------------------------------"); console.log("Execution:"); - console.log("Approving router to spend tokens:"); - if ((await underlying.allowance(signerAddress, vault.target)).lt(fixedPtAmount)) { + console.log("Approving vault to spend tokens:"); + const allowance = await underlying.allowance(signerAddress, vault.target); + if (allowance < fixedPtAmount) { const tx1 = await underlying.connect(signer).approve(vault.target, fixedPtAmount); await tx1.wait(); console.log("Tx", tx1.hash); @@ -398,8 +524,9 @@ task("ops:vault:swapPerpsForUnderlying") console.log("---------------------------------------------------------------"); console.log("Execution:"); - console.log("Approving router to spend tokens:"); - if ((await perp.allowance(signerAddress, vault.target)).lt(fixedPtAmount)) { + console.log("Approving vault to spend tokens:"); + const allowance = await perp.allowance(signerAddress, vault.target); + if (allowance < fixedPtAmount) { const tx1 = await perp.connect(signer).approve(vault.target, fixedPtAmount); await tx1.wait(); console.log("Tx", tx1.hash); diff --git a/spot-contracts/tasks/scripts/sepolia.sh b/spot-contracts/tasks/scripts/sepolia.sh index 97f54a10..0b34d34d 100644 --- a/spot-contracts/tasks/scripts/sepolia.sh +++ b/spot-contracts/tasks/scripts/sepolia.sh @@ -29,15 +29,13 @@ yarn hardhat --network sepolia ops:perp:updateTolerableTrancheMaturity \ --minimum 600 \ --maximum 3600 -yarn hardhat --network sepolia ops:fee:setSwapFees \ - --address "0x2DdF288F26490D1147296cC0FA2B3c4da5E15f10" \ - --fee-perc "0.05" - ######################################################################## ## OPS yarn hardhat --network sepolia ops:perp:info 0xdcCef9065876fD654bAddeBAa778FDA43E0bfC1F yarn hardhat --network sepolia ops:vault:info 0x107614c6602A8e602952Da107B8fE62b5Ab13b04 yarn hardhat --network sepolia ops:perp:updateState 0xdcCef9065876fD654bAddeBAa778FDA43E0bfC1F +yarn hardhat --network sepolia ops:vault:rebalance \ + --vault-address 0x107614c6602A8e602952Da107B8fE62b5Ab13b04 yarn hardhat --network sepolia ops:vault:recoverAndRedeploy \ --vault-address 0x107614c6602A8e602952Da107B8fE62b5Ab13b04 yarn hardhat --network sepolia ops:vault:deploy \ @@ -56,7 +54,6 @@ yarn hardhat --network sepolia ops:perp:trancheAndDeposit \ --collateral-amount 250 yarn hardhat --network sepolia ops:perp:redeem \ - --router-address 0x5B59915E5754C62C40Ba5e7467382ced958F8559 \ --perp-address 0xdcCef9065876fD654bAddeBAa778FDA43E0bfC1F \ --amount 10 @@ -69,6 +66,14 @@ yarn hardhat --network sepolia ops:vault:redeem \ --vault-address 0x107614c6602A8e602952Da107B8fE62b5Ab13b04 \ --amount "0.001" +yarn hardhat --network sepolia ops:vault:mint2 \ + --vault-address 0x107614c6602A8e602952Da107B8fE62b5Ab13b04 \ + --underlying-amount 250 + +yarn hardhat --network sepolia ops:vault:redeem2 \ + --vault-address 0x107614c6602A8e602952Da107B8fE62b5Ab13b04 \ + --perp-amount 250 --note-amount 1 + yarn hardhat --network sepolia ops:vault:swapUnderlyingForPerps \ --vault-address 0x107614c6602A8e602952Da107B8fE62b5Ab13b04 \ --underlying-amount 10 diff --git a/spot-contracts/tasks/upgrade/index.ts b/spot-contracts/tasks/upgrade/index.ts index 88d7ac4f..34b717bd 100644 --- a/spot-contracts/tasks/upgrade/index.ts +++ b/spot-contracts/tasks/upgrade/index.ts @@ -66,10 +66,10 @@ task("upgrade:testnet") console.log("Proxy", address); console.log("Current implementation", await getImplementationAddress(hre.ethers.provider, address)); - const impl = await hre.upgrades.upgradeProxy(address, Factory, { + await hre.upgrades.upgradeProxy(address, Factory, { unsafeAllowRenames: true, }); - await impl.deployed(); + await sleep(30); const newImpl = await getImplementationAddress(hre.ethers.provider, address); console.log("Updated implementation", newImpl); @@ -78,3 +78,47 @@ task("upgrade:testnet") address: newImpl, }); }); + +task("upgrade:testnet:RolloverVault") + .addPositionalParam("address", "the address of the deployed proxy contract", undefined, types.string, false) + .addParam("trancheManagerAddress", "the address of the linked tranche manager", "0x", types.string) + .addParam("fromIdx", "the index of sender", 0, types.int) + .setAction(async function (args: TaskArguments, hre) { + const signer = (await hre.ethers.getSigners())[args.fromIdx]; + const signerAddress = await signer.getAddress(); + console.log("Signer", signerAddress); + + let trancheManagerAddress = args.trancheManagerAddress; + if (trancheManagerAddress === "0x") { + const TrancheManager = await hre.ethers.getContractFactory("TrancheManager"); + const trancheManager = await TrancheManager.deploy(); + trancheManagerAddress = trancheManager.target; + console.log("Deploying linked library TrancheManager", trancheManagerAddress); + } + const Factory = await hre.ethers.getContractFactory("RolloverVault", { + libraries: { + TrancheManager: trancheManagerAddress, + }, + }); + + const { address } = args; + console.log("Proxy", address); + console.log("Current implementation", await getImplementationAddress(hre.ethers.provider, address)); + + await hre.upgrades.upgradeProxy(address, Factory, { + unsafeAllowRenames: true, + unsafeAllowLinkedLibraries: true, + }); + await sleep(30); + const newImpl = await getImplementationAddress(hre.ethers.provider, address); + console.log("Updated implementation", newImpl); + + await sleep(30); + await hre.run("verify:contract", { + address: trancheManagerAddress, + }); + await sleep(30); + await hre.run("verify:contract", { + address: newImpl, + }); + }); diff --git a/spot-vaults/.openzeppelin/sepolia.json b/spot-vaults/.openzeppelin/sepolia.json index 6087f3cb..4e464dd5 100644 --- a/spot-vaults/.openzeppelin/sepolia.json +++ b/spot-vaults/.openzeppelin/sepolia.json @@ -326,6 +326,325 @@ }, "namespaces": {} } + }, + "7f703e4a10347cca6e80b8d427a010abcbb83e0b8f3039d52b3a4a4aae5948ff": { + "address": "0x047b82a5D79d9DF62dE4f34CbaBa83F71848a6BF", + "txHash": "0xda1e4afb92b889dce9982b6ff84671a677d7735194299577ca14e1d7a3091cce", + "layout": { + "solcVersion": "0.8.24", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:63", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:68" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:40" + }, + { + "label": "_balances", + "offset": 0, + "slot": "51", + "type": "t_mapping(t_address,t_uint256)", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:40" + }, + { + "label": "_allowances", + "offset": 0, + "slot": "52", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:42" + }, + { + "label": "_totalSupply", + "offset": 0, + "slot": "53", + "type": "t_uint256", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:44" + }, + { + "label": "_name", + "offset": 0, + "slot": "54", + "type": "t_string_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:46" + }, + { + "label": "_symbol", + "offset": 0, + "slot": "55", + "type": "t_string_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:47" + }, + { + "label": "__gap", + "offset": 0, + "slot": "56", + "type": "t_array(t_uint256)45_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:376" + }, + { + "label": "__gap", + "offset": 0, + "slot": "101", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC20BurnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol:51" + }, + { + "label": "_owner", + "offset": 0, + "slot": "151", + "type": "t_address", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22" + }, + { + "label": "__gap", + "offset": 0, + "slot": "152", + "type": "t_array(t_uint256)49_storage", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:94" + }, + { + "label": "_paused", + "offset": 0, + "slot": "201", + "type": "t_bool", + "contract": "PausableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:29" + }, + { + "label": "__gap", + "offset": 0, + "slot": "202", + "type": "t_array(t_uint256)49_storage", + "contract": "PausableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:116" + }, + { + "label": "_status", + "offset": 0, + "slot": "251", + "type": "t_uint256", + "contract": "ReentrancyGuardUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol:38" + }, + { + "label": "__gap", + "offset": 0, + "slot": "252", + "type": "t_array(t_uint256)49_storage", + "contract": "ReentrancyGuardUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol:88" + }, + { + "label": "perp", + "offset": 0, + "slot": "301", + "type": "t_contract(IPerpetualTranche)2878", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:94" + }, + { + "label": "usd", + "offset": 0, + "slot": "302", + "type": "t_contract(IERC20Upgradeable)5020", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:97" + }, + { + "label": "usdUnitAmt", + "offset": 0, + "slot": "303", + "type": "t_uint256", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:100" + }, + { + "label": "perpUnitAmt", + "offset": 0, + "slot": "304", + "type": "t_uint256", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:103" + }, + { + "label": "keeper", + "offset": 0, + "slot": "305", + "type": "t_address", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:108" + }, + { + "label": "oracle", + "offset": 0, + "slot": "306", + "type": "t_contract(IPerpPricer)13600", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:111" + }, + { + "label": "fees", + "offset": 0, + "slot": "307", + "type": "t_struct(BillBrokerFees)13657_storage", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:114" + }, + { + "label": "arHardBound", + "offset": 0, + "slot": "314", + "type": "t_struct(Range)13689_storage", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:117" + }, + { + "label": "arSoftBound", + "offset": 0, + "slot": "316", + "type": "t_struct(Range)13689_storage", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:121" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)45_storage": { + "label": "uint256[45]", + "numberOfBytes": "1440" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(IERC20Upgradeable)5020": { + "label": "contract IERC20Upgradeable", + "numberOfBytes": "20" + }, + "t_contract(IPerpPricer)13600": { + "label": "contract IPerpPricer", + "numberOfBytes": "20" + }, + "t_contract(IPerpetualTranche)2878": { + "label": "contract IPerpetualTranche", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "label": "mapping(address => mapping(address => uint256))", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)", + "numberOfBytes": "32" + }, + "t_string_storage": { + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(BillBrokerFees)13657_storage": { + "label": "struct BillBrokerFees", + "members": [ + { + "label": "mintFeePerc", + "type": "t_uint256", + "offset": 0, + "slot": "0" + }, + { + "label": "burnFeePerc", + "type": "t_uint256", + "offset": 0, + "slot": "1" + }, + { + "label": "perpToUSDSwapFeeFactors", + "type": "t_struct(Range)13689_storage", + "offset": 0, + "slot": "2" + }, + { + "label": "usdToPerpSwapFeeFactors", + "type": "t_struct(Range)13689_storage", + "offset": 0, + "slot": "4" + }, + { + "label": "protocolSwapSharePerc", + "type": "t_uint256", + "offset": 0, + "slot": "6" + } + ], + "numberOfBytes": "224" + }, + "t_struct(Range)13689_storage": { + "label": "struct Range", + "members": [ + { + "label": "lower", + "type": "t_uint256", + "offset": 0, + "slot": "0" + }, + { + "label": "upper", + "type": "t_uint256", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + }, + "namespaces": {} + } } } } diff --git a/spot-vaults/README.md b/spot-vaults/README.md index e915bacc..c244e963 100644 --- a/spot-vaults/README.md +++ b/spot-vaults/README.md @@ -12,7 +12,7 @@ The official mainnet addresses are: The official testnet addresses are: - Bill Broker (SPOT-USDC): [0xc3f6D1F1d253EdC8B34D78Bc6cDD2b3eEFAd76BD](https://sepolia.etherscan.io/address/0xc3f6D1F1d253EdC8B34D78Bc6cDD2b3eEFAd76BD) -- SpotAppraiser **(deprecated)**: [0x08c5b39F000705ebeC8427C1d64D6262392944EE](https://sepolia.etherscan.io/address/0x08c5b39F000705ebeC8427C1d64D6262392944EE) +- SpotPricer: [0xc3B2C246b61123E7d18dc8d831A8314Eb038beE5](https://sepolia.etherscan.io/address/0xc3B2C246b61123E7d18dc8d831A8314Eb038beE5) ## Install diff --git a/spot-vaults/contracts/_test/MockSpotPricer.sol b/spot-vaults/contracts/_test/MockSpotPricer.sol new file mode 100644 index 00000000..e263dd77 --- /dev/null +++ b/spot-vaults/contracts/_test/MockSpotPricer.sol @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: BUSL-1.1 +pragma solidity ^0.8.24; + +import { Math } from "@openzeppelin/contracts/utils/math/Math.sol"; +import { IPerpetualTranche } from "../_interfaces/external/IPerpetualTranche.sol"; + +/** + * @title MockSpotPricer + * + * @notice SpotPricer for bill broker testnet deployment. + * + */ +contract MockSpotPricer { + using Math for uint256; + uint256 private constant DECIMALS = 18; + uint256 private constant ONE = (10 ** DECIMALS); + + IPerpetualTranche public immutable SPOT; + + constructor(IPerpetualTranche spot) { + SPOT = spot; + } + + function decimals() external pure returns (uint8) { + return uint8(DECIMALS); + } + + function usdPrice() external pure returns (uint256, bool) { + return (ONE, true); + } + + function perpUsdPrice() external returns (uint256, bool) { + return perpFmvUsdPrice(); + } + + function perpFmvUsdPrice() public returns (uint256, bool) { + (uint256 targetPrice, bool targetPriceValid) = amplTargetUsdPrice(); + return (targetPrice.mulDiv(SPOT.getTVL(), SPOT.totalSupply()), targetPriceValid); + } + + function amplTargetUsdPrice() public pure returns (uint256, bool) { + return (ONE.mulDiv(121, 100), true); + } +} diff --git a/spot-vaults/package.json b/spot-vaults/package.json index 12986136..860a7d79 100644 --- a/spot-vaults/package.json +++ b/spot-vaults/package.json @@ -62,7 +62,7 @@ "ethers": "^6.6.0", "ethers-v5": "npm:ethers@^5.7.0", "ganache-cli": "latest", - "hardhat": "^2.22.18", + "hardhat": "^2.24.1", "hardhat-gas-reporter": "latest", "lodash": "^4.17.21", "prettier": "^2.7.1", diff --git a/spot-vaults/tasks/deploy.ts b/spot-vaults/tasks/deploy.ts index 07ae73d6..f7a1e2b8 100644 --- a/spot-vaults/tasks/deploy.ts +++ b/spot-vaults/tasks/deploy.ts @@ -17,6 +17,36 @@ task("deploy:mocks").setAction(async function (args: TaskArguments, hre) { await cpiOracle.mockData("1200000000000000000", true); }); +task("deploy:MockSpotPricer") + .addParam( + "spot", + "the address of the testnet spot token", + undefined, + types.string, + false, + ) + .addParam("verify", "flag to set false for local deployments", true, types.boolean) + .setAction(async function (args: TaskArguments, hre) { + const deployer = (await hre.ethers.getSigners())[0]; + console.log("Signer", await deployer.getAddress()); + + const { spot } = args; + + const MockSpotPricer = await hre.ethers.getContractFactory("MockSpotPricer"); + const mockSpotPricer = await MockSpotPricer.deploy(spot); + console.log("spotPricer", mockSpotPricer.target); + + if (args.verify) { + await sleep(30); + await hre.run("verify:contract", { + address: mockSpotPricer.target, + constructorArguments: [spot], + }); + } else { + console.log("Skipping verification"); + } + }); + task("deploy:SpotPricer") .addParam( "wethWamplPool", diff --git a/spot-vaults/tasks/info.ts b/spot-vaults/tasks/info.ts index 9cb18ac4..5d976688 100644 --- a/spot-vaults/tasks/info.ts +++ b/spot-vaults/tasks/info.ts @@ -95,8 +95,8 @@ task("info:BillBroker") const oracle = await hre.ethers.getContractAt( "SpotPricer", - // await billBroker.oracle.staticCall(), - "0x0f8f519878c10ce36C6aAF89c1AeefaaDE5D7881", + await billBroker.oracle.staticCall(), + // "0x0f8f519878c10ce36C6aAF89c1AeefaaDE5D7881", ); const oracleDecimals = await oracle.decimals(); console.log("---------------------------------------------------------------"); @@ -104,7 +104,7 @@ task("info:BillBroker") const usdPriceCall = await oracle.usdPrice.staticCall(); console.log("usdPrice:", pp(usdPriceCall[0], oracleDecimals)); console.log("usdPriceValid:", usdPriceCall[1]); - const perpPriceCall = await oracle.perpUsdPrice.staticCall(); + const perpPriceCall = await oracle.perpFmvUsdPrice.staticCall(); console.log("perpPrice:", pp(perpPriceCall[0], oracleDecimals)); console.log("perpPriceValid:", perpPriceCall[1]); console.log("---------------------------------------------------------------"); @@ -169,12 +169,12 @@ task("info:BillBroker") unitPerp * swapAmt, ), usdDecimals, - ) / parseInt(swapAmt), + ) / parseFloat(swapAmt), `usd per perp`, ); console.log( `~Sell price for ${swapAmt} perp: `, - parseInt(swapAmt) / + parseFloat(swapAmt) / pp( await billBroker["computeUSDToPerpSwapAmt(uint256)"].staticCall( unitUsd * swapAmt, @@ -187,7 +187,6 @@ task("info:BillBroker") console.log("---------------------------------------------------------------"); } catch (e) { console.log(e); - console.log("ReserveState: NA"); console.log("---------------------------------------------------------------"); } }); diff --git a/spot-vaults/tasks/ops.ts b/spot-vaults/tasks/ops.ts index 2533f01d..4283edb4 100644 --- a/spot-vaults/tasks/ops.ts +++ b/spot-vaults/tasks/ops.ts @@ -113,6 +113,122 @@ task("ops:deposit", "Deposits perp and usd tokens to mint bb lp tokens") ); }); +task("ops:depositPerp", "Deposits perp tokens to mint bb lp tokens") + .addParam( + "address", + "the address of the bill broker contract", + undefined, + types.string, + false, + ) + .addParam( + "perpAmount", + "the total amount of usd tokens (in float) to deposit", + undefined, + types.string, + false, + ) + .setAction(async function (args: TaskArguments, hre) { + const signer = (await hre.ethers.getSigners())[0]; + const signerAddress = await signer.getAddress(); + console.log("Signer", signerAddress); + + const { address, perpAmount } = args; + const billBroker = await hre.ethers.getContractAt("BillBroker", address); + const perp = await hre.ethers.getContractAt("ERC20", await billBroker.perp()); + const perpFixedPtAmount = ethers.parseUnits(perpAmount, await perp.decimals()); + + console.log( + "Signer perp balance", + ethers.formatUnits(await perp.balanceOf(signerAddress), await perp.decimals()), + ); + + console.log("---------------------------------------------------------------"); + console.log("Execution:"); + console.log("Approving router to spend tokens:"); + if ((await perp.allowance(signerAddress, billBroker.target)) < perpFixedPtAmount) { + const tx = await perp.connect(signer).approve(billBroker.target, perpFixedPtAmount); + await tx.wait(); + console.log("Tx", tx.hash); + } + + console.log("Deposit:"); + const tx = await billBroker.connect(signer).depositPerp(perpFixedPtAmount, 0); + await tx.wait(); + console.log("Tx", tx.hash); + + console.log( + "Signer lp balance", + ethers.formatUnits( + await billBroker.balanceOf(signerAddress), + await billBroker.decimals(), + ), + ); + console.log( + "Signer perp balance", + ethers.formatUnits(await perp.balanceOf(signerAddress), await perp.decimals()), + ); + }); + +task("ops:depositUSD", "Deposits usd tokens to mint bb lp tokens") + .addParam( + "address", + "the address of the bill broker contract", + undefined, + types.string, + false, + ) + .addParam( + "usdAmount", + "the total amount of usd tokens (in float) to deposit", + undefined, + types.string, + false, + ) + .setAction(async function (args: TaskArguments, hre) { + const signer = (await hre.ethers.getSigners())[0]; + const signerAddress = await signer.getAddress(); + console.log("Signer", signerAddress); + + const { address, usdAmount } = args; + const billBroker = await hre.ethers.getContractAt("BillBroker", address); + const usd = await hre.ethers.getContractAt("ERC20", await billBroker.usd()); + const usdFixedPtAmount = ethers.parseUnits(usdAmount, await usd.decimals()); + + console.log( + "Signer usd balance", + ethers.formatUnits(await usd.balanceOf(signerAddress), await usd.decimals()), + ); + + console.log("---------------------------------------------------------------"); + console.log("Execution:"); + console.log("Approving router to spend tokens:"); + if ((await usd.allowance(signerAddress, billBroker.target)) < usdFixedPtAmount) { + const tx = await usd.connect(signer).approve(billBroker.target, usdFixedPtAmount); + await tx.wait(); + console.log("Tx", tx.hash); + } + + console.log("Deposit:"); + const tx = await billBroker + .connect(signer) + .depositUSD(usdFixedPtAmount, hre.ethers.MaxUint256); + await tx.wait(); + console.log("Tx", tx.hash); + + console.log( + "Signer lp balance", + ethers.formatUnits( + await billBroker.balanceOf(signerAddress), + await billBroker.decimals(), + ), + ); + console.log( + "Signer usd balance", + ethers.formatUnits(await usd.balanceOf(signerAddress), await usd.decimals()), + ); + }); + task("ops:redeem") .addParam( "address", diff --git a/spot-vaults/tasks/scripts/sepolia.sh b/spot-vaults/tasks/scripts/sepolia.sh index c2079221..86ac002e 100644 --- a/spot-vaults/tasks/scripts/sepolia.sh +++ b/spot-vaults/tasks/scripts/sepolia.sh @@ -28,6 +28,14 @@ yarn hardhat --network sepolia ops:deposit \ --perp-amount 1000 \ --usd-amount 1000 +yarn hardhat --network sepolia ops:depositPerp \ + --address "0xc3f6D1F1d253EdC8B34D78Bc6cDD2b3eEFAd76BD" \ + --perp-amount 10 + +yarn hardhat --network sepolia ops:depositUSD \ + --address "0xc3f6D1F1d253EdC8B34D78Bc6cDD2b3eEFAd76BD" \ + --usd-amount 10 + yarn hardhat --network sepolia ops:swapUSDForPerps \ --address "0xc3f6D1F1d253EdC8B34D78Bc6cDD2b3eEFAd76BD" \ --usd-amount 10 diff --git a/spot-vaults/tasks/upgrade.ts b/spot-vaults/tasks/upgrade.ts index d47cdd94..9937088c 100644 --- a/spot-vaults/tasks/upgrade.ts +++ b/spot-vaults/tasks/upgrade.ts @@ -105,10 +105,10 @@ task("upgrade:testnet") await getImplementationAddress(hre.ethers.provider, address), ); - const impl = await hre.upgrades.upgradeProxy(address, Factory, { + await hre.upgrades.upgradeProxy(address, Factory, { unsafeAllowRenames: true, }); - await impl.deployed(); + await sleep(30); const newImpl = await getImplementationAddress(hre.ethers.provider, address); console.log("Updated implementation", newImpl); diff --git a/yarn.lock b/yarn.lock index 9e3dcae1..45fbef16 100644 --- a/yarn.lock +++ b/yarn.lock @@ -157,7 +157,7 @@ __metadata: ethers: ^6.6.0 ethers-v5: "npm:ethers@^5.7.0" ganache-cli: latest - hardhat: ^2.22.18 + hardhat: ^2.24.1 hardhat-gas-reporter: latest lodash: ^4.17.21 prettier: ^2.7.1 @@ -7457,7 +7457,7 @@ __metadata: languageName: node linkType: hard -"hardhat@npm:^2.22.18, hardhat@npm:^2.23.0": +"hardhat@npm:^2.23.0": version: 2.24.0 resolution: "hardhat@npm:2.24.0" dependencies: @@ -7516,6 +7516,65 @@ __metadata: languageName: node linkType: hard +"hardhat@npm:^2.24.1": + version: 2.24.1 + resolution: "hardhat@npm:2.24.1" + dependencies: + "@ethereumjs/util": ^9.1.0 + "@ethersproject/abi": ^5.1.2 + "@nomicfoundation/edr": ^0.11.0 + "@nomicfoundation/solidity-analyzer": ^0.1.0 + "@sentry/node": ^5.18.1 + "@types/bn.js": ^5.1.0 + "@types/lru-cache": ^5.1.0 + adm-zip: ^0.4.16 + aggregate-error: ^3.0.0 + ansi-escapes: ^4.3.0 + boxen: ^5.1.2 + chokidar: ^4.0.0 + ci-info: ^2.0.0 + debug: ^4.1.1 + enquirer: ^2.3.0 + env-paths: ^2.2.0 + ethereum-cryptography: ^1.0.3 + find-up: ^5.0.0 + fp-ts: 1.19.3 + fs-extra: ^7.0.1 + immutable: ^4.0.0-rc.12 + io-ts: 1.10.4 + json-stream-stringify: ^3.1.4 + keccak: ^3.0.2 + lodash: ^4.17.11 + micro-eth-signer: ^0.14.0 + mnemonist: ^0.38.0 + mocha: ^10.0.0 + p-map: ^4.0.0 + picocolors: ^1.1.0 + raw-body: ^2.4.1 + resolve: 1.17.0 + semver: ^6.3.0 + solc: 0.8.26 + source-map-support: ^0.5.13 + stacktrace-parser: ^0.1.10 + tinyglobby: ^0.2.6 + tsort: 0.0.1 + undici: ^5.14.0 + uuid: ^8.3.2 + ws: ^7.4.6 + peerDependencies: + ts-node: "*" + typescript: "*" + peerDependenciesMeta: + ts-node: + optional: true + typescript: + optional: true + bin: + hardhat: internal/cli/bootstrap.js + checksum: 98fa6022a25986343318709e2699c0f1b1c466e68fe6074a6e838ddeddb2cb53ccb9d6f572e809513a30eefa82a00fcad2220c5e2c7f9fad4f1436c9755c01d9 + languageName: node + linkType: hard + "has-bigints@npm:^1.0.2": version: 1.1.0 resolution: "has-bigints@npm:1.1.0" From dde1112ffc9f46c54eb6e747ad3a709b71ffeb56 Mon Sep 17 00:00:00 2001 From: Aalavandhan <6264334+aalavandhan@users.noreply.github.com> Date: Tue, 1 Jul 2025 13:36:51 -0400 Subject: [PATCH 07/18] Mainnet deployment v5 (#259) * mainnet deployment * bill broker update * ran yarn install * notes --- spot-contracts/.openzeppelin/mainnet.json | 916 +++++++++++++++++++++ spot-contracts/.openzeppelin/sepolia.json | 228 +++++ spot-contracts/README.md | 2 +- spot-contracts/deployments/mainnet.json | 2 +- spot-contracts/hardhat.config.ts | 5 +- spot-contracts/package.json | 2 +- spot-contracts/tasks/scripts/mainnet_v5.sh | 34 + spot-contracts/tasks/upgrade/index.ts | 69 ++ spot-vaults/.openzeppelin/mainnet.json | 345 +++++++- spot-vaults/hardhat.config.ts | 3 +- yarn.lock | 17 +- 11 files changed, 1603 insertions(+), 20 deletions(-) create mode 100644 spot-contracts/tasks/scripts/mainnet_v5.sh diff --git a/spot-contracts/.openzeppelin/mainnet.json b/spot-contracts/.openzeppelin/mainnet.json index 420a385c..d9a61a89 100644 --- a/spot-contracts/.openzeppelin/mainnet.json +++ b/spot-contracts/.openzeppelin/mainnet.json @@ -19,6 +19,11 @@ "address": "0xE22977381506bF094CB3ed50CB8834E358F7ef6c", "txHash": "0x4942e46f0c306087f3485aa8c6d74fec37d1fa1f7a59acfb385b2ed8173e745c", "kind": "transparent" + }, + { + "address": "0x8689Fa9991834Bcf0387b31b7986ac311bAb6ab5", + "txHash": "0x8f8fcc763660586128699cf7658bb6672434e98597903b57749da2f56afd5a92", + "kind": "transparent" } ], "impls": { @@ -3324,6 +3329,917 @@ }, "namespaces": {} } + }, + "907dd399d33e68e0a7c77c54e1886a30e59ec356c35a0f9c27e96d39644c64d6": { + "address": "0x03Cb728991DEb43A55D475885Ff07a694bF1cc6B", + "txHash": "0xc9712ffbcc1b697bc28eccc30566ce23a2aa6b6d045f0a578f23dd1d142af72c", + "layout": { + "solcVersion": "0.8.20", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:62", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:67" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:36" + }, + { + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22" + }, + { + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:94" + }, + { + "label": "targetSystemRatio", + "offset": 0, + "slot": "101", + "type": "t_uint256", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:69" + }, + { + "label": "equilibriumDR", + "offset": 0, + "slot": "102", + "type": "t_struct(Range)11656_storage", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:74" + }, + { + "label": "feeFnDRDown", + "offset": 0, + "slot": "104", + "type": "t_struct(Line)11666_storage", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:80" + }, + { + "label": "feeFnDRUp", + "offset": 0, + "slot": "108", + "type": "t_struct(Line)11666_storage", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:83" + }, + { + "label": "perpDebasementLag", + "offset": 0, + "slot": "112", + "type": "t_uint256", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:89" + }, + { + "label": "perpEnrichmentLag", + "offset": 0, + "slot": "113", + "type": "t_uint256", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:92" + }, + { + "label": "perpDebasementPercLimits", + "offset": 0, + "slot": "114", + "type": "t_struct(Range)11656_storage", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:95" + }, + { + "label": "perpEnrichmentPercLimits", + "offset": 0, + "slot": "116", + "type": "t_struct(Range)11656_storage", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:98" + }, + { + "label": "rebalanceFreqSec", + "offset": 0, + "slot": "118", + "type": "t_uint256", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:101" + }, + { + "label": "protocolSharePerc", + "offset": 0, + "slot": "119", + "type": "t_uint256", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:104" + }, + { + "label": "protocolFeeCollector", + "offset": 0, + "slot": "120", + "type": "t_address", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:107" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_struct(Line)11666_storage": { + "label": "struct Line", + "members": [ + { + "label": "x1", + "type": "t_uint256", + "offset": 0, + "slot": "0" + }, + { + "label": "y1", + "type": "t_uint256", + "offset": 0, + "slot": "1" + }, + { + "label": "x2", + "type": "t_uint256", + "offset": 0, + "slot": "2" + }, + { + "label": "y2", + "type": "t_uint256", + "offset": 0, + "slot": "3" + } + ], + "numberOfBytes": "128" + }, + "t_struct(Range)11656_storage": { + "label": "struct Range", + "members": [ + { + "label": "lower", + "type": "t_uint256", + "offset": 0, + "slot": "0" + }, + { + "label": "upper", + "type": "t_uint256", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + }, + "namespaces": {} + } + }, + "27615ac3f0c04782221a0e771a009ef027f8d4639b613c0b87c5311ebbfd6094": { + "address": "0x62cbE9F24413485f04FA62F9548C7855ec4a5425", + "txHash": "0xe3b11f8c86361ce12e6eb009c0e842407262d952d494b87bd0141f39b36f5d19", + "layout": { + "solcVersion": "0.8.20", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:62", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:67" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:36" + }, + { + "label": "_balances", + "offset": 0, + "slot": "51", + "type": "t_mapping(t_address,t_uint256)", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:37" + }, + { + "label": "_allowances", + "offset": 0, + "slot": "52", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:39" + }, + { + "label": "_totalSupply", + "offset": 0, + "slot": "53", + "type": "t_uint256", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:41" + }, + { + "label": "_name", + "offset": 0, + "slot": "54", + "type": "t_string_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:43" + }, + { + "label": "_symbol", + "offset": 0, + "slot": "55", + "type": "t_string_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:44" + }, + { + "label": "__gap", + "offset": 0, + "slot": "56", + "type": "t_array(t_uint256)45_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:394" + }, + { + "label": "__gap", + "offset": 0, + "slot": "101", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC20BurnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol:51" + }, + { + "label": "_owner", + "offset": 0, + "slot": "151", + "type": "t_address", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22" + }, + { + "label": "__gap", + "offset": 0, + "slot": "152", + "type": "t_array(t_uint256)49_storage", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:94" + }, + { + "label": "_paused", + "offset": 0, + "slot": "201", + "type": "t_bool", + "contract": "PausableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:29" + }, + { + "label": "__gap", + "offset": 0, + "slot": "202", + "type": "t_array(t_uint256)49_storage", + "contract": "PausableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:116" + }, + { + "label": "_status", + "offset": 0, + "slot": "251", + "type": "t_uint256", + "contract": "ReentrancyGuardUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol:38" + }, + { + "label": "__gap", + "offset": 0, + "slot": "252", + "type": "t_array(t_uint256)49_storage", + "contract": "ReentrancyGuardUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol:74" + }, + { + "label": "_decimals", + "offset": 0, + "slot": "301", + "type": "t_uint8", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:130" + }, + { + "label": "keeper", + "offset": 1, + "slot": "301", + "type": "t_address", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:136" + }, + { + "label": "feePolicy", + "offset": 0, + "slot": "302", + "type": "t_contract(IFeePolicy)11799", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:140" + }, + { + "label": "_pricingStrategy_DEPRECATED", + "offset": 0, + "slot": "303", + "type": "t_address", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:146" + }, + { + "label": "_discountStrategy_DEPRECATED", + "offset": 0, + "slot": "304", + "type": "t_address", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:154" + }, + { + "label": "bondIssuer", + "offset": 0, + "slot": "305", + "type": "t_contract(IBondIssuer)11728", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:158" + }, + { + "label": "_depositBond", + "offset": 0, + "slot": "306", + "type": "t_contract(IBondController)12381", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:161" + }, + { + "label": "minTrancheMaturitySec", + "offset": 0, + "slot": "307", + "type": "t_uint256", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:165" + }, + { + "label": "maxTrancheMaturitySec", + "offset": 0, + "slot": "308", + "type": "t_uint256", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:169" + }, + { + "label": "_matureValueTargetPerc_DEPRECATED", + "offset": 0, + "slot": "309", + "type": "t_uint256", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:177" + }, + { + "label": "maxSupply", + "offset": 0, + "slot": "310", + "type": "t_uint256", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:180" + }, + { + "label": "maxDepositTrancheValuePerc", + "offset": 0, + "slot": "311", + "type": "t_uint256", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:184" + }, + { + "label": "_mintedSupplyPerTranche_DEPRECATED", + "offset": 0, + "slot": "312", + "type": "t_mapping(t_contract(ITranche)12408,t_uint256)", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:190" + }, + { + "label": "_appliedDiscounts_DEPRECATED", + "offset": 0, + "slot": "313", + "type": "t_mapping(t_contract(IERC20Upgradeable)1157,t_uint256)", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:197" + }, + { + "label": "_reserves", + "offset": 0, + "slot": "314", + "type": "t_struct(AddressSet)4620_storage", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:203" + }, + { + "label": "_matureTrancheBalance_DEPRECATED", + "offset": 0, + "slot": "316", + "type": "t_uint256", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:209" + }, + { + "label": "vault", + "offset": 0, + "slot": "317", + "type": "t_contract(IRolloverVault)12133", + "contract": "PerpetualTranche", + "src": "contracts/PerpetualTranche.sol:216" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_bytes32)dyn_storage": { + "label": "bytes32[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)45_storage": { + "label": "uint256[45]", + "numberOfBytes": "1440" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(IBondController)12381": { + "label": "contract IBondController", + "numberOfBytes": "20" + }, + "t_contract(IBondIssuer)11728": { + "label": "contract IBondIssuer", + "numberOfBytes": "20" + }, + "t_contract(IERC20Upgradeable)1157": { + "label": "contract IERC20Upgradeable", + "numberOfBytes": "20" + }, + "t_contract(IFeePolicy)11799": { + "label": "contract IFeePolicy", + "numberOfBytes": "20" + }, + "t_contract(IRolloverVault)12133": { + "label": "contract IRolloverVault", + "numberOfBytes": "20" + }, + "t_contract(ITranche)12408": { + "label": "contract ITranche", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "label": "mapping(address => mapping(address => uint256))", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes32,t_uint256)": { + "label": "mapping(bytes32 => uint256)", + "numberOfBytes": "32" + }, + "t_mapping(t_contract(IERC20Upgradeable)1157,t_uint256)": { + "label": "mapping(contract IERC20Upgradeable => uint256)", + "numberOfBytes": "32" + }, + "t_mapping(t_contract(ITranche)12408,t_uint256)": { + "label": "mapping(contract ITranche => uint256)", + "numberOfBytes": "32" + }, + "t_string_storage": { + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(AddressSet)4620_storage": { + "label": "struct EnumerableSetUpgradeable.AddressSet", + "members": [ + { + "label": "_inner", + "type": "t_struct(Set)4319_storage", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "64" + }, + "t_struct(Set)4319_storage": { + "label": "struct EnumerableSetUpgradeable.Set", + "members": [ + { + "label": "_values", + "type": "t_array(t_bytes32)dyn_storage", + "offset": 0, + "slot": "0" + }, + { + "label": "_indexes", + "type": "t_mapping(t_bytes32,t_uint256)", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + }, + "namespaces": {} + } + }, + "a654f5fc3f523b33f333301fc186ec85f3adf97f68e5c1c99b8f2929861773bc": { + "address": "0x09e8adfa8D829DaC1c305544A86b53Ed0dDD536a", + "txHash": "0x43e5cc57ceda548dba1f946c90b07646ddd59ad09c56a60ffcfbcb7d2616d394", + "layout": { + "solcVersion": "0.8.20", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:62", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:67" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:36" + }, + { + "label": "_balances", + "offset": 0, + "slot": "51", + "type": "t_mapping(t_address,t_uint256)", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:37" + }, + { + "label": "_allowances", + "offset": 0, + "slot": "52", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:39" + }, + { + "label": "_totalSupply", + "offset": 0, + "slot": "53", + "type": "t_uint256", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:41" + }, + { + "label": "_name", + "offset": 0, + "slot": "54", + "type": "t_string_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:43" + }, + { + "label": "_symbol", + "offset": 0, + "slot": "55", + "type": "t_string_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:44" + }, + { + "label": "__gap", + "offset": 0, + "slot": "56", + "type": "t_array(t_uint256)45_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:394" + }, + { + "label": "__gap", + "offset": 0, + "slot": "101", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC20BurnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol:51" + }, + { + "label": "_owner", + "offset": 0, + "slot": "151", + "type": "t_address", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22" + }, + { + "label": "__gap", + "offset": 0, + "slot": "152", + "type": "t_array(t_uint256)49_storage", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:94" + }, + { + "label": "_paused", + "offset": 0, + "slot": "201", + "type": "t_bool", + "contract": "PausableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:29" + }, + { + "label": "__gap", + "offset": 0, + "slot": "202", + "type": "t_array(t_uint256)49_storage", + "contract": "PausableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:116" + }, + { + "label": "_status", + "offset": 0, + "slot": "251", + "type": "t_uint256", + "contract": "ReentrancyGuardUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol:38" + }, + { + "label": "__gap", + "offset": 0, + "slot": "252", + "type": "t_array(t_uint256)49_storage", + "contract": "ReentrancyGuardUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol:74" + }, + { + "label": "underlying", + "offset": 0, + "slot": "301", + "type": "t_contract(IERC20Upgradeable)1157", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:128" + }, + { + "label": "_deployed", + "offset": 0, + "slot": "302", + "type": "t_struct(AddressSet)4620_storage", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:132" + }, + { + "label": "minDeploymentAmt", + "offset": 0, + "slot": "304", + "type": "t_uint256", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:140" + }, + { + "label": "perp", + "offset": 0, + "slot": "305", + "type": "t_contract(IPerpetualTranche)12045", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:143" + }, + { + "label": "feePolicy", + "offset": 0, + "slot": "306", + "type": "t_contract(IFeePolicy)11799", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:149" + }, + { + "label": "keeper", + "offset": 0, + "slot": "307", + "type": "t_address", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:154" + }, + { + "label": "reservedUnderlyingBal", + "offset": 0, + "slot": "308", + "type": "t_uint256", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:165" + }, + { + "label": "reservedUnderlyingPerc", + "offset": 0, + "slot": "309", + "type": "t_uint256", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:169" + }, + { + "label": "lastRebalanceTimestampSec", + "offset": 0, + "slot": "310", + "type": "t_uint256", + "contract": "RolloverVault", + "src": "contracts/RolloverVault.sol:175" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_bytes32)dyn_storage": { + "label": "bytes32[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)45_storage": { + "label": "uint256[45]", + "numberOfBytes": "1440" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(IERC20Upgradeable)1157": { + "label": "contract IERC20Upgradeable", + "numberOfBytes": "20" + }, + "t_contract(IFeePolicy)11799": { + "label": "contract IFeePolicy", + "numberOfBytes": "20" + }, + "t_contract(IPerpetualTranche)12045": { + "label": "contract IPerpetualTranche", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "label": "mapping(address => mapping(address => uint256))", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes32,t_uint256)": { + "label": "mapping(bytes32 => uint256)", + "numberOfBytes": "32" + }, + "t_string_storage": { + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(AddressSet)4620_storage": { + "label": "struct EnumerableSetUpgradeable.AddressSet", + "members": [ + { + "label": "_inner", + "type": "t_struct(Set)4319_storage", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "64" + }, + "t_struct(Set)4319_storage": { + "label": "struct EnumerableSetUpgradeable.Set", + "members": [ + { + "label": "_values", + "type": "t_array(t_bytes32)dyn_storage", + "offset": 0, + "slot": "0" + }, + { + "label": "_indexes", + "type": "t_mapping(t_bytes32,t_uint256)", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + }, + "namespaces": {} + } } } } diff --git a/spot-contracts/.openzeppelin/sepolia.json b/spot-contracts/.openzeppelin/sepolia.json index f2127177..449ddf59 100644 --- a/spot-contracts/.openzeppelin/sepolia.json +++ b/spot-contracts/.openzeppelin/sepolia.json @@ -44,6 +44,21 @@ "address": "0xd90FcB328D90B778D1f6719d781045bbbac8F251", "txHash": "0x8b29769272d41c1032345366209cdcddb8abda7b8c66bfba001162c14671855e", "kind": "transparent" + }, + { + "address": "0x7f75A61c4475d32a50829710AA8d8aCDEbD2c0d4", + "txHash": "0x366889a82d52a5e9496b0c2f7d8becee5ab4d4611c0ddbe11b99124f983be136", + "kind": "transparent" + }, + { + "address": "0xc6b4b85FB97695052CA2e6C6401C20a7Ba30605D", + "txHash": "0xb64e64b39d3296e9d6dc0d2098ddb6a97f8582dbfad0543d8ed364f6d8107abb", + "kind": "transparent" + }, + { + "address": "0x6D6cBba605F4AF825F4997F1db74AF54e4F01c04", + "txHash": "0x6d23bda7a369524a4918846231c2c6646c092f39c23c823bcde50ee9e1a3d66b", + "kind": "transparent" } ], "impls": { @@ -2715,6 +2730,219 @@ }, "namespaces": {} } + }, + "907dd399d33e68e0a7c77c54e1886a30e59ec356c35a0f9c27e96d39644c64d6": { + "address": "0x058C0F40427A5bBb7eF7169FfF0A12d265317B15", + "txHash": "0x8909e28358b1ff3b70564f6e6e8d6708e21b718cb04056638b9ef9f3ec5dda78", + "layout": { + "solcVersion": "0.8.20", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:62", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:67" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:36" + }, + { + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22" + }, + { + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:94" + }, + { + "label": "targetSystemRatio", + "offset": 0, + "slot": "101", + "type": "t_uint256", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:69" + }, + { + "label": "equilibriumDR", + "offset": 0, + "slot": "102", + "type": "t_struct(Range)11656_storage", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:74" + }, + { + "label": "feeFnDRDown", + "offset": 0, + "slot": "104", + "type": "t_struct(Line)11666_storage", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:80" + }, + { + "label": "feeFnDRUp", + "offset": 0, + "slot": "108", + "type": "t_struct(Line)11666_storage", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:83" + }, + { + "label": "perpDebasementLag", + "offset": 0, + "slot": "112", + "type": "t_uint256", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:89" + }, + { + "label": "perpEnrichmentLag", + "offset": 0, + "slot": "113", + "type": "t_uint256", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:92" + }, + { + "label": "perpDebasementPercLimits", + "offset": 0, + "slot": "114", + "type": "t_struct(Range)11656_storage", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:95" + }, + { + "label": "perpEnrichmentPercLimits", + "offset": 0, + "slot": "116", + "type": "t_struct(Range)11656_storage", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:98" + }, + { + "label": "rebalanceFreqSec", + "offset": 0, + "slot": "118", + "type": "t_uint256", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:101" + }, + { + "label": "protocolSharePerc", + "offset": 0, + "slot": "119", + "type": "t_uint256", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:104" + }, + { + "label": "protocolFeeCollector", + "offset": 0, + "slot": "120", + "type": "t_address", + "contract": "FeePolicy", + "src": "contracts/FeePolicy.sol:107" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_struct(Line)11666_storage": { + "label": "struct Line", + "members": [ + { + "label": "x1", + "type": "t_uint256", + "offset": 0, + "slot": "0" + }, + { + "label": "y1", + "type": "t_uint256", + "offset": 0, + "slot": "1" + }, + { + "label": "x2", + "type": "t_uint256", + "offset": 0, + "slot": "2" + }, + { + "label": "y2", + "type": "t_uint256", + "offset": 0, + "slot": "3" + } + ], + "numberOfBytes": "128" + }, + "t_struct(Range)11656_storage": { + "label": "struct Range", + "members": [ + { + "label": "lower", + "type": "t_uint256", + "offset": 0, + "slot": "0" + }, + { + "label": "upper", + "type": "t_uint256", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + }, + "namespaces": {} + } } } } diff --git a/spot-contracts/README.md b/spot-contracts/README.md index 3ca2370a..8522e308 100644 --- a/spot-contracts/README.md +++ b/spot-contracts/README.md @@ -8,7 +8,7 @@ The official mainnet addresses are: - Bond issuer: [0x5613Fc36A431c9c2746763B80C1DD89e03593871](https://etherscan.io/address/0x5613Fc36A431c9c2746763B80C1DD89e03593871) - Router: [0xCe2878d1f2901EFaF48cd456E586B470C145d1BC](https://etherscan.io/address/0xCe2878d1f2901EFaF48cd456E586B470C145d1BC) - RolloverVault: [0x82A91a0D599A45d8E9Af781D67f695d7C72869Bd](https://etherscan.io//address/0x82A91a0D599A45d8E9Af781D67f695d7C72869Bd) -- FeePolicy: [0xE22977381506bF094CB3ed50CB8834E358F7ef6c](https://etherscan.io//address/0xE22977381506bF094CB3ed50CB8834E358F7ef6c) +- FeePolicy: [0x8689Fa9991834Bcf0387b31b7986ac311bAb6ab5](https://etherscan.io//address/0x8689Fa9991834Bcf0387b31b7986ac311bAb6ab5) ## Install diff --git a/spot-contracts/deployments/mainnet.json b/spot-contracts/deployments/mainnet.json index 03ee64ae..20a775bd 100644 --- a/spot-contracts/deployments/mainnet.json +++ b/spot-contracts/deployments/mainnet.json @@ -8,7 +8,7 @@ "rolloverVault": "0x82A91a0D599A45d8E9Af781D67f695d7C72869Bd", "proxyAdmin": "0x2978B4103985A6668CE345555b0febdE64Fb092F", "router": "0xCe2878d1f2901EFaF48cd456E586B470C145d1BC", - "feePolicy": "0xE22977381506bF094CB3ed50CB8834E358F7ef6c", + "feePolicy": "0x8689Fa9991834Bcf0387b31b7986ac311bAb6ab5", "previousIssuers": [ [0, "0x9443b779d4AedF97d2B93D7CDa5fA0BB6312DfF2"], [1, "0xD64FA63dc5E8fcB743457E47E4d522E11Ff1AD66"], diff --git a/spot-contracts/hardhat.config.ts b/spot-contracts/hardhat.config.ts index 45427cc3..3ccfd425 100644 --- a/spot-contracts/hardhat.config.ts +++ b/spot-contracts/hardhat.config.ts @@ -38,8 +38,9 @@ export default { }, }, mainnet: { - // url: `https://mainnet.infura.io/v3/${process.env.INFURA_SECRET}`, - url: `https://eth-mainnet.g.alchemy.com/v2/${process.env.ALCHEMY_SECRET}`, + url: `https://mainnet.infura.io/v3/${process.env.INFURA_SECRET}`, + // url: `https://eth-mainnet.g.alchemy.com/v2/${process.env.ALCHEMY_SECRET}`, + // url: `https://virtual.mainnet.rpc.tenderly.co/f468fb75-ada0-4833-9f64-f71d51b71190`, accounts: { mnemonic: process.env.PROD_MNEMONIC || Wallet.createRandom().mnemonic.phrase, }, diff --git a/spot-contracts/package.json b/spot-contracts/package.json index 5e4483df..54d85765 100644 --- a/spot-contracts/package.json +++ b/spot-contracts/package.json @@ -51,7 +51,7 @@ "eslint-plugin-promise": "^6.0.0", "eslint-plugin-unused-imports": "^3.0.0", "ethereum-waffle": "latest", - "ethers": "^6.6.0", + "ethers": "^6.14.4", "ethers-v5": "npm:ethers@^5.7.0", "ganache-cli": "latest", "hardhat": "^2.23.0", diff --git a/spot-contracts/tasks/scripts/mainnet_v5.sh b/spot-contracts/tasks/scripts/mainnet_v5.sh new file mode 100644 index 00000000..0b3d2cf9 --- /dev/null +++ b/spot-contracts/tasks/scripts/mainnet_v5.sh @@ -0,0 +1,34 @@ +# deploy new contracts +yarn hardhat --network mainnet deploy:FeePolicy +# fee policy 0x8689Fa9991834Bcf0387b31b7986ac311bAb6ab5 +yarn hardhat --network mainnet transferOwnership "0x8689Fa9991834Bcf0387b31b7986ac311bAb6ab5" \ + --new-owner-address "0x57981B1EaFe4b18EC97f8B10859B40207b364662" + +# deploy new implementations +yarn hardhat --network mainnet prepare_upgrade PerpetualTranche 0xC1f33e0cf7e40a67375007104B929E49a581bafE +yarn hardhat --network mainnet prepare_upgrade:RolloverVault 0x82A91a0D599A45d8E9Af781D67f695d7C72869Bd +# linked library 0xe0028c40C8A09449852ea4D2e9aa4d25895F285f + +# spot v2 check storage layout +yarn hardhat --network mainnet validate_upgrade PerpetualTranche 0xC1f33e0cf7e40a67375007104B929E49a581bafE +yarn hardhat --network mainnet validate_upgrade:RolloverVault 0x82A91a0D599A45d8E9Af781D67f695d7C72869Bd \ + --tranche-manager-address 0xe0028c40C8A09449852ea4D2e9aa4d25895F285f + +# execute via multisig +# proxyAdmin: 0x2978B4103985A6668CE345555b0febdE64Fb092F +# proxyAdmin.upgrade(0xC1f33e0cf7e40a67375007104B929E49a581bafE, 0x62cbE9F24413485f04FA62F9548C7855ec4a5425) +# proxyAdmin.upgrade(0x82A91a0D599A45d8E9Af781D67f695d7C72869Bd, 0x09e8adfa8D829DaC1c305544A86b53Ed0dDD536a) + +yarn hardhat --network mainnet ops:perp:info 0xC1f33e0cf7e40a67375007104B929E49a581bafE +yarn hardhat --network mainnet ops:vault:info 0x82A91a0D599A45d8E9Af781D67f695d7C72869Bd + +# emergency rollback +# proxyAdmin.upgrade(0xC1f33e0cf7e40a67375007104B929E49a581bafE, 0x5dc5488b35c34a43fe19ba9de38b63806fab4b23) +# proxyAdmin.upgrade(0x82A91a0D599A45d8E9Af781D67f695d7C72869Bd, 0xa85be82083e032edf32a19028df558484b399196) + +# Deployment runbook +# 1) Setup new fee policy, with chosen parameters (sanity check return values) +# 2) Pause everything, SPOT, stAMPL and BillBroker +# 3) Execute upgrade (spot and stampl) +# 4) Set fee policy reference and double check all other parameters on SPOT and STAMPL +# 5) Ops, execute first rebalance \ No newline at end of file diff --git a/spot-contracts/tasks/upgrade/index.ts b/spot-contracts/tasks/upgrade/index.ts index 34b717bd..8389754b 100644 --- a/spot-contracts/tasks/upgrade/index.ts +++ b/spot-contracts/tasks/upgrade/index.ts @@ -22,6 +22,31 @@ task("validate_upgrade") console.log("Success"); }); +task("validate_upgrade:RolloverVault") + .addPositionalParam("address", "the address of the deployed proxy contract", undefined, types.string, false) + .addParam("trancheManagerAddress", "the address of the linked tranche manager", "0x", types.string) + .setAction(async function (args: TaskArguments, hre) { + const { address, trancheManagerAddress } = args; + const Factory = await hre.ethers.getContractFactory("RolloverVault", { + libraries: { + TrancheManager: trancheManagerAddress, + }, + }); + + console.log("Trying strict validation"); + try { + await hre.upgrades.validateUpgrade(address, Factory); + } catch (e) { + console.log("Strict validation failed. ", e); + console.log("Retrying but allowing variable renames."); + await hre.upgrades.validateUpgrade(address, Factory, { + unsafeAllowRenames: true, + unsafeAllowLinkedLibraries: true, + }); + } + console.log("Success"); + }); + task("prepare_upgrade") .addPositionalParam("factory", "the name of the factory", undefined, types.string, false) .addPositionalParam("address", "the address of the deployed proxy contract", undefined, types.string, false) @@ -122,3 +147,47 @@ task("upgrade:testnet:RolloverVault") address: newImpl, }); }); + +task("prepare_upgrade:RolloverVault") + .addPositionalParam("address", "the address of the deployed proxy contract", undefined, types.string, false) + .addParam("trancheManagerAddress", "the address of the linked tranche manager", "0x", types.string) + .addParam("fromIdx", "the index of sender", 0, types.int) + .setAction(async function (args: TaskArguments, hre) { + const signer = (await hre.ethers.getSigners())[args.fromIdx]; + const signerAddress = await signer.getAddress(); + console.log("Signer", signerAddress); + + let trancheManagerAddress = args.trancheManagerAddress; + if (trancheManagerAddress === "0x") { + const TrancheManager = await hre.ethers.getContractFactory("TrancheManager"); + const trancheManager = await TrancheManager.deploy(); + trancheManagerAddress = trancheManager.target; + console.log("Deploying linked library TrancheManager", trancheManagerAddress); + } + const Factory = await hre.ethers.getContractFactory("RolloverVault", { + libraries: { + TrancheManager: trancheManagerAddress, + }, + }); + + const { address } = args; + console.log("Proxy", address); + console.log("Current implementation", await getImplementationAddress(hre.ethers.provider, address)); + + await hre.upgrades.prepareUpgrade(address, Factory, { + unsafeAllowRenames: true, + unsafeAllowLinkedLibraries: true, + }); + await sleep(30); + const newImpl = await getImplementationAddress(hre.ethers.provider, address); + console.log("Updated implementation", newImpl); + + await sleep(30); + await hre.run("verify:contract", { + address: trancheManagerAddress, + }); + await sleep(30); + await hre.run("verify:contract", { + address: newImpl, + }); + }); diff --git a/spot-vaults/.openzeppelin/mainnet.json b/spot-vaults/.openzeppelin/mainnet.json index befb1c87..6c707349 100644 --- a/spot-vaults/.openzeppelin/mainnet.json +++ b/spot-vaults/.openzeppelin/mainnet.json @@ -466,7 +466,7 @@ "label": "perp", "offset": 0, "slot": "301", - "type": "t_contract(IPerpetualTranche)389", + "type": "t_contract(IPerpetualTranche)2802", "contract": "BillBroker", "src": "contracts/BillBroker.sol:89" }, @@ -474,7 +474,7 @@ "label": "usd", "offset": 0, "slot": "302", - "type": "t_contract(IERC20Upgradeable)1872", + "type": "t_contract(IERC20Upgradeable)4840", "contract": "BillBroker", "src": "contracts/BillBroker.sol:92" }, @@ -506,7 +506,7 @@ "label": "pricingStrategy", "offset": 0, "slot": "306", - "type": "t_contract(ISpotPricingStrategy)8533", + "type": "t_contract(ISpotPricingStrategy)12114", "contract": "BillBroker", "src": "contracts/BillBroker.sol:106" }, @@ -514,7 +514,7 @@ "label": "fees", "offset": 0, "slot": "307", - "type": "t_struct(BillBrokerFees)8494_storage", + "type": "t_struct(BillBrokerFees)12075_storage", "contract": "BillBroker", "src": "contracts/BillBroker.sol:109" }, @@ -522,7 +522,7 @@ "label": "arHardBound", "offset": 0, "slot": "314", - "type": "t_struct(Range)8475_storage", + "type": "t_struct(Range)12056_storage", "contract": "BillBroker", "src": "contracts/BillBroker.sol:112" }, @@ -530,7 +530,7 @@ "label": "arSoftBound", "offset": 0, "slot": "316", - "type": "t_struct(Range)8475_storage", + "type": "t_struct(Range)12056_storage", "contract": "BillBroker", "src": "contracts/BillBroker.sol:116" } @@ -556,15 +556,15 @@ "label": "bool", "numberOfBytes": "1" }, - "t_contract(IERC20Upgradeable)1872": { + "t_contract(IERC20Upgradeable)4840": { "label": "contract IERC20Upgradeable", "numberOfBytes": "20" }, - "t_contract(IPerpetualTranche)389": { + "t_contract(IPerpetualTranche)2802": { "label": "contract IPerpetualTranche", "numberOfBytes": "20" }, - "t_contract(ISpotPricingStrategy)8533": { + "t_contract(ISpotPricingStrategy)12114": { "label": "contract ISpotPricingStrategy", "numberOfBytes": "20" }, @@ -580,7 +580,7 @@ "label": "string", "numberOfBytes": "32" }, - "t_struct(BillBrokerFees)8494_storage": { + "t_struct(BillBrokerFees)12075_storage": { "label": "struct BillBrokerFees", "members": [ { @@ -597,13 +597,332 @@ }, { "label": "perpToUSDSwapFeePercs", - "type": "t_struct(Range)8475_storage", + "type": "t_struct(Range)12056_storage", "offset": 0, "slot": "2" }, { "label": "usdToPerpSwapFeePercs", - "type": "t_struct(Range)8475_storage", + "type": "t_struct(Range)12056_storage", + "offset": 0, + "slot": "4" + }, + { + "label": "protocolSwapSharePerc", + "type": "t_uint256", + "offset": 0, + "slot": "6" + } + ], + "numberOfBytes": "224" + }, + "t_struct(Range)12056_storage": { + "label": "struct Range", + "members": [ + { + "label": "lower", + "type": "t_uint256", + "offset": 0, + "slot": "0" + }, + { + "label": "upper", + "type": "t_uint256", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + }, + "namespaces": {} + } + }, + "7f703e4a10347cca6e80b8d427a010abcbb83e0b8f3039d52b3a4a4aae5948ff": { + "address": "0x728d8BD67B4271a6d7f8424d0E41B41dcB762D81", + "txHash": "0x7d99175530528ec44ec18df867033691921fa104a0edc2a0ee3ba7f0f0fd71e8", + "layout": { + "solcVersion": "0.8.24", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:63", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:68" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:40" + }, + { + "label": "_balances", + "offset": 0, + "slot": "51", + "type": "t_mapping(t_address,t_uint256)", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:40" + }, + { + "label": "_allowances", + "offset": 0, + "slot": "52", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:42" + }, + { + "label": "_totalSupply", + "offset": 0, + "slot": "53", + "type": "t_uint256", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:44" + }, + { + "label": "_name", + "offset": 0, + "slot": "54", + "type": "t_string_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:46" + }, + { + "label": "_symbol", + "offset": 0, + "slot": "55", + "type": "t_string_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:47" + }, + { + "label": "__gap", + "offset": 0, + "slot": "56", + "type": "t_array(t_uint256)45_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:376" + }, + { + "label": "__gap", + "offset": 0, + "slot": "101", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC20BurnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol:51" + }, + { + "label": "_owner", + "offset": 0, + "slot": "151", + "type": "t_address", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22" + }, + { + "label": "__gap", + "offset": 0, + "slot": "152", + "type": "t_array(t_uint256)49_storage", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:94" + }, + { + "label": "_paused", + "offset": 0, + "slot": "201", + "type": "t_bool", + "contract": "PausableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:29" + }, + { + "label": "__gap", + "offset": 0, + "slot": "202", + "type": "t_array(t_uint256)49_storage", + "contract": "PausableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:116" + }, + { + "label": "_status", + "offset": 0, + "slot": "251", + "type": "t_uint256", + "contract": "ReentrancyGuardUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol:38" + }, + { + "label": "__gap", + "offset": 0, + "slot": "252", + "type": "t_array(t_uint256)49_storage", + "contract": "ReentrancyGuardUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol:88" + }, + { + "label": "perp", + "offset": 0, + "slot": "301", + "type": "t_contract(IPerpetualTranche)2824", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:94" + }, + { + "label": "usd", + "offset": 0, + "slot": "302", + "type": "t_contract(IERC20Upgradeable)4979", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:97" + }, + { + "label": "usdUnitAmt", + "offset": 0, + "slot": "303", + "type": "t_uint256", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:100" + }, + { + "label": "perpUnitAmt", + "offset": 0, + "slot": "304", + "type": "t_uint256", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:103" + }, + { + "label": "keeper", + "offset": 0, + "slot": "305", + "type": "t_address", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:108" + }, + { + "label": "oracle", + "offset": 0, + "slot": "306", + "type": "t_contract(IPerpPricer)14225", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:111" + }, + { + "label": "fees", + "offset": 0, + "slot": "307", + "type": "t_struct(BillBrokerFees)14748_storage", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:114" + }, + { + "label": "arHardBound", + "offset": 0, + "slot": "314", + "type": "t_struct(Range)14780_storage", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:117" + }, + { + "label": "arSoftBound", + "offset": 0, + "slot": "316", + "type": "t_struct(Range)14780_storage", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:121" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)45_storage": { + "label": "uint256[45]", + "numberOfBytes": "1440" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(IERC20Upgradeable)4979": { + "label": "contract IERC20Upgradeable", + "numberOfBytes": "20" + }, + "t_contract(IPerpPricer)14225": { + "label": "contract IPerpPricer", + "numberOfBytes": "20" + }, + "t_contract(IPerpetualTranche)2824": { + "label": "contract IPerpetualTranche", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "label": "mapping(address => mapping(address => uint256))", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)", + "numberOfBytes": "32" + }, + "t_string_storage": { + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(BillBrokerFees)14748_storage": { + "label": "struct BillBrokerFees", + "members": [ + { + "label": "mintFeePerc", + "type": "t_uint256", + "offset": 0, + "slot": "0" + }, + { + "label": "burnFeePerc", + "type": "t_uint256", + "offset": 0, + "slot": "1" + }, + { + "label": "perpToUSDSwapFeeFactors", + "type": "t_struct(Range)14780_storage", + "offset": 0, + "slot": "2" + }, + { + "label": "usdToPerpSwapFeeFactors", + "type": "t_struct(Range)14780_storage", "offset": 0, "slot": "4" }, @@ -616,7 +935,7 @@ ], "numberOfBytes": "224" }, - "t_struct(Range)8475_storage": { + "t_struct(Range)14780_storage": { "label": "struct Range", "members": [ { diff --git a/spot-vaults/hardhat.config.ts b/spot-vaults/hardhat.config.ts index d697b3bd..7b922461 100644 --- a/spot-vaults/hardhat.config.ts +++ b/spot-vaults/hardhat.config.ts @@ -39,7 +39,8 @@ export default { gasMultiplier: 1.01, }, mainnet: { - url: `https://eth-mainnet.g.alchemy.com/v2/${process.env.ALCHEMY_SECRET}`, + // url: `https://eth-mainnet.g.alchemy.com/v2/${process.env.ALCHEMY_SECRET}`, + url: `https://mainnet.infura.io/v3/${process.env.INFURA_SECRET}`, accounts: { mnemonic: process.env.PROD_MNEMONIC || Wallet.createRandom().mnemonic.phrase, }, diff --git a/yarn.lock b/yarn.lock index 45fbef16..90f06744 100644 --- a/yarn.lock +++ b/yarn.lock @@ -56,7 +56,7 @@ __metadata: eslint-plugin-promise: ^6.0.0 eslint-plugin-unused-imports: ^3.0.0 ethereum-waffle: latest - ethers: ^6.6.0 + ethers: ^6.14.4 ethers-v5: "npm:ethers@^5.7.0" ganache-cli: latest hardhat: ^2.23.0 @@ -6482,6 +6482,21 @@ __metadata: languageName: node linkType: hard +"ethers@npm:^6.14.4": + version: 6.14.4 + resolution: "ethers@npm:6.14.4" + dependencies: + "@adraffy/ens-normalize": 1.10.1 + "@noble/curves": 1.2.0 + "@noble/hashes": 1.3.2 + "@types/node": 22.7.5 + aes-js: 4.0.0-beta.5 + tslib: 2.7.0 + ws: 8.17.1 + checksum: 9f7e651ef3ee8c158c5bfd067cb048b3b4367d2d68b575b8777e1cf1eb337a7487cd4e34925cfe421b9a28de12bbd062d08575c1f7b6b0601e32b98edc9c708e + languageName: node + linkType: hard + "ethers@npm:^6.6.0": version: 6.14.0 resolution: "ethers@npm:6.14.0" From aab4d8de6d91a33900acfeae7448eb96a782385f Mon Sep 17 00:00:00 2001 From: Aalavandhan <6264334+aalavandhan@users.noreply.github.com> Date: Tue, 8 Jul 2025 22:44:15 -0400 Subject: [PATCH 08/18] Subgraph updates for SPOT v5 (#260) * spot subgraph updates * updated bb subgraph * cleaned up spot subgraph * ran linter --- .../exported-artifacts/FeePolicy.json | 582 ++++++++++++++++++ spot-staking-subgraph/schema.graphql | 10 +- spot-staking-subgraph/src/billBroker.ts | 143 ++++- spot-staking-subgraph/src/charmVault.ts | 23 +- spot-staking-subgraph/src/utils.ts | 2 +- spot-subgraph/schema.graphql | 57 +- spot-subgraph/scripts/deploy.sh | 6 +- spot-subgraph/scripts/generate-ipfs-cid.sh | 30 + spot-subgraph/src/data/perpetualTranche.ts | 5 +- spot-subgraph/src/data/rolloverVault.ts | 108 +++- .../src/mappings/perpetualTranche.ts | 40 +- spot-subgraph/src/mappings/rolloverVault.ts | 141 +++-- spot-subgraph/src/utils.ts | 14 + spot-subgraph/subgraph.template.yaml | 15 +- 14 files changed, 985 insertions(+), 191 deletions(-) create mode 100644 spot-contracts/exported-artifacts/FeePolicy.json create mode 100755 spot-subgraph/scripts/generate-ipfs-cid.sh diff --git a/spot-contracts/exported-artifacts/FeePolicy.json b/spot-contracts/exported-artifacts/FeePolicy.json new file mode 100644 index 00000000..746ff17c --- /dev/null +++ b/spot-contracts/exported-artifacts/FeePolicy.json @@ -0,0 +1,582 @@ +[ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InvalidFees", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidPerc", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidRange", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "DECIMALS", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ONE", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "perpTVL", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "vaultTVL", + "type": "uint256" + } + ], + "internalType": "struct SystemTVL", + "name": "s", + "type": "tuple" + } + ], + "name": "computeDeviationRatio", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "drPre", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "drPost", + "type": "uint256" + } + ], + "name": "computeFeePerc", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "perpTVL", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "vaultTVL", + "type": "uint256" + } + ], + "internalType": "struct SystemTVL", + "name": "s", + "type": "tuple" + } + ], + "name": "computeRebalanceAmount", + "outputs": [ + { + "internalType": "int256", + "name": "underlyingAmtIntoPerp", + "type": "int256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "equilibriumDR", + "outputs": [ + { + "internalType": "uint256", + "name": "lower", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "upper", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "feeFnDRDown", + "outputs": [ + { + "internalType": "uint256", + "name": "x1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "y1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "x2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "y2", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "feeFnDRUp", + "outputs": [ + { + "internalType": "uint256", + "name": "x1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "y1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "x2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "y2", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "init", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "perpDebasementLag", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "perpDebasementPercLimits", + "outputs": [ + { + "internalType": "uint256", + "name": "lower", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "upper", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "perpEnrichmentLag", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "perpEnrichmentPercLimits", + "outputs": [ + { + "internalType": "uint256", + "name": "lower", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "upper", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "protocolFeeCollector", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "protocolSharePerc", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rebalanceFreqSec", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "targetSystemRatio", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "lower", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "upper", + "type": "uint256" + } + ], + "internalType": "struct Range", + "name": "equilibriumDR_", + "type": "tuple" + } + ], + "name": "updateEquilibriumDR", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "x1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "y1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "x2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "y2", + "type": "uint256" + } + ], + "internalType": "struct Line", + "name": "feeFnDRDown_", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "x1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "y1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "x2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "y2", + "type": "uint256" + } + ], + "internalType": "struct Line", + "name": "feeFnDRUp_", + "type": "tuple" + } + ], + "name": "updateFees", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "protocolSharePerc_", + "type": "uint256" + }, + { + "internalType": "address", + "name": "protocolFeeCollector_", + "type": "address" + } + ], + "name": "updateProtocolFeeConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "perpDebasementLag_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "perpEnrichmentLag_", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "lower", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "upper", + "type": "uint256" + } + ], + "internalType": "struct Range", + "name": "perpDebasementPercLimits_", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "lower", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "upper", + "type": "uint256" + } + ], + "internalType": "struct Range", + "name": "perpEnrichmentPercLimits_", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "rebalanceFreqSec_", + "type": "uint256" + } + ], + "name": "updateRebalanceConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "targetSystemRatio_", + "type": "uint256" + } + ], + "name": "updateTargetSystemRatio", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/spot-staking-subgraph/schema.graphql b/spot-staking-subgraph/schema.graphql index 61e1d6f3..13f11b4b 100644 --- a/spot-staking-subgraph/schema.graphql +++ b/spot-staking-subgraph/schema.graphql @@ -34,10 +34,9 @@ type BillBrokerDailyStat @entity { perpPrice: BigDecimal! usdPrice: BigDecimal! totalSupply: BigDecimal! - usdSwapAmt: BigDecimal! - perpSwapAmt: BigDecimal! - usdFeeAmt: BigDecimal! - perpFeeAmt: BigDecimal! + swapValue: BigDecimal! + feeValue: BigDecimal! + feeYield: BigDecimal! tvl:BigDecimal! price:BigDecimal! } @@ -50,7 +49,8 @@ type BillBrokerSwap @entity { nonce: BigInt! type: String! swapAmt: BigDecimal! - feeAmt: BigDecimal! + swapValue: BigDecimal! + feeValue: BigDecimal! tx: String! } diff --git a/spot-staking-subgraph/src/billBroker.ts b/spot-staking-subgraph/src/billBroker.ts index c43664be..64d0fbc9 100644 --- a/spot-staking-subgraph/src/billBroker.ts +++ b/spot-staking-subgraph/src/billBroker.ts @@ -18,6 +18,8 @@ import { import { BillBroker__computePerpToUSDSwapAmt1InputSStruct, BillBroker__computeUSDToPerpSwapAmtInputSStruct, + BillBroker__computeMintAmtWithUSD1InputSStruct, + BillBroker__computeMintAmtWithPerp1InputSStruct, } from '../generated/BillBroker/BillBroker' import { BillBroker as BillBrokerABI } from '../generated/BillBroker/BillBroker' import { ERC20 as ERC20ABI } from '../generated/BillBroker/ERC20' @@ -74,7 +76,10 @@ export function fetchBillBroker(address: Address): BillBroker { return vault as BillBroker } -export function fetchBillBrokerDailyStat(vault: BillBroker, timestamp: BigInt): BillBrokerDailyStat { +export function fetchBillBrokerDailyStat( + vault: BillBroker, + timestamp: BigInt, +): BillBrokerDailyStat { let id = vault.id.concat('-').concat(timestamp.toString()) let dailyStat = BillBrokerDailyStat.load(id) if (dailyStat === null) { @@ -86,10 +91,9 @@ export function fetchBillBrokerDailyStat(vault: BillBroker, timestamp: BigInt): dailyStat.perpPrice = BIGDECIMAL_ZERO dailyStat.usdPrice = BIGDECIMAL_ZERO dailyStat.totalSupply = BIGDECIMAL_ZERO - dailyStat.usdSwapAmt = BIGDECIMAL_ZERO - dailyStat.perpSwapAmt = BIGDECIMAL_ZERO - dailyStat.usdFeeAmt = BIGDECIMAL_ZERO - dailyStat.perpFeeAmt = BIGDECIMAL_ZERO + dailyStat.swapValue = BIGDECIMAL_ZERO + dailyStat.feeValue = BIGDECIMAL_ZERO + dailyStat.feeYield = BIGDECIMAL_ZERO dailyStat.tvl = BIGDECIMAL_ZERO dailyStat.price = BIGDECIMAL_ZERO dailyStat.save() @@ -106,7 +110,8 @@ function fetchBillBrokerSwap(vault: BillBroker, nonce: BigInt): BillBrokerSwap { swap.nonce = nonce swap.type = '' swap.swapAmt = BIGDECIMAL_ZERO - swap.feeAmt = BIGDECIMAL_ZERO + swap.swapValue = BIGDECIMAL_ZERO + swap.feeValue = BIGDECIMAL_ZERO swap.tx = '0x' swap.timestamp = BIGINT_ZERO swap.save() @@ -152,6 +157,7 @@ export function handleSwapPerpsForUSD(event: SwapPerpsForUSD): void { vault.usdPrice = formatBalance(event.params.preOpState.usdPrice, vault.decimals) vault.tvl = vault.usdBal.times(vault.usdPrice).plus(vault.perpBal.times(vault.perpPrice)) vault.price = vault.tvl.div(vault.totalSupply) + vault.swapNonce = vault.swapNonce.plus(BIGINT_ONE) vault.save() dailyStat.perpPrice = vault.perpPrice @@ -162,6 +168,7 @@ export function handleSwapPerpsForUSD(event: SwapPerpsForUSD): void { swap.type = 'perps' swap.swapAmt = formatBalance(event.params.perpAmtIn, vault.perpDecimals) + swap.swapValue = swap.swapAmt.times(vault.perpPrice) swap.tx = event.transaction.hash.toHex() swap.timestamp = event.block.timestamp swap.save() @@ -180,15 +187,16 @@ export function handleSwapPerpsForUSD(event: SwapPerpsForUSD): void { let r = vaultContract.try_computePerpToUSDSwapAmt1(event.params.perpAmtIn, reserveStateStruct) if (!r.reverted) { let swapAmts = r.value - dailyStat.perpSwapAmt = dailyStat.perpSwapAmt.plus( - formatBalance(event.params.perpAmtIn, vault.perpDecimals), - ) - dailyStat.usdFeeAmt = dailyStat.usdFeeAmt.plus( - formatBalance(swapAmts.value1, vault.usdDecimals), - ) + let perpAmtIn = swap.swapAmt + let usdAmtOut = formatBalance(swapAmts.value0, vault.usdDecimals) + let estUsdAmtOut = perpAmtIn.times(vault.perpPrice).div(vault.usdPrice) + let usdFeeAmt = estUsdAmtOut.minus(usdAmtOut) + let feeValue = usdFeeAmt.times(vault.usdPrice) + dailyStat.swapValue = dailyStat.swapValue.plus(swap.swapValue) + dailyStat.feeValue = dailyStat.feeValue.plus(feeValue) + dailyStat.feeYield = dailyStat.feeValue.div(dailyStat.tvl) dailyStat.save() - - swap.feeAmt = dailyStat.usdFeeAmt + swap.feeValue = feeValue swap.save() } } @@ -204,6 +212,7 @@ export function handleSwapUSDForPerps(event: SwapUSDForPerps): void { vault.usdPrice = formatBalance(event.params.preOpState.usdPrice, vault.decimals) vault.tvl = vault.usdBal.times(vault.usdPrice).plus(vault.perpBal.times(vault.perpPrice)) vault.price = vault.tvl.div(vault.totalSupply) + vault.swapNonce = vault.swapNonce.plus(BIGINT_ONE) vault.save() dailyStat.perpPrice = vault.perpPrice @@ -213,7 +222,8 @@ export function handleSwapUSDForPerps(event: SwapUSDForPerps): void { dailyStat.save() swap.type = 'usd' - swap.swapAmt = formatBalance(event.params.usdAmtIn, vault.perpDecimals) + swap.swapAmt = formatBalance(event.params.usdAmtIn, vault.usdDecimals) + swap.swapValue = swap.swapAmt.times(vault.usdPrice) swap.tx = event.transaction.hash.toHex() swap.timestamp = event.block.timestamp swap.save() @@ -232,15 +242,16 @@ export function handleSwapUSDForPerps(event: SwapUSDForPerps): void { let r = vaultContract.try_computeUSDToPerpSwapAmt(event.params.usdAmtIn, reserveStateStruct) if (!r.reverted) { let swapAmts = r.value - dailyStat.usdSwapAmt = dailyStat.usdSwapAmt.plus( - formatBalance(event.params.usdAmtIn, vault.usdDecimals), - ) - dailyStat.perpFeeAmt = dailyStat.perpFeeAmt.plus( - formatBalance(swapAmts.value1, vault.perpDecimals), - ) + let usdAmtIn = swap.swapAmt + let perpAmtOut = formatBalance(swapAmts.value0, vault.perpDecimals) + let estPerpAmtOut = usdAmtIn.times(vault.usdPrice).div(vault.perpPrice) + let perpFeeAmt = estPerpAmtOut.minus(perpAmtOut) + let feeValue = perpFeeAmt.times(vault.perpPrice) + dailyStat.swapValue = dailyStat.swapValue.plus(swap.swapValue) + dailyStat.feeValue = dailyStat.feeValue.plus(feeValue) + dailyStat.feeYield = dailyStat.feeValue.div(dailyStat.tvl) dailyStat.save() - - swap.feeAmt = dailyStat.perpFeeAmt + swap.feeValue = feeValue swap.save() } } @@ -249,6 +260,7 @@ export function handleDepositUSD(event: DepositUSD): void { log.warning('triggered single sided deposit', []) let vault = fetchBillBroker(event.address) let dailyStat = fetchBillBrokerDailyStat(vault, dayTimestamp(event.block.timestamp)) + let swap = fetchBillBrokerSwap(vault, vault.swapNonce.plus(BIGINT_ONE)) refreshBillBrokerStats(vault, dailyStat) vault.perpPrice = formatBalance(event.params.preOpState.perpPrice, vault.decimals) @@ -262,12 +274,55 @@ export function handleDepositUSD(event: DepositUSD): void { dailyStat.tvl = vault.tvl dailyStat.price = vault.price dailyStat.save() + + let vaultContract = BillBrokerABI.bind(stringToAddress(vault.id)) + let reserveStateValues: Array = [ + ethereum.Value.fromUnsignedBigInt(event.params.preOpState.usdBalance), + ethereum.Value.fromUnsignedBigInt(event.params.preOpState.perpBalance), + ethereum.Value.fromUnsignedBigInt(event.params.preOpState.usdPrice), + ethereum.Value.fromUnsignedBigInt(event.params.preOpState.perpPrice), + ] + let reserveStateTuple = changetype(reserveStateValues) + let reserveStateStruct = changetype( + reserveStateTuple, + ) + let r = vaultContract.try_computeMintAmtWithUSD1(event.params.usdAmtIn, reserveStateStruct) + if (!r.reverted) { + let usdAmtIn = formatBalance(event.params.usdAmtIn, vault.usdDecimals) + let valueIn = usdAmtIn.times(vault.usdPrice) + let estMintAmt = formatBalance(r.value, vault.decimals) + let mintAmt = valueIn.div(vault.tvl).times(vault.totalSupply) + let feePerc = estMintAmt.minus(mintAmt).div(estMintAmt) + + let usdClaimPost = vault.usdBal.times(estMintAmt).div(vault.totalSupply) + let swapAmt = usdAmtIn.minus(usdClaimPost) + let feeValue = swapAmt.times(feePerc) + + vault.swapNonce = vault.swapNonce.plus(BIGINT_ONE) + vault.save() + + swap.type = 'usd' + swap.swapAmt = swapAmt + swap.swapValue = swap.swapAmt.times(vault.usdPrice) + swap.tx = event.transaction.hash.toHex() + swap.timestamp = event.block.timestamp + swap.save() + + dailyStat.swapValue = dailyStat.swapValue.plus(swap.swapValue) + dailyStat.feeValue = dailyStat.feeValue.plus(feeValue) + dailyStat.feeYield = dailyStat.feeValue.div(dailyStat.tvl) + dailyStat.save() + + swap.feeValue = feeValue + swap.save() + } } export function handleDepositPerp(event: DepositPerp): void { log.warning('triggered single sided deposit', []) let vault = fetchBillBroker(event.address) let dailyStat = fetchBillBrokerDailyStat(vault, dayTimestamp(event.block.timestamp)) + let swap = fetchBillBrokerSwap(vault, vault.swapNonce.plus(BIGINT_ONE)) refreshBillBrokerStats(vault, dailyStat) vault.perpPrice = formatBalance(event.params.preOpState.perpPrice, vault.decimals) @@ -281,4 +336,46 @@ export function handleDepositPerp(event: DepositPerp): void { dailyStat.tvl = vault.tvl dailyStat.price = vault.price dailyStat.save() + + let vaultContract = BillBrokerABI.bind(stringToAddress(vault.id)) + let reserveStateValues: Array = [ + ethereum.Value.fromUnsignedBigInt(event.params.preOpState.usdBalance), + ethereum.Value.fromUnsignedBigInt(event.params.preOpState.perpBalance), + ethereum.Value.fromUnsignedBigInt(event.params.preOpState.usdPrice), + ethereum.Value.fromUnsignedBigInt(event.params.preOpState.perpPrice), + ] + let reserveStateTuple = changetype(reserveStateValues) + let reserveStateStruct = changetype( + reserveStateTuple, + ) + let r = vaultContract.try_computeMintAmtWithPerp1(event.params.perpAmtIn, reserveStateStruct) + if (!r.reverted) { + let perpAmtIn = formatBalance(event.params.perpAmtIn, vault.perpDecimals) + let valueIn = perpAmtIn.times(vault.perpPrice) + let estMintAmt = formatBalance(r.value, vault.decimals) + let mintAmt = valueIn.div(vault.tvl).times(vault.totalSupply) + let feePerc = estMintAmt.minus(mintAmt).div(estMintAmt) + + let perpClaimPost = vault.perpBal.times(estMintAmt).div(vault.totalSupply) + let swapAmt = perpAmtIn.minus(perpClaimPost) + let feeValue = swapAmt.times(feePerc) + + vault.swapNonce = vault.swapNonce.plus(BIGINT_ONE) + vault.save() + + swap.type = 'perp' + swap.swapAmt = swapAmt + swap.swapValue = swap.swapAmt.times(vault.perpPrice) + swap.tx = event.transaction.hash.toHex() + swap.timestamp = event.block.timestamp + swap.save() + + dailyStat.swapValue = dailyStat.swapValue.plus(swap.swapValue) + dailyStat.feeValue = dailyStat.feeValue.plus(feeValue) + dailyStat.feeYield = dailyStat.feeValue.div(dailyStat.tvl) + dailyStat.save() + + swap.feeValue = feeValue + swap.save() + } } diff --git a/spot-staking-subgraph/src/charmVault.ts b/spot-staking-subgraph/src/charmVault.ts index 3a420458..a7b49067 100644 --- a/spot-staking-subgraph/src/charmVault.ts +++ b/spot-staking-subgraph/src/charmVault.ts @@ -59,7 +59,7 @@ export function fetchCharmVault(address: Address): CharmVault { vault.tvl = BIGDECIMAL_ZERO vault.price = BIGDECIMAL_ZERO vault.totalSupply = BIGDECIMAL_ZERO - + let context = new DataSourceContext() context.setString('charmVault', id) RebasingERC20.createWithContext(getUnderlyingAddress(token1Address), context) @@ -68,7 +68,10 @@ export function fetchCharmVault(address: Address): CharmVault { return vault as CharmVault } -export function fetchCharmVaultDailyStat(vault: CharmVault, timestamp: BigInt): CharmVaultDailyStat { +export function fetchCharmVaultDailyStat( + vault: CharmVault, + timestamp: BigInt, +): CharmVaultDailyStat { let id = vault.id.concat('-').concat(timestamp.toString()) let dailyStat = CharmVaultDailyStat.load(id) if (dailyStat === null) { @@ -103,7 +106,9 @@ export function refreshCharmVaultStats(vault: CharmVault, dailyStat: CharmVaultD vault.token1Bal = formatBalance(tokenBals.value1, vault.token1Decimals) vault.token0Price = BIGDECIMAL_ONE vault.token1Price = prices[0] - vault.tvl = vault.token0Bal.times(vault.token0Price).plus(vault.token1Bal.times(vault.token1Price)) + vault.tvl = vault.token0Bal + .times(vault.token0Price) + .plus(vault.token1Bal.times(vault.token1Price)) vault.totalSupply = formatBalance(vaultContract.totalSupply(), vault.decimals) vault.price = vault.tvl.div(vault.totalSupply) vault.save() @@ -145,9 +150,15 @@ export function handleFees(event: CollectFees): void { let dailyStat = fetchCharmVaultDailyStat(vault, dayTimestamp(event.block.timestamp)) refreshCharmVaultStats(vault, dailyStat) - dailyStat.token0Fees = dailyStat.token0Fees.plus(formatBalance(event.params.feesToVault0, vault.token0Decimals)) - dailyStat.token1Fees = dailyStat.token1Fees.plus(formatBalance(event.params.feesToVault1, vault.token1Decimals)) - dailyStat.totalFeeVal = dailyStat.token1Fees.times(dailyStat.token1Price).plus(dailyStat.token0Fees.times(dailyStat.token0Price)) + dailyStat.token0Fees = dailyStat.token0Fees.plus( + formatBalance(event.params.feesToVault0, vault.token0Decimals), + ) + dailyStat.token1Fees = dailyStat.token1Fees.plus( + formatBalance(event.params.feesToVault1, vault.token1Decimals), + ) + dailyStat.totalFeeVal = dailyStat.token1Fees + .times(dailyStat.token1Price) + .plus(dailyStat.token0Fees.times(dailyStat.token0Price)) dailyStat.feeYield = dailyStat.totalFeeVal.div(dailyStat.tvl.minus(dailyStat.totalFeeVal)) dailyStat.save() } diff --git a/spot-staking-subgraph/src/utils.ts b/spot-staking-subgraph/src/utils.ts index a5aa75c4..9176aecd 100644 --- a/spot-staking-subgraph/src/utils.ts +++ b/spot-staking-subgraph/src/utils.ts @@ -67,4 +67,4 @@ export function getUnderlyingAddress(tokenAddress: Address): Address { return collateralResult.value } return Address.fromString('0x0000000000000000000000000000000000000000') -} \ No newline at end of file +} diff --git a/spot-subgraph/schema.graphql b/spot-subgraph/schema.graphql index c37a2229..fd300ffe 100644 --- a/spot-subgraph/schema.graphql +++ b/spot-subgraph/schema.graphql @@ -232,18 +232,6 @@ type PerpetualTrancheDailyStat @entity { " the timestamp of the given day " timestamp: BigInt! - " the total perp tokens minted on the given day " - totalMints: BigDecimal! - - " the total perp tokens redeemed on the given day " - totalRedemptions: BigDecimal! - - " the total value of perp tokens minted on the given day " - totalMintValue: BigDecimal! - - " the total value of perp tokens redeemed on the given day " - totalRedemptionValue: BigDecimal! - " the tvl on the given day " tvl: BigDecimal! @@ -252,6 +240,9 @@ type PerpetualTrancheDailyStat @entity { " the perp token supply on the given day " totalSupply: BigDecimal! + + " the total underlying value of fees " + totalUnderlyingFeeValue: BigDecimal! } type RolloverVault @entity { @@ -273,12 +264,6 @@ type RolloverVault @entity { " addresses of assets currently in the reserve " activeReserves: [RolloverVaultAsset!]! - " the total fixed mc share of underlying tokens deposited into the system " - totalScaledUnderlyingDeposited: BigDecimal! - - " the total fixed mc share of underlying tokens deposited by each user " - scaledUnderlyingBalances: [ScaledUnderlyingVaultDepositorBalance!]! @derivedFrom(field: "vault") - " the current tvl based on the active reserves " tvl: BigDecimal! @@ -288,17 +273,16 @@ type RolloverVault @entity { " the price of each token " price: BigDecimal! + " the target system ratio " + targetSystemRatio: BigDecimal! + + " the system deviation ratio " + deviationRatio: BigDecimal! + " reference to the daily stats " dailyStats: [RolloverVaultDailyStat!]! @derivedFrom(field: "vault") } -type ScaledUnderlyingVaultDepositorBalance @entity { - id: ID! - vault: RolloverVault! - account: Bytes! - value: BigDecimal! -} - type RolloverVaultAsset @entity { " Equals to: -" id: ID! @@ -329,18 +313,6 @@ type RolloverVaultDailyStat @entity { " the timestamp of the given day " timestamp: BigInt! - " the total vault notes minted on the given day " - totalMints: BigDecimal! - - " the total vault notes redeemed on the given day " - totalRedemptions: BigDecimal! - - " the total value of vault notes minted on the given day " - totalMintValue: BigDecimal! - - " the total value of vault notes redeemed on the given day " - totalRedemptionValue: BigDecimal! - " the tvl on the given day " tvl: BigDecimal! @@ -353,12 +325,9 @@ type RolloverVaultDailyStat @entity { " the vault note supply on the given day " totalSupply: BigDecimal! - " the total value of swaps on the given day " - totalSwapValue: BigDecimal! - - " the total value of underlying to perp swaps on the given day " - totalUnderlyingToPerpSwapValue: BigDecimal! + " the system deviation ratio " + deviationRatio: BigDecimal! - " the total value of perp to underlying swaps on the given day " - totalPerpToUnderlyingSwapValue: BigDecimal! + " the total underlying value of fees " + totalUnderlyingFeeValue: BigDecimal! } \ No newline at end of file diff --git a/spot-subgraph/scripts/deploy.sh b/spot-subgraph/scripts/deploy.sh index e6c0c3c6..0c8bcfb8 100755 --- a/spot-subgraph/scripts/deploy.sh +++ b/spot-subgraph/scripts/deploy.sh @@ -7,6 +7,10 @@ yarn codegen yarn build +echo "NOTE: graph deploy to Alchemy fails when you redeploy with the same IPFS hash" + +# yarn graph auth $THE_GRAPH_API_KEY +# yarn graph deploy $2 yarn graph deploy $2 \ --node https://subgraphs.alchemy.com/api/subgraphs/deploy \ - --deploy-key $GRAPH_AUTH \ No newline at end of file + --deploy-key $GRAPH_AUTH diff --git a/spot-subgraph/scripts/generate-ipfs-cid.sh b/spot-subgraph/scripts/generate-ipfs-cid.sh new file mode 100755 index 00000000..d09d8209 --- /dev/null +++ b/spot-subgraph/scripts/generate-ipfs-cid.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# generate-ipfs-cid.sh +# Computes IPFS CID of a given directory using IPFS in Docker without uploading + +set -e + +TARGET_PATH=${1:-build} + +if [ ! -d "$TARGET_PATH" ]; then + echo "❌ Error: Directory '$TARGET_PATH' does not exist." + echo "Usage: $0 [path-to-directory]" + exit 1 +fi + +echo "📦 Computing IPFS CID for '$TARGET_PATH'..." + +CID=$(docker run --rm \ + -v "$(pwd):/data" \ + -e IPFS_PATH=/tmp/ipfs \ + --entrypoint sh \ + ipfs/kubo \ + -c "ipfs init >/dev/null && ipfs add -r --only-hash --quiet /data/$TARGET_PATH" | tail -n 1) + +if [ -z "$CID" ]; then + echo "❌ Failed to generate IPFS CID." + exit 1 +fi + +echo "✅ IPFS CID: $CID" diff --git a/spot-subgraph/src/data/perpetualTranche.ts b/spot-subgraph/src/data/perpetualTranche.ts index dd0c5a28..fac3a83b 100644 --- a/spot-subgraph/src/data/perpetualTranche.ts +++ b/spot-subgraph/src/data/perpetualTranche.ts @@ -172,13 +172,10 @@ export function fetchPerpetualTrancheDailyStat( dailyStat = new PerpetualTrancheDailyStat(id) dailyStat.perp = perp.id dailyStat.timestamp = timestamp - dailyStat.totalMints = BIGDECIMAL_ZERO - dailyStat.totalRedemptions = BIGDECIMAL_ZERO - dailyStat.totalMintValue = BIGDECIMAL_ZERO - dailyStat.totalRedemptionValue = BIGDECIMAL_ZERO dailyStat.tvl = BIGDECIMAL_ZERO dailyStat.price = BIGDECIMAL_ZERO dailyStat.totalSupply = BIGDECIMAL_ZERO + dailyStat.totalUnderlyingFeeValue = BIGDECIMAL_ZERO } return dailyStat as PerpetualTrancheDailyStat } diff --git a/spot-subgraph/src/data/rolloverVault.ts b/spot-subgraph/src/data/rolloverVault.ts index 47575d5e..0a9d21fc 100644 --- a/spot-subgraph/src/data/rolloverVault.ts +++ b/spot-subgraph/src/data/rolloverVault.ts @@ -1,12 +1,12 @@ -import { BigDecimal, BigInt, Address, DataSourceContext } from '@graphprotocol/graph-ts' +import { log, BigDecimal, BigInt, Address, DataSourceContext } from '@graphprotocol/graph-ts' import { RolloverVault, RolloverVaultAsset, - ScaledUnderlyingVaultDepositorBalance, RolloverVaultDailyStat, Tranche, } from '../../generated/schema' import { RolloverVault as RolloverVaultABI } from '../../generated/RolloverVault/RolloverVault' +import { FeePolicy as FeePolicyABI } from '../../generated/RolloverVault/FeePolicy' import { ERC20 as ERC20ABI } from '../../generated/BondFactory/ERC20' import { RebasingToken as RebasingTokenTemplate } from '../../generated/templates' import { @@ -16,6 +16,7 @@ import { BIGDECIMAL_ONE, stringToAddress, formatBalance, + formatDecimalBalance, getTrancheCDRInfo, } from '../utils' import { fetchPerpetualTranche } from './perpetualTranche' @@ -96,6 +97,8 @@ export function refreshRolloverVaultTVL(vault: RolloverVault): void { if (vaultToken.totalSupply.gt(BIGDECIMAL_ZERO)) { vault.price = vault.tvl.div(vaultToken.totalSupply) } + vault.targetSystemRatio = fetchTargetSystemRatio(vaultAddress) + vault.deviationRatio = fetchDeviationRatio(perpAddress, vaultAddress, vault.targetSystemRatio) vault.save() } @@ -157,6 +160,7 @@ export function refreshRolloverVaultDailyStat(dailyStat: RolloverVaultDailyStat) dailyStat.rebaseMultiplier = vault.rebaseMultiplier dailyStat.price = vault.price dailyStat.totalSupply = vaultToken.totalSupply + dailyStat.deviationRatio = vault.deviationRatio dailyStat.save() } @@ -168,11 +172,12 @@ export function fetchRolloverVault(address: Address): RolloverVault { vaultToken.save() vault = new RolloverVault(id) vault.token = vaultToken.id - vault.totalScaledUnderlyingDeposited = BIGDECIMAL_ZERO vault.activeReserves = [] vault.tvl = BIGDECIMAL_ZERO vault.rebaseMultiplier = BIGDECIMAL_ONE vault.price = BIGDECIMAL_ZERO + vault.targetSystemRatio = BIGDECIMAL_ZERO + vault.deviationRatio = BIGDECIMAL_ZERO refreshRolloverVaultStore(vault as RolloverVault) let underlyingContext = new DataSourceContext() @@ -212,21 +217,6 @@ export function fetchRolloverVaultAsset( return assetToken as RolloverVaultAsset } -export function fetchScaledUnderlyingVaultDepositorBalance( - vault: RolloverVault, - account: Address, -): ScaledUnderlyingVaultDepositorBalance { - let id = vault.id.concat('-').concat(account.toHexString()) - let balance = ScaledUnderlyingVaultDepositorBalance.load(id) - if (balance == null) { - balance = new ScaledUnderlyingVaultDepositorBalance(id) - balance.vault = vault.id - balance.account = account - balance.value = BIGDECIMAL_ZERO - } - return balance as ScaledUnderlyingVaultDepositorBalance -} - export function fetchRolloverVaultDailyStat( vault: RolloverVault, timestamp: BigInt, @@ -237,17 +227,85 @@ export function fetchRolloverVaultDailyStat( dailyStat = new RolloverVaultDailyStat(id) dailyStat.vault = vault.id dailyStat.timestamp = timestamp - dailyStat.totalMints = BIGDECIMAL_ZERO - dailyStat.totalRedemptions = BIGDECIMAL_ZERO - dailyStat.totalMintValue = BIGDECIMAL_ZERO - dailyStat.totalRedemptionValue = BIGDECIMAL_ZERO dailyStat.tvl = BIGDECIMAL_ZERO dailyStat.rebaseMultiplier = BIGDECIMAL_ONE dailyStat.price = BIGDECIMAL_ZERO dailyStat.totalSupply = BIGDECIMAL_ZERO - dailyStat.totalSwapValue = BIGDECIMAL_ZERO - dailyStat.totalUnderlyingToPerpSwapValue = BIGDECIMAL_ZERO - dailyStat.totalPerpToUnderlyingSwapValue = BIGDECIMAL_ZERO + dailyStat.deviationRatio = BIGDECIMAL_ZERO + dailyStat.totalUnderlyingFeeValue = BIGDECIMAL_ZERO } return dailyStat as RolloverVaultDailyStat } + +function fetchDeviationRatio( + perpAddress: Address, + vaultAddress: Address, + targetSystemRatio: BigDecimal, +): BigDecimal { + let perp = fetchPerpetualTranche(perpAddress) + let vault = fetchRolloverVault(vaultAddress) + return calcDeviationRatio(perp.tvl, vault.tvl, targetSystemRatio) +} + +function fetchTargetSystemRatio(vaultAddress: Address): BigDecimal { + let SYSTEM_RATIO_START = BigDecimal.fromString('3') + let vaultContract = RolloverVaultABI.bind(vaultAddress) + let r1 = vaultContract.try_feePolicy() + if (r1.reverted) { + log.error('fee policy not set', []) + return SYSTEM_RATIO_START + } + let feePolicyContract = FeePolicyABI.bind(r1.value) + let r2 = feePolicyContract.try_targetSystemRatio() + if (r2.reverted) { + log.error('fee policy version incorrect', []) + return SYSTEM_RATIO_START + } + log.error('fee policy correct {}:{}', [r1.value.toHexString(), r2.value.toString()]) + return formatBalance(r2.value, BigInt.fromI32(feePolicyContract.decimals())) +} + +function calcDeviationRatio( + perpTVL: BigDecimal, + vaultTVL: BigDecimal, + targetSystemRatio: BigDecimal, +): BigDecimal { + return vaultTVL.div(perpTVL).div(targetSystemRatio) +} + +export function computeFeePerc( + perpTVLPre: BigDecimal, + vaultTVLPre: BigDecimal, + perpTVLPost: BigDecimal, + vaultTVLPost: BigDecimal, + targetSystemRatio: BigDecimal, + vaultAddress: Address, +): BigDecimal { + let vaultContract = RolloverVaultABI.bind(vaultAddress) + let r1 = vaultContract.try_feePolicy() + if (r1.reverted) { + log.error('fee policy not set', []) + return BIGDECIMAL_ZERO + } + let feePolicyContract = FeePolicyABI.bind(r1.value) + let feePolicyDecimals = BigInt.fromI32(feePolicyContract.decimals()) + let drPre = formatDecimalBalance( + calcDeviationRatio(perpTVLPre, vaultTVLPre, targetSystemRatio), + feePolicyDecimals, + ) + let drPost = formatDecimalBalance( + calcDeviationRatio(perpTVLPost, vaultTVLPost, targetSystemRatio), + feePolicyDecimals, + ) + let r2 = feePolicyContract.try_computeFeePerc(drPre, drPost) + if (r2.reverted) { + log.error('fee policy version incorrect', []) + return BIGDECIMAL_ZERO + } + log.error('fee policy correct {}:{}:{}', [ + r1.value.toHexString(), + drPre.toString(), + drPost.toString(), + ]) + return formatBalance(r2.value, feePolicyDecimals) +} diff --git a/spot-subgraph/src/mappings/perpetualTranche.ts b/spot-subgraph/src/mappings/perpetualTranche.ts index a0e01020..e3d5b5c6 100644 --- a/spot-subgraph/src/mappings/perpetualTranche.ts +++ b/spot-subgraph/src/mappings/perpetualTranche.ts @@ -56,37 +56,35 @@ export function handleUpdatedDepositBond(event: UpdatedDepositBond): void { perp.save() } -export function handleMint(event: Transfer): void { +export function handleTransfer(event: Transfer): void { let from = event.params.from + let to = event.params.to if (from == ADDRESS_ZERO) { log.debug('triggered mint', []) let perpToken = fetchToken(event.address) refreshSupply(perpToken) + let perp = fetchPerpetualTranche(event.address) + refreshPerpetualTrancheTVL(perp) + } + if (to == ADDRESS_ZERO) { + log.debug('triggered burn', []) + let perpToken = fetchToken(event.address) + refreshSupply(perpToken) let perp = fetchPerpetualTranche(event.address) refreshPerpetualTrancheTVL(perp) + } - let perpAmtMinted = formatBalance(event.params.value, perpToken.decimals) + // Mint and burn fees are handled by sending perp tokens to the perp contract + if (to == event.address) { + log.debug('perp fees paid', []) + let perpToken = fetchToken(event.address) + let perp = fetchPerpetualTranche(event.address) + let perpFeeAmt = formatBalance(event.params.value, perpToken.decimals) let dailyStat = fetchPerpetualTrancheDailyStat(perp, dayTimestamp(event.block.timestamp)) - dailyStat.totalMints = dailyStat.totalMints.plus(perpAmtMinted) - dailyStat.totalMintValue = dailyStat.totalMintValue.plus(perpAmtMinted.times(perp.price)) + dailyStat.totalUnderlyingFeeValue = dailyStat.totalUnderlyingFeeValue.plus( + perpFeeAmt.times(perp.price), + ) dailyStat.save() } } - -export function handleRedeem(call: RedeemCall): void { - log.debug('triggered redeem', []) - let perpToken = fetchToken(call.to) - refreshSupply(perpToken) - - let perp = fetchPerpetualTranche(call.to) - refreshPerpetualTrancheTVL(perp) - - let perpAmtBurnt = formatBalance(call.inputs.perpAmtBurnt, perpToken.decimals) - let dailyStat = fetchPerpetualTrancheDailyStat(perp, dayTimestamp(call.block.timestamp)) - dailyStat.totalRedemptions = dailyStat.totalRedemptions.plus(perpAmtBurnt) - dailyStat.totalRedemptionValue = dailyStat.totalRedemptionValue.plus( - perpAmtBurnt.times(perp.price), - ) - dailyStat.save() -} diff --git a/spot-subgraph/src/mappings/rolloverVault.ts b/spot-subgraph/src/mappings/rolloverVault.ts index 0aad7c70..60ebd29e 100644 --- a/spot-subgraph/src/mappings/rolloverVault.ts +++ b/spot-subgraph/src/mappings/rolloverVault.ts @@ -1,5 +1,6 @@ import { log, ethereum } from '@graphprotocol/graph-ts' import { + Transfer, DepositCall, RedeemCall, AssetSynced, @@ -10,12 +11,12 @@ import { RebasingERC20 as RebasingERC20ABI } from '../../generated/templates/Reb import { fetchPerpetualTranche, refreshPerpetualTrancheTVL } from '../data/perpetualTranche' import { fetchRolloverVault, - fetchScaledUnderlyingVaultDepositorBalance, refreshRolloverVaultTVL, refreshRolloverVaultRebaseMultiplier, refreshRolloverVaultDailyStat, fetchRolloverVaultAsset, fetchRolloverVaultDailyStat, + computeFeePerc, } from '../data/rolloverVault' import { fetchToken, refreshSupply } from '../data/token' import { @@ -25,76 +26,74 @@ import { removeFromSet, BIGDECIMAL_ZERO, dayTimestamp, + ADDRESS_ZERO, } from '../utils' +export function handleTransfer(event: Transfer): void { + let from = event.params.from + let to = event.params.to + if (from == ADDRESS_ZERO) { + log.debug('triggered mint', []) + let vault = fetchRolloverVault(event.address) + let vaultToken = fetchToken(event.address) + refreshSupply(vaultToken) + refreshRolloverVaultTVL(vault) + refreshRolloverVaultRebaseMultiplier(vault) + } + + if (to == ADDRESS_ZERO) { + log.debug('triggered burn', []) + let vault = fetchRolloverVault(event.address) + let vaultToken = fetchToken(event.address) + refreshSupply(vaultToken) + refreshRolloverVaultTVL(vault) + refreshRolloverVaultRebaseMultiplier(vault) + } +} + export function handleDeposit(call: DepositCall): void { log.debug('triggered deposit', []) let vault = fetchRolloverVault(call.to) - let vaultToken = fetchToken(stringToAddress(vault.token)) - refreshSupply(vaultToken) - refreshRolloverVaultTVL(vault) - refreshRolloverVaultRebaseMultiplier(vault) - + let vaultAddress = stringToAddress(vault.token) + let perp = fetchPerpetualTranche(stringToAddress(vault.perp)) let underlyingToken = fetchToken(stringToAddress(vault.underlying)) - refreshSupply(underlyingToken) - let underlyingTokenSupply = underlyingToken.totalSupply - - let underlyingTokenContract = RebasingERC20ABI.bind(stringToAddress(vault.underlying)) - let scaledUnderlyingSupply = underlyingTokenContract.scaledTotalSupply().toBigDecimal() let underlyingAmtIn = formatBalance(call.inputs.underlyingAmtIn, underlyingToken.decimals) - let scaledUnderlyingAmountIn = underlyingAmtIn - .times(scaledUnderlyingSupply) - .div(underlyingTokenSupply) - vault.totalScaledUnderlyingDeposited = vault.totalScaledUnderlyingDeposited.plus( - scaledUnderlyingAmountIn, - ) - vault.save() - - let scaledUnderlyingDepositorBalance = fetchScaledUnderlyingVaultDepositorBalance( - vault, - call.from, + let dailyStat = fetchRolloverVaultDailyStat(vault, dayTimestamp(call.block.timestamp)) + let feePerc = computeFeePerc( + perp.tvl, + vault.tvl.minus(underlyingAmtIn), + perp.tvl, + vault.tvl, + vault.targetSystemRatio, + vaultAddress, ) - scaledUnderlyingDepositorBalance.value = scaledUnderlyingDepositorBalance.value.plus( - scaledUnderlyingAmountIn, + dailyStat.totalUnderlyingFeeValue = dailyStat.totalUnderlyingFeeValue.plus( + underlyingAmtIn.times(feePerc), ) - scaledUnderlyingDepositorBalance.save() - - let dailyStat = fetchRolloverVaultDailyStat(vault, dayTimestamp(call.block.timestamp)) - dailyStat.totalMints = dailyStat.totalMints.plus(underlyingAmtIn.div(vault.price)) - dailyStat.totalMintValue = dailyStat.totalMintValue.plus(underlyingAmtIn) dailyStat.save() } export function handleRedeem(call: RedeemCall): void { log.debug('triggered redeem', []) let vault = fetchRolloverVault(call.to) - let vaultToken = fetchToken(stringToAddress(vault.token)) - refreshSupply(vaultToken) - refreshRolloverVaultTVL(vault) - refreshRolloverVaultRebaseMultiplier(vault) + let vaultAddress = stringToAddress(vault.token) + let vaultToken = fetchToken(vaultAddress) + let perp = fetchPerpetualTranche(stringToAddress(vault.perp)) let notesOut = formatBalance(call.inputs.notes, vaultToken.decimals) - let scaledAmountOut = vault.totalScaledUnderlyingDeposited - .times(notesOut) - .div(vaultToken.totalSupply) - vault.totalScaledUnderlyingDeposited = vault.totalScaledUnderlyingDeposited.minus( - scaledAmountOut, - ) - vault.save() - - let scaledUnderlyingDepositorBalance = fetchScaledUnderlyingVaultDepositorBalance( - vault, - call.from, + let dailyStat = fetchRolloverVaultDailyStat(vault, dayTimestamp(call.block.timestamp)) + let feePerc = computeFeePerc( + perp.tvl, + vault.tvl.times(notesOut + vaultToken.totalSupply).div(vaultToken.totalSupply), + perp.tvl, + vault.tvl, + vault.targetSystemRatio, + vaultAddress, ) - scaledUnderlyingDepositorBalance.value = scaledUnderlyingDepositorBalance.value.minus( - scaledAmountOut, + dailyStat.totalUnderlyingFeeValue = dailyStat.totalUnderlyingFeeValue.plus( + notesOut.times(vault.price).times(feePerc), ) - scaledUnderlyingDepositorBalance.save() - - let dailyStat = fetchRolloverVaultDailyStat(vault, dayTimestamp(call.block.timestamp)) - dailyStat.totalRedemptions = dailyStat.totalRedemptions.plus(notesOut) - dailyStat.totalRedemptionValue = dailyStat.totalRedemptionValue.plus(notesOut.times(vault.price)) dailyStat.save() } @@ -127,17 +126,36 @@ export function handleUnderlyingToPerpSwap(call: SwapUnderlyingForPerpsCall): vo log.debug('triggered UnderlyingToPerpSwap', []) let vault = fetchRolloverVault(call.to) + let vaultAddress = stringToAddress(vault.token) refreshRolloverVaultTVL(vault) refreshRolloverVaultRebaseMultiplier(vault) + let perp = fetchPerpetualTranche(stringToAddress(vault.perp)) + refreshPerpetualTrancheTVL(perp) + let underlyingToken = fetchToken(stringToAddress(vault.underlying)) let underlyingAmtIn = formatBalance(call.inputs.underlyingAmtIn, underlyingToken.decimals) let dailyStat = fetchRolloverVaultDailyStat(vault, dayTimestamp(call.block.timestamp)) - dailyStat.totalSwapValue = dailyStat.totalSwapValue.plus(underlyingAmtIn) - dailyStat.totalUnderlyingToPerpSwapValue = dailyStat.totalUnderlyingToPerpSwapValue.plus( - underlyingAmtIn, + let feePerc = computeFeePerc( + perp.tvl.minus(underlyingAmtIn), + vault.tvl, + perp.tvl, + vault.tvl, + vault.targetSystemRatio, + vaultAddress, + ) + log.error('computing fee {}:{}:{}:{}', [ + perp.tvl.minus(underlyingAmtIn).toString(), + vault.tvl.toString(), + perp.tvl.toString(), + vault.tvl.toString(), + vault.targetSystemRatio.toString(), + ]) + dailyStat.totalUnderlyingFeeValue = dailyStat.totalUnderlyingFeeValue.plus( + underlyingAmtIn.times(feePerc), ) + dailyStat.save() } @@ -145,6 +163,7 @@ export function handlePerpToUnderlyingSwap(call: SwapPerpsForUnderlyingCall): vo log.debug('triggered PerpToUnderlyingSwap', []) let vault = fetchRolloverVault(call.to) + let vaultAddress = stringToAddress(vault.token) refreshRolloverVaultTVL(vault) refreshRolloverVaultRebaseMultiplier(vault) @@ -155,9 +174,17 @@ export function handlePerpToUnderlyingSwap(call: SwapPerpsForUnderlyingCall): vo let perpAmtIn = formatBalance(call.inputs.perpAmtIn, underlyingToken.decimals) let dailyStat = fetchRolloverVaultDailyStat(vault, dayTimestamp(call.block.timestamp)) - dailyStat.totalSwapValue = dailyStat.totalSwapValue.plus(perpAmtIn.times(perp.price)) - dailyStat.totalPerpToUnderlyingSwapValue = dailyStat.totalPerpToUnderlyingSwapValue.plus( - perpAmtIn.times(perp.price), + let feePerc = computeFeePerc( + perp.tvl.plus(perpAmtIn.times(perp.price)), + vault.tvl, + perp.tvl, + vault.tvl, + vault.targetSystemRatio, + vaultAddress, + ) + dailyStat.totalUnderlyingFeeValue = dailyStat.totalUnderlyingFeeValue.plus( + perpAmtIn.times(perp.price).times(feePerc), ) + dailyStat.save() } diff --git a/spot-subgraph/src/utils.ts b/spot-subgraph/src/utils.ts index f44a0e57..a824c00d 100644 --- a/spot-subgraph/src/utils.ts +++ b/spot-subgraph/src/utils.ts @@ -9,6 +9,20 @@ export let BIGDECIMAL_ZERO = new BigDecimal(BIGINT_ZERO) export let BIGDECIMAL_ONE = new BigDecimal(BIGINT_ONE) export let ADDRESS_ZERO = Address.fromString('0x0000000000000000000000000000000000000000') +export const formatDecimalBalance = (value: BigDecimal, decimals: BigInt): BigInt => { + return toBigInt( + value.times( + BigInt.fromI32(10) + .pow(decimals.toI32() as u8) + .toBigDecimal(), + ), + ) +} + +function toBigInt(n: BigDecimal): BigInt { + return BigInt.fromString(n.toString().split('.')[0]) +} + export const formatBalance = (wei: BigInt, decimals: BigInt): BigDecimal => { return wei.toBigDecimal().div( BigInt.fromI32(10) diff --git a/spot-subgraph/subgraph.template.yaml b/spot-subgraph/subgraph.template.yaml index 33e8c8d4..a9f36996 100644 --- a/spot-subgraph/subgraph.template.yaml +++ b/spot-subgraph/subgraph.template.yaml @@ -140,16 +140,15 @@ dataSources: file: ../spot-contracts/external-artifacts/ERC20ABI.json - name: RebasingERC20 file: ../spot-contracts/external-artifacts/RebasingERC20ABI.json + - name: FeePolicy + file: ../spot-contracts/exported-artifacts/FeePolicy.json eventHandlers: - event: ReserveSynced(address,uint256) handler: handleReserveSynced - event: UpdatedDepositBond(address) handler: handleUpdatedDepositBond - event: Transfer(indexed address,indexed address,uint256) - handler: handleMint - callHandlers: - - function: redeem(uint256) - handler: handleRedeem + handler: handleTransfer file: ./src/mappings/perpetualTranche.ts - kind: ethereum/contract @@ -170,6 +169,8 @@ dataSources: file: ../spot-contracts/exported-artifacts/RolloverVault.json - name: PerpetualTranche file: ../spot-contracts/exported-artifacts/PerpetualTranche.json + - name: PerpetualTrancheV1 + file: ../spot-contracts/exported-artifacts/PerpetualTrancheV1.json - name: BondController file: ../spot-contracts/external-artifacts/BondController.json - name: Tranche @@ -178,9 +179,13 @@ dataSources: file: ../spot-contracts/external-artifacts/ERC20ABI.json - name: RebasingERC20 file: ../spot-contracts/external-artifacts/RebasingERC20ABI.json + - name: FeePolicy + file: ../spot-contracts/exported-artifacts/FeePolicy.json eventHandlers: - event: AssetSynced(address,uint256) handler: handleAssetSynced + - event: Transfer(indexed address,indexed address,uint256) + handler: handleTransfer callHandlers: - function: deposit(uint256) handler: handleDeposit @@ -270,6 +275,8 @@ templates: file: ../spot-contracts/external-artifacts/ERC20ABI.json - name: RebasingERC20 file: ../spot-contracts/external-artifacts/RebasingERC20ABI.json + - name: FeePolicy + file: ../spot-contracts/exported-artifacts/FeePolicy.json eventHandlers: - event: Rebase(indexed uint256,uint256) handler: handleRebase From b91b91dafd3ee6d41b50b902994409ffd610bbe3 Mon Sep 17 00:00:00 2001 From: aalavandhann <6264334+aalavandhan@users.noreply.github.com> Date: Fri, 11 Jul 2025 12:51:06 -0400 Subject: [PATCH 09/18] updated bill broker abi and redeployed subgraph --- spot-staking-subgraph/abis/BillBroker.json | 110 ++++++++++++++------- 1 file changed, 72 insertions(+), 38 deletions(-) diff --git a/spot-staking-subgraph/abis/BillBroker.json b/spot-staking-subgraph/abis/BillBroker.json index ab4ff3a8..8c730c59 100644 --- a/spot-staking-subgraph/abis/BillBroker.json +++ b/spot-staking-subgraph/abis/BillBroker.json @@ -14,6 +14,11 @@ "name": "InvalidPerc", "type": "error" }, + { + "inputs": [], + "name": "InvalidRange", + "type": "error" + }, { "inputs": [], "name": "SlippageTooHigh", @@ -31,12 +36,12 @@ }, { "inputs": [], - "name": "UnexpectedARDelta", + "name": "UnexpectedDecimals", "type": "error" }, { "inputs": [], - "name": "UnexpectedDecimals", + "name": "UnexpectedRangeDelta", "type": "error" }, { @@ -329,6 +334,32 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "MAX_ASSET_RATIO", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_FEE_FACTOR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "MINIMUM_LIQUIDITY", @@ -355,6 +386,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "TWO", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -627,7 +671,7 @@ "outputs": [ { "internalType": "uint256", - "name": "", + "name": "mintAmt", "type": "uint256" } ], @@ -692,7 +736,7 @@ "outputs": [ { "internalType": "uint256", - "name": "", + "name": "mintAmt", "type": "uint256" } ], @@ -760,11 +804,6 @@ "name": "usdAmtOut", "type": "uint256" }, - { - "internalType": "uint256", - "name": "lpFeeUsdAmt", - "type": "uint256" - }, { "internalType": "uint256", "name": "protocolFeeUsdAmt", @@ -787,7 +826,7 @@ "type": "uint256" } ], - "name": "computePerpToUSDSwapFeePerc", + "name": "computePerpToUSDSwapFeeFactor", "outputs": [ { "internalType": "uint256", @@ -864,11 +903,6 @@ "name": "perpAmtOut", "type": "uint256" }, - { - "internalType": "uint256", - "name": "lpFeePerpAmt", - "type": "uint256" - }, { "internalType": "uint256", "name": "protocolFeePerpAmt", @@ -910,7 +944,7 @@ "type": "uint256" } ], - "name": "computeUSDToPerpSwapFeePerc", + "name": "computeUSDToPerpSwapFeeFactor", "outputs": [ { "internalType": "uint256", @@ -1068,7 +1102,7 @@ } ], "internalType": "struct Range", - "name": "perpToUSDSwapFeePercs", + "name": "perpToUSDSwapFeeFactors", "type": "tuple" }, { @@ -1085,7 +1119,7 @@ } ], "internalType": "struct Range", - "name": "usdToPerpSwapFeePercs", + "name": "usdToPerpSwapFeeFactors", "type": "tuple" }, { @@ -1144,8 +1178,8 @@ "type": "address" }, { - "internalType": "contract ISpotPricingStrategy", - "name": "pricingStrategy_", + "internalType": "contract IPerpPricer", + "name": "oracle_", "type": "address" } ], @@ -1180,6 +1214,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "oracle", + "outputs": [ + { + "internalType": "contract IPerpPricer", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "owner", @@ -1265,19 +1312,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "pricingStrategy", - "outputs": [ - { - "internalType": "contract ISpotPricingStrategy", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "protocolFeeCollector", @@ -1574,7 +1608,7 @@ } ], "internalType": "struct Range", - "name": "perpToUSDSwapFeePercs", + "name": "perpToUSDSwapFeeFactors", "type": "tuple" }, { @@ -1591,7 +1625,7 @@ } ], "internalType": "struct Range", - "name": "usdToPerpSwapFeePercs", + "name": "usdToPerpSwapFeeFactors", "type": "tuple" }, { @@ -1626,12 +1660,12 @@ { "inputs": [ { - "internalType": "contract ISpotPricingStrategy", - "name": "pricingStrategy_", + "internalType": "contract IPerpPricer", + "name": "oracle_", "type": "address" } ], - "name": "updatePricingStrategy", + "name": "updateOracle", "outputs": [], "stateMutability": "nonpayable", "type": "function" From 634e00aac36c1714c1427d215d2ff9c0471a041a Mon Sep 17 00:00:00 2001 From: Aalavandhan <6264334+aalavandhan@users.noreply.github.com> Date: Thu, 17 Jul 2025 13:45:36 -0400 Subject: [PATCH 10/18] redeployed bill broker (#261) --- spot-vaults/.openzeppelin/mainnet.json | 319 +++++++++++++++++++++++++ spot-vaults/contracts/BillBroker.sol | 2 +- 2 files changed, 320 insertions(+), 1 deletion(-) diff --git a/spot-vaults/.openzeppelin/mainnet.json b/spot-vaults/.openzeppelin/mainnet.json index 6c707349..f7e88223 100644 --- a/spot-vaults/.openzeppelin/mainnet.json +++ b/spot-vaults/.openzeppelin/mainnet.json @@ -964,6 +964,325 @@ }, "namespaces": {} } + }, + "2887dfa3327bf2c6c3fedd96ab7570643d403c5255ef98a0e2387111a6844c57": { + "address": "0x9Ce5056eEEd22e4569a39DAa670bacD277df3ef1", + "txHash": "0xfa230a8845a5ed6906e9f680fd90e15945491a1b86db33677a00a8496370ac0c", + "layout": { + "solcVersion": "0.8.24", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:63", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:68" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:40" + }, + { + "label": "_balances", + "offset": 0, + "slot": "51", + "type": "t_mapping(t_address,t_uint256)", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:40" + }, + { + "label": "_allowances", + "offset": 0, + "slot": "52", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:42" + }, + { + "label": "_totalSupply", + "offset": 0, + "slot": "53", + "type": "t_uint256", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:44" + }, + { + "label": "_name", + "offset": 0, + "slot": "54", + "type": "t_string_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:46" + }, + { + "label": "_symbol", + "offset": 0, + "slot": "55", + "type": "t_string_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:47" + }, + { + "label": "__gap", + "offset": 0, + "slot": "56", + "type": "t_array(t_uint256)45_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:376" + }, + { + "label": "__gap", + "offset": 0, + "slot": "101", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC20BurnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol:51" + }, + { + "label": "_owner", + "offset": 0, + "slot": "151", + "type": "t_address", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22" + }, + { + "label": "__gap", + "offset": 0, + "slot": "152", + "type": "t_array(t_uint256)49_storage", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:94" + }, + { + "label": "_paused", + "offset": 0, + "slot": "201", + "type": "t_bool", + "contract": "PausableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:29" + }, + { + "label": "__gap", + "offset": 0, + "slot": "202", + "type": "t_array(t_uint256)49_storage", + "contract": "PausableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:116" + }, + { + "label": "_status", + "offset": 0, + "slot": "251", + "type": "t_uint256", + "contract": "ReentrancyGuardUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol:38" + }, + { + "label": "__gap", + "offset": 0, + "slot": "252", + "type": "t_array(t_uint256)49_storage", + "contract": "ReentrancyGuardUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol:88" + }, + { + "label": "perp", + "offset": 0, + "slot": "301", + "type": "t_contract(IPerpetualTranche)2878", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:94" + }, + { + "label": "usd", + "offset": 0, + "slot": "302", + "type": "t_contract(IERC20Upgradeable)5020", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:97" + }, + { + "label": "usdUnitAmt", + "offset": 0, + "slot": "303", + "type": "t_uint256", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:100" + }, + { + "label": "perpUnitAmt", + "offset": 0, + "slot": "304", + "type": "t_uint256", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:103" + }, + { + "label": "keeper", + "offset": 0, + "slot": "305", + "type": "t_address", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:108" + }, + { + "label": "oracle", + "offset": 0, + "slot": "306", + "type": "t_contract(IPerpPricer)13597", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:111" + }, + { + "label": "fees", + "offset": 0, + "slot": "307", + "type": "t_struct(BillBrokerFees)13707_storage", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:114" + }, + { + "label": "arHardBound", + "offset": 0, + "slot": "314", + "type": "t_struct(Range)13739_storage", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:117" + }, + { + "label": "arSoftBound", + "offset": 0, + "slot": "316", + "type": "t_struct(Range)13739_storage", + "contract": "BillBroker", + "src": "contracts/BillBroker.sol:121" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)45_storage": { + "label": "uint256[45]", + "numberOfBytes": "1440" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(IERC20Upgradeable)5020": { + "label": "contract IERC20Upgradeable", + "numberOfBytes": "20" + }, + "t_contract(IPerpPricer)13597": { + "label": "contract IPerpPricer", + "numberOfBytes": "20" + }, + "t_contract(IPerpetualTranche)2878": { + "label": "contract IPerpetualTranche", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "label": "mapping(address => mapping(address => uint256))", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)", + "numberOfBytes": "32" + }, + "t_string_storage": { + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(BillBrokerFees)13707_storage": { + "label": "struct BillBrokerFees", + "members": [ + { + "label": "mintFeePerc", + "type": "t_uint256", + "offset": 0, + "slot": "0" + }, + { + "label": "burnFeePerc", + "type": "t_uint256", + "offset": 0, + "slot": "1" + }, + { + "label": "perpToUSDSwapFeeFactors", + "type": "t_struct(Range)13739_storage", + "offset": 0, + "slot": "2" + }, + { + "label": "usdToPerpSwapFeeFactors", + "type": "t_struct(Range)13739_storage", + "offset": 0, + "slot": "4" + }, + { + "label": "protocolSwapSharePerc", + "type": "t_uint256", + "offset": 0, + "slot": "6" + } + ], + "numberOfBytes": "224" + }, + "t_struct(Range)13739_storage": { + "label": "struct Range", + "members": [ + { + "label": "lower", + "type": "t_uint256", + "offset": 0, + "slot": "0" + }, + { + "label": "upper", + "type": "t_uint256", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + }, + "namespaces": {} + } } } } diff --git a/spot-vaults/contracts/BillBroker.sol b/spot-vaults/contracts/BillBroker.sol index 0345a5f8..c5a8896e 100644 --- a/spot-vaults/contracts/BillBroker.sol +++ b/spot-vaults/contracts/BillBroker.sol @@ -84,7 +84,7 @@ contract BillBroker is uint256 public constant TWO = ONE * 2; uint256 private constant INITIAL_RATE = 1000000; uint256 public constant MINIMUM_LIQUIDITY = 10 ** 22; - uint256 public constant MAX_FEE_FACTOR = ((ONE * 6) / 5); // 1.2 or 20% + uint256 public constant MAX_FEE_FACTOR = (ONE * 2); // 2 or 100% uint256 public constant MAX_ASSET_RATIO = uint256(type(int256).max); //------------------------------------------------------------------------- From 141553141f027cc890f9208aa895add38a3cca90 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Aug 2025 10:11:06 -0400 Subject: [PATCH 11/18] Bump actions/checkout from 4 to 5 (#262) Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/nightly.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 7d04bb2f..b57a58f0 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -16,7 +16,7 @@ jobs: steps: - name: Setup Repo - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Uses node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e8167a14..e21e8799 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,7 @@ jobs: steps: - name: Setup Repo - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Uses node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 From 15bed7b41545567e59a30b9731710f6a26dca03e Mon Sep 17 00:00:00 2001 From: Aalavandhan <6264334+aalavandhan@users.noreply.github.com> Date: Wed, 4 Feb 2026 14:40:28 -0500 Subject: [PATCH 12/18] DRBalancerVault contract for system DR rebalancing (#269) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Implement a vault that holds underlying (AMPL) and perp (SPOT) tokens and auto-rebalances to maintain the system's target deviation ratio via IRolloverVault swaps. Key features: - Deposit underlying tokens and mint vault notes (LP tokens) - Redeem notes for proportional underlying + perp tokens - Auto-rebalance when system DR is outside equilibrium zone: DR < 1 (perpTVL too high): redeem perps to decrease perpTVL DR > 1 (perpTVL too low): mint perps to increase perpTVL - Rebalance formula: requiredChange = perpTVL × |dr - targetDR| (rolloverVaultTVL unchanged during flash mint/redeem) - Liquidity limits based on swap direction: underlying->perp: limited by underlying balance perp->underlying: limited by perp value held - Separate lag factors and percentage limits for each direction - Slippage protection with configurable max swap fee percentage - Keeper-controlled pause functionality. * Update DRBalancerVault deposit/redeem to accept both tokens with slippage protection - Update deposit() to accept both underlying and perp tokens with signature: deposit(underlyingAmtMax, perpAmtMax, minNotesMinted) - Update redeem() to include slippage protection with signature: redeem(notesAmt, minUnderlyingAmtOut, minPerpAmtOut) - Update computeMintAmt() to return (notesMinted, underlyingAmtIn, perpAmtIn) - First deposit accepts any ratio; subsequent deposits enforce vault ratio - Update Deposited event to include perpAmtIn - Fix lag factor comments (swapped DR conditions) - Add InvalidLagFactor validation to prevent division by zero - Update contract docstring to reflect dual-token deposits Co-Authored-By: Claude Opus 4.5 * renamed events * added dr eq range back * allowing empty equilibriumDR --------- Co-authored-by: Claude Opus 4.5 --- .gitignore | 3 + spot-contracts/package.json | 2 +- spot-vaults/contracts/DRBalancerVault.sol | 621 ++++ .../_interfaces/IDRBalancerVault.sol | 145 + .../_interfaces/errors/DRBalancerErrors.sol | 14 + .../contracts/_test/MockPerpetualTranche.sol | 16 + spot-vaults/package.json | 4 +- spot-vaults/tasks/info.ts | 4 +- spot-vaults/test/DRBalancerVault.ts | 336 ++ .../test/DRBalancerVault_deposit_redeem.ts | 747 +++++ spot-vaults/test/DRBalancerVault_rebalance.ts | 625 ++++ spot-vaults/test/helpers.ts | 1 + yarn.lock | 2708 +++++++++-------- 13 files changed, 3886 insertions(+), 1340 deletions(-) create mode 100644 spot-vaults/contracts/DRBalancerVault.sol create mode 100644 spot-vaults/contracts/_interfaces/IDRBalancerVault.sol create mode 100644 spot-vaults/contracts/_interfaces/errors/DRBalancerErrors.sol create mode 100644 spot-vaults/contracts/_test/MockPerpetualTranche.sol create mode 100644 spot-vaults/test/DRBalancerVault.ts create mode 100644 spot-vaults/test/DRBalancerVault_deposit_redeem.ts create mode 100644 spot-vaults/test/DRBalancerVault_rebalance.ts diff --git a/.gitignore b/.gitignore index 48cb62f1..a23d44a0 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,6 @@ artifacts #Generated files RolloverBatch.json RedeemBatch.json + +.claude +CLAUDE.md \ No newline at end of file diff --git a/spot-contracts/package.json b/spot-contracts/package.json index 54d85765..8cd429e6 100644 --- a/spot-contracts/package.json +++ b/spot-contracts/package.json @@ -26,7 +26,7 @@ "@ethersproject/providers": "^5.6.8", "@nomicfoundation/hardhat-chai-matchers": "latest", "@nomicfoundation/hardhat-ethers": "^3.0.0", - "@nomicfoundation/hardhat-verify": "latest", + "@nomicfoundation/hardhat-verify": "^2.0.0", "@nomiclabs/hardhat-waffle": "^2.0.6", "@openzeppelin/hardhat-upgrades": "^3.0.4", "@openzeppelin/upgrades-core": "latest", diff --git a/spot-vaults/contracts/DRBalancerVault.sol b/spot-vaults/contracts/DRBalancerVault.sol new file mode 100644 index 00000000..b7a31e0f --- /dev/null +++ b/spot-vaults/contracts/DRBalancerVault.sol @@ -0,0 +1,621 @@ +// SPDX-License-Identifier: BUSL-1.1 +pragma solidity ^0.8.24; + +import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; +import { PausableUpgradeable } from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; +import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; +import { MathUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol"; +import { SafeERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; +import { ERC20BurnableUpgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol"; +import { IERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; +import { IERC20MetadataUpgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol"; + +import { IPerpetualTranche } from "@ampleforthorg/spot-contracts/contracts/_interfaces/IPerpetualTranche.sol"; +import { IRolloverVault } from "@ampleforthorg/spot-contracts/contracts/_interfaces/IRolloverVault.sol"; +import { ERC20Helpers } from "@ampleforthorg/spot-contracts/contracts/_utils/ERC20Helpers.sol"; +import { UnauthorizedCall, InvalidPerc, InvalidRange } from "./_interfaces/errors/CommonErrors.sol"; +import { Range } from "@ampleforthorg/spot-contracts/contracts/_interfaces/CommonTypes.sol"; +import { LastRebalanceTooRecent, SlippageTooHigh, InvalidLagFactor } from "./_interfaces/errors/DRBalancerErrors.sol"; + +/** + * @title DRBalancerVault + * + * @notice A vault that holds underlying (e.g., AMPL) and perp (SPOT) tokens as liquidity, + * and auto-rebalances to help maintain the SYSTEM's target deviation ratio + * via IRolloverVault swaps. + * + * The system's deviation ratio (DR) is defined by FeePolicy: + * DR = stamplTVL / perpTVL / targetSystemRatio + * + * When DR < 1 (under-subscribed): perpTVL is too high, redeem perps to decrease it + * When DR > 1 (over-subscribed): perpTVL is too low, mint perps to increase it + * + * LPs deposit underlying and/or perp tokens and receive vault notes. They can redeem + * their notes for a proportional share of the vault's underlying and perp holdings. + * + * @dev Rebalance Math: + * + * Since stamplTVL doesn't change during flash mint/redeem: + * requiredChange = perpTVL × |dr - targetDR| + * adjustedChange = requiredChange / lagFactor + * + * The adjusted change is capped by: + * - minRebalanceVal: skip rebalance if below this threshold + * - availableLiquidity: perp value (DR < 1) or underlying balance (DR > 1) + * - requiredChange: prevent overshoot + * + * Example: DR = 0.80 (too low, redeem perps) + * Given: perpTVL = 10,000, lagFactor = 3, minRebalanceVal = 100 + * - drDelta = 1.0 - 0.80 = 0.20 + * - requiredChange = 10,000 × 0.20 = 2,000 + * - adjustedChange = 2,000 / 3 = 666 + * - 666 >= minRebalanceVal, so proceed + * - Result: Redeem 666 AMPL worth of perps (capped by available liquidity) + */ +contract DRBalancerVault is + ERC20BurnableUpgradeable, + OwnableUpgradeable, + PausableUpgradeable, + ReentrancyGuardUpgradeable +{ + //------------------------------------------------------------------------- + // Libraries + + using SafeERC20Upgradeable for IERC20Upgradeable; + using SafeERC20Upgradeable for IPerpetualTranche; + using ERC20Helpers for IERC20Upgradeable; + using MathUpgradeable for uint256; + + //------------------------------------------------------------------------- + // Constants + + uint256 public constant DECIMALS = 18; + uint256 public constant ONE = (10 ** DECIMALS); + + /// @dev DR values use 8 decimals to match FeePolicy. + uint256 public constant DR_DECIMALS = 8; + uint256 public constant DR_ONE = (10 ** DR_DECIMALS); + + //------------------------------------------------------------------------- + // Storage + + /// @notice The underlying rebasing token (e.g., AMPL). + IERC20Upgradeable public underlying; + + /// @notice The perpetual tranche token (SPOT). + IPerpetualTranche public perp; + + /// @notice The STAMPL rollover vault used for underlying<->perp swaps. + IRolloverVault public stampl; + + /// @notice The fixed-point amount of underlying tokens equivalent to 1.0. + uint256 public underlyingUnitAmt; + + /// @notice The fixed-point amount of perp tokens equivalent to 1.0. + uint256 public perpUnitAmt; + + /// @notice Reference to the address that has the ability to pause/unpause operations. + address public keeper; + + /// @notice The target system deviation ratio (typically 1.0 = DR_ONE, using 8 decimals). + uint256 public targetDR; + + /// @notice The range of deviation ratios which define the equilibrium zone. + /// @dev When the system's dr is within the equilibrium zone, no value is transferred during rebalance. + /// A zero-size range is allowed and represents a single target value. + Range public equilibriumDR; + + /// @notice The lag factor for underlying->perp swaps (when DR is high). + uint256 public lagFactorUnderlyingToPerp; + + /// @notice The lag factor for perp->underlying swaps (when DR is low). + uint256 public lagFactorPerpToUnderlying; + + /// @notice Minimum rebalance amount per rebalance (underlying denominated). + uint256 public minRebalanceVal; + + /// @notice Minimum seconds between rebalances. + uint256 public rebalanceFreqSec; + + /// @notice Timestamp of the last rebalance. + uint256 public lastRebalanceTimestampSec; + + /// @notice Maximum swap fee percentage allowed during rebalance (slippage protection). + uint256 public maxSwapFeePerc; + + //-------------------------------------------------------------------------- + // Events + + /// @notice Emitted when a user deposits tokens. + event Deposit( + address indexed depositor, + uint256 underlyingAmtIn, + uint256 perpAmtIn, + uint256 notesMinted + ); + + /// @notice Emitted when a user redeems vault notes. + event Redeem( + address indexed redeemer, + uint256 notesBurnt, + uint256 underlyingAmtOut, + uint256 perpAmtOut + ); + + /// @notice Emitted when the vault rebalances to adjust system DR. + /// @param drBefore The system deviation ratio before rebalance. + /// @param drAfter The system deviation ratio after rebalance. + /// @param underlyingAmt The amount of underlying involved in the swap. + /// @param isUnderlyingIntoPerp True if underlying was swapped for perps, false if perps were swapped for underlying. + event Rebalance( + uint256 drBefore, + uint256 drAfter, + uint256 underlyingAmt, + bool isUnderlyingIntoPerp + ); + + //-------------------------------------------------------------------------- + // Modifiers + + /// @dev Throws if called by any account other than the keeper. + modifier onlyKeeper() { + if (msg.sender != keeper) { + revert UnauthorizedCall(); + } + _; + } + + //----------------------------------------------------------------------------- + + /// @custom:oz-upgrades-unsafe-allow constructor + constructor() { + _disableInitializers(); + } + + /// @notice Contract initializer. + /// @param name ERC-20 Name of the vault LP token. + /// @param symbol ERC-20 Symbol of the vault LP token. + /// @param underlying_ Address of the underlying token. + /// @param perp_ Address of the perp token. + /// @param stampl_ Address of the STAMPL rollover vault for swaps. + function init( + string memory name, + string memory symbol, + IERC20Upgradeable underlying_, + IPerpetualTranche perp_, + IRolloverVault stampl_ + ) public initializer { + __ERC20_init(name, symbol); + __ERC20Burnable_init(); + __Ownable_init(); + __Pausable_init(); + __ReentrancyGuard_init(); + + underlying = underlying_; + perp = perp_; + stampl = stampl_; + + underlyingUnitAmt = + 10 ** IERC20MetadataUpgradeable(address(underlying_)).decimals(); + perpUnitAmt = 10 ** IERC20MetadataUpgradeable(address(perp_)).decimals(); + + updateKeeper(owner()); + + // Default configuration + // Target DR is 1.0 (system in balance) with 8 decimals + targetDR = DR_ONE; + // Equilibrium DR range (skip rebalances when DR is within this window) + equilibriumDR = Range({ + lower: (DR_ONE * 95) / 100, + upper: (DR_ONE * 105) / 100 + }); + // Default lag factors + lagFactorUnderlyingToPerp = 3; + lagFactorPerpToUnderlying = 3; + // Minimum rebalance amount (in underlying token units) + minRebalanceVal = 0; + rebalanceFreqSec = 86400; // 1 day + maxSwapFeePerc = ONE / 100; // 1% default max fee + } + + //-------------------------------------------------------------------------- + // Owner only methods + + /// @notice Updates the reference to the keeper. + /// @param keeper_ The address of the new keeper. + function updateKeeper(address keeper_) public onlyOwner { + keeper = keeper_; + } + + /// @notice Updates the target system deviation ratio and equilibrium DR range together. + /// @param targetDR_ The new target DR as a fixed point number with 8 decimals. + /// @param equilibriumDR_ The new equilibrium DR range as tuple of fixed-point numbers with {DR_DECIMALS} places. + function updateTargetAndEquilibriumDR( + uint256 targetDR_, + Range memory equilibriumDR_ + ) external onlyOwner { + if ( + equilibriumDR_.lower > equilibriumDR_.upper || + targetDR_ < equilibriumDR_.lower || + targetDR_ > equilibriumDR_.upper + ) { + revert InvalidRange(); + } + + targetDR = targetDR_; + equilibriumDR = equilibriumDR_; + } + + /// @notice Updates the lag factors for rebalancing. + /// @param lagFactorUnderlyingToPerp_ The new lag factor for underlying->perp swaps. + /// @param lagFactorPerpToUnderlying_ The new lag factor for perp->underlying swaps. + function updateLagFactors( + uint256 lagFactorUnderlyingToPerp_, + uint256 lagFactorPerpToUnderlying_ + ) external onlyOwner { + if (lagFactorUnderlyingToPerp_ <= 0 || lagFactorPerpToUnderlying_ <= 0) { + revert InvalidLagFactor(); + } + lagFactorUnderlyingToPerp = lagFactorUnderlyingToPerp_; + lagFactorPerpToUnderlying = lagFactorPerpToUnderlying_; + } + + /// @notice Updates the minimum rebalance amount. + /// @param minRebalanceVal_ The new minimum underlying amount to deploy per rebalance. + function updateMinRebalanceAmt(uint256 minRebalanceVal_) external onlyOwner { + minRebalanceVal = minRebalanceVal_; + } + + /// @notice Updates the rebalance frequency. + /// @param rebalanceFreqSec_ The new rebalance frequency in seconds. + function updateRebalanceFreqSec(uint256 rebalanceFreqSec_) external onlyOwner { + rebalanceFreqSec = rebalanceFreqSec_; + } + + /// @notice Updates the maximum swap fee percentage allowed during rebalance. + /// @param maxSwapFeePerc_ The new maximum swap fee percentage. + function updateMaxSwapFeePerc(uint256 maxSwapFeePerc_) external onlyOwner { + if (maxSwapFeePerc_ > ONE) { + revert InvalidPerc(); + } + maxSwapFeePerc = maxSwapFeePerc_; + } + + //-------------------------------------------------------------------------- + // Keeper only methods + + /// @notice Pauses deposits, withdrawals and rebalances. + function pause() external onlyKeeper { + _pause(); + } + + /// @notice Unpauses deposits, withdrawals and rebalances. + function unpause() external onlyKeeper { + _unpause(); + } + + //-------------------------------------------------------------------------- + // External & Public write methods + + /// @notice Deposits underlying and/or perp tokens and mints vault notes (LP tokens). + /// @param underlyingAmtMax The maximum amount of underlying tokens to deposit. + /// @param perpAmtMax The maximum amount of perp tokens to deposit. + /// @param minNotesMinted The minimum amount of vault notes to mint (slippage protection). + /// @return notesMinted The amount of vault notes minted. + function deposit( + uint256 underlyingAmtMax, + uint256 perpAmtMax, + uint256 minNotesMinted + ) external nonReentrant whenNotPaused returns (uint256 notesMinted) { + uint256 underlyingAmtIn; + uint256 perpAmtIn; + (notesMinted, underlyingAmtIn, perpAmtIn) = computeMintAmt( + underlyingAmtMax, + perpAmtMax + ); + + if (notesMinted <= 0) { + return 0; + } + + if (notesMinted < minNotesMinted) { + revert SlippageTooHigh(); + } + + // Transfer tokens from the user + if (underlyingAmtIn > 0) { + underlying.safeTransferFrom(msg.sender, address(this), underlyingAmtIn); + } + if (perpAmtIn > 0) { + perp.safeTransferFrom(msg.sender, address(this), perpAmtIn); + } + + // Mint vault notes to the user + _mint(msg.sender, notesMinted); + + emit Deposit(msg.sender, underlyingAmtIn, perpAmtIn, notesMinted); + } + + /// @notice Burns vault notes and returns proportional underlying and perp tokens. + /// @param notesAmt The amount of vault notes to burn. + /// @param minUnderlyingAmtOut The minimum amount of underlying tokens to receive (slippage protection). + /// @param minPerpAmtOut The minimum amount of perp tokens to receive (slippage protection). + /// @return underlyingAmtOut The amount of underlying tokens returned. + /// @return perpAmtOut The amount of perp tokens returned. + function redeem( + uint256 notesAmt, + uint256 minUnderlyingAmtOut, + uint256 minPerpAmtOut + ) + external + nonReentrant + whenNotPaused + returns (uint256 underlyingAmtOut, uint256 perpAmtOut) + { + (underlyingAmtOut, perpAmtOut) = computeRedemptionAmts(notesAmt); + if (underlyingAmtOut <= 0 && perpAmtOut <= 0) { + return (0, 0); + } + + if (underlyingAmtOut < minUnderlyingAmtOut || perpAmtOut < minPerpAmtOut) { + revert SlippageTooHigh(); + } + + // Burn vault notes + _burn(msg.sender, notesAmt); + + // Return funds + if (underlyingAmtOut > 0) { + underlying.safeTransfer(msg.sender, underlyingAmtOut); + } + if (perpAmtOut > 0) { + perp.safeTransfer(msg.sender, perpAmtOut); + } + + emit Redeem(msg.sender, notesAmt, underlyingAmtOut, perpAmtOut); + } + + /// @notice Rebalances to help maintain the system's target deviation ratio. + /// @dev Can only be called after rebalance frequency period has elapsed. + /// Swaps underlying<->perps via STAMPL to push system DR toward equilibrium. + function rebalance() external nonReentrant whenNotPaused { + // Enforce rebalance frequency + if (block.timestamp < lastRebalanceTimestampSec + rebalanceFreqSec) { + revert LastRebalanceTooRecent(); + } + + // Query perp state once before any swaps + uint256 perpTVL = perp.getTVL(); + uint256 perpTotalSupply = perp.totalSupply(); + + uint256 drBefore = stampl.deviationRatio(); + ( + uint256 underlyingValSwapped, + bool isUnderlyingIntoPerp + ) = _computeRebalanceAmount(drBefore, perpTVL, perpTotalSupply); + + if (underlyingValSwapped <= 0) { + lastRebalanceTimestampSec = block.timestamp; + emit Rebalance(drBefore, drBefore, 0, isUnderlyingIntoPerp); + return; + } + + uint256 underlyingValOut; + if (isUnderlyingIntoPerp) { + // DR too high: perpTVL is too low, mint perps to increase it + underlying.checkAndApproveMax(address(stampl), underlyingValSwapped); + uint256 perpAmtMint = stampl.swapUnderlyingForPerps(underlyingValSwapped); + // Convert perp output to underlying value using pre-swap price + underlyingValOut = perpAmtMint.mulDiv(perpTVL, perpTotalSupply); + } else { + // DR too low: perpTVL is too high, redeem perps to decrease it + // Convert underlying value to perp amount using pre-swap price + uint256 perpAmtToRedeem = underlyingValSwapped.mulDiv( + perpTotalSupply, + perpTVL + ); + IERC20Upgradeable(address(perp)).checkAndApproveMax( + address(stampl), + perpAmtToRedeem + ); + underlyingValOut = stampl.swapPerpsForUnderlying(perpAmtToRedeem); + } + + // Check slippage: compare underlying value out to underlying value in + uint256 feePerc = ONE - underlyingValOut.mulDiv(ONE, underlyingValSwapped); + if (feePerc > maxSwapFeePerc) { + revert SlippageTooHigh(); + } + + uint256 drAfter = stampl.deviationRatio(); + lastRebalanceTimestampSec = block.timestamp; + + emit Rebalance(drBefore, drAfter, underlyingValSwapped, isUnderlyingIntoPerp); + } + + //----------------------------------------------------------------------------- + // Public methods + + /// @notice Computes the amount of vault notes minted for a given deposit of underlying and/or perp tokens. + /// @param underlyingAmtMax The maximum amount of underlying tokens to deposit. + /// @param perpAmtMax The maximum amount of perp tokens to deposit. + /// @return notesMinted The amount of vault notes that would be minted. + /// @return underlyingAmtIn The actual amount of underlying tokens to deposit. + /// @return perpAmtIn The actual amount of perp tokens to deposit. + function computeMintAmt( + uint256 underlyingAmtMax, + uint256 perpAmtMax + ) + public + view + returns (uint256 notesMinted, uint256 underlyingAmtIn, uint256 perpAmtIn) + { + uint256 totalSupply_ = totalSupply(); + + if (underlyingAmtMax <= 0 && perpAmtMax <= 0) { + return (0, 0, 0); + } + + if (totalSupply_ <= 0) { + // First deposit: accept any ratio + underlyingAmtIn = underlyingAmtMax; + perpAmtIn = perpAmtMax; + // Mint notes based on combined value (normalized to 18 decimals) + notesMinted = + underlyingAmtIn.mulDiv(ONE, underlyingUnitAmt) + + perpAmtIn.mulDiv(ONE, perpUnitAmt); + } else { + // Subsequent deposits: enforce vault ratio + uint256 underlyingBal = underlying.balanceOf(address(this)); + uint256 perpBal = perp.balanceOf(address(this)); + + if (perpBal <= 0) { + // Vault has only underlying + underlyingAmtIn = underlyingAmtMax; + perpAmtIn = 0; + notesMinted = totalSupply_.mulDiv(underlyingAmtIn, underlyingBal); + } else if (underlyingBal <= 0) { + // Vault has only perps + underlyingAmtIn = 0; + perpAmtIn = perpAmtMax; + notesMinted = totalSupply_.mulDiv(perpAmtIn, perpBal); + } else { + // Vault has both: calculate proportional amounts + underlyingAmtIn = underlyingAmtMax; + perpAmtIn = perpBal.mulDiv(underlyingAmtIn, underlyingBal); + if (perpAmtIn > perpAmtMax) { + perpAmtIn = perpAmtMax; + underlyingAmtIn = underlyingBal.mulDiv(perpAmtIn, perpBal); + } + notesMinted = totalSupply_.mulDiv(underlyingAmtIn, underlyingBal); + } + } + } + + /// @notice Computes the amounts of underlying and perp tokens returned for burning vault notes. + /// @param notesAmt The amount of vault notes to burn. + /// @return underlyingAmtOut The amount of underlying tokens returned. + /// @return perpAmtOut The amount of perp tokens returned. + function computeRedemptionAmts( + uint256 notesAmt + ) public view returns (uint256 underlyingAmtOut, uint256 perpAmtOut) { + uint256 totalSupply_ = totalSupply(); + if (notesAmt <= 0 || totalSupply_ <= 0) { + return (0, 0); + } + + underlyingAmtOut = underlying.balanceOf(address(this)).mulDiv( + notesAmt, + totalSupply_ + ); + perpAmtOut = perp.balanceOf(address(this)).mulDiv(notesAmt, totalSupply_); + } + + /// @notice Returns this vault's total value locked in underlying denomination. + /// @return tvl The TVL of this vault (underlying + perp value). + function getTVL() public returns (uint256 tvl) { + uint256 underlyingBal = underlying.balanceOf(address(this)); + uint256 perpBal = perp.balanceOf(address(this)); + + // Perp value = perpBalance * perpTVL / perpTotalSupply + uint256 perpValue = 0; + uint256 perpTotalSupply = perp.totalSupply(); + if (perpTotalSupply > 0 && perpBal > 0) { + perpValue = perpBal.mulDiv(perp.getTVL(), perpTotalSupply); + } + + tvl = underlyingBal + perpValue; + } + + /// @notice Computes the amount of underlying to swap for rebalancing the system DR. + /// @return underlyingAmt The amount of underlying involved in the swap. + /// @return isUnderlyingIntoPerp True if should swap underlying for perps, false otherwise. + function computeRebalanceAmount() + public + returns (uint256 underlyingAmt, bool isUnderlyingIntoPerp) + { + return + _computeRebalanceAmount( + stampl.deviationRatio(), + perp.getTVL(), + perp.totalSupply() + ); + } + + /// @dev Computes rebalance amount. See contract-level documentation for math details. + function _computeRebalanceAmount( + uint256 dr, + uint256 perpTVL, + uint256 perpTotalSupply + ) private view returns (uint256 underlyingAmt, bool isUnderlyingIntoPerp) { + if (perpTVL <= 0) { + return (0, false); + } + + // Skip rebalancing if DR is within the equilibrium range. + if (dr >= equilibriumDR.lower && dr <= equilibriumDR.upper) { + return (0, false); + } + + // Determine direction, magnitude, and available liquidity for the swap + // If DR < target: perpTVL is too high, redeem perps to decrease it + // If DR > target: perpTVL is too low, mint perps to increase it + uint256 drDelta; + uint256 lagFactor_; + uint256 availableLiquidity; + + if (dr < targetDR) { + isUnderlyingIntoPerp = false; + drDelta = targetDR - dr; + lagFactor_ = lagFactorPerpToUnderlying; + // Swapping perps for underlying: limit by perp balance (in underlying terms) + availableLiquidity = perp.balanceOf(address(this)).mulDiv( + perpTVL, + perpTotalSupply + ); + } else { + isUnderlyingIntoPerp = true; + drDelta = dr - targetDR; + lagFactor_ = lagFactorUnderlyingToPerp; + // Swapping underlying for perps: limit by underlying balance + availableLiquidity = underlying.balanceOf(address(this)); + } + + // Compute required change: + // Since stamplTVL doesn't change during flash mint/redeem, + // only perpTVL changes, so: requiredChange = perpTVL × |dr - targetDR| + uint256 requiredChange = perpTVL.mulDiv(drDelta, DR_ONE); + + // Apply lag factor (gradual adjustment) + uint256 adjustedChange = requiredChange / lagFactor_; + + // Skip if below minimum rebalance amount + if (adjustedChange < minRebalanceVal) { + return (0, isUnderlyingIntoPerp); + } + + // Cap by available liquidity and required change (prevent overshoot) + underlyingAmt = adjustedChange; + if (underlyingAmt > availableLiquidity) { + underlyingAmt = availableLiquidity; + } + if (underlyingAmt > requiredChange) { + underlyingAmt = requiredChange; + } + } + + //----------------------------------------------------------------------------- + // External view methods + + /// @notice Returns the underlying token balance held by this vault. + /// @return The underlying token balance. + function underlyingBalance() external view returns (uint256) { + return underlying.balanceOf(address(this)); + } + + /// @notice Returns the perp token balance held by this vault. + /// @return The perp token balance. + function perpBalance() external view returns (uint256) { + return perp.balanceOf(address(this)); + } +} diff --git a/spot-vaults/contracts/_interfaces/IDRBalancerVault.sol b/spot-vaults/contracts/_interfaces/IDRBalancerVault.sol new file mode 100644 index 00000000..523e004b --- /dev/null +++ b/spot-vaults/contracts/_interfaces/IDRBalancerVault.sol @@ -0,0 +1,145 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +pragma solidity ^0.8.24; + +import { IERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; +import { IPerpetualTranche } from "@ampleforthorg/spot-contracts/contracts/_interfaces/IPerpetualTranche.sol"; +import { IRolloverVault } from "@ampleforthorg/spot-contracts/contracts/_interfaces/IRolloverVault.sol"; +import { Range } from "./types/CommonTypes.sol"; + +/// @title IDRBalancerVault +/// @notice Interface for DRBalancerVault - a vault that holds underlying and perp tokens +/// as liquidity and auto-rebalances to help maintain the SYSTEM's target deviation ratio +/// via IRolloverVault swaps. +/// +/// The system's deviation ratio (DR) is defined by FeePolicy as: +/// DR = vaultTVL / perpTVL / targetSystemRatio +/// +/// When DR < 1 (under-subscribed): vault TVL is too low relative to perp TVL +/// When DR > 1 (over-subscribed): vault TVL is too high relative to perp TVL +interface IDRBalancerVault is IERC20Upgradeable { + //-------------------------------------------------------------------------- + // Events + + /// @notice Emitted when a user deposits underlying tokens. + /// @param depositor The address of the depositor. + /// @param underlyingAmtIn The amount of underlying tokens deposited. + /// @param notesMinted The amount of vault notes minted. + event Deposit( + address indexed depositor, + uint256 underlyingAmtIn, + uint256 notesMinted + ); + + /// @notice Emitted when a user redeems vault notes. + /// @param redeemer The address of the redeemer. + /// @param notesBurnt The amount of vault notes burnt. + /// @param underlyingAmtOut The amount of underlying tokens returned. + /// @param perpAmtOut The amount of perp tokens returned. + event Redeem( + address indexed redeemer, + uint256 notesBurnt, + uint256 underlyingAmtOut, + uint256 perpAmtOut + ); + + /// @notice Emitted when the vault rebalances to adjust system DR. + /// @param drBefore The system deviation ratio before rebalance. + /// @param drAfter The system deviation ratio after rebalance. + /// @param underlyingAmt The amount of underlying involved in the swap. + /// @param isUnderlyingIntoPerp True if underlying was swapped for perps, false if perps were swapped for underlying. + event Rebalance( + uint256 drBefore, + uint256 drAfter, + uint256 underlyingAmt, + bool isUnderlyingIntoPerp + ); + + //-------------------------------------------------------------------------- + // Core Methods + + /// @notice Deposits underlying tokens and mints vault notes (LP tokens). + /// @param underlyingAmtIn The amount of underlying tokens to deposit. + /// @return notesMinted The amount of vault notes minted. + function deposit(uint256 underlyingAmtIn) external returns (uint256 notesMinted); + + /// @notice Burns vault notes and returns proportional underlying and perp tokens. + /// @param notesAmt The amount of vault notes to burn. + /// @return underlyingAmtOut The amount of underlying tokens returned. + /// @return perpAmtOut The amount of perp tokens returned. + function redeem( + uint256 notesAmt + ) external returns (uint256 underlyingAmtOut, uint256 perpAmtOut); + + /// @notice Rebalances to help maintain the system's target deviation ratio. + /// @dev Can only be called after cooldown period has elapsed. + function rebalance() external; + + //-------------------------------------------------------------------------- + // View Methods + + /// @notice Returns this vault's total value locked in underlying denomination. + /// @return The TVL of this vault (underlying + perp value). + function getTVL() external returns (uint256); + + /// @notice Returns the current SYSTEM deviation ratio from the rollover vault. + /// @dev DR = vaultTVL / perpTVL / targetSystemRatio (as defined in FeePolicy) + /// @return The system deviation ratio as a fixed point number with 8 decimals. + function getSystemDeviationRatio() external returns (uint256); + + /// @notice Computes the amount of underlying to swap for rebalancing. + /// @return underlyingAmt The amount of underlying involved in the swap. + /// @return isUnderlyingIntoPerp True if should swap underlying for perps, false otherwise. + function computeRebalanceAmount() + external + returns (uint256 underlyingAmt, bool isUnderlyingIntoPerp); + + /// @notice Returns the underlying token balance held by this vault. + /// @return The underlying token balance. + function underlyingBalance() external view returns (uint256); + + /// @notice Returns the perp token balance held by this vault. + /// @return The perp token balance. + function perpBalance() external view returns (uint256); + + //-------------------------------------------------------------------------- + // Config Getters + + /// @notice The underlying rebasing token (e.g., AMPL). + function underlying() external view returns (IERC20Upgradeable); + + /// @notice The perpetual tranche token (SPOT). + function perp() external view returns (IPerpetualTranche); + + /// @notice The rollover vault used for swaps. + function rolloverVault() external view returns (IRolloverVault); + + /// @notice The target system deviation ratio (typically 1.0 with 8 decimals). + function targetDR() external view returns (uint256); + + /// @notice The equilibrium DR range where no rebalancing occurs. + function equilibriumDR() external view returns (Range memory); + + /// @notice The lag factor for underlying->perp swaps (when DR is low). + function lagFactorUnderlyingToPerp() external view returns (uint256); + + /// @notice The lag factor for perp->underlying swaps (when DR is high). + function lagFactorPerpToUnderlying() external view returns (uint256); + + /// @notice The min/max percentage of TVL for underlying->perp swaps. + function rebalancePercLimitsUnderlyingToPerp() external view returns (Range memory); + + /// @notice The min/max percentage of TVL for perp->underlying swaps. + function rebalancePercLimitsPerpToUnderlying() external view returns (Range memory); + + /// @notice The minimum seconds between rebalances. + function rebalanceFreqSec() external view returns (uint256); + + /// @notice The timestamp of the last rebalance. + function lastRebalanceTimestampSec() external view returns (uint256); + + /// @notice The maximum swap fee percentage allowed during rebalance. + function maxSwapFeePerc() external view returns (uint256); + + /// @notice The keeper address. + function keeper() external view returns (address); +} diff --git a/spot-vaults/contracts/_interfaces/errors/DRBalancerErrors.sol b/spot-vaults/contracts/_interfaces/errors/DRBalancerErrors.sol new file mode 100644 index 00000000..69c53477 --- /dev/null +++ b/spot-vaults/contracts/_interfaces/errors/DRBalancerErrors.sol @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: BUSL-1.1 +pragma solidity ^0.8.24; + +/// @notice Expected DR lower bound to be under the upper bound. +error InvalidDRBound(); + +/// @notice Rebalance called before cooldown elapsed. +error LastRebalanceTooRecent(); + +/// @notice Swap fee exceeded the maximum allowed percentage. +error SlippageTooHigh(); + +/// @notice Lag factor must be greater than zero. +error InvalidLagFactor(); diff --git a/spot-vaults/contracts/_test/MockPerpetualTranche.sol b/spot-vaults/contracts/_test/MockPerpetualTranche.sol new file mode 100644 index 00000000..a69a79f6 --- /dev/null +++ b/spot-vaults/contracts/_test/MockPerpetualTranche.sol @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: BUSL-1.1 +pragma solidity ^0.8.24; + +import { MockERC20 } from "./MockERC20.sol"; + +contract MockPerpetualTranche is MockERC20 { + uint256 private _tvl; + + function setTVL(uint256 tvl_) external { + _tvl = tvl_; + } + + function getTVL() external view returns (uint256) { + return _tvl; + } +} diff --git a/spot-vaults/package.json b/spot-vaults/package.json index 860a7d79..6338a134 100644 --- a/spot-vaults/package.json +++ b/spot-vaults/package.json @@ -21,7 +21,7 @@ "@openzeppelin/contracts-upgradeable": "4.9.6", "@uniswap/v3-core": "^1.0.1", "ampleforth-contracts": "https://github.com/ampleforth/ampleforth-contracts#master", - "tranche": "https://github.com/buttonwood-protocol/tranche.git#main" + "tranche": "https://github.com/buttonwood-protocol/tranche/archive/main.tar.gz" }, "devDependencies": { "@ethersproject/abi": "^5.6.4", @@ -34,7 +34,7 @@ "@nomicfoundation/hardhat-ignition-ethers": "^0.15.0", "@nomicfoundation/hardhat-network-helpers": "^1.0.0", "@nomicfoundation/hardhat-toolbox": "latest", - "@nomicfoundation/hardhat-verify": "latest", + "@nomicfoundation/hardhat-verify": "^2.0.0", "@nomiclabs/hardhat-waffle": "^2.0.6", "@openzeppelin/hardhat-upgrades": "^3.0.4", "@openzeppelin/upgrades-core": "latest", diff --git a/spot-vaults/tasks/info.ts b/spot-vaults/tasks/info.ts index 5d976688..63a6f5c1 100644 --- a/spot-vaults/tasks/info.ts +++ b/spot-vaults/tasks/info.ts @@ -159,7 +159,7 @@ task("info:BillBroker") console.log("tvl", tvl); console.log("---------------------------------------------------------------"); - const swapAmts = [1n, 1000n, 10000n, 25000n, 50000n, 100000n]; + const swapAmts = [1n, 1000n, 10000n, 15000n, 20000n, 25000n]; for (let i = 0; i < swapAmts.length; i++) { const swapAmt = swapAmts[i]; console.log( @@ -186,7 +186,7 @@ task("info:BillBroker") } console.log("---------------------------------------------------------------"); } catch (e) { - console.log(e); + // console.log(e); console.log("---------------------------------------------------------------"); } }); diff --git a/spot-vaults/test/DRBalancerVault.ts b/spot-vaults/test/DRBalancerVault.ts new file mode 100644 index 00000000..c11b5a4c --- /dev/null +++ b/spot-vaults/test/DRBalancerVault.ts @@ -0,0 +1,336 @@ +import { ethers, upgrades } from "hardhat"; +import { loadFixture } from "@nomicfoundation/hardhat-toolbox/network-helpers"; +import { expect } from "chai"; +import { DMock, amplFP, perpFP, drFP } from "./helpers"; + +const ONE = ethers.parseUnits("1", 18); +const DR_ONE = ethers.parseUnits("1", 8); // DR uses 8 decimals like FeePolicy +const DAY = 86400; + +describe("DRBalancerVault", function () { + async function setupContracts() { + const accounts = await ethers.getSigners(); + const deployer = accounts[0]; + + // Deploy mock underlying token (AMPL-like, 9 decimals) + const Token = await ethers.getContractFactory("MockERC20"); + const underlying = await Token.deploy(); + await underlying.init("Ampleforth", "AMPL", 9); + + // Deploy mock perp token (SPOT-like, 9 decimals) with getTVL support + const PerpToken = await ethers.getContractFactory("MockPerpetualTranche"); + const perp = await PerpToken.deploy(); + await perp.init("SPOT", "SPOT", 9); + await perp.setTVL(amplFP("10000")); // Default perpTVL for rebalance calculations + + // Deploy mock rollover vault + const rolloverVault = new DMock( + "@ampleforthorg/spot-contracts/contracts/_interfaces/IRolloverVault.sol:IRolloverVault", + ); + await rolloverVault.deploy(); + await rolloverVault.mockMethod("swapUnderlyingForPerps(uint256)", [0]); + await rolloverVault.mockMethod("swapPerpsForUnderlying(uint256)", [0]); + // Mock system DR at equilibrium (1.0 with 8 decimals as per FeePolicy) + await rolloverVault.mockMethod("deviationRatio()", [drFP("1")]); + // Mock compute functions with zero fee by default + // Returns: (perpAmtOut, perpFeeAmtToBurn, SystemTVL) + await rolloverVault.mockMethod("computeUnderlyingToPerpSwapAmt(uint256)", [ + perpFP("100"), + 0, + { perpTVL: amplFP("1000"), vaultTVL: amplFP("1000") }, + ]); + + // Deploy DRBalancerVault + const DRBalancerVault = await ethers.getContractFactory("DRBalancerVault"); + const vault = await upgrades.deployProxy( + DRBalancerVault.connect(deployer), + ["DR Balancer LP", "DRLP", underlying.target, perp.target, rolloverVault.target], + { + initializer: "init(string,string,address,address,address)", + }, + ); + + // Mint tokens to deployer for testing + await underlying.mint(deployer.getAddress(), amplFP("100000")); + + // Approve vault to spend tokens + await underlying.connect(deployer).approve(vault.target, ethers.MaxUint256); + + return { deployer, underlying, perp, rolloverVault, vault }; + } + + describe("init", function () { + it("should set initial values", async function () { + const { deployer, vault, underlying, perp, rolloverVault } = await loadFixture( + setupContracts, + ); + + expect(await vault.underlying()).to.eq(underlying.target); + expect(await vault.perp()).to.eq(perp.target); + expect(await vault.stampl()).to.eq(rolloverVault.target); + expect(await vault.underlyingUnitAmt()).to.eq(amplFP("1")); + expect(await vault.perpUnitAmt()).to.eq(perpFP("1")); + + expect(await vault.owner()).to.eq(await deployer.getAddress()); + expect(await vault.keeper()).to.eq(await deployer.getAddress()); + + // Target DR is 1.0 (system in balance) with 8 decimals + expect(await vault.targetDR()).to.eq(DR_ONE); + const eqRange = await vault.equilibriumDR(); + expect(eqRange[0]).to.eq(drFP("0.95")); + expect(eqRange[1]).to.eq(drFP("1.05")); + + expect(await vault.lagFactorUnderlyingToPerp()).to.eq(3); + expect(await vault.lagFactorPerpToUnderlying()).to.eq(3); + expect(await vault.minRebalanceVal()).to.eq(0); + + expect(await vault.rebalanceFreqSec()).to.eq(DAY); + expect(await vault.maxSwapFeePerc()).to.eq(ONE / 100n); // 1% default + }); + }); + + describe("#updateKeeper", function () { + describe("when triggered by non-owner", function () { + it("should revert", async function () { + const { vault } = await loadFixture(setupContracts); + await vault.renounceOwnership(); + await expect(vault.updateKeeper(ethers.ZeroAddress)).to.be.revertedWith( + "Ownable: caller is not the owner", + ); + }); + }); + + describe("when set address is valid", function () { + it("should update reference", async function () { + const { vault } = await loadFixture(setupContracts); + await vault.updateKeeper(vault.target); + expect(await vault.keeper()).to.eq(vault.target); + }); + }); + }); + + describe("#updateTargetAndEquilibriumDR", function () { + describe("when triggered by non-owner", function () { + it("should revert", async function () { + const { vault } = await loadFixture(setupContracts); + await vault.renounceOwnership(); + await expect( + vault.updateTargetAndEquilibriumDR(DR_ONE, [drFP("0.9"), drFP("1.1")]), + ).to.be.revertedWith("Ownable: caller is not the owner"); + }); + }); + + describe("when target is outside range", function () { + it("should revert", async function () { + const { vault } = await loadFixture(setupContracts); + await expect( + vault.updateTargetAndEquilibriumDR(DR_ONE, [drFP("1.01"), drFP("1.1")]), + ).to.be.revertedWithCustomError(vault, "InvalidRange"); + }); + }); + + describe("when target equals a boundary with non-zero range", function () { + it("should allow update", async function () { + const { vault } = await loadFixture(setupContracts); + await vault.updateTargetAndEquilibriumDR(DR_ONE, [DR_ONE, drFP("1.1")]); + expect(await vault.targetDR()).to.eq(DR_ONE); + const r = await vault.equilibriumDR(); + expect(r[0]).to.eq(DR_ONE); + expect(r[1]).to.eq(drFP("1.1")); + }); + }); + + describe("when range size is zero at target", function () { + it("should allow update", async function () { + const { vault } = await loadFixture(setupContracts); + await vault.updateTargetAndEquilibriumDR(DR_ONE, [DR_ONE, DR_ONE]); + expect(await vault.targetDR()).to.eq(DR_ONE); + const r = await vault.equilibriumDR(); + expect(r[0]).to.eq(DR_ONE); + expect(r[1]).to.eq(DR_ONE); + }); + }); + + describe("when valid", function () { + it("should update target DR and equilibrium range", async function () { + const { vault } = await loadFixture(setupContracts); + const newTarget = drFP("1.02"); + await vault.updateTargetAndEquilibriumDR(newTarget, [drFP("0.98"), drFP("1.1")]); + expect(await vault.targetDR()).to.eq(newTarget); + const r = await vault.equilibriumDR(); + expect(r[0]).to.eq(drFP("0.98")); + expect(r[1]).to.eq(drFP("1.1")); + }); + }); + }); + + describe("#updateLagFactors", function () { + describe("when triggered by non-owner", function () { + it("should revert", async function () { + const { vault } = await loadFixture(setupContracts); + await vault.renounceOwnership(); + await expect(vault.updateLagFactors(5, 5)).to.be.revertedWith( + "Ownable: caller is not the owner", + ); + }); + }); + + describe("when lagFactorUnderlyingToPerp is zero", function () { + it("should revert", async function () { + const { vault } = await loadFixture(setupContracts); + await expect(vault.updateLagFactors(0, 5)).to.be.revertedWithCustomError( + vault, + "InvalidLagFactor", + ); + }); + }); + + describe("when lagFactorPerpToUnderlying is zero", function () { + it("should revert", async function () { + const { vault } = await loadFixture(setupContracts); + await expect(vault.updateLagFactors(5, 0)).to.be.revertedWithCustomError( + vault, + "InvalidLagFactor", + ); + }); + }); + + describe("when valid", function () { + it("should update lag factors", async function () { + const { vault } = await loadFixture(setupContracts); + await vault.updateLagFactors(5, 8); + expect(await vault.lagFactorUnderlyingToPerp()).to.eq(5); + expect(await vault.lagFactorPerpToUnderlying()).to.eq(8); + }); + }); + }); + + describe("#updateMinRebalanceAmt", function () { + describe("when triggered by non-owner", function () { + it("should revert", async function () { + const { vault } = await loadFixture(setupContracts); + await vault.renounceOwnership(); + await expect(vault.updateMinRebalanceAmt(amplFP("100"))).to.be.revertedWith( + "Ownable: caller is not the owner", + ); + }); + }); + + describe("when valid", function () { + it("should update min rebalance amount", async function () { + const { vault } = await loadFixture(setupContracts); + await vault.updateMinRebalanceAmt(amplFP("100")); + expect(await vault.minRebalanceVal()).to.eq(amplFP("100")); + }); + }); + }); + + describe("#updateRebalanceFreqSec", function () { + describe("when triggered by non-owner", function () { + it("should revert", async function () { + const { vault } = await loadFixture(setupContracts); + await vault.renounceOwnership(); + await expect(vault.updateRebalanceFreqSec(DAY * 2)).to.be.revertedWith( + "Ownable: caller is not the owner", + ); + }); + }); + + describe("when valid", function () { + it("should update frequency", async function () { + const { vault } = await loadFixture(setupContracts); + await vault.updateRebalanceFreqSec(DAY * 2); + expect(await vault.rebalanceFreqSec()).to.eq(DAY * 2); + }); + }); + }); + + describe("#updateMaxSwapFeePerc", function () { + describe("when triggered by non-owner", function () { + it("should revert", async function () { + const { vault } = await loadFixture(setupContracts); + await vault.renounceOwnership(); + await expect(vault.updateMaxSwapFeePerc(ONE / 100n)).to.be.revertedWith( + "Ownable: caller is not the owner", + ); + }); + }); + + describe("when fee > 100%", function () { + it("should revert", async function () { + const { vault } = await loadFixture(setupContracts); + await expect(vault.updateMaxSwapFeePerc(ONE + 1n)).to.be.revertedWithCustomError( + vault, + "InvalidPerc", + ); + }); + }); + + describe("when valid", function () { + it("should update max swap fee", async function () { + const { vault } = await loadFixture(setupContracts); + await vault.updateMaxSwapFeePerc(ONE / 50n); + expect(await vault.maxSwapFeePerc()).to.eq(ONE / 50n); + }); + }); + }); + + describe("#pause", function () { + describe("when triggered by non-keeper", function () { + it("should revert", async function () { + const { vault } = await loadFixture(setupContracts); + await vault.updateKeeper(ethers.ZeroAddress); + await expect(vault.pause()).to.be.revertedWithCustomError( + vault, + "UnauthorizedCall", + ); + }); + }); + + describe("when already paused", function () { + it("should revert", async function () { + const { vault } = await loadFixture(setupContracts); + await vault.pause(); + await expect(vault.pause()).to.be.revertedWith("Pausable: paused"); + }); + }); + + describe("when valid", function () { + it("should pause", async function () { + const { vault } = await loadFixture(setupContracts); + await vault.pause(); + expect(await vault.paused()).to.eq(true); + }); + }); + }); + + describe("#unpause", function () { + describe("when triggered by non-keeper", function () { + it("should revert", async function () { + const { vault } = await loadFixture(setupContracts); + await vault.pause(); + await vault.updateKeeper(ethers.ZeroAddress); + await expect(vault.unpause()).to.be.revertedWithCustomError( + vault, + "UnauthorizedCall", + ); + }); + }); + + describe("when not paused", function () { + it("should revert", async function () { + const { vault } = await loadFixture(setupContracts); + await expect(vault.unpause()).to.be.revertedWith("Pausable: not paused"); + }); + }); + + describe("when valid", function () { + it("should unpause", async function () { + const { vault } = await loadFixture(setupContracts); + await vault.pause(); + await vault.unpause(); + expect(await vault.paused()).to.eq(false); + }); + }); + }); +}); diff --git a/spot-vaults/test/DRBalancerVault_deposit_redeem.ts b/spot-vaults/test/DRBalancerVault_deposit_redeem.ts new file mode 100644 index 00000000..16d8043a --- /dev/null +++ b/spot-vaults/test/DRBalancerVault_deposit_redeem.ts @@ -0,0 +1,747 @@ +import { ethers, upgrades } from "hardhat"; +import { loadFixture } from "@nomicfoundation/hardhat-toolbox/network-helpers"; +import { expect } from "chai"; +import { DMock, amplFP, perpFP, drFP, noteFP } from "./helpers"; + +describe("DRBalancerVault", function () { + async function setupContracts() { + const accounts = await ethers.getSigners(); + const deployer = accounts[0]; + const otherUser = accounts[1]; + + // Deploy mock underlying token (AMPL-like, 9 decimals) + const Token = await ethers.getContractFactory("MockERC20"); + const underlying = await Token.deploy(); + await underlying.init("Ampleforth", "AMPL", 9); + + // Deploy mock perp token (SPOT-like, 9 decimals) with getTVL support + const PerpToken = await ethers.getContractFactory("MockPerpetualTranche"); + const perp = await PerpToken.deploy(); + await perp.init("SPOT", "SPOT", 9); + await perp.setTVL(amplFP("10000")); // Default perpTVL for rebalance calculations + + // Deploy mock rollover vault + const rolloverVault = new DMock( + "@ampleforthorg/spot-contracts/contracts/_interfaces/IRolloverVault.sol:IRolloverVault", + ); + await rolloverVault.deploy(); + await rolloverVault.mockMethod("swapUnderlyingForPerps(uint256)", [0]); + await rolloverVault.mockMethod("swapPerpsForUnderlying(uint256)", [0]); + // Mock system DR at equilibrium (1.0 with 8 decimals as per FeePolicy) + await rolloverVault.mockMethod("deviationRatio()", [drFP("1")]); + // Mock compute functions with zero fee by default + await rolloverVault.mockMethod("computeUnderlyingToPerpSwapAmt(uint256)", [ + perpFP("100"), + 0, + { perpTVL: amplFP("1000"), vaultTVL: amplFP("1000") }, + ]); + + // Deploy DRBalancerVault + const DRBalancerVault = await ethers.getContractFactory("DRBalancerVault"); + const vault = await upgrades.deployProxy( + DRBalancerVault.connect(deployer), + ["DR Balancer LP", "DRLP", underlying.target, perp.target, rolloverVault.target], + { + initializer: "init(string,string,address,address,address)", + }, + ); + + // Mint tokens to users for testing + await underlying.mint(deployer.getAddress(), amplFP("100000")); + await underlying.mint(otherUser.getAddress(), amplFP("100000")); + + // Mint perp tokens to users for testing + await perp.mint(deployer.getAddress(), perpFP("100000")); + await perp.mint(otherUser.getAddress(), perpFP("100000")); + + // Approve vault to spend tokens + await underlying.connect(deployer).approve(vault.target, ethers.MaxUint256); + await underlying.connect(otherUser).approve(vault.target, ethers.MaxUint256); + await perp.connect(deployer).approve(vault.target, ethers.MaxUint256); + await perp.connect(otherUser).approve(vault.target, ethers.MaxUint256); + + return { deployer, otherUser, underlying, perp, rolloverVault, vault }; + } + + describe("#computeMintAmt", function () { + describe("when both amounts are zero", function () { + it("should return zeros", async function () { + const { vault } = await loadFixture(setupContracts); + const [notesMinted, underlyingAmtIn, perpAmtIn] = + await vault.computeMintAmt.staticCall(0, 0); + expect(notesMinted).to.eq(0n); + expect(underlyingAmtIn).to.eq(0n); + expect(perpAmtIn).to.eq(0n); + }); + }); + + describe("first mint (totalSupply = 0)", function () { + it("should compute mint amount for underlying only", async function () { + const { vault } = await loadFixture(setupContracts); + // notesMinted = underlyingAmtIn * ONE / underlyingUnitAmt + // = 1000 * 10^9 * 10^18 / 10^9 = 1000 * 10^18 + const [notesMinted, underlyingAmtIn, perpAmtIn] = + await vault.computeMintAmt.staticCall(amplFP("1000"), 0); + expect(notesMinted).to.eq(noteFP("1000")); + expect(underlyingAmtIn).to.eq(amplFP("1000")); + expect(perpAmtIn).to.eq(0n); + }); + + it("should compute mint amount for perp only", async function () { + const { vault } = await loadFixture(setupContracts); + // notesMinted = perpAmtIn * ONE / perpUnitAmt + // = 500 * 10^9 * 10^18 / 10^9 = 500 * 10^18 + const [notesMinted, underlyingAmtIn, perpAmtIn] = + await vault.computeMintAmt.staticCall(0, perpFP("500")); + expect(notesMinted).to.eq(noteFP("500")); + expect(underlyingAmtIn).to.eq(0n); + expect(perpAmtIn).to.eq(perpFP("500")); + }); + + it("should compute mint amount for both tokens", async function () { + const { vault } = await loadFixture(setupContracts); + // notesMinted = (underlyingAmtIn * ONE / underlyingUnitAmt) + (perpAmtIn * ONE / perpUnitAmt) + // = (1000 * 10^9 * 10^18 / 10^9) + (500 * 10^9 * 10^18 / 10^9) + // = 1000 * 10^18 + 500 * 10^18 = 1500 * 10^18 + const [notesMinted, underlyingAmtIn, perpAmtIn] = + await vault.computeMintAmt.staticCall(amplFP("1000"), perpFP("500")); + expect(notesMinted).to.eq(noteFP("1500")); + expect(underlyingAmtIn).to.eq(amplFP("1000")); + expect(perpAmtIn).to.eq(perpFP("500")); + }); + }); + + describe("subsequent mint (totalSupply > 0, vault has only underlying)", function () { + it("should compute mint amount proportional to balance", async function () { + const { vault } = await loadFixture(setupContracts); + await vault.deposit(amplFP("1000"), 0, 0); + // notesMinted = totalSupply * underlyingAmtIn / underlyingBal + // = 1000 * 10^18 * 500 * 10^9 / (1000 * 10^9) = 500 * 10^18 + const [notesMinted, underlyingAmtIn, perpAmtIn] = + await vault.computeMintAmt.staticCall(amplFP("500"), perpFP("100")); + expect(notesMinted).to.eq(noteFP("500")); + expect(underlyingAmtIn).to.eq(amplFP("500")); + expect(perpAmtIn).to.eq(0n); // perps ignored when vault has only underlying + }); + }); + + describe("subsequent mint (totalSupply > 0, vault has only perps)", function () { + it("should compute mint amount proportional to balance", async function () { + const { vault } = await loadFixture(setupContracts); + await vault.deposit(0, perpFP("1000"), 0); + // notesMinted = totalSupply * perpAmtIn / perpBal + // = 1000 * 10^18 * 500 * 10^9 / (1000 * 10^9) = 500 * 10^18 + const [notesMinted, underlyingAmtIn, perpAmtIn] = + await vault.computeMintAmt.staticCall(amplFP("100"), perpFP("500")); + expect(notesMinted).to.eq(noteFP("500")); + expect(underlyingAmtIn).to.eq(0n); // underlying ignored when vault has only perps + expect(perpAmtIn).to.eq(perpFP("500")); + }); + }); + + describe("subsequent mint (totalSupply > 0, vault has both tokens)", function () { + it("should enforce vault ratio (underlying limited)", async function () { + const { vault } = await loadFixture(setupContracts); + await vault.deposit(amplFP("1000"), perpFP("500"), 0); + // Vault ratio: 1000 AMPL : 500 SPOT = 2:1 + // User wants: 200 AMPL max, 200 SPOT max + // Required perp for 200 AMPL: 500 * 200 / 1000 = 100 SPOT + // Since 100 < 200 (perpAmtMax), underlying is the limit + // notesMinted = totalSupply * underlyingAmtIn / underlyingBal + // = 1500 * 10^18 * 200 * 10^9 / (1000 * 10^9) = 300 * 10^18 + const [notesMinted, underlyingAmtIn, perpAmtIn] = + await vault.computeMintAmt.staticCall(amplFP("200"), perpFP("200")); + expect(notesMinted).to.eq(noteFP("300")); + expect(underlyingAmtIn).to.eq(amplFP("200")); + expect(perpAmtIn).to.eq(perpFP("100")); + }); + + it("should enforce vault ratio (perp limited)", async function () { + const { vault } = await loadFixture(setupContracts); + await vault.deposit(amplFP("1000"), perpFP("500"), 0); + // Vault ratio: 1000 AMPL : 500 SPOT = 2:1 + // User wants: 400 AMPL max, 100 SPOT max + // Required perp for 400 AMPL: 500 * 400 / 1000 = 200 SPOT + // Since 200 > 100 (perpAmtMax), perp is the limit + // Required underlying for 100 SPOT: 1000 * 100 / 500 = 200 AMPL + // notesMinted = totalSupply * underlyingAmtIn / underlyingBal + // = 1500 * 10^18 * 200 * 10^9 / (1000 * 10^9) = 300 * 10^18 + const [notesMinted, underlyingAmtIn, perpAmtIn] = + await vault.computeMintAmt.staticCall(amplFP("400"), perpFP("100")); + expect(notesMinted).to.eq(noteFP("300")); + expect(underlyingAmtIn).to.eq(amplFP("200")); + expect(perpAmtIn).to.eq(perpFP("100")); + }); + }); + }); + + describe("#deposit", function () { + describe("when paused", function () { + it("should revert", async function () { + const { vault } = await loadFixture(setupContracts); + await vault.pause(); + await expect(vault.deposit(amplFP("100"), 0, 0)).to.be.revertedWith( + "Pausable: paused", + ); + }); + }); + + describe("when both amounts are zero", function () { + it("should return zero", async function () { + const { vault } = await loadFixture(setupContracts); + expect(await vault.deposit.staticCall(0, 0, 0)).to.eq(0n); + }); + }); + + describe("when slippage is too high", function () { + it("should revert", async function () { + const { vault } = await loadFixture(setupContracts); + // Request 100 AMPL which would mint 100 notes, but require minimum 200 notes + await expect( + vault.deposit(amplFP("100"), 0, noteFP("200")), + ).to.be.revertedWithCustomError(vault, "SlippageTooHigh"); + }); + }); + + describe("first deposit (underlying only)", function () { + it("should transfer underlying from user", async function () { + const { deployer, vault, underlying } = await loadFixture(setupContracts); + await expect(() => vault.deposit(amplFP("1000"), 0, 0)).to.changeTokenBalance( + underlying, + deployer, + amplFP("-1000"), + ); + }); + + it("should mint notes to user", async function () { + const { deployer, vault } = await loadFixture(setupContracts); + // First deposit: notesMinted = underlyingAmtIn * ONE / underlyingUnitAmt + // = 1000 * 10^9 * 10^18 / 10^9 = 1000 * 10^18 + await expect(() => vault.deposit(amplFP("1000"), 0, 0)).to.changeTokenBalance( + vault, + deployer, + noteFP("1000"), + ); + expect(await vault.totalSupply()).to.eq(noteFP("1000")); + }); + + it("should return mint amount", async function () { + const { vault } = await loadFixture(setupContracts); + const notesMinted = await vault.deposit.staticCall(amplFP("1000"), 0, 0); + expect(notesMinted).to.eq(noteFP("1000")); + }); + + it("should emit Deposit event", async function () { + const { deployer, vault } = await loadFixture(setupContracts); + await expect(vault.deposit(amplFP("1000"), 0, 0)) + .to.emit(vault, "Deposit") + .withArgs(await deployer.getAddress(), amplFP("1000"), 0n, noteFP("1000")); + }); + }); + + describe("first deposit (perp only)", function () { + it("should transfer perp from user", async function () { + const { deployer, vault, perp } = await loadFixture(setupContracts); + await expect(() => vault.deposit(0, perpFP("500"), 0)).to.changeTokenBalance( + perp, + deployer, + perpFP("-500"), + ); + }); + + it("should mint notes to user", async function () { + const { deployer, vault } = await loadFixture(setupContracts); + await expect(() => vault.deposit(0, perpFP("500"), 0)).to.changeTokenBalance( + vault, + deployer, + noteFP("500"), + ); + expect(await vault.totalSupply()).to.eq(noteFP("500")); + }); + + it("should emit Deposit event", async function () { + const { deployer, vault } = await loadFixture(setupContracts); + await expect(vault.deposit(0, perpFP("500"), 0)) + .to.emit(vault, "Deposit") + .withArgs(await deployer.getAddress(), 0n, perpFP("500"), noteFP("500")); + }); + }); + + describe("first deposit (both tokens)", function () { + it("should transfer both tokens from user", async function () { + const { deployer, vault, underlying } = await loadFixture(setupContracts); + await expect(() => + vault.deposit(amplFP("1000"), perpFP("500"), 0), + ).to.changeTokenBalances(underlying, [deployer], [amplFP("-1000")]); + }); + + it("should transfer perp from user", async function () { + const { deployer, vault, perp } = await loadFixture(setupContracts); + await expect(() => + vault.deposit(amplFP("1000"), perpFP("500"), 0), + ).to.changeTokenBalance(perp, deployer, perpFP("-500")); + }); + + it("should mint combined notes to user", async function () { + const { deployer, vault } = await loadFixture(setupContracts); + // notesMinted = (1000 + 500) * 10^18 = 1500 * 10^18 + await expect(() => + vault.deposit(amplFP("1000"), perpFP("500"), 0), + ).to.changeTokenBalance(vault, deployer, noteFP("1500")); + expect(await vault.totalSupply()).to.eq(noteFP("1500")); + }); + + it("should emit Deposit event", async function () { + const { deployer, vault } = await loadFixture(setupContracts); + await expect(vault.deposit(amplFP("1000"), perpFP("500"), 0)) + .to.emit(vault, "Deposit") + .withArgs( + await deployer.getAddress(), + amplFP("1000"), + perpFP("500"), + noteFP("1500"), + ); + }); + }); + + describe("subsequent deposits (vault has only underlying)", function () { + it("should transfer underlying from user", async function () { + const { vault, underlying, otherUser } = await loadFixture(setupContracts); + await vault.deposit(amplFP("1000"), 0, 0); + await expect(() => + vault.connect(otherUser).deposit(amplFP("500"), perpFP("100"), 0), + ).to.changeTokenBalance(underlying, otherUser, amplFP("-500")); + }); + + it("should not transfer perp (vault has only underlying)", async function () { + const { vault, perp, otherUser } = await loadFixture(setupContracts); + await vault.deposit(amplFP("1000"), 0, 0); + await expect(() => + vault.connect(otherUser).deposit(amplFP("500"), perpFP("100"), 0), + ).to.changeTokenBalance(perp, otherUser, 0n); + }); + + it("should mint proportional notes", async function () { + const { vault, otherUser } = await loadFixture(setupContracts); + await vault.deposit(amplFP("1000"), 0, 0); + // notesMinted = totalSupply * underlyingAmtIn / underlyingBal + // = 1000 * 10^18 * 500 * 10^9 / (1000 * 10^9) = 500 * 10^18 + await expect(() => + vault.connect(otherUser).deposit(amplFP("500"), 0, 0), + ).to.changeTokenBalance(vault, otherUser, noteFP("500")); + expect(await vault.totalSupply()).to.eq(noteFP("1500")); + }); + + it("should return mint amount", async function () { + const { vault, otherUser } = await loadFixture(setupContracts); + await vault.deposit(amplFP("1000"), 0, 0); + const notesMinted = await vault + .connect(otherUser) + .deposit.staticCall(amplFP("500"), 0, 0); + expect(notesMinted).to.eq(noteFP("500")); + }); + + it("should emit Deposit event", async function () { + const { vault, otherUser } = await loadFixture(setupContracts); + await vault.deposit(amplFP("1000"), 0, 0); + await expect(vault.connect(otherUser).deposit(amplFP("500"), 0, 0)) + .to.emit(vault, "Deposit") + .withArgs(await otherUser.getAddress(), amplFP("500"), 0n, noteFP("500")); + }); + }); + + describe("subsequent deposits (vault has only perps)", function () { + it("should not transfer underlying (vault has only perps)", async function () { + const { vault, underlying, otherUser } = await loadFixture(setupContracts); + await vault.deposit(0, perpFP("1000"), 0); + await expect(() => + vault.connect(otherUser).deposit(amplFP("100"), perpFP("500"), 0), + ).to.changeTokenBalance(underlying, otherUser, 0n); + }); + + it("should transfer perp from user", async function () { + const { vault, perp, otherUser } = await loadFixture(setupContracts); + await vault.deposit(0, perpFP("1000"), 0); + await expect(() => + vault.connect(otherUser).deposit(amplFP("100"), perpFP("500"), 0), + ).to.changeTokenBalance(perp, otherUser, perpFP("-500")); + }); + + it("should mint proportional notes", async function () { + const { vault, otherUser } = await loadFixture(setupContracts); + await vault.deposit(0, perpFP("1000"), 0); + // notesMinted = totalSupply * perpAmtIn / perpBal + // = 1000 * 10^18 * 500 * 10^9 / (1000 * 10^9) = 500 * 10^18 + await expect(() => + vault.connect(otherUser).deposit(0, perpFP("500"), 0), + ).to.changeTokenBalance(vault, otherUser, noteFP("500")); + expect(await vault.totalSupply()).to.eq(noteFP("1500")); + }); + }); + + describe("subsequent deposits (vault has both tokens)", function () { + it("should transfer proportional amounts (underlying limited)", async function () { + const { vault, underlying, otherUser } = await loadFixture(setupContracts); + await vault.deposit(amplFP("1000"), perpFP("500"), 0); + // Vault ratio: 1000 AMPL : 500 SPOT = 2:1 + // User offers: 200 AMPL max, 200 SPOT max + // Required perp for 200 AMPL: 500 * 200 / 1000 = 100 SPOT + await expect(() => + vault.connect(otherUser).deposit(amplFP("200"), perpFP("200"), 0), + ).to.changeTokenBalances( + underlying, + [otherUser, vault], + [amplFP("-200"), amplFP("200")], + ); + }); + + it("should transfer proportional perp (underlying limited)", async function () { + const { vault, perp, otherUser } = await loadFixture(setupContracts); + await vault.deposit(amplFP("1000"), perpFP("500"), 0); + await expect(() => + vault.connect(otherUser).deposit(amplFP("200"), perpFP("200"), 0), + ).to.changeTokenBalance(perp, otherUser, perpFP("-100")); + }); + + it("should transfer proportional amounts (perp limited)", async function () { + const { vault, underlying, otherUser } = await loadFixture(setupContracts); + await vault.deposit(amplFP("1000"), perpFP("500"), 0); + // Vault ratio: 1000 AMPL : 500 SPOT = 2:1 + // User offers: 400 AMPL max, 100 SPOT max + // Required perp for 400 AMPL: 500 * 400 / 1000 = 200 SPOT > 100 max + // So perp is limiting: required underlying = 1000 * 100 / 500 = 200 AMPL + await expect(() => + vault.connect(otherUser).deposit(amplFP("400"), perpFP("100"), 0), + ).to.changeTokenBalance(underlying, otherUser, amplFP("-200")); + }); + + it("should transfer proportional perp (perp limited)", async function () { + const { vault, perp, otherUser } = await loadFixture(setupContracts); + await vault.deposit(amplFP("1000"), perpFP("500"), 0); + await expect(() => + vault.connect(otherUser).deposit(amplFP("400"), perpFP("100"), 0), + ).to.changeTokenBalance(perp, otherUser, perpFP("-100")); + }); + + it("should mint proportional notes", async function () { + const { vault, otherUser } = await loadFixture(setupContracts); + await vault.deposit(amplFP("1000"), perpFP("500"), 0); + // notesMinted = totalSupply * underlyingAmtIn / underlyingBal + // = 1500 * 10^18 * 200 * 10^9 / (1000 * 10^9) = 300 * 10^18 + await expect(() => + vault.connect(otherUser).deposit(amplFP("200"), perpFP("200"), 0), + ).to.changeTokenBalance(vault, otherUser, noteFP("300")); + }); + + it("should emit Deposit event", async function () { + const { vault, otherUser } = await loadFixture(setupContracts); + await vault.deposit(amplFP("1000"), perpFP("500"), 0); + await expect(vault.connect(otherUser).deposit(amplFP("200"), perpFP("200"), 0)) + .to.emit(vault, "Deposit") + .withArgs( + await otherUser.getAddress(), + amplFP("200"), + perpFP("100"), + noteFP("300"), + ); + }); + }); + + describe("slippage protection", function () { + it("should succeed when notes meet minimum", async function () { + const { vault } = await loadFixture(setupContracts); + // Deposit 1000 AMPL, expect at least 1000 notes + const notesMinted = await vault.deposit.staticCall( + amplFP("1000"), + 0, + noteFP("1000"), + ); + expect(notesMinted).to.eq(noteFP("1000")); + }); + + it("should revert when notes below minimum", async function () { + const { vault } = await loadFixture(setupContracts); + // Deposit 1000 AMPL (would mint 1000 notes), but require 1001 notes + await expect( + vault.deposit(amplFP("1000"), 0, noteFP("1001")), + ).to.be.revertedWithCustomError(vault, "SlippageTooHigh"); + }); + }); + }); + + describe("#computeRedemptionAmts", function () { + describe("when notesAmt is zero", function () { + it("should return zeros", async function () { + const { vault } = await loadFixture(setupContracts); + const [underlyingOut, perpOut] = await vault.computeRedemptionAmts.staticCall(0); + expect(underlyingOut).to.eq(0n); + expect(perpOut).to.eq(0n); + }); + }); + + describe("when totalSupply is zero", function () { + it("should return zeros", async function () { + const { vault } = await loadFixture(setupContracts); + const [underlyingOut, perpOut] = await vault.computeRedemptionAmts.staticCall( + noteFP("100"), + ); + expect(underlyingOut).to.eq(0n); + expect(perpOut).to.eq(0n); + }); + }); + + describe("when redeeming partial supply (only underlying)", function () { + it("should return proportional amounts", async function () { + const { vault } = await loadFixture(setupContracts); + await vault.deposit(amplFP("1000"), 0, 0); + // underlyingAmtOut = underlyingBalance * notesAmt / totalSupply + // = 1000 * 10^9 * 500 * 10^18 / (1000 * 10^18) = 500 * 10^9 + const [underlyingOut, perpOut] = await vault.computeRedemptionAmts.staticCall( + noteFP("500"), + ); + expect(underlyingOut).to.eq(amplFP("500")); + expect(perpOut).to.eq(0n); + }); + }); + + describe("when redeeming entire supply (only underlying)", function () { + it("should return all underlying", async function () { + const { vault } = await loadFixture(setupContracts); + await vault.deposit(amplFP("1000"), 0, 0); + const [underlyingOut, perpOut] = await vault.computeRedemptionAmts.staticCall( + noteFP("1000"), + ); + expect(underlyingOut).to.eq(amplFP("1000")); + expect(perpOut).to.eq(0n); + }); + }); + + describe("when vault holds both underlying and perps", function () { + it("should return proportional amounts of both", async function () { + const { vault } = await loadFixture(setupContracts); + await vault.deposit(amplFP("1000"), perpFP("200"), 0); + // underlyingAmtOut = 1000 * 10^9 * 600 * 10^18 / (1200 * 10^18) = 500 * 10^9 + // perpAmtOut = 200 * 10^9 * 600 * 10^18 / (1200 * 10^18) = 100 * 10^9 + const [underlyingOut, perpOut] = await vault.computeRedemptionAmts.staticCall( + noteFP("600"), + ); + expect(underlyingOut).to.eq(amplFP("500")); + expect(perpOut).to.eq(perpFP("100")); + }); + }); + }); + + describe("#redeem", function () { + async function setupWithDeposited() { + const fixtures = await setupContracts(); + const { vault } = fixtures; + await vault.deposit(amplFP("1000"), 0, 0); + return fixtures; + } + + describe("when paused", function () { + it("should revert", async function () { + const { vault } = await loadFixture(setupWithDeposited); + await vault.pause(); + await expect(vault.redeem(noteFP("100"), 0, 0)).to.be.revertedWith( + "Pausable: paused", + ); + }); + }); + + describe("when amount is zero", function () { + it("should return zeros", async function () { + const { vault } = await loadFixture(setupWithDeposited); + const [underlyingOut, perpOut] = await vault.redeem.staticCall(0, 0, 0); + expect(underlyingOut).to.eq(0n); + expect(perpOut).to.eq(0n); + }); + }); + + describe("when slippage is too high", function () { + it("should revert when underlying below minimum", async function () { + const { vault } = await loadFixture(setupWithDeposited); + // Request 400 notes redeem which would give 400 AMPL, but require minimum 500 AMPL + await expect( + vault.redeem(noteFP("400"), amplFP("500"), 0), + ).to.be.revertedWithCustomError(vault, "SlippageTooHigh"); + }); + + it("should revert when perp below minimum", async function () { + const { vault } = await loadFixture(setupWithDeposited); + // Request 400 notes redeem which would give 0 SPOT, but require minimum 1 SPOT + await expect( + vault.redeem(noteFP("400"), 0, perpFP("1")), + ).to.be.revertedWithCustomError(vault, "SlippageTooHigh"); + }); + }); + + describe("on partial redemption", function () { + it("should burn notes from user", async function () { + const { deployer, vault } = await loadFixture(setupWithDeposited); + await expect(() => vault.redeem(noteFP("400"), 0, 0)).to.changeTokenBalance( + vault, + deployer, + noteFP("-400"), + ); + expect(await vault.totalSupply()).to.eq(noteFP("600")); + }); + + it("should transfer underlying to user", async function () { + const { deployer, vault, underlying } = await loadFixture(setupWithDeposited); + // underlyingAmtOut = 1000 * 10^9 * 400 * 10^18 / (1000 * 10^18) = 400 * 10^9 + await expect(() => vault.redeem(noteFP("400"), 0, 0)).to.changeTokenBalance( + underlying, + deployer, + amplFP("400"), + ); + }); + + it("should return redemption amounts", async function () { + const { vault } = await loadFixture(setupWithDeposited); + const [underlyingOut, perpOut] = await vault.redeem.staticCall( + noteFP("400"), + 0, + 0, + ); + expect(underlyingOut).to.eq(amplFP("400")); + expect(perpOut).to.eq(0n); + }); + + it("should emit Redeem event", async function () { + const { deployer, vault } = await loadFixture(setupWithDeposited); + await expect(vault.redeem(noteFP("400"), 0, 0)) + .to.emit(vault, "Redeem") + .withArgs(await deployer.getAddress(), noteFP("400"), amplFP("400"), 0n); + }); + }); + + describe("on complete redemption", function () { + it("should burn all notes from user", async function () { + const { deployer, vault } = await loadFixture(setupWithDeposited); + await expect(() => vault.redeem(noteFP("1000"), 0, 0)).to.changeTokenBalance( + vault, + deployer, + noteFP("-1000"), + ); + expect(await vault.balanceOf(await deployer.getAddress())).to.eq(0n); + expect(await vault.totalSupply()).to.eq(0n); + }); + + it("should transfer all underlying to user", async function () { + const { deployer, vault, underlying } = await loadFixture(setupWithDeposited); + await expect(() => vault.redeem(noteFP("1000"), 0, 0)).to.changeTokenBalance( + underlying, + deployer, + amplFP("1000"), + ); + }); + + it("should return redemption amounts", async function () { + const { vault } = await loadFixture(setupWithDeposited); + const [underlyingOut, perpOut] = await vault.redeem.staticCall( + noteFP("1000"), + 0, + 0, + ); + expect(underlyingOut).to.eq(amplFP("1000")); + expect(perpOut).to.eq(0n); + }); + + it("should emit Redeem event", async function () { + const { deployer, vault } = await loadFixture(setupWithDeposited); + await expect(vault.redeem(noteFP("1000"), 0, 0)) + .to.emit(vault, "Redeem") + .withArgs(await deployer.getAddress(), noteFP("1000"), amplFP("1000"), 0n); + }); + }); + + describe("when vault holds both underlying and perps", function () { + async function setupWithBothTokens() { + const fixtures = await setupContracts(); + const { vault } = fixtures; + // Deposit both: 1000 AMPL + 500 SPOT = 1500 notes + await vault.deposit(amplFP("1000"), perpFP("500"), 0); + return fixtures; + } + + it("should transfer proportional amounts of both", async function () { + const { deployer, vault, underlying } = await loadFixture(setupWithBothTokens); + // Redeem 750 notes (half): should get 500 AMPL and 250 SPOT + await expect(() => vault.redeem(noteFP("750"), 0, 0)).to.changeTokenBalances( + underlying, + [deployer], + [amplFP("500")], + ); + }); + + it("should transfer proportional perps to user", async function () { + const { deployer, vault, perp } = await loadFixture(setupWithBothTokens); + // perpAmtOut = 500 * 10^9 * 750 * 10^18 / (1500 * 10^18) = 250 * 10^9 + await expect(() => vault.redeem(noteFP("750"), 0, 0)).to.changeTokenBalance( + perp, + deployer, + perpFP("250"), + ); + }); + + it("should return both redemption amounts", async function () { + const { vault } = await loadFixture(setupWithBothTokens); + const [underlyingOut, perpOut] = await vault.redeem.staticCall( + noteFP("750"), + 0, + 0, + ); + expect(underlyingOut).to.eq(amplFP("500")); + expect(perpOut).to.eq(perpFP("250")); + }); + + it("should emit Redeem event with both amounts", async function () { + const { deployer, vault } = await loadFixture(setupWithBothTokens); + await expect(vault.redeem(noteFP("750"), 0, 0)) + .to.emit(vault, "Redeem") + .withArgs( + await deployer.getAddress(), + noteFP("750"), + amplFP("500"), + perpFP("250"), + ); + }); + }); + + describe("slippage protection", function () { + async function setupWithBothTokens() { + const fixtures = await setupContracts(); + const { vault } = fixtures; + await vault.deposit(amplFP("1000"), perpFP("500"), 0); + return fixtures; + } + + it("should succeed when amounts meet minimum", async function () { + const { vault } = await loadFixture(setupWithBothTokens); + // Redeem 750 notes: expect 500 AMPL and 250 SPOT + const [underlyingOut, perpOut] = await vault.redeem.staticCall( + noteFP("750"), + amplFP("500"), + perpFP("250"), + ); + expect(underlyingOut).to.eq(amplFP("500")); + expect(perpOut).to.eq(perpFP("250")); + }); + + it("should revert when underlying below minimum", async function () { + const { vault } = await loadFixture(setupWithBothTokens); + await expect( + vault.redeem(noteFP("750"), amplFP("501"), perpFP("250")), + ).to.be.revertedWithCustomError(vault, "SlippageTooHigh"); + }); + + it("should revert when perp below minimum", async function () { + const { vault } = await loadFixture(setupWithBothTokens); + await expect( + vault.redeem(noteFP("750"), amplFP("500"), perpFP("251")), + ).to.be.revertedWithCustomError(vault, "SlippageTooHigh"); + }); + }); + }); +}); diff --git a/spot-vaults/test/DRBalancerVault_rebalance.ts b/spot-vaults/test/DRBalancerVault_rebalance.ts new file mode 100644 index 00000000..7393e71e --- /dev/null +++ b/spot-vaults/test/DRBalancerVault_rebalance.ts @@ -0,0 +1,625 @@ +import { ethers, upgrades } from "hardhat"; +import { loadFixture, time } from "@nomicfoundation/hardhat-toolbox/network-helpers"; +import { expect } from "chai"; +import { DMock, amplFP, perpFP, drFP } from "./helpers"; + +const ONE = ethers.parseUnits("1", 18); +const DAY = 86400; + +describe("DRBalancerVault", function () { + async function setupContracts() { + const accounts = await ethers.getSigners(); + const deployer = accounts[0]; + + // Deploy mock underlying token (AMPL-like, 9 decimals) + const Token = await ethers.getContractFactory("MockERC20"); + const underlying = await Token.deploy(); + await underlying.init("Ampleforth", "AMPL", 9); + + // Deploy mock perp token (SPOT-like, 9 decimals) with getTVL support + const PerpToken = await ethers.getContractFactory("MockPerpetualTranche"); + const perp = await PerpToken.deploy(); + await perp.init("SPOT", "SPOT", 9); + // Note: perpTVL is set but totalSupply starts at 0 + // perpPrice = perpTVL / totalSupply, so we must mint perps to establish a price + await perp.setTVL(amplFP("10000")); + + // Deploy mock rollover vault + const rolloverVault = new DMock( + "@ampleforthorg/spot-contracts/contracts/_interfaces/IRolloverVault.sol:IRolloverVault", + ); + await rolloverVault.deploy(); + await rolloverVault.mockMethod("swapUnderlyingForPerps(uint256)", [0]); + await rolloverVault.mockMethod("swapPerpsForUnderlying(uint256)", [0]); + // Mock system DR at equilibrium (1.0 with 8 decimals as per FeePolicy) + await rolloverVault.mockMethod("deviationRatio()", [drFP("1")]); + + // Deploy DRBalancerVault + const DRBalancerVault = await ethers.getContractFactory("DRBalancerVault"); + const vault = await upgrades.deployProxy( + DRBalancerVault.connect(deployer), + ["DR Balancer LP", "DRLP", underlying.target, perp.target, rolloverVault.target], + { + initializer: "init(string,string,address,address,address)", + }, + ); + + // Mint tokens to deployer for testing + await underlying.mint(deployer.getAddress(), amplFP("100000")); + + // Approve vault to spend tokens + await underlying.connect(deployer).approve(vault.target, ethers.MaxUint256); + + return { deployer, underlying, perp, rolloverVault, vault }; + } + + // Fixture with balanced liquidity: 10000 AMPL + 10000 SPOT (perpPrice = 1) + async function setupWithBalancedLiquidity() { + const fixtures = await setupContracts(); + const { vault, perp } = fixtures; + + // Deposit 10000 AMPL + await vault.deposit(amplFP("10000"), 0, 0); + + // Mint 10000 perps to vault, with perpTVL = 10000, so perpPrice = 1 + await perp.mint(vault.target, perpFP("10000")); + + return fixtures; + } + + // Fixture with only underlying (no perps in vault, but perps exist in system) + async function setupWithOnlyUnderlying() { + const fixtures = await setupContracts(); + const { vault, perp, deployer } = fixtures; + await vault.deposit(amplFP("10000"), 0, 0); + // Mint perps to deployer (not vault) so perpTotalSupply > 0 to avoid division by zero + await perp.mint(await deployer.getAddress(), perpFP("10000")); + return fixtures; + } + + // Fixture with only perps in vault (no underlying deposited) + async function setupWithOnlyPerps() { + const fixtures = await setupContracts(); + const { vault, perp } = fixtures; + // Mint perps directly to vault (simulating a state after full conversion) + await perp.mint(vault.target, perpFP("10000")); + return fixtures; + } + + describe("#computeRebalanceAmount", function () { + // Test Matrix: + // - DR at target: returns 0 + // - DR within equilibrium range: returns 0 + // - DR below target: perp -> underlying swap (isUnderlyingIntoPerp = false) + // - DR above target: underlying -> perp swap (isUnderlyingIntoPerp = true) + // - Caps: minRebalanceVal threshold, availableLiquidity cap, requiredChange cap + + describe("DR at target", function () { + it("should return 0 at DR = 1.0", async function () { + const { vault, rolloverVault } = await loadFixture(setupWithBalancedLiquidity); + await rolloverVault.mockMethod("deviationRatio()", [drFP("1")]); + + const [amt, isUnderlyingIntoPerp] = + await vault.computeRebalanceAmount.staticCall(); + expect(amt).to.eq(0n); + // When DR is within equilibrium range, no swap occurs and direction is false + expect(isUnderlyingIntoPerp).to.eq(false); + }); + }); + + describe("DR below target (perp -> underlying swap)", function () { + // When DR < target: redeem perps to decrease perpTVL + // isUnderlyingIntoPerp = false + + describe("basic rebalance", function () { + it("should compute adjustedChange correctly", async function () { + const { vault, rolloverVault } = await loadFixture(setupWithBalancedLiquidity); + await rolloverVault.mockMethod("deviationRatio()", [drFP("0.5")]); + + // drDelta = 1.0 - 0.5 = 0.5 + // requiredChange = perpTVL * drDelta = 10000 * 0.5 = 5000 AMPL + // adjustedChange = 5000 / 3 (lagFactor) = 1666.666... AMPL + // availableLiquidity = perpValue = 10000 AMPL + // adjustedChange < availableLiquidity, adjustedChange < requiredChange + const [amt, isUnderlyingIntoPerp] = + await vault.computeRebalanceAmount.staticCall(); + expect(amt).to.eq(amplFP("1666.666666666")); + expect(isUnderlyingIntoPerp).to.eq(false); + }); + }); + + describe("minRebalanceVal threshold", function () { + it("should return 0 when adjustedChange < minRebalanceVal", async function () { + const { vault, rolloverVault } = await loadFixture(setupWithBalancedLiquidity); + // Set minRebalanceVal to 1000 AMPL (underlying denominated) + await vault.updateMinRebalanceAmt(amplFP("1000")); + await rolloverVault.mockMethod("deviationRatio()", [drFP("0.8")]); + + // drDelta = 1.0 - 0.8 = 0.2 + // requiredChange = 10000 * 0.2 = 2000 AMPL + // adjustedChange = 2000 / 3 = 666.666... AMPL + // 666 < minRebalanceVal (1000), so return 0 + const [amt, isUnderlyingIntoPerp] = + await vault.computeRebalanceAmount.staticCall(); + expect(amt).to.eq(0n); + expect(isUnderlyingIntoPerp).to.eq(false); + }); + + it("should proceed when adjustedChange >= minRebalanceVal", async function () { + const { vault, rolloverVault } = await loadFixture(setupWithBalancedLiquidity); + await vault.updateMinRebalanceAmt(amplFP("500")); + await rolloverVault.mockMethod("deviationRatio()", [drFP("0.8")]); + + // adjustedChange = 666 >= minRebalanceVal (500) + const [amt, isUnderlyingIntoPerp] = + await vault.computeRebalanceAmount.staticCall(); + expect(amt).to.eq(amplFP("666.666666666")); + expect(isUnderlyingIntoPerp).to.eq(false); + }); + }); + + describe("availableLiquidity cap", function () { + it("should cap at availableLiquidity when adjustedChange > availableLiquidity", async function () { + const { vault, rolloverVault } = await loadFixture(setupWithBalancedLiquidity); + // Set lagFactor to 1 so adjustedChange = requiredChange + await vault.updateLagFactors(1, 1); + await rolloverVault.mockMethod("deviationRatio()", [drFP("0.3")]); + + // drDelta = 1.0 - 0.3 = 0.7 + // requiredChange = 10000 * 0.7 = 7000 AMPL + // adjustedChange = 7000 / 1 = 7000 AMPL + // availableLiquidity = perpValue = 10000 AMPL + // 7000 < 10000, so no cap needed + const [amt, isUnderlyingIntoPerp] = + await vault.computeRebalanceAmount.staticCall(); + expect(amt).to.eq(amplFP("7000")); + expect(isUnderlyingIntoPerp).to.eq(false); + }); + }); + + describe("requiredChange cap (overshoot protection)", function () { + it("should cap at requiredChange to prevent overshoot", async function () { + const { vault, rolloverVault, perp } = await loadFixture(setupContracts); + await vault.deposit(amplFP("50000"), 0, 0); + await perp.mint(vault.target, perpFP("50000")); + // Set lagFactor to 1 so adjustedChange = requiredChange + await vault.updateLagFactors(1, 1); + await rolloverVault.mockMethod("deviationRatio()", [drFP("0.9")]); + + // drDelta = 1.0 - 0.9 = 0.1 + // requiredChange = 10000 * 0.1 = 1000 AMPL + // adjustedChange = 1000 / 1 = 1000 AMPL + // availableLiquidity = 50000 AMPL + // adjustedChange (1000) < availableLiquidity (50000) + // adjustedChange (1000) = requiredChange (1000), no overshoot + const [amt, isUnderlyingIntoPerp] = + await vault.computeRebalanceAmount.staticCall(); + expect(amt).to.eq(amplFP("1000")); + expect(isUnderlyingIntoPerp).to.eq(false); + }); + }); + + describe("zero liquidity", function () { + it("should return 0 when vault has no perps", async function () { + const { vault, rolloverVault } = await loadFixture(setupWithOnlyUnderlying); + await rolloverVault.mockMethod("deviationRatio()", [drFP("0.8")]); + + // availableLiquidity = 0 + const [amt, isUnderlyingIntoPerp] = + await vault.computeRebalanceAmount.staticCall(); + expect(amt).to.eq(0n); + expect(isUnderlyingIntoPerp).to.eq(false); + }); + }); + }); + + describe("DR above target (underlying -> perp swap)", function () { + // When DR > target: mint perps to increase perpTVL + // isUnderlyingIntoPerp = true + + describe("basic rebalance", function () { + it("should compute adjustedChange correctly", async function () { + const { vault, rolloverVault } = await loadFixture(setupWithBalancedLiquidity); + await rolloverVault.mockMethod("deviationRatio()", [drFP("1.5")]); + + // drDelta = 1.5 - 1.0 = 0.5 + // requiredChange = 10000 * 0.5 = 5000 AMPL + // adjustedChange = 5000 / 3 = 1666.666... AMPL + // availableLiquidity = underlyingBalance = 10000 AMPL + const [amt, isUnderlyingIntoPerp] = + await vault.computeRebalanceAmount.staticCall(); + expect(amt).to.eq(amplFP("1666.666666666")); + expect(isUnderlyingIntoPerp).to.eq(true); + }); + }); + + describe("minRebalanceVal threshold", function () { + it("should return 0 when adjustedChange < minRebalanceVal", async function () { + const { vault, rolloverVault } = await loadFixture(setupWithBalancedLiquidity); + await vault.updateMinRebalanceAmt(amplFP("1000")); + await rolloverVault.mockMethod("deviationRatio()", [drFP("1.2")]); + + // drDelta = 1.2 - 1.0 = 0.2 + // requiredChange = 10000 * 0.2 = 2000 AMPL + // adjustedChange = 2000 / 3 = 666.666... AMPL + // 666 < minRebalanceVal (1000), so return 0 + const [amt, isUnderlyingIntoPerp] = + await vault.computeRebalanceAmount.staticCall(); + expect(amt).to.eq(0n); + expect(isUnderlyingIntoPerp).to.eq(true); + }); + }); + + describe("availableLiquidity cap", function () { + it("should cap at availableLiquidity when adjustedChange > availableLiquidity", async function () { + const { vault, rolloverVault } = await loadFixture(setupWithBalancedLiquidity); + await vault.updateLagFactors(1, 1); + await rolloverVault.mockMethod("deviationRatio()", [drFP("1.7")]); + + // drDelta = 1.7 - 1.0 = 0.7 + // requiredChange = 10000 * 0.7 = 7000 AMPL + // adjustedChange = 7000 / 1 = 7000 AMPL + // availableLiquidity = underlyingBalance = 10000 AMPL + // 7000 < 10000, so no cap needed + const [amt, isUnderlyingIntoPerp] = + await vault.computeRebalanceAmount.staticCall(); + expect(amt).to.eq(amplFP("7000")); + expect(isUnderlyingIntoPerp).to.eq(true); + }); + }); + + describe("requiredChange cap (overshoot protection)", function () { + it("should cap at requiredChange to prevent overshoot", async function () { + const { vault, rolloverVault, perp } = await loadFixture(setupContracts); + await vault.deposit(amplFP("50000"), 0, 0); + await perp.mint(vault.target, perpFP("10000")); + await vault.updateLagFactors(1, 1); + await rolloverVault.mockMethod("deviationRatio()", [drFP("1.1")]); + + // drDelta = 1.1 - 1.0 = 0.1 + // requiredChange = 10000 * 0.1 = 1000 AMPL + // adjustedChange = 1000 / 1 = 1000 AMPL + // availableLiquidity = 50000 AMPL + const [amt, isUnderlyingIntoPerp] = + await vault.computeRebalanceAmount.staticCall(); + expect(amt).to.eq(amplFP("1000")); + expect(isUnderlyingIntoPerp).to.eq(true); + }); + }); + + describe("zero liquidity", function () { + it("should return 0 when vault has no underlying", async function () { + const { vault, rolloverVault } = await loadFixture(setupWithOnlyPerps); + await rolloverVault.mockMethod("deviationRatio()", [drFP("1.2")]); + + // availableLiquidity = 0 + const [amt, isUnderlyingIntoPerp] = + await vault.computeRebalanceAmount.staticCall(); + expect(amt).to.eq(0n); + expect(isUnderlyingIntoPerp).to.eq(true); + }); + }); + }); + + describe("edge cases", function () { + it("should return 0 when perpTVL is 0", async function () { + const { vault, rolloverVault, perp } = await loadFixture( + setupWithBalancedLiquidity, + ); + await perp.setTVL(0); + await rolloverVault.mockMethod("deviationRatio()", [drFP("0.8")]); + + const [amt, isUnderlyingIntoPerp] = + await vault.computeRebalanceAmount.staticCall(); + expect(amt).to.eq(0n); + expect(isUnderlyingIntoPerp).to.eq(false); + }); + }); + }); + + describe("#rebalance", function () { + describe("when paused", function () { + it("should revert", async function () { + const { vault } = await loadFixture(setupWithBalancedLiquidity); + await vault.pause(); + await expect(vault.rebalance()).to.be.revertedWith("Pausable: paused"); + }); + }); + + describe("when cooldown not elapsed", function () { + it("should revert", async function () { + const { vault } = await loadFixture(setupWithBalancedLiquidity); + await vault.rebalance(); + await expect(vault.rebalance()).to.be.revertedWithCustomError( + vault, + "LastRebalanceTooRecent", + ); + }); + }); + + describe("when cooldown has elapsed", function () { + it("should allow rebalance", async function () { + const { vault, rolloverVault } = await loadFixture(setupWithBalancedLiquidity); + await rolloverVault.mockMethod("deviationRatio()", [drFP("1")]); + + await vault.rebalance(); + await time.increase(DAY + 1); + await expect(vault.rebalance()) + .to.emit(vault, "Rebalance") + .withArgs(drFP("1"), drFP("1"), 0n, false); + }); + }); + + describe("when system DR is at target", function () { + it("should emit Rebalance event with zero swap amount", async function () { + const { vault, rolloverVault } = await loadFixture(setupWithBalancedLiquidity); + await rolloverVault.mockMethod("deviationRatio()", [drFP("1")]); + + // When DR is within equilibrium range, no swap occurs and direction is false + await expect(vault.rebalance()) + .to.emit(vault, "Rebalance") + .withArgs(drFP("1"), drFP("1"), 0n, false); + }); + + it("should update lastRebalanceTimestampSec", async function () { + const { vault, rolloverVault } = await loadFixture(setupWithBalancedLiquidity); + await rolloverVault.mockMethod("deviationRatio()", [drFP("1")]); + + const tx = await vault.rebalance(); + const receipt = await tx.wait(); + const block = await ethers.provider.getBlock(receipt!.blockNumber); + + const timestamp = await vault.lastRebalanceTimestampSec(); + expect(timestamp).to.eq(block!.timestamp); + }); + + it("should not change token balances", async function () { + const { vault, rolloverVault, underlying } = await loadFixture( + setupWithBalancedLiquidity, + ); + await rolloverVault.mockMethod("deviationRatio()", [drFP("1")]); + + await expect(() => vault.rebalance()).to.changeTokenBalances( + underlying, + [vault], + [0n], + ); + }); + }); + + describe("underlying -> perp swap (DR too high)", function () { + it("should call swapUnderlyingForPerps with correct amount", async function () { + const { vault, rolloverVault } = await loadFixture(setupWithBalancedLiquidity); + await rolloverVault.mockMethod("deviationRatio()", [drFP("1.2")]); + // DR=1.2, drDelta=0.2, requiredChange=2000, adjustedChange=2000/3=666.666... + await rolloverVault.mockCall( + "swapUnderlyingForPerps(uint256)", + [amplFP("666.666666666")], + [perpFP("666.666666666")], + ); + + await expect(vault.rebalance()) + .to.emit(vault, "Rebalance") + .withArgs(drFP("1.2"), drFP("1.2"), amplFP("666.666666666"), true); + }); + }); + + describe("perp -> underlying swap (DR too low)", function () { + it("should call swapPerpsForUnderlying with correct amount", async function () { + const { vault, rolloverVault } = await loadFixture(setupWithBalancedLiquidity); + await rolloverVault.mockMethod("deviationRatio()", [drFP("0.8")]); + // DR=0.8, drDelta=0.2, requiredChange=2000, adjustedChange=2000/3=666.666... + // perpAmtIn = 666.666... * 10000 / 10000 = 666.666... SPOT + await rolloverVault.mockCall( + "swapPerpsForUnderlying(uint256)", + [perpFP("666.666666666")], + [amplFP("666.666666666")], + ); + + await expect(vault.rebalance()) + .to.emit(vault, "Rebalance") + .withArgs(drFP("0.8"), drFP("0.8"), amplFP("666.666666666"), false); + }); + }); + + describe("slippage protection", function () { + describe("underlying -> perp swap", function () { + it("should revert when fee exceeds max", async function () { + const { vault, rolloverVault } = await loadFixture(setupWithBalancedLiquidity); + await rolloverVault.mockMethod("deviationRatio()", [drFP("1.2")]); + + // Swap 666.666... AMPL, return only 600 SPOT (10% fee when perpPrice = 1) + await rolloverVault.mockCall( + "swapUnderlyingForPerps(uint256)", + [amplFP("666.666666666")], + [perpFP("600")], + ); + + // Default max fee is 1% + await expect(vault.rebalance()).to.be.revertedWithCustomError( + vault, + "SlippageTooHigh", + ); + }); + + it("should succeed when fee is zero", async function () { + const { vault, rolloverVault } = await loadFixture(setupWithBalancedLiquidity); + await rolloverVault.mockMethod("deviationRatio()", [drFP("1.2")]); + + // No fee + await rolloverVault.mockCall( + "swapUnderlyingForPerps(uint256)", + [amplFP("666.666666666")], + [perpFP("666.666666666")], + ); + + await expect(vault.rebalance()) + .to.emit(vault, "Rebalance") + .withArgs(drFP("1.2"), drFP("1.2"), amplFP("666.666666666"), true); + }); + + it("should succeed when fee is within limit", async function () { + const { vault, rolloverVault } = await loadFixture(setupWithBalancedLiquidity); + await rolloverVault.mockMethod("deviationRatio()", [drFP("1.2")]); + + // ~0.5% fee + await rolloverVault.mockCall( + "swapUnderlyingForPerps(uint256)", + [amplFP("666.666666666")], + [perpFP("663.333333333")], + ); + + // Default max fee is 1% + await expect(vault.rebalance()) + .to.emit(vault, "Rebalance") + .withArgs(drFP("1.2"), drFP("1.2"), amplFP("666.666666666"), true); + }); + + it("should succeed when fee equals max limit", async function () { + const { vault, rolloverVault } = await loadFixture(setupWithBalancedLiquidity); + await rolloverVault.mockMethod("deviationRatio()", [drFP("1.2")]); + await vault.updateMaxSwapFeePerc(ONE / 20n); // 5% + + // Exactly 5% fee + await rolloverVault.mockCall( + "swapUnderlyingForPerps(uint256)", + [amplFP("666.666666666")], + [perpFP("633.333333333")], + ); + + await expect(vault.rebalance()) + .to.emit(vault, "Rebalance") + .withArgs(drFP("1.2"), drFP("1.2"), amplFP("666.666666666"), true); + }); + }); + + describe("perp -> underlying swap", function () { + it("should revert when fee exceeds max", async function () { + const { vault, rolloverVault } = await loadFixture(setupWithBalancedLiquidity); + await rolloverVault.mockMethod("deviationRatio()", [drFP("0.8")]); + + // Swap 666.666... SPOT, return only 600 AMPL (10% fee) + await rolloverVault.mockCall( + "swapPerpsForUnderlying(uint256)", + [perpFP("666.666666666")], + [amplFP("600")], + ); + + // Default max fee is 1% + await expect(vault.rebalance()).to.be.revertedWithCustomError( + vault, + "SlippageTooHigh", + ); + }); + + it("should succeed when fee is zero", async function () { + const { vault, rolloverVault } = await loadFixture(setupWithBalancedLiquidity); + await rolloverVault.mockMethod("deviationRatio()", [drFP("0.8")]); + + // No fee + await rolloverVault.mockCall( + "swapPerpsForUnderlying(uint256)", + [perpFP("666.666666666")], + [amplFP("666.666666666")], + ); + + await expect(vault.rebalance()) + .to.emit(vault, "Rebalance") + .withArgs(drFP("0.8"), drFP("0.8"), amplFP("666.666666666"), false); + }); + + it("should succeed when fee is within limit", async function () { + const { vault, rolloverVault } = await loadFixture(setupWithBalancedLiquidity); + await rolloverVault.mockMethod("deviationRatio()", [drFP("0.8")]); + + // ~0.5% fee + await rolloverVault.mockCall( + "swapPerpsForUnderlying(uint256)", + [perpFP("666.666666666")], + [amplFP("663.333333333")], + ); + + await expect(vault.rebalance()) + .to.emit(vault, "Rebalance") + .withArgs(drFP("0.8"), drFP("0.8"), amplFP("666.666666666"), false); + }); + }); + }); + }); + + describe("#getTVL", function () { + describe("when vault has only underlying", function () { + it("should return underlying balance", async function () { + const { vault } = await loadFixture(setupWithOnlyUnderlying); + const tvl = await vault.getTVL.staticCall(); + expect(tvl).to.eq(amplFP("10000")); + }); + }); + + describe("when vault has only perps", function () { + it("should return perp value in underlying terms", async function () { + const { vault } = await loadFixture(setupWithOnlyPerps); + // perpValue = perpBalance * perpTVL / perpTotalSupply + // = 10000 * 10000 / 10000 = 10000 AMPL + const tvl = await vault.getTVL.staticCall(); + expect(tvl).to.eq(amplFP("10000")); + }); + }); + + describe("when vault has both underlying and perps", function () { + it("should return sum of underlying and perp value", async function () { + const { vault } = await loadFixture(setupWithBalancedLiquidity); + // TVL = underlyingBalance + perpValue + // = 10000 + (10000 * 10000 / 10000) = 20000 AMPL + const tvl = await vault.getTVL.staticCall(); + expect(tvl).to.eq(amplFP("20000")); + }); + }); + + describe("when perpPrice != 1", function () { + it("should calculate perp value correctly", async function () { + const { vault, perp } = await loadFixture(setupWithBalancedLiquidity); + // Change perpTVL to make perpPrice = 2 (perpTVL = 20000, supply = 10000) + await perp.setTVL(amplFP("20000")); + + // perpValue = 10000 * 20000 / 10000 = 20000 AMPL + // TVL = 10000 + 20000 = 30000 AMPL + const tvl = await vault.getTVL.staticCall(); + expect(tvl).to.eq(amplFP("30000")); + }); + }); + + describe("when perpTotalSupply is 0", function () { + it("should return only underlying balance", async function () { + const { vault } = await loadFixture(setupWithOnlyUnderlying); + // No perps exist, TVL = underlying only + const tvl = await vault.getTVL.staticCall(); + expect(tvl).to.eq(amplFP("10000")); + }); + }); + }); + + describe("#underlyingBalance", function () { + it("should return zero when empty", async function () { + const { vault } = await loadFixture(setupContracts); + expect(await vault.underlyingBalance()).to.eq(0n); + }); + + it("should return the underlying balance after deposit", async function () { + const { vault } = await loadFixture(setupWithOnlyUnderlying); + expect(await vault.underlyingBalance()).to.eq(amplFP("10000")); + }); + }); + + describe("#perpBalance", function () { + it("should return zero when no perps", async function () { + const { vault } = await loadFixture(setupWithOnlyUnderlying); + expect(await vault.perpBalance()).to.eq(0n); + }); + + it("should return perp balance when vault holds perps", async function () { + const { vault } = await loadFixture(setupWithOnlyPerps); + expect(await vault.perpBalance()).to.eq(perpFP("10000")); + }); + }); +}); diff --git a/spot-vaults/test/helpers.ts b/spot-vaults/test/helpers.ts index 141635fd..54a13ebb 100644 --- a/spot-vaults/test/helpers.ts +++ b/spot-vaults/test/helpers.ts @@ -17,6 +17,7 @@ export const ethOracleFP = (a: string): BigInt => ethers.parseUnits(sciParseFloa export const amplOracleFP = (a: string): BigInt => ethers.parseUnits(sciParseFloat(a), 18); export const drFP = (a: string): BigInt => ethers.parseUnits(sciParseFloat(a), 8); +export const noteFP = (a: string): BigInt => ethers.parseUnits(sciParseFloat(a), 18); export class DMock { private refArtifact: string; diff --git a/yarn.lock b/yarn.lock index 90f06744..a7786ac9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12,10 +12,10 @@ __metadata: languageName: node linkType: hard -"@adraffy/ens-normalize@npm:^1.10.1": - version: 1.11.0 - resolution: "@adraffy/ens-normalize@npm:1.11.0" - checksum: b2911269e3e0ec6396a2e5433a99e0e1f9726befc6c167994448cd0e53dbdd0be22b4835b4f619558b568ed9aa7312426b8fa6557a13999463489daa88169ee5 +"@adraffy/ens-normalize@npm:^1.11.0": + version: 1.11.1 + resolution: "@adraffy/ens-normalize@npm:1.11.1" + checksum: e8b17fcc730ccc45a956e1fbb09edfe42be41c291079512082e9964f8ef4287e67913183cdd02fff71d2e215340d5b98a9bbbd9be32c5d36fad4ba2c1ec33ff2 languageName: node linkType: hard @@ -30,7 +30,7 @@ __metadata: "@ethersproject/providers": ^5.6.8 "@nomicfoundation/hardhat-chai-matchers": latest "@nomicfoundation/hardhat-ethers": ^3.0.0 - "@nomicfoundation/hardhat-verify": latest + "@nomicfoundation/hardhat-verify": ^2.0.0 "@nomiclabs/hardhat-waffle": ^2.0.6 "@openzeppelin/contracts-upgradeable": 4.7.3 "@openzeppelin/hardhat-upgrades": ^3.0.4 @@ -125,7 +125,7 @@ __metadata: "@nomicfoundation/hardhat-ignition-ethers": ^0.15.0 "@nomicfoundation/hardhat-network-helpers": ^1.0.0 "@nomicfoundation/hardhat-toolbox": latest - "@nomicfoundation/hardhat-verify": latest + "@nomicfoundation/hardhat-verify": ^2.0.0 "@nomiclabs/hardhat-waffle": ^2.0.6 "@openzeppelin/contracts": 4.9.6 "@openzeppelin/contracts-upgradeable": 4.9.6 @@ -164,7 +164,7 @@ __metadata: prettier-plugin-solidity: ^1.0.0-dev.23 solhint: ^3.3.7 solidity-coverage: ^0.8.5 - tranche: "https://github.com/buttonwood-protocol/tranche.git#main" + tranche: "https://github.com/buttonwood-protocol/tranche/archive/main.tar.gz" ts-node: ^10.9.1 typechain: ^8.1.0 typescript: ^4.7.4 @@ -251,420 +251,442 @@ __metadata: linkType: hard "@aws-sdk/client-lambda@npm:^3.563.0": - version: 3.804.0 - resolution: "@aws-sdk/client-lambda@npm:3.804.0" + version: 3.980.0 + resolution: "@aws-sdk/client-lambda@npm:3.980.0" dependencies: "@aws-crypto/sha256-browser": 5.2.0 "@aws-crypto/sha256-js": 5.2.0 - "@aws-sdk/core": 3.804.0 - "@aws-sdk/credential-provider-node": 3.804.0 - "@aws-sdk/middleware-host-header": 3.804.0 - "@aws-sdk/middleware-logger": 3.804.0 - "@aws-sdk/middleware-recursion-detection": 3.804.0 - "@aws-sdk/middleware-user-agent": 3.804.0 - "@aws-sdk/region-config-resolver": 3.804.0 - "@aws-sdk/types": 3.804.0 - "@aws-sdk/util-endpoints": 3.804.0 - "@aws-sdk/util-user-agent-browser": 3.804.0 - "@aws-sdk/util-user-agent-node": 3.804.0 - "@smithy/config-resolver": ^4.1.0 - "@smithy/core": ^3.3.1 - "@smithy/eventstream-serde-browser": ^4.0.2 - "@smithy/eventstream-serde-config-resolver": ^4.1.0 - "@smithy/eventstream-serde-node": ^4.0.2 - "@smithy/fetch-http-handler": ^5.0.2 - "@smithy/hash-node": ^4.0.2 - "@smithy/invalid-dependency": ^4.0.2 - "@smithy/middleware-content-length": ^4.0.2 - "@smithy/middleware-endpoint": ^4.1.2 - "@smithy/middleware-retry": ^4.1.3 - "@smithy/middleware-serde": ^4.0.3 - "@smithy/middleware-stack": ^4.0.2 - "@smithy/node-config-provider": ^4.0.2 - "@smithy/node-http-handler": ^4.0.4 - "@smithy/protocol-http": ^5.1.0 - "@smithy/smithy-client": ^4.2.2 - "@smithy/types": ^4.2.0 - "@smithy/url-parser": ^4.0.2 - "@smithy/util-base64": ^4.0.0 - "@smithy/util-body-length-browser": ^4.0.0 - "@smithy/util-body-length-node": ^4.0.0 - "@smithy/util-defaults-mode-browser": ^4.0.10 - "@smithy/util-defaults-mode-node": ^4.0.10 - "@smithy/util-endpoints": ^3.0.2 - "@smithy/util-middleware": ^4.0.2 - "@smithy/util-retry": ^4.0.3 - "@smithy/util-stream": ^4.2.0 - "@smithy/util-utf8": ^4.0.0 - "@smithy/util-waiter": ^4.0.3 + "@aws-sdk/core": ^3.973.5 + "@aws-sdk/credential-provider-node": ^3.972.4 + "@aws-sdk/middleware-host-header": ^3.972.3 + "@aws-sdk/middleware-logger": ^3.972.3 + "@aws-sdk/middleware-recursion-detection": ^3.972.3 + "@aws-sdk/middleware-user-agent": ^3.972.5 + "@aws-sdk/region-config-resolver": ^3.972.3 + "@aws-sdk/types": ^3.973.1 + "@aws-sdk/util-endpoints": 3.980.0 + "@aws-sdk/util-user-agent-browser": ^3.972.3 + "@aws-sdk/util-user-agent-node": ^3.972.3 + "@smithy/config-resolver": ^4.4.6 + "@smithy/core": ^3.22.0 + "@smithy/eventstream-serde-browser": ^4.2.8 + "@smithy/eventstream-serde-config-resolver": ^4.3.8 + "@smithy/eventstream-serde-node": ^4.2.8 + "@smithy/fetch-http-handler": ^5.3.9 + "@smithy/hash-node": ^4.2.8 + "@smithy/invalid-dependency": ^4.2.8 + "@smithy/middleware-content-length": ^4.2.8 + "@smithy/middleware-endpoint": ^4.4.12 + "@smithy/middleware-retry": ^4.4.29 + "@smithy/middleware-serde": ^4.2.9 + "@smithy/middleware-stack": ^4.2.8 + "@smithy/node-config-provider": ^4.3.8 + "@smithy/node-http-handler": ^4.4.8 + "@smithy/protocol-http": ^5.3.8 + "@smithy/smithy-client": ^4.11.1 + "@smithy/types": ^4.12.0 + "@smithy/url-parser": ^4.2.8 + "@smithy/util-base64": ^4.3.0 + "@smithy/util-body-length-browser": ^4.2.0 + "@smithy/util-body-length-node": ^4.2.1 + "@smithy/util-defaults-mode-browser": ^4.3.28 + "@smithy/util-defaults-mode-node": ^4.2.31 + "@smithy/util-endpoints": ^3.2.8 + "@smithy/util-middleware": ^4.2.8 + "@smithy/util-retry": ^4.2.8 + "@smithy/util-stream": ^4.5.10 + "@smithy/util-utf8": ^4.2.0 + "@smithy/util-waiter": ^4.2.8 tslib: ^2.6.2 - checksum: 6b3ed01415d82cc77327d978cb8ed5ca814a949ab7fd6430c20fff4783b6129a6fb5d3cd6e88084faaacb336ae482c31995a08874e6d631de145424c0b7130dc + checksum: cb378246665cff0e04cee2076f138b1254a0671996ba2b4e3266d9320897fc0957b42738b0e3b4c9f8de63d1ae9575433d2da1b034848bbb83ffdf8883605027 languageName: node linkType: hard -"@aws-sdk/client-sso@npm:3.804.0": - version: 3.804.0 - resolution: "@aws-sdk/client-sso@npm:3.804.0" +"@aws-sdk/client-sso@npm:3.980.0": + version: 3.980.0 + resolution: "@aws-sdk/client-sso@npm:3.980.0" dependencies: "@aws-crypto/sha256-browser": 5.2.0 "@aws-crypto/sha256-js": 5.2.0 - "@aws-sdk/core": 3.804.0 - "@aws-sdk/middleware-host-header": 3.804.0 - "@aws-sdk/middleware-logger": 3.804.0 - "@aws-sdk/middleware-recursion-detection": 3.804.0 - "@aws-sdk/middleware-user-agent": 3.804.0 - "@aws-sdk/region-config-resolver": 3.804.0 - "@aws-sdk/types": 3.804.0 - "@aws-sdk/util-endpoints": 3.804.0 - "@aws-sdk/util-user-agent-browser": 3.804.0 - "@aws-sdk/util-user-agent-node": 3.804.0 - "@smithy/config-resolver": ^4.1.0 - "@smithy/core": ^3.3.1 - "@smithy/fetch-http-handler": ^5.0.2 - "@smithy/hash-node": ^4.0.2 - "@smithy/invalid-dependency": ^4.0.2 - "@smithy/middleware-content-length": ^4.0.2 - "@smithy/middleware-endpoint": ^4.1.2 - "@smithy/middleware-retry": ^4.1.3 - "@smithy/middleware-serde": ^4.0.3 - "@smithy/middleware-stack": ^4.0.2 - "@smithy/node-config-provider": ^4.0.2 - "@smithy/node-http-handler": ^4.0.4 - "@smithy/protocol-http": ^5.1.0 - "@smithy/smithy-client": ^4.2.2 - "@smithy/types": ^4.2.0 - "@smithy/url-parser": ^4.0.2 - "@smithy/util-base64": ^4.0.0 - "@smithy/util-body-length-browser": ^4.0.0 - "@smithy/util-body-length-node": ^4.0.0 - "@smithy/util-defaults-mode-browser": ^4.0.10 - "@smithy/util-defaults-mode-node": ^4.0.10 - "@smithy/util-endpoints": ^3.0.2 - "@smithy/util-middleware": ^4.0.2 - "@smithy/util-retry": ^4.0.3 - "@smithy/util-utf8": ^4.0.0 + "@aws-sdk/core": ^3.973.5 + "@aws-sdk/middleware-host-header": ^3.972.3 + "@aws-sdk/middleware-logger": ^3.972.3 + "@aws-sdk/middleware-recursion-detection": ^3.972.3 + "@aws-sdk/middleware-user-agent": ^3.972.5 + "@aws-sdk/region-config-resolver": ^3.972.3 + "@aws-sdk/types": ^3.973.1 + "@aws-sdk/util-endpoints": 3.980.0 + "@aws-sdk/util-user-agent-browser": ^3.972.3 + "@aws-sdk/util-user-agent-node": ^3.972.3 + "@smithy/config-resolver": ^4.4.6 + "@smithy/core": ^3.22.0 + "@smithy/fetch-http-handler": ^5.3.9 + "@smithy/hash-node": ^4.2.8 + "@smithy/invalid-dependency": ^4.2.8 + "@smithy/middleware-content-length": ^4.2.8 + "@smithy/middleware-endpoint": ^4.4.12 + "@smithy/middleware-retry": ^4.4.29 + "@smithy/middleware-serde": ^4.2.9 + "@smithy/middleware-stack": ^4.2.8 + "@smithy/node-config-provider": ^4.3.8 + "@smithy/node-http-handler": ^4.4.8 + "@smithy/protocol-http": ^5.3.8 + "@smithy/smithy-client": ^4.11.1 + "@smithy/types": ^4.12.0 + "@smithy/url-parser": ^4.2.8 + "@smithy/util-base64": ^4.3.0 + "@smithy/util-body-length-browser": ^4.2.0 + "@smithy/util-body-length-node": ^4.2.1 + "@smithy/util-defaults-mode-browser": ^4.3.28 + "@smithy/util-defaults-mode-node": ^4.2.31 + "@smithy/util-endpoints": ^3.2.8 + "@smithy/util-middleware": ^4.2.8 + "@smithy/util-retry": ^4.2.8 + "@smithy/util-utf8": ^4.2.0 tslib: ^2.6.2 - checksum: ddd097f5a4cb1617aa07f33c70878659d7b7e794a3c19a9a75b4da631a3306bf72d9585d8092040ab097e4a973c05a2bfab8ec4bebe1806e50548710b88e4ae3 + checksum: 10e0e06a53f4bd272b9e0d5f998ec799fef95f8ffdd0b38d61599a197f1f543753d4f185531007e0e1fb0b101c7879cebb1a02a1ba8211970cfed2179070ccad + languageName: node + linkType: hard + +"@aws-sdk/core@npm:^3.973.5": + version: 3.973.5 + resolution: "@aws-sdk/core@npm:3.973.5" + dependencies: + "@aws-sdk/types": ^3.973.1 + "@aws-sdk/xml-builder": ^3.972.2 + "@smithy/core": ^3.22.0 + "@smithy/node-config-provider": ^4.3.8 + "@smithy/property-provider": ^4.2.8 + "@smithy/protocol-http": ^5.3.8 + "@smithy/signature-v4": ^5.3.8 + "@smithy/smithy-client": ^4.11.1 + "@smithy/types": ^4.12.0 + "@smithy/util-base64": ^4.3.0 + "@smithy/util-middleware": ^4.2.8 + "@smithy/util-utf8": ^4.2.0 + tslib: ^2.6.2 + checksum: df5bc5935f7031a366bb335070a92ed9355a7f6de3dd46e0a9ee9623b42456e2661969f0aa22cd047c932aa7f786e1f0c17f7e8f75510b460a0f33b32158765c languageName: node linkType: hard -"@aws-sdk/core@npm:3.804.0": - version: 3.804.0 - resolution: "@aws-sdk/core@npm:3.804.0" +"@aws-sdk/credential-provider-env@npm:^3.972.3": + version: 3.972.3 + resolution: "@aws-sdk/credential-provider-env@npm:3.972.3" dependencies: - "@aws-sdk/types": 3.804.0 - "@smithy/core": ^3.3.1 - "@smithy/node-config-provider": ^4.0.2 - "@smithy/property-provider": ^4.0.2 - "@smithy/protocol-http": ^5.1.0 - "@smithy/signature-v4": ^5.1.0 - "@smithy/smithy-client": ^4.2.2 - "@smithy/types": ^4.2.0 - "@smithy/util-middleware": ^4.0.2 - fast-xml-parser: 4.4.1 + "@aws-sdk/core": ^3.973.5 + "@aws-sdk/types": ^3.973.1 + "@smithy/property-provider": ^4.2.8 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: 338efb8f2c7f2798f78450be8401334339f9662e9b9f654099123903a06ef7f45d2edd8b99ad4895e33969ad1d2e33153033950f9360795231a2cb4021c65065 + checksum: 167cb5eb441d1b7065e98fcd2972279fab9cb940d417761e4179b6530345aa760a68c42173f0126e0463d1b37f7c7e0c8a879bb55d62fda54b8d245fed0976a6 languageName: node linkType: hard -"@aws-sdk/credential-provider-env@npm:3.804.0": - version: 3.804.0 - resolution: "@aws-sdk/credential-provider-env@npm:3.804.0" +"@aws-sdk/credential-provider-http@npm:^3.972.5": + version: 3.972.5 + resolution: "@aws-sdk/credential-provider-http@npm:3.972.5" dependencies: - "@aws-sdk/core": 3.804.0 - "@aws-sdk/types": 3.804.0 - "@smithy/property-provider": ^4.0.2 - "@smithy/types": ^4.2.0 + "@aws-sdk/core": ^3.973.5 + "@aws-sdk/types": ^3.973.1 + "@smithy/fetch-http-handler": ^5.3.9 + "@smithy/node-http-handler": ^4.4.8 + "@smithy/property-provider": ^4.2.8 + "@smithy/protocol-http": ^5.3.8 + "@smithy/smithy-client": ^4.11.1 + "@smithy/types": ^4.12.0 + "@smithy/util-stream": ^4.5.10 + tslib: ^2.6.2 + checksum: e39658b640e8ea2218d6af840d101f61b2acb73b97376498b821f37ec06f9f09973590a01e596fbc03e3cc77e41b3059dc7d269506160e56aca466d56638fd76 + languageName: node + linkType: hard + +"@aws-sdk/credential-provider-ini@npm:^3.972.3": + version: 3.972.3 + resolution: "@aws-sdk/credential-provider-ini@npm:3.972.3" + dependencies: + "@aws-sdk/core": ^3.973.5 + "@aws-sdk/credential-provider-env": ^3.972.3 + "@aws-sdk/credential-provider-http": ^3.972.5 + "@aws-sdk/credential-provider-login": ^3.972.3 + "@aws-sdk/credential-provider-process": ^3.972.3 + "@aws-sdk/credential-provider-sso": ^3.972.3 + "@aws-sdk/credential-provider-web-identity": ^3.972.3 + "@aws-sdk/nested-clients": 3.980.0 + "@aws-sdk/types": ^3.973.1 + "@smithy/credential-provider-imds": ^4.2.8 + "@smithy/property-provider": ^4.2.8 + "@smithy/shared-ini-file-loader": ^4.4.3 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: 76cae825be7bb350492f682488b13031d4799bd193a60d5dbd31ec2dbaf7bd79fac1d800293b49bec1d151580e9d1ab0245c7429599fd6e6a57385679b62957b + checksum: 15d90417e07c8a0f702e5a8b1cb355810939373a571ca08a42691926e40f137c33f95ca05e4aab6dbad8649c943126a0856581b6cdb373657f9e33113fa07e83 languageName: node linkType: hard -"@aws-sdk/credential-provider-http@npm:3.804.0": - version: 3.804.0 - resolution: "@aws-sdk/credential-provider-http@npm:3.804.0" +"@aws-sdk/credential-provider-login@npm:^3.972.3": + version: 3.972.3 + resolution: "@aws-sdk/credential-provider-login@npm:3.972.3" dependencies: - "@aws-sdk/core": 3.804.0 - "@aws-sdk/types": 3.804.0 - "@smithy/fetch-http-handler": ^5.0.2 - "@smithy/node-http-handler": ^4.0.4 - "@smithy/property-provider": ^4.0.2 - "@smithy/protocol-http": ^5.1.0 - "@smithy/smithy-client": ^4.2.2 - "@smithy/types": ^4.2.0 - "@smithy/util-stream": ^4.2.0 - tslib: ^2.6.2 - checksum: 2084f21c0be8799741cc584856f530e188dedda062656e292ed57035ea6cf2a5926e2e6cdf9f84d9d47c3228a86edfca493af3682a4ca3841c801b1728623dc2 - languageName: node - linkType: hard - -"@aws-sdk/credential-provider-ini@npm:3.804.0": - version: 3.804.0 - resolution: "@aws-sdk/credential-provider-ini@npm:3.804.0" - dependencies: - "@aws-sdk/core": 3.804.0 - "@aws-sdk/credential-provider-env": 3.804.0 - "@aws-sdk/credential-provider-http": 3.804.0 - "@aws-sdk/credential-provider-process": 3.804.0 - "@aws-sdk/credential-provider-sso": 3.804.0 - "@aws-sdk/credential-provider-web-identity": 3.804.0 - "@aws-sdk/nested-clients": 3.804.0 - "@aws-sdk/types": 3.804.0 - "@smithy/credential-provider-imds": ^4.0.2 - "@smithy/property-provider": ^4.0.2 - "@smithy/shared-ini-file-loader": ^4.0.2 - "@smithy/types": ^4.2.0 + "@aws-sdk/core": ^3.973.5 + "@aws-sdk/nested-clients": 3.980.0 + "@aws-sdk/types": ^3.973.1 + "@smithy/property-provider": ^4.2.8 + "@smithy/protocol-http": ^5.3.8 + "@smithy/shared-ini-file-loader": ^4.4.3 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: 3e65387b962bbef19d68584de762e13f1dceddc0507f9d59b15edea35380c49669226446c62d3c041fa48a86dd80f3f6d06c4d01ec07ec4f858e9879be2aa116 + checksum: 1b27c0c68a777a4bde796cb3551ecf9a2e15365f4984b40e20ef26da0359ebf1fb669682899762d1ef21d5e1ffd2e3521d12c8b1f47ce24097bacc93048e15d5 languageName: node linkType: hard -"@aws-sdk/credential-provider-node@npm:3.804.0": - version: 3.804.0 - resolution: "@aws-sdk/credential-provider-node@npm:3.804.0" +"@aws-sdk/credential-provider-node@npm:^3.972.4": + version: 3.972.4 + resolution: "@aws-sdk/credential-provider-node@npm:3.972.4" dependencies: - "@aws-sdk/credential-provider-env": 3.804.0 - "@aws-sdk/credential-provider-http": 3.804.0 - "@aws-sdk/credential-provider-ini": 3.804.0 - "@aws-sdk/credential-provider-process": 3.804.0 - "@aws-sdk/credential-provider-sso": 3.804.0 - "@aws-sdk/credential-provider-web-identity": 3.804.0 - "@aws-sdk/types": 3.804.0 - "@smithy/credential-provider-imds": ^4.0.2 - "@smithy/property-provider": ^4.0.2 - "@smithy/shared-ini-file-loader": ^4.0.2 - "@smithy/types": ^4.2.0 + "@aws-sdk/credential-provider-env": ^3.972.3 + "@aws-sdk/credential-provider-http": ^3.972.5 + "@aws-sdk/credential-provider-ini": ^3.972.3 + "@aws-sdk/credential-provider-process": ^3.972.3 + "@aws-sdk/credential-provider-sso": ^3.972.3 + "@aws-sdk/credential-provider-web-identity": ^3.972.3 + "@aws-sdk/types": ^3.973.1 + "@smithy/credential-provider-imds": ^4.2.8 + "@smithy/property-provider": ^4.2.8 + "@smithy/shared-ini-file-loader": ^4.4.3 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: 89a4013f6e2a22d7577a9e3ff6000392fccccb1dc21c0ac7c39c3024774d33ebddb3a092495976ebcd77fc9ee1bfbc37230b0e92ce34b1df8cb1866732cff1ac + checksum: 353bf5041ace2d628643b69c0ce28157525001435d67c72d6664e6866d9f98b733e4e63c3c1b0ae177acabf0df88d19993aed4ca110b63ea0155dee9cb7cee64 languageName: node linkType: hard -"@aws-sdk/credential-provider-process@npm:3.804.0": - version: 3.804.0 - resolution: "@aws-sdk/credential-provider-process@npm:3.804.0" +"@aws-sdk/credential-provider-process@npm:^3.972.3": + version: 3.972.3 + resolution: "@aws-sdk/credential-provider-process@npm:3.972.3" dependencies: - "@aws-sdk/core": 3.804.0 - "@aws-sdk/types": 3.804.0 - "@smithy/property-provider": ^4.0.2 - "@smithy/shared-ini-file-loader": ^4.0.2 - "@smithy/types": ^4.2.0 + "@aws-sdk/core": ^3.973.5 + "@aws-sdk/types": ^3.973.1 + "@smithy/property-provider": ^4.2.8 + "@smithy/shared-ini-file-loader": ^4.4.3 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: 9f193dfa0244c1be42bfdbb9a4d2f77d8553501085db4f73a92176260795d24f5f8d4cbf4c974634c0ad968910c3dd7ee4eb4bc6ce84cbe516a61d6c78203430 + checksum: e7bc6e098137958ffaaa3b116551d60afb375076126781c77d2d0a2b372da1685c4ec9eff36425566fe7cc78460a823c2bfa881926ba4027e2a50cbbd1d51da0 languageName: node linkType: hard -"@aws-sdk/credential-provider-sso@npm:3.804.0": - version: 3.804.0 - resolution: "@aws-sdk/credential-provider-sso@npm:3.804.0" +"@aws-sdk/credential-provider-sso@npm:^3.972.3": + version: 3.972.3 + resolution: "@aws-sdk/credential-provider-sso@npm:3.972.3" dependencies: - "@aws-sdk/client-sso": 3.804.0 - "@aws-sdk/core": 3.804.0 - "@aws-sdk/token-providers": 3.804.0 - "@aws-sdk/types": 3.804.0 - "@smithy/property-provider": ^4.0.2 - "@smithy/shared-ini-file-loader": ^4.0.2 - "@smithy/types": ^4.2.0 + "@aws-sdk/client-sso": 3.980.0 + "@aws-sdk/core": ^3.973.5 + "@aws-sdk/token-providers": 3.980.0 + "@aws-sdk/types": ^3.973.1 + "@smithy/property-provider": ^4.2.8 + "@smithy/shared-ini-file-loader": ^4.4.3 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: 66d97bbe361829079248ca2dcabc1968889908825827c03ef504b0d4d95e8d58da210b8053ef11c7bc29a463af5d2b391c0dd99d25ac3fcda5e51dfbcf997782 + checksum: 69001eaf5bea77aeb1bacc3c83276e931693778df664a27158861dc545e35b287b1819341e605c8105d3399164dcbd649438d552332664dc3b7f3dd00fc10832 languageName: node linkType: hard -"@aws-sdk/credential-provider-web-identity@npm:3.804.0": - version: 3.804.0 - resolution: "@aws-sdk/credential-provider-web-identity@npm:3.804.0" +"@aws-sdk/credential-provider-web-identity@npm:^3.972.3": + version: 3.972.3 + resolution: "@aws-sdk/credential-provider-web-identity@npm:3.972.3" dependencies: - "@aws-sdk/core": 3.804.0 - "@aws-sdk/nested-clients": 3.804.0 - "@aws-sdk/types": 3.804.0 - "@smithy/property-provider": ^4.0.2 - "@smithy/types": ^4.2.0 + "@aws-sdk/core": ^3.973.5 + "@aws-sdk/nested-clients": 3.980.0 + "@aws-sdk/types": ^3.973.1 + "@smithy/property-provider": ^4.2.8 + "@smithy/shared-ini-file-loader": ^4.4.3 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: e643f9fa13c5a180844ecaf4e0293bb9d78d800d73eec25bdf781c8db991a0c723d37d350368904b1874e34b8a1e1e7997dd0248a6ca249007c50cd0ed6d0148 + checksum: 6ec6c0418e3b9903ce9de53bc87c32febad003ae349159176c0c841a20a8ff8bada495a3ed8818370fce86648a03b54b5bfaf03095e940d03b4797dc982c1997 languageName: node linkType: hard -"@aws-sdk/middleware-host-header@npm:3.804.0": - version: 3.804.0 - resolution: "@aws-sdk/middleware-host-header@npm:3.804.0" +"@aws-sdk/middleware-host-header@npm:^3.972.3": + version: 3.972.3 + resolution: "@aws-sdk/middleware-host-header@npm:3.972.3" dependencies: - "@aws-sdk/types": 3.804.0 - "@smithy/protocol-http": ^5.1.0 - "@smithy/types": ^4.2.0 + "@aws-sdk/types": ^3.973.1 + "@smithy/protocol-http": ^5.3.8 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: 3310bf3c88b2db2d179ec8c7feff5e6429b3f4ef2535ffcfb492fdfce265362f132a502a06a8743b4ff6118083a5da4bd4219d2f3743863da75e594d39a50f6e + checksum: aa484d42301f5609331aa6937ec754e6befd6edae48b0880804e573c7288d6e38bc2786efdc4e0d7f885070a18c232a96e2b7d343c4c80d66515cb95a2bee4e1 languageName: node linkType: hard -"@aws-sdk/middleware-logger@npm:3.804.0": - version: 3.804.0 - resolution: "@aws-sdk/middleware-logger@npm:3.804.0" +"@aws-sdk/middleware-logger@npm:^3.972.3": + version: 3.972.3 + resolution: "@aws-sdk/middleware-logger@npm:3.972.3" dependencies: - "@aws-sdk/types": 3.804.0 - "@smithy/types": ^4.2.0 + "@aws-sdk/types": ^3.973.1 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: 11c62cf5670eeb035f87ea95ce6e8b8205bd407b0a5d8c7a73a5b0e30ccfa6e11d4595d9aba6d61ef628377555447ca25704afdd8e916d6a6ba67b7a7fd0f078 + checksum: 91301bddfbe9694ce3da20f4c38646440567eb65a3623ae27fb4aa5c13d76275db9e062446df516188abb2c81013c03d481a5f9838a00ea495f2e73e2ef57809 languageName: node linkType: hard -"@aws-sdk/middleware-recursion-detection@npm:3.804.0": - version: 3.804.0 - resolution: "@aws-sdk/middleware-recursion-detection@npm:3.804.0" +"@aws-sdk/middleware-recursion-detection@npm:^3.972.3": + version: 3.972.3 + resolution: "@aws-sdk/middleware-recursion-detection@npm:3.972.3" dependencies: - "@aws-sdk/types": 3.804.0 - "@smithy/protocol-http": ^5.1.0 - "@smithy/types": ^4.2.0 + "@aws-sdk/types": ^3.973.1 + "@aws/lambda-invoke-store": ^0.2.2 + "@smithy/protocol-http": ^5.3.8 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: e762ca615372584ec4fea95b50f4476457edd36c8b433238df8c6c7143ae91da17fe1d3209eca425e89e799a73879e76510121d9235975c46d644e37a17e5350 + checksum: e1eeeec04e25186776c191991f12e7b51e081030f162121b8cac623cb7efe3bdca20c8b22b6ff400b4ad14fe8d79c9e0a85984db03c50b87bc0bf1557b63cfba languageName: node linkType: hard -"@aws-sdk/middleware-user-agent@npm:3.804.0": - version: 3.804.0 - resolution: "@aws-sdk/middleware-user-agent@npm:3.804.0" +"@aws-sdk/middleware-user-agent@npm:^3.972.5": + version: 3.972.5 + resolution: "@aws-sdk/middleware-user-agent@npm:3.972.5" dependencies: - "@aws-sdk/core": 3.804.0 - "@aws-sdk/types": 3.804.0 - "@aws-sdk/util-endpoints": 3.804.0 - "@smithy/core": ^3.3.1 - "@smithy/protocol-http": ^5.1.0 - "@smithy/types": ^4.2.0 + "@aws-sdk/core": ^3.973.5 + "@aws-sdk/types": ^3.973.1 + "@aws-sdk/util-endpoints": 3.980.0 + "@smithy/core": ^3.22.0 + "@smithy/protocol-http": ^5.3.8 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: 3b51dd159b51a640203c8ca7055be6cf3290b60a1490b6b9970bfa975ca7033e0d13b307dbc2630663b027ae1bb088deb5ad6f3a64e8d1e6324980b781c2781b + checksum: 256b3a6ec9d4db4c1d0461d2110788da6e0dfcc40f32a5da6d8e4da78a7a5b39ffbd5458c7d8c7af6107bd8f7107686ec62ba719f52a3f9e913e81061156050d languageName: node linkType: hard -"@aws-sdk/nested-clients@npm:3.804.0": - version: 3.804.0 - resolution: "@aws-sdk/nested-clients@npm:3.804.0" +"@aws-sdk/nested-clients@npm:3.980.0": + version: 3.980.0 + resolution: "@aws-sdk/nested-clients@npm:3.980.0" dependencies: "@aws-crypto/sha256-browser": 5.2.0 "@aws-crypto/sha256-js": 5.2.0 - "@aws-sdk/core": 3.804.0 - "@aws-sdk/middleware-host-header": 3.804.0 - "@aws-sdk/middleware-logger": 3.804.0 - "@aws-sdk/middleware-recursion-detection": 3.804.0 - "@aws-sdk/middleware-user-agent": 3.804.0 - "@aws-sdk/region-config-resolver": 3.804.0 - "@aws-sdk/types": 3.804.0 - "@aws-sdk/util-endpoints": 3.804.0 - "@aws-sdk/util-user-agent-browser": 3.804.0 - "@aws-sdk/util-user-agent-node": 3.804.0 - "@smithy/config-resolver": ^4.1.0 - "@smithy/core": ^3.3.1 - "@smithy/fetch-http-handler": ^5.0.2 - "@smithy/hash-node": ^4.0.2 - "@smithy/invalid-dependency": ^4.0.2 - "@smithy/middleware-content-length": ^4.0.2 - "@smithy/middleware-endpoint": ^4.1.2 - "@smithy/middleware-retry": ^4.1.3 - "@smithy/middleware-serde": ^4.0.3 - "@smithy/middleware-stack": ^4.0.2 - "@smithy/node-config-provider": ^4.0.2 - "@smithy/node-http-handler": ^4.0.4 - "@smithy/protocol-http": ^5.1.0 - "@smithy/smithy-client": ^4.2.2 - "@smithy/types": ^4.2.0 - "@smithy/url-parser": ^4.0.2 - "@smithy/util-base64": ^4.0.0 - "@smithy/util-body-length-browser": ^4.0.0 - "@smithy/util-body-length-node": ^4.0.0 - "@smithy/util-defaults-mode-browser": ^4.0.10 - "@smithy/util-defaults-mode-node": ^4.0.10 - "@smithy/util-endpoints": ^3.0.2 - "@smithy/util-middleware": ^4.0.2 - "@smithy/util-retry": ^4.0.3 - "@smithy/util-utf8": ^4.0.0 + "@aws-sdk/core": ^3.973.5 + "@aws-sdk/middleware-host-header": ^3.972.3 + "@aws-sdk/middleware-logger": ^3.972.3 + "@aws-sdk/middleware-recursion-detection": ^3.972.3 + "@aws-sdk/middleware-user-agent": ^3.972.5 + "@aws-sdk/region-config-resolver": ^3.972.3 + "@aws-sdk/types": ^3.973.1 + "@aws-sdk/util-endpoints": 3.980.0 + "@aws-sdk/util-user-agent-browser": ^3.972.3 + "@aws-sdk/util-user-agent-node": ^3.972.3 + "@smithy/config-resolver": ^4.4.6 + "@smithy/core": ^3.22.0 + "@smithy/fetch-http-handler": ^5.3.9 + "@smithy/hash-node": ^4.2.8 + "@smithy/invalid-dependency": ^4.2.8 + "@smithy/middleware-content-length": ^4.2.8 + "@smithy/middleware-endpoint": ^4.4.12 + "@smithy/middleware-retry": ^4.4.29 + "@smithy/middleware-serde": ^4.2.9 + "@smithy/middleware-stack": ^4.2.8 + "@smithy/node-config-provider": ^4.3.8 + "@smithy/node-http-handler": ^4.4.8 + "@smithy/protocol-http": ^5.3.8 + "@smithy/smithy-client": ^4.11.1 + "@smithy/types": ^4.12.0 + "@smithy/url-parser": ^4.2.8 + "@smithy/util-base64": ^4.3.0 + "@smithy/util-body-length-browser": ^4.2.0 + "@smithy/util-body-length-node": ^4.2.1 + "@smithy/util-defaults-mode-browser": ^4.3.28 + "@smithy/util-defaults-mode-node": ^4.2.31 + "@smithy/util-endpoints": ^3.2.8 + "@smithy/util-middleware": ^4.2.8 + "@smithy/util-retry": ^4.2.8 + "@smithy/util-utf8": ^4.2.0 tslib: ^2.6.2 - checksum: 1dbc0c7e4764a845a81af012cb39a3e2eae1dd6eb08eb8d33a765401b114db6a91ff84259e0cf68b6408b32d644d616bf76f8b4d9432d04ac256f58b4cdba9ee + checksum: ce9b07c29ade9b1691d30bfda687bf2347528b252bc651f4b154756a2276b73fd5ca790ca6d21d0e59d51cbaa5bad95929ffe64ad1b4a88002555b4624212935 languageName: node linkType: hard -"@aws-sdk/region-config-resolver@npm:3.804.0": - version: 3.804.0 - resolution: "@aws-sdk/region-config-resolver@npm:3.804.0" +"@aws-sdk/region-config-resolver@npm:^3.972.3": + version: 3.972.3 + resolution: "@aws-sdk/region-config-resolver@npm:3.972.3" dependencies: - "@aws-sdk/types": 3.804.0 - "@smithy/node-config-provider": ^4.0.2 - "@smithy/types": ^4.2.0 - "@smithy/util-config-provider": ^4.0.0 - "@smithy/util-middleware": ^4.0.2 + "@aws-sdk/types": ^3.973.1 + "@smithy/config-resolver": ^4.4.6 + "@smithy/node-config-provider": ^4.3.8 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: 9af63a819979d581630b11232a81e345c3cdbd9aa006642ce9a68b9e8a288674cdc3c873aead78406be93fca5cc5a2448ad6add0d4f7ffc14c0fda618f83140f + checksum: d85c72b274734d128040f90b994be3ae444095c225e69f8b7694300e07d301585682c3247b7ac88ad6ad883099d65c9bb1c4a2a0f1584baeb580d452b5071f2f languageName: node linkType: hard -"@aws-sdk/token-providers@npm:3.804.0": - version: 3.804.0 - resolution: "@aws-sdk/token-providers@npm:3.804.0" +"@aws-sdk/token-providers@npm:3.980.0": + version: 3.980.0 + resolution: "@aws-sdk/token-providers@npm:3.980.0" dependencies: - "@aws-sdk/nested-clients": 3.804.0 - "@aws-sdk/types": 3.804.0 - "@smithy/property-provider": ^4.0.2 - "@smithy/shared-ini-file-loader": ^4.0.2 - "@smithy/types": ^4.2.0 + "@aws-sdk/core": ^3.973.5 + "@aws-sdk/nested-clients": 3.980.0 + "@aws-sdk/types": ^3.973.1 + "@smithy/property-provider": ^4.2.8 + "@smithy/shared-ini-file-loader": ^4.4.3 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: 912830754585df1c759979a7769730798cb769474c5746f02a134a0c44cbe138ad2b88d1982fcf46295f071cd950312414bf7d987cd4e3a6879fa27248be4a8b + checksum: 330fb937727356d50ba19f8b1623bf112970b9a48cbe129cd33e7c902f6bef0576c364fa6500b63f50523ff8dc97b825992e98984f397b11c8f961bc2c61c064 languageName: node linkType: hard -"@aws-sdk/types@npm:3.804.0, @aws-sdk/types@npm:^3.1.0, @aws-sdk/types@npm:^3.222.0": - version: 3.804.0 - resolution: "@aws-sdk/types@npm:3.804.0" +"@aws-sdk/types@npm:^3.1.0, @aws-sdk/types@npm:^3.222.0, @aws-sdk/types@npm:^3.973.1": + version: 3.973.1 + resolution: "@aws-sdk/types@npm:3.973.1" dependencies: - "@smithy/types": ^4.2.0 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: 6e15b214b96e3f1a158ad5144093cd6cbc765984b8ddc00492e2274218b00d43921aaf1340c8a75dd1878c981528257663c053c28d7a47146620122af4f45cca + checksum: e42827172e695f2df9e5c3275edd81f18a3d36d703df2378cadb55c4951ac7403b3b3768fd9cb8a72d359b18d58cc7bbd2950c1f2bc672eacd3b8e1e2fe75424 languageName: node linkType: hard -"@aws-sdk/util-endpoints@npm:3.804.0": - version: 3.804.0 - resolution: "@aws-sdk/util-endpoints@npm:3.804.0" +"@aws-sdk/util-endpoints@npm:3.980.0": + version: 3.980.0 + resolution: "@aws-sdk/util-endpoints@npm:3.980.0" dependencies: - "@aws-sdk/types": 3.804.0 - "@smithy/types": ^4.2.0 - "@smithy/util-endpoints": ^3.0.2 + "@aws-sdk/types": ^3.973.1 + "@smithy/types": ^4.12.0 + "@smithy/url-parser": ^4.2.8 + "@smithy/util-endpoints": ^3.2.8 tslib: ^2.6.2 - checksum: 4bdce464c42183663eb4d6d6cd55c8186475aaaad302e3c9e61210c2bd4f67e05db0fecf2b2c150bfa291e345598b41d8491b429fd4bef2dac47563d1adc7d47 + checksum: 7531bdcb9d9d4094fb8fa15b83e89d5e393460dd107ac4b17ee22d62abf36d044634232ed894b5a054a850c58d7ede9e62060c74f843ad4b838978df5d2c05c6 languageName: node linkType: hard "@aws-sdk/util-locate-window@npm:^3.0.0": - version: 3.804.0 - resolution: "@aws-sdk/util-locate-window@npm:3.804.0" + version: 3.965.4 + resolution: "@aws-sdk/util-locate-window@npm:3.965.4" dependencies: tslib: ^2.6.2 - checksum: 87b384533ba5ceade6e212f5783b6134551ade3ecb413c93ea453c2d5af76651137c4dc7b270b643e8ac810b072119a273790046c31921aaf0f6a664d1a31c99 + checksum: ec8d3653f6aa2f3743d9a14dc2f19c7221d08a8b34d929d4259c5477f5d1d8c2bd0785927b2e6ad909459cc7cf0127e68093440a928aade9b5063fc213daf507 languageName: node linkType: hard -"@aws-sdk/util-user-agent-browser@npm:3.804.0": - version: 3.804.0 - resolution: "@aws-sdk/util-user-agent-browser@npm:3.804.0" +"@aws-sdk/util-user-agent-browser@npm:^3.972.3": + version: 3.972.3 + resolution: "@aws-sdk/util-user-agent-browser@npm:3.972.3" dependencies: - "@aws-sdk/types": 3.804.0 - "@smithy/types": ^4.2.0 + "@aws-sdk/types": ^3.973.1 + "@smithy/types": ^4.12.0 bowser: ^2.11.0 tslib: ^2.6.2 - checksum: 6216ac4936631696c596a57a762683575b173efca7af5a8bb805402c6527e8caa0b5f75b3da3f73e354581f04dd19a5e5d09bca7c2f55c7c2b8fba61086f4e86 + checksum: d18ff7696136b2eadb4b3f24fcf51a7f816135d62275580b21b04ab1840c84c7826301552fc8f0f8c74d8aa21c4d2a47f07a0d43bd9d99a04d0feec4949165e5 languageName: node linkType: hard -"@aws-sdk/util-user-agent-node@npm:3.804.0": - version: 3.804.0 - resolution: "@aws-sdk/util-user-agent-node@npm:3.804.0" +"@aws-sdk/util-user-agent-node@npm:^3.972.3": + version: 3.972.3 + resolution: "@aws-sdk/util-user-agent-node@npm:3.972.3" dependencies: - "@aws-sdk/middleware-user-agent": 3.804.0 - "@aws-sdk/types": 3.804.0 - "@smithy/node-config-provider": ^4.0.2 - "@smithy/types": ^4.2.0 + "@aws-sdk/middleware-user-agent": ^3.972.5 + "@aws-sdk/types": ^3.973.1 + "@smithy/node-config-provider": ^4.3.8 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 peerDependencies: aws-crt: ">=1.0.0" peerDependenciesMeta: aws-crt: optional: true - checksum: 335d78b11bbda03e82e47de7e014ef2dfa0194ae24aa8f9b188e9295fbc3da23f8b703de9a95ad085aaec72527d9b83a01f288b6c13fdd020dcae19822bb394e + checksum: 6181580ecc10469b0c43161cb8424f4dab0d9b7cbbe2a38b2d18064c29845d10afa4cb35f37b5ffc4a9e40743441c3ec45a4698275cb23518f87d7f8bc120423 languageName: node linkType: hard @@ -677,21 +699,39 @@ __metadata: languageName: node linkType: hard +"@aws-sdk/xml-builder@npm:^3.972.2": + version: 3.972.2 + resolution: "@aws-sdk/xml-builder@npm:3.972.2" + dependencies: + "@smithy/types": ^4.12.0 + fast-xml-parser: 5.2.5 + tslib: ^2.6.2 + checksum: 43e4b6736412b8f8b7c747684ad6097de7228a31cd9f0dbbdd599df33f6ab46a354129e683d7fa9b704a329748ec94654a84991a2d795dc6e05f9c6f8ed15e67 + languageName: node + linkType: hard + +"@aws/lambda-invoke-store@npm:^0.2.2": + version: 0.2.3 + resolution: "@aws/lambda-invoke-store@npm:0.2.3" + checksum: 8fd9e329a95386ebfdc232b2c59d1a1c76b22db5cf58c5da0f133bea5345e096c2200279d33b0b4ad5182db46f9df214a0ce651b80239e7c47109343ffd67321 + languageName: node + linkType: hard + "@babel/code-frame@npm:^7.0.0": - version: 7.27.1 - resolution: "@babel/code-frame@npm:7.27.1" + version: 7.29.0 + resolution: "@babel/code-frame@npm:7.29.0" dependencies: - "@babel/helper-validator-identifier": ^7.27.1 + "@babel/helper-validator-identifier": ^7.28.5 js-tokens: ^4.0.0 picocolors: ^1.1.1 - checksum: 5874edc5d37406c4a0bb14cf79c8e51ad412fb0423d176775ac14fc0259831be1bf95bdda9c2aa651126990505e09a9f0ed85deaa99893bc316d2682c5115bdc + checksum: 39f5b303757e4d63bbff8133e251094cd4f952b46e3fa9febc7368d907583911d6a1eded6090876dc1feeff5cf6e134fb19b706f8d58d26c5402cd50e5e1aeb2 languageName: node linkType: hard -"@babel/helper-validator-identifier@npm:^7.27.1": - version: 7.27.1 - resolution: "@babel/helper-validator-identifier@npm:7.27.1" - checksum: 3c7e8391e59d6c85baeefe9afb86432f2ab821c6232b00ea9082a51d3e7e95a2f3fb083d74dc1f49ac82cf238e1d2295dafcb001f7b0fab479f3f56af5eaaa47 +"@babel/helper-validator-identifier@npm:^7.28.5": + version: 7.28.5 + resolution: "@babel/helper-validator-identifier@npm:7.28.5" + checksum: 5a251a6848e9712aea0338f659a1a3bd334d26219d5511164544ca8ec20774f098c3a6661e9da65a0d085c745c00bb62c8fada38a62f08fa1f8053bc0aeb57e4 languageName: node linkType: hard @@ -719,20 +759,20 @@ __metadata: linkType: hard "@eslint-community/eslint-utils@npm:^4.2.0": - version: 4.7.0 - resolution: "@eslint-community/eslint-utils@npm:4.7.0" + version: 4.9.1 + resolution: "@eslint-community/eslint-utils@npm:4.9.1" dependencies: eslint-visitor-keys: ^3.4.3 peerDependencies: eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 - checksum: b177e3b75c0b8d0e5d71f1c532edb7e40b31313db61f0c879f9bf19c3abb2783c6c372b5deb2396dab4432f2946b9972122ac682e77010376c029dfd0149c681 + checksum: 0a27c2d676c4be6b329ebb5dd8f6c5ef5fae9a019ff575655306d72874bb26f3ab20e0b241a5f086464bb1f2511ca26a29ff6f80c1e2b0b02eca4686b4dfe1b5 languageName: node linkType: hard "@eslint-community/regexpp@npm:^4.4.0, @eslint-community/regexpp@npm:^4.6.1": - version: 4.12.1 - resolution: "@eslint-community/regexpp@npm:4.12.1" - checksum: 0d628680e204bc316d545b4993d3658427ca404ae646ce541fcc65306b8c712c340e5e573e30fb9f85f4855c0c5f6dca9868931f2fcced06417fbe1a0c6cd2d6 + version: 4.12.2 + resolution: "@eslint-community/regexpp@npm:4.12.2" + checksum: 1770bc81f676a72f65c7200b5675ff7a349786521f30e66125faaf767fde1ba1c19c3790e16ba8508a62a3933afcfc806a893858b3b5906faf693d862b9e4120 languageName: node linkType: hard @@ -1544,6 +1584,22 @@ __metadata: languageName: node linkType: hard +"@isaacs/balanced-match@npm:^4.0.1": + version: 4.0.1 + resolution: "@isaacs/balanced-match@npm:4.0.1" + checksum: 102fbc6d2c0d5edf8f6dbf2b3feb21695a21bc850f11bc47c4f06aa83bd8884fde3fe9d6d797d619901d96865fdcb4569ac2a54c937992c48885c5e3d9967fe8 + languageName: node + linkType: hard + +"@isaacs/brace-expansion@npm:^5.0.0": + version: 5.0.0 + resolution: "@isaacs/brace-expansion@npm:5.0.0" + dependencies: + "@isaacs/balanced-match": ^4.0.1 + checksum: d7a3b8b0ddbf0ccd8eeb1300e29dd0a0c02147e823d8138f248375a365682360620895c66d113e05ee02389318c654379b0e538b996345b83c914941786705b1 + languageName: node + linkType: hard + "@isaacs/cliui@npm:^8.0.2": version: 8.0.2 resolution: "@isaacs/cliui@npm:8.0.2" @@ -1575,9 +1631,9 @@ __metadata: linkType: hard "@jridgewell/sourcemap-codec@npm:^1.4.10": - version: 1.5.0 - resolution: "@jridgewell/sourcemap-codec@npm:1.5.0" - checksum: 05df4f2538b3b0f998ea4c1cd34574d0feba216fa5d4ccaef0187d12abf82eafe6021cec8b49f9bb4d90f2ba4582ccc581e72986a5fcf4176ae0cfeb04cf52ec + version: 1.5.5 + resolution: "@jridgewell/sourcemap-codec@npm:1.5.5" + checksum: c2e36e67971f719a8a3a85ef5a5f580622437cc723c35d03ebd0c9c0b06418700ef006f58af742791f71f6a4fc68fcfaf1f6a74ec2f9a3332860e9373459dae7 languageName: node linkType: hard @@ -1591,6 +1647,13 @@ __metadata: languageName: node linkType: hard +"@noble/ciphers@npm:^1.3.0": + version: 1.3.0 + resolution: "@noble/ciphers@npm:1.3.0" + checksum: 19722c35475df9bc78db60d261d0b5ef8a6d722561efc2135453f943eaa421b492195dc666e3e4df2b755bca3739e04f04b9c660198559f5dd05d3cfbf1b9e92 + languageName: node + linkType: hard + "@noble/curves@npm:1.2.0": version: 1.2.0 resolution: "@noble/curves@npm:1.2.0" @@ -1609,7 +1672,16 @@ __metadata: languageName: node linkType: hard -"@noble/curves@npm:1.8.2, @noble/curves@npm:~1.8.1": +"@noble/curves@npm:1.9.1": + version: 1.9.1 + resolution: "@noble/curves@npm:1.9.1" + dependencies: + "@noble/hashes": 1.8.0 + checksum: 4f3483a1001538d2f55516cdcb19319d1eaef79550633f670e7d570b989cdbc0129952868b72bb67643329746b8ffefe8e4cd791c8cc35574e05a37f873eef42 + languageName: node + linkType: hard + +"@noble/curves@npm:~1.8.1": version: 1.8.2 resolution: "@noble/curves@npm:1.8.2" dependencies: @@ -1618,12 +1690,12 @@ __metadata: languageName: node linkType: hard -"@noble/curves@npm:^1.6.0, @noble/curves@npm:~1.9.0": - version: 1.9.0 - resolution: "@noble/curves@npm:1.9.0" +"@noble/curves@npm:~1.9.0": + version: 1.9.7 + resolution: "@noble/curves@npm:1.9.7" dependencies: "@noble/hashes": 1.8.0 - checksum: dc82f8c095e90ab0d88f4bfcdf3a6f8500444dac3644b02d7b81a268f516573f18fae66aa3030f5e8886d86dff63dd57a5bb639d968d6cdfadae10436680840c + checksum: 65acad44ac6944ab96471109087d6cfcbcaa251faad6295961be9a5ace220634f4b7c74a96d1ee2274ad3880ea953d8e8259893ed8c906c831ef29f5c04ec9cc languageName: node linkType: hard @@ -1655,7 +1727,7 @@ __metadata: languageName: node linkType: hard -"@noble/hashes@npm:1.8.0, @noble/hashes@npm:^1.4.0, @noble/hashes@npm:^1.5.0, @noble/hashes@npm:~1.8.0": +"@noble/hashes@npm:1.8.0, @noble/hashes@npm:^1.4.0, @noble/hashes@npm:^1.8.0, @noble/hashes@npm:~1.8.0": version: 1.8.0 resolution: "@noble/hashes@npm:1.8.0" checksum: c94e98b941963676feaba62475b1ccfa8341e3f572adbb3b684ee38b658df44100187fa0ef4220da580b13f8d27e87d5492623c8a02ecc61f23fb9960c7918f5 @@ -1703,153 +1775,153 @@ __metadata: languageName: node linkType: hard -"@nomicfoundation/edr-darwin-arm64@npm:0.11.0": - version: 0.11.0 - resolution: "@nomicfoundation/edr-darwin-arm64@npm:0.11.0" - checksum: ee4df930bdd9adb3e6ff6485326da101ac52347fe6639b5a0d185df40664c1973ac906a28ee6b3d3d683d91c7dae7c8368425a8daf6bd138d5d799b4d40ff6cb +"@nomicfoundation/edr-darwin-arm64@npm:0.12.0-next.22": + version: 0.12.0-next.22 + resolution: "@nomicfoundation/edr-darwin-arm64@npm:0.12.0-next.22" + checksum: ad90e42cb6963748c5475eaa99e58ccac2a69aa80cf8fce248b9e741fcfdc212687aaafd9a1d5f8769d0d3db2409873c60ff66f8762ff88be0372cfe49e706c8 languageName: node linkType: hard -"@nomicfoundation/edr-darwin-x64@npm:0.11.0": - version: 0.11.0 - resolution: "@nomicfoundation/edr-darwin-x64@npm:0.11.0" - checksum: 0e71ea9cb2fd5ce57a4704b2118254a46528cfe057299490615245ad420fc3381c0f659714b3d5445b9265b140418d62f9a11d40b7a638687732e3e80bf8c8b0 +"@nomicfoundation/edr-darwin-x64@npm:0.12.0-next.22": + version: 0.12.0-next.22 + resolution: "@nomicfoundation/edr-darwin-x64@npm:0.12.0-next.22" + checksum: d770b78c510ef4223e4d4432cc6c79b3fa88cab8814f3fa8744ddcc2849228033230869623b5b472147e61103ec94e0b75f1493db59dc3bd3d66094f9416a40a languageName: node linkType: hard -"@nomicfoundation/edr-linux-arm64-gnu@npm:0.11.0": - version: 0.11.0 - resolution: "@nomicfoundation/edr-linux-arm64-gnu@npm:0.11.0" - checksum: 72168c713b2ef501d05a28cd73c8dd48539b42708b72ea0f5350cfb7d51056b5b6d8a38bce4039928b01aee40b94d5829fba47e2b4c68a7e011c2334a2c81152 +"@nomicfoundation/edr-linux-arm64-gnu@npm:0.12.0-next.22": + version: 0.12.0-next.22 + resolution: "@nomicfoundation/edr-linux-arm64-gnu@npm:0.12.0-next.22" + checksum: b515c26f931d4d6091b55f333f11aafa51126e08c33808014871383756a6ba0ff0035597071e91cc8c4258a66bc7d59ba1ded28464cded6fa067e291f6f39a15 languageName: node linkType: hard -"@nomicfoundation/edr-linux-arm64-musl@npm:0.11.0": - version: 0.11.0 - resolution: "@nomicfoundation/edr-linux-arm64-musl@npm:0.11.0" - checksum: 3030bd1cce2342132ee4fdd2e287611a057bd82fb66d792204f3051d0f68454444f2664c9716a3dce692a7cd4c6053d229edd4b3862194c22212d6c51a9f77e7 +"@nomicfoundation/edr-linux-arm64-musl@npm:0.12.0-next.22": + version: 0.12.0-next.22 + resolution: "@nomicfoundation/edr-linux-arm64-musl@npm:0.12.0-next.22" + checksum: ea275733bf8917a9192bb632d7ca77a8a9e0c21782979f4791b0cf006f8225d2266a155b134d5349eb213345fe75a5f068bf0b5c9288d499828af90ae8de8f30 languageName: node linkType: hard -"@nomicfoundation/edr-linux-x64-gnu@npm:0.11.0": - version: 0.11.0 - resolution: "@nomicfoundation/edr-linux-x64-gnu@npm:0.11.0" - checksum: d4fcc0d81610995d61389f099d640322462d298e111a45b715e6a890722fa85023d29c1d618290a846fb82b9cbfef6f5ccdd71258321031cc21d389fdc3ec945 +"@nomicfoundation/edr-linux-x64-gnu@npm:0.12.0-next.22": + version: 0.12.0-next.22 + resolution: "@nomicfoundation/edr-linux-x64-gnu@npm:0.12.0-next.22" + checksum: 325e212db6ecf4d460b17706290b768a88690ffab4c0c39fdea995837477270fc42f91420bf283d7078012f88e5fd3dd4f83fcd83ffa64f0f302d788c0262f96 languageName: node linkType: hard -"@nomicfoundation/edr-linux-x64-musl@npm:0.11.0": - version: 0.11.0 - resolution: "@nomicfoundation/edr-linux-x64-musl@npm:0.11.0" - checksum: 558e73fb58f7a79fd6fd1867a1d45b54ae963288a110f9bde5c96d62de2d818ba92faea5bb97dc24aa4b81f36ba83e1a341a72179f04cd649210bff85936fe97 +"@nomicfoundation/edr-linux-x64-musl@npm:0.12.0-next.22": + version: 0.12.0-next.22 + resolution: "@nomicfoundation/edr-linux-x64-musl@npm:0.12.0-next.22" + checksum: 8aeea787d45498ec9f3db4f7a9aeb5a1c37cbe20e5872230225c43240e2c5af8fa2d3754852b6b2f6462839be43731459063bd10f084e34a80d11801baaec975 languageName: node linkType: hard -"@nomicfoundation/edr-win32-x64-msvc@npm:0.11.0": - version: 0.11.0 - resolution: "@nomicfoundation/edr-win32-x64-msvc@npm:0.11.0" - checksum: 2f32f8857fe32634b92ed6f30728b316e1da2268a0e7100de2794b35552f75fd8be5e5a610b46aa88fba9903d8b889c82e1a40a9287c967cb22a961bf5f96bba +"@nomicfoundation/edr-win32-x64-msvc@npm:0.12.0-next.22": + version: 0.12.0-next.22 + resolution: "@nomicfoundation/edr-win32-x64-msvc@npm:0.12.0-next.22" + checksum: 26fe2c7ff9d5e4b89aa4a2e8bc61fe01da13b1806cd4aeec9913a3f25688e2ce1d90304df359079c7d0e61908857c78c42f5ecae604075c64cc27f2520ecbe65 languageName: node linkType: hard -"@nomicfoundation/edr@npm:^0.11.0": - version: 0.11.0 - resolution: "@nomicfoundation/edr@npm:0.11.0" +"@nomicfoundation/edr@npm:0.12.0-next.22": + version: 0.12.0-next.22 + resolution: "@nomicfoundation/edr@npm:0.12.0-next.22" dependencies: - "@nomicfoundation/edr-darwin-arm64": 0.11.0 - "@nomicfoundation/edr-darwin-x64": 0.11.0 - "@nomicfoundation/edr-linux-arm64-gnu": 0.11.0 - "@nomicfoundation/edr-linux-arm64-musl": 0.11.0 - "@nomicfoundation/edr-linux-x64-gnu": 0.11.0 - "@nomicfoundation/edr-linux-x64-musl": 0.11.0 - "@nomicfoundation/edr-win32-x64-msvc": 0.11.0 - checksum: ed264aa20ef535b6d82dd135360dfbd0ce3a14aa4f18f0db71bbbd96478360360ab8274d7c93eab2f042abd3252071e9a9a58d868f59a7614b88220d6a884e2a + "@nomicfoundation/edr-darwin-arm64": 0.12.0-next.22 + "@nomicfoundation/edr-darwin-x64": 0.12.0-next.22 + "@nomicfoundation/edr-linux-arm64-gnu": 0.12.0-next.22 + "@nomicfoundation/edr-linux-arm64-musl": 0.12.0-next.22 + "@nomicfoundation/edr-linux-x64-gnu": 0.12.0-next.22 + "@nomicfoundation/edr-linux-x64-musl": 0.12.0-next.22 + "@nomicfoundation/edr-win32-x64-msvc": 0.12.0-next.22 + checksum: cc3e9a68007e63c307ac6fc1bdcef620b93e2c79d121a820d8f1e8e6cb183aa2302add36f7c5560d55bb4f0110bab9822ef7319f6e7f49ef70a6c59d2177829b languageName: node linkType: hard "@nomicfoundation/hardhat-chai-matchers@npm:latest": - version: 2.0.8 - resolution: "@nomicfoundation/hardhat-chai-matchers@npm:2.0.8" + version: 2.1.0 + resolution: "@nomicfoundation/hardhat-chai-matchers@npm:2.1.0" dependencies: "@types/chai-as-promised": ^7.1.3 chai-as-promised: ^7.1.1 deep-eql: ^4.0.1 ordinal: ^1.0.3 peerDependencies: - "@nomicfoundation/hardhat-ethers": ^3.0.0 + "@nomicfoundation/hardhat-ethers": ^3.1.0 chai: ^4.2.0 - ethers: ^6.1.0 - hardhat: ^2.9.4 - checksum: bcf2efcf98e1e889e4566b3ff23099313c67a4c765367f702672890e0d3e6f38ad8de415ee6e9f65d038f6dcd879cc080ca0dda07109acc7d3fc249e8fdb79f5 + ethers: ^6.14.0 + hardhat: ^2.26.0 + checksum: 743d85e7a20826e4cf8055de6d66248ecfb83079b6f264d8383fb5dce17c34a63d74e3c8a007a4b1134ffdd258ff11cdb7c5e56fa07e86a6ddffcfbcd452e9e7 languageName: node linkType: hard "@nomicfoundation/hardhat-ethers@npm:^3.0.0": - version: 3.0.8 - resolution: "@nomicfoundation/hardhat-ethers@npm:3.0.8" + version: 3.1.3 + resolution: "@nomicfoundation/hardhat-ethers@npm:3.1.3" dependencies: debug: ^4.1.1 lodash.isequal: ^4.5.0 peerDependencies: - ethers: ^6.1.0 - hardhat: ^2.0.0 - checksum: 6ad6da6713fa25e653cef894ec10762fc3d728a50461a63c169eac248b5b1ea81bb3d42e8017601bbd231c9fee034336e1f2dc25375d5dcf9926ec4d4389034a + ethers: ^6.14.0 + hardhat: ^2.28.0 + checksum: e42bd298fbd6b747524cd9a84712dae7c094bbc6d0cc93a3cbec8a6907f06ac5c81d46e82e74cbc91fab3effed5ebe2906988eb674064b8f2305a4c2f9b12a7b languageName: node linkType: hard "@nomicfoundation/hardhat-ignition-ethers@npm:^0.15.0": - version: 0.15.11 - resolution: "@nomicfoundation/hardhat-ignition-ethers@npm:0.15.11" + version: 0.15.17 + resolution: "@nomicfoundation/hardhat-ignition-ethers@npm:0.15.17" peerDependencies: - "@nomicfoundation/hardhat-ethers": ^3.0.4 - "@nomicfoundation/hardhat-ignition": ^0.15.11 - "@nomicfoundation/ignition-core": ^0.15.11 - ethers: ^6.7.0 - hardhat: ^2.18.0 - checksum: 0333f26d7b2d0f625e3b7974d720dc63ca2b7fe0de7933ef17792d95b0821b803498ea75e294699fa3cb4c63245716e25ac49dcf74a356e62f921119fe7431be + "@nomicfoundation/hardhat-ethers": ^3.1.0 + "@nomicfoundation/hardhat-ignition": ^0.15.16 + "@nomicfoundation/ignition-core": ^0.15.15 + ethers: ^6.14.0 + hardhat: ^2.26.0 + checksum: 4b10580e67890bf6dac29a1306239e5bfc79144c243568c49204421178c2a071fe66fc2f399f5a23b85d0da45681a13eb72c459cbb39b5c68c6fe2e1e3b50572 languageName: node linkType: hard "@nomicfoundation/hardhat-network-helpers@npm:^1.0.0": - version: 1.0.12 - resolution: "@nomicfoundation/hardhat-network-helpers@npm:1.0.12" + version: 1.1.2 + resolution: "@nomicfoundation/hardhat-network-helpers@npm:1.1.2" dependencies: ethereumjs-util: ^7.1.4 peerDependencies: - hardhat: ^2.9.5 - checksum: 7e1b91789dd4e73464b4eec919b1e67c6d482dd7534f4f7cae73fb5bdddd69f2a47143754b34385b098a1df0f4875cd4d2e1109fc3d847db76f4b0a9a44bd959 + hardhat: ^2.26.0 + checksum: 9b0f3152ebd7ec0b813372f3e837bc249f54e86b76a96bedb78f6142fb1ccc21e3f877a0003542d847a0a8a0aa4243f682bdc1dfbcd964b16e9d2c6f04baec3c languageName: node linkType: hard "@nomicfoundation/hardhat-toolbox@npm:latest": - version: 5.0.0 - resolution: "@nomicfoundation/hardhat-toolbox@npm:5.0.0" + version: 6.1.0 + resolution: "@nomicfoundation/hardhat-toolbox@npm:6.1.0" peerDependencies: - "@nomicfoundation/hardhat-chai-matchers": ^2.0.0 - "@nomicfoundation/hardhat-ethers": ^3.0.0 - "@nomicfoundation/hardhat-ignition-ethers": ^0.15.0 - "@nomicfoundation/hardhat-network-helpers": ^1.0.0 - "@nomicfoundation/hardhat-verify": ^2.0.0 + "@nomicfoundation/hardhat-chai-matchers": ^2.1.0 + "@nomicfoundation/hardhat-ethers": ^3.1.0 + "@nomicfoundation/hardhat-ignition-ethers": ^0.15.14 + "@nomicfoundation/hardhat-network-helpers": ^1.1.0 + "@nomicfoundation/hardhat-verify": ^2.1.0 "@typechain/ethers-v6": ^0.5.0 "@typechain/hardhat": ^9.0.0 "@types/chai": ^4.2.0 "@types/mocha": ">=9.1.0" - "@types/node": ">=18.0.0" + "@types/node": ">=20.0.0" chai: ^4.2.0 - ethers: ^6.4.0 - hardhat: ^2.11.0 - hardhat-gas-reporter: ^1.0.8 + ethers: ^6.14.0 + hardhat: ^2.26.0 + hardhat-gas-reporter: ^2.3.0 solidity-coverage: ^0.8.1 ts-node: ">=8.0.0" typechain: ^8.3.0 typescript: ">=4.5.0" - checksum: 18890eaf1cc130afb7dc83ea48cb6ef23c499eb5d28c3fbb36e706082383a320118ee6d4491ede64acf684d2f1ffa117cf84ad80d8ebde9fa52a443f8780a898 + checksum: 2658faef5faf748e291cc382f66cdaa0147c6a01ce0a98e1b89949a8724952a8268b7c946dcc7fb131ec382ec594e2e424f3c1b27def761f572c4ca87f1b2619 languageName: node linkType: hard -"@nomicfoundation/hardhat-verify@npm:latest": - version: 2.0.13 - resolution: "@nomicfoundation/hardhat-verify@npm:2.0.13" +"@nomicfoundation/hardhat-verify@npm:^2.0.0": + version: 2.1.3 + resolution: "@nomicfoundation/hardhat-verify@npm:2.1.3" dependencies: "@ethersproject/abi": ^5.1.2 "@ethersproject/address": ^5.0.2 @@ -1861,8 +1933,8 @@ __metadata: table: ^6.8.0 undici: ^5.14.0 peerDependencies: - hardhat: ^2.0.4 - checksum: 59a4d0f1fb93fcce91a4c318aaa69c8de6a857deb983e3976e9c20f09ce204f5a4e8a4e2ccae63018ee83ce5dbaa954b1f182a2c02e29d1a77f8673b03b498f9 + hardhat: ^2.26.0 + checksum: b0d8fbdd5522e8c3817e8a2e7538afe8bfb3f27317169871ef30abc51247afbfb52316c84d9dda6e7e796603b55da659432f6bcc52e2708f6fc89d4348a2dddc languageName: node linkType: hard @@ -1967,25 +2039,25 @@ __metadata: languageName: node linkType: hard -"@npmcli/agent@npm:^3.0.0": - version: 3.0.0 - resolution: "@npmcli/agent@npm:3.0.0" +"@npmcli/agent@npm:^4.0.0": + version: 4.0.0 + resolution: "@npmcli/agent@npm:4.0.0" dependencies: agent-base: ^7.1.0 http-proxy-agent: ^7.0.0 https-proxy-agent: ^7.0.1 - lru-cache: ^10.0.1 + lru-cache: ^11.2.1 socks-proxy-agent: ^8.0.3 - checksum: e8fc25d536250ed3e669813b36e8c6d805628b472353c57afd8c4fde0fcfcf3dda4ffe22f7af8c9070812ec2e7a03fb41d7151547cef3508efe661a5a3add20f + checksum: 89ae20b44859ff8d4de56ade319d8ceaa267a0742d6f7345fe98aa5cd8614ced7db85ea4dc5bfbd6614dbb200a10b134e087143582534c939e8a02219e8665c8 languageName: node linkType: hard -"@npmcli/fs@npm:^4.0.0": - version: 4.0.0 - resolution: "@npmcli/fs@npm:4.0.0" +"@npmcli/fs@npm:^5.0.0": + version: 5.0.0 + resolution: "@npmcli/fs@npm:5.0.0" dependencies: semver: ^7.3.5 - checksum: 68951c589e9a4328698a35fd82fe71909a257d6f2ede0434d236fa55634f0fbcad9bb8755553ce5849bd25ee6f019f4d435921ac715c853582c4a7f5983c8d4a + checksum: 897dac32eb37e011800112d406b9ea2ebd96f1dab01bb8fbeb59191b86f6825dffed6a89f3b6c824753d10f8735b76d630927bd7610e9e123b129ef2e5f02cb5 languageName: node linkType: hard @@ -2017,42 +2089,42 @@ __metadata: languageName: node linkType: hard -"@openzeppelin/defender-sdk-base-client@npm:^2.1.0, @openzeppelin/defender-sdk-base-client@npm:^2.5.0": - version: 2.5.0 - resolution: "@openzeppelin/defender-sdk-base-client@npm:2.5.0" +"@openzeppelin/defender-sdk-base-client@npm:^2.1.0, @openzeppelin/defender-sdk-base-client@npm:^2.7.0": + version: 2.7.0 + resolution: "@openzeppelin/defender-sdk-base-client@npm:2.7.0" dependencies: "@aws-sdk/client-lambda": ^3.563.0 amazon-cognito-identity-js: ^6.3.6 async-retry: ^1.3.3 - checksum: b8c2be0ffefe8ec371dc842bdb16d0b29c34ac05c9f26646e2286a3e22a3511de569e54a7bc5cdaea17eb20b7a8d5f47a44664733174e12ae190d5a5ddba4753 + checksum: d1df0e8013b0fad6c7eed345a210f083badc52e4b0738f85e2ebde50b15cd666029e3d4e18dcb40efcabae5ba6cf6f6b081346ede2d2881a349c7d9203aa8afc languageName: node linkType: hard "@openzeppelin/defender-sdk-deploy-client@npm:^2.1.0": - version: 2.5.0 - resolution: "@openzeppelin/defender-sdk-deploy-client@npm:2.5.0" + version: 2.7.0 + resolution: "@openzeppelin/defender-sdk-deploy-client@npm:2.7.0" dependencies: - "@openzeppelin/defender-sdk-base-client": ^2.5.0 + "@openzeppelin/defender-sdk-base-client": ^2.7.0 axios: ^1.7.4 lodash: ^4.17.21 - checksum: 620cafbb276cf7ad2eed8cde5a8349fa8be6ce7007a2fd5ee5d87ca24a46ec333396d9e3799cb501b858636519e769cec712338287ecc949b3cc0d6ab55b522c + checksum: 6366d3554805b08fc0df9b78f1e0f9ae03e108e7814eaa02bd71f3afb2e6b0011d1e514e4659bc92dd1a121d361b14cafb676ed70174113284f2fc0905fd9094 languageName: node linkType: hard "@openzeppelin/defender-sdk-network-client@npm:^2.1.0": - version: 2.5.0 - resolution: "@openzeppelin/defender-sdk-network-client@npm:2.5.0" + version: 2.7.0 + resolution: "@openzeppelin/defender-sdk-network-client@npm:2.7.0" dependencies: - "@openzeppelin/defender-sdk-base-client": ^2.5.0 + "@openzeppelin/defender-sdk-base-client": ^2.7.0 axios: ^1.7.4 lodash: ^4.17.21 - checksum: c1ab3d8db9f118e4da00a86803bdb1bac20a28edbc81ac1c656aafe4d2f9ad0241e8106ee6e4e9506a1c93bb09f7a5b7a82fc2c4689bfe1d32544f354642548a + checksum: 28712ad87e4cc53a9bfb39c38d76135149b8c122569651556c59ee425895094ae057d74476e419148b6fc6964a53ce12d512e1f6a91d9740c5cb41c4f516dba9 languageName: node linkType: hard "@openzeppelin/hardhat-upgrades@npm:^3.0.4": - version: 3.9.0 - resolution: "@openzeppelin/hardhat-upgrades@npm:3.9.0" + version: 3.9.1 + resolution: "@openzeppelin/hardhat-upgrades@npm:3.9.1" dependencies: "@openzeppelin/defender-sdk-base-client": ^2.1.0 "@openzeppelin/defender-sdk-deploy-client": ^2.1.0 @@ -2064,22 +2136,22 @@ __metadata: proper-lockfile: ^4.1.1 undici: ^6.11.1 peerDependencies: - "@nomicfoundation/hardhat-ethers": ^3.0.0 - "@nomicfoundation/hardhat-verify": ^2.0.0 + "@nomicfoundation/hardhat-ethers": ^3.0.6 + "@nomicfoundation/hardhat-verify": ^2.0.14 ethers: ^6.6.0 - hardhat: ^2.0.2 + hardhat: ^2.24.1 peerDependenciesMeta: "@nomicfoundation/hardhat-verify": optional: true bin: migrate-oz-cli-project: dist/scripts/migrate-oz-cli-project.js - checksum: 3475daf67bd03dde63de86666f897a4fcdea0028c1759b70163429af5f4e83521d8de7f8c836aa08df6f0218112d31f541c5197827b04d95ef777406d2a752dc + checksum: b82aa904695570033ac42696740bb65aee53167277eb48306e12dca4e16021b7892975e2ca7f149041b918431ad776bff0c8ca738f0b7a2f467ea599508bb9e8 languageName: node linkType: hard "@openzeppelin/upgrades-core@npm:^1.41.0, @openzeppelin/upgrades-core@npm:latest": - version: 1.44.0 - resolution: "@openzeppelin/upgrades-core@npm:1.44.0" + version: 1.44.2 + resolution: "@openzeppelin/upgrades-core@npm:1.44.2" dependencies: "@nomicfoundation/slang": ^0.18.3 bignumber.js: ^9.1.2 @@ -2094,7 +2166,7 @@ __metadata: solidity-ast: ^0.4.60 bin: openzeppelin-upgrades-core: dist/cli/cli.js - checksum: 44da52859525e3b63a0a4e2960ce1fec5fc7444349c7c630bb5eee41deadebd975a6a5fcb65568cc7a1b5e2c3a3c5618fab758a19854d96165c4c41c1d827f6c + checksum: e901d7a883b594144f1e1c649e32c2a78bb37099978b3df55a5e78eaca8078145ae8ee0178881c34cfb6ad835400b448b0002f5f0ba7179fc30a50dd32b1f25d languageName: node linkType: hard @@ -2244,10 +2316,10 @@ __metadata: languageName: node linkType: hard -"@scure/base@npm:~1.2.2, @scure/base@npm:~1.2.4, @scure/base@npm:~1.2.5": - version: 1.2.5 - resolution: "@scure/base@npm:1.2.5" - checksum: 79f76781d4f55fa2ce36e4d6f950a76234a81f81c9f5f33794ee82077e5c8005e84a1491684a0643e77734e3dd1cd8367930d2a165a9c0af4d3c526ffe7407f8 +"@scure/base@npm:~1.2.5": + version: 1.2.6 + resolution: "@scure/base@npm:1.2.6" + checksum: 1058cb26d5e4c1c46c9cc0ae0b67cc66d306733baf35d6ebdd8ddaba242b80c3807b726e3b48cb0411bb95ec10d37764969063ea62188f86ae9315df8ea6b325 languageName: node linkType: hard @@ -2273,18 +2345,7 @@ __metadata: languageName: node linkType: hard -"@scure/bip32@npm:1.6.2": - version: 1.6.2 - resolution: "@scure/bip32@npm:1.6.2" - dependencies: - "@noble/curves": ~1.8.1 - "@noble/hashes": ~1.7.1 - "@scure/base": ~1.2.2 - checksum: e7586619f8a669e522267ce71a90b2d00c3a91da658f1f50e54072cf9f432ba26d2bb4d3d91a5d06932ab96612b8bd038bc31d885bbc048cebfb6509c4a790fc - languageName: node - linkType: hard - -"@scure/bip32@npm:^1.5.0": +"@scure/bip32@npm:1.7.0, @scure/bip32@npm:^1.7.0": version: 1.7.0 resolution: "@scure/bip32@npm:1.7.0" dependencies: @@ -2315,17 +2376,7 @@ __metadata: languageName: node linkType: hard -"@scure/bip39@npm:1.5.4": - version: 1.5.4 - resolution: "@scure/bip39@npm:1.5.4" - dependencies: - "@noble/hashes": ~1.7.1 - "@scure/base": ~1.2.4 - checksum: 744f302559ad05ee6ea4928572ac8f0b5443e8068fd53234c9c2e158814e910a043c54f0688d05546decadd2ff66e0d0c76355d10e103a28cb8f44efe140857a - languageName: node - linkType: hard - -"@scure/bip39@npm:^1.4.0": +"@scure/bip39@npm:1.6.0, @scure/bip39@npm:^1.6.0": version: 1.6.0 resolution: "@scure/bip39@npm:1.6.0" dependencies: @@ -2417,145 +2468,148 @@ __metadata: languageName: node linkType: hard -"@smithy/abort-controller@npm:^4.0.2": - version: 4.0.2 - resolution: "@smithy/abort-controller@npm:4.0.2" +"@smithy/abort-controller@npm:^4.2.8": + version: 4.2.8 + resolution: "@smithy/abort-controller@npm:4.2.8" dependencies: - "@smithy/types": ^4.2.0 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: b5851bb498d7920926b844659381bd1b5b29e5741dce11daf4e4aeb14216d71d2db5f159e1ae20c538541443cee618a9d926c53b7a7693b1943689af5ca8ff5f + checksum: ae5c37f677e54c2808d1014d64bc9592b0120dec4e972475c15c67ff201f99613ebbe66937051ad2e4396b0d94a1034e6712e8cc0213142f252a9200f4c5ac37 languageName: node linkType: hard -"@smithy/config-resolver@npm:^4.1.0": - version: 4.1.0 - resolution: "@smithy/config-resolver@npm:4.1.0" +"@smithy/config-resolver@npm:^4.4.6": + version: 4.4.6 + resolution: "@smithy/config-resolver@npm:4.4.6" dependencies: - "@smithy/node-config-provider": ^4.0.2 - "@smithy/types": ^4.2.0 - "@smithy/util-config-provider": ^4.0.0 - "@smithy/util-middleware": ^4.0.2 + "@smithy/node-config-provider": ^4.3.8 + "@smithy/types": ^4.12.0 + "@smithy/util-config-provider": ^4.2.0 + "@smithy/util-endpoints": ^3.2.8 + "@smithy/util-middleware": ^4.2.8 tslib: ^2.6.2 - checksum: 28be57094f6c8e4bfdebc78ec6df647f6155699c1706aa571ee6fecf191f41cd260d1e164872f86f434c2eb428398e376ae83a46fc9adb3eb2a3e48b972d7674 + checksum: ffb98899d0343a16692e0bab514719b88d3f97a696489eabaa1c7e52d534083dac440e51dbf8cadf7193e9fabddd7244e77e32d03f905a1469c3d8113fa02a6c languageName: node linkType: hard -"@smithy/core@npm:^3.3.1": - version: 3.3.1 - resolution: "@smithy/core@npm:3.3.1" - dependencies: - "@smithy/middleware-serde": ^4.0.3 - "@smithy/protocol-http": ^5.1.0 - "@smithy/types": ^4.2.0 - "@smithy/util-body-length-browser": ^4.0.0 - "@smithy/util-middleware": ^4.0.2 - "@smithy/util-stream": ^4.2.0 - "@smithy/util-utf8": ^4.0.0 +"@smithy/core@npm:^3.22.0": + version: 3.22.0 + resolution: "@smithy/core@npm:3.22.0" + dependencies: + "@smithy/middleware-serde": ^4.2.9 + "@smithy/protocol-http": ^5.3.8 + "@smithy/types": ^4.12.0 + "@smithy/util-base64": ^4.3.0 + "@smithy/util-body-length-browser": ^4.2.0 + "@smithy/util-middleware": ^4.2.8 + "@smithy/util-stream": ^4.5.10 + "@smithy/util-utf8": ^4.2.0 + "@smithy/uuid": ^1.1.0 tslib: ^2.6.2 - checksum: 879e5e62bc7206b177d61a65e849dc4ff6fe236d1427dd45cdf63a56b9e56ada93611d75ee545215b56a219eac30fdd475dce3bd78268da0b739d35c39226f02 + checksum: ed8053ea4985a9a0dc3d9deb8c86a34dfe7375174abe534e25d744ff749d06216fec8e2a1eccf01d8ac97fa632f0e95738c9af3530fd3f3ce0cf7355fb628e82 languageName: node linkType: hard -"@smithy/credential-provider-imds@npm:^4.0.2": - version: 4.0.2 - resolution: "@smithy/credential-provider-imds@npm:4.0.2" +"@smithy/credential-provider-imds@npm:^4.2.8": + version: 4.2.8 + resolution: "@smithy/credential-provider-imds@npm:4.2.8" dependencies: - "@smithy/node-config-provider": ^4.0.2 - "@smithy/property-provider": ^4.0.2 - "@smithy/types": ^4.2.0 - "@smithy/url-parser": ^4.0.2 + "@smithy/node-config-provider": ^4.3.8 + "@smithy/property-provider": ^4.2.8 + "@smithy/types": ^4.12.0 + "@smithy/url-parser": ^4.2.8 tslib: ^2.6.2 - checksum: c037a3165bf09f23faf7474c6ee035fb11b9481511519ee2f4d7db9a4fa6412d4cd03c79685662ea8fe087c678038bbfd4d7399139e093fbad7312fe91214ef3 + checksum: 954bb2abdfda69b6b17386bf0270a8b7730d0d9fc3699cd2574b65bf17ad112b9be6711177d2fcad9fd694bd790b97541298210c7d9dba4736d9fa56fe75f167 languageName: node linkType: hard -"@smithy/eventstream-codec@npm:^4.0.2": - version: 4.0.2 - resolution: "@smithy/eventstream-codec@npm:4.0.2" +"@smithy/eventstream-codec@npm:^4.2.8": + version: 4.2.8 + resolution: "@smithy/eventstream-codec@npm:4.2.8" dependencies: "@aws-crypto/crc32": 5.2.0 - "@smithy/types": ^4.2.0 - "@smithy/util-hex-encoding": ^4.0.0 + "@smithy/types": ^4.12.0 + "@smithy/util-hex-encoding": ^4.2.0 tslib: ^2.6.2 - checksum: f870d041f44d464ec6e6b7429fcc8b40f67664e1ebe16187246dbf8d56b3cd93b43491ef849719db226ff4e658574490c2b74a7c86357c698b599560cfd3510a + checksum: ef010dbb65eb6b24a7a89eaaba993b045f0aaae16660e5e99aa9f000019b40d00de51004be63f2a17e05a5ad4c99192d2ba2bfa11e13c0807f3e2006f8411dea languageName: node linkType: hard -"@smithy/eventstream-serde-browser@npm:^4.0.2": - version: 4.0.2 - resolution: "@smithy/eventstream-serde-browser@npm:4.0.2" +"@smithy/eventstream-serde-browser@npm:^4.2.8": + version: 4.2.8 + resolution: "@smithy/eventstream-serde-browser@npm:4.2.8" dependencies: - "@smithy/eventstream-serde-universal": ^4.0.2 - "@smithy/types": ^4.2.0 + "@smithy/eventstream-serde-universal": ^4.2.8 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: 2d212a3dc2643413699cb8e26fde77c7fea8381614a4c5c88c1de2e9fb9a6f50b7368d0689c10f3034bba48af640c465f338d1f4449d77ad531ae4fc866dd558 + checksum: 0d69fef4485ba86e3381d1e47465b1dfe60f6fe34a1fed7ccb359c965cc4b92c99d7c5ed70cb0d26b19d8fc3b8c49db0a140578deef152930534b20d730751d6 languageName: node linkType: hard -"@smithy/eventstream-serde-config-resolver@npm:^4.1.0": - version: 4.1.0 - resolution: "@smithy/eventstream-serde-config-resolver@npm:4.1.0" +"@smithy/eventstream-serde-config-resolver@npm:^4.3.8": + version: 4.3.8 + resolution: "@smithy/eventstream-serde-config-resolver@npm:4.3.8" dependencies: - "@smithy/types": ^4.2.0 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: 3cdad747060f1598944b4a5f734b10cd1dfe4fac1f1207a2ccedcee75a38523c887868521da90494b6fd49ea48ba385820cb97f1034079f4c16dcc030baa85bc + checksum: 849544e1212d98469ca3d6e73919a9ff5bc2eaf903226193ad0857d03c11129a03ddbf4177673059c6a97af015cb0f32530018e42a430b1c5e639d95174f64e8 languageName: node linkType: hard -"@smithy/eventstream-serde-node@npm:^4.0.2": - version: 4.0.2 - resolution: "@smithy/eventstream-serde-node@npm:4.0.2" +"@smithy/eventstream-serde-node@npm:^4.2.8": + version: 4.2.8 + resolution: "@smithy/eventstream-serde-node@npm:4.2.8" dependencies: - "@smithy/eventstream-serde-universal": ^4.0.2 - "@smithy/types": ^4.2.0 + "@smithy/eventstream-serde-universal": ^4.2.8 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: 77d025e983ab72faa3613d9f1b84f917f22848e9c0889da1828f63f93f99a61962b701da6104d61844a01d23cd1082309bcf80c3a417ecc64e1493e4f1f08120 + checksum: d95a5317be7452129259d491c0c7d35f90440c8b67a6006476152182cefd1e5e96d4e090419fb850afb7ec763940134c351cbc6d6b46c03e9c6331e1e7f79ba4 languageName: node linkType: hard -"@smithy/eventstream-serde-universal@npm:^4.0.2": - version: 4.0.2 - resolution: "@smithy/eventstream-serde-universal@npm:4.0.2" +"@smithy/eventstream-serde-universal@npm:^4.2.8": + version: 4.2.8 + resolution: "@smithy/eventstream-serde-universal@npm:4.2.8" dependencies: - "@smithy/eventstream-codec": ^4.0.2 - "@smithy/types": ^4.2.0 + "@smithy/eventstream-codec": ^4.2.8 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: 8e760cc5646bb8804429ad811b62d2a9308127db33dca4ac7c362ddc6f1230067cde263144830cd83152656b70c0eaf19895c649e2d406efa46c2aed6af9701b + checksum: 3d49d9f24e4c1f91fd23439388e93cbd94579632dfc16353e519971fca8eb5e48fec29d0cf88007ccca5f45f9943f80de21a1f7f17f1d9bf5cc28d40078a98e1 languageName: node linkType: hard -"@smithy/fetch-http-handler@npm:^5.0.2": - version: 5.0.2 - resolution: "@smithy/fetch-http-handler@npm:5.0.2" +"@smithy/fetch-http-handler@npm:^5.3.9": + version: 5.3.9 + resolution: "@smithy/fetch-http-handler@npm:5.3.9" dependencies: - "@smithy/protocol-http": ^5.1.0 - "@smithy/querystring-builder": ^4.0.2 - "@smithy/types": ^4.2.0 - "@smithy/util-base64": ^4.0.0 + "@smithy/protocol-http": ^5.3.8 + "@smithy/querystring-builder": ^4.2.8 + "@smithy/types": ^4.12.0 + "@smithy/util-base64": ^4.3.0 tslib: ^2.6.2 - checksum: da210125fdf56981bba5f456b24bd45571c8bf7140cb2f2bfa2cacb522b9fdbd785eb751632dd42e2c4eb8a14b187e113d044fd4b4e8c9a7bc446f90292df435 + checksum: de73fa72fb059a1b52771b8b4ab1ed541c1164f5e4ee6e7a6e6110c08081949e81236108698b2c91d61a8bbd5104bc0d05a93624a44d411f313c6342f0d01b74 languageName: node linkType: hard -"@smithy/hash-node@npm:^4.0.2": - version: 4.0.2 - resolution: "@smithy/hash-node@npm:4.0.2" +"@smithy/hash-node@npm:^4.2.8": + version: 4.2.8 + resolution: "@smithy/hash-node@npm:4.2.8" dependencies: - "@smithy/types": ^4.2.0 - "@smithy/util-buffer-from": ^4.0.0 - "@smithy/util-utf8": ^4.0.0 + "@smithy/types": ^4.12.0 + "@smithy/util-buffer-from": ^4.2.0 + "@smithy/util-utf8": ^4.2.0 tslib: ^2.6.2 - checksum: 3bf68605d3fa033fbfd556f60966ad3fa5f4f66e902fbe2b901cfaaf7d74b545d4a5a15ceebc1b2cf69557eac02c66af3b5e7071c11341ea536d36c4c4ee755c + checksum: 93916922b88e19c98b75b6c75b639e53c63ff62fb302f578d6b07fa9c1feb091b892949c3590600f708e2277395bff9d97386527990fbf74ec37056d035d3880 languageName: node linkType: hard -"@smithy/invalid-dependency@npm:^4.0.2": - version: 4.0.2 - resolution: "@smithy/invalid-dependency@npm:4.0.2" +"@smithy/invalid-dependency@npm:^4.2.8": + version: 4.2.8 + resolution: "@smithy/invalid-dependency@npm:4.2.8" dependencies: - "@smithy/types": ^4.2.0 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: 96ea5e6c02c112e78655bf5538e13bca5ba374692db3e1ac73683143d0f2183958c1b8cbf4c1ed4d1357f45174f338a255352ad6d7e83fdf2601c1cb6ff73997 + checksum: 966e4b7fb233db2db150087f552230cb3b2b3169632eaff9bf57b7f3221505d46ad20c7568172e4d76c04bc0c8f89ecf099875a1547e861426236ce2be6a90ea languageName: node linkType: hard @@ -2568,241 +2622,242 @@ __metadata: languageName: node linkType: hard -"@smithy/is-array-buffer@npm:^4.0.0": - version: 4.0.0 - resolution: "@smithy/is-array-buffer@npm:4.0.0" +"@smithy/is-array-buffer@npm:^4.2.0": + version: 4.2.0 + resolution: "@smithy/is-array-buffer@npm:4.2.0" dependencies: tslib: ^2.6.2 - checksum: 8226fc1eca7aacd7f887f3a5ec2f15a3cafa72aa1c42d3fc759c66600481381d18ec7285a8195f24b9c4fe0ce9a565c133b2021d86a8077aebce3f86b3716802 + checksum: a738fd54758912d0a38dbb1f44f3e4274773be57fe29179a616ffe502fc45f708a49643be037b4d8fc24d18a68e489e314e258140c30b1589b46db6d62a78173 languageName: node linkType: hard -"@smithy/middleware-content-length@npm:^4.0.2": - version: 4.0.2 - resolution: "@smithy/middleware-content-length@npm:4.0.2" +"@smithy/middleware-content-length@npm:^4.2.8": + version: 4.2.8 + resolution: "@smithy/middleware-content-length@npm:4.2.8" dependencies: - "@smithy/protocol-http": ^5.1.0 - "@smithy/types": ^4.2.0 + "@smithy/protocol-http": ^5.3.8 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: fa93318eb108e4ee32d734acbd74cbae10cce4f2d323a5399aac831a0d24ef7ca5f66c3af2c0e94238bf1a603f79d65fcfe42d87757f4aacfbdb2ee2da1d79a8 + checksum: cda46f45ba40d70ac46a75822b33ca23c25973735e7d2e7cd932366c8227be1d2ce348582562a10293ea287d75b094305ae89afc1fa540d1b0e4c03a116e901d languageName: node linkType: hard -"@smithy/middleware-endpoint@npm:^4.1.2": - version: 4.1.2 - resolution: "@smithy/middleware-endpoint@npm:4.1.2" - dependencies: - "@smithy/core": ^3.3.1 - "@smithy/middleware-serde": ^4.0.3 - "@smithy/node-config-provider": ^4.0.2 - "@smithy/shared-ini-file-loader": ^4.0.2 - "@smithy/types": ^4.2.0 - "@smithy/url-parser": ^4.0.2 - "@smithy/util-middleware": ^4.0.2 +"@smithy/middleware-endpoint@npm:^4.4.12": + version: 4.4.12 + resolution: "@smithy/middleware-endpoint@npm:4.4.12" + dependencies: + "@smithy/core": ^3.22.0 + "@smithy/middleware-serde": ^4.2.9 + "@smithy/node-config-provider": ^4.3.8 + "@smithy/shared-ini-file-loader": ^4.4.3 + "@smithy/types": ^4.12.0 + "@smithy/url-parser": ^4.2.8 + "@smithy/util-middleware": ^4.2.8 tslib: ^2.6.2 - checksum: 69b38bfbaceb75f4aa84ea302cb8977d1bbc5f330ea654b93fbbed8c07edd70f86294f39b65d8011b310698f6ad7a2f0c1ea217f1d6f79b993793417f9c7dbb8 + checksum: cf8e6d8a6c216d886a8404f21b436df19474fcb1a02360457edeaa1a76189a71a2d98d94ab007b232ca6498c853acce52d410b2cbdf3c5f3f4c881e3cbe6b85b languageName: node linkType: hard -"@smithy/middleware-retry@npm:^4.1.3": - version: 4.1.3 - resolution: "@smithy/middleware-retry@npm:4.1.3" - dependencies: - "@smithy/node-config-provider": ^4.0.2 - "@smithy/protocol-http": ^5.1.0 - "@smithy/service-error-classification": ^4.0.3 - "@smithy/smithy-client": ^4.2.2 - "@smithy/types": ^4.2.0 - "@smithy/util-middleware": ^4.0.2 - "@smithy/util-retry": ^4.0.3 +"@smithy/middleware-retry@npm:^4.4.29": + version: 4.4.29 + resolution: "@smithy/middleware-retry@npm:4.4.29" + dependencies: + "@smithy/node-config-provider": ^4.3.8 + "@smithy/protocol-http": ^5.3.8 + "@smithy/service-error-classification": ^4.2.8 + "@smithy/smithy-client": ^4.11.1 + "@smithy/types": ^4.12.0 + "@smithy/util-middleware": ^4.2.8 + "@smithy/util-retry": ^4.2.8 + "@smithy/uuid": ^1.1.0 tslib: ^2.6.2 - uuid: ^9.0.1 - checksum: 99f9945ac64ca1193ec67c7db2633f3d1271d5eaf0041086c4f939cfea90661952ad3b5f27e30757535efcc06ead3593e5ddc56c1594b2da91adc2cb7d2311ec + checksum: 28d05db3e5cbc473bb72f48fc3340b3541c1542fe3d50c47c95d6942eeba3f9827998028c54c5e18cbc9ba45c87f396d72252e471ef060408e26506f1e66c640 languageName: node linkType: hard -"@smithy/middleware-serde@npm:^4.0.3": - version: 4.0.3 - resolution: "@smithy/middleware-serde@npm:4.0.3" +"@smithy/middleware-serde@npm:^4.2.9": + version: 4.2.9 + resolution: "@smithy/middleware-serde@npm:4.2.9" dependencies: - "@smithy/types": ^4.2.0 + "@smithy/protocol-http": ^5.3.8 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: e64fb925d2ee344ade5781b727f06619b4e2f3b0153134a5c4e9850a5598b96fe542343ce2eaca57fb85a585e43570d6d324d6c9faf8b97040d2c18c30c94806 + checksum: 85217b475e95446d9b448ea89b8ed0ddce3ccc3275dffb723dfd667edcaf461b250b7051d8bcee7a446b8924ab4b4d03d043d35bd48f39b5a78bc516bd9dd646 languageName: node linkType: hard -"@smithy/middleware-stack@npm:^4.0.2": - version: 4.0.2 - resolution: "@smithy/middleware-stack@npm:4.0.2" +"@smithy/middleware-stack@npm:^4.2.8": + version: 4.2.8 + resolution: "@smithy/middleware-stack@npm:4.2.8" dependencies: - "@smithy/types": ^4.2.0 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: 3401fc2e7fba63c71cc4dcebf489d39ece1396fccf858f9877a99b36aa625ab8c30a7866596f2f4bdf7128bd29800f06160dea0db01bde061fb63a0f43a60a20 + checksum: 45de485d2f5234a0eb6b84ecd7b961bbd4c1952626a750611fc237be87855f30f8a883f8d26ca2c84ff3adf8a81f53bf8b10a014ffa050ae06ac6bae9d6317c7 languageName: node linkType: hard -"@smithy/node-config-provider@npm:^4.0.2": - version: 4.0.2 - resolution: "@smithy/node-config-provider@npm:4.0.2" +"@smithy/node-config-provider@npm:^4.3.8": + version: 4.3.8 + resolution: "@smithy/node-config-provider@npm:4.3.8" dependencies: - "@smithy/property-provider": ^4.0.2 - "@smithy/shared-ini-file-loader": ^4.0.2 - "@smithy/types": ^4.2.0 + "@smithy/property-provider": ^4.2.8 + "@smithy/shared-ini-file-loader": ^4.4.3 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: 278cf7aec9b11228b103ec2e665c9242b457a2851d38259f645b55a87bfa66ef7b0b7b30c348998178597875f36134f77ae7d924e204f01764f37a0b2426adf6 + checksum: 98682d2c0235f041e7545ab7c5e9432a0d6307461042c21aa5cff2be5cebe5402a35de6a559c1a5a3b884c940d5d52679618552b422e393953ba2dc8a00e0fbb languageName: node linkType: hard -"@smithy/node-http-handler@npm:^4.0.4": - version: 4.0.4 - resolution: "@smithy/node-http-handler@npm:4.0.4" +"@smithy/node-http-handler@npm:^4.4.8": + version: 4.4.8 + resolution: "@smithy/node-http-handler@npm:4.4.8" dependencies: - "@smithy/abort-controller": ^4.0.2 - "@smithy/protocol-http": ^5.1.0 - "@smithy/querystring-builder": ^4.0.2 - "@smithy/types": ^4.2.0 + "@smithy/abort-controller": ^4.2.8 + "@smithy/protocol-http": ^5.3.8 + "@smithy/querystring-builder": ^4.2.8 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: 315f9bfeb22c3d06add4a68a7e6fd394caa9fb22422e89c7fdc564a6d3d94da2355caed18558019f0ef919385473f72e2cad71fc72f47166a14c33a69e0f0ee5 + checksum: ef328ede589ef1438de83450f7569a7e9ecf575aa0cb8153129e4a97f3b5cc67a2e0dee1058e7135c42307cd755ecbfb95c9b7b827b60068dd9479af90087e79 languageName: node linkType: hard -"@smithy/property-provider@npm:^4.0.2": - version: 4.0.2 - resolution: "@smithy/property-provider@npm:4.0.2" +"@smithy/property-provider@npm:^4.2.8": + version: 4.2.8 + resolution: "@smithy/property-provider@npm:4.2.8" dependencies: - "@smithy/types": ^4.2.0 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: 3038ce031036d3d055bb1c9401f30bea7f1410b2db1d0cd3565cd25f7f374f18a67792930b2e3d0f73c2b1fcbfb23d3bfbd110197f1fd15d0acaa778719fa267 + checksum: 6a19b5e44ceb37a85999796dfa73ce7d82653c1db0cfe332786e202b7333f988dc5e65902c0492dc37d48f4c48ccf35fc4fa92cdf1ca9e8f24d2d1d6206e3dd5 languageName: node linkType: hard -"@smithy/protocol-http@npm:^5.1.0": - version: 5.1.0 - resolution: "@smithy/protocol-http@npm:5.1.0" +"@smithy/protocol-http@npm:^5.3.8": + version: 5.3.8 + resolution: "@smithy/protocol-http@npm:5.3.8" dependencies: - "@smithy/types": ^4.2.0 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: 091e8c129411c2072e640aa6a8440fdcfd265fc7b4aef3ff52f419c24dc5f8e34009f03fc810a87a49c7e66d0bf4636b4fbd76a84be563a97b41e9c927f90337 + checksum: 4371cbb493109edde1177bfd84b2d4d7887fbf821085df3c9251ba99f635e355f967c4dea32f02aaac52edabb408e946a3452bd7723d724827d56e7f2292614d languageName: node linkType: hard -"@smithy/querystring-builder@npm:^4.0.2": - version: 4.0.2 - resolution: "@smithy/querystring-builder@npm:4.0.2" +"@smithy/querystring-builder@npm:^4.2.8": + version: 4.2.8 + resolution: "@smithy/querystring-builder@npm:4.2.8" dependencies: - "@smithy/types": ^4.2.0 - "@smithy/util-uri-escape": ^4.0.0 + "@smithy/types": ^4.12.0 + "@smithy/util-uri-escape": ^4.2.0 tslib: ^2.6.2 - checksum: d802d3af37192d574f59e71aa050ec6daa63df58f2d1b44b95ef9b0ff93e6a40960db4a91eed853be94cdbcd1faa6a658bc56c9b9d1d85449d9215137918b3dd + checksum: 7bface9bf3586625392d1861318c93d356d2353fa79ff024df55ac0b71d0bfc77a43eae91a3eda01e7bd68538c382229d0b1841e95f27d75bfb0dc9d76441933 languageName: node linkType: hard -"@smithy/querystring-parser@npm:^4.0.2": - version: 4.0.2 - resolution: "@smithy/querystring-parser@npm:4.0.2" +"@smithy/querystring-parser@npm:^4.2.8": + version: 4.2.8 + resolution: "@smithy/querystring-parser@npm:4.2.8" dependencies: - "@smithy/types": ^4.2.0 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: 4aa30d35b6cf06da6e55386afa70b8d33d3171ed9b3a303a65e23d67a9c090c302d373af4d75609a981188c9441dc81c22d4adb1018888cbd16a62c9ab363d7d + checksum: a7c89eb63321fc8c4ed5a4b1bbb88f1254e128ab86e7d5aa666a2a2b7889489ccbc3efb7f73c34567b6dad8356b5cecb2a512ff0fd5a19266eb187ffe9868d86 languageName: node linkType: hard -"@smithy/service-error-classification@npm:^4.0.3": - version: 4.0.3 - resolution: "@smithy/service-error-classification@npm:4.0.3" +"@smithy/service-error-classification@npm:^4.2.8": + version: 4.2.8 + resolution: "@smithy/service-error-classification@npm:4.2.8" dependencies: - "@smithy/types": ^4.2.0 - checksum: 6fa7a20dafca3e0a03d69ac0dc83749a2cc04061af4c7b8a06e8fbdff4050325536cfbe299cf0bbfc9a9cc0b2541fc22cfe923ae45a8bddce64d83927990253d + "@smithy/types": ^4.12.0 + checksum: bf7dc438050d6fd9f563e4479a680fa284df6d2acddd305c27f5c0cb5dd94aa17b5ede42074100072be97f6cd04bda7e3ffb1e9535ececac7ebb9a11aa982c46 languageName: node linkType: hard -"@smithy/shared-ini-file-loader@npm:^4.0.2": - version: 4.0.2 - resolution: "@smithy/shared-ini-file-loader@npm:4.0.2" +"@smithy/shared-ini-file-loader@npm:^4.4.3": + version: 4.4.3 + resolution: "@smithy/shared-ini-file-loader@npm:4.4.3" dependencies: - "@smithy/types": ^4.2.0 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: d6304d06c3e7e252a29197fae37f827b5924dbf98e1473adebc398256cdde67f14c9afa8b0ffc2b914cbf9d257c2417f5d0ebede95f824814d1c11077e1d1721 + checksum: bda50324b855b8994029a47d256a70bb25f886759d5826e88479bb169f17d8d6c44570b762ea15b38fb29818ea6294fddc15027552efd9e2ef81c5465430afd2 languageName: node linkType: hard -"@smithy/signature-v4@npm:^5.1.0": - version: 5.1.0 - resolution: "@smithy/signature-v4@npm:5.1.0" - dependencies: - "@smithy/is-array-buffer": ^4.0.0 - "@smithy/protocol-http": ^5.1.0 - "@smithy/types": ^4.2.0 - "@smithy/util-hex-encoding": ^4.0.0 - "@smithy/util-middleware": ^4.0.2 - "@smithy/util-uri-escape": ^4.0.0 - "@smithy/util-utf8": ^4.0.0 +"@smithy/signature-v4@npm:^5.3.8": + version: 5.3.8 + resolution: "@smithy/signature-v4@npm:5.3.8" + dependencies: + "@smithy/is-array-buffer": ^4.2.0 + "@smithy/protocol-http": ^5.3.8 + "@smithy/types": ^4.12.0 + "@smithy/util-hex-encoding": ^4.2.0 + "@smithy/util-middleware": ^4.2.8 + "@smithy/util-uri-escape": ^4.2.0 + "@smithy/util-utf8": ^4.2.0 tslib: ^2.6.2 - checksum: 302741d0779c419ef13be6fd303476d1544c9ad6b531e40d7883941b72817f1e36342474b5fe1cde177b38d1b8cd89d0da59eb3b41fa1ab719e7988b3cf35155 + checksum: 651073b25020d314a2dcca81fbfe2baa6522ec5be7bf930c1cfea1e24a1b7babe6da6dcf37c3faa0e69c1b994d3f3fb9d501e1dba787ed4e098f8cebf8b9809d languageName: node linkType: hard -"@smithy/smithy-client@npm:^4.2.2": - version: 4.2.2 - resolution: "@smithy/smithy-client@npm:4.2.2" +"@smithy/smithy-client@npm:^4.11.1": + version: 4.11.1 + resolution: "@smithy/smithy-client@npm:4.11.1" dependencies: - "@smithy/core": ^3.3.1 - "@smithy/middleware-endpoint": ^4.1.2 - "@smithy/middleware-stack": ^4.0.2 - "@smithy/protocol-http": ^5.1.0 - "@smithy/types": ^4.2.0 - "@smithy/util-stream": ^4.2.0 + "@smithy/core": ^3.22.0 + "@smithy/middleware-endpoint": ^4.4.12 + "@smithy/middleware-stack": ^4.2.8 + "@smithy/protocol-http": ^5.3.8 + "@smithy/types": ^4.12.0 + "@smithy/util-stream": ^4.5.10 tslib: ^2.6.2 - checksum: 67eb6b29cde36125dd135c5facfdf57346783e8ba18e5d8b4c1677d4f7636be37b8cdeb785348f797aa8d7ed7ae0c0af60fb65511f3141483e416507a6a6c760 + checksum: 0f63b21fad19abaee85da7c4c085dd84d73ffa32da04939ea65ae713f91f22c693fe396d1a95ff6a66f20b632baaece52f6021227dcdb5dfdc1d22e612c3f871 languageName: node linkType: hard -"@smithy/types@npm:^4.2.0": - version: 4.2.0 - resolution: "@smithy/types@npm:4.2.0" +"@smithy/types@npm:^4.12.0": + version: 4.12.0 + resolution: "@smithy/types@npm:4.12.0" dependencies: tslib: ^2.6.2 - checksum: 296b2122144a4edacbecf6baec138c6d4abb838b98823dbb8b94e90e89a0e1c13cf3a7bbd82900b4a229ebe58dac9cd516fc4a6ddf39b1e5190c91cce64c25a5 + checksum: bd74ef4dba3683f75531650c8dbba018b05fae70e69f0f427136aef3df13a525521a85053b676a5985a11d8273d06eb12bec867c4221eb5a5b2b4eb6a3706dc4 languageName: node linkType: hard -"@smithy/url-parser@npm:^4.0.2": - version: 4.0.2 - resolution: "@smithy/url-parser@npm:4.0.2" +"@smithy/url-parser@npm:^4.2.8": + version: 4.2.8 + resolution: "@smithy/url-parser@npm:4.2.8" dependencies: - "@smithy/querystring-parser": ^4.0.2 - "@smithy/types": ^4.2.0 + "@smithy/querystring-parser": ^4.2.8 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: a193c8d215756d5ee0f4fc52262f3aebba2c71a1f21e309f2d36fae79b1575379fd084383c1f159473879e72ea158650bcfa25048815378880867929fade24f1 + checksum: f354e69cc629084bbb7ed1759f2970d96e2c462d2849402057e86aeaa18b32d13f7e24b5244ecddac398b6504fe3705b8ee2696a68df662a556ae20566d68f38 languageName: node linkType: hard -"@smithy/util-base64@npm:^4.0.0": - version: 4.0.0 - resolution: "@smithy/util-base64@npm:4.0.0" +"@smithy/util-base64@npm:^4.3.0": + version: 4.3.0 + resolution: "@smithy/util-base64@npm:4.3.0" dependencies: - "@smithy/util-buffer-from": ^4.0.0 - "@smithy/util-utf8": ^4.0.0 + "@smithy/util-buffer-from": ^4.2.0 + "@smithy/util-utf8": ^4.2.0 tslib: ^2.6.2 - checksum: 7fb3430d6e1cbb4bcc61458587bb0746458f0ec8e8cd008224ca984ff65c3c3307b3a528d040cef4c1fc7d1bd4111f6de8f4f1595845422f14ac7d100b3871b1 + checksum: 67b707c36fb384bcd0233f27968f103ff2fd25da93ea85d8e22eb492dc668487b222f3aac151b2f348548946a439a741c0f3aa5f28f1d554ed428415b98c01c4 languageName: node linkType: hard -"@smithy/util-body-length-browser@npm:^4.0.0": - version: 4.0.0 - resolution: "@smithy/util-body-length-browser@npm:4.0.0" +"@smithy/util-body-length-browser@npm:^4.2.0": + version: 4.2.0 + resolution: "@smithy/util-body-length-browser@npm:4.2.0" dependencies: tslib: ^2.6.2 - checksum: 72381e12de7cccbb722c60e3f3ae0f8bce7fc9a9e8064c7968ac733698a5a30bea098a3c365095c519491fe64e2e949c22f74d4f1e0d910090d6389b41c416eb + checksum: 60feae29fc6429fac8babac8e0b82307bd14862d5a0fa554e100ff9f99c6b959cd30e1e022e0059214df329e463e631003b3a29307f02deb233537582a1dbe31 languageName: node linkType: hard -"@smithy/util-body-length-node@npm:^4.0.0": - version: 4.0.0 - resolution: "@smithy/util-body-length-node@npm:4.0.0" +"@smithy/util-body-length-node@npm:^4.2.1": + version: 4.2.1 + resolution: "@smithy/util-body-length-node@npm:4.2.1" dependencies: tslib: ^2.6.2 - checksum: 12d8de9c526647f51f56804044f5847f0c7c7afee30fa368d2b7bd4b4de8fe2438a925aab51965fe8a4b2f08f68e8630cc3c54a449beae6646d99cae900ed106 + checksum: bf4ae0fa4f49cd9f9b5f117cbb368059a77653281cbd7b881a24f82484ba2415eba01c67700381723f972db5103ca5120055eb763d32395dde469fb522b15658 languageName: node linkType: hard @@ -2816,116 +2871,115 @@ __metadata: languageName: node linkType: hard -"@smithy/util-buffer-from@npm:^4.0.0": - version: 4.0.0 - resolution: "@smithy/util-buffer-from@npm:4.0.0" +"@smithy/util-buffer-from@npm:^4.2.0": + version: 4.2.0 + resolution: "@smithy/util-buffer-from@npm:4.2.0" dependencies: - "@smithy/is-array-buffer": ^4.0.0 + "@smithy/is-array-buffer": ^4.2.0 tslib: ^2.6.2 - checksum: 8124e28d3e34b5335c08398a9081cc56a232d23e08172d488669f91a167d0871d36aba9dd3e4b70175a52f1bd70e2bf708d4c989a19512a4374d2cf67650a15e + checksum: c9908db97a3e91ae7ac869a3cfba3c345f9bc8072ec9545a25f318b8a9604d6ed6139298e1b75fffce7347cc15a5823e178b631828aee674fdb6b4ed3810d647 languageName: node linkType: hard -"@smithy/util-config-provider@npm:^4.0.0": - version: 4.0.0 - resolution: "@smithy/util-config-provider@npm:4.0.0" +"@smithy/util-config-provider@npm:^4.2.0": + version: 4.2.0 + resolution: "@smithy/util-config-provider@npm:4.2.0" dependencies: tslib: ^2.6.2 - checksum: 91bd9e0bec4c4a37c3fc286e72f3387be9272b090111edaee992d9e9619370f3f2ad88ce771ef42dbfe40a44500163b633914486e662526591f5f737d5e4ff5a + checksum: 7ff1cb4c11f779021e0e96edfd619d375297420b3eed6998e8dc2f2409895b74e803e8147045b80432d1784da35d2963d941785083343e8333d0f6308ff36fe3 languageName: node linkType: hard -"@smithy/util-defaults-mode-browser@npm:^4.0.10": - version: 4.0.10 - resolution: "@smithy/util-defaults-mode-browser@npm:4.0.10" +"@smithy/util-defaults-mode-browser@npm:^4.3.28": + version: 4.3.28 + resolution: "@smithy/util-defaults-mode-browser@npm:4.3.28" dependencies: - "@smithy/property-provider": ^4.0.2 - "@smithy/smithy-client": ^4.2.2 - "@smithy/types": ^4.2.0 - bowser: ^2.11.0 + "@smithy/property-provider": ^4.2.8 + "@smithy/smithy-client": ^4.11.1 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: 86a8e39eb6323b4b1b2556081c69b30418e35536a1cb97d2729f1c59d28470409a848e7da2b96bfdc6dfc4bc6b49d89acf9803ece050d75a91dc423c3c01d44a + checksum: 982623d90d54a0c2f9413613b017cdabd0b4a2d2da072def5ee8982853dc4b9bbae3eae95fa1f3a8aa0c89fea7b25e0309f316f07def3f74eacdaa8982b5b18f languageName: node linkType: hard -"@smithy/util-defaults-mode-node@npm:^4.0.10": - version: 4.0.10 - resolution: "@smithy/util-defaults-mode-node@npm:4.0.10" - dependencies: - "@smithy/config-resolver": ^4.1.0 - "@smithy/credential-provider-imds": ^4.0.2 - "@smithy/node-config-provider": ^4.0.2 - "@smithy/property-provider": ^4.0.2 - "@smithy/smithy-client": ^4.2.2 - "@smithy/types": ^4.2.0 +"@smithy/util-defaults-mode-node@npm:^4.2.31": + version: 4.2.31 + resolution: "@smithy/util-defaults-mode-node@npm:4.2.31" + dependencies: + "@smithy/config-resolver": ^4.4.6 + "@smithy/credential-provider-imds": ^4.2.8 + "@smithy/node-config-provider": ^4.3.8 + "@smithy/property-provider": ^4.2.8 + "@smithy/smithy-client": ^4.11.1 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: 93f02b0a65f6410cb8931e869b83443c433565d9d1f9380436fdbd277b133400ab0d31edfc4cc9dd58c97b125202f8c6123c4c573293c4cc59b32076f99c2f0b + checksum: f298527d411687de4914b091eb7d57c8fbe979a30de4ef5ff9dfa34dab636361289172db6d98d8001c3872741bccd15ba726e6baef73eff16d7f1551a774f0c0 languageName: node linkType: hard -"@smithy/util-endpoints@npm:^3.0.2": - version: 3.0.2 - resolution: "@smithy/util-endpoints@npm:3.0.2" +"@smithy/util-endpoints@npm:^3.2.8": + version: 3.2.8 + resolution: "@smithy/util-endpoints@npm:3.2.8" dependencies: - "@smithy/node-config-provider": ^4.0.2 - "@smithy/types": ^4.2.0 + "@smithy/node-config-provider": ^4.3.8 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: 751b802a7e1f42e3ec70bd35ebe6a0964ee7c4fdd49da28351b28bd4c08438ea02d56230b5bd45787a21e963648453af7c69dc3d0a3a4da22758e5fa7084b2ec + checksum: d50a189c86b18737e513fa20ce46e3c472d87518e377a04683d7997059270f57c8dec80d5e4e0acb0251cd4b3c9a8d8ed1b9cbdd2ed25ada86ffb59a9cadff5b languageName: node linkType: hard -"@smithy/util-hex-encoding@npm:^4.0.0": - version: 4.0.0 - resolution: "@smithy/util-hex-encoding@npm:4.0.0" +"@smithy/util-hex-encoding@npm:^4.2.0": + version: 4.2.0 + resolution: "@smithy/util-hex-encoding@npm:4.2.0" dependencies: tslib: ^2.6.2 - checksum: b932fa0e5cd2ba2598ad55ce46722bbbd15109809badaa3e4402fe4dd6f31f62b9fb49d2616e38d660363dc92a5898391f9c8f3b18507c36109e908400785e2a + checksum: 3c4ea7126245c02257bf0fa49b971eaa9f84d0296023fed7b7eea7fb4622d9d473a9fb2be2a3df765013515f38811b8da028cbf7c2181fafecac69d71299263a languageName: node linkType: hard -"@smithy/util-middleware@npm:^4.0.2": - version: 4.0.2 - resolution: "@smithy/util-middleware@npm:4.0.2" +"@smithy/util-middleware@npm:^4.2.8": + version: 4.2.8 + resolution: "@smithy/util-middleware@npm:4.2.8" dependencies: - "@smithy/types": ^4.2.0 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: 74fdc436056b453fb9365c3c98067ae0d3e4ac0795868946dbecf3816b99996e4c5e5d02604b2bf57a1adda3669cf00b8fc9a3bb9db9af2c8c4de63be9ba9a4a + checksum: bc6b1f549d5e6faced387b2158c56f8b59937853987dbddd0b49da82cc2e97630d718b30c426fd77ecf882ff151c330428e25e2780407aeefbfcfd3c5e2c9a71 languageName: node linkType: hard -"@smithy/util-retry@npm:^4.0.3": - version: 4.0.3 - resolution: "@smithy/util-retry@npm:4.0.3" +"@smithy/util-retry@npm:^4.2.8": + version: 4.2.8 + resolution: "@smithy/util-retry@npm:4.2.8" dependencies: - "@smithy/service-error-classification": ^4.0.3 - "@smithy/types": ^4.2.0 + "@smithy/service-error-classification": ^4.2.8 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: 9cabe7f127729dcd93ef1fd9d5f47d5efe958cac534b51310fdfcfee6c1be2d6146a9c8f5f3bb4ba46d8be95e22d2b5b47de4dc15ab17b3c24b352ba063be0b5 + checksum: a3c84a496c169c5b3a002c9d98bb53cbd8401a81e17fdb6aaf1d2076ce849901c191dc98d62b3bb7bce8529075505ff6d2fd1fa39b1d1967dd24874a1d67920d languageName: node linkType: hard -"@smithy/util-stream@npm:^4.2.0": - version: 4.2.0 - resolution: "@smithy/util-stream@npm:4.2.0" - dependencies: - "@smithy/fetch-http-handler": ^5.0.2 - "@smithy/node-http-handler": ^4.0.4 - "@smithy/types": ^4.2.0 - "@smithy/util-base64": ^4.0.0 - "@smithy/util-buffer-from": ^4.0.0 - "@smithy/util-hex-encoding": ^4.0.0 - "@smithy/util-utf8": ^4.0.0 +"@smithy/util-stream@npm:^4.5.10": + version: 4.5.10 + resolution: "@smithy/util-stream@npm:4.5.10" + dependencies: + "@smithy/fetch-http-handler": ^5.3.9 + "@smithy/node-http-handler": ^4.4.8 + "@smithy/types": ^4.12.0 + "@smithy/util-base64": ^4.3.0 + "@smithy/util-buffer-from": ^4.2.0 + "@smithy/util-hex-encoding": ^4.2.0 + "@smithy/util-utf8": ^4.2.0 tslib: ^2.6.2 - checksum: b392f9464b2e93078e010d8f8e9a6bdb14633ea79eb050e5adcce143721ea2386447e5c565469d636029415d7466e7886c5367750b1d10033a8534ab23121404 + checksum: 0dc406923b0abdd2de6c6b782a3d3722b5192d453f25ebd2ca9821075223d22179a3f174bfb8372fa05fbdcd32d17e16e9fe80bdd65c41aa07155c7a17028b68 languageName: node linkType: hard -"@smithy/util-uri-escape@npm:^4.0.0": - version: 4.0.0 - resolution: "@smithy/util-uri-escape@npm:4.0.0" +"@smithy/util-uri-escape@npm:^4.2.0": + version: 4.2.0 + resolution: "@smithy/util-uri-escape@npm:4.2.0" dependencies: tslib: ^2.6.2 - checksum: 7ea350545971f8a009d56e085c34c949c9045862cfab233ee7adc16e111a076a814bb5d9279b2b85ee382e0ed204a1c673ac32e3e28f1073b62a2c53a5dd6d19 + checksum: 2817dcf7691016ea7e6c63f11793023a814d93345b87013dc20b8dd952e9dfa28c3d90bf7cd9c0568df827d173005317782a26742da70026c64e5f1fdb422942 languageName: node linkType: hard @@ -2939,24 +2993,33 @@ __metadata: languageName: node linkType: hard -"@smithy/util-utf8@npm:^4.0.0": - version: 4.0.0 - resolution: "@smithy/util-utf8@npm:4.0.0" +"@smithy/util-utf8@npm:^4.2.0": + version: 4.2.0 + resolution: "@smithy/util-utf8@npm:4.2.0" dependencies: - "@smithy/util-buffer-from": ^4.0.0 + "@smithy/util-buffer-from": ^4.2.0 tslib: ^2.6.2 - checksum: 08811c5a18c341782b3b65acc4640a9f559aeba61c889dbdc56e5153a3b7f395e613bfb1ade25cf15311d6237f291e1fce8af197c6313065e0cb084fd2148c64 + checksum: 5aeb13cd57b31184ae2bb101c74e232f3621a49dabcfc0de25fdc7668e61e60206e3d80a08dbc84c8199ddd9e267f7e0a7bea3d81d9a60ab5d6aa2369baedd75 languageName: node linkType: hard -"@smithy/util-waiter@npm:^4.0.3": - version: 4.0.3 - resolution: "@smithy/util-waiter@npm:4.0.3" +"@smithy/util-waiter@npm:^4.2.8": + version: 4.2.8 + resolution: "@smithy/util-waiter@npm:4.2.8" dependencies: - "@smithy/abort-controller": ^4.0.2 - "@smithy/types": ^4.2.0 + "@smithy/abort-controller": ^4.2.8 + "@smithy/types": ^4.12.0 tslib: ^2.6.2 - checksum: 90611e62bc70ae03c4de672cdf34f2beb8ac54bfa76ff22b5acbcb4302d9ba7207541a9e5a0145028c8d8aa99e6b276cad300b1a7d2af675661ff942401f5ddb + checksum: eb5d83a2fd5de5a38dcab69e2f483400e4e2c2993de2beaf4f771814dde36e20bb400466323dfe8eccdeb92a6c8e2889fcd63aedb3af9ebb865710a3582c1147 + languageName: node + linkType: hard + +"@smithy/uuid@npm:^1.1.0": + version: 1.1.0 + resolution: "@smithy/uuid@npm:1.1.0" + dependencies: + tslib: ^2.6.2 + checksum: 97b749dc4a57b3e23df6717c990d01c8724c97fe45abe669f17a834e7f12d882f537024db3a8604692658c264c0d9911cf22a8ec86f4cce280a0a4d15e19ceaf languageName: node linkType: hard @@ -2969,17 +3032,10 @@ __metadata: languageName: node linkType: hard -"@solidity-parser/parser@npm:^0.19.0": - version: 0.19.0 - resolution: "@solidity-parser/parser@npm:0.19.0" - checksum: b1c556eeb83ac99f066ea4b0eb0bee45321a667f76dbafef95f8bc6adf32d1f8f52f752fb47620c61d1a264d3acb7534d75a8daa6d21099f55bc52b0af13ad83 - languageName: node - linkType: hard - "@solidity-parser/parser@npm:^0.20.1": - version: 0.20.1 - resolution: "@solidity-parser/parser@npm:0.20.1" - checksum: a05152e54be574b3b75cc6ad059bec01e4ff26c6bc68a0fa4fb9aca3542058c6c657a65d9f3cfb553b986e4143724a8ce98500b3b5453d2f7b2f4397cc32cf63 + version: 0.20.2 + resolution: "@solidity-parser/parser@npm:0.20.2" + checksum: 5623e9b5863d59aab50f0fc98fe81a2b693e64feb29e2cf011a826d0e89374bbb6dfaf3fce48ac5c462251c792042f47805ba2004993182b717314e7d7292cd4 languageName: node linkType: hard @@ -3004,9 +3060,9 @@ __metadata: linkType: hard "@tsconfig/node10@npm:^1.0.7": - version: 1.0.11 - resolution: "@tsconfig/node10@npm:1.0.11" - checksum: 51fe47d55fe1b80ec35e6e5ed30a13665fd3a531945350aa74a14a1e82875fb60b350c2f2a5e72a64831b1b6bc02acb6760c30b3738b54954ec2dea82db7a267 + version: 1.0.12 + resolution: "@tsconfig/node10@npm:1.0.12" + checksum: 27e2f989dbb20f773aa121b609a5361a473b7047ff286fce7c851e61f5eec0c74f0bdb38d5bd69c8a06f17e60e9530188f2219b1cbeabeac91f0a5fd348eac2a languageName: node linkType: hard @@ -3094,11 +3150,11 @@ __metadata: linkType: hard "@types/bn.js@npm:^5.1.0": - version: 5.1.6 - resolution: "@types/bn.js@npm:5.1.6" + version: 5.2.0 + resolution: "@types/bn.js@npm:5.2.0" dependencies: "@types/node": "*" - checksum: 887411126d40e3d28aef2df8075cda2832db2b0e926bb4046039bbb026f2e3cfbcf1a3ce90bd935be0fcc039f8009e32026dfbb84a11c1f5d051cd7f8194ba23 + checksum: 38fb5512e51edd8386d560ac60d9489014cfcea41d8c383ec9070b176f8ea640189afc1b57fe8cbbe570dec8909d8e05fa129097f0dd4e2a34ebdd69cec4b790 languageName: node linkType: hard @@ -3112,11 +3168,12 @@ __metadata: linkType: hard "@types/chai@npm:*": - version: 5.2.2 - resolution: "@types/chai@npm:5.2.2" + version: 5.2.3 + resolution: "@types/chai@npm:5.2.3" dependencies: "@types/deep-eql": "*" - checksum: 386887bd55ba684572cececd833ed91aba6cce2edd8cc1d8cefa78800b3a74db6dbf5c5c41af041d1d1f3ce672ea30b45c9520f948cdc75431eb7df3fbba8405 + assertion-error: ^2.0.1 + checksum: eb4c2da9ec38b474a983f39bfb5ec4fbcceb5e5d76d184094d2cbc4c41357973eb5769c8972cedac665a233251b0ed754f1e338fcf408d381968af85cdecc596 languageName: node linkType: hard @@ -3199,7 +3256,7 @@ __metadata: languageName: node linkType: hard -"@types/lru-cache@npm:5.1.1, @types/lru-cache@npm:^5.1.0": +"@types/lru-cache@npm:5.1.1": version: 5.1.1 resolution: "@types/lru-cache@npm:5.1.1" checksum: e1d6c0085f61b16ec5b3073ec76ad1be4844ea036561c3f145fc19f71f084b58a6eb600b14128aa95809d057d28f1d147c910186ae51219f58366ffd2ff2e118 @@ -3237,21 +3294,21 @@ __metadata: linkType: hard "@types/node-fetch@npm:^2.6.1": - version: 2.6.12 - resolution: "@types/node-fetch@npm:2.6.12" + version: 2.6.13 + resolution: "@types/node-fetch@npm:2.6.13" dependencies: "@types/node": "*" - form-data: ^4.0.0 - checksum: 9647e68f9a125a090220c38d77b3c8e669c488658ae7506f1b4f9568214beba087624b1705bba1dc76649a65281ce3fd5b400e15266cbef8088027fb88777557 + form-data: ^4.0.4 + checksum: e4b4db3a8c23309dadf0beb87e88882af1157f0c08b7b76027ac40add6ed363c924e2fa275f42ae45eacf776b25ed439d14400d9d6372eb39634dd4c7e7e1ad8 languageName: node linkType: hard "@types/node@npm:*, @types/node@npm:>=13.7.0": - version: 22.15.16 - resolution: "@types/node@npm:22.15.16" + version: 25.1.0 + resolution: "@types/node@npm:25.1.0" dependencies: - undici-types: ~6.21.0 - checksum: a90136c365f47da329cc41814dedfb9e8484c1429baf8d8f99c2d427181319bce933371940eb1377b9f73ab0f8c4d40621fece878eee36222283b9982ddf7227 + undici-types: ~7.16.0 + checksum: 7e96871cd81bd12fa9e7da87bbeffcc0b9ffb8972dd4aadc59454430fc9e87a4e3dc63efc66fd1747c462431e46b706f68e8f98261d4e6056bf01c90165e5644 languageName: node linkType: hard @@ -3279,11 +3336,11 @@ __metadata: linkType: hard "@types/node@npm:^18.6.1": - version: 18.19.99 - resolution: "@types/node@npm:18.19.99" + version: 18.19.130 + resolution: "@types/node@npm:18.19.130" dependencies: undici-types: ~5.26.4 - checksum: 59a77f2cd576e852b320d9e4c769cd50ffcad03da6b7311584d56aaf49d007b5fc942492e67cb6bdd5e737d1b5fde56f81c604c4a625e208e19d5828900c079f + checksum: b7032363581c416e721a88cffdc2b47662337cacd20f8294f5619a1abf79615c7fef1521964c2aa9d36ed6aae733e1a03e8c704661bd5a0c2f34b390f41ea395 languageName: node linkType: hard @@ -3311,11 +3368,11 @@ __metadata: linkType: hard "@types/secp256k1@npm:^4.0.1": - version: 4.0.6 - resolution: "@types/secp256k1@npm:4.0.6" + version: 4.0.7 + resolution: "@types/secp256k1@npm:4.0.7" dependencies: "@types/node": "*" - checksum: 984494caf49a4ce99fda2b9ea1840eb47af946b8c2737314108949bcc0c06b4880e871296bd49ed6ea4c8423e3a302ad79fec43abfc987330e7eb98f0c4e8ba4 + checksum: 29c9fd4c2687f323ef546eac4b25676ebe62b74ecfb88d595b0bda26bdf5da2bcc35ee178c333aa024e696434b0ae97930e5fab05f4813c4895e7272fc0bc2d4 languageName: node linkType: hard @@ -3327,9 +3384,9 @@ __metadata: linkType: hard "@types/semver@npm:^7.3.12": - version: 7.7.0 - resolution: "@types/semver@npm:7.7.0" - checksum: d488eaeddb23879a0a8a759bed667e1a76cb0dd4d23e3255538e24c189db387357953ca9e7a3bda2bb7f95e84cac8fe0db4fbe6b3456e893043337732d1d23cc + version: 7.7.1 + resolution: "@types/semver@npm:7.7.1" + checksum: 76d218e414482a398148d5c28f2bfa017108869f3fc18cda379c9d8d062348f8b9653ae2fa8642d3b5b52e211928fe8be34f22da4e1f08245c84e0e51e040673 languageName: node linkType: hard @@ -3344,18 +3401,18 @@ __metadata: linkType: hard "@types/sinon@npm:*": - version: 17.0.4 - resolution: "@types/sinon@npm:17.0.4" + version: 21.0.0 + resolution: "@types/sinon@npm:21.0.0" dependencies: "@types/sinonjs__fake-timers": "*" - checksum: 487f43bda8d8b2ef32d1b3c08e5a68e17705d2c7470ea89c8fd62e3a086f9a35faf65d37a57bf189004c4e7adbc5f9562dfaa332c54e06a8d99fc7361f3ac004 + checksum: 9700d58ee14d4e487519b98c044b1c1c89cc8f1eb844fb4f264a20d5f742da0db94ebdda8a7704dc4e9a460c237e9ae946d32451fd65d8158443d1591084a300 languageName: node linkType: hard "@types/sinonjs__fake-timers@npm:*": - version: 8.1.5 - resolution: "@types/sinonjs__fake-timers@npm:8.1.5" - checksum: 7e3c08f6c13df44f3ea7d9a5155ddf77e3f7314c156fa1c5a829a4f3763bafe2f75b1283b887f06e6b4296996a2f299b70f64ff82625f9af5885436e2524d10c + version: 15.0.1 + resolution: "@types/sinonjs__fake-timers@npm:15.0.1" + checksum: a4bbc3cf17e016db5c4d02bd3a0437a2d104b73dc90c85b96d9e267a14504601f376f7b559855cfade303f55126283c7e8c43a675ac616bfb696e4f489793555 languageName: node linkType: hard @@ -3659,25 +3716,25 @@ __metadata: languageName: node linkType: hard -"abbrev@npm:^3.0.0": - version: 3.0.1 - resolution: "abbrev@npm:3.0.1" - checksum: e70b209f5f408dd3a3bbd0eec4b10a2ffd64704a4a3821d0969d84928cc490a8eb60f85b78a95622c1841113edac10161c62e52f5e7d0027aa26786a8136e02e +"abbrev@npm:^4.0.0": + version: 4.0.0 + resolution: "abbrev@npm:4.0.0" + checksum: d0344b63d28e763f259b4898c41bdc92c08e9d06d0da5617d0bbe4d78244e46daea88c510a2f9472af59b031d9060ec1a999653144e793fd029a59dae2f56dc8 languageName: node linkType: hard -"abitype@npm:1.0.8, abitype@npm:^1.0.6": - version: 1.0.8 - resolution: "abitype@npm:1.0.8" +"abitype@npm:1.2.3, abitype@npm:^1.2.3": + version: 1.2.3 + resolution: "abitype@npm:1.2.3" peerDependencies: typescript: ">=5.0.4" - zod: ^3 >=3.22.0 + zod: ^3.22.0 || ^4.0.0 peerDependenciesMeta: typescript: optional: true zod: optional: true - checksum: 104bc2f6820ced8d2cb61521916f7f22c0981a846216f5b6144f69461265f7da137a4ae108bf4b84cd8743f2dd1e9fdadffc0f95371528e15a59e0a369e08438 + checksum: b5b5620f8e55a6dd7ae829630c0ded02b30f589f0f8f5ca931cdfcf6d7daa8154e30e3fe3593b3f6c4872a955ac55d447ccc2f801fd6a6aa698bdad966e3fe2e languageName: node linkType: hard @@ -3758,11 +3815,11 @@ __metadata: linkType: hard "acorn@npm:^8.11.0, acorn@npm:^8.4.1, acorn@npm:^8.9.0": - version: 8.14.1 - resolution: "acorn@npm:8.14.1" + version: 8.15.0 + resolution: "acorn@npm:8.15.0" bin: acorn: bin/acorn - checksum: 260d9bb6017a1b6e42d31364687f0258f78eb20210b36ef2baad38fd619d78d4e95ff7dde9b3dbe0d81f137f79a8d651a845363a26e6985997f7b71145dc5e94 + checksum: 309c6b49aedf1a2e34aaf266de06de04aab6eb097c02375c66fdeb0f64556a6a823540409914fb364d9a11bc30d79d485a2eba29af47992d3490e9886c4391c3 languageName: node linkType: hard @@ -3797,9 +3854,9 @@ __metadata: linkType: hard "agent-base@npm:^7.1.0, agent-base@npm:^7.1.2": - version: 7.1.3 - resolution: "agent-base@npm:7.1.3" - checksum: 87bb7ee54f5ecf0ccbfcba0b07473885c43ecd76cb29a8db17d6137a19d9f9cd443a2a7c5fd8a3f24d58ad8145f9eb49116344a66b107e1aeab82cf2383f4753 + version: 7.1.4 + resolution: "agent-base@npm:7.1.4" + checksum: 86a7f542af277cfbd77dd61e7df8422f90bac512953709003a1c530171a9d019d072e2400eab2b59f84b49ab9dd237be44315ca663ac73e82b3922d10ea5eafa languageName: node linkType: hard @@ -3838,15 +3895,15 @@ __metadata: linkType: hard "amazon-cognito-identity-js@npm:^6.3.6": - version: 6.3.15 - resolution: "amazon-cognito-identity-js@npm:6.3.15" + version: 6.3.16 + resolution: "amazon-cognito-identity-js@npm:6.3.16" dependencies: "@aws-crypto/sha256-js": 1.2.2 buffer: 4.9.2 fast-base64-decode: ^1.0.0 isomorphic-unfetch: ^3.0.0 js-cookie: ^2.2.1 - checksum: d440f180f46fac797023841c2d9a2087abad3814788cbe179bab0934a4524b2af844da6fe0d89a4dea8ddedec74fb93d0facc1839988516495cb0b982339bb6e + checksum: 0cc29bbf1deb421549636a8c077cb58a2bf8a144072e21c9d750053712b8ff430dd915672e597c04193bdbf314d047ac1ee9483ce901f90ac92b8bbf0d0a841f languageName: node linkType: hard @@ -3859,10 +3916,10 @@ __metadata: "ampleforth-contracts@https://github.com/ampleforth/ampleforth-contracts#master": version: 0.0.1 - resolution: "ampleforth-contracts@https://github.com/ampleforth/ampleforth-contracts.git#commit=1d13ed3bcd32772ddba91355579b87d07e3551db" + resolution: "ampleforth-contracts@https://github.com/ampleforth/ampleforth-contracts.git#commit=701eee27d877f2ad7d0308467968a209d73dcff7" dependencies: "@openzeppelin/contracts-upgradeable": ^4.7.3 - checksum: af4cf9b611cdb3005adebbb33cb7c636056335cae8dd0b02a87a1a2a21f5eeebba7c141fd80119ed02926379938de567f72ea69ccfc55dd36a77c88dfab66422 + checksum: 6edaa415218733c9877729b15d0026620c73b5000e75c7bcfa84c139e3bfe26e9394ad5096aac32dfd1c1bd7ccc9a4a39520759e6bb071f42c678b5c384f9393 languageName: node linkType: hard @@ -3920,9 +3977,9 @@ __metadata: linkType: hard "ansi-regex@npm:^6.0.1": - version: 6.1.0 - resolution: "ansi-regex@npm:6.1.0" - checksum: 495834a53b0856c02acd40446f7130cb0f8284f4a39afdab20d5dc42b2e198b1196119fe887beed8f9055c4ff2055e3b2f6d4641d0be018cdfb64fedf6fc1aac + version: 6.2.2 + resolution: "ansi-regex@npm:6.2.2" + checksum: 9b17ce2c6daecc75bcd5966b9ad672c23b184dc3ed9bf3c98a0702f0d2f736c15c10d461913568f2cf527a5e64291c7473358885dd493305c84a1cfed66ba94f languageName: node linkType: hard @@ -3945,9 +4002,9 @@ __metadata: linkType: hard "ansi-styles@npm:^6.1.0": - version: 6.2.1 - resolution: "ansi-styles@npm:6.2.1" - checksum: ef940f2f0ced1a6347398da88a91da7930c33ecac3c77b72c5905f8b8fe402c52e6fde304ff5347f616e27a742da3f1dc76de98f6866c69251ad0b07a66776d9 + version: 6.2.3 + resolution: "ansi-styles@npm:6.2.3" + checksum: f1b0829cf048cce870a305819f65ce2adcebc097b6d6479e12e955fd6225df9b9eb8b497083b764df796d94383ff20016cc4dbbae5b40f36138fb65a9d33c2e2 languageName: node linkType: hard @@ -4057,17 +4114,19 @@ __metadata: languageName: node linkType: hard -"array-includes@npm:^3.1.8": - version: 3.1.8 - resolution: "array-includes@npm:3.1.8" +"array-includes@npm:^3.1.9": + version: 3.1.9 + resolution: "array-includes@npm:3.1.9" dependencies: - call-bind: ^1.0.7 + call-bind: ^1.0.8 + call-bound: ^1.0.4 define-properties: ^1.2.1 - es-abstract: ^1.23.2 - es-object-atoms: ^1.0.0 - get-intrinsic: ^1.2.4 - is-string: ^1.0.7 - checksum: eb39ba5530f64e4d8acab39297c11c1c5be2a4ea188ab2b34aba5fb7224d918f77717a9d57a3e2900caaa8440e59431bdaf5c974d5212ef65d97f132e38e2d91 + es-abstract: ^1.24.0 + es-object-atoms: ^1.1.1 + get-intrinsic: ^1.3.0 + is-string: ^1.1.1 + math-intrinsics: ^1.1.0 + checksum: b58dc526fe415252e50319eaf88336e06e75aa673e3b58d252414739a4612dbe56e7b613fdcc7c90561dc9cf9202bbe5ca029ccd8c08362746459475ae5a8f3e languageName: node linkType: hard @@ -4078,7 +4137,7 @@ __metadata: languageName: node linkType: hard -"array.prototype.findlastindex@npm:^1.2.5": +"array.prototype.findlastindex@npm:^1.2.6": version: 1.2.6 resolution: "array.prototype.findlastindex@npm:1.2.6" dependencies: @@ -4093,7 +4152,7 @@ __metadata: languageName: node linkType: hard -"array.prototype.flat@npm:^1.3.2": +"array.prototype.flat@npm:^1.3.3": version: 1.3.3 resolution: "array.prototype.flat@npm:1.3.3" dependencies: @@ -4105,7 +4164,7 @@ __metadata: languageName: node linkType: hard -"array.prototype.flatmap@npm:^1.3.2": +"array.prototype.flatmap@npm:^1.3.3": version: 1.3.3 resolution: "array.prototype.flatmap@npm:1.3.3" dependencies: @@ -4172,6 +4231,13 @@ __metadata: languageName: node linkType: hard +"assertion-error@npm:^2.0.1": + version: 2.0.1 + resolution: "assertion-error@npm:2.0.1" + checksum: a0789dd882211b87116e81e2648ccb7f60340b34f19877dd020b39ebb4714e475eb943e14ba3e22201c221ef6645b7bfe10297e76b6ac95b48a9898c1211ce66 + languageName: node + linkType: hard + "ast-parents@npm:^0.0.1": version: 0.0.1 resolution: "ast-parents@npm:0.0.1" @@ -4209,6 +4275,13 @@ __metadata: languageName: node linkType: hard +"async-generator-function@npm:^1.0.0": + version: 1.0.0 + resolution: "async-generator-function@npm:1.0.0" + checksum: 74a71a4a2dd7afd06ebb612f6d612c7f4766a351bedffde466023bf6dae629e46b0d2cd38786239e0fbf245de0c7df76035465e16d1213774a0efb22fec0d713 + languageName: node + linkType: hard + "async-retry@npm:^1.3.3": version: 1.3.3 resolution: "async-retry@npm:1.3.3" @@ -4281,13 +4354,13 @@ __metadata: linkType: hard "axios@npm:^1.6.7, axios@npm:^1.7.4": - version: 1.9.0 - resolution: "axios@npm:1.9.0" + version: 1.13.4 + resolution: "axios@npm:1.13.4" dependencies: follow-redirects: ^1.15.6 - form-data: ^4.0.0 + form-data: ^4.0.4 proxy-from-env: ^1.1.0 - checksum: 631f02c9c279f2ae90637a4989cc9d75c1c27aefd16b6e8eb90f98a4d0bddaccfd1cb1387be12101d1ab0f9bbf0c47e2451b4de0cf2870462a7d9ed3de8da3f2 + checksum: 1d1f360cf54c8a4b602d4d5af1b13f04612be3876a7958e9cd49c5869448399d75978ce4a099839d55ccb9f9aff9d49a312db879dba9d76fac994479fd1ad11c languageName: node linkType: hard @@ -4338,9 +4411,9 @@ __metadata: linkType: hard "bignumber.js@npm:^9.0.0, bignumber.js@npm:^9.1.2": - version: 9.3.0 - resolution: "bignumber.js@npm:9.3.0" - checksum: 580d783d60246e758e527fa879ae0d282d8f250f555dd0fcee1227d680186ceba49ed7964c6d14e2e8d8eac7a2f4dd6ef1b7925dc52f5fc28a5a87639dd2dbd1 + version: 9.3.1 + resolution: "bignumber.js@npm:9.3.1" + checksum: 6ab100271a23a75bb8b99a4b1a34a1a94967ac0b9a52a198147607bd91064e72c6f356380d7a09cd687bf50d81ad2ed1a0a8edfaa90369c9003ed8bb2440d7f0 languageName: node linkType: hard @@ -4422,9 +4495,9 @@ __metadata: linkType: hard "bowser@npm:^2.11.0": - version: 2.11.0 - resolution: "bowser@npm:2.11.0" - checksum: 29c3f01f22e703fa6644fc3b684307442df4240b6e10f6cfe1b61c6ca5721073189ca97cdeedb376081148c8518e33b1d818a57f781d70b0b70e1f31fb48814f + version: 2.13.1 + resolution: "bowser@npm:2.13.1" + checksum: 83ba90bebe4b73ce761b35e13f846e90094919a351fbfe5ddb0b6be869d166648a70b9c97a8bfe1e0c21eee220ff9832ecef5302487efe53b2027d79189926c1 languageName: node linkType: hard @@ -4445,21 +4518,21 @@ __metadata: linkType: hard "brace-expansion@npm:^1.1.7": - version: 1.1.11 - resolution: "brace-expansion@npm:1.1.11" + version: 1.1.12 + resolution: "brace-expansion@npm:1.1.12" dependencies: balanced-match: ^1.0.0 concat-map: 0.0.1 - checksum: faf34a7bb0c3fcf4b59c7808bc5d2a96a40988addf2e7e09dfbb67a2251800e0d14cd2bfc1aa79174f2f5095c54ff27f46fb1289fe2d77dac755b5eb3434cc07 + checksum: 12cb6d6310629e3048cadb003e1aca4d8c9bb5c67c3c321bafdd7e7a50155de081f78ea3e0ed92ecc75a9015e784f301efc8132383132f4f7904ad1ac529c562 languageName: node linkType: hard "brace-expansion@npm:^2.0.1": - version: 2.0.1 - resolution: "brace-expansion@npm:2.0.1" + version: 2.0.2 + resolution: "brace-expansion@npm:2.0.2" dependencies: balanced-match: ^1.0.0 - checksum: a61e7cd2e8a8505e9f0036b3b6108ba5e926b4b55089eeb5550cd04a471fe216c96d4fe7e4c7f995c728c554ae20ddfc4244cad10aef255e72b62930afd233d1 + checksum: 01dff195e3646bc4b0d27b63d9bab84d2ebc06121ff5013ad6e5356daa5a9d6b60fa26cf73c74797f2dc3fbec112af13578d51f75228c1112b26c790a87b0488 languageName: node linkType: hard @@ -4631,30 +4704,29 @@ __metadata: languageName: node linkType: hard -"bytes@npm:3.1.2": +"bytes@npm:~3.1.2": version: 3.1.2 resolution: "bytes@npm:3.1.2" checksum: e4bcd3948d289c5127591fbedf10c0b639ccbf00243504e4e127374a15c3bc8eed0d28d4aaab08ff6f1cf2abc0cce6ba3085ed32f4f90e82a5683ce0014e1b6e languageName: node linkType: hard -"cacache@npm:^19.0.1": - version: 19.0.1 - resolution: "cacache@npm:19.0.1" +"cacache@npm:^20.0.1": + version: 20.0.3 + resolution: "cacache@npm:20.0.3" dependencies: - "@npmcli/fs": ^4.0.0 + "@npmcli/fs": ^5.0.0 fs-minipass: ^3.0.0 - glob: ^10.2.2 - lru-cache: ^10.0.1 + glob: ^13.0.0 + lru-cache: ^11.1.0 minipass: ^7.0.3 minipass-collect: ^2.0.1 minipass-flush: ^1.0.5 minipass-pipeline: ^1.2.4 p-map: ^7.0.2 - ssri: ^12.0.0 - tar: ^7.4.3 - unique-filename: ^4.0.0 - checksum: e95684717de6881b4cdaa949fa7574e3171946421cd8291769dd3d2417dbf7abf4aa557d1f968cca83dcbc95bed2a281072b09abfc977c942413146ef7ed4525 + ssri: ^13.0.0 + unique-filename: ^5.0.0 + checksum: 595e6b91d72972d596e1e9ccab8ddbf08b773f27240220b1b5b1b7b3f52173cfbcf095212e5d7acd86c3bd453c28e69b116469889c511615ef3589523d542639 languageName: node linkType: hard @@ -4726,11 +4798,11 @@ __metadata: linkType: hard "cbor@npm:^10.0.0": - version: 10.0.3 - resolution: "cbor@npm:10.0.3" + version: 10.0.11 + resolution: "cbor@npm:10.0.11" dependencies: nofilter: ^3.0.2 - checksum: 8bb589fae51a43b041f645c64ee5d8c0da77ed67ffaa5b1087f1bd5aac28714fe67b6865054148335d62bff979c44139767b47fdb6033b0f7b30f06d9923c43e + checksum: d293d3ccdb53f8301c58a500bd83ea16b3a7744462113d33d1db1ebaab22f860a09ab007c4c3060abba2dab209ca99417df8da9d1fd79e3b4d95aa90d8f2ae87 languageName: node linkType: hard @@ -4882,12 +4954,13 @@ __metadata: linkType: hard "cipher-base@npm:^1.0.0, cipher-base@npm:^1.0.1, cipher-base@npm:^1.0.3": - version: 1.0.6 - resolution: "cipher-base@npm:1.0.6" + version: 1.0.7 + resolution: "cipher-base@npm:1.0.7" dependencies: inherits: ^2.0.4 safe-buffer: ^5.2.1 - checksum: 64a1738a8583163cf096bc85321a69ef3075bb0873f34cf89dc705e62b9eee058dd6b2e5c672f774ede0b6bdbe56fe7b710e0d38c4f08a2f355d8ab828f05c6f + to-buffer: ^1.2.2 + checksum: 3c3b5ddd8c8bfbb68fdd134c4c6db408b57a81f19260c59a5e1f5b75cb67fc5a0127af2ffb84a14720c9d249226659544c593245123f42285c82267cf787b883 languageName: node linkType: hard @@ -5118,9 +5191,9 @@ __metadata: linkType: hard "core-js-pure@npm:^3.0.1": - version: 3.42.0 - resolution: "core-js-pure@npm:3.42.0" - checksum: 37f2488e810db5ea23f623458b8d5861a5a858cde1b4d5777c89b531b00775a3df2cf814f69af0d9d16a421094f6c640c4466b9f86a8580d65263e3219c75440 + version: 3.48.0 + resolution: "core-js-pure@npm:3.48.0" + checksum: fdc8a26fa7d2cf7809c7943494660442267666a048d74739900b6a1ba7e4e52815d8203ef453d81ddd1b3dade5880a1275fefc13d884686e71a85e7fcdd69790 languageName: node linkType: hard @@ -5190,7 +5263,7 @@ __metadata: languageName: node linkType: hard -"create-hmac@npm:^1.1.4, create-hmac@npm:^1.1.7": +"create-hmac@npm:^1.1.7": version: 1.1.7 resolution: "create-hmac@npm:1.1.7" dependencies: @@ -5292,14 +5365,14 @@ __metadata: linkType: hard "debug@npm:4, debug@npm:^4.0.1, debug@npm:^4.1.1, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4, debug@npm:^4.3.5": - version: 4.4.0 - resolution: "debug@npm:4.4.0" + version: 4.4.3 + resolution: "debug@npm:4.4.3" dependencies: ms: ^2.1.3 peerDependenciesMeta: supports-color: optional: true - checksum: fb42df878dd0e22816fc56e1fdca9da73caa85212fbe40c868b1295a6878f9101ae684f4eeef516c13acfc700f5ea07f1136954f43d4cd2d477a811144136479 + checksum: 4805abd570e601acdca85b6aa3757186084a45cff9b2fa6eee1f3b173caa776b45f478b2a71a572d616d2010cea9211d0ac4a02a610e4c18ac4324bde3760834 languageName: node linkType: hard @@ -5413,7 +5486,7 @@ __metadata: languageName: node linkType: hard -"depd@npm:2.0.0": +"depd@npm:~2.0.0": version: 2.0.0 resolution: "depd@npm:2.0.0" checksum: abbe19c768c97ee2eed6282d8ce3031126662252c58d711f646921c9623f9052e3e1906443066beec1095832f534e57c523b7333f8e7e0d93051ab6baef5ab3a @@ -5421,16 +5494,16 @@ __metadata: linkType: hard "diff@npm:^4.0.1": - version: 4.0.2 - resolution: "diff@npm:4.0.2" - checksum: f2c09b0ce4e6b301c221addd83bf3f454c0bc00caa3dd837cf6c127d6edf7223aa2bbe3b688feea110b7f262adbfc845b757c44c8a9f8c0c5b15d8fa9ce9d20d + version: 4.0.4 + resolution: "diff@npm:4.0.4" + checksum: e3f1c368778b16f9e7e4fd4199d04913bba9b017c37fbca7642b3613ebefcf3b18a4bd55e5f7074dc023fc95c96bd265f72114044e62cebae7f9a0f53bc36ace languageName: node linkType: hard "diff@npm:^5.2.0": - version: 5.2.0 - resolution: "diff@npm:5.2.0" - checksum: 12b63ca9c36c72bafa3effa77121f0581b4015df18bc16bac1f8e263597735649f1a173c26f7eba17fb4162b073fee61788abe49610e6c70a2641fe1895443fd + version: 5.2.2 + resolution: "diff@npm:5.2.2" + checksum: a1af5d6322ca6312279369665b5a9e6d54cd2aed42729a30523e174ccd14661a752bf10d75deec8763964cab3df3787fe816f88e9de7ee8fe774852007269d88 languageName: node linkType: hard @@ -5514,9 +5587,9 @@ __metadata: linkType: hard "dotenv@npm:^16.0.1": - version: 16.5.0 - resolution: "dotenv@npm:16.5.0" - checksum: 6543fe87b5ddf2d60dd42df6616eec99148a5fc150cb4530fef5bda655db5204a3afa0e6f25f7cd64b20657ace4d79c0ef974bec32fdb462cad18754191e7a90 + version: 16.6.1 + resolution: "dotenv@npm:16.6.1" + checksum: e8bd63c9a37f57934f7938a9cf35de698097fadf980cb6edb61d33b3e424ceccfe4d10f37130b904a973b9038627c2646a3365a904b4406514ea94d7f1816b69 languageName: node linkType: hard @@ -5629,11 +5702,11 @@ __metadata: linkType: hard "end-of-stream@npm:^1.0.0, end-of-stream@npm:^1.1.0": - version: 1.4.4 - resolution: "end-of-stream@npm:1.4.4" + version: 1.4.5 + resolution: "end-of-stream@npm:1.4.5" dependencies: once: ^1.4.0 - checksum: 530a5a5a1e517e962854a31693dbb5c0b2fc40b46dad2a56a2deec656ca040631124f4795823acc68238147805f8b021abbe221f4afed5ef3c8e8efc2024908b + checksum: 1e0cfa6e7f49887544e03314f9dfc56a8cb6dde910cbb445983ecc2ff426fc05946df9d75d8a21a3a64f2cecfe1bf88f773952029f46756b2ed64a24e95b1fb8 languageName: node linkType: hard @@ -5689,34 +5762,34 @@ __metadata: linkType: hard "error-ex@npm:^1.3.1": - version: 1.3.2 - resolution: "error-ex@npm:1.3.2" + version: 1.3.4 + resolution: "error-ex@npm:1.3.4" dependencies: is-arrayish: ^0.2.1 - checksum: c1c2b8b65f9c91b0f9d75f0debaa7ec5b35c266c2cac5de412c1a6de86d4cbae04ae44e510378cb14d032d0645a36925d0186f8bb7367bcc629db256b743a001 + checksum: 25136c0984569c8d68417036a9a1624804314296f24675199a391e5d20b2e26fe6d9304d40901293fa86900603a229983c9a8921ea7f1d16f814c2db946ff4ef languageName: node linkType: hard -"es-abstract@npm:^1.23.2, es-abstract@npm:^1.23.5, es-abstract@npm:^1.23.9": - version: 1.23.9 - resolution: "es-abstract@npm:1.23.9" +"es-abstract@npm:^1.23.2, es-abstract@npm:^1.23.5, es-abstract@npm:^1.23.9, es-abstract@npm:^1.24.0": + version: 1.24.1 + resolution: "es-abstract@npm:1.24.1" dependencies: array-buffer-byte-length: ^1.0.2 arraybuffer.prototype.slice: ^1.0.4 available-typed-arrays: ^1.0.7 call-bind: ^1.0.8 - call-bound: ^1.0.3 + call-bound: ^1.0.4 data-view-buffer: ^1.0.2 data-view-byte-length: ^1.0.2 data-view-byte-offset: ^1.0.1 es-define-property: ^1.0.1 es-errors: ^1.3.0 - es-object-atoms: ^1.0.0 + es-object-atoms: ^1.1.1 es-set-tostringtag: ^2.1.0 es-to-primitive: ^1.3.0 function.prototype.name: ^1.1.8 - get-intrinsic: ^1.2.7 - get-proto: ^1.0.0 + get-intrinsic: ^1.3.0 + get-proto: ^1.0.1 get-symbol-description: ^1.1.0 globalthis: ^1.0.4 gopd: ^1.2.0 @@ -5728,21 +5801,24 @@ __metadata: is-array-buffer: ^3.0.5 is-callable: ^1.2.7 is-data-view: ^1.0.2 + is-negative-zero: ^2.0.3 is-regex: ^1.2.1 + is-set: ^2.0.3 is-shared-array-buffer: ^1.0.4 is-string: ^1.1.1 is-typed-array: ^1.1.15 - is-weakref: ^1.1.0 + is-weakref: ^1.1.1 math-intrinsics: ^1.1.0 - object-inspect: ^1.13.3 + object-inspect: ^1.13.4 object-keys: ^1.1.1 object.assign: ^4.1.7 own-keys: ^1.0.1 - regexp.prototype.flags: ^1.5.3 + regexp.prototype.flags: ^1.5.4 safe-array-concat: ^1.1.3 safe-push-apply: ^1.0.0 safe-regex-test: ^1.1.0 set-proto: ^1.0.0 + stop-iteration-iterator: ^1.1.0 string.prototype.trim: ^1.2.10 string.prototype.trimend: ^1.0.9 string.prototype.trimstart: ^1.0.8 @@ -5751,8 +5827,8 @@ __metadata: typed-array-byte-offset: ^1.0.4 typed-array-length: ^1.0.7 unbox-primitive: ^1.1.0 - which-typed-array: ^1.1.18 - checksum: f3ee2614159ca197f97414ab36e3f406ee748ce2f97ffbf09e420726db5a442ce13f1e574601468bff6e6eb81588e6c9ce1ac6c03868a37c7cd48ac679f8485a + which-typed-array: ^1.1.19 + checksum: 84896f97ac812bd9d884f1e5372ae71dbdbef364d2e178defdb712a0aae8c9df66f447b472ad54e3e1fa5aa9a84f3c11b5f35007d629cf975699c5f885aeb0c5 languageName: node linkType: hard @@ -5881,13 +5957,13 @@ __metadata: linkType: hard "eslint-config-prettier@npm:^8.5.0": - version: 8.10.0 - resolution: "eslint-config-prettier@npm:8.10.0" + version: 8.10.2 + resolution: "eslint-config-prettier@npm:8.10.2" peerDependencies: eslint: ">=7.0.0" bin: eslint-config-prettier: bin/cli.js - checksum: 153266badd477e49b0759816246b2132f1dbdb6c7f313ca60a9af5822fd1071c2bc5684a3720d78b725452bbac04bb130878b2513aea5e72b1b792de5a69fec8 + checksum: a92b7e8a996e65adf79de1579524235687e9d3552d088cfab4f170da60d23762addb4276169c8ca3a9551329dda8408c59f7e414101b238a6385379ac1bc3b16 languageName: node linkType: hard @@ -5914,15 +5990,15 @@ __metadata: languageName: node linkType: hard -"eslint-module-utils@npm:^2.12.0": - version: 2.12.0 - resolution: "eslint-module-utils@npm:2.12.0" +"eslint-module-utils@npm:^2.12.1": + version: 2.12.1 + resolution: "eslint-module-utils@npm:2.12.1" dependencies: debug: ^3.2.7 peerDependenciesMeta: eslint: optional: true - checksum: be3ac52e0971c6f46daeb1a7e760e45c7c45f820c8cc211799f85f10f04ccbf7afc17039165d56cb2da7f7ca9cec2b3a777013cddf0b976784b37eb9efa24180 + checksum: 2f074670d8c934687820a83140048776b28bbaf35fc37f35623f63cc9c438d496d11f0683b4feabb9a120435435d4a69604b1c6c567f118be2c9a0aba6760fc1 languageName: node linkType: hard @@ -5951,31 +6027,31 @@ __metadata: linkType: hard "eslint-plugin-import@npm:^2.26.0": - version: 2.31.0 - resolution: "eslint-plugin-import@npm:2.31.0" + version: 2.32.0 + resolution: "eslint-plugin-import@npm:2.32.0" dependencies: "@rtsao/scc": ^1.1.0 - array-includes: ^3.1.8 - array.prototype.findlastindex: ^1.2.5 - array.prototype.flat: ^1.3.2 - array.prototype.flatmap: ^1.3.2 + array-includes: ^3.1.9 + array.prototype.findlastindex: ^1.2.6 + array.prototype.flat: ^1.3.3 + array.prototype.flatmap: ^1.3.3 debug: ^3.2.7 doctrine: ^2.1.0 eslint-import-resolver-node: ^0.3.9 - eslint-module-utils: ^2.12.0 + eslint-module-utils: ^2.12.1 hasown: ^2.0.2 - is-core-module: ^2.15.1 + is-core-module: ^2.16.1 is-glob: ^4.0.3 minimatch: ^3.1.2 object.fromentries: ^2.0.8 object.groupby: ^1.0.3 - object.values: ^1.2.0 + object.values: ^1.2.1 semver: ^6.3.1 - string.prototype.trimend: ^1.0.8 + string.prototype.trimend: ^1.0.9 tsconfig-paths: ^3.15.0 peerDependencies: eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 || ^9 - checksum: b1d2ac268b3582ff1af2a72a2c476eae4d250c100f2e335b6e102036e4a35efa530b80ec578dfc36761fabb34a635b9bf5ab071abe9d4404a4bb054fdf22d415 + checksum: 8cd40595b5e4346d3698eb577014b4b6d0ba57b7b9edf975be4f052a89330ec202d0cc5c3861d37ebeafa151b6264821410243889b0c31710911a6b625bcf76b languageName: node linkType: hard @@ -6021,8 +6097,8 @@ __metadata: linkType: hard "eslint-plugin-prettier@npm:^4.2.1": - version: 4.2.1 - resolution: "eslint-plugin-prettier@npm:4.2.1" + version: 4.2.5 + resolution: "eslint-plugin-prettier@npm:4.2.5" dependencies: prettier-linter-helpers: ^1.0.0 peerDependencies: @@ -6031,7 +6107,7 @@ __metadata: peerDependenciesMeta: eslint-config-prettier: optional: true - checksum: b9e839d2334ad8ec7a5589c5cb0f219bded260839a857d7a486997f9870e95106aa59b8756ff3f37202085ebab658de382b0267cae44c3a7f0eb0bcc03a4f6d6 + checksum: 22c29ba685f18516e3b1595e062849ccc108996a759da6067ff5d876519a5f81c8ba92c0c5623a1c62b593d417619ba44ab3b6ec1450ca753c078fd92970b883 languageName: node linkType: hard @@ -6274,11 +6350,11 @@ __metadata: linkType: hard "esquery@npm:^1.0.1, esquery@npm:^1.4.2": - version: 1.6.0 - resolution: "esquery@npm:1.6.0" + version: 1.7.0 + resolution: "esquery@npm:1.7.0" dependencies: estraverse: ^5.1.0 - checksum: 08ec4fe446d9ab27186da274d979558557fbdbbd10968fa9758552482720c54152a5640e08b9009e5a30706b66aba510692054d4129d32d0e12e05bbc0b96fb2 + checksum: 3239792b68cf39fe18966d0ca01549bb15556734f0144308fd213739b0f153671ae916013fce0bca032044a4dbcda98b43c1c667f20c20a54dec3597ac0d7c27 languageName: node linkType: hard @@ -6482,9 +6558,9 @@ __metadata: languageName: node linkType: hard -"ethers@npm:^6.14.4": - version: 6.14.4 - resolution: "ethers@npm:6.14.4" +"ethers@npm:^6.14.4, ethers@npm:^6.6.0": + version: 6.16.0 + resolution: "ethers@npm:6.16.0" dependencies: "@adraffy/ens-normalize": 1.10.1 "@noble/curves": 1.2.0 @@ -6493,22 +6569,7 @@ __metadata: aes-js: 4.0.0-beta.5 tslib: 2.7.0 ws: 8.17.1 - checksum: 9f7e651ef3ee8c158c5bfd067cb048b3b4367d2d68b575b8777e1cf1eb337a7487cd4e34925cfe421b9a28de12bbd062d08575c1f7b6b0601e32b98edc9c708e - languageName: node - linkType: hard - -"ethers@npm:^6.6.0": - version: 6.14.0 - resolution: "ethers@npm:6.14.0" - dependencies: - "@adraffy/ens-normalize": 1.10.1 - "@noble/curves": 1.2.0 - "@noble/hashes": 1.3.2 - "@types/node": 22.7.5 - aes-js: 4.0.0-beta.5 - tslib: 2.7.0 - ws: 8.17.1 - checksum: 937cab802131b289ca9a278fce595dff5977d358c5e2c72603e321a67a3ed531b4c19ddeec555d53fd474f75e101d599b6962cb3e33a691b526ecfebed9482d8 + checksum: f96c54d35aa09d6700dbbe732db160d66f2a1acd59f2820e307869be478bb5c4c3fd0f34a5d51014cbea04200e6e9776290f521795492688c8d67052bf8a1e2a languageName: node linkType: hard @@ -6591,9 +6652,9 @@ __metadata: linkType: hard "exponential-backoff@npm:^3.1.1": - version: 3.1.2 - resolution: "exponential-backoff@npm:3.1.2" - checksum: 7e191e3dd6edd8c56c88f2c8037c98fbb8034fe48778be53ed8cb30ccef371a061a4e999a469aab939b92f8f12698f3b426d52f4f76b7a20da5f9f98c3cbc862 + version: 3.1.3 + resolution: "exponential-backoff@npm:3.1.3" + checksum: 471fdb70fd3d2c08a74a026973bdd4105b7832911f610ca67bbb74e39279411c1eed2f2a110c9d41c2edd89459ba58fdaba1c174beed73e7a42d773882dcff82 languageName: node linkType: hard @@ -6692,41 +6753,41 @@ __metadata: linkType: hard "fast-uri@npm:^3.0.1": - version: 3.0.6 - resolution: "fast-uri@npm:3.0.6" - checksum: 7161ba2a7944778d679ba8e5f00d6a2bb479a2142df0982f541d67be6c979b17808f7edbb0ce78161c85035974bde3fa52b5137df31da46c0828cb629ba67c4e + version: 3.1.0 + resolution: "fast-uri@npm:3.1.0" + checksum: daab0efd3548cc53d0db38ecc764d125773f8bd70c34552ff21abdc6530f26fa4cb1771f944222ca5e61a0a1a85d01a104848ff88c61736de445d97bd616ea7e languageName: node linkType: hard -"fast-xml-parser@npm:4.4.1": - version: 4.4.1 - resolution: "fast-xml-parser@npm:4.4.1" +"fast-xml-parser@npm:5.2.5": + version: 5.2.5 + resolution: "fast-xml-parser@npm:5.2.5" dependencies: - strnum: ^1.0.5 + strnum: ^2.1.0 bin: fxparser: src/cli/cli.js - checksum: f440c01cd141b98789ae777503bcb6727393296094cc82924ae9f88a5b971baa4eec7e65306c7e07746534caa661fc83694ff437d9012dc84dee39dfbfaab947 + checksum: b12daa933bc226bd7df1e1ecbd305e561c83fd6e4a234b5e2728901deca25a9b9522b9d3ebafde41b1f4d87ab814e3efe18c636638580795fdbe4670a556be88 languageName: node linkType: hard "fastq@npm:^1.6.0": - version: 1.19.1 - resolution: "fastq@npm:1.19.1" + version: 1.20.1 + resolution: "fastq@npm:1.20.1" dependencies: reusify: ^1.0.4 - checksum: 7691d1794fb84ad0ec2a185f10e00f0e1713b894e2c9c4d42f0bc0ba5f8c00e6e655a202074ca0b91b9c3d977aab7c30c41a8dc069fb5368576ac0054870a0e6 + checksum: 49128edbf05e682bee3c1db3d2dfc7da195469065ef014d8368c555d829932313ae2ddf584bb03146409b0d5d9fdb387c471075483a7319b52f777ad91128ed8 languageName: node linkType: hard -"fdir@npm:^6.4.4": - version: 6.4.4 - resolution: "fdir@npm:6.4.4" +"fdir@npm:^6.5.0": + version: 6.5.0 + resolution: "fdir@npm:6.5.0" peerDependencies: picomatch: ^3 || ^4 peerDependenciesMeta: picomatch: optional: true - checksum: 79043610236579ffbd0647c508b43bd030a2d034a17c43cf96813a00e8e92e51acdb115c6ddecef3b5812cc2692b976155b4f6413e51e3761f1e772fa019a321 + checksum: bd537daa9d3cd53887eed35efa0eab2dbb1ca408790e10e024120e7a36c6e9ae2b33710cb8381e35def01bc9c1d7eaba746f886338413e68ff6ebaee07b9a6e8 languageName: node linkType: hard @@ -6840,12 +6901,12 @@ __metadata: linkType: hard "follow-redirects@npm:^1.12.1, follow-redirects@npm:^1.14.0, follow-redirects@npm:^1.15.6": - version: 1.15.9 - resolution: "follow-redirects@npm:1.15.9" + version: 1.15.11 + resolution: "follow-redirects@npm:1.15.11" peerDependenciesMeta: debug: optional: true - checksum: 859e2bacc7a54506f2bf9aacb10d165df78c8c1b0ceb8023f966621b233717dab56e8d08baadc3ad3b9db58af290413d585c999694b7c146aaf2616340c3d2a6 + checksum: 20bf55e9504f59e6cc3743ba27edb2ebf41edea1baab34799408f2c050f73f0c612728db21c691276296d2795ea8a812dc532a98e8793619fcab91abe06d017f languageName: node linkType: hard @@ -6875,15 +6936,16 @@ __metadata: languageName: node linkType: hard -"form-data@npm:^4.0.0": - version: 4.0.2 - resolution: "form-data@npm:4.0.2" +"form-data@npm:^4.0.4": + version: 4.0.5 + resolution: "form-data@npm:4.0.5" dependencies: asynckit: ^0.4.0 combined-stream: ^1.0.8 es-set-tostringtag: ^2.1.0 + hasown: ^2.0.2 mime-types: ^2.1.12 - checksum: e887298b22c13c7c9c5a8ba3716f295a479a13ca78bfd855ef11cbce1bcf22bc0ae2062e94808e21d46e5c667664a1a1a8a7f57d7040193c1fefbfb11af58aab + checksum: af8328413c16d0cded5fccc975a44d227c5120fd46a9e81de8acf619d43ed838414cc6d7792195b30b248f76a65246949a129a4dadd148721948f90cd6d4fb69 languageName: node linkType: hard @@ -7072,6 +7134,13 @@ __metadata: languageName: node linkType: hard +"generator-function@npm:^2.0.0": + version: 2.0.1 + resolution: "generator-function@npm:2.0.1" + checksum: 3bf87f7b0230de5d74529677e6c3ceb3b7b5d9618b5a22d92b45ce3876defbaf5a77791b25a61b0fa7d13f95675b5ff67a7769f3b9af33f096e34653519e873d + languageName: node + linkType: hard + "get-caller-file@npm:^2.0.1, get-caller-file@npm:^2.0.5": version: 2.0.5 resolution: "get-caller-file@npm:2.0.5" @@ -7087,20 +7156,23 @@ __metadata: linkType: hard "get-intrinsic@npm:^1.2.4, get-intrinsic@npm:^1.2.5, get-intrinsic@npm:^1.2.6, get-intrinsic@npm:^1.2.7, get-intrinsic@npm:^1.3.0": - version: 1.3.0 - resolution: "get-intrinsic@npm:1.3.0" + version: 1.3.1 + resolution: "get-intrinsic@npm:1.3.1" dependencies: + async-function: ^1.0.0 + async-generator-function: ^1.0.0 call-bind-apply-helpers: ^1.0.2 es-define-property: ^1.0.1 es-errors: ^1.3.0 es-object-atoms: ^1.1.1 function-bind: ^1.1.2 + generator-function: ^2.0.0 get-proto: ^1.0.1 gopd: ^1.2.0 has-symbols: ^1.1.0 hasown: ^2.0.2 math-intrinsics: ^1.1.0 - checksum: 301008e4482bb9a9cb49e132b88fee093bff373b4e6def8ba219b1e96b60158a6084f273ef5cafe832e42cd93462f4accb46a618d35fe59a2b507f2388c5b79d + checksum: c02b3b6a445f9cd53e14896303794ac60f9751f58a69099127248abdb0251957174c6524245fc68579dc8e6a35161d3d94c93e665f808274716f4248b269436a languageName: node linkType: hard @@ -7111,7 +7183,7 @@ __metadata: languageName: node linkType: hard -"get-proto@npm:^1.0.0, get-proto@npm:^1.0.1": +"get-proto@npm:^1.0.1": version: 1.0.1 resolution: "get-proto@npm:1.0.1" dependencies: @@ -7210,9 +7282,9 @@ __metadata: languageName: node linkType: hard -"glob@npm:^10.2.2, glob@npm:^10.3.10": - version: 10.4.5 - resolution: "glob@npm:10.4.5" +"glob@npm:^10.3.10": + version: 10.5.0 + resolution: "glob@npm:10.5.0" dependencies: foreground-child: ^3.1.0 jackspeak: ^3.1.2 @@ -7222,7 +7294,18 @@ __metadata: path-scurry: ^1.11.1 bin: glob: dist/esm/bin.mjs - checksum: 0bc725de5e4862f9f387fd0f2b274baf16850dcd2714502ccf471ee401803997983e2c05590cb65f9675a3c6f2a58e7a53f9e365704108c6ad3cbf1d60934c4a + checksum: cda96c074878abca9657bd984d2396945cf0d64283f6feeb40d738fe2da642be0010ad5210a1646244a5fc3511b0cab5a374569b3de5a12b8a63d392f18c6043 + languageName: node + linkType: hard + +"glob@npm:^13.0.0": + version: 13.0.0 + resolution: "glob@npm:13.0.0" + dependencies: + minimatch: ^10.1.1 + minipass: ^7.1.2 + path-scurry: ^2.0.0 + checksum: 963730222b0acc85a0d2616c08ba3a5d5b5f33fbf69182791967b8a02245db505577a6fc19836d5d58e1cbbfb414ad4f62f605a0372ab05cd9e6998efe944369 languageName: node linkType: hard @@ -7448,13 +7531,13 @@ __metadata: linkType: hard "hardhat-gas-reporter@npm:latest": - version: 2.2.3 - resolution: "hardhat-gas-reporter@npm:2.2.3" + version: 2.3.0 + resolution: "hardhat-gas-reporter@npm:2.3.0" dependencies: "@ethersproject/abi": ^5.7.0 "@ethersproject/bytes": ^5.7.0 "@ethersproject/units": ^5.7.0 - "@solidity-parser/parser": ^0.19.0 + "@solidity-parser/parser": ^0.20.1 axios: ^1.6.7 brotli-wasm: ^2.0.1 chalk: 4.1.2 @@ -7468,80 +7551,19 @@ __metadata: viem: ^2.27.0 peerDependencies: hardhat: ^2.16.0 - checksum: fcbc73ad000b2fdd18eb430f2ecaa5e74e6d7a7795a5c9631999bf2f826c20702f96793af92d6b14916e76729be19086b84b5fb8327db1c54b542ec4f48dfb61 - languageName: node - linkType: hard - -"hardhat@npm:^2.23.0": - version: 2.24.0 - resolution: "hardhat@npm:2.24.0" - dependencies: - "@ethereumjs/util": ^9.1.0 - "@ethersproject/abi": ^5.1.2 - "@nomicfoundation/edr": ^0.11.0 - "@nomicfoundation/solidity-analyzer": ^0.1.0 - "@sentry/node": ^5.18.1 - "@types/bn.js": ^5.1.0 - "@types/lru-cache": ^5.1.0 - adm-zip: ^0.4.16 - aggregate-error: ^3.0.0 - ansi-escapes: ^4.3.0 - boxen: ^5.1.2 - chokidar: ^4.0.0 - ci-info: ^2.0.0 - debug: ^4.1.1 - enquirer: ^2.3.0 - env-paths: ^2.2.0 - ethereum-cryptography: ^1.0.3 - find-up: ^5.0.0 - fp-ts: 1.19.3 - fs-extra: ^7.0.1 - immutable: ^4.0.0-rc.12 - io-ts: 1.10.4 - json-stream-stringify: ^3.1.4 - keccak: ^3.0.2 - lodash: ^4.17.11 - micro-eth-signer: ^0.14.0 - mnemonist: ^0.38.0 - mocha: ^10.0.0 - p-map: ^4.0.0 - picocolors: ^1.1.0 - raw-body: ^2.4.1 - resolve: 1.17.0 - semver: ^6.3.0 - solc: 0.8.26 - source-map-support: ^0.5.13 - stacktrace-parser: ^0.1.10 - tinyglobby: ^0.2.6 - tsort: 0.0.1 - undici: ^5.14.0 - uuid: ^8.3.2 - ws: ^7.4.6 - peerDependencies: - ts-node: "*" - typescript: "*" - peerDependenciesMeta: - ts-node: - optional: true - typescript: - optional: true - bin: - hardhat: internal/cli/bootstrap.js - checksum: 405b10e5ac074389c4b14b412b681eee04ad92451e786ea6ffe1448337c40a9b27ee4a881707f976e49bd972876e6e41933a09ded3270b35a2bcbba0d76d2326 + checksum: 055c4e99c8628a2a7e26bf80b12e91933a3a8e301e2c8a130be0590608d3b59f36ac5e6dff90d436e72063995936dd2107a6c01e39b51b9a9b9f11874ae7a103 languageName: node linkType: hard -"hardhat@npm:^2.24.1": - version: 2.24.1 - resolution: "hardhat@npm:2.24.1" +"hardhat@npm:^2.23.0, hardhat@npm:^2.24.1": + version: 2.28.4 + resolution: "hardhat@npm:2.28.4" dependencies: "@ethereumjs/util": ^9.1.0 "@ethersproject/abi": ^5.1.2 - "@nomicfoundation/edr": ^0.11.0 + "@nomicfoundation/edr": 0.12.0-next.22 "@nomicfoundation/solidity-analyzer": ^0.1.0 "@sentry/node": ^5.18.1 - "@types/bn.js": ^5.1.0 - "@types/lru-cache": ^5.1.0 adm-zip: ^0.4.16 aggregate-error: ^3.0.0 ansi-escapes: ^4.3.0 @@ -7586,7 +7608,7 @@ __metadata: optional: true bin: hardhat: internal/cli/bootstrap.js - checksum: 98fa6022a25986343318709e2699c0f1b1c466e68fe6074a6e838ddeddb2cb53ccb9d6f572e809513a30eefa82a00fcad2220c5e2c7f9fad4f1436c9755c01d9 + checksum: ad1588e6f67b7bb9b4d89434bfce0f60c410e7d6c32d234f7ee7fdc7388536d2906039b9faf10ae931b18815b917069a941fd0b52cd0ce984c23c67e0d08e9b4 languageName: node linkType: hard @@ -7652,14 +7674,15 @@ __metadata: languageName: node linkType: hard -"hash-base@npm:^3.0.0": - version: 3.1.0 - resolution: "hash-base@npm:3.1.0" +"hash-base@npm:^3.0.0, hash-base@npm:^3.1.2": + version: 3.1.2 + resolution: "hash-base@npm:3.1.2" dependencies: inherits: ^2.0.4 - readable-stream: ^3.6.0 - safe-buffer: ^5.2.0 - checksum: 26b7e97ac3de13cb23fc3145e7e3450b0530274a9562144fc2bf5c1e2983afd0e09ed7cc3b20974ba66039fad316db463da80eb452e7373e780cbee9a0d2f2dc + readable-stream: ^2.3.8 + safe-buffer: ^5.2.1 + to-buffer: ^1.2.1 + checksum: ca7c548098ca2aa3616f8ddb0406c9cadd0fbc35868d885200692b13a3b6d5b30e2b55ab808ff6000c69f11b3c26fd98e5955b1484d79a59fbd07d1d6b65ca4b languageName: node linkType: hard @@ -7717,22 +7740,22 @@ __metadata: linkType: hard "http-cache-semantics@npm:^4.1.1": - version: 4.1.1 - resolution: "http-cache-semantics@npm:4.1.1" - checksum: 83ac0bc60b17a3a36f9953e7be55e5c8f41acc61b22583060e8dedc9dd5e3607c823a88d0926f9150e571f90946835c7fe150732801010845c72cd8bbff1a236 + version: 4.2.0 + resolution: "http-cache-semantics@npm:4.2.0" + checksum: 7a7246ddfce629f96832791176fd643589d954e6f3b49548dadb4290451961237fab8fcea41cd2008fe819d95b41c1e8b97f47d088afc0a1c81705287b4ddbcc languageName: node linkType: hard -"http-errors@npm:2.0.0": - version: 2.0.0 - resolution: "http-errors@npm:2.0.0" +"http-errors@npm:~2.0.1": + version: 2.0.1 + resolution: "http-errors@npm:2.0.1" dependencies: - depd: 2.0.0 - inherits: 2.0.4 - setprototypeof: 1.2.0 - statuses: 2.0.1 - toidentifier: 1.0.1 - checksum: 9b0a3782665c52ce9dc658a0d1560bcb0214ba5699e4ea15aefb2a496e2ca83db03ebc42e1cce4ac1f413e4e0d2d736a3fd755772c556a9a06853ba2a0b7d920 + depd: ~2.0.0 + inherits: ~2.0.4 + setprototypeof: ~1.2.0 + statuses: ~2.0.2 + toidentifier: ~1.0.1 + checksum: 155d1a100a06e4964597013109590b97540a177b69c3600bbc93efc746465a99a2b718f43cdf76b3791af994bbe3a5711002046bf668cdc007ea44cea6df7ccd languageName: node linkType: hard @@ -7784,7 +7807,7 @@ __metadata: languageName: node linkType: hard -"iconv-lite@npm:0.4.24, iconv-lite@npm:^0.4.24": +"iconv-lite@npm:^0.4.24, iconv-lite@npm:~0.4.24": version: 0.4.24 resolution: "iconv-lite@npm:0.4.24" dependencies: @@ -7885,7 +7908,7 @@ __metadata: languageName: node linkType: hard -"inherits@npm:2, inherits@npm:2.0.4, inherits@npm:^2.0.1, inherits@npm:^2.0.3, inherits@npm:^2.0.4, inherits@npm:~2.0.1, inherits@npm:~2.0.3": +"inherits@npm:2, inherits@npm:^2.0.1, inherits@npm:^2.0.3, inherits@npm:^2.0.4, inherits@npm:~2.0.1, inherits@npm:~2.0.3, inherits@npm:~2.0.4": version: 2.0.4 resolution: "inherits@npm:2.0.4" checksum: 4a48a733847879d6cf6691860a6b1e3f0f4754176e4d71494c41f3475553768b10f84b5ce1d40fbd0e34e6bfbb864ee35858ad4dd2cf31e02fc4a154b724d7f1 @@ -7972,13 +7995,10 @@ __metadata: languageName: node linkType: hard -"ip-address@npm:^9.0.5": - version: 9.0.5 - resolution: "ip-address@npm:9.0.5" - dependencies: - jsbn: 1.1.0 - sprintf-js: ^1.1.3 - checksum: aa15f12cfd0ef5e38349744e3654bae649a34c3b10c77a674a167e99925d1549486c5b14730eebce9fea26f6db9d5e42097b00aa4f9f612e68c79121c71652dc +"ip-address@npm:^10.0.1": + version: 10.1.0 + resolution: "ip-address@npm:10.1.0" + checksum: 76b1abcdf52a32e2e05ca1f202f3a8ab8547e5651a9233781b330271bd7f1a741067748d71c4cbb9d9906d9f1fa69e7ddc8b4a11130db4534fdab0e908c84e0d languageName: node linkType: hard @@ -8162,7 +8182,7 @@ __metadata: languageName: node linkType: hard -"is-core-module@npm:^2.11.0, is-core-module@npm:^2.13.0, is-core-module@npm:^2.15.1, is-core-module@npm:^2.16.0": +"is-core-module@npm:^2.11.0, is-core-module@npm:^2.13.0, is-core-module@npm:^2.16.1": version: 2.16.1 resolution: "is-core-module@npm:2.16.1" dependencies: @@ -8230,14 +8250,15 @@ __metadata: linkType: hard "is-generator-function@npm:^1.0.10": - version: 1.1.0 - resolution: "is-generator-function@npm:1.1.0" + version: 1.1.2 + resolution: "is-generator-function@npm:1.1.2" dependencies: - call-bound: ^1.0.3 - get-proto: ^1.0.0 + call-bound: ^1.0.4 + generator-function: ^2.0.0 + get-proto: ^1.0.1 has-tostringtag: ^1.0.2 safe-regex-test: ^1.1.0 - checksum: f7f7276131bdf7e28169b86ac55a5b080012a597f9d85a0cbef6fe202a7133fa450a3b453e394870e3cb3685c5a764c64a9f12f614684b46969b1e6f297bed6b + checksum: 0b81c613752a5e534939e5b3835ff722446837a5b94c3a3934af5ded36a651d9aa31c3f11f8a3453884b9658bf26dbfb7eb855e744d920b07f084bd890a43414 languageName: node linkType: hard @@ -8280,6 +8301,13 @@ __metadata: languageName: node linkType: hard +"is-negative-zero@npm:^2.0.3": + version: 2.0.3 + resolution: "is-negative-zero@npm:2.0.3" + checksum: c1e6b23d2070c0539d7b36022d5a94407132411d01aba39ec549af824231f3804b1aea90b5e4e58e807a65d23ceb538ed6e355ce76b267bdd86edb757ffcbdcd + languageName: node + linkType: hard + "is-number-object@npm:^1.1.1": version: 1.1.1 resolution: "is-number-object@npm:1.1.1" @@ -8353,7 +8381,7 @@ __metadata: languageName: node linkType: hard -"is-string@npm:^1.0.7, is-string@npm:^1.1.1": +"is-string@npm:^1.1.1": version: 1.1.1 resolution: "is-string@npm:1.1.1" dependencies: @@ -8411,7 +8439,7 @@ __metadata: languageName: node linkType: hard -"is-weakref@npm:^1.0.2, is-weakref@npm:^1.1.0": +"is-weakref@npm:^1.0.2, is-weakref@npm:^1.1.1": version: 1.1.1 resolution: "is-weakref@npm:1.1.1" dependencies: @@ -8491,12 +8519,12 @@ __metadata: languageName: node linkType: hard -"isows@npm:1.0.6": - version: 1.0.6 - resolution: "isows@npm:1.0.6" +"isows@npm:1.0.7": + version: 1.0.7 + resolution: "isows@npm:1.0.7" peerDependencies: ws: "*" - checksum: ab9e85b50bcc3d70aa5ec875aa2746c5daf9321cb376ed4e5434d3c2643c5d62b1f466d93a05cd2ad0ead5297224922748c31707cb4fbd68f5d05d0479dce99c + checksum: 044b949b369872882af07b60b613b5801ae01b01a23b5b72b78af80c8103bbeed38352c3e8ceff13a7834bc91fd2eb41cf91ec01d59a041d8705680e6b0ec546 languageName: node linkType: hard @@ -8623,32 +8651,25 @@ __metadata: linkType: hard "js-yaml@npm:3.x, js-yaml@npm:^3.13.1": - version: 3.14.1 - resolution: "js-yaml@npm:3.14.1" + version: 3.14.2 + resolution: "js-yaml@npm:3.14.2" dependencies: argparse: ^1.0.7 esprima: ^4.0.0 bin: js-yaml: bin/js-yaml.js - checksum: bef146085f472d44dee30ec34e5cf36bf89164f5d585435a3d3da89e52622dff0b188a580e4ad091c3341889e14cb88cac6e4deb16dc5b1e9623bb0601fc255c + checksum: 626fc207734a3452d6ba84e1c8c226240e6d431426ed94d0ab043c50926d97c509629c08b1d636f5d27815833b7cfd225865631da9fb33cb957374490bf3e90b languageName: node linkType: hard "js-yaml@npm:^4.1.0": - version: 4.1.0 - resolution: "js-yaml@npm:4.1.0" + version: 4.1.1 + resolution: "js-yaml@npm:4.1.1" dependencies: argparse: ^2.0.1 bin: js-yaml: bin/js-yaml.js - checksum: c7830dfd456c3ef2c6e355cc5a92e6700ceafa1d14bba54497b34a99f0376cecbb3e9ac14d3e5849b426d5a5140709a66237a8c991c675431271c4ce5504151a - languageName: node - linkType: hard - -"jsbn@npm:1.1.0": - version: 1.1.0 - resolution: "jsbn@npm:1.1.0" - checksum: 944f924f2bd67ad533b3850eee47603eed0f6ae425fd1ee8c760f477e8c34a05f144c1bd4f5a5dd1963141dc79a2c55f89ccc5ab77d039e7077f3ad196b64965 + checksum: ea2339c6930fe048ec31b007b3c90be2714ab3e7defcc2c27ebf30c74fd940358f29070b4345af0019ef151875bf3bc3f8644bea1bab0372652b5044813ac02d languageName: node linkType: hard @@ -8748,15 +8769,15 @@ __metadata: linkType: hard "jsonfile@npm:^6.0.1": - version: 6.1.0 - resolution: "jsonfile@npm:6.1.0" + version: 6.2.0 + resolution: "jsonfile@npm:6.2.0" dependencies: graceful-fs: ^4.1.6 universalify: ^2.0.0 dependenciesMeta: graceful-fs: optional: true - checksum: 7af3b8e1ac8fe7f1eccc6263c6ca14e1966fcbc74b618d3c78a0a2075579487547b94f72b7a1114e844a1e15bb00d440e5d1720bfc4612d790a6f285d5ea8354 + checksum: c3028ec5c770bb41290c9bb9ca04bdd0a1b698ddbdf6517c9453d3f90fc9e000c9675959fb46891d317690a93c62de03ff1735d8dbe02be83e51168ce85815d3 languageName: node linkType: hard @@ -9143,9 +9164,9 @@ __metadata: linkType: hard "lodash@npm:^4.17.11, lodash@npm:^4.17.14, lodash@npm:^4.17.15, lodash@npm:^4.17.19, lodash@npm:^4.17.21": - version: 4.17.21 - resolution: "lodash@npm:4.17.21" - checksum: eb835a2e51d381e561e508ce932ea50a8e5a68f4ebdd771ea240d3048244a8d13658acbd502cd4829768c56f2e16bdd4340b9ea141297d472517b83868e677f7 + version: 4.17.23 + resolution: "lodash@npm:4.17.23" + checksum: 7daad39758a72872e94651630fbb54ba76868f904211089721a64516ce865506a759d9ad3d8ff22a2a49a50a09db5d27c36f22762d21766e47e3ba918d6d7bab languageName: node linkType: hard @@ -9184,13 +9205,20 @@ __metadata: languageName: node linkType: hard -"lru-cache@npm:^10.0.1, lru-cache@npm:^10.2.0": +"lru-cache@npm:^10.2.0": version: 10.4.3 resolution: "lru-cache@npm:10.4.3" checksum: 6476138d2125387a6d20f100608c2583d415a4f64a0fecf30c9e2dda976614f09cad4baa0842447bd37dd459a7bd27f57d9d8f8ce558805abd487c583f3d774a languageName: node linkType: hard +"lru-cache@npm:^11.0.0, lru-cache@npm:^11.1.0, lru-cache@npm:^11.2.1": + version: 11.2.5 + resolution: "lru-cache@npm:11.2.5" + checksum: b3cd18066c81e0540429507036e0a37f860325348f6a85376ed71196e5b893668af410849574c5fb49110bc0afff76b4f87646cb93b2482a315c9e7b8435630f + languageName: node + linkType: hard + "lru-cache@npm:^5.1.1": version: 5.1.1 resolution: "lru-cache@npm:5.1.1" @@ -9221,22 +9249,22 @@ __metadata: languageName: node linkType: hard -"make-fetch-happen@npm:^14.0.3": - version: 14.0.3 - resolution: "make-fetch-happen@npm:14.0.3" +"make-fetch-happen@npm:^15.0.0": + version: 15.0.3 + resolution: "make-fetch-happen@npm:15.0.3" dependencies: - "@npmcli/agent": ^3.0.0 - cacache: ^19.0.1 + "@npmcli/agent": ^4.0.0 + cacache: ^20.0.1 http-cache-semantics: ^4.1.1 minipass: ^7.0.2 - minipass-fetch: ^4.0.0 + minipass-fetch: ^5.0.0 minipass-flush: ^1.0.5 minipass-pipeline: ^1.2.4 negotiator: ^1.0.0 - proc-log: ^5.0.0 + proc-log: ^6.0.0 promise-retry: ^2.0.1 - ssri: ^12.0.0 - checksum: 6fb2fee6da3d98f1953b03d315826b5c5a4ea1f908481afc113782d8027e19f080c85ae998454de4e5f27a681d3ec58d57278f0868d4e0b736f51d396b661691 + ssri: ^13.0.0 + checksum: 4fb9dbb739b33565c85dacdcff7eb9388d8f36f326a59dc13375f01af809c42c48aa5d1f4840ee36623b2461a15476e1e79e4548ca1af30b42e1e324705ac8b3 languageName: node linkType: hard @@ -9447,6 +9475,15 @@ __metadata: languageName: node linkType: hard +"minimatch@npm:^10.1.1": + version: 10.1.1 + resolution: "minimatch@npm:10.1.1" + dependencies: + "@isaacs/brace-expansion": ^5.0.0 + checksum: 8820c0be92994f57281f0a7a2cc4268dcc4b610f9a1ab666685716b4efe4b5898b43c835a8f22298875b31c7a278a5e3b7e253eee7c886546bb0b61fb94bca6b + languageName: node + linkType: hard + "minimatch@npm:^5.0.1, minimatch@npm:^5.1.6": version: 5.1.6 resolution: "minimatch@npm:5.1.6" @@ -9481,9 +9518,9 @@ __metadata: languageName: node linkType: hard -"minipass-fetch@npm:^4.0.0": - version: 4.0.1 - resolution: "minipass-fetch@npm:4.0.1" +"minipass-fetch@npm:^5.0.0": + version: 5.0.0 + resolution: "minipass-fetch@npm:5.0.0" dependencies: encoding: ^0.1.13 minipass: ^7.0.3 @@ -9492,7 +9529,7 @@ __metadata: dependenciesMeta: encoding: optional: true - checksum: 3dfca705ce887ca9ff14d73e8d8593996dea1a1ecd8101fdbb9c10549d1f9670bc8fb66ad0192769ead4c2dc01b4f9ca1cf567ded365adff17827a303b948140 + checksum: 416645d1e54c09fdfe64ec1676541ac2f6f2af3abc7ad25f2f22c4518535997c1ecd2c0c586ea8a5c6499ad7d8f97671f50ff38488ada54bf61fde309f731379 languageName: node linkType: hard @@ -9539,12 +9576,12 @@ __metadata: languageName: node linkType: hard -"minizlib@npm:^3.0.1": - version: 3.0.2 - resolution: "minizlib@npm:3.0.2" +"minizlib@npm:^3.0.1, minizlib@npm:^3.1.0": + version: 3.1.0 + resolution: "minizlib@npm:3.1.0" dependencies: minipass: ^7.1.2 - checksum: 493bed14dcb6118da7f8af356a8947cf1473289c09658e5aabd69a737800a8c3b1736fb7d7931b722268a9c9bc038a6d53c049b6a6af24b34a121823bb709996 + checksum: a15e6f0128f514b7d41a1c68ce531155447f4669e32d279bba1c1c071ef6c2abd7e4d4579bb59ccc2ed1531346749665968fdd7be8d83eb6b6ae2fe1f3d370a7 languageName: node linkType: hard @@ -9568,15 +9605,6 @@ __metadata: languageName: node linkType: hard -"mkdirp@npm:^3.0.1": - version: 3.0.1 - resolution: "mkdirp@npm:3.0.1" - bin: - mkdirp: dist/cjs/src/bin.js - checksum: 972deb188e8fb55547f1e58d66bd6b4a3623bf0c7137802582602d73e6480c1c2268dcbafbfb1be466e00cc7e56ac514d7fd9334b7cf33e3e2ab547c16f83a8d - languageName: node - linkType: hard - "mnemonist@npm:^0.38.0": version: 0.38.5 resolution: "mnemonist@npm:0.38.5" @@ -9821,22 +9849,22 @@ __metadata: linkType: hard "node-gyp@npm:latest": - version: 11.2.0 - resolution: "node-gyp@npm:11.2.0" + version: 12.2.0 + resolution: "node-gyp@npm:12.2.0" dependencies: env-paths: ^2.2.0 exponential-backoff: ^3.1.1 graceful-fs: ^4.2.6 - make-fetch-happen: ^14.0.3 - nopt: ^8.0.0 - proc-log: ^5.0.0 + make-fetch-happen: ^15.0.0 + nopt: ^9.0.0 + proc-log: ^6.0.0 semver: ^7.3.5 - tar: ^7.4.3 + tar: ^7.5.4 tinyglobby: ^0.2.12 - which: ^5.0.0 + which: ^6.0.0 bin: node-gyp: bin/node-gyp.js - checksum: 2536282ba81f8a94b29482d3622b6ab298611440619e46de4512a6f32396a68b5530357c474b859787069d84a4c537d99e0c71078cce5b9f808bf84eeb78e8fb + checksum: d4ce0acd08bd41004f45e10cef468f4bd15eaafb3acc388a0c567416e1746dc005cc080b8a3495e4e2ae2eed170a2123ff622c2d6614062f4a839837dcf1dd9d languageName: node linkType: hard @@ -9858,14 +9886,14 @@ __metadata: languageName: node linkType: hard -"nopt@npm:^8.0.0": - version: 8.1.0 - resolution: "nopt@npm:8.1.0" +"nopt@npm:^9.0.0": + version: 9.0.0 + resolution: "nopt@npm:9.0.0" dependencies: - abbrev: ^3.0.0 + abbrev: ^4.0.0 bin: nopt: bin/nopt.js - checksum: 49cfd3eb6f565e292bf61f2ff1373a457238804d5a5a63a8d786c923007498cba89f3648e3b952bc10203e3e7285752abf5b14eaf012edb821e84f24e881a92a + checksum: 7a5d9ab0629eaec1944a95438cc4efa6418ed2834aa8eb21a1bea579a7d8ac3e30120131855376a96ef59ab0e23ad8e0bc94d3349770a95e5cb7119339f7c7fb languageName: node linkType: hard @@ -9918,7 +9946,7 @@ __metadata: languageName: node linkType: hard -"object-inspect@npm:^1.13.3": +"object-inspect@npm:^1.13.3, object-inspect@npm:^1.13.4": version: 1.13.4 resolution: "object-inspect@npm:1.13.4" checksum: 582810c6a8d2ef988ea0a39e69e115a138dad8f42dd445383b394877e5816eb4268489f316a6f74ee9c4e0a984b3eab1028e3e79d62b1ed67c726661d55c7a8b @@ -9969,7 +9997,7 @@ __metadata: languageName: node linkType: hard -"object.values@npm:^1.2.0": +"object.values@npm:^1.2.1": version: 1.2.1 resolution: "object.values@npm:1.2.1" dependencies: @@ -10095,23 +10123,24 @@ __metadata: languageName: node linkType: hard -"ox@npm:0.6.9": - version: 0.6.9 - resolution: "ox@npm:0.6.9" +"ox@npm:0.11.3": + version: 0.11.3 + resolution: "ox@npm:0.11.3" dependencies: - "@adraffy/ens-normalize": ^1.10.1 - "@noble/curves": ^1.6.0 - "@noble/hashes": ^1.5.0 - "@scure/bip32": ^1.5.0 - "@scure/bip39": ^1.4.0 - abitype: ^1.0.6 + "@adraffy/ens-normalize": ^1.11.0 + "@noble/ciphers": ^1.3.0 + "@noble/curves": 1.9.1 + "@noble/hashes": ^1.8.0 + "@scure/bip32": ^1.7.0 + "@scure/bip39": ^1.6.0 + abitype: ^1.2.3 eventemitter3: 5.0.1 peerDependencies: typescript: ">=5.4.0" peerDependenciesMeta: typescript: optional: true - checksum: 6f35c9710ab3edb8146f0d2a7c482517c8e1cb2adf0cfb7aba23a17209cf7171546ad017cce98dd9e0f60cee5d77ddaaa72961023e4456de093d985b5712c546 + checksum: a3245ecf26451fe681f094ad3d082b2b59f57f52ff02a8d74b2e8e21e95e612328785efb1f65222927fdc5a2670b4965ff2372fcef8daf90effd5744bcfa3262 languageName: node linkType: hard @@ -10206,9 +10235,9 @@ __metadata: linkType: hard "p-map@npm:^7.0.2": - version: 7.0.3 - resolution: "p-map@npm:7.0.3" - checksum: 8c92d533acf82f0d12f7e196edccff773f384098bbb048acdd55a08778ce4fc8889d8f1bde72969487bd96f9c63212698d79744c20bedfce36c5b00b46d369f8 + version: 7.0.4 + resolution: "p-map@npm:7.0.4" + checksum: 4be2097e942f2fd3a4f4b0c6585c721f23851de8ad6484d20c472b3ea4937d5cd9a59914c832b1bceac7bf9d149001938036b82a52de0bc381f61ff2d35d26a5 languageName: node linkType: hard @@ -10313,6 +10342,16 @@ __metadata: languageName: node linkType: hard +"path-scurry@npm:^2.0.0": + version: 2.0.1 + resolution: "path-scurry@npm:2.0.1" + dependencies: + lru-cache: ^11.0.0 + minipass: ^7.1.2 + checksum: a022c6c38fed836079d03f96540eafd4cd989acf287b99613c82300107f366e889513ad8b671a2039a9d251122621f9c6fa649f0bd4d50acf95a6943a6692dbf + languageName: node + linkType: hard + "path-type@npm:^4.0.0": version: 4.0.0 resolution: "path-type@npm:4.0.0" @@ -10328,15 +10367,16 @@ __metadata: linkType: hard "pbkdf2@npm:^3.0.17, pbkdf2@npm:^3.0.9": - version: 3.1.2 - resolution: "pbkdf2@npm:3.1.2" + version: 3.1.5 + resolution: "pbkdf2@npm:3.1.5" dependencies: - create-hash: ^1.1.2 - create-hmac: ^1.1.4 - ripemd160: ^2.0.1 - safe-buffer: ^5.0.1 - sha.js: ^2.4.8 - checksum: 2c950a100b1da72123449208e231afc188d980177d021d7121e96a2de7f2abbc96ead2b87d03d8fe5c318face097f203270d7e27908af9f471c165a4e8e69c92 + create-hash: ^1.2.0 + create-hmac: ^1.1.7 + ripemd160: ^2.0.3 + safe-buffer: ^5.2.1 + sha.js: ^2.4.12 + to-buffer: ^1.2.1 + checksum: 377dd4791ae6e439c98ca2a120d1cb28375884aab04af98ea1e51e5304d69c3102d0d8ed915fd1e9908cb93744807202eb22b64d99ba6496697db9b2c4ee64cc languageName: node linkType: hard @@ -10361,10 +10401,10 @@ __metadata: languageName: node linkType: hard -"picomatch@npm:^4.0.2": - version: 4.0.2 - resolution: "picomatch@npm:4.0.2" - checksum: a7a5188c954f82c6585720e9143297ccd0e35ad8072231608086ca950bee672d51b0ef676254af0788205e59bd4e4deb4e7708769226bed725bf13370a7d1464 +"picomatch@npm:^4.0.3": + version: 4.0.3 + resolution: "picomatch@npm:4.0.3" + checksum: 6817fb74eb745a71445debe1029768de55fd59a42b75606f478ee1d0dc1aa6e78b711d041a7c9d5550e042642029b7f373dc1a43b224c4b7f12d23436735dba0 languageName: node linkType: hard @@ -10411,11 +10451,11 @@ __metadata: linkType: hard "prettier-linter-helpers@npm:^1.0.0": - version: 1.0.0 - resolution: "prettier-linter-helpers@npm:1.0.0" + version: 1.0.1 + resolution: "prettier-linter-helpers@npm:1.0.1" dependencies: fast-diff: ^1.1.2 - checksum: 00ce8011cf6430158d27f9c92cfea0a7699405633f7f1d4a45f07e21bf78e99895911cbcdc3853db3a824201a7c745bd49bfea8abd5fb9883e765a90f74f8392 + checksum: 2dc35f5036a35f4c4f5e645887edda1436acb63687a7f12b2383e0a6f3c1f76b8a0a4709fe4d82e19157210feb5984b159bb714d43290022911ab53d606474ec languageName: node linkType: hard @@ -10449,10 +10489,10 @@ __metadata: languageName: node linkType: hard -"proc-log@npm:^5.0.0": - version: 5.0.0 - resolution: "proc-log@npm:5.0.0" - checksum: c78b26ecef6d5cce4a7489a1e9923d7b4b1679028c8654aef0463b27f4a90b0946cd598f55799da602895c52feb085ec76381d007ab8dcceebd40b89c2f9dfe0 +"proc-log@npm:^6.0.0": + version: 6.1.0 + resolution: "proc-log@npm:6.1.0" + checksum: ac450ff8244e95b0c9935b52d629fef92ae69b7e39aea19972a8234259614d644402dd62ce9cb094f4a637d8a4514cba90c1456ad785a40ad5b64d502875a817 languageName: node linkType: hard @@ -10549,12 +10589,12 @@ __metadata: linkType: hard "pump@npm:^3.0.0": - version: 3.0.2 - resolution: "pump@npm:3.0.2" + version: 3.0.3 + resolution: "pump@npm:3.0.3" dependencies: end-of-stream: ^1.1.0 once: ^1.3.1 - checksum: e0c4216874b96bd25ddf31a0b61a5613e26cc7afa32379217cf39d3915b0509def3565f5f6968fafdad2894c8bbdbd67d340e84f3634b2a29b950cffb6442d9f + checksum: 52843fc933b838c0330f588388115a1b28ef2a5ffa7774709b142e35431e8ab0c2edec90de3fa34ebb72d59fef854f151eea7dfc211b6dcf586b384556bd2f39 languageName: node linkType: hard @@ -10573,11 +10613,11 @@ __metadata: linkType: hard "qs@npm:^6.12.3": - version: 6.14.0 - resolution: "qs@npm:6.14.0" + version: 6.14.1 + resolution: "qs@npm:6.14.1" dependencies: side-channel: ^1.1.0 - checksum: 189b52ad4e9a0da1a16aff4c58b2a554a8dad9bd7e287c7da7446059b49ca2e33a49e570480e8be406b87fccebf134f51c373cbce36c8c83859efa0c9b71d635 + checksum: 7fffab0344fd75bfb6b8c94b8ba17f3d3e823d25b615900f68b473c3a078e497de8eaa08f709eaaa170eedfcee50638a7159b98abef7d8c89c2ede79291522f2 languageName: node linkType: hard @@ -10605,14 +10645,14 @@ __metadata: linkType: hard "raw-body@npm:^2.4.1": - version: 2.5.2 - resolution: "raw-body@npm:2.5.2" + version: 2.5.3 + resolution: "raw-body@npm:2.5.3" dependencies: - bytes: 3.1.2 - http-errors: 2.0.0 - iconv-lite: 0.4.24 - unpipe: 1.0.0 - checksum: ba1583c8d8a48e8fbb7a873fdbb2df66ea4ff83775421bfe21ee120140949ab048200668c47d9ae3880012f6e217052690628cf679ddfbd82c9fc9358d574676 + bytes: ~3.1.2 + http-errors: ~2.0.1 + iconv-lite: ~0.4.24 + unpipe: ~1.0.0 + checksum: 16aa51e504318ebeef7f84a4d884c0f273cb0b7f3f14ea88788f92f5f488870617c97d4f886e84f119f21a2d6cdda3c4554821f8b18ed6be0d731ecb5a063d2a languageName: node linkType: hard @@ -10625,7 +10665,7 @@ __metadata: languageName: node linkType: hard -"readable-stream@npm:^2.2.2, readable-stream@npm:^2.3.0, readable-stream@npm:^2.3.5": +"readable-stream@npm:^2.2.2, readable-stream@npm:^2.3.0, readable-stream@npm:^2.3.5, readable-stream@npm:^2.3.8": version: 2.3.8 resolution: "readable-stream@npm:2.3.8" dependencies: @@ -10729,7 +10769,7 @@ __metadata: languageName: node linkType: hard -"regexp.prototype.flags@npm:^1.5.3": +"regexp.prototype.flags@npm:^1.5.4": version: 1.5.4 resolution: "regexp.prototype.flags@npm:1.5.4" dependencies: @@ -10837,15 +10877,15 @@ __metadata: linkType: hard "resolve@npm:^1.1.6, resolve@npm:^1.10.1, resolve@npm:^1.22.1, resolve@npm:^1.22.4": - version: 1.22.10 - resolution: "resolve@npm:1.22.10" + version: 1.22.11 + resolution: "resolve@npm:1.22.11" dependencies: - is-core-module: ^2.16.0 + is-core-module: ^2.16.1 path-parse: ^1.0.7 supports-preserve-symlinks-flag: ^1.0.0 bin: resolve: bin/resolve - checksum: ab7a32ff4046fcd7c6fdd525b24a7527847d03c3650c733b909b01b757f92eb23510afa9cc3e9bf3f26a3e073b48c88c706dfd4c1d2fb4a16a96b73b6328ddcf + checksum: 6d5baa2156b95a65ac431e7642e21106584e9f4194da50871cae8bc1bbd2b53bb7cee573c92543d83bb999620b224a087f62379d800ed1ccb189da6df5d78d50 languageName: node linkType: hard @@ -10866,15 +10906,15 @@ __metadata: linkType: hard "resolve@patch:resolve@^1.1.6#~builtin, resolve@patch:resolve@^1.10.1#~builtin, resolve@patch:resolve@^1.22.1#~builtin, resolve@patch:resolve@^1.22.4#~builtin": - version: 1.22.10 - resolution: "resolve@patch:resolve@npm%3A1.22.10#~builtin::version=1.22.10&hash=07638b" + version: 1.22.11 + resolution: "resolve@patch:resolve@npm%3A1.22.11#~builtin::version=1.22.11&hash=07638b" dependencies: - is-core-module: ^2.16.0 + is-core-module: ^2.16.1 path-parse: ^1.0.7 supports-preserve-symlinks-flag: ^1.0.0 bin: resolve: bin/resolve - checksum: 8aac1e4e4628bd00bf4b94b23de137dd3fe44097a8d528fd66db74484be929936e20c696e1a3edf4488f37e14180b73df6f600992baea3e089e8674291f16c9d + checksum: 1462da84ac3410d7c2e12e4f5f25c1423d8a174c3b4245c43eafea85e7bbe6af3eb7ec10a4850b5e518e8531608604742b8cbd761e1acd7ad1035108b7c98013 languageName: node linkType: hard @@ -10949,13 +10989,13 @@ __metadata: languageName: node linkType: hard -"ripemd160@npm:^2.0.0, ripemd160@npm:^2.0.1": - version: 2.0.2 - resolution: "ripemd160@npm:2.0.2" +"ripemd160@npm:^2.0.0, ripemd160@npm:^2.0.1, ripemd160@npm:^2.0.3": + version: 2.0.3 + resolution: "ripemd160@npm:2.0.3" dependencies: - hash-base: ^3.0.0 - inherits: ^2.0.1 - checksum: 006accc40578ee2beae382757c4ce2908a826b27e2b079efdcd2959ee544ddf210b7b5d7d5e80467807604244e7388427330f5c6d4cd61e6edaddc5773ccc393 + hash-base: ^3.1.2 + inherits: ^2.0.4 + checksum: da25591f15d3f03d3a26cabc8255634ee9e0ae89fc053846e6b3975bbdbae6941baeb539dba30e0aaec9a726c7442149de064e13c2510332e119e50beaf3314d languageName: node linkType: hard @@ -11026,7 +11066,7 @@ __metadata: languageName: node linkType: hard -"safe-buffer@npm:^5.0.1, safe-buffer@npm:^5.1.0, safe-buffer@npm:^5.1.1, safe-buffer@npm:^5.1.2, safe-buffer@npm:^5.2.0, safe-buffer@npm:^5.2.1, safe-buffer@npm:~5.2.0": +"safe-buffer@npm:^5.0.1, safe-buffer@npm:^5.1.0, safe-buffer@npm:^5.1.1, safe-buffer@npm:^5.1.2, safe-buffer@npm:^5.2.1, safe-buffer@npm:~5.2.0": version: 5.2.1 resolution: "safe-buffer@npm:5.2.1" checksum: b99c4b41fdd67a6aaf280fcd05e9ffb0813654894223afb78a31f14a19ad220bba8aba1cb14eddce1fcfb037155fe6de4e861784eb434f7d11ed58d1e70dd491 @@ -11156,11 +11196,11 @@ __metadata: linkType: hard "semver@npm:^7.0.0, semver@npm:^7.3.2, semver@npm:^7.3.4, semver@npm:^7.3.5, semver@npm:^7.3.7, semver@npm:^7.3.8, semver@npm:^7.5.2, semver@npm:^7.7.1": - version: 7.7.1 - resolution: "semver@npm:7.7.1" + version: 7.7.3 + resolution: "semver@npm:7.7.3" bin: semver: bin/semver.js - checksum: 586b825d36874007c9382d9e1ad8f93888d8670040add24a28e06a910aeebd673a2eb9e3bf169c6679d9245e66efb9057e0852e70d9daa6c27372aab1dda7104 + checksum: f013a3ee4607857bcd3503b6ac1d80165f7f8ea94f5d55e2d3e33df82fce487aa3313b987abf9b39e0793c83c9fc67b76c36c067625141a9f6f704ae0ea18db2 languageName: node linkType: hard @@ -11224,22 +11264,23 @@ __metadata: languageName: node linkType: hard -"setprototypeof@npm:1.2.0": +"setprototypeof@npm:~1.2.0": version: 1.2.0 resolution: "setprototypeof@npm:1.2.0" checksum: be18cbbf70e7d8097c97f713a2e76edf84e87299b40d085c6bf8b65314e994cc15e2e317727342fa6996e38e1f52c59720b53fe621e2eb593a6847bf0356db89 languageName: node linkType: hard -"sha.js@npm:^2.4.0, sha.js@npm:^2.4.8": - version: 2.4.11 - resolution: "sha.js@npm:2.4.11" +"sha.js@npm:^2.4.0, sha.js@npm:^2.4.12, sha.js@npm:^2.4.8": + version: 2.4.12 + resolution: "sha.js@npm:2.4.12" dependencies: - inherits: ^2.0.1 - safe-buffer: ^5.0.1 + inherits: ^2.0.4 + safe-buffer: ^5.2.1 + to-buffer: ^1.2.0 bin: - sha.js: ./bin.js - checksum: ebd3f59d4b799000699097dadb831c8e3da3eb579144fd7eb7a19484cbcbb7aca3c68ba2bb362242eb09e33217de3b4ea56e4678184c334323eca24a58e3ad07 + sha.js: bin.js + checksum: 9ec0fe39cc402acb33ffb18d261b52013485a2a9569a1873ff1861510a67b9ea2b3ccc78ab8aa09c34e1e85a5f06e18ab83637715509c6153ba8d537bbd2c29d languageName: node linkType: hard @@ -11408,12 +11449,12 @@ __metadata: linkType: hard "socks@npm:^2.8.3": - version: 2.8.4 - resolution: "socks@npm:2.8.4" + version: 2.8.7 + resolution: "socks@npm:2.8.7" dependencies: - ip-address: ^9.0.5 + ip-address: ^10.0.1 smart-buffer: ^4.2.0 - checksum: cd1edc924475d5dfde534adf66038df7e62c7343e6b8c0113e52dc9bb6a0a10e25b2f136197f379d695f18e8f0f2b7f6e42977bf720ddbee912a851201c396ad + checksum: 4bbe2c88cf0eeaf49f94b7f11564a99b2571bde6fd1e714ff95b38f89e1f97858c19e0ab0e6d39eb7f6a984fa67366825895383ed563fe59962a1d57a1d55318 languageName: node linkType: hard @@ -11483,15 +11524,15 @@ __metadata: linkType: hard "solidity-ast@npm:^0.4.60": - version: 0.4.60 - resolution: "solidity-ast@npm:0.4.60" - checksum: 61b5c47d707f4a151b1ee73a551c96a52cfbc045b26c82f0024ad1f52b7221f360c56f37760f52ecd90a25554fe6027eb79de583f1556c08bc254db283bf1448 + version: 0.4.61 + resolution: "solidity-ast@npm:0.4.61" + checksum: 05600cc9efc73c7946cbb60a7134e1f23042bec7e05e475493e5d4558e93e70bdfec2a1e4655d02316bb5aa80ad77bf1a1eb141062a313d31304b17d80bb92a0 languageName: node linkType: hard "solidity-coverage@npm:^0.8.5": - version: 0.8.16 - resolution: "solidity-coverage@npm:0.8.16" + version: 0.8.17 + resolution: "solidity-coverage@npm:0.8.17" dependencies: "@ethersproject/abi": ^5.0.9 "@solidity-parser/parser": ^0.20.1 @@ -11516,7 +11557,7 @@ __metadata: hardhat: ^2.11.0 bin: solidity-coverage: plugins/bin.js - checksum: c1b172a716a898da2b4e650cfd9446ee4612c08926f7a90923af8a23fa711d2efd228ebfea0e1cb33f7842e8f5f2133227f0c9586a68c614fdfe7e57330736ee + checksum: 84845b9935a2afb0070ffb209752786ddcf1c8198f4c6b6193a879a9c4dcc3c374703bc29cd0f4cad227463366cf7cf6b8017995f9f364fc545c496df14bf227 languageName: node linkType: hard @@ -11563,13 +11604,6 @@ __metadata: languageName: node linkType: hard -"sprintf-js@npm:^1.1.3": - version: 1.1.3 - resolution: "sprintf-js@npm:1.1.3" - checksum: a3fdac7b49643875b70864a9d9b469d87a40dfeaf5d34d9d0c5b1cda5fd7d065531fcb43c76357d62254c57184a7b151954156563a4d6a747015cfb41021cad0 - languageName: node - linkType: hard - "sprintf-js@npm:~1.0.2": version: 1.0.3 resolution: "sprintf-js@npm:1.0.3" @@ -11598,12 +11632,12 @@ __metadata: languageName: node linkType: hard -"ssri@npm:^12.0.0": - version: 12.0.0 - resolution: "ssri@npm:12.0.0" +"ssri@npm:^13.0.0": + version: 13.0.0 + resolution: "ssri@npm:13.0.0" dependencies: minipass: ^7.0.3 - checksum: ef4b6b0ae47b4a69896f5f1c4375f953b9435388c053c36d27998bc3d73e046969ccde61ab659e679142971a0b08e50478a1228f62edb994105b280f17900c98 + checksum: 9705dff9e686b11f3035fb4c3d44ce690359a15a54adcd6a18951f2763f670877321178dc72c37a2b804dba3287ecaa48726dbd0cff79b2715b1cc24521b3af3 languageName: node linkType: hard @@ -11616,10 +11650,20 @@ __metadata: languageName: node linkType: hard -"statuses@npm:2.0.1": - version: 2.0.1 - resolution: "statuses@npm:2.0.1" - checksum: 18c7623fdb8f646fb213ca4051be4df7efb3484d4ab662937ca6fbef7ced9b9e12842709872eb3020cc3504b93bde88935c9f6417489627a7786f24f8031cbcb +"statuses@npm:~2.0.2": + version: 2.0.2 + resolution: "statuses@npm:2.0.2" + checksum: 6927feb50c2a75b2a4caab2c565491f7a93ad3d8dbad7b1398d52359e9243a20e2ebe35e33726dee945125ef7a515e9097d8a1b910ba2bbd818265a2f6c39879 + languageName: node + linkType: hard + +"stop-iteration-iterator@npm:^1.1.0": + version: 1.1.0 + resolution: "stop-iteration-iterator@npm:1.1.0" + dependencies: + es-errors: ^1.3.0 + internal-slot: ^1.1.0 + checksum: be944489d8829fb3bdec1a1cc4a2142c6b6eb317305eeace1ece978d286d6997778afa1ae8cb3bd70e2b274b9aa8c69f93febb1e15b94b1359b11058f9d3c3a1 languageName: node linkType: hard @@ -11697,7 +11741,7 @@ __metadata: languageName: node linkType: hard -"string.prototype.trimend@npm:^1.0.8, string.prototype.trimend@npm:^1.0.9": +"string.prototype.trimend@npm:^1.0.9": version: 1.0.9 resolution: "string.prototype.trimend@npm:1.0.9" dependencies: @@ -11773,11 +11817,11 @@ __metadata: linkType: hard "strip-ansi@npm:^7.0.1": - version: 7.1.0 - resolution: "strip-ansi@npm:7.1.0" + version: 7.1.2 + resolution: "strip-ansi@npm:7.1.2" dependencies: ansi-regex: ^6.0.1 - checksum: 859c73fcf27869c22a4e4d8c6acfe690064659e84bef9458aa6d13719d09ca88dcfd40cbf31fd0be63518ea1a643fe070b4827d353e09533a5b0b9fd4553d64d + checksum: db0e3f9654e519c8a33c50fc9304d07df5649388e7da06d3aabf66d29e5ad65d5e6315d8519d409c15b32fa82c1df7e11ed6f8cd50b0e4404463f0c9d77c8d0b languageName: node linkType: hard @@ -11818,10 +11862,10 @@ __metadata: languageName: node linkType: hard -"strnum@npm:^1.0.5": - version: 1.1.2 - resolution: "strnum@npm:1.1.2" - checksum: a85219eda13e97151c95e343a9e5960eacfb0a0ff98104b4c9cb7a212e3008bddf0c9714c9c37c2e508be78e741a04afc80027c2dc18509d1b5ffd4c37191fc2 +"strnum@npm:^2.1.0": + version: 2.1.2 + resolution: "strnum@npm:2.1.2" + checksum: 755e8327ee68201d700169ceee097ea52da7b675f4521442a8dbd1517021f89a91399213c446d1bf3d1123ca1896a76f0ff076d04c88ffe6056e78828ce6f60a languageName: node linkType: hard @@ -11906,14 +11950,14 @@ __metadata: linkType: hard "tar-fs@npm:~1.16.3": - version: 1.16.4 - resolution: "tar-fs@npm:1.16.4" + version: 1.16.6 + resolution: "tar-fs@npm:1.16.6" dependencies: chownr: ^1.0.1 mkdirp: ^0.5.1 pump: ^1.0.0 tar-stream: ^1.1.2 - checksum: fd8983552ff1d384f6e424f39dcd9c346847bf2bb5206b944dff4ff8d3b7540d4f26fd38f50c59ac50f93cc76ad6d8e00d83733f22be086664dce9d979123d9c + checksum: 58921cec6c53b44edbe80054229e60235b188cfd94b734553cccd29f88a981476a401496590c042a5c50fccaa0f9aeac05f9789542eb341f84b6651a80d5bb60 languageName: node linkType: hard @@ -11932,17 +11976,16 @@ __metadata: languageName: node linkType: hard -"tar@npm:^7.4.3": - version: 7.4.3 - resolution: "tar@npm:7.4.3" +"tar@npm:^7.5.4": + version: 7.5.7 + resolution: "tar@npm:7.5.7" dependencies: "@isaacs/fs-minipass": ^4.0.0 chownr: ^3.0.0 minipass: ^7.1.2 - minizlib: ^3.0.1 - mkdirp: ^3.0.1 + minizlib: ^3.1.0 yallist: ^5.0.0 - checksum: 8485350c0688331c94493031f417df069b778aadb25598abdad51862e007c39d1dd5310702c7be4a6784731a174799d8885d2fde0484269aea205b724d7b2ffa + checksum: 82fa04804b6cae4c0b46b84e97a08c39e1c17bb959350baa32d139bcf5e1fc7ebc3ceb72465dd3e2e311992386ecc13599a257d5672158490ceb9464146d5573 languageName: node linkType: hard @@ -11972,12 +12015,12 @@ __metadata: linkType: hard "tinyglobby@npm:^0.2.12, tinyglobby@npm:^0.2.6": - version: 0.2.13 - resolution: "tinyglobby@npm:0.2.13" + version: 0.2.15 + resolution: "tinyglobby@npm:0.2.15" dependencies: - fdir: ^6.4.4 - picomatch: ^4.0.2 - checksum: 3a2e87a2518cb3616057b0aa58be4f17771ae78c6890556516ae1e631f8ce4cfee1ba1dcb62fcc54a64e2bdd6c3104f4f3d021e1a3e3f8fb0875bca380b913e5 + fdir: ^6.5.0 + picomatch: ^4.0.3 + checksum: 0e33b8babff966c6ab86e9b825a350a6a98a63700fa0bb7ae6cf36a7770a508892383adc272f7f9d17aaf46a9d622b455e775b9949a3f951eaaf5dfb26331d44 languageName: node linkType: hard @@ -12000,16 +12043,20 @@ __metadata: linkType: hard "tmp@npm:^0.2.0": - version: 0.2.3 - resolution: "tmp@npm:0.2.3" - checksum: 73b5c96b6e52da7e104d9d44afb5d106bb1e16d9fa7d00dbeb9e6522e61b571fbdb165c756c62164be9a3bbe192b9b268c236d370a2a0955c7689cd2ae377b95 + version: 0.2.5 + resolution: "tmp@npm:0.2.5" + checksum: 9d18e58060114154939930457b9e198b34f9495bcc05a343bc0a0a29aa546d2c1c2b343dae05b87b17c8fde0af93ab7d8fe8574a8f6dc2cd8fd3f2ca1ad0d8e1 languageName: node linkType: hard -"to-buffer@npm:^1.1.1": - version: 1.1.1 - resolution: "to-buffer@npm:1.1.1" - checksum: 6c897f58c2bdd8b8b1645ea515297732fec6dafb089bf36d12370c102ff5d64abf2be9410e0b1b7cfc707bada22d9a4084558010bfc78dd7023748dc5dd9a1ce +"to-buffer@npm:^1.1.1, to-buffer@npm:^1.2.0, to-buffer@npm:^1.2.1, to-buffer@npm:^1.2.2": + version: 1.2.2 + resolution: "to-buffer@npm:1.2.2" + dependencies: + isarray: ^2.0.5 + safe-buffer: ^5.2.1 + typed-array-buffer: ^1.0.3 + checksum: b0cd2417989a9f3d47273301e8cec2c9798b19a117822424686f385f3ec0239d2defd5fd9f8e76cda0b21e2a2f5de65a58e806506bf4c296c31750c5efd3ae4b languageName: node linkType: hard @@ -12022,7 +12069,7 @@ __metadata: languageName: node linkType: hard -"toidentifier@npm:1.0.1": +"toidentifier@npm:~1.0.1": version: 1.0.1 resolution: "toidentifier@npm:1.0.1" checksum: 952c29e2a85d7123239b5cfdd889a0dde47ab0497f0913d70588f19c53f7e0b5327c95f4651e413c74b785147f9637b17410ac8c846d5d4a20a5a33eb6dc3a45 @@ -12046,16 +12093,16 @@ __metadata: languageName: node linkType: hard -"tranche@https://github.com/buttonwood-protocol/tranche.git#main": +"tranche@https://github.com/buttonwood-protocol/tranche/archive/main.tar.gz": version: 1.0.0 - resolution: "tranche@https://github.com/buttonwood-protocol/tranche.git#commit=3b9b6be224b5220fe5e08a4dfa76a27b9684f259" + resolution: "tranche@https://github.com/buttonwood-protocol/tranche/archive/main.tar.gz" dependencies: "@openzeppelin/contracts-upgradeable": ^4.1.0 "@rari-capital/solmate": ^6.4.0 "@uniswap/v2-periphery": ^1.1.0-beta.0 "@uniswap/v3-periphery": ^1.1.0 lodash: ^4.17.21 - checksum: 52706d5b87a74289206073d4d7cda9ec36d0b1fed34a4a8d67baecb2572f5a4ef63c565a7d79ba7f956147c9a7bd9550fd4b58a31d3e42012ccbb41966127240 + checksum: 6bde0ab1d3eeeccfef1661abb66f561a3dd8aa738dfd7bf15d1d15f6aaee7459d0d2fa2bb7fa867ccd9930452147edb66f63963e9bc8df9f80a55094ecd09564 languageName: node linkType: hard @@ -12420,10 +12467,10 @@ __metadata: languageName: node linkType: hard -"undici-types@npm:~6.21.0": - version: 6.21.0 - resolution: "undici-types@npm:6.21.0" - checksum: 46331c7d6016bf85b3e8f20c159d62f5ae471aba1eb3dc52fff35a0259d58dcc7d592d4cc4f00c5f9243fa738a11cfa48bd20203040d4a9e6bc25e807fab7ab3 +"undici-types@npm:~7.16.0": + version: 7.16.0 + resolution: "undici-types@npm:7.16.0" + checksum: 1ef68fc6c5bad200c8b6f17de8e5bc5cfdcadc164ba8d7208cd087cfa8583d922d8316a7fd76c9a658c22b4123d3ff847429185094484fbc65377d695c905857 languageName: node linkType: hard @@ -12437,9 +12484,9 @@ __metadata: linkType: hard "undici@npm:^6.11.1": - version: 6.21.2 - resolution: "undici@npm:6.21.2" - checksum: 4d7227910bfee0703ea5c5c9d4343bcb2a80d2ce2eb64698b6fb8cc48852e29f7c7c623126161a5073fd594c9040ae7e7ecc8e093fe6e84a9394dd2595754ec5 + version: 6.23.0 + resolution: "undici@npm:6.23.0" + checksum: f0953920330375e76d1614381af07da9d7c21ad3244d0785b3f7bd4072635c20a1f432ef3a129baa3e4a92278ce32e9ea2ca8b5f0e0554a5739222af332c08fe languageName: node linkType: hard @@ -12450,21 +12497,21 @@ __metadata: languageName: node linkType: hard -"unique-filename@npm:^4.0.0": - version: 4.0.0 - resolution: "unique-filename@npm:4.0.0" +"unique-filename@npm:^5.0.0": + version: 5.0.0 + resolution: "unique-filename@npm:5.0.0" dependencies: - unique-slug: ^5.0.0 - checksum: 6a62094fcac286b9ec39edbd1f8f64ff92383baa430af303dfed1ffda5e47a08a6b316408554abfddd9730c78b6106bef4ca4d02c1231a735ddd56ced77573df + unique-slug: ^6.0.0 + checksum: a5f67085caef74bdd2a6869a200ed5d68d171f5cc38435a836b5fd12cce4e4eb55e6a190298035c325053a5687ed7a3c96f0a91e82215fd14729769d9ac57d9b languageName: node linkType: hard -"unique-slug@npm:^5.0.0": - version: 5.0.0 - resolution: "unique-slug@npm:5.0.0" +"unique-slug@npm:^6.0.0": + version: 6.0.0 + resolution: "unique-slug@npm:6.0.0" dependencies: imurmurhash: ^0.1.4 - checksum: 222d0322bc7bbf6e45c08967863212398313ef73423f4125e075f893a02405a5ffdbaaf150f7dd1e99f8861348a486dd079186d27c5f2c60e465b7dcbb1d3e5b + checksum: ad6cf238b10292d944521714d31bc9f3ca79fa80cb7a154aad183056493f98e85de669412c6bbfe527ffa9bdeff36d3dd4d5bccaf562c794f2580ab11932b691 languageName: node linkType: hard @@ -12482,7 +12529,7 @@ __metadata: languageName: node linkType: hard -"unpipe@npm:1.0.0": +"unpipe@npm:~1.0.0": version: 1.0.0 resolution: "unpipe@npm:1.0.0" checksum: 4fa18d8d8d977c55cb09715385c203197105e10a6d220087ec819f50cb68870f02942244f1017565484237f1f8c5d3cd413631b1ae104d3096f24fdfde1b4aa2 @@ -12550,15 +12597,6 @@ __metadata: languageName: node linkType: hard -"uuid@npm:^9.0.1": - version: 9.0.1 - resolution: "uuid@npm:9.0.1" - bin: - uuid: dist/bin/uuid - checksum: 39931f6da74e307f51c0fb463dc2462807531dc80760a9bff1e35af4316131b4fc3203d16da60ae33f07fdca5b56f3f1dd662da0c99fea9aaeab2004780cc5f4 - languageName: node - linkType: hard - "v8-compile-cache-lib@npm:^3.0.1": version: 3.0.1 resolution: "v8-compile-cache-lib@npm:3.0.1" @@ -12592,23 +12630,23 @@ __metadata: linkType: hard "viem@npm:^2.27.0": - version: 2.29.1 - resolution: "viem@npm:2.29.1" + version: 2.45.1 + resolution: "viem@npm:2.45.1" dependencies: - "@noble/curves": 1.8.2 - "@noble/hashes": 1.7.2 - "@scure/bip32": 1.6.2 - "@scure/bip39": 1.5.4 - abitype: 1.0.8 - isows: 1.0.6 - ox: 0.6.9 - ws: 8.18.1 + "@noble/curves": 1.9.1 + "@noble/hashes": 1.8.0 + "@scure/bip32": 1.7.0 + "@scure/bip39": 1.6.0 + abitype: 1.2.3 + isows: 1.0.7 + ox: 0.11.3 + ws: 8.18.3 peerDependencies: typescript: ">=5.0.4" peerDependenciesMeta: typescript: optional: true - checksum: ea9f591ef2cc8891480bf3cfe058f5bc5d8ef4d0d99eb3020f67f27df91af2daa4178b92be30147de2b6db95bc30619051f046de3c69b4cc1fd0e248e6e21308 + checksum: 5207f8e5c9ae33ca928094f97ce68c739d9b32ff35646f00c699a74431e518fbcf828bbe3ed0d054bc02437c0fbe0b3b41a4c5439135954b3804785fb985dfd5 languageName: node linkType: hard @@ -12707,9 +12745,9 @@ __metadata: languageName: node linkType: hard -"which-typed-array@npm:^1.1.16, which-typed-array@npm:^1.1.18": - version: 1.1.19 - resolution: "which-typed-array@npm:1.1.19" +"which-typed-array@npm:^1.1.16, which-typed-array@npm:^1.1.19": + version: 1.1.20 + resolution: "which-typed-array@npm:1.1.20" dependencies: available-typed-arrays: ^1.0.7 call-bind: ^1.0.8 @@ -12718,7 +12756,7 @@ __metadata: get-proto: ^1.0.1 gopd: ^1.2.0 has-tostringtag: ^1.0.2 - checksum: 162d2a07f68ea323f88ed9419861487ce5d02cb876f2cf9dd1e428d04a63133f93a54f89308f337b27cabd312ee3d027cae4a79002b2f0a85b79b9ef4c190670 + checksum: 82527027127c3a6f7b278b5c0059605b968bec780d1ddd7c0ce3c2172ae4b9d2217486123107e31d229ff57ed8cc2bc76d751f290f392ee6d3aa27b26d2ffc12 languageName: node linkType: hard @@ -12744,14 +12782,14 @@ __metadata: languageName: node linkType: hard -"which@npm:^5.0.0": - version: 5.0.0 - resolution: "which@npm:5.0.0" +"which@npm:^6.0.0": + version: 6.0.0 + resolution: "which@npm:6.0.0" dependencies: isexe: ^3.1.1 bin: node-which: bin/which.js - checksum: 6ec99e89ba32c7e748b8a3144e64bfc74aa63e2b2eacbb61a0060ad0b961eb1a632b08fb1de067ed59b002cec3e21de18299216ebf2325ef0f78e0f121e14e90 + checksum: df19b2cd8aac94b333fa29b42e8e371a21e634a742a3b156716f7752a5afe1d73fb5d8bce9b89326f453d96879e8fe626eb421e0117eb1a3ce9fd8c97f6b7db9 languageName: node linkType: hard @@ -12874,9 +12912,9 @@ __metadata: languageName: node linkType: hard -"ws@npm:8.18.1": - version: 8.18.1 - resolution: "ws@npm:8.18.1" +"ws@npm:8.18.3": + version: 8.18.3 + resolution: "ws@npm:8.18.3" peerDependencies: bufferutil: ^4.0.1 utf-8-validate: ">=5.0.2" @@ -12885,7 +12923,7 @@ __metadata: optional: true utf-8-validate: optional: true - checksum: 4658357185d891bc45cc2d42a84f9e192d047e8476fb5cba25b604f7d75ca87ca0dd54cd0b2cc49aeee57c79045a741cb7d0b14501953ac60c790cd105c42f23 + checksum: d64ef1631227bd0c5fe21b3eb3646c9c91229402fb963d12d87b49af0a1ef757277083af23a5f85742bae1e520feddfb434cb882ea59249b15673c16dc3f36e0 languageName: node linkType: hard From 8cb8f1b694702d4af44643f1644df685465115d8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 5 Feb 2026 20:34:33 -0500 Subject: [PATCH 13/18] Bump actions/setup-node from 4 to 6 (#264) Bumps [actions/setup-node](https://github.com/actions/setup-node) from 4 to 6. - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](https://github.com/actions/setup-node/compare/v4...v6) --- updated-dependencies: - dependency-name: actions/setup-node dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/nightly.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index b57a58f0..d571b4f4 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -19,7 +19,7 @@ jobs: uses: actions/checkout@v5 - name: Uses node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: node-version: ${{ matrix.node-version }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e21e8799..4db857c9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,7 +21,7 @@ jobs: uses: actions/checkout@v5 - name: Uses node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: node-version: ${{ matrix.node-version }} From 3730e07a75d3321b34f8ad0dceef1e46dc6eef99 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 5 Feb 2026 20:34:51 -0500 Subject: [PATCH 14/18] Bump coverallsapp/github-action from 2.3.6 to 2.3.7 (#267) Bumps [coverallsapp/github-action](https://github.com/coverallsapp/github-action) from 2.3.6 to 2.3.7. - [Release notes](https://github.com/coverallsapp/github-action/releases) - [Commits](https://github.com/coverallsapp/github-action/compare/v2.3.6...v2.3.7) --- updated-dependencies: - dependency-name: coverallsapp/github-action dependency-version: 2.3.7 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/nightly.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index d571b4f4..f1731f44 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -30,7 +30,7 @@ jobs: run: yarn workspace @ampleforthorg/spot-contracts run coverage - name: spot-contracts report coverage - uses: coverallsapp/github-action@v2.3.6 + uses: coverallsapp/github-action@v2.3.7 with: github-token: ${{ secrets.GITHUB_TOKEN }} path-to-lcov: "./spot-contracts/coverage/lcov.info" @@ -39,7 +39,7 @@ jobs: run: yarn workspace @ampleforthorg/spot-vaults run coverage - name: spot-vaults report coverage - uses: coverallsapp/github-action@v2.3.6 + uses: coverallsapp/github-action@v2.3.7 with: github-token: ${{ secrets.GITHUB_TOKEN }} path-to-lcov: "./spot-vaults/coverage/lcov.info" From 01a9898ce12cedd18816bf44e6b26736a216f63d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 5 Feb 2026 20:35:05 -0500 Subject: [PATCH 15/18] Bump actions/checkout from 5 to 6 (#268) Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v5...v6) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/nightly.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index f1731f44..578b4a75 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -16,7 +16,7 @@ jobs: steps: - name: Setup Repo - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Uses node.js ${{ matrix.node-version }} uses: actions/setup-node@v6 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4db857c9..c7c503c6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,7 @@ jobs: steps: - name: Setup Repo - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Uses node.js ${{ matrix.node-version }} uses: actions/setup-node@v6 From d2021ce4529d77097ea01169777b2b65a88efbb1 Mon Sep 17 00:00:00 2001 From: nms-7 <57442379+nms-7@users.noreply.github.com> Date: Thu, 5 Feb 2026 20:35:36 -0500 Subject: [PATCH 16/18] updates spot subgraph deployment steps - goldsky (#266) * Updates README.md * Update deploy.sh * Update README.md --- spot-subgraph/README.md | 21 ++++++++++++++++----- spot-subgraph/scripts/deploy.sh | 12 +----------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/spot-subgraph/README.md b/spot-subgraph/README.md index 12d43781..ec39daeb 100644 --- a/spot-subgraph/README.md +++ b/spot-subgraph/README.md @@ -4,7 +4,7 @@ The Graph is a tool for for indexing events emitted on the Ethereum blockchain. ``` Public graphql endpoint: -https://api.thegraph.com/subgraphs/name/ampleforth/spot +https://api.goldsky.com/api/public/project_cmgzjl03n004g5np20v5j3qpx/subgraphs/ampleforth-spot/prod/gn ``` ## Getting started @@ -26,13 +26,24 @@ Setup project: yarn ``` -To build and deploy the subgraph to the graph hosted service: +To build and deploy the subgraph to the goldsky's hosted service: ``` # local deployment ./scripts/deploy-local.sh sepolia ampleforth-spot-sepolia # prod deployment -./scripts/deploy.sh sepolia ampleforth-spot-sepolia -./scripts/deploy.sh mainnet ampleforth-spot -``` \ No newline at end of file + +You should have your own Goldsky API key to use with the Goldsky CLI. +Note you must set the (new) version to deploy to, and then update the tag separately. + +``` +./scripts/deploy.sh sepolia ampleforth-spot-sepolia +./scripts/deploy.sh mainnet ampleforth-spot +``` + +Once deployed, update the tag that frg-web-api looks for. + +``` +goldsky subgraph tag create / --tag prod +``` diff --git a/spot-subgraph/scripts/deploy.sh b/spot-subgraph/scripts/deploy.sh index 0c8bcfb8..519cd0c9 100755 --- a/spot-subgraph/scripts/deploy.sh +++ b/spot-subgraph/scripts/deploy.sh @@ -3,14 +3,4 @@ set -e yarn mustache ../spot-contracts/deployments/$1.json subgraph.template.yaml > ./subgraph.yaml -yarn codegen - -yarn build - -echo "NOTE: graph deploy to Alchemy fails when you redeploy with the same IPFS hash" - -# yarn graph auth $THE_GRAPH_API_KEY -# yarn graph deploy $2 -yarn graph deploy $2 \ - --node https://subgraphs.alchemy.com/api/subgraphs/deploy \ - --deploy-key $GRAPH_AUTH +goldsky subgraph deploy $2/$3 --path . From 8ffdcfa7dba867105ec84ed050c6fa3ff6a084fb Mon Sep 17 00:00:00 2001 From: nms-7 <57442379+nms-7@users.noreply.github.com> Date: Thu, 5 Feb 2026 20:35:59 -0500 Subject: [PATCH 17/18] Update README.md (#265) --- spot-staking-subgraph/README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/spot-staking-subgraph/README.md b/spot-staking-subgraph/README.md index 6bb96bd6..8645e7dc 100644 --- a/spot-staking-subgraph/README.md +++ b/spot-staking-subgraph/README.md @@ -1,13 +1,15 @@ # spot-staking-subgraph -Ancillary subgraphs to keep track of spot staking. +Ancillary subgraphs to keep track of spot staking. +You should have your own Goldsky API key to use with the Goldsky CLI. +Note you must set the (new) version to deploy to, and then update the tag separately. +``` +goldsky subgraph deploy spot-staking/ --path . ``` -yarn codegen - -yarn build -export GRAPH_AUTH="SET_KEY" -yarn deploy -``` \ No newline at end of file +Once deployed, update the tag that frg-web-api looks for. +``` +goldsky subgraph tag create spot-staking/ --tag prod +``` From 5708d68fc059737153f806b7428b2c67f4c8fc16 Mon Sep 17 00:00:00 2001 From: Aalavandhan <6264334+aalavandhan@users.noreply.github.com> Date: Mon, 16 Feb 2026 12:12:07 -0500 Subject: [PATCH 18/18] dr vault testnet and mainnet deployment (#270) --- spot-vaults/.openzeppelin/mainnet.json | 328 +++++++++++++++++++++++++ spot-vaults/.openzeppelin/sepolia.json | 328 +++++++++++++++++++++++++ spot-vaults/tasks/deploy.ts | 85 +++++++ spot-vaults/tasks/info.ts | 129 ++++++++++ spot-vaults/tasks/ops.ts | 228 +++++++++++++++++ spot-vaults/tasks/scripts/mainnet.sh | 22 ++ spot-vaults/tasks/scripts/sepolia.sh | 18 +- 7 files changed, 1137 insertions(+), 1 deletion(-) diff --git a/spot-vaults/.openzeppelin/mainnet.json b/spot-vaults/.openzeppelin/mainnet.json index f7e88223..bd24ff53 100644 --- a/spot-vaults/.openzeppelin/mainnet.json +++ b/spot-vaults/.openzeppelin/mainnet.json @@ -5,6 +5,11 @@ "address": "0xA088Aef966CAD7fE0B38e28c2E07590127Ab4ccB", "txHash": "0x7b991de0ac1a42dc8b2d2ba290f0c36ed40d9433d06af0a726e36f723a561fe2", "kind": "transparent" + }, + { + "address": "0x6f60625c5B4Bdf89b9F18B9c681310E6B3dAcDbD", + "txHash": "0x0f2bb0b3e4f47f23838fdcf6062ef273e2b5dd03e06c41166f8857272ef24e1c", + "kind": "transparent" } ], "impls": { @@ -1283,6 +1288,329 @@ }, "namespaces": {} } + }, + "625b0bbf06f5cc4dd25c6f8d9b6bea67b59d5ed0c3eb5a35af6bb9c0a252db8b": { + "address": "0x7e6f463765cf20cb3bD3ac437cFde89c157a4223", + "txHash": "0x1abe1cf66b7345e699f8800c4a9eacb86451e13745d003d821e5cd182084af66", + "layout": { + "solcVersion": "0.8.24", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:63", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:68" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:40" + }, + { + "label": "_balances", + "offset": 0, + "slot": "51", + "type": "t_mapping(t_address,t_uint256)", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:40" + }, + { + "label": "_allowances", + "offset": 0, + "slot": "52", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:42" + }, + { + "label": "_totalSupply", + "offset": 0, + "slot": "53", + "type": "t_uint256", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:44" + }, + { + "label": "_name", + "offset": 0, + "slot": "54", + "type": "t_string_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:46" + }, + { + "label": "_symbol", + "offset": 0, + "slot": "55", + "type": "t_string_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:47" + }, + { + "label": "__gap", + "offset": 0, + "slot": "56", + "type": "t_array(t_uint256)45_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:376" + }, + { + "label": "__gap", + "offset": 0, + "slot": "101", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC20BurnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol:51" + }, + { + "label": "_owner", + "offset": 0, + "slot": "151", + "type": "t_address", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22" + }, + { + "label": "__gap", + "offset": 0, + "slot": "152", + "type": "t_array(t_uint256)49_storage", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:94" + }, + { + "label": "_paused", + "offset": 0, + "slot": "201", + "type": "t_bool", + "contract": "PausableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:29" + }, + { + "label": "__gap", + "offset": 0, + "slot": "202", + "type": "t_array(t_uint256)49_storage", + "contract": "PausableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:116" + }, + { + "label": "_status", + "offset": 0, + "slot": "251", + "type": "t_uint256", + "contract": "ReentrancyGuardUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol:38" + }, + { + "label": "__gap", + "offset": 0, + "slot": "252", + "type": "t_array(t_uint256)49_storage", + "contract": "ReentrancyGuardUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol:88" + }, + { + "label": "underlying", + "offset": 0, + "slot": "301", + "type": "t_contract(IERC20Upgradeable)1950", + "contract": "DRBalancerVault", + "src": "contracts/DRBalancerVault.sol:83" + }, + { + "label": "perp", + "offset": 0, + "slot": "302", + "type": "t_contract(IPerpetualTranche)413", + "contract": "DRBalancerVault", + "src": "contracts/DRBalancerVault.sol:86" + }, + { + "label": "stampl", + "offset": 0, + "slot": "303", + "type": "t_contract(IRolloverVault)501", + "contract": "DRBalancerVault", + "src": "contracts/DRBalancerVault.sol:89" + }, + { + "label": "underlyingUnitAmt", + "offset": 0, + "slot": "304", + "type": "t_uint256", + "contract": "DRBalancerVault", + "src": "contracts/DRBalancerVault.sol:92" + }, + { + "label": "perpUnitAmt", + "offset": 0, + "slot": "305", + "type": "t_uint256", + "contract": "DRBalancerVault", + "src": "contracts/DRBalancerVault.sol:95" + }, + { + "label": "keeper", + "offset": 0, + "slot": "306", + "type": "t_address", + "contract": "DRBalancerVault", + "src": "contracts/DRBalancerVault.sol:98" + }, + { + "label": "targetDR", + "offset": 0, + "slot": "307", + "type": "t_uint256", + "contract": "DRBalancerVault", + "src": "contracts/DRBalancerVault.sol:101" + }, + { + "label": "equilibriumDR", + "offset": 0, + "slot": "308", + "type": "t_struct(Range)32_storage", + "contract": "DRBalancerVault", + "src": "contracts/DRBalancerVault.sol:106" + }, + { + "label": "lagFactorUnderlyingToPerp", + "offset": 0, + "slot": "310", + "type": "t_uint256", + "contract": "DRBalancerVault", + "src": "contracts/DRBalancerVault.sol:109" + }, + { + "label": "lagFactorPerpToUnderlying", + "offset": 0, + "slot": "311", + "type": "t_uint256", + "contract": "DRBalancerVault", + "src": "contracts/DRBalancerVault.sol:112" + }, + { + "label": "minRebalanceVal", + "offset": 0, + "slot": "312", + "type": "t_uint256", + "contract": "DRBalancerVault", + "src": "contracts/DRBalancerVault.sol:115" + }, + { + "label": "rebalanceFreqSec", + "offset": 0, + "slot": "313", + "type": "t_uint256", + "contract": "DRBalancerVault", + "src": "contracts/DRBalancerVault.sol:118" + }, + { + "label": "lastRebalanceTimestampSec", + "offset": 0, + "slot": "314", + "type": "t_uint256", + "contract": "DRBalancerVault", + "src": "contracts/DRBalancerVault.sol:121" + }, + { + "label": "maxSwapFeePerc", + "offset": 0, + "slot": "315", + "type": "t_uint256", + "contract": "DRBalancerVault", + "src": "contracts/DRBalancerVault.sol:124" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)45_storage": { + "label": "uint256[45]", + "numberOfBytes": "1440" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(IERC20Upgradeable)1950": { + "label": "contract IERC20Upgradeable", + "numberOfBytes": "20" + }, + "t_contract(IPerpetualTranche)413": { + "label": "contract IPerpetualTranche", + "numberOfBytes": "20" + }, + "t_contract(IRolloverVault)501": { + "label": "contract IRolloverVault", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "label": "mapping(address => mapping(address => uint256))", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)", + "numberOfBytes": "32" + }, + "t_string_storage": { + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(Range)32_storage": { + "label": "struct Range", + "members": [ + { + "label": "lower", + "type": "t_uint256", + "offset": 0, + "slot": "0" + }, + { + "label": "upper", + "type": "t_uint256", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + }, + "namespaces": {} + } } } } diff --git a/spot-vaults/.openzeppelin/sepolia.json b/spot-vaults/.openzeppelin/sepolia.json index 4e464dd5..203d361b 100644 --- a/spot-vaults/.openzeppelin/sepolia.json +++ b/spot-vaults/.openzeppelin/sepolia.json @@ -5,6 +5,11 @@ "address": "0xc3f6D1F1d253EdC8B34D78Bc6cDD2b3eEFAd76BD", "txHash": "0xe08468aac2fe4f178e7dbddd07de8bb8d4e8066358082aa0a17c1be74400ad7c", "kind": "transparent" + }, + { + "address": "0xB02114487836409136B0006A090995D63931C486", + "txHash": "0x2764db52ff079c7e1a6cbd293eb914089977ee9968c01cf8a9302aa660947ec9", + "kind": "transparent" } ], "impls": { @@ -645,6 +650,329 @@ }, "namespaces": {} } + }, + "625b0bbf06f5cc4dd25c6f8d9b6bea67b59d5ed0c3eb5a35af6bb9c0a252db8b": { + "address": "0x932Ba53192a3206825A9F9393FE669C9CEf7ee37", + "txHash": "0xac53eebc0ce079d2999b697eceaa933d68af6960c90a8b87690ce4d60549e4e0", + "layout": { + "solcVersion": "0.8.24", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:63", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:68" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:40" + }, + { + "label": "_balances", + "offset": 0, + "slot": "51", + "type": "t_mapping(t_address,t_uint256)", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:40" + }, + { + "label": "_allowances", + "offset": 0, + "slot": "52", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:42" + }, + { + "label": "_totalSupply", + "offset": 0, + "slot": "53", + "type": "t_uint256", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:44" + }, + { + "label": "_name", + "offset": 0, + "slot": "54", + "type": "t_string_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:46" + }, + { + "label": "_symbol", + "offset": 0, + "slot": "55", + "type": "t_string_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:47" + }, + { + "label": "__gap", + "offset": 0, + "slot": "56", + "type": "t_array(t_uint256)45_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:376" + }, + { + "label": "__gap", + "offset": 0, + "slot": "101", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC20BurnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol:51" + }, + { + "label": "_owner", + "offset": 0, + "slot": "151", + "type": "t_address", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22" + }, + { + "label": "__gap", + "offset": 0, + "slot": "152", + "type": "t_array(t_uint256)49_storage", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:94" + }, + { + "label": "_paused", + "offset": 0, + "slot": "201", + "type": "t_bool", + "contract": "PausableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:29" + }, + { + "label": "__gap", + "offset": 0, + "slot": "202", + "type": "t_array(t_uint256)49_storage", + "contract": "PausableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:116" + }, + { + "label": "_status", + "offset": 0, + "slot": "251", + "type": "t_uint256", + "contract": "ReentrancyGuardUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol:38" + }, + { + "label": "__gap", + "offset": 0, + "slot": "252", + "type": "t_array(t_uint256)49_storage", + "contract": "ReentrancyGuardUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol:88" + }, + { + "label": "underlying", + "offset": 0, + "slot": "301", + "type": "t_contract(IERC20Upgradeable)1950", + "contract": "DRBalancerVault", + "src": "contracts/DRBalancerVault.sol:83" + }, + { + "label": "perp", + "offset": 0, + "slot": "302", + "type": "t_contract(IPerpetualTranche)413", + "contract": "DRBalancerVault", + "src": "contracts/DRBalancerVault.sol:86" + }, + { + "label": "stampl", + "offset": 0, + "slot": "303", + "type": "t_contract(IRolloverVault)501", + "contract": "DRBalancerVault", + "src": "contracts/DRBalancerVault.sol:89" + }, + { + "label": "underlyingUnitAmt", + "offset": 0, + "slot": "304", + "type": "t_uint256", + "contract": "DRBalancerVault", + "src": "contracts/DRBalancerVault.sol:92" + }, + { + "label": "perpUnitAmt", + "offset": 0, + "slot": "305", + "type": "t_uint256", + "contract": "DRBalancerVault", + "src": "contracts/DRBalancerVault.sol:95" + }, + { + "label": "keeper", + "offset": 0, + "slot": "306", + "type": "t_address", + "contract": "DRBalancerVault", + "src": "contracts/DRBalancerVault.sol:98" + }, + { + "label": "targetDR", + "offset": 0, + "slot": "307", + "type": "t_uint256", + "contract": "DRBalancerVault", + "src": "contracts/DRBalancerVault.sol:101" + }, + { + "label": "equilibriumDR", + "offset": 0, + "slot": "308", + "type": "t_struct(Range)32_storage", + "contract": "DRBalancerVault", + "src": "contracts/DRBalancerVault.sol:106" + }, + { + "label": "lagFactorUnderlyingToPerp", + "offset": 0, + "slot": "310", + "type": "t_uint256", + "contract": "DRBalancerVault", + "src": "contracts/DRBalancerVault.sol:109" + }, + { + "label": "lagFactorPerpToUnderlying", + "offset": 0, + "slot": "311", + "type": "t_uint256", + "contract": "DRBalancerVault", + "src": "contracts/DRBalancerVault.sol:112" + }, + { + "label": "minRebalanceVal", + "offset": 0, + "slot": "312", + "type": "t_uint256", + "contract": "DRBalancerVault", + "src": "contracts/DRBalancerVault.sol:115" + }, + { + "label": "rebalanceFreqSec", + "offset": 0, + "slot": "313", + "type": "t_uint256", + "contract": "DRBalancerVault", + "src": "contracts/DRBalancerVault.sol:118" + }, + { + "label": "lastRebalanceTimestampSec", + "offset": 0, + "slot": "314", + "type": "t_uint256", + "contract": "DRBalancerVault", + "src": "contracts/DRBalancerVault.sol:121" + }, + { + "label": "maxSwapFeePerc", + "offset": 0, + "slot": "315", + "type": "t_uint256", + "contract": "DRBalancerVault", + "src": "contracts/DRBalancerVault.sol:124" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)45_storage": { + "label": "uint256[45]", + "numberOfBytes": "1440" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(IERC20Upgradeable)1950": { + "label": "contract IERC20Upgradeable", + "numberOfBytes": "20" + }, + "t_contract(IPerpetualTranche)413": { + "label": "contract IPerpetualTranche", + "numberOfBytes": "20" + }, + "t_contract(IRolloverVault)501": { + "label": "contract IRolloverVault", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "label": "mapping(address => mapping(address => uint256))", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)", + "numberOfBytes": "32" + }, + "t_string_storage": { + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(Range)32_storage": { + "label": "struct Range", + "members": [ + { + "label": "lower", + "type": "t_uint256", + "offset": 0, + "slot": "0" + }, + { + "label": "upper", + "type": "t_uint256", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + }, + "namespaces": {} + } } } } diff --git a/spot-vaults/tasks/deploy.ts b/spot-vaults/tasks/deploy.ts index f7a1e2b8..6b48cb31 100644 --- a/spot-vaults/tasks/deploy.ts +++ b/spot-vaults/tasks/deploy.ts @@ -1,3 +1,4 @@ +import { getAdminAddress, getImplementationAddress } from "@openzeppelin/upgrades-core"; import { task, types } from "hardhat/config"; import { TaskArguments } from "hardhat/types"; import { sleep } from "./tools"; @@ -166,3 +167,87 @@ task("deploy:CharmManager") console.log("Skipping verification"); } }); + +task("deploy:DRBalancerVault") + .addParam( + "name", + "the ERC20 name of the vault LP token", + undefined, + types.string, + false, + ) + .addParam( + "symbol", + "the ERC20 symbol of the vault LP token", + undefined, + types.string, + false, + ) + .addParam( + "underlying", + "the address of the underlying token", + undefined, + types.string, + false, + ) + .addParam("perp", "the address of the perp token", undefined, types.string, false) + .addParam( + "rolloverVault", + "the address of the stAMPL rollover vault", + undefined, + types.string, + false, + ) + .addParam("verify", "flag to set false for local deployments", true, types.boolean) + .setAction(async function (args: TaskArguments, hre) { + const deployer = (await hre.ethers.getSigners())[0]; + const deployerAddress = await deployer.getAddress(); + console.log("Deployer:", deployerAddress); + + const { name, symbol, underlying, perp, rolloverVault, verify } = args; + + // Deploy proxy + console.log("\n--- Deploying DRBalancerVault proxy ---"); + const DRBalancerVault = await hre.ethers.getContractFactory("DRBalancerVault"); + const vault = await hre.upgrades.deployProxy( + DRBalancerVault.connect(deployer), + [name, symbol, underlying, perp, rolloverVault], + { + initializer: "init(string,string,address,address,address)", + }, + ); + await vault.waitForDeployment(); + const proxyAddress = vault.target; + console.log("DRBalancerVault proxy:", proxyAddress); + + // Get proxy admin and implementation addresses + const proxyAdminAddress = await getAdminAddress( + hre.ethers.provider, + proxyAddress as string, + ); + const implAddress = await getImplementationAddress( + hre.ethers.provider, + proxyAddress as string, + ); + console.log("ProxyAdmin:", proxyAdminAddress); + console.log("Implementation:", implAddress); + + // Verify contracts + if (verify) { + console.log("\n--- Verifying contracts ---"); + await sleep(30); + try { + await hre.run("verify:contract", { + address: proxyAddress, + }); + } catch (e) { + console.log("Verification failed (may already be verified):", e.message); + } + } + + console.log("\n--- Deployment Summary ---"); + console.log("DRBalancerVault proxy:", proxyAddress); + console.log("ProxyAdmin:", proxyAdminAddress); + console.log("Implementation:", implAddress); + console.log("Owner:", deployerAddress); + }); diff --git a/spot-vaults/tasks/info.ts b/spot-vaults/tasks/info.ts index 63a6f5c1..3d3d8771 100644 --- a/spot-vaults/tasks/info.ts +++ b/spot-vaults/tasks/info.ts @@ -191,6 +191,135 @@ task("info:BillBroker") } }); +task("info:DRBalancerVault") + .addPositionalParam( + "address", + "the address of the DR balancer vault contract", + undefined, + types.string, + false, + ) + .setAction(async function (args: TaskArguments, hre) { + const { address } = args; + + const vault = await hre.ethers.getContractAt("DRBalancerVault", address); + const vaultDecimals = await vault.DECIMALS(); + const drDecimals = await vault.DR_DECIMALS(); + const proxyAdminAddress = await getAdminAddress(hre.ethers.provider, address); + const implAddress = await getImplementationAddress(hre.ethers.provider, address); + + const underlying = await hre.ethers.getContractAt("ERC20", await vault.underlying()); + const underlyingDecimals = await underlying.decimals(); + const perp = await hre.ethers.getContractAt("ERC20", await vault.perp()); + const perpDecimals = await perp.decimals(); + const stampl = await vault.stampl(); + + console.log("---------------------------------------------------------------"); + console.log("DRBalancerVault:", vault.target); + console.log("owner:", await vault.owner()); + console.log("keeper:", await vault.keeper()); + console.log("proxyAdmin:", proxyAdminAddress); + console.log("implementation:", implAddress); + console.log("paused:", await vault.paused()); + + console.log("---------------------------------------------------------------"); + console.log("Tokens:"); + console.log("underlying:", underlying.target, `(${await underlying.symbol()})`); + console.log("perp:", perp.target, `(${await perp.symbol()})`); + console.log("stampl:", stampl); + + console.log("---------------------------------------------------------------"); + console.log("Configuration:"); + const targetDR = await vault.targetDR(); + const equilibriumDR = await vault.equilibriumDR(); + console.table([ + ["targetDR", pp(targetDR, drDecimals)], + ["equilibriumDR.lower", pp(equilibriumDR[0], drDecimals)], + ["equilibriumDR.upper", pp(equilibriumDR[1], drDecimals)], + ["lagFactorUnderlyingToPerp", (await vault.lagFactorUnderlyingToPerp()).toString()], + ["lagFactorPerpToUnderlying", (await vault.lagFactorPerpToUnderlying()).toString()], + ["minRebalanceVal", pp(await vault.minRebalanceVal(), underlyingDecimals)], + ["rebalanceFreqSec", (await vault.rebalanceFreqSec()).toString()], + ["maxSwapFeePerc", pp(await vault.maxSwapFeePerc(), vaultDecimals)], + ]); + + console.log("---------------------------------------------------------------"); + console.log("State:"); + const underlyingBal = await vault.underlyingBalance(); + const perpBal = await vault.perpBalance(); + const totalSupply = await vault.totalSupply(); + const lastRebalance = await vault.lastRebalanceTimestampSec(); + const lastRebalanceDate = + lastRebalance > 0 ? new Date(Number(lastRebalance) * 1000).toISOString() : "never"; + + console.table([ + ["underlyingBalance", pp(underlyingBal, underlyingDecimals)], + ["perpBalance", pp(perpBal, perpDecimals)], + ["totalSupply (notes)", pp(totalSupply, vaultDecimals)], + ["lastRebalanceTimestampSec", lastRebalance.toString()], + ["lastRebalanceDate", lastRebalanceDate], + ]); + + try { + const tvl = await vault.getTVL.staticCall(); + console.log("TVL (underlying denomination):", pp(tvl, underlyingDecimals)); + + const stamplContract = await hre.ethers.getContractAt("IRolloverVault", stampl); + const currentDR = await stamplContract.deviationRatio.staticCall(); + console.log("Current system DR:", pp(currentDR, drDecimals)); + + const [rebalanceAmt, isUnderlyingIntoPerp] = + await vault.computeRebalanceAmount.staticCall(); + console.log("---------------------------------------------------------------"); + console.log("Rebalance Preview:"); + console.log("rebalanceAmount:", pp(rebalanceAmt, underlyingDecimals)); + console.log( + "direction:", + isUnderlyingIntoPerp + ? "underlying -> perp (mint)" + : "perp -> underlying (redeem)", + ); + + // Check if rebalance is pokable + console.log("---------------------------------------------------------------"); + console.log("Rebalance Pokability:"); + + const currentTimestamp = Math.floor(Date.now() / 1000); + const rebalanceFreq = Number(await vault.rebalanceFreqSec()); + const nextRebalanceTimestamp = Number(lastRebalance) + rebalanceFreq; + const timeElapsed = currentTimestamp >= nextRebalanceTimestamp; + const secondsUntilPokable = timeElapsed + ? 0 + : nextRebalanceTimestamp - currentTimestamp; + + const equilibriumDR = await vault.equilibriumDR(); + const inEquilibriumZone = + currentDR >= equilibriumDR[0] && currentDR <= equilibriumDR[1]; + + console.table([ + ["timeElapsed", timeElapsed], + ["secondsUntilPokable", secondsUntilPokable], + ["inEquilibriumZone", inEquilibriumZone], + ["hasRebalanceAmount", rebalanceAmt > 0n], + ]); + + // Try static call to see if rebalance would succeed + let rebalanceExecutable = false; + try { + await vault.rebalance.staticCall(); + rebalanceExecutable = true; + } catch (e) { + // rebalance not executable + } + console.log("rebalanceExecutable:", rebalanceExecutable); + } catch (e) { + console.log(e); + console.log("Unable to fetch dynamic state (TVL/DR/rebalance)"); + } + + console.log("---------------------------------------------------------------"); + }); + task("info:WethWamplManager") .addPositionalParam( "address", diff --git a/spot-vaults/tasks/ops.ts b/spot-vaults/tasks/ops.ts index 4283edb4..6848e578 100644 --- a/spot-vaults/tasks/ops.ts +++ b/spot-vaults/tasks/ops.ts @@ -414,3 +414,231 @@ task("ops:swapPerpsForUSD") ethers.formatUnits(await perp.balanceOf(signerAddress), await perp.decimals()), ); }); + +task("ops:drVaultRebalance", "Calls rebalance on DRBalancerVault") + .addParam( + "address", + "the address of the DRBalancerVault contract", + undefined, + types.string, + false, + ) + .setAction(async function (args: TaskArguments, hre) { + const signer = (await hre.ethers.getSigners())[0]; + const signerAddress = await signer.getAddress(); + console.log("Signer", signerAddress); + + const { address } = args; + const vault = await hre.ethers.getContractAt("DRBalancerVault", address); + const underlying = await hre.ethers.getContractAt("ERC20", await vault.underlying()); + const perp = await hre.ethers.getContractAt("ERC20", await vault.perp()); + const stampl = await hre.ethers.getContractAt("IRolloverVault", await vault.stampl()); + const underlyingDecimals = await underlying.decimals(); + const perpDecimals = await perp.decimals(); + const drDecimals = await vault.DR_DECIMALS(); + + console.log("---------------------------------------------------------------"); + console.log("State before rebalance:"); + const drBefore = await stampl.deviationRatio.staticCall(); + console.log("System DR:", ethers.formatUnits(drBefore, drDecimals)); + console.log( + "Vault underlying balance:", + ethers.formatUnits(await vault.underlyingBalance(), underlyingDecimals), + ); + console.log( + "Vault perp balance:", + ethers.formatUnits(await vault.perpBalance(), perpDecimals), + ); + + const lastRebalance = await vault.lastRebalanceTimestampSec(); + const rebalanceFreq = await vault.rebalanceFreqSec(); + const nextRebalanceTime = Number(lastRebalance) + Number(rebalanceFreq); + const now = Math.floor(Date.now() / 1000); + console.log( + "Last rebalance:", + lastRebalance > 0 ? new Date(Number(lastRebalance) * 1000).toISOString() : "never", + ); + console.log("Rebalance frequency (sec):", rebalanceFreq.toString()); + console.log( + "Can rebalance:", + now >= nextRebalanceTime ? "yes" : `no (wait ${nextRebalanceTime - now}s)`, + ); + + console.log("---------------------------------------------------------------"); + console.log("Rebalance preview:"); + try { + const [rebalanceAmt, isUnderlyingIntoPerp] = + await vault.computeRebalanceAmount.staticCall(); + console.log( + "Rebalance amount:", + ethers.formatUnits(rebalanceAmt, underlyingDecimals), + ); + console.log( + "Direction:", + isUnderlyingIntoPerp + ? "underlying -> perp (mint)" + : "perp -> underlying (redeem)", + ); + + if (rebalanceAmt === 0n) { + console.log( + "No rebalance needed (within equilibrium range or insufficient liquidity)", + ); + return; + } + } catch (e) { + console.log("Unable to preview rebalance:", e.message); + } + + console.log("---------------------------------------------------------------"); + console.log("Execution:"); + console.log("Calling rebalance..."); + const tx = await vault.connect(signer).rebalance(); + await tx.wait(); + console.log("Tx", tx.hash); + + console.log("---------------------------------------------------------------"); + console.log("State after rebalance:"); + const drAfter = await stampl.deviationRatio.staticCall(); + console.log("System DR:", ethers.formatUnits(drAfter, drDecimals)); + console.log( + "Vault underlying balance:", + ethers.formatUnits(await vault.underlyingBalance(), underlyingDecimals), + ); + console.log( + "Vault perp balance:", + ethers.formatUnits(await vault.perpBalance(), perpDecimals), + ); + }); + +task("ops:drVaultDeposit", "Deposits underlying and perp tokens to DRBalancerVault") + .addParam( + "address", + "the address of the DRBalancerVault contract", + undefined, + types.string, + false, + ) + .addParam( + "underlyingAmount", + "the amount of underlying tokens (in float) to deposit", + undefined, + types.string, + false, + ) + .addParam( + "perpAmount", + "the amount of perp tokens (in float) to deposit", + undefined, + types.string, + false, + ) + .setAction(async function (args: TaskArguments, hre) { + const signer = (await hre.ethers.getSigners())[0]; + const signerAddress = await signer.getAddress(); + console.log("Signer", signerAddress); + + const { address, underlyingAmount, perpAmount } = args; + const vault = await hre.ethers.getContractAt("DRBalancerVault", address); + const underlying = await hre.ethers.getContractAt("ERC20", await vault.underlying()); + const perp = await hre.ethers.getContractAt("ERC20", await vault.perp()); + const underlyingDecimals = await underlying.decimals(); + const perpDecimals = await perp.decimals(); + const underlyingFixedPtAmount = ethers.parseUnits( + underlyingAmount, + underlyingDecimals, + ); + const perpFixedPtAmount = ethers.parseUnits(perpAmount, perpDecimals); + + console.log( + "Signer underlying balance", + ethers.formatUnits(await underlying.balanceOf(signerAddress), underlyingDecimals), + ); + console.log( + "Signer perp balance", + ethers.formatUnits(await perp.balanceOf(signerAddress), perpDecimals), + ); + + console.log("---------------------------------------------------------------"); + console.log("Preview deposit:"); + const [expectedNotes, expectedUnderlying, expectedPerp] = + await vault.computeMintAmt.staticCall(underlyingFixedPtAmount, perpFixedPtAmount); + console.log( + "Expected notes:", + ethers.formatUnits(expectedNotes, await vault.decimals()), + ); + console.log( + "Expected underlying in:", + ethers.formatUnits(expectedUnderlying, underlyingDecimals), + ); + console.log("Expected perp in:", ethers.formatUnits(expectedPerp, perpDecimals)); + + console.log("---------------------------------------------------------------"); + console.log("Execution:"); + console.log("Approving vault to spend tokens:"); + if ( + (await underlying.allowance(signerAddress, vault.target)) < underlyingFixedPtAmount + ) { + const tx1 = await underlying + .connect(signer) + .approve(vault.target, underlyingFixedPtAmount); + await tx1.wait(); + console.log("Tx", tx1.hash); + } + if ((await perp.allowance(signerAddress, vault.target)) < perpFixedPtAmount) { + const tx2 = await perp.connect(signer).approve(vault.target, perpFixedPtAmount); + await tx2.wait(); + console.log("Tx", tx2.hash); + } + + console.log("Deposit:"); + const tx3 = await vault + .connect(signer) + .deposit(underlyingFixedPtAmount, perpFixedPtAmount, 0); + await tx3.wait(); + console.log("Tx", tx3.hash); + + console.log("---------------------------------------------------------------"); + console.log( + "Signer vault notes balance", + ethers.formatUnits(await vault.balanceOf(signerAddress), await vault.decimals()), + ); + console.log( + "Signer underlying balance", + ethers.formatUnits(await underlying.balanceOf(signerAddress), underlyingDecimals), + ); + console.log( + "Signer perp balance", + ethers.formatUnits(await perp.balanceOf(signerAddress), perpDecimals), + ); + + console.log("---------------------------------------------------------------"); + console.log("Rebalance status:"); + const lastRebalance = await vault.lastRebalanceTimestampSec(); + const rebalanceFreq = await vault.rebalanceFreqSec(); + const nextRebalanceTime = Number(lastRebalance) + Number(rebalanceFreq); + const now = Math.floor(Date.now() / 1000); + const canRebalance = now >= nextRebalanceTime; + console.log( + "Can rebalance:", + canRebalance ? "yes" : `no (wait ${nextRebalanceTime - now}s)`, + ); + + try { + const [rebalanceAmt, isUnderlyingIntoPerp] = + await vault.computeRebalanceAmount.staticCall(); + console.log( + "Rebalance amount:", + ethers.formatUnits(rebalanceAmt, underlyingDecimals), + ); + console.log( + "Direction:", + isUnderlyingIntoPerp + ? "underlying -> perp (mint)" + : "perp -> underlying (redeem)", + ); + console.log("Rebalance pokable:", canRebalance && rebalanceAmt > 0n ? "yes" : "no"); + } catch (e) { + console.log("Unable to compute rebalance:", e.message); + } + }); diff --git a/spot-vaults/tasks/scripts/mainnet.sh b/spot-vaults/tasks/scripts/mainnet.sh index 9b0eb47f..05d7784b 100644 --- a/spot-vaults/tasks/scripts/mainnet.sh +++ b/spot-vaults/tasks/scripts/mainnet.sh @@ -24,6 +24,13 @@ yarn hardhat --network mainnet deploy:CharmManager \ --vault "0x2dcaff0f75765d7867887fc402b71c841b3a4bfb" \ --oracle "0x0f8f519878c10ce36C6aAF89c1AeefaaDE5D7881" +yarn hardhat --network mainnet deploy:DRBalancerVault \ + --name "DR Balancer Vault" \ + --symbol "DR-VAULT" \ + --underlying "0xD46bA6D942050d489DBd938a2C909A5d5039A161" \ + --perp "0xC1f33e0cf7e40a67375007104B929E49a581bafE" \ + --rollover-vault "0x82A91a0D599A45d8E9Af781D67f695d7C72869Bd" + yarn hardhat --network mainnet transferOwnership "0xA088Aef966CAD7fE0B38e28c2E07590127Ab4ccB" \ --new-owner-address "0x57981B1EaFe4b18EC97f8B10859B40207b364662" @@ -33,11 +40,18 @@ yarn hardhat --network mainnet transferOwnership "0x574fca658b4B59E965C0e5f74761 yarn hardhat --network mainnet transferOwnership "0x2f67158859Fe0f69f5773570eC60444Fe0c1693c" \ --new-owner-address "0x57981B1EaFe4b18EC97f8B10859B40207b364662" +yarn hardhat --network mainnet transferOwnership "0xd6e88D952ea0B1dFa42018c81eb597b3C1e2BF48" \ + --new-owner-address "0x57981B1EaFe4b18EC97f8B10859B40207b364662" + +yarn hardhat --network mainnet transferOwnership "0x6f60625c5B4Bdf89b9F18B9c681310E6B3dAcDbD" \ + --new-owner-address "0x57981B1EaFe4b18EC97f8B10859B40207b364662" + ######################################################################## ## INFO yarn hardhat --network mainnet info:MetaOracle "0x0f8f519878c10ce36C6aAF89c1AeefaaDE5D7881" yarn hardhat --network mainnet info:BillBroker "0xA088Aef966CAD7fE0B38e28c2E07590127Ab4ccB" +yarn hardhat --network mainnet info:DRBalancerVault "0x6f60625c5B4Bdf89b9F18B9c681310E6B3dAcDbD" yarn hardhat --network mainnet info:WethWamplManager "0x574fca658b4B59E965C0e5f74761AE0Ac41DA6a7" yarn hardhat --network mainnet info:UsdcSpotManager "0x2f67158859Fe0f69f5773570eC60444Fe0c1693c" @@ -61,6 +75,14 @@ yarn hardhat --network mainnet ops:redeem \ --address "0xA088Aef966CAD7fE0B38e28c2E07590127Ab4ccB" \ --amount 1000 +yarn hardhat --network mainnet ops:drVaultDeposit \ + --address "" \ + --underlying-amount 1000 \ + --perp-amount 1000 + +yarn hardhat --network mainnet ops:drVaultRebalance \ + --address "" + ######################################################################## ## Upgrade diff --git a/spot-vaults/tasks/scripts/sepolia.sh b/spot-vaults/tasks/scripts/sepolia.sh index 86ac002e..5cac919d 100644 --- a/spot-vaults/tasks/scripts/sepolia.sh +++ b/spot-vaults/tasks/scripts/sepolia.sh @@ -15,10 +15,18 @@ yarn hardhat --network sepolia deploy:BillBroker \ --perp "0xdcCef9065876fD654bAddeBAa778FDA43E0bfC1F" \ --pricing-strategy "0x08c5b39F000705ebeC8427C1d64D6262392944EE" +yarn hardhat --network sepolia deploy:DRBalancerVault \ + --name "DR Balancer Vault" \ + --symbol "DR-VAULT" \ + --underlying "0x251410f849ad67bebffdb5a549e5f02d5d9c25ba" \ + --perp "0xdcCef9065876fD654bAddeBAa778FDA43E0bfC1F" \ + --rollover-vault "0x107614c6602A8e602952Da107B8fE62b5Ab13b04" + ######################################################################## ## INFO yarn hardhat --network sepolia info:BillBroker "0xc3f6D1F1d253EdC8B34D78Bc6cDD2b3eEFAd76BD" +yarn hardhat --network sepolia info:DRBalancerVault "0xB02114487836409136B0006A090995D63931C486" ######################################################################## ## OPS @@ -46,4 +54,12 @@ yarn hardhat --network sepolia ops:swapPerpsForUSD \ yarn hardhat --network sepolia ops:redeem \ --address "0xc3f6D1F1d253EdC8B34D78Bc6cDD2b3eEFAd76BD" \ - --amount 1000 \ No newline at end of file + --amount 1000 + +yarn hardhat --network sepolia ops:drVaultDeposit \ + --address "0xB02114487836409136B0006A090995D63931C486" \ + --underlying-amount 1000 \ + --perp-amount 1000 + +yarn hardhat --network sepolia ops:drVaultRebalance \ + --address "0xB02114487836409136B0006A090995D63931C486" \ No newline at end of file