diff --git a/packages/axis-utils/.prettierrc b/packages/axis-utils/.prettierrc index 0967ef4..02d542d 100644 --- a/packages/axis-utils/.prettierrc +++ b/packages/axis-utils/.prettierrc @@ -1 +1,3 @@ -{} +{ + "plugins": ["prettier-plugin-sh"] +} diff --git a/packages/axis-utils/foundry.toml b/packages/axis-utils/foundry.toml index 1a1d001..0657729 100644 --- a/packages/axis-utils/foundry.toml +++ b/packages/axis-utils/foundry.toml @@ -3,8 +3,8 @@ src = "src" out = "out" libs = ["lib"] fs_permissions = [ - {access = "read", path = "./dependencies/axis-core-1.0.0/script/env.json"}, - {access = "read", path = "./dependencies/axis-periphery-0.9.0/script/env.json"}, + {access = "read", path = "./dependencies/axis-core-1.0.1/script/env.json"}, + {access = "read", path = "./dependencies/axis-periphery-1.0.0/script/env.json"}, ] ffi = true solc_version = "0.8.19" @@ -32,8 +32,8 @@ ignore = [ [dependencies] forge-std = "1.9.1" solmate = { version = "6.7.0", url = "git@github.com:transmissions11/solmate.git", commit = "c892309933b25c03d32b1b0d674df7ae292ba925" } -axis-core = { version = "1.0.0" } -axis-periphery = { version = "0.9.0", git = "git@github.com:Axis-Fi/axis-periphery.git", rev = "a87edb37c610315dd46cd2d780863bb477f5c0c6" } +axis-core = { version = "1.0.1" } +axis-periphery = { version = "1.0.0" } solady = { version = "0.0.124" } clones-with-immutable-args = { version = "1.1.1", git = "git@github.com:wighawag/clones-with-immutable-args.git", rev = "f5ca191afea933d50a36d101009b5644dc28bc99" } "@openzeppelin-contracts" = { version = "4.9.2" } diff --git a/packages/axis-utils/package.json b/packages/axis-utils/package.json index c8ff3d4..fe8ac69 100644 --- a/packages/axis-utils/package.json +++ b/packages/axis-utils/package.json @@ -17,6 +17,7 @@ "license": "ISC", "devDependencies": { "prettier": "3.3.3", + "prettier-plugin-sh": "^0.14.0", "solhint-community": "^3.7.0" } } diff --git a/packages/axis-utils/pnpm-lock.yaml b/packages/axis-utils/pnpm-lock.yaml index 7ec3bc6..ecfccdc 100644 --- a/packages/axis-utils/pnpm-lock.yaml +++ b/packages/axis-utils/pnpm-lock.yaml @@ -11,6 +11,9 @@ importers: prettier: specifier: 3.3.3 version: 3.3.3 + prettier-plugin-sh: + specifier: ^0.14.0 + version: 0.14.0(prettier@3.3.3) solhint-community: specifier: ^3.7.0 version: 3.7.0 @@ -200,6 +203,9 @@ packages: resolution: {integrity: sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==} engines: {node: '>=10'} + mvdan-sh@0.10.1: + resolution: {integrity: sha512-kMbrH0EObaKmK3nVRKUIIya1dpASHIEusM13S4V1ViHFuxuNxCo+arxoa6j/dbV22YBGjl7UKJm9QQKJ2Crzhg==} + once@1.4.0: resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} @@ -222,6 +228,12 @@ packages: resolution: {integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==} engines: {node: '>=4'} + prettier-plugin-sh@0.14.0: + resolution: {integrity: sha512-hfXulj5+zEl/ulrO5kMuuTPKmXvOg0bnLHY1hKFNN/N+/903iZbNp8NyZBTsgI8dtkSgFfAEIQq0IQTyP1ZVFQ==} + engines: {node: '>=16.0.0'} + peerDependencies: + prettier: ^3.0.3 + prettier@2.8.8: resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==} engines: {node: '>=10.13.0'} @@ -248,6 +260,10 @@ packages: resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} hasBin: true + sh-syntax@0.4.2: + resolution: {integrity: sha512-/l2UZ5fhGZLVZa16XQM9/Vq/hezGGbdHeVEA01uWjOL1+7Ek/gt6FquW0iKKws4a9AYPYvlz6RyVvjh3JxOteg==} + engines: {node: '>=16.0.0'} + slice-ansi@4.0.0: resolution: {integrity: sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==} engines: {node: '>=10'} @@ -279,6 +295,9 @@ packages: text-table@0.2.0: resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} + tslib@2.6.3: + resolution: {integrity: sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==} + uri-js@4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} @@ -449,6 +468,8 @@ snapshots: dependencies: brace-expansion: 2.0.1 + mvdan-sh@0.10.1: {} + once@1.4.0: dependencies: wrappy: 1.0.2 @@ -470,6 +491,12 @@ snapshots: pluralize@8.0.0: {} + prettier-plugin-sh@0.14.0(prettier@3.3.3): + dependencies: + mvdan-sh: 0.10.1 + prettier: 3.3.3 + sh-syntax: 0.4.2 + prettier@2.8.8: optional: true @@ -483,6 +510,10 @@ snapshots: semver@6.3.1: {} + sh-syntax@0.4.2: + dependencies: + tslib: 2.6.3 + slice-ansi@4.0.0: dependencies: ansi-styles: 4.3.0 @@ -541,6 +572,8 @@ snapshots: text-table@0.2.0: {} + tslib@2.6.3: {} + uri-js@4.4.1: dependencies: punycode: 2.3.1 diff --git a/packages/axis-utils/remappings.txt b/packages/axis-utils/remappings.txt index b8594ec..7f9f24e 100644 --- a/packages/axis-utils/remappings.txt +++ b/packages/axis-utils/remappings.txt @@ -1,9 +1,9 @@ @forge-std-1.9.1=dependencies/forge-std-1.9.1/src -@axis-core-1.0.0=dependencies/axis-core-1.0.0/src +@axis-core-1.0.1=dependencies/axis-core-1.0.1/src @solmate-6.7.0=dependencies/solmate-6.7.0/src -@axis-periphery-0.9.0=dependencies/axis-periphery-0.9.0/src -@axis-periphery-0.9.0-script=dependencies/axis-periphery-0.9.0/script -@axis-periphery-0.9.0-test=dependencies/axis-periphery-0.9.0/test +@axis-periphery-1.0.0=dependencies/axis-periphery-1.0.0/src +@axis-periphery-1.0.0-script=dependencies/axis-periphery-1.0.0/script +@axis-periphery-1.0.0-test=dependencies/axis-periphery-1.0.0/test @solady-0.0.124=dependencies/solady-0.0.124/src @clones-with-immutable-args-1.1.1=dependencies/clones-with-immutable-args-1.1.1/src @openzeppelin-contracts-4.9.2=dependencies/@openzeppelin-contracts-4.9.2 diff --git a/packages/axis-utils/script/WithEnvironment.s.sol b/packages/axis-utils/script/WithEnvironment.s.sol index 8ff6e87..c30521f 100644 --- a/packages/axis-utils/script/WithEnvironment.s.sol +++ b/packages/axis-utils/script/WithEnvironment.s.sol @@ -17,8 +17,8 @@ abstract contract WithEnvironment is Script { console2.log("Using chain:", chain_); // Load environment file - envAxisCore = vm.readFile("dependencies/axis-core-1.0.0/script/env.json"); - envAxisPeriphery = vm.readFile("dependencies/axis-periphery-0.9.0/script/env.json"); + envAxisCore = vm.readFile("dependencies/axis-core-1.0.1/script/env.json"); + envAxisPeriphery = vm.readFile("dependencies/axis-periphery-1.0.0/script/env.json"); } /// @notice Get address from environment file diff --git a/packages/axis-utils/script/developer-guide/atomic/purchase.s.sol b/packages/axis-utils/script/developer-guide/atomic/purchase.s.sol index ee88aa0..601d2e5 100644 --- a/packages/axis-utils/script/developer-guide/atomic/purchase.s.sol +++ b/packages/axis-utils/script/developer-guide/atomic/purchase.s.sol @@ -10,8 +10,8 @@ import {Constants} from "../constants.s.sol"; import {MockERC20} from "../../../test/mocks/MockERC20.sol"; // Axis contracts -import {IAtomicAuctionHouse} from "@axis-core-1.0.0/interfaces/IAtomicAuctionHouse.sol"; -import {IFixedPriceSale} from "@axis-core-1.0.0/interfaces/modules/auctions/IFixedPriceSale.sol"; +import {IAtomicAuctionHouse} from "@axis-core-1.0.1/interfaces/IAtomicAuctionHouse.sol"; +import {IFixedPriceSale} from "@axis-core-1.0.1/interfaces/modules/auctions/IFixedPriceSale.sol"; contract PurchaseScript is Script, Constants { function run(bool usePermit2_) public { diff --git a/packages/axis-utils/script/developer-guide/batch/abort.s.sol b/packages/axis-utils/script/developer-guide/batch/abort.s.sol index c6ceb02..6423377 100644 --- a/packages/axis-utils/script/developer-guide/batch/abort.s.sol +++ b/packages/axis-utils/script/developer-guide/batch/abort.s.sol @@ -7,7 +7,7 @@ import {console2} from "@forge-std-1.9.1/console2.sol"; import {Constants} from "../constants.s.sol"; // Axis contracts -import {IBatchAuctionHouse} from "@axis-core-1.0.0/interfaces/IBatchAuctionHouse.sol"; +import {IBatchAuctionHouse} from "@axis-core-1.0.1/interfaces/IBatchAuctionHouse.sol"; contract AbortScript is Script, Constants { function run() public { diff --git a/packages/axis-utils/script/developer-guide/batch/bid-cancel.s.sol b/packages/axis-utils/script/developer-guide/batch/bid-cancel.s.sol index c6c2998..aa68ad5 100644 --- a/packages/axis-utils/script/developer-guide/batch/bid-cancel.s.sol +++ b/packages/axis-utils/script/developer-guide/batch/bid-cancel.s.sol @@ -7,8 +7,8 @@ import {console2} from "@forge-std-1.9.1/console2.sol"; import {Constants} from "../constants.s.sol"; // Axis contracts -import {IBatchAuctionHouse} from "@axis-core-1.0.0/interfaces/IBatchAuctionHouse.sol"; -import {IBatchAuction} from "@axis-core-1.0.0/interfaces/modules/IBatchAuction.sol"; +import {IBatchAuctionHouse} from "@axis-core-1.0.1/interfaces/IBatchAuctionHouse.sol"; +import {IBatchAuction} from "@axis-core-1.0.1/interfaces/modules/IBatchAuction.sol"; contract BidCancelScript is Script, Constants { function run() public { diff --git a/packages/axis-utils/script/developer-guide/batch/bid-claim.s.sol b/packages/axis-utils/script/developer-guide/batch/bid-claim.s.sol index 9f24f6f..52e472f 100644 --- a/packages/axis-utils/script/developer-guide/batch/bid-claim.s.sol +++ b/packages/axis-utils/script/developer-guide/batch/bid-claim.s.sol @@ -7,7 +7,7 @@ import {console2} from "@forge-std-1.9.1/console2.sol"; import {Constants} from "../constants.s.sol"; // Axis contracts -import {IBatchAuctionHouse} from "@axis-core-1.0.0/interfaces/IBatchAuctionHouse.sol"; +import {IBatchAuctionHouse} from "@axis-core-1.0.1/interfaces/IBatchAuctionHouse.sol"; contract BidClaimScript is Script, Constants { function run() public { diff --git a/packages/axis-utils/script/developer-guide/batch/bid-submit.s.sol b/packages/axis-utils/script/developer-guide/batch/bid-submit.s.sol index d775f8b..4188c77 100644 --- a/packages/axis-utils/script/developer-guide/batch/bid-submit.s.sol +++ b/packages/axis-utils/script/developer-guide/batch/bid-submit.s.sol @@ -10,12 +10,12 @@ import {Constants} from "../constants.s.sol"; import {MockERC20} from "../../../test/mocks/MockERC20.sol"; // Axis contracts -import {IBatchAuctionHouse} from "@axis-core-1.0.0/interfaces/IBatchAuctionHouse.sol"; +import {IBatchAuctionHouse} from "@axis-core-1.0.1/interfaces/IBatchAuctionHouse.sol"; import {IEncryptedMarginalPrice} from - "@axis-core-1.0.0/interfaces/modules/auctions/IEncryptedMarginalPrice.sol"; + "@axis-core-1.0.1/interfaces/modules/auctions/IEncryptedMarginalPrice.sol"; // Libraries -import {ECIES, Point} from "@axis-core-1.0.0/lib/ECIES.sol"; +import {ECIES, Point} from "@axis-core-1.0.1/lib/ECIES.sol"; import {EncryptedMarginalPriceBid} from "../../../src/lib/EncryptedMarginalPriceBid.sol"; contract BidSubmitScript is Script, Constants { diff --git a/packages/axis-utils/script/developer-guide/batch/settle.s.sol b/packages/axis-utils/script/developer-guide/batch/settle.s.sol index 7364802..7342229 100644 --- a/packages/axis-utils/script/developer-guide/batch/settle.s.sol +++ b/packages/axis-utils/script/developer-guide/batch/settle.s.sol @@ -7,10 +7,10 @@ import {console2} from "@forge-std-1.9.1/console2.sol"; import {Constants} from "../constants.s.sol"; // Axis contracts -import {IBatchAuctionHouse} from "@axis-core-1.0.0/interfaces/IBatchAuctionHouse.sol"; +import {IBatchAuctionHouse} from "@axis-core-1.0.1/interfaces/IBatchAuctionHouse.sol"; import {IEncryptedMarginalPrice} from - "@axis-core-1.0.0/interfaces/modules/auctions/IEncryptedMarginalPrice.sol"; -import {IBatchAuction} from "@axis-core-1.0.0/interfaces/modules/IBatchAuction.sol"; + "@axis-core-1.0.1/interfaces/modules/auctions/IEncryptedMarginalPrice.sol"; +import {IBatchAuction} from "@axis-core-1.0.1/interfaces/modules/IBatchAuction.sol"; contract SettleScript is Script, Constants { function run() public { diff --git a/packages/axis-utils/script/developer-guide/cancel-auction.s.sol b/packages/axis-utils/script/developer-guide/cancel-auction.s.sol index 80df5dc..d18c381 100644 --- a/packages/axis-utils/script/developer-guide/cancel-auction.s.sol +++ b/packages/axis-utils/script/developer-guide/cancel-auction.s.sol @@ -7,7 +7,7 @@ import {Script} from "@forge-std-1.9.1/Script.sol"; import {Constants} from "./constants.s.sol"; // Axis contracts -import {IAuctionHouse} from "@axis-core-1.0.0/interfaces/IAuctionHouse.sol"; +import {IAuctionHouse} from "@axis-core-1.0.1/interfaces/IAuctionHouse.sol"; contract CancelAuctionScript is Script, Constants { function run() public { diff --git a/packages/axis-utils/script/developer-guide/create-auction.s.sol b/packages/axis-utils/script/developer-guide/create-auction.s.sol index 48a4792..6594ffe 100644 --- a/packages/axis-utils/script/developer-guide/create-auction.s.sol +++ b/packages/axis-utils/script/developer-guide/create-auction.s.sol @@ -10,15 +10,15 @@ import {Constants} from "./constants.s.sol"; import {MockERC20} from "../../test/mocks/MockERC20.sol"; // Libraries -import {ECIES, Point} from "@axis-core-1.0.0/lib/ECIES.sol"; +import {ECIES, Point} from "@axis-core-1.0.1/lib/ECIES.sol"; // Axis contracts -import {IAuctionHouse} from "@axis-core-1.0.0/interfaces/IAuctionHouse.sol"; -import {IAuction} from "@axis-core-1.0.0/interfaces/modules/IAuction.sol"; -import {ICallback} from "@axis-core-1.0.0/interfaces/ICallback.sol"; -import {toKeycode} from "@axis-core-1.0.0/modules/Keycode.sol"; +import {IAuctionHouse} from "@axis-core-1.0.1/interfaces/IAuctionHouse.sol"; +import {IAuction} from "@axis-core-1.0.1/interfaces/modules/IAuction.sol"; +import {ICallback} from "@axis-core-1.0.1/interfaces/ICallback.sol"; +import {toKeycode} from "@axis-core-1.0.1/modules/Keycode.sol"; import {IEncryptedMarginalPrice} from - "@axis-core-1.0.0/interfaces/modules/auctions/IEncryptedMarginalPrice.sol"; + "@axis-core-1.0.1/interfaces/modules/auctions/IEncryptedMarginalPrice.sol"; contract CreateAuctionScript is Script, Constants { function run() external { diff --git a/packages/axis-utils/script/developer-guide/curation.s.sol b/packages/axis-utils/script/developer-guide/curation.s.sol index a51affa..c039f9c 100644 --- a/packages/axis-utils/script/developer-guide/curation.s.sol +++ b/packages/axis-utils/script/developer-guide/curation.s.sol @@ -7,9 +7,9 @@ import {Script} from "@forge-std-1.9.1/Script.sol"; import {Constants} from "./constants.s.sol"; // Axis contracts -import {IAuctionHouse} from "@axis-core-1.0.0/interfaces/IAuctionHouse.sol"; -import {IFeeManager} from "@axis-core-1.0.0/interfaces/IFeeManager.sol"; -import {Keycode, toKeycode} from "@axis-core-1.0.0/modules/Keycode.sol"; +import {IAuctionHouse} from "@axis-core-1.0.1/interfaces/IAuctionHouse.sol"; +import {IFeeManager} from "@axis-core-1.0.1/interfaces/IFeeManager.sol"; +import {Keycode, toKeycode} from "@axis-core-1.0.1/modules/Keycode.sol"; contract CuratorScript is Script, Constants { function setCuratorMaxFee() public { diff --git a/packages/axis-utils/script/developer-guide/using-derivatives.s.sol b/packages/axis-utils/script/developer-guide/using-derivatives.s.sol index 6070b62..01f0259 100644 --- a/packages/axis-utils/script/developer-guide/using-derivatives.s.sol +++ b/packages/axis-utils/script/developer-guide/using-derivatives.s.sol @@ -10,17 +10,17 @@ import {Constants} from "./constants.s.sol"; import {MockERC20} from "../../test/mocks/MockERC20.sol"; // Axis contracts -import {IAuctionHouse} from "@axis-core-1.0.0/interfaces/IAuctionHouse.sol"; -import {IAtomicAuctionHouse} from "@axis-core-1.0.0/interfaces/IAtomicAuctionHouse.sol"; +import {IAuctionHouse} from "@axis-core-1.0.1/interfaces/IAuctionHouse.sol"; +import {IAtomicAuctionHouse} from "@axis-core-1.0.1/interfaces/IAtomicAuctionHouse.sol"; -import {IAuction} from "@axis-core-1.0.0/interfaces/modules/IAuction.sol"; -import {IFixedPriceSale} from "@axis-core-1.0.0/interfaces/modules/auctions/IFixedPriceSale.sol"; +import {IAuction} from "@axis-core-1.0.1/interfaces/modules/IAuction.sol"; +import {IFixedPriceSale} from "@axis-core-1.0.1/interfaces/modules/auctions/IFixedPriceSale.sol"; -import {IDerivative} from "@axis-core-1.0.0/interfaces/modules/IDerivative.sol"; -import {ILinearVesting} from "@axis-core-1.0.0/interfaces/modules/derivatives/ILinearVesting.sol"; +import {IDerivative} from "@axis-core-1.0.1/interfaces/modules/IDerivative.sol"; +import {ILinearVesting} from "@axis-core-1.0.1/interfaces/modules/derivatives/ILinearVesting.sol"; -import {ICallback} from "@axis-core-1.0.0/interfaces/ICallback.sol"; -import {toKeycode} from "@axis-core-1.0.0/modules/Keycode.sol"; +import {ICallback} from "@axis-core-1.0.1/interfaces/ICallback.sol"; +import {toKeycode} from "@axis-core-1.0.1/modules/Keycode.sol"; contract DerivativesScript is Script, Constants { function createAuction() external { diff --git a/packages/axis-utils/script/test/EncryptedMarginalPrice/TestData.s.sol b/packages/axis-utils/script/test/EncryptedMarginalPrice/TestData.s.sol index aa75249..73a279b 100644 --- a/packages/axis-utils/script/test/EncryptedMarginalPrice/TestData.s.sol +++ b/packages/axis-utils/script/test/EncryptedMarginalPrice/TestData.s.sol @@ -5,11 +5,11 @@ pragma solidity 0.8.19; import {Script} from "@forge-std-1.9.1/Script.sol"; // System contracts -import {BatchAuctionHouse} from "@axis-core-1.0.0/BatchAuctionHouse.sol"; -import {IAuctionHouse} from "@axis-core-1.0.0/interfaces/IAuctionHouse.sol"; -import {toKeycode} from "@axis-core-1.0.0/modules/Modules.sol"; -import {EncryptedMarginalPrice} from "@axis-core-1.0.0/modules/auctions/batch/EMP.sol"; -import {Point} from "@axis-core-1.0.0/lib/ECIES.sol"; +import {BatchAuctionHouse} from "@axis-core-1.0.1/BatchAuctionHouse.sol"; +import {IAuctionHouse} from "@axis-core-1.0.1/interfaces/IAuctionHouse.sol"; +import {toKeycode} from "@axis-core-1.0.1/modules/Modules.sol"; +import {EncryptedMarginalPrice} from "@axis-core-1.0.1/modules/auctions/batch/EMP.sol"; +import {Point} from "@axis-core-1.0.1/lib/ECIES.sol"; // Generic contracts import {MockERC20} from "@solmate-6.7.0/test/utils/mocks/MockERC20.sol"; diff --git a/packages/axis-utils/script/test/EncryptedMarginalPrice/cancelAuction.sh b/packages/axis-utils/script/test/EncryptedMarginalPrice/cancelAuction.sh index c573fa4..04bce19 100755 --- a/packages/axis-utils/script/test/EncryptedMarginalPrice/cancelAuction.sh +++ b/packages/axis-utils/script/test/EncryptedMarginalPrice/cancelAuction.sh @@ -5,5 +5,5 @@ source .env # Cancel auction forge script ./script/test/EncryptedMarginalPrice/TestData.s.sol:TestData --sig "cancelAuction(uint96)()" $1 \ ---rpc-url $RPC_URL --private-key $DEPLOYER_PRIVATE_KEY --froms $DEPLOYER_ADDRESS --slow -vvv \ ---broadcast \ No newline at end of file + --rpc-url $RPC_URL --private-key $DEPLOYER_PRIVATE_KEY --froms $DEPLOYER_ADDRESS --slow -vvv \ + --broadcast diff --git a/packages/axis-utils/script/test/EncryptedMarginalPrice/createAuction.sh b/packages/axis-utils/script/test/EncryptedMarginalPrice/createAuction.sh index afdb52a..3d27181 100755 --- a/packages/axis-utils/script/test/EncryptedMarginalPrice/createAuction.sh +++ b/packages/axis-utils/script/test/EncryptedMarginalPrice/createAuction.sh @@ -16,29 +16,25 @@ eval "$curenv" AUCTION_TYPE=$1 # Check if Auction type is set -if [ -z "$AUCTION_TYPE" ] -then +if [ -z "$AUCTION_TYPE" ]; then echo "No auction type specified. Provide a valid auction type." exit 1 fi # Check if Auction type is valid -if [ "$AUCTION_TYPE" != "EMP" ] && [ "$AUCTION_TYPE" != "FPB" ] -then +if [ "$AUCTION_TYPE" != "EMP" ] && [ "$AUCTION_TYPE" != "FPB" ]; then echo "Invalid auction type. Provide a valid auction type." exit 1 fi # Set the function to call based on the auction type -if [ "$AUCTION_TYPE" == "EMP" ] -then +if [ "$AUCTION_TYPE" == "EMP" ]; then CALLDATA=$(cast calldata "createAuction(uint256,uint256,address)" $2 $3 $4) -elif [ "$AUCTION_TYPE" == "FPB" ] -then +elif [ "$AUCTION_TYPE" == "FPB" ]; then CALLDATA=$(cast calldata "createFPBAuction()") fi # Create auction forge script ./script/test/EncryptedMarginalPrice/TestData.s.sol:TestData --sig $CALLDATA \ ---rpc-url $RPC_URL --private-key $BIDDER_PRIVATE_KEY --froms $BIDDER_ADDRESS --slow -vvv \ ---broadcast \ No newline at end of file + --rpc-url $RPC_URL --private-key $BIDDER_PRIVATE_KEY --froms $BIDDER_ADDRESS --slow -vvv \ + --broadcast diff --git a/packages/axis-utils/script/test/EncryptedMarginalPrice/mintTokens.sh b/packages/axis-utils/script/test/EncryptedMarginalPrice/mintTokens.sh index 44a2eb7..d00e53c 100644 --- a/packages/axis-utils/script/test/EncryptedMarginalPrice/mintTokens.sh +++ b/packages/axis-utils/script/test/EncryptedMarginalPrice/mintTokens.sh @@ -5,5 +5,5 @@ source .env # Create auction forge script ./script/test/EncryptedMarginalPrice/TestData.s.sol:TestData --sig "mintTestTokens(address,address)()" $1 $2 \ ---rpc-url $RPC_URL --private-key $DEPLOYER_PRIVATE_KEY --froms $DEPLOYER_ADDRESS --slow -vvv \ ---broadcast \ No newline at end of file + --rpc-url $RPC_URL --private-key $DEPLOYER_PRIVATE_KEY --froms $DEPLOYER_ADDRESS --slow -vvv \ + --broadcast diff --git a/packages/axis-utils/script/test/EncryptedMarginalPrice/placeBid.sh b/packages/axis-utils/script/test/EncryptedMarginalPrice/placeBid.sh index 082371c..4bc48f0 100644 --- a/packages/axis-utils/script/test/EncryptedMarginalPrice/placeBid.sh +++ b/packages/axis-utils/script/test/EncryptedMarginalPrice/placeBid.sh @@ -5,5 +5,5 @@ source .env # Create auction forge script ./script/test/EncryptedMarginalPrice/TestData.s.sol:TestData --sig "placeBid(uint96,uint256,uint256)()" $1 $2 $3 \ ---rpc-url $RPC_URL --private-key $BIDDER_PRIVATE_KEY --froms $BIDDER_ADDRESS --slow -vvv \ ---broadcast \ No newline at end of file + --rpc-url $RPC_URL --private-key $BIDDER_PRIVATE_KEY --froms $BIDDER_ADDRESS --slow -vvv \ + --broadcast diff --git a/packages/axis-utils/script/test/FixedPriceBatch-BaseDTL/TestData.s.sol b/packages/axis-utils/script/test/FixedPriceBatch-BaseDTL/TestData.s.sol index afda6de..6443b1c 100644 --- a/packages/axis-utils/script/test/FixedPriceBatch-BaseDTL/TestData.s.sol +++ b/packages/axis-utils/script/test/FixedPriceBatch-BaseDTL/TestData.s.sol @@ -6,18 +6,16 @@ import {Script, console2} from "@forge-std-1.9.1/Script.sol"; import {WithEnvironment} from "../../WithEnvironment.s.sol"; // System contracts -import {IBatchAuctionHouse} from "@axis-core-1.0.0/interfaces/IBatchAuctionHouse.sol"; -import {BatchAuctionHouse} from "@axis-core-1.0.0/BatchAuctionHouse.sol"; -import {IAuctionHouse} from "@axis-core-1.0.0/interfaces/IAuctionHouse.sol"; -import {toKeycode} from "@axis-core-1.0.0/modules/Modules.sol"; -import {ICallback} from "@axis-core-1.0.0/interfaces/ICallback.sol"; -import {IFixedPriceBatch} from "@axis-core-1.0.0/interfaces/modules/auctions/IFixedPriceBatch.sol"; -import {IAuction} from "@axis-core-1.0.0/interfaces/modules/IAuction.sol"; +import {IBatchAuctionHouse} from "@axis-core-1.0.1/interfaces/IBatchAuctionHouse.sol"; +import {BatchAuctionHouse} from "@axis-core-1.0.1/BatchAuctionHouse.sol"; +import {IAuctionHouse} from "@axis-core-1.0.1/interfaces/IAuctionHouse.sol"; +import {toKeycode} from "@axis-core-1.0.1/modules/Modules.sol"; +import {ICallback} from "@axis-core-1.0.1/interfaces/ICallback.sol"; +import {IFixedPriceBatch} from "@axis-core-1.0.1/interfaces/modules/auctions/IFixedPriceBatch.sol"; +import {IAuction} from "@axis-core-1.0.1/interfaces/modules/IAuction.sol"; // Callbacks -import {BaseDirectToLiquidity} from "@axis-periphery-0.9.0/callbacks/liquidity/BaseDTL.sol"; -import {UniswapV2DirectToLiquidity} from - "@axis-periphery-0.9.0/callbacks/liquidity/UniswapV2DTL.sol"; +import {BaseDirectToLiquidity} from "@axis-periphery-1.0.0/callbacks/liquidity/BaseDTL.sol"; // Generic contracts import {ERC20} from "@solmate-6.7.0/tokens/ERC20.sol"; @@ -37,6 +35,8 @@ contract TestData is Script, WithEnvironment { address quoteToken_, address baseToken_, address callback_, + uint24 poolPercent_, + uint24 maxSlippage_, uint24 uniswapV3PoolFee_ ) public returns (uint96) { // Load addresses from .env @@ -54,15 +54,18 @@ contract TestData is Script, WithEnvironment { if (callback_ != address(0)) { console2.log("Callback enabled"); + // Second-level callback implParams bytes memory callbackImplParams = abi.encode(""); if (uniswapV3PoolFee_ > 0) { console2.log("Setting Uniswap V3 pool fee to", uniswapV3PoolFee_); - callbackImplParams = abi.encode(uniswapV3PoolFee_); + callbackImplParams = abi.encode(uniswapV3PoolFee_, maxSlippage_); + } else { + callbackImplParams = abi.encode(maxSlippage_); } routingParams.callbackData = abi.encode( BaseDirectToLiquidity.OnCreateParams({ - proceedsUtilisationPercent: 5000, // 50% + poolPercent: poolPercent_, vestingStart: 0, vestingExpiry: 0, recipient: msg.sender, @@ -152,11 +155,8 @@ contract TestData is Script, WithEnvironment { console2.log("Timestamp is", block.timestamp); - bytes memory callbackData = - abi.encode(UniswapV2DirectToLiquidity.OnSettleParams({maxSlippage: 50})); // 0.5% - vm.broadcast(); - auctionHouse.settle(lotId_, 100, callbackData); + auctionHouse.settle(lotId_, 100, ""); console2.log("Auction settled with lot ID: ", lotId_); } diff --git a/packages/axis-utils/script/test/FixedPriceBatch-BaseDTL/createAuction.sh b/packages/axis-utils/script/test/FixedPriceBatch-BaseDTL/createAuction.sh index 83e786c..d2e9f94 100755 --- a/packages/axis-utils/script/test/FixedPriceBatch-BaseDTL/createAuction.sh +++ b/packages/axis-utils/script/test/FixedPriceBatch-BaseDTL/createAuction.sh @@ -1,7 +1,7 @@ #!/bin/bash # Usage: -# ./createAuction.sh --quoteToken
--baseToken
--callback
--poolFee --envFile <.env> --broadcast +# ./createAuction.sh --quoteToken
--baseToken
--callback
--poolPercent --maxSlippage --poolFee --envFile <.env> --broadcast # # Expects the following environment variables: # CHAIN: The chain to deploy to, based on values from the ./script/env.json file. @@ -22,54 +22,63 @@ ENV_FILE=${envFile:-".env"} echo "Sourcing environment variables from $ENV_FILE" # Load environment file -set -a # Automatically export all variables +set -a # Automatically export all variables source $ENV_FILE -set +a # Disable automatic export +set +a # Disable automatic export # Apply defaults to command-line arguments BROADCAST=${broadcast:-false} # Check that the CHAIN is defined -if [ -z "$CHAIN" ] -then +if [ -z "$CHAIN" ]; then echo "No chain specified. Set the CHAIN environment variable." exit 1 fi # Check that the quote token is defined and is an address -if [[ ! "$quoteToken" =~ ^0x[0-9a-fA-F]{40}$ ]] -then +if [[ ! "$quoteToken" =~ ^0x[0-9a-fA-F]{40}$ ]]; then echo "Invalid quote token specified. Provide the address after the --quoteToken flag." exit 1 fi # Check that the base token is defined and is an address -if [[ ! "$baseToken" =~ ^0x[a-fA-F0-9]{40}$ ]] -then +if [[ ! "$baseToken" =~ ^0x[a-fA-F0-9]{40}$ ]]; then echo "Invalid base token specified. Provide the address after the --baseToken flag." exit 1 fi # Check that the callback is defined and is an address -if [[ ! "$callback" =~ ^0x[a-fA-F0-9]{40}$ ]] -then +if [[ ! "$callback" =~ ^0x[a-fA-F0-9]{40}$ ]]; then echo "Invalid callback specified. Provide the address after the --callback flag." exit 1 fi +# Check that the poolPercent is defined and is a uint24 +if [[ ! "$poolPercent" =~ ^[0-9]+$ ]]; then + echo "Invalid poolPercent specified. Provide a uint24 value after the --poolPercent flag." + exit 1 +fi + +# Check that the maxSlippage is defined and is a uint24 +if [[ ! "$maxSlippage" =~ ^[0-9]+$ ]]; then + echo "Invalid maxSlippage specified. Provide a uint24 value after the --maxSlippage flag." + exit 1 +fi + # If the pool fee is not set, set it to 0 -if [ -z "$poolFee" ] -then +if [ -z "$poolFee" ]; then poolFee=0 fi echo "Using chain: $CHAIN" echo "Using RPC at URL: $RPC_URL" +echo "Deployer: $DEPLOYER_ADDRESS" echo "Using quote token: $quoteToken" echo "Using base token: $baseToken" echo "Using callback: $callback" +echo "Using pool percent: $poolPercent" +echo "Using max slippage: $maxSlippage" echo "Using pool fee (Uniswap V3 only): $poolFee" -echo "Deployer: $DEPLOYER_ADDRESS" # Set BROADCAST_FLAG based on BROADCAST BROADCAST_FLAG="" @@ -81,6 +90,6 @@ else fi # Create auction -forge script ./script/test/FixedPriceBatch-BaseDTL/TestData.s.sol:TestData --sig "createAuction(string,address,address,address,uint24)()" $CHAIN $quoteToken $baseToken $callback $poolFee \ ---rpc-url $RPC_URL --private-key $DEPLOYER_PRIVATE_KEY --froms $DEPLOYER_ADDRESS --slow -vvvv \ -$BROADCAST_FLAG +forge script ./script/test/FixedPriceBatch-BaseDTL/TestData.s.sol:TestData --sig "createAuction(string,address,address,address,uint24,uint24,uint24)()" $CHAIN $quoteToken $baseToken $callback $poolPercent $maxSlippage $poolFee \ + --rpc-url $RPC_URL --private-key $DEPLOYER_PRIVATE_KEY --froms $DEPLOYER_ADDRESS --slow -vvvv \ + $BROADCAST_FLAG diff --git a/packages/axis-utils/script/test/FixedPriceBatch-BaseDTL/placeBid.sh b/packages/axis-utils/script/test/FixedPriceBatch-BaseDTL/placeBid.sh index 55a90e3..3eefb10 100755 --- a/packages/axis-utils/script/test/FixedPriceBatch-BaseDTL/placeBid.sh +++ b/packages/axis-utils/script/test/FixedPriceBatch-BaseDTL/placeBid.sh @@ -22,30 +22,27 @@ ENV_FILE=${envFile:-".env"} echo "Sourcing environment variables from $ENV_FILE" # Load environment file -set -a # Automatically export all variables +set -a # Automatically export all variables source $ENV_FILE -set +a # Disable automatic export +set +a # Disable automatic export # Apply defaults to command-line arguments BROADCAST=${broadcast:-false} # Check that the CHAIN is defined -if [ -z "$CHAIN" ] -then +if [ -z "$CHAIN" ]; then echo "No chain specified. Set the CHAIN environment variable." exit 1 fi # Check that the lotId is defined and is an integer -if [[ ! "$lotId" =~ ^[0-9]+$ ]] -then +if [[ ! "$lotId" =~ ^[0-9]+$ ]]; then echo "Invalid lotId specified. Provide the integer value after the --lotId flag." exit 1 fi # Check that the amount is defined and is an integer -if [[ ! "$amount" =~ ^[0-9]+$ ]] -then +if [[ ! "$amount" =~ ^[0-9]+$ ]]; then echo "Invalid amount specified. Provide the integer value after the --amount flag." exit 1 fi @@ -67,5 +64,5 @@ fi # Create auction forge script ./script/test/FixedPriceBatch-BaseDTL/TestData.s.sol:TestData --sig "placeBid(string,uint96,uint256)()" $CHAIN $lotId $amount \ ---rpc-url $RPC_URL --private-key $DEPLOYER_PRIVATE_KEY --froms $DEPLOYER_ADDRESS --slow -vvvv \ -$BROADCAST_FLAG + --rpc-url $RPC_URL --private-key $DEPLOYER_PRIVATE_KEY --froms $DEPLOYER_ADDRESS --slow -vvvv \ + $BROADCAST_FLAG diff --git a/packages/axis-utils/script/test/FixedPriceBatch-BaseDTL/settleAuction.sh b/packages/axis-utils/script/test/FixedPriceBatch-BaseDTL/settleAuction.sh index 7028f4a..5a6b6e3 100755 --- a/packages/axis-utils/script/test/FixedPriceBatch-BaseDTL/settleAuction.sh +++ b/packages/axis-utils/script/test/FixedPriceBatch-BaseDTL/settleAuction.sh @@ -22,23 +22,21 @@ ENV_FILE=${envFile:-".env"} echo "Sourcing environment variables from $ENV_FILE" # Load environment file -set -a # Automatically export all variables +set -a # Automatically export all variables source $ENV_FILE -set +a # Disable automatic export +set +a # Disable automatic export # Apply defaults to command-line arguments BROADCAST=${broadcast:-false} # Check that the CHAIN is defined -if [ -z "$CHAIN" ] -then +if [ -z "$CHAIN" ]; then echo "No chain specified. Set the CHAIN environment variable." exit 1 fi # Check that the lotId is defined and is an integer -if [[ ! "$lotId" =~ ^[0-9]+$ ]] -then +if [[ ! "$lotId" =~ ^[0-9]+$ ]]; then echo "Invalid lotId specified. Provide the integer value after the --lotId flag." exit 1 fi @@ -59,5 +57,5 @@ fi # Create auction forge script ./script/test/FixedPriceBatch-BaseDTL/TestData.s.sol:TestData --sig "settleAuction(string,uint96)()" $CHAIN $lotId \ ---rpc-url $RPC_URL --private-key $DEPLOYER_PRIVATE_KEY --froms $DEPLOYER_ADDRESS --slow -vvvv \ -$BROADCAST_FLAG + --rpc-url $RPC_URL --private-key $DEPLOYER_PRIVATE_KEY --froms $DEPLOYER_ADDRESS --slow -vvvv \ + $BROADCAST_FLAG diff --git a/packages/axis-utils/script/test/FixedPriceBatch-Baseline/README.md b/packages/axis-utils/script/test/FixedPriceBatch-Baseline/README.md index 9c17102..3ff821c 100644 --- a/packages/axis-utils/script/test/FixedPriceBatch-Baseline/README.md +++ b/packages/axis-utils/script/test/FixedPriceBatch-Baseline/README.md @@ -12,8 +12,10 @@ 6. Deploy the BaselineAllocatedAllowlist callback contract - You will need to provide the kernel, owner, and reserveToken 7. Generate the Merkle root + - Use the oz-merkle-tree tool for this 8. Create the auction - - You will need to provide the quote token, base token, BaselineAllocatedAllowlist address and Merkle root + - You will need to provide parameters for the auction + - The `packages/oz-merkle-tree/out/-proofs.json` file should be provided as the input for the `--merkleProofFile` parameter. ## To Settle an Auction diff --git a/packages/axis-utils/script/test/FixedPriceBatch-Baseline/TestData.s.sol b/packages/axis-utils/script/test/FixedPriceBatch-Baseline/TestData.s.sol index ed6a4b6..39a8265 100644 --- a/packages/axis-utils/script/test/FixedPriceBatch-Baseline/TestData.s.sol +++ b/packages/axis-utils/script/test/FixedPriceBatch-Baseline/TestData.s.sol @@ -6,17 +6,17 @@ import {Script, console2} from "@forge-std-1.9.1/Script.sol"; import {WithEnvironment} from "../../WithEnvironment.s.sol"; // System contracts -import {IBatchAuctionHouse} from "@axis-core-1.0.0/interfaces/IBatchAuctionHouse.sol"; -import {BatchAuctionHouse} from "@axis-core-1.0.0/BatchAuctionHouse.sol"; -import {IAuctionHouse} from "@axis-core-1.0.0/interfaces/IAuctionHouse.sol"; -import {toKeycode} from "@axis-core-1.0.0/modules/Modules.sol"; -import {ICallback} from "@axis-core-1.0.0/interfaces/ICallback.sol"; -import {IFixedPriceBatch} from "@axis-core-1.0.0/interfaces/modules/auctions/IFixedPriceBatch.sol"; -import {IAuction} from "@axis-core-1.0.0/interfaces/modules/IAuction.sol"; +import {IBatchAuctionHouse} from "@axis-core-1.0.1/interfaces/IBatchAuctionHouse.sol"; +import {BatchAuctionHouse} from "@axis-core-1.0.1/BatchAuctionHouse.sol"; +import {IAuctionHouse} from "@axis-core-1.0.1/interfaces/IAuctionHouse.sol"; +import {toKeycode} from "@axis-core-1.0.1/modules/Modules.sol"; +import {ICallback} from "@axis-core-1.0.1/interfaces/ICallback.sol"; +import {IFixedPriceBatch} from "@axis-core-1.0.1/interfaces/modules/auctions/IFixedPriceBatch.sol"; +import {IAuction} from "@axis-core-1.0.1/interfaces/modules/IAuction.sol"; // Baseline import {BaselineAxisLaunch} from - "@axis-periphery-0.9.0/callbacks/liquidity/BaselineV2/BaselineAxisLaunch.sol"; + "@axis-periphery-1.0.0/callbacks/liquidity/BaselineV2/BaselineAxisLaunch.sol"; // Generic contracts import {ERC20} from "@solmate-6.7.0/tokens/ERC20.sol"; @@ -36,7 +36,12 @@ contract TestData is Script, WithEnvironment { address quoteToken_, address baseToken_, address callback_, - bytes32 merkleRoot + bytes32 merkleRoot, + uint24 poolPercent_, + uint24 floorReservesPercent_, + int24 floorRangeGap_, + int24 anchorTickU_, + int24 anchorTickWidth_ ) public returns (uint96) { // Load addresses from .env _loadEnv(chain_); @@ -54,9 +59,12 @@ contract TestData is Script, WithEnvironment { console2.log("Setting callback parameters"); routingParams.callbackData = abi.encode( BaselineAxisLaunch.CreateData({ - floorReservesPercent: 50e2, // 50% - anchorTickWidth: 3, - discoveryTickWidth: 100, + recipient: msg.sender, + poolPercent: poolPercent_, + floorReservesPercent: floorReservesPercent_, + floorRangeGap: floorRangeGap_, + anchorTickU: anchorTickU_, + anchorTickWidth: anchorTickWidth_, allowlistParams: abi.encode(merkleRoot) }) ); @@ -110,7 +118,7 @@ contract TestData is Script, WithEnvironment { string calldata chain_, uint96 lotId_, uint256 amount_, - bytes32 merkleProof_, + bytes32[] calldata merkleProofs_, uint256 allocatedAmount_ ) public { _loadEnv(chain_); @@ -126,9 +134,6 @@ contract TestData is Script, WithEnvironment { console2.log("Approved spending of quote token by BatchAuctionHouse"); } - bytes32[] memory allowlistProof = new bytes32[](1); - allowlistProof[0] = merkleProof_; - vm.broadcast(); uint64 bidId = auctionHouse.bid( IBatchAuctionHouse.BidParams({ @@ -139,7 +144,7 @@ contract TestData is Script, WithEnvironment { auctionData: abi.encode(""), permit2Data: bytes("") }), - abi.encode(allowlistProof, allocatedAmount_) + abi.encode(merkleProofs_, allocatedAmount_) ); console2.log("Bid placed with ID: ", bidId); diff --git a/packages/axis-utils/script/test/FixedPriceBatch-Baseline/createAuction.sh b/packages/axis-utils/script/test/FixedPriceBatch-Baseline/createAuction.sh index 72c5753..5057c14 100755 --- a/packages/axis-utils/script/test/FixedPriceBatch-Baseline/createAuction.sh +++ b/packages/axis-utils/script/test/FixedPriceBatch-Baseline/createAuction.sh @@ -1,7 +1,7 @@ #!/bin/bash # Usage: -# ./createAuction.sh --quoteToken
--baseToken
--callback
--envFile <.env> +# ./createAuction.sh --quoteToken
--baseToken
--callback
--merkleProofFile --poolPercent --floorReservesPercent --floorRangeGap --anchorTickUpper --anchorTickWidth --envFile <.env> # # Expects the following environment variables: # CHAIN: The chain to deploy to, based on values from the ./script/env.json file. @@ -22,55 +22,97 @@ ENV_FILE=${envFile:-".env"} echo "Sourcing environment variables from $ENV_FILE" # Load environment file -set -a # Automatically export all variables +set -a # Automatically export all variables source $ENV_FILE -set +a # Disable automatic export +set +a # Disable automatic export # Apply defaults to command-line arguments BROADCAST=${broadcast:-false} # Check that the CHAIN is defined -if [ -z "$CHAIN" ] -then +if [ -z "$CHAIN" ]; then echo "No chain specified. Set the CHAIN environment variable." exit 1 fi # Check that the quote token is defined and is an address -if [[ ! "$quoteToken" =~ ^0x[0-9a-fA-F]{40}$ ]] -then +if [[ ! "$quoteToken" =~ ^0x[0-9a-fA-F]{40}$ ]]; then echo "Invalid quote token specified. Provide the address after the --quoteToken flag." exit 1 fi # Check that the base token is defined and is an address -if [[ ! "$baseToken" =~ ^0x[a-fA-F0-9]{40}$ ]] -then +if [[ ! "$baseToken" =~ ^0x[a-fA-F0-9]{40}$ ]]; then echo "Invalid base token specified. Provide the address after the --baseToken flag." exit 1 fi # Check that the callback is defined and is an address -if [[ ! "$callback" =~ ^0x[a-fA-F0-9]{40}$ ]] -then +if [[ ! "$callback" =~ ^0x[a-fA-F0-9]{40}$ ]]; then echo "Invalid callback specified. Provide the address after the --callback flag." exit 1 fi +# Check that the path for the allowlist merkle proofs is defined and exists +if [ ! -f "$merkleProofFile" ]; then + echo "Invalid allowlist merkle proof path specified. Provide the path after the --merkleProofFile flag." + exit 1 +fi + +# Attempt to read the merkle root from the allowlist merkle proof +merkleRoot=$(jq -r '.root' $merkleProofFile) + # Check that the allowlist merkle root is defined and is a bytes32 string -if [[ ! "$allowlistMerkleRoot" =~ ^0x[a-fA-F0-9]{64}$ ]] -then - echo "Invalid allowlist merkle root specified. Provide the bytes32 string after the --allowlistMerkleRoot flag." +if [[ ! "$merkleRoot" =~ ^0x[a-fA-F0-9]{64}$ ]]; then + echo "Invalid allowlist merkle root in the allowlist merkle proof at $merkleProofFile" + echo "The merkle root should be located at the top-level key 'root'." + echo "Actual value: $merkleRoot" + exit 1 +fi + +# Check that the poolPercent is defined and is a number +if [[ ! "$poolPercent" =~ ^[0-9]+$ ]]; then + echo "Invalid pool percent specified. Provide the number after the --poolPercent flag." + exit 1 +fi + +# Check that the floorReservesPercent is defined and is a number +if [[ ! "$floorReservesPercent" =~ ^[0-9]+$ ]]; then + echo "Invalid floor reserves percent specified. Provide the number after the --floorReservesPercent flag." + exit 1 +fi + +# Check that the floorRangeGap is defined and is a number +if [[ ! "$floorRangeGap" =~ ^[0-9]+$ ]]; then + echo "Invalid floor range gap specified. Provide the number after the --floorRangeGap flag." + exit 1 +fi + +# Check that the anchorTickUpper is defined and is a number +if [[ ! "$anchorTickUpper" =~ ^[0-9]+$ ]]; then + echo "Invalid anchor tick upper specified. Provide the number after the --anchorTickUpper flag." + exit 1 +fi + +# Check that the anchorTickWidth is defined and is a number +if [[ ! "$anchorTickWidth" =~ ^[0-9]+$ ]]; then + echo "Invalid anchor tick width specified. Provide the number after the --anchorTickWidth flag." exit 1 fi echo "Using chain: $CHAIN" echo "Using RPC at URL: $RPC_URL" +echo "Deployer: $DEPLOYER_ADDRESS" echo "Using quote token: $quoteToken" echo "Using base token: $baseToken" echo "Using callback: $callback" -echo "Using allowlist merkle root: $allowlistMerkleRoot" -echo "Deployer: $DEPLOYER_ADDRESS" +echo "Using allowlist merkle proof file: $merkleProofFile" +echo "Using allowlist merkle root: $merkleRoot" +echo "Using pool percent: $poolPercent" +echo "Using floor reserves percent: $floorReservesPercent" +echo "Using floor range gap: $floorRangeGap" +echo "Using anchor tick upper: $anchorTickUpper" +echo "Using anchor tick width: $anchorTickWidth" # Set BROADCAST_FLAG based on BROADCAST BROADCAST_FLAG="" @@ -82,6 +124,6 @@ else fi # Create auction -forge script ./script/test/FixedPriceBatch-Baseline/TestData.s.sol:TestData --sig "createAuction(string,address,address,address,bytes32)()" $CHAIN $quoteToken $baseToken $callback $allowlistMerkleRoot \ ---rpc-url $RPC_URL --private-key $DEPLOYER_PRIVATE_KEY --froms $DEPLOYER_ADDRESS --slow -vvvv \ -$BROADCAST_FLAG +forge script ./script/test/FixedPriceBatch-Baseline/TestData.s.sol:TestData --sig "createAuction(string,address,address,address,bytes32,uint24,uint24,int24,int24,int24)()" $CHAIN $quoteToken $baseToken $callback $merkleRoot $poolPercent $floorReservesPercent $floorRangeGap $anchorTickUpper $anchorTickWidth \ + --rpc-url $RPC_URL --private-key $DEPLOYER_PRIVATE_KEY --froms $DEPLOYER_ADDRESS --slow -vvvv \ + $BROADCAST_FLAG diff --git a/packages/axis-utils/script/test/FixedPriceBatch-Baseline/placeBid.sh b/packages/axis-utils/script/test/FixedPriceBatch-Baseline/placeBid.sh index c4f441a..72231fe 100755 --- a/packages/axis-utils/script/test/FixedPriceBatch-Baseline/placeBid.sh +++ b/packages/axis-utils/script/test/FixedPriceBatch-Baseline/placeBid.sh @@ -1,7 +1,7 @@ #!/bin/bash # Usage: -# ./placeBid.sh --lotId --amount --envFile <.env> +# ./placeBid.sh --lotId --amount --allocatedAmount --merkleProofFile --envFile <.env> # # Expects the following environment variables: # CHAIN: The chain to deploy to, based on values from the ./script/env.json file. @@ -17,60 +17,89 @@ while [ $# -gt 0 ]; do shift done +# If DEBUG is set, print the commands +if [ ! -z "$DEBUG" ]; then + set -x +fi + # Get the name of the .env file or use the default ENV_FILE=${envFile:-".env"} echo "Sourcing environment variables from $ENV_FILE" # Load environment file -set -a # Automatically export all variables +set -a # Automatically export all variables source $ENV_FILE -set +a # Disable automatic export +set +a # Disable automatic export # Apply defaults to command-line arguments BROADCAST=${broadcast:-false} # Check that the CHAIN is defined -if [ -z "$CHAIN" ] -then +if [ -z "$CHAIN" ]; then echo "No chain specified. Set the CHAIN environment variable." exit 1 fi # Check that the lotId is defined and is an integer -if [[ ! "$lotId" =~ ^[0-9]+$ ]] -then +if [[ ! "$lotId" =~ ^[0-9]+$ ]]; then echo "Invalid lotId specified. Provide the integer value after the --lotId flag." exit 1 fi # Check that the amount is defined and is an integer -if [[ ! "$amount" =~ ^[0-9]+$ ]] -then +if [[ ! "$amount" =~ ^[0-9]+$ ]]; then echo "Invalid amount specified. Provide the integer value after the --amount flag." exit 1 fi -# Check that the merkle proof is defined and is a bytes32 string -if [[ ! "$merkleProof" =~ ^0x[a-fA-F0-9]{64}$ ]] -then - echo "Invalid merkle proof specified. Provide the bytes32 string after the --merkleProof flag." +# Check that the allocated amount is defined and is an integer +if [[ ! "$allocatedAmount" =~ ^[0-9]+$ ]]; then + echo "Invalid allocated amount specified. Provide the integer value after the --allocatedAmount flag." exit 1 fi -# Check that the allocated amount is defined and is an integer -if [[ ! "$allocatedAmount" =~ ^[0-9]+$ ]] -then - echo "Invalid allocated amount specified. Provide the integer value after the --allocatedAmount flag." +# Check that the merkle proof file is defined and exists +if [ ! -f "$merkleProofFile" ]; then + echo "Invalid merkle proof file path specified. Provide the path after the --merkleProofFile flag." + exit 1 +fi + +# Read the merkle proofs from the file using the deployer address and allocated amount +# Expected format: +# { +# root: string; +# entries: { +# value: string[]; +# proofs: string[]; +# }[]; +# } +merkleProofs=$(jq -r --arg deployer "$DEPLOYER_ADDRESS" --arg allocatedAmount "$allocatedAmount" '.entries[] | select(.value[0] == $deployer and .value[1] == $allocatedAmount) | .proofs' $merkleProofFile) +# Strip spacing, newlines, single quotes, double quotes +merkleProofs=$(echo $merkleProofs | tr -d '[:space:]' | tr -d "'" | tr -d '"') + +# Check that the merkle proof was found +if [ -z "$merkleProofs" ]; then + echo "No merkle proof found for the deployer address $DEPLOYER_ADDRESS and allocated amount $allocatedAmount in the merkle proof file at $merkleProofFile" + exit 1 +fi + +# Check that the merkle proof is defined and is an array of bytes32 strings +# Expected format: [0x...,0x...,...] +if [[ ! "$merkleProofs" =~ ^\[0x[a-fA-F0-9]{64}(,0x[a-fA-F0-9]{64})*\]$ ]]; then + echo "Invalid merkle proofs in the merkle proof file at $merkleProofFile" + echo "The merkle proofs should be located at the top-level key 'entries' and contain an array of objects with the keys 'value' and 'proofs'." + echo "Actual value: $merkleProofs" exit 1 fi echo "Using chain: $CHAIN" echo "Using RPC at URL: $RPC_URL" +echo "Deployer: $DEPLOYER_ADDRESS" echo "Lot ID: $lotId" echo "Amount: $amount" -echo "Merkle proof: $merkleProof" echo "Allocated amount: $allocatedAmount" -echo "Deployer: $DEPLOYER_ADDRESS" +echo "Allowlist merkle proof file: $merkleProofFile" +echo "Allowlist merkle proofs: $merkleProofs" # Set BROADCAST_FLAG based on BROADCAST BROADCAST_FLAG="" @@ -82,6 +111,6 @@ else fi # Create auction -forge script ./script/test/FixedPriceBatch-Baseline/TestData.s.sol:TestData --sig "placeBid(string,uint96,uint256,bytes32,uint256)()" $CHAIN $lotId $amount $merkleProof $allocatedAmount \ ---rpc-url $RPC_URL --private-key $DEPLOYER_PRIVATE_KEY --froms $DEPLOYER_ADDRESS --slow -vvvv \ -$BROADCAST_FLAG +forge script ./script/test/FixedPriceBatch-Baseline/TestData.s.sol:TestData --sig "placeBid(string,uint96,uint256,bytes32[],uint256)()" $CHAIN $lotId $amount $merkleProofs $allocatedAmount \ + --rpc-url $RPC_URL --private-key $DEPLOYER_PRIVATE_KEY --froms $DEPLOYER_ADDRESS --slow -vvvv \ + $BROADCAST_FLAG diff --git a/packages/axis-utils/script/test/FixedPriceBatch-Baseline/settleAuction.sh b/packages/axis-utils/script/test/FixedPriceBatch-Baseline/settleAuction.sh index 7d4b5eb..d9a6b8f 100755 --- a/packages/axis-utils/script/test/FixedPriceBatch-Baseline/settleAuction.sh +++ b/packages/axis-utils/script/test/FixedPriceBatch-Baseline/settleAuction.sh @@ -22,23 +22,21 @@ ENV_FILE=${envFile:-".env"} echo "Sourcing environment variables from $ENV_FILE" # Load environment file -set -a # Automatically export all variables +set -a # Automatically export all variables source $ENV_FILE -set +a # Disable automatic export +set +a # Disable automatic export # Apply defaults to command-line arguments BROADCAST=${broadcast:-false} # Check that the CHAIN is defined -if [ -z "$CHAIN" ] -then +if [ -z "$CHAIN" ]; then echo "No chain specified. Set the CHAIN environment variable." exit 1 fi # Check that the lotId is defined and is an integer -if [[ ! "$lotId" =~ ^[0-9]+$ ]] -then +if [[ ! "$lotId" =~ ^[0-9]+$ ]]; then echo "Invalid lotId specified. Provide the integer value after the --lotId flag." exit 1 fi @@ -59,5 +57,5 @@ fi # Create auction forge script ./script/test/FixedPriceBatch-Baseline/TestData.s.sol:TestData --sig "settleAuction(string,uint96)()" $CHAIN $lotId \ ---rpc-url $RPC_URL --private-key $DEPLOYER_PRIVATE_KEY --froms $DEPLOYER_ADDRESS --slow -vvvv \ -$BROADCAST_FLAG + --rpc-url $RPC_URL --private-key $DEPLOYER_PRIVATE_KEY --froms $DEPLOYER_ADDRESS --slow -vvvv \ + $BROADCAST_FLAG diff --git a/packages/axis-utils/script/test/tokens/deployTokens.sh b/packages/axis-utils/script/test/tokens/deployTokens.sh index 67ff80d..a1d9a05 100755 --- a/packages/axis-utils/script/test/tokens/deployTokens.sh +++ b/packages/axis-utils/script/test/tokens/deployTokens.sh @@ -19,9 +19,9 @@ ENV_FILE=${envFile:-".env"} echo "Sourcing environment variables from $ENV_FILE" # Load environment file -set -a # Automatically export all variables +set -a # Automatically export all variables source $ENV_FILE -set +a # Disable automatic export +set +a # Disable automatic export # Apply defaults to command-line arguments BROADCAST=${broadcast:-false} @@ -29,15 +29,13 @@ VERIFY=${verify:-false} RESUME=${resume:-false} # Check that the seller is defined and is an address -if [[ ! "$seller" =~ ^0x[a-fA-F0-9]{40}$ ]] -then +if [[ ! "$seller" =~ ^0x[a-fA-F0-9]{40}$ ]]; then echo "Invalid seller specified. Provide the address after the --seller flag." exit 1 fi # Check that the buyer is defined and is an address -if [[ ! "$buyer" =~ ^0x[a-fA-F0-9]{40}$ ]] -then +if [[ ! "$buyer" =~ ^0x[a-fA-F0-9]{40}$ ]]; then echo "Invalid buyer specified. Provide the address after the --buyer flag." exit 1 fi @@ -99,7 +97,7 @@ fi # Create auction forge script ./script/test/DeployTokens.s.sol:DeployTokens --sig "deployTestTokens(address,address)()" $seller $buyer \ ---rpc-url $RPC_URL --private-key $DEPLOYER_PRIVATE_KEY --froms $DEPLOYER_ADDRESS --slow -vvv \ -$BROADCAST_FLAG \ -$VERIFY_FLAG \ -$RESUME_FLAG + --rpc-url $RPC_URL --private-key $DEPLOYER_PRIVATE_KEY --froms $DEPLOYER_ADDRESS --slow -vvv \ + $BROADCAST_FLAG \ + $VERIFY_FLAG \ + $RESUME_FLAG diff --git a/packages/axis-utils/script/test/warp.sh b/packages/axis-utils/script/test/warp.sh index 9cec7cf..c19f960 100755 --- a/packages/axis-utils/script/test/warp.sh +++ b/packages/axis-utils/script/test/warp.sh @@ -19,20 +19,18 @@ ENV_FILE=${envFile:-".env"} echo "Sourcing environment variables from $ENV_FILE" # Load environment file -set -a # Automatically export all variables +set -a # Automatically export all variables source $ENV_FILE -set +a # Disable automatic export +set +a # Disable automatic export # Check that the ADMIN_RPC_URL is defined -if [ -z "$ADMIN_RPC_URL" ] -then +if [ -z "$ADMIN_RPC_URL" ]; then echo "No RPC URL specified. Set the ADMIN_RPC_URL environment variable." exit 1 fi # Check that the timestamp is defined and is an integer -if [[ ! "$timestamp" =~ ^[0-9]+$ ]] -then +if [[ ! "$timestamp" =~ ^[0-9]+$ ]]; then echo "Invalid timestamp specified. Provide an integer after the --timestamp flag." exit 1 fi diff --git a/packages/axis-utils/soldeer.lock b/packages/axis-utils/soldeer.lock index ffad399..7f87db8 100644 --- a/packages/axis-utils/soldeer.lock +++ b/packages/axis-utils/soldeer.lock @@ -13,15 +13,15 @@ checksum = "97bdb2003b70382996a79a406813f76417b1cf90" [[dependencies]] name = "axis-core" -version = "1.0.0" -source = "https://soldeer-revisions.s3.amazonaws.com/axis-core/1_0_0_18-07-2024_01:46:16_axis-core.zip" -checksum = "9b5716ade218b4064bba7cca7d31065e6aa66574ad92386aaf2cc71b5c21bbb4" +version = "1.0.1" +source = "https://soldeer-revisions.s3.amazonaws.com/axis-core/1_0_1_22-08-2024_01:53:20_axis-core.zip" +checksum = "90ee8eca451f4454ad911c52d014bebbbacc3e0ba2260ad19e56e32598ea9d21" [[dependencies]] name = "axis-periphery" -version = "0.9.0" -source = "git@github.com:Axis-Fi/axis-periphery.git" -checksum = "a87edb37c610315dd46cd2d780863bb477f5c0c6" +version = "1.0.0" +source = "https://soldeer-revisions.s3.amazonaws.com/axis-periphery/1_0_0_22-08-2024_19:37:58_axis-periphery.zip" +checksum = "fb20c7ebe7ab30697b72300c8c9e4cc847de98c35ab8c05b5d71fe3ed59fead0" [[dependencies]] name = "solady" diff --git a/packages/axis-utils/src/lib/EncryptedMarginalPriceBid.sol b/packages/axis-utils/src/lib/EncryptedMarginalPriceBid.sol index a5802a9..c43c2b2 100644 --- a/packages/axis-utils/src/lib/EncryptedMarginalPriceBid.sol +++ b/packages/axis-utils/src/lib/EncryptedMarginalPriceBid.sol @@ -1,12 +1,12 @@ // SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity ^0.8.0; -import {ECIES, Point} from "@axis-core-1.0.0/lib/ECIES.sol"; +import {ECIES, Point} from "@axis-core-1.0.1/lib/ECIES.sol"; /// @title EncryptedMarginalPriceBid /// @notice Library for encrypting the amount out for a bid in an encrypted marginal price auction library EncryptedMarginalPriceBid { - function _formatBid(uint96 amountOut_, uint128 bidSeed) internal pure returns (uint256) { + function formatBid(uint96 amountOut_, uint128 bidSeed) internal pure returns (uint256) { uint256 formattedAmountOut; { uint128 subtracted; @@ -39,7 +39,7 @@ library EncryptedMarginalPriceBid { uint256 bidPrivateKey_ ) public view returns (uint256 encryptedAmountOut) { // Format the amount out - uint256 formattedAmountOut = _formatBid(amountOut_, bidSeed_); + uint256 formattedAmountOut = formatBid(amountOut_, bidSeed_); uint256 salt = uint256(keccak256(abi.encodePacked(lotId_, bidder_, uint96(amountIn_)))); (encryptedAmountOut,) =