Skip to content
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
2 changes: 0 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ jobs:

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

# Providing the SSH key to the checkout action does not work with our config.
# It likely is because of the install script wiping the lib/ directory.
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "lib/baseline-v2"]
path = lib/baseline-v2
url = git@github.com:0xBaseline/baseline-v2.git
11 changes: 0 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,6 @@ The test suite can be run with:
pnpm run test
```

#### Address Mismatch

Many of the contracts (e.g. callbacks) require a specific address prefix or have a deterministic address. If tests are failing for this reason, the cause is usually one of:

- The code of a callback contract has been changed
- This requires re-generating the salt for the contract. See the [test_salts.sh](/script/salts/test/test_salts.sh) script.
- There has been a change to the dependencies under `/lib`. The dependencies affect the build output, so any changes will affect the bytecode generated by the Solidity compiler.
- If the submodule change was inadvertent, this can be fixed by running `pnpm install` to reset the changes.
- In some cases, such as the `g-uni-v1-core` dependency, installing npm packages will result in the remappings being changed. It is best to remove the dependency's respective dependencies in order to fix this.
- If the change to dependencies and invalidation of salts is expected, then new salts must be generated. In some cases (such as Uniswap V2 and V3 factories), the new addresses must be recorded in the `Constants.sol` file.

### Format

Combines `forge fmt` and `solhint`
Expand Down
8 changes: 4 additions & 4 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ axis-core = { version = "1.0.4" }
"@openzeppelin-contracts-upgradeable" = { version = "4.9.2" }
"@uniswap-v2-core" = { version = "1.0.1" }
"@uniswap-v3-core" = { version = "1.0.1-solc-0.8-simulate" }
g-uni-v1-core = { version = "0.9.9", git = "git@github.com:Axis-Fi/g-uni-v1-core.git", rev = "d6bcb6e811e86d36bc836c002eb2e9a2c73d29ca" }
"@uniswap-v2-periphery" = { version = "1.0.1", git = "git@github.com:Axis-Fi/uniswap-v2-periphery.git", rev = "19be650786731dfe43cac3aac7a2d1f0731d18e2" }
"@uniswap-v3-periphery" = { version = "1.4.2-solc-0.8", git = "git@github.com:Uniswap/v3-periphery.git", rev = "b325bb0905d922ae61fcc7df85ee802e8df5e96c" }
g-uni-v1-core = { version = "0.9.9", git = "https://github.com/Axis-Fi/g-uni-v1-core.git", rev = "d6bcb6e811e86d36bc836c002eb2e9a2c73d29ca" }
"@uniswap-v2-periphery" = { version = "1.0.1", git = "https://github.com/Axis-Fi/uniswap-v2-periphery.git", rev = "19be650786731dfe43cac3aac7a2d1f0731d18e2" }
"@uniswap-v3-periphery" = { version = "1.4.2-solc-0.8", git = "https://github.com/Uniswap/v3-periphery.git", rev = "b325bb0905d922ae61fcc7df85ee802e8df5e96c" }
solmate = { version = "6.8.0" }
clones-with-immutable-args = { version = "1.1.1", git = "git@github.com:wighawag/clones-with-immutable-args.git", rev = "f5ca191afea933d50a36d101009b5644dc28bc99" }
clones-with-immutable-args = { version = "1.1.1", git = "https://github.com/wighawag/clones-with-immutable-args.git", rev = "f5ca191afea933d50a36d101009b5644dc28bc99" }
solady = { version = "0.0.124" }
1 change: 0 additions & 1 deletion lib/baseline-v2
Submodule baseline-v2 deleted from 60bed7
1 change: 0 additions & 1 deletion remappings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@
@openzeppelin/contracts=dependencies/@openzeppelin-contracts-4.9.2
@openzeppelin/contracts-upgradeable=dependencies/@openzeppelin-contracts-upgradeable-4.9.2
@solady-0.0.124=dependencies/solady-0.0.124/src
@baseline=lib/baseline-v2/src
319 changes: 0 additions & 319 deletions script/deploy/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,6 @@ import {CappedMerkleAllowlist} from "../../src/callbacks/allowlists/CappedMerkle
import {MerkleAllowlist} from "../../src/callbacks/allowlists/MerkleAllowlist.sol";
import {TokenAllowlist} from "../../src/callbacks/allowlists/TokenAllowlist.sol";
import {AllocatedMerkleAllowlist} from "../../src/callbacks/allowlists/AllocatedMerkleAllowlist.sol";
import {BaselineAxisLaunch} from "../../src/callbacks/liquidity/BaselineV2/BaselineAxisLaunch.sol";
import {BALwithAllowlist} from "../../src/callbacks/liquidity/BaselineV2/BALwithAllowlist.sol";
import {BALwithAllocatedAllowlist} from
"../../src/callbacks/liquidity/BaselineV2/BALwithAllocatedAllowlist.sol";
import {BALwithCappedAllowlist} from
"../../src/callbacks/liquidity/BaselineV2/BALwithCappedAllowlist.sol";
import {BALwithTokenAllowlist} from
"../../src/callbacks/liquidity/BaselineV2/BALwithTokenAllowlist.sol";

// Baseline
import {
Kernel as BaselineKernel,
Actions as BaselineKernelActions
} from "../../src/callbacks/liquidity/BaselineV2/lib/Kernel.sol";

/// @notice Declarative deployment script that reads a deployment sequence (with constructor args)
/// and a configured environment file to deploy and install contracts in the Axis protocol.
Expand Down Expand Up @@ -787,311 +773,6 @@ contract Deploy is Script, WithDeploySequence, WithSalts {
return (address(cbBatchAllocatedMerkleAllowlist), _PREFIX_CALLBACKS, deploymentKey);
}

function deployBatchBaselineAxisLaunch(
string memory sequenceName_
) public returns (address, string memory, string memory) {
console2.log("");
console2.log("Deploying BaselineAxisLaunch (Batch)");

// Get configuration variables
address batchAuctionHouse = _getAddressNotZero("deployments.BatchAuctionHouse");
address baselineKernel = _getSequenceAddress(sequenceName_, "args.baselineKernel");
console2.log(" baselineKernel:", baselineKernel);
address baselineOwner = _getSequenceAddress(sequenceName_, "args.baselineOwner");
console2.log(" baselineOwner:", baselineOwner);
address reserveToken = _getSequenceAddress(sequenceName_, "args.reserveToken");
console2.log(" reserveToken:", reserveToken);
string memory deploymentKey = _getDeploymentKey(sequenceName_);
console2.log(" deploymentKey:", deploymentKey);

// Validate arguments
require(baselineKernel != address(0), "baselineKernel not set");
require(baselineOwner != address(0), "baselineOwner not set");
require(reserveToken != address(0), "reserveToken not set");

// Get the salt
// This supports an arbitrary salt key, which can be set in the deployment sequence
// This is required as each callback is single-use
bytes32 salt_ = _getSalt(
deploymentKey,
type(BaselineAxisLaunch).creationCode,
abi.encode(batchAuctionHouse, baselineKernel, reserveToken, baselineOwner)
);

// Revert if the salt is not set
require(salt_ != bytes32(0), "Salt not set");

// Deploy the module
console2.log(" salt:", vm.toString(salt_));

vm.broadcast();
BaselineAxisLaunch batchCallback = new BaselineAxisLaunch{salt: salt_}(
batchAuctionHouse, baselineKernel, reserveToken, baselineOwner
);
console2.log("");
console2.log(" deployed at:", address(batchCallback));

// If the deployer is the executor,
// install the module as a policy in the Baseline kernel
BaselineKernel kernel = BaselineKernel(baselineKernel);
if (kernel.executor() == msg.sender) {
vm.broadcast();
BaselineKernel(baselineKernel).executeAction(
BaselineKernelActions.ActivatePolicy, address(batchCallback)
);

console2.log(" Policy activated in Baseline Kernel");
} else {
console2.log(" Policy activation skipped");
}

return (address(batchCallback), _PREFIX_CALLBACKS, deploymentKey);
}

function deployBatchBaselineAllocatedAllowlist(
string memory sequenceName_
) public returns (address, string memory, string memory) {
console2.log("");
console2.log("Deploying BaselineAllocatedAllowlist (Batch)");

// Get configuration variables
address batchAuctionHouse = _getAddressNotZero("deployments.BatchAuctionHouse");
address baselineKernel = _getSequenceAddress(sequenceName_, "args.baselineKernel");
console2.log(" baselineKernel:", baselineKernel);
address baselineOwner = _getSequenceAddress(sequenceName_, "args.baselineOwner");
console2.log(" baselineOwner:", baselineOwner);
address reserveToken = _getSequenceAddress(sequenceName_, "args.reserveToken");
console2.log(" reserveToken:", reserveToken);
string memory deploymentKey = _getDeploymentKey(sequenceName_);
console2.log(" deploymentKey:", deploymentKey);

// Validate arguments
require(baselineKernel != address(0), "baselineKernel not set");
require(baselineOwner != address(0), "baselineOwner not set");
require(reserveToken != address(0), "reserveToken not set");

// Get the salt
// This supports an arbitrary salt key, which can be set in the deployment sequence
// This is required as each callback is single-use
bytes32 salt_ = _getSalt(
deploymentKey,
type(BALwithAllocatedAllowlist).creationCode,
abi.encode(batchAuctionHouse, baselineKernel, reserveToken, baselineOwner)
);

// Revert if the salt is not set
require(salt_ != bytes32(0), "Salt not set");

// Deploy the module
console2.log(" salt:", vm.toString(salt_));

vm.broadcast();
BALwithAllocatedAllowlist batchAllowlist = new BALwithAllocatedAllowlist{salt: salt_}(
batchAuctionHouse, baselineKernel, reserveToken, baselineOwner
);
console2.log("");
console2.log(" deployed at:", address(batchAllowlist));

// If the deployer is the executor,
// install the module as a policy in the Baseline kernel
BaselineKernel kernel = BaselineKernel(baselineKernel);
if (kernel.executor() == msg.sender) {
vm.broadcast();
BaselineKernel(baselineKernel).executeAction(
BaselineKernelActions.ActivatePolicy, address(batchAllowlist)
);

console2.log(" Policy activated in Baseline Kernel");
} else {
console2.log(" Policy activation skipped");
}

return (address(batchAllowlist), _PREFIX_CALLBACKS, deploymentKey);
}

function deployBatchBaselineAllowlist(
string memory sequenceName_
) public returns (address, string memory, string memory) {
console2.log("");
console2.log("Deploying BaselineAllowlist (Batch)");

// Get configuration variables
address batchAuctionHouse = _getAddressNotZero("deployments.BatchAuctionHouse");
address baselineKernel = _getSequenceAddress(sequenceName_, "args.baselineKernel");
console2.log(" baselineKernel:", baselineKernel);
address baselineOwner = _getSequenceAddress(sequenceName_, "args.baselineOwner");
console2.log(" baselineOwner:", baselineOwner);
address reserveToken = _getSequenceAddress(sequenceName_, "args.reserveToken");
console2.log(" reserveToken:", reserveToken);
string memory deploymentKey = _getDeploymentKey(sequenceName_);
console2.log(" deploymentKey:", deploymentKey);

// Validate arguments
require(baselineKernel != address(0), "baselineKernel not set");
require(baselineOwner != address(0), "baselineOwner not set");
require(reserveToken != address(0), "reserveToken not set");

// Get the salt
// This supports an arbitrary salt key, which can be set in the deployment sequence
// This is required as each callback is single-use
bytes32 salt_ = _getSalt(
deploymentKey,
type(BALwithAllowlist).creationCode,
abi.encode(batchAuctionHouse, baselineKernel, reserveToken, baselineOwner)
);

// Revert if the salt is not set
require(salt_ != bytes32(0), "Salt not set");

// Deploy the module
console2.log(" salt:", vm.toString(salt_));

vm.broadcast();
BALwithAllowlist batchAllowlist = new BALwithAllowlist{salt: salt_}(
batchAuctionHouse, baselineKernel, reserveToken, baselineOwner
);
console2.log("");
console2.log(" deployed at:", address(batchAllowlist));

// If the deployer is the executor,
// install the module as a policy in the Baseline kernel
BaselineKernel kernel = BaselineKernel(baselineKernel);
if (kernel.executor() == msg.sender) {
vm.broadcast();
BaselineKernel(baselineKernel).executeAction(
BaselineKernelActions.ActivatePolicy, address(batchAllowlist)
);

console2.log(" Policy activated in Baseline Kernel");
} else {
console2.log(" Policy activation skipped");
}

return (address(batchAllowlist), _PREFIX_CALLBACKS, deploymentKey);
}

function deployBatchBaselineCappedAllowlist(
string memory sequenceName_
) public returns (address, string memory, string memory) {
console2.log("");
console2.log("Deploying BaselineCappedAllowlist (Batch)");

// Get configuration variables
address batchAuctionHouse = _getAddressNotZero("deployments.BatchAuctionHouse");
address baselineKernel = _getSequenceAddress(sequenceName_, "args.baselineKernel");
console2.log(" baselineKernel:", baselineKernel);
address baselineOwner = _getSequenceAddress(sequenceName_, "args.baselineOwner");
console2.log(" baselineOwner:", baselineOwner);
address reserveToken = _getSequenceAddress(sequenceName_, "args.reserveToken");
console2.log(" reserveToken:", reserveToken);
string memory deploymentKey = _getDeploymentKey(sequenceName_);
console2.log(" deploymentKey:", deploymentKey);

// Validate arguments
require(baselineKernel != address(0), "baselineKernel not set");
require(baselineOwner != address(0), "baselineOwner not set");
require(reserveToken != address(0), "reserveToken not set");

// Get the salt
// This supports an arbitrary salt key, which can be set in the deployment sequence
// This is required as each callback is single-use
bytes32 salt_ = _getSalt(
deploymentKey,
type(BALwithCappedAllowlist).creationCode,
abi.encode(batchAuctionHouse, baselineKernel, reserveToken, baselineOwner)
);

// Revert if the salt is not set
require(salt_ != bytes32(0), "Salt not set");

// Deploy the module
console2.log(" salt:", vm.toString(salt_));

vm.broadcast();
BALwithCappedAllowlist batchAllowlist = new BALwithCappedAllowlist{salt: salt_}(
batchAuctionHouse, baselineKernel, reserveToken, baselineOwner
);
console2.log("");
console2.log(" deployed at:", address(batchAllowlist));

// If the deployer is the executor,
// install the module as a policy in the Baseline kernel
BaselineKernel kernel = BaselineKernel(baselineKernel);
if (kernel.executor() == msg.sender) {
vm.broadcast();
BaselineKernel(baselineKernel).executeAction(
BaselineKernelActions.ActivatePolicy, address(batchAllowlist)
);

console2.log(" Policy activated in Baseline Kernel");
} else {
console2.log(" Policy activation skipped");
}

return (address(batchAllowlist), _PREFIX_CALLBACKS, deploymentKey);
}

function deployBatchBaselineTokenAllowlist(
string memory sequenceName_
) public returns (address, string memory, string memory) {
console2.log("");
console2.log("Deploying BaselineTokenAllowlist (Batch)");

// Get configuration variables
address batchAuctionHouse = _getAddressNotZero("deployments.BatchAuctionHouse");
address baselineKernel = _getSequenceAddress(sequenceName_, "args.baselineKernel");
console2.log(" baselineKernel:", baselineKernel);
address baselineOwner = _getSequenceAddress(sequenceName_, "args.baselineOwner");
console2.log(" baselineOwner:", baselineOwner);
address reserveToken = _getSequenceAddress(sequenceName_, "args.reserveToken");
console2.log(" reserveToken:", reserveToken);
string memory deploymentKey = _getDeploymentKey(sequenceName_);
console2.log(" deploymentKey:", deploymentKey);

// Validate arguments
require(baselineKernel != address(0), "baselineKernel not set");
require(baselineOwner != address(0), "baselineOwner not set");
require(reserveToken != address(0), "reserveToken not set");

// Get the salt
// This supports an arbitrary salt key, which can be set in the deployment sequence
// This is required as each callback is single-use
bytes32 salt_ = _getSalt(
deploymentKey,
type(BALwithTokenAllowlist).creationCode,
abi.encode(batchAuctionHouse, baselineKernel, reserveToken, baselineOwner)
);

// Revert if the salt is not set
require(salt_ != bytes32(0), "Salt not set");

// Deploy the module
console2.log(" salt:", vm.toString(salt_));

vm.broadcast();
BALwithTokenAllowlist batchAllowlist = new BALwithTokenAllowlist{salt: salt_}(
batchAuctionHouse, baselineKernel, reserveToken, baselineOwner
);
console2.log("");
console2.log(" deployed at:", address(batchAllowlist));

// If the deployer is the executor,
// install the module as a policy in the Baseline kernel
BaselineKernel kernel = BaselineKernel(baselineKernel);
if (kernel.executor() == msg.sender) {
vm.broadcast();
BaselineKernel(baselineKernel).executeAction(
BaselineKernelActions.ActivatePolicy, address(batchAllowlist)
);

console2.log(" Policy activated in Baseline Kernel");
} else {
console2.log(" Policy activation skipped");
}

return (address(batchAllowlist), _PREFIX_CALLBACKS, deploymentKey);
}

// ========== HELPER FUNCTIONS ========== //

function _configureDeployment(string memory data_, string memory name_) internal {
Expand Down
13 changes: 0 additions & 13 deletions script/deploy/sequences/baselineAllocatedAllowlist-sample.json

This file was deleted.

Loading
Loading