Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Price Batch Auction #193

Merged
merged 17 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,13 @@
],
"[json]": {
"editor.tabSize": 2
}
},
"json.schemas": [
{
"fileMatch": [
"/script/deploy/sequences/*.json"
],
"url": "/script/deploy/sequence_schema.json"
}
]
}
3 changes: 3 additions & 0 deletions deployments/.arbitrum-sepolia-fpb-v3.1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"axis.FixedPriceBatch": "0xB24D0b6ae015DC6fd279E330db101bB890d8060c"
}
5 changes: 5 additions & 0 deletions deployments/.base-sepolia-allowlists-v3.1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"axis.BatchCappedMerkleAllowlist": "0x98316f91B751d1ae41Fd668440db05Dc644b8112",
"axis.BatchMerkleAllowlist": "0x985AFB4b65Fa7f47c53CF4a44a1d6D8ad59Bf6F8",
"axis.BatchTokenAllowlist": "0x986fB5ac838e7DB6857c171d7ac846Fc875c306B"
}
7 changes: 7 additions & 0 deletions deployments/.base-sepolia-v3.1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"axis.BatchAuctionHouse": "0xBA000092028c37fdf4231090D9a0e42B3A983C17",
"axis.BatchCatalogue": "0xD55227c0C37C97Fa2619a9C7F658C173883C1E2a",
"axis.EncryptedMarginalPrice": "0x0599DA010907835037A0beC4525Dc5D600e790EB",
"axis.FixedPriceBatch": "0x71a2946A761FC6ecE1b16cb4517a3E3D7E30Cc92",
"axis.BatchLinearVesting": "0xc20918b09dE9708d2A7997dfFc3c5ACB34d4a15b"
}
3 changes: 3 additions & 0 deletions deployments/.blast-sepolia-fpb-v3.1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"axis.FixedPriceBatch": "0xEDa0cC0bbb45D8cd6354755856053d6Ea646E201"
}
3 changes: 3 additions & 0 deletions deployments/.mode-sepolia-fpb-v3.1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"axis.FixedPriceBatch": "0xC818f1f000f9C24D014BCe2c5334e14B1360d9CD"
}
38 changes: 35 additions & 3 deletions script/deploy/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ import {Module} from "src/modules/Modules.sol";
import {Callbacks} from "src/lib/Callbacks.sol";

// Auction modules
import {EncryptedMarginalPrice} from "src/modules/auctions/EMP.sol";
import {FixedPriceSale} from "src/modules/auctions/FPS.sol";
import {EncryptedMarginalPrice} from "src/modules/auctions/batch/EMP.sol";
import {FixedPriceSale} from "src/modules/auctions/atomic/FPS.sol";
import {FixedPriceBatch} from "src/modules/auctions/batch/FPB.sol";

// Derivative modules
import {LinearVesting} from "src/modules/derivatives/LinearVesting.sol";
Expand Down Expand Up @@ -362,7 +363,7 @@ contract Deploy is Script, WithEnvironment, WithSalts {
return (address(batchCatalogue), _PREFIX_AXIS);
}

// ========== MODULE DEPLOYMENTS ========== //
// ========== AUCTION MODULE DEPLOYMENTS ========== //

function deployEncryptedMarginalPrice(bytes memory)
public
Expand Down Expand Up @@ -428,6 +429,37 @@ contract Deploy is Script, WithEnvironment, WithSalts {
return (address(amFps), _PREFIX_AXIS);
}

function deployFixedPriceBatch(bytes memory) public virtual returns (address, string memory) {
// No args used
console2.log("");
console2.log("Deploying FixedPriceBatch");

address batchAuctionHouse = _getAddressNotZero("axis.BatchAuctionHouse");

// Get the salt
bytes32 salt_ = _getSalt(
"FixedPriceBatch", type(FixedPriceBatch).creationCode, abi.encode(batchAuctionHouse)
);

// Deploy the module
FixedPriceBatch amFpb;
if (salt_ == bytes32(0)) {
vm.broadcast();
amFpb = new FixedPriceBatch(batchAuctionHouse);
} else {
console2.log(" salt:", vm.toString(salt_));

vm.broadcast();
amFpb = new FixedPriceBatch{salt: salt_}(batchAuctionHouse);
}
console2.log("");
console2.log(" FixedPriceBatch deployed at:", address(amFpb));

return (address(amFpb), _PREFIX_AXIS);
}

// ========== DERIVATIVE MODULE DEPLOYMENTS ========== //

function deployAtomicLinearVesting(bytes memory)
public
virtual
Expand Down
33 changes: 31 additions & 2 deletions script/deploy/DeployBlast.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import {console2} from "forge-std/Script.sol";
// System contracts
import {BlastAtomicAuctionHouse} from "src/blast/BlastAtomicAuctionHouse.sol";
import {BlastBatchAuctionHouse} from "src/blast/BlastBatchAuctionHouse.sol";
import {BlastEMP} from "src/blast/modules/auctions/BlastEMP.sol";
import {BlastFPS} from "src/blast/modules/auctions/BlastFPS.sol";
import {BlastEMP} from "src/blast/modules/auctions/batch/BlastEMP.sol";
import {BlastFPS} from "src/blast/modules/auctions/atomic/BlastFPS.sol";
import {BlastFPB} from "src/blast/modules/auctions/batch/BlastFPB.sol";
import {BlastLinearVesting} from "src/blast/modules/derivatives/BlastLinearVesting.sol";

import {Deploy} from "script/deploy/Deploy.s.sol";
Expand Down Expand Up @@ -153,6 +154,34 @@ contract DeployBlast is Deploy {
return (address(amFps), _PREFIX_AXIS);
}

function deployFixedPriceBatch(bytes memory) public override returns (address, string memory) {
// No args used
console2.log("");
console2.log("Deploying BlastFPB (Fixed Price Batch)");

address batchAuctionHouse = _getAddressNotZero("axis.BatchAuctionHouse");
address blast = _getAddressNotZero("blast.blast");

// Get the salt
bytes32 salt_ =
_getSalt("BlastFPB", type(BlastFPB).creationCode, abi.encode(batchAuctionHouse, blast));

// Deploy the module
BlastFPB amFpb;
if (salt_ == bytes32(0)) {
vm.broadcast();
amFpb = new BlastFPB(batchAuctionHouse, blast);
} else {
console2.log(" salt:", vm.toString(salt_));

vm.broadcast();
amFpb = new BlastFPB{salt: salt_}(batchAuctionHouse, blast);
}
console2.log(" BlastFPB deployed at:", address(amFpb));

return (address(amFpb), _PREFIX_AXIS);
}

function deployAtomicLinearVesting(bytes memory)
public
override
Expand Down
44 changes: 44 additions & 0 deletions script/deploy/sequence_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://axis.finance/deploy.schema.json",
"title": "Axis Finance Deployment Configuration",
"description": "Configuration for deploying Axis Finance core and modules",
"type": "object",
"properties": {
"sequence": {
"type": "array",
"items": {
"type": "object",
"description": "Describes an individual deployment",
"properties": {
"name": {
"type": "string",
"description": "The name of the module to deploy",
"exclusiveMinimum": 0
},
"installAtomicAuctionHouse": {
"type": "boolean",
"description": "Whether to install the module into the Atomic Auction House",
"default": false
},
"installBatchAuctionHouse": {
"type": "boolean",
"description": "Whether to install the module into the Batch Auction House",
"default": false
},
"args": {
"type": "object",
"description": "Arguments to pass to the module's deploy function",
"uniqueItems": true,
"additionalProperties": {
"type": ["integer", "string"],
"pattern": "^0x[0-9a-fA-F]{40}$"
}
}
},
"required": ["name"]
}
},
"required": ["sequence"]
}
}
8 changes: 8 additions & 0 deletions script/deploy/sequences/fixed-batch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"sequence": [
{
"name": "FixedPriceBatch",
"installBatchAuctionHouse": true
}
]
}
14 changes: 2 additions & 12 deletions script/deploy/sequences/origin.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
{
"sequence": [
{
"name": "AtomicAuctionHouse"
},
{
"name": "BatchAuctionHouse"
},
{
"name": "AtomicCatalogue"
},
{
"name": "BatchCatalogue"
},
Expand All @@ -17,12 +11,8 @@
"installBatchAuctionHouse": true
},
{
"name": "FixedPriceSale",
"installAtomicAuctionHouse": true
},
{
"name": "AtomicLinearVesting",
"installAtomicAuctionHouse": true
"name": "FixedPriceBatch",
"installBatchAuctionHouse": true
},
{
"name": "BatchLinearVesting",
Expand Down
15 changes: 11 additions & 4 deletions script/env.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"BatchUniswapV2DirectToLiquidity": "0x0000000000000000000000000000000000000000",
"BatchUniswapV3DirectToLiquidity": "0x0000000000000000000000000000000000000000",
"EncryptedMarginalPrice": "0x87F2a19FBbf9e557a68bD35D85FAd20dEec40494",
"FixedPriceBatch": "0xB24D0b6ae015DC6fd279E330db101bB890d8060c",
"FixedPriceSale": "0x0A0BA689D2D72D3f376293c534AF299B3C6Dac85",
"OWNER": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e",
"PERMIT2": "0x000000000022D473030F116dDEE9F6B43aC78BA3",
Expand All @@ -68,12 +69,16 @@
"AtomicLinearVesting": "0x0000000000000000000000000000000000000000",
"AtomicUniswapV2DirectToLiquidity": "0x0000000000000000000000000000000000000000",
"AtomicUniswapV3DirectToLiquidity": "0x0000000000000000000000000000000000000000",
"BatchAuctionHouse": "0x0000000000000000000000000000000000000000",
"BatchCatalogue": "0x0000000000000000000000000000000000000000",
"BatchLinearVesting": "0x0000000000000000000000000000000000000000",
"BatchAuctionHouse": "0xBA000092028c37fdf4231090D9a0e42B3A983C17",
"BatchCappedMerkleAllowlist": "0x98316f91B751d1ae41Fd668440db05Dc644b8112",
"BatchCatalogue": "0xD55227c0C37C97Fa2619a9C7F658C173883C1E2a",
"BatchLinearVesting": "0xc20918b09dE9708d2A7997dfFc3c5ACB34d4a15b",
"BatchMerkleAllowlist": "0x985AFB4b65Fa7f47c53CF4a44a1d6D8ad59Bf6F8",
"BatchTokenAllowlist": "0x986fB5ac838e7DB6857c171d7ac846Fc875c306B",
"BatchUniswapV2DirectToLiquidity": "0x0000000000000000000000000000000000000000",
"BatchUniswapV3DirectToLiquidity": "0x0000000000000000000000000000000000000000",
"EncryptedMarginalPrice": "0x0000000000000000000000000000000000000000",
"EncryptedMarginalPrice": "0x0599DA010907835037A0beC4525Dc5D600e790EB",
"FixedPriceBatch": "0x71a2946A761FC6ecE1b16cb4517a3E3D7E30Cc92",
"FixedPriceSale": "0x0000000000000000000000000000000000000000",
"OWNER": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e",
"PERMIT2": "0x000000000022D473030F116dDEE9F6B43aC78BA3",
Expand Down Expand Up @@ -140,6 +145,7 @@
"BatchUniswapV2DirectToLiquidity": "0x0000000000000000000000000000000000000000",
"BatchUniswapV3DirectToLiquidity": "0x0000000000000000000000000000000000000000",
"EncryptedMarginalPrice": "0x96B52Ab3e5CAc0BbF49Be5039F2f9ef5d53bD322",
"FixedPriceBatch": "0xEDa0cC0bbb45D8cd6354755856053d6Ea646E201",
"FixedPriceSale": "0x3661B7704F7032103B3122C7796B5E03fAC715b5",
"OWNER": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e",
"PERMIT2": "0x000000000022D473030F116dDEE9F6B43aC78BA3",
Expand Down Expand Up @@ -206,6 +212,7 @@
"BatchUniswapV2DirectToLiquidity": "0x0000000000000000000000000000000000000000",
"BatchUniswapV3DirectToLiquidity": "0x0000000000000000000000000000000000000000",
"EncryptedMarginalPrice": "0x4e519eEf63b9e127cFCeCA31C8E5485CdA65D355",
"FixedPriceBatch": "0xC818f1f000f9C24D014BCe2c5334e14B1360d9CD",
"FixedPriceSale": "0xacD10C2B4aA625dd00cba40E4466c8Ff07288a16",
"OWNER": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e",
"PERMIT2": "0x000000000022D473030F116dDEE9F6B43aC78BA3",
Expand Down
2 changes: 1 addition & 1 deletion script/ops/test/TestData.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {Script, console2} from "forge-std/Script.sol";
import {BatchAuctionHouse} from "src/BatchAuctionHouse.sol";
import {IAuctionHouse} from "src/interfaces/IAuctionHouse.sol";
import {toKeycode, toVeecode} from "src/modules/Modules.sol";
import {EncryptedMarginalPrice} from "src/modules/auctions/EMP.sol";
import {EncryptedMarginalPrice} from "src/modules/auctions/batch/EMP.sol";
import {ECIES, Point} from "src/lib/ECIES.sol";
import {uint2str} from "src/lib/Uint2Str.sol";

Expand Down
4 changes: 2 additions & 2 deletions script/salts/allowlist/AllowlistSalts.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ contract AllowlistSalts is Script, WithEnvironment, WithSalts {
_createBytecodeDirectory();

// Cache auction houses
_envAtomicAuctionHouse = _envAddressNotZero("axis.AtomicAuctionHouse");
_envAtomicAuctionHouse = _envAddress("axis.AtomicAuctionHouse");
console2.log("AtomicAuctionHouse:", _envAtomicAuctionHouse);
_envBatchAuctionHouse = _envAddressNotZero("axis.BatchAuctionHouse");
_envBatchAuctionHouse = _envAddress("axis.BatchAuctionHouse");
console2.log("BatchAuctionHouse:", _envBatchAuctionHouse);
}

Expand Down
6 changes: 5 additions & 1 deletion script/salts/salts.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"0xc34e46cfceb1e62d804e8197ba829a150e216e433ee21a68b96f1edd3abd4dd9": "0x87bc14fda5bd97c7e883ae1227f30462125ebcf6800a34d10f39af4ac46e84b9"
},
"BatchAuctionHouse": {
"0x1d8b7b9cfbd8610a556d5e2e85dcdb25a17d6b5407574aef07970a86e4b0e2c3": "0x06374b73456c869d550c6cb45aff40113752ac3c4dd8efb8185b6da5c898aa82",
"0x4c4d86f9737bd18dab3f6dc74d2f5c610b7169459c90a457e0e126ed42ae3bba": "0xbe4a9dc1b73685497c6104df59c2a3d2c1c5039bd48b1b25e9c0a029f3744311"
},
"BlastAtomicAuctionHouse": {
Expand All @@ -12,12 +13,14 @@
"0xc640e527fdcd05d6135de917e29082984847300ec6bf4cf38393f8dbfa742b19": "0x1e7690f0ac2409cb3804ffe443d81e9685d882d4d1804c8bfb1056cc624afee8"
},
"CappedMerkleAllowlist": {
"0x0ae7777d88dd21a8b9ca3dd9212307295a83aed438fef9dad0b62d57fbaf1025": "0x1de5ae5b126bd2cee8eb4f083080f5c30baa692580cf823fa5f382a7bfc70ac5",
"0x7629e3374867d748eaab783ad2eedb4e39634e55428c39713fd82415d41043a3": "0x31246341c7c82c31414f184b807da273fdd6cdf591cb6f997fec41babc279fd9",
"0x78ee3a1a70f7e9a784590ca00ef3290f3478105f6338266b9e5f0d10951b4aa9": "0xdb5af3b6d32454d69075509db94196460a19acb9849c5dc0d5ccef5a1b4ab032"
},
"MerkleAllowlist": {
"0x8dabf7c769c996b5b33b4da1013d93b9daeeb7cf468d179804c9130fd7eaa891": "0x71072df633972dfa166196430a104dbc30b8dc5997a8b965253ca299fd96feaf",
"0xb4128aa3cf1f256d76081a556cbe66c83429e49ce28bca3b2e3b07b926f0bda8": "0xcbac00a3b5465e91d8c65d179de9fa8f52be1c99b8ecfd9ce35b51faa0046232"
"0xb4128aa3cf1f256d76081a556cbe66c83429e49ce28bca3b2e3b07b926f0bda8": "0xcbac00a3b5465e91d8c65d179de9fa8f52be1c99b8ecfd9ce35b51faa0046232",
"0xc8e647c61be9e05b08050eb7d8cfc1102b5328d9540b81891da5783ba25d2978": "0x368c44b5208a15f6292a0ac1246d7d6973d5c919d32cebd2f30da0844356e63a"
},
"Test_CappedMerkleAllowlist": {
"0x949cc973758fec263c28001984b366da5a91b8c2808ff8a54d0a15d553fbb119": "0x3152e9b2cb8c87f150a66f3e6445095a816f624d33fe0837e565c6cf7dab4365",
Expand Down Expand Up @@ -50,6 +53,7 @@
"0x205b2d8780f5fa0bb6edef93607aa4f671b524b5d2b2f3278d238d08dfdf900c": "0x52c359e9c03d7e4b2af98f5b70fc386406184608f7f882d2789be69a2743d09a"
},
"TokenAllowlist": {
"0x09db47d395a68db033a3b222b9d1a212cec8422b03aeafc313aa4d2813c6dd60": "0x1c4bc5002d793fc427b068abb9dab670aad1864bab04a981d134b7459103f693",
"0x30d8cf89cc8c815884740dc27e72a1f8b5dacbbe39f3d1e35deb436176390b20": "0xd3b0a4a73b330c13d6fef29f392e398db9099d4de7cc69ccbe71a2e21d7687dc",
"0xcc0cb46859311aa362f48add9ffc284efd8aad3e4ec5a29b68eee7ab1b4cd8c4": "0x38fa3d6714b18bea94ce4f3f8a3491d0873d4fbc8527002cfb153c385c093e72"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BSL-1.1
pragma solidity 0.8.19;

import {FixedPriceSale} from "src/modules/auctions/FPS.sol";
import {FixedPriceSale} from "src/modules/auctions/atomic/FPS.sol";
import {BlastGas} from "src/blast/modules/BlastGas.sol";

contract BlastFPS is FixedPriceSale, BlastGas {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BSL-1.1
pragma solidity 0.8.19;

import {EncryptedMarginalPrice} from "src/modules/auctions/EMP.sol";
import {EncryptedMarginalPrice} from "src/modules/auctions/batch/EMP.sol";
import {BlastGas} from "src/blast/modules/BlastGas.sol";

contract BlastEMP is EncryptedMarginalPrice, BlastGas {
Expand Down
14 changes: 14 additions & 0 deletions src/blast/modules/auctions/batch/BlastFPB.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-License-Identifier: BSL-1.1
pragma solidity 0.8.19;

import {FixedPriceBatch} from "src/modules/auctions/batch/FPB.sol";
import {BlastGas} from "src/blast/modules/BlastGas.sol";

contract BlastFPB is FixedPriceBatch, BlastGas {
// ========== CONSTRUCTOR ========== //

constructor(
address auctionHouse_,
address blast_
) FixedPriceBatch(auctionHouse_) BlastGas(auctionHouse_, blast_) {}
}
Loading
Loading