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

Baseline Callback Fixes #24

Merged
merged 14 commits into from
Sep 10, 2024
15 changes: 13 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ jobs:
name: Foundry project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Git Checkout
uses: actions/checkout@v4
with:
submodules: recursive
submodules: false
persist-credentials: false

- name: Install Node.js
uses: actions/setup-node@v2
Expand All @@ -34,6 +36,15 @@ jobs:
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.
# For this reason, we disable submodule checkouts above, set up the SSH agent
# with the provided key, and then run the install script.
- name: Setup SSH key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

- name: Install Dependencies
run: |
pnpm install
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.0.1

- Add additional `poolTargetTick` parameter to Baseline callbacks.

## 1.0.0

- Introduces direct-to-liquidity callbacks. Multi-use, permissionless versions are available for UniswapV2 and UniswapV3 pools. Permissioned launches are available for Baseline pools on Blast.
Expand Down
3 changes: 3 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ ignore = [

# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options

[soldeer]
remappings_generate = false # Disable replacing existing/custom remappings

[dependencies]
forge-std = { version = "1.9.1" }
axis-core = { version = "1.0.1" }
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "axis-periphery",
"version": "0.9.0",
"version": "1.0.1",
"description": "",
"main": "index.js",
"engines": {
Expand Down
8 changes: 6 additions & 2 deletions script/deploy/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,9 @@ contract Deploy is Script, WithDeploySequence, WithSalts {
if (saveDeployment) _saveDeployment(chain_);
}

function _saveDeployment(string memory chain_) internal {
function _saveDeployment(
string memory chain_
) internal {
// Create the deployments folder if it doesn't exist
if (!vm.isDir("./deployments")) {
console2.log("Creating deployments directory");
Expand Down Expand Up @@ -1143,7 +1145,9 @@ contract Deploy is Script, WithDeploySequence, WithSalts {
///
/// @param key_ Key to look for
/// @return address Returns the address
function _getAddressNotZero(string memory key_) internal view returns (address) {
function _getAddressNotZero(
string memory key_
) internal view returns (address) {
// Get from the deployed addresses first
address deployedAddress = deployedTo[key_];

Expand Down
4 changes: 3 additions & 1 deletion script/deploy/WithDeploySequence.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ abstract contract WithDeploySequence is Script, WithEnvironment {

// === Higher-level script functions === //

function _getDeploymentKey(string memory sequenceName_) internal view returns (string memory) {
function _getDeploymentKey(
string memory sequenceName_
) internal view returns (string memory) {
return string.concat(
sequenceName_, _getSequenceStringOrFallback(sequenceName_, "deploymentKeySuffix", "")
);
Expand Down
12 changes: 9 additions & 3 deletions script/deploy/WithEnvironment.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ abstract contract WithEnvironment is Script {
string public env;
string public envAxisCore;

function _loadEnv(string calldata chain_) internal {
function _loadEnv(
string calldata chain_
) internal {
chain = chain_;
console2.log("Using chain:", chain_);

Expand All @@ -26,7 +28,9 @@ abstract contract WithEnvironment is Script {
///
/// @param key_ The key to look up in the environment file
/// @return address The address from the environment file, or the zero address
function _envAddress(string memory key_) internal view returns (address) {
function _envAddress(
string memory key_
) internal view returns (address) {
string memory fullKey = string.concat(".current.", chain, ".", key_);
address addr;
bool keyExists = vm.keyExists(env, fullKey);
Expand Down Expand Up @@ -55,7 +59,9 @@ abstract contract WithEnvironment is Script {
///
/// @param key_ The key to look up in the environment file
/// @return address The address from the environment file
function _envAddressNotZero(string memory key_) internal view returns (address) {
function _envAddressNotZero(
string memory key_
) internal view returns (address) {
address addr = _envAddress(key_);
require(
addr != address(0), string.concat("WithEnvironment: key '", key_, "' has zero address")
Expand Down
5 changes: 4 additions & 1 deletion script/install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash

# Exit immediately on error
set -e

echo ""
echo "*** Removing submodules"
rm -rf lib/
Expand All @@ -19,7 +22,7 @@ echo "*** Restoring submodule commits"

echo ""
echo "baseline"
cd lib/baseline-v2/ && git checkout 8950018baec27d6497fba409cb361a596535447d && cd ../..
cd lib/baseline-v2/ && git checkout 8950018baec27d6497fba409cb361a596535447d && cd ../..

echo ""
echo "*** Applying patch to Baseline submodule"
Expand Down
4 changes: 3 additions & 1 deletion script/salts/WithSalts.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ contract WithSalts is Script {
return string.concat("./", _BYTECODE_DIR);
}

function _getBytecodePath(string memory name_) internal pure returns (string memory) {
function _getBytecodePath(
string memory name_
) internal pure returns (string memory) {
return string.concat(_getBytecodeDirectory(), "/", name_, ".bin");
}

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

function _getContractArgs(address auctionHouse_) internal pure returns (bytes memory) {
function _getContractArgs(
address auctionHouse_
) internal pure returns (bytes memory) {
return abi.encode(
auctionHouse_,
Callbacks.Permissions({
Expand All @@ -41,7 +43,9 @@ contract AllowlistSalts is Script, WithDeploySequence, WithSalts {
);
}

function _getAuctionHouse(bool atomic_) internal view returns (address) {
function _getAuctionHouse(
bool atomic_
) internal view returns (address) {
return atomic_
? _envAddressNotZero("deployments.AtomicAuctionHouse")
: _envAddressNotZero("deployments.BatchAuctionHouse");
Expand Down
18 changes: 9 additions & 9 deletions script/salts/salts.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,19 @@
"0xfafe60b7eb7a21b3b9a1b72d01dddba667a59544624fcd58b2b6e02fea347d7f": "0x78e03f1906753cf0f03e02e6af8940b82fe6dd0d45b6b2861c8f9af6bb968696"
},
"Test_BaselineAllocatedAllowlist": {
"0x71af7b8cb507e6f210338d9ecd860830fdae66b8bfcfcd4b09992f478c1db762": "0x75847aa632b809de1dc6e0b65ddcb67cc927630dc73589d0fdc425b8f8fd39a8"
"0x14c064a34f48cb07b634f2f2a22f44b85187670899ace155d6c76f19671bc0de": "0x38e6b7d07ebaa7a83b12baca0dfec874309d560b222af66b4b5bfb80e21a9dcd"
},
"Test_BaselineAllowlist": {
"0x96af9f52be0a74d16b32511e95a0ab41543135e7365337f5aa5c909f858d1bce": "0x33f9a171ed5fd424f995c2deac8fcff836f2575fb43df0d957456629e54020ab"
"0x12327ec4f7c7e2ade50980ecde80f9434866c0735855db8e344578d4b9f3bc10": "0x167426f42873e7b12f7b3a1d825e3fff59434c287010c0413486b89ae60c5746"
},
"Test_BaselineAxisLaunch": {
"0x31b0450a728dd3bed00d83e9c5e9b3b4d30a1b83e1527bd587519aab02500667": "0x42c9ff158bfe2f663311f9f75cff7335a86d597946fc892b01b4cd0f20e93dd4"
"0x59d2d6db2d34a526ebacede4500fb7c8c342a8d0c2882501e32080fca6f73b61": "0xf97aba82c1ac37fe4afd1be79837d9085993fe0fcc106f0c605c944ab1ee944d"
},
"Test_BaselineCappedAllowlist": {
"0x70c1941dfe3f605e8136f574eaa6c2c394fb304755c5d79fc7fd73d6dd5c0361": "0x975b4921658727ab3a8413f512d77e71b735e48f0e3c0c9e56d5a61001c97796"
"0x6fc7138eb2534fee64013e8ea53936af69ab8f99cd630527e4622c717971b116": "0x4782b9130b4ea961914662d9cdbb1ad141f2a92d075c1d98100305b4e3beba61"
},
"Test_BaselineTokenAllowlist": {
"0x21993fcd4b05b8ad948628ddcaf0e8066926a7f2f504009c6b562e5aa9026160": "0xb50386120448533c5d0eaf4d45809bcb3d2631c7109617a60283970a31b09584"
"0x983601112ae210e257e9d90660546499ee381661a9c1d0987b609f780849ff2b": "0x4d631375f5160105bfe68a840ee13036d0603f38e6292023ca656dade62413ed"
},
"Test_CappedMerkleAllowlist": {
"0x29dc229c79db0e97b991dc5816522298310d7167312ac507208acbfdf1dbf5b4": "0xb587e8409114393923bd3bc128bdbcfb7f09ccbd55f1213e94471ae03434c0a6",
Expand All @@ -92,17 +92,17 @@
"0xb24a3be6a8bdede031d12faa20163604d4e3ac83d74bd62343527c19d02d6bd7": "0x2cad71e04bcb4b291ee2c07deb5949371de1e15c0f0fe33b0d33ed63e8b10e44"
},
"Test_TokenAllowlist": {
"0x238371f92ead2927fde1bf05e297357a8f5eb2725e1dc509c577eee1772aa0e9": "0x7d39a797e209a7859f9563ae65448fd68edd78e6c864f36e771780cd9dde5229",
"0xa5d022492135bdf93503117957c22ccc97483fedf5e60761b30ddd4adced90ea": "0x9c316bbf1a8b1e5ef1b344f8c8b9f696f53fca1c18f88a7f2fc99aa58687241f"
"0xb22d05b8215fd932a637c877eca1c05634bb8ac4d0726f28c60d6bbe35112903": "0x7fc4719d70338e0a09224c432a07d9a2a1505e860dfe55c66be17ecc0b697e3a",
"0xb789c4afd1a886c5cfeb88fbd8b09ae8ec1b3869e50a0b8527289817f2e25218": "0xe33f41bdf6be9ac2a67f006ff3fa86cf5974fba590d3b14514751adf8d1f63ac"
},
"Test_UniswapV2DirectToLiquidity": {
"0x73e92c9fa7edbd64b00a40b781f6c757025945f0a761bc0b75764a6e401c91db": "0x1faa834688af2ee88010e925fac2876c9331a48dae57d50028260fcb42cca505"
"0x73e92c9fa7edbd64b00a40b781f6c757025945f0a761bc0b75764a6e401c91db": "0x82cef4b767766ea17c0232cad10798847f9c23fd04774b19b72ccd443321d6cb"
},
"Test_UniswapV2Router": {
"0x874532e739feebacbbe36f8c61fa97ab6ab1e6f7316e48763abf915e4af90c02": "0x5e9f7ca3ee281335c8a4fe4a4f33b950a5359d6a95fdc81892d9103ffd689659"
},
"Test_UniswapV3DirectToLiquidity": {
"0x40c266b9dec7915f86953624b76dde1d0dbd23b2d4331ae2ef505750cb949c43": "0xa998f887fd77653aaeea91ab3507da8eb3d236b8513ed69b7de5173f33b94c55"
"0x8b8a67c1a77b2a6e6498afcc953996805627b791b07b022b75e61e93977bea7b": "0xb3bb1bc05e789ba09ea8b4273381d883a2377423cb399c907700ddda448864dd"
},
"Test_UniswapV3Factory": {
"0x862fde1cd9de35dc112d759742b17a659781dfe0dddb8136e0b63fa9c2e00dab": "0x5fbe68e6c093ea70e56909c84fe99890a237a4af7f7599ace8471a48c78a8aae"
Expand Down
4 changes: 3 additions & 1 deletion script/salts/test/TestSalts.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ contract TestSalts is Script, WithEnvironment, Permit2User, WithSalts, TestConst
string internal constant _ALLOCATED_MERKLE_ALLOWLIST = "AllocatedMerkleAllowlist";
string internal constant _TOKEN_ALLOWLIST = "TokenAllowlist";

function _setUp(string calldata chain_) internal {
function _setUp(
string calldata chain_
) internal {
_loadEnv(chain_);
_createBytecodeDirectory();
}
Expand Down
64 changes: 35 additions & 29 deletions soldeer.lock
Original file line number Diff line number Diff line change
@@ -1,72 +1,78 @@

[[dependencies]]
name = "forge-std"
version = "1.9.1"
source = "https://soldeer-revisions.s3.amazonaws.com/forge-std/v1_9_1_03-07-2024_14:44:59_forge-std-v1.9.1.zip"
checksum = "110b35ad3604d91a919c521c71206c18cd07b29c750bd90b5cbbaf37288c9636"

[[dependencies]]
name = "axis-core"
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 = "@openzeppelin-contracts"
version = "4.9.2"
source = "https://soldeer-revisions.s3.amazonaws.com/@openzeppelin-contracts/4_9_2_22-01-2024_13:13:52_contracts.zip"
checksum = "0f4450671798ea5659e6391876a3cf443ca50a696d9b556ac622ec7660bce306"
integrity = "f69bd90f264280204b2a1172a02a2d20f3611f5993a61e5215647bec696a8420"

[[dependencies]]
name = "@openzeppelin-contracts-upgradeable"
version = "4.9.2"
source = "https://soldeer-revisions.s3.amazonaws.com/@openzeppelin-contracts-upgradeable/4_9_2_22-01-2024_13:15:04_contracts-upgradeable.zip"
checksum = "33a161bf7799dcac1475d2470615b56a8f9a9387cb8eef921b49816dbbc61c2b"
integrity = "93ffee03edd3f6b0cad1830d6cb1937c5c870fab9eccaaeabbf1b752c6d4e8f1"

[[dependencies]]
name = "@uniswap-v2-core"
version = "1.0.1"
source = "https://soldeer-revisions.s3.amazonaws.com/@uniswap-v2-core/1_0_1_22-01-2024_13:18:30_v2-core.zip"
checksum = "efebb89237048771c19f52d3ce87ec4d0c591279bf1977c49f9e70e5fff530f0"

[[dependencies]]
name = "@uniswap-v3-core"
version = "1.0.1-solc-0.8-simulate"
source = "https://soldeer-revisions.s3.amazonaws.com/@uniswap-v3-core/1_0_1-solc-0_8-simulate_22-01-2024_13:19:52_v3-core.zip"
checksum = "566fc479fe846f41b211a0ddd66f875cd37e2ccb86b3fc4f7fa18bd55266ec7d"

[[dependencies]]
name = "g-uni-v1-core"
version = "0.9.9"
source = "[email protected]:Axis-Fi/g-uni-v1-core.git"
checksum = "d6bcb6e811e86d36bc836c002eb2e9a2c73d29ca"
integrity = "fda4e18a2a0c21eeddd8b6af36439f394e4ff74eb75705409a87b8952c9e2972"

[[dependencies]]
name = "@uniswap-v2-periphery"
version = "1.0.1"
source = "[email protected]:Axis-Fi/uniswap-v2-periphery.git"
checksum = "19be650786731dfe43cac3aac7a2d1f0731d18e2"

[[dependencies]]
name = "@uniswap-v3-core"
version = "1.0.1-solc-0.8-simulate"
source = "https://soldeer-revisions.s3.amazonaws.com/@uniswap-v3-core/1_0_1-solc-0_8-simulate_22-01-2024_13:19:52_v3-core.zip"
checksum = "566fc479fe846f41b211a0ddd66f875cd37e2ccb86b3fc4f7fa18bd55266ec7d"
integrity = "75f26f8cb2cd8179eace9cdc4b248fa75faae799fc19c3e5a1f8f1b9d58d3188"

[[dependencies]]
name = "@uniswap-v3-periphery"
version = "1.4.2-solc-0.8"
source = "[email protected]:Uniswap/v3-periphery.git"
checksum = "b325bb0905d922ae61fcc7df85ee802e8df5e96c"

[[dependencies]]
name = "solmate"
version = "6.7.0"
source = "[email protected]:transmissions11/solmate.git"
checksum = "c892309933b25c03d32b1b0d674df7ae292ba925"
name = "axis-core"
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"
integrity = "381ce84e3d947c891a53aa651a59328bdcba27534116bf5c55f57833a5603962"

[[dependencies]]
name = "clones-with-immutable-args"
version = "1.1.1"
source = "[email protected]:wighawag/clones-with-immutable-args.git"
checksum = "f5ca191afea933d50a36d101009b5644dc28bc99"

[[dependencies]]
name = "forge-std"
version = "1.9.1"
source = "https://soldeer-revisions.s3.amazonaws.com/forge-std/v1_9_1_03-07-2024_14:44:59_forge-std-v1.9.1.zip"
checksum = "110b35ad3604d91a919c521c71206c18cd07b29c750bd90b5cbbaf37288c9636"
integrity = "229fada41d3af5734ba5e8b2715734b99c7d70335f3dd5a103d2a2e1cae831ba"

[[dependencies]]
name = "g-uni-v1-core"
version = "0.9.9"
source = "[email protected]:Axis-Fi/g-uni-v1-core.git"
checksum = "d6bcb6e811e86d36bc836c002eb2e9a2c73d29ca"

[[dependencies]]
name = "solady"
version = "0.0.124"
source = "https://soldeer-revisions.s3.amazonaws.com/solady/0_0_124_22-01-2024_13:28:04_solady.zip"
checksum = "9342385eaad08f9bb5408be0b41b241dd2b974c001f7da8c3b1ac552b52ce16b"
integrity = "29d93e52694d8e858cf5a737257f4a6f21aefccaf803174fd00b9d686172ab27"

[[dependencies]]
name = "solmate"
version = "6.7.0"
source = "[email protected]:transmissions11/solmate.git"
checksum = "c892309933b25c03d32b1b0d674df7ae292ba925"
4 changes: 3 additions & 1 deletion src/callbacks/allowlists/TokenAllowlist.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import {Callbacks} from "@axis-core-1.0.1/lib/Callbacks.sol";
/// @notice Generic interface for tokens that implement a balanceOf function (includes ERC-20 and ERC-721)
interface ITokenBalance {
/// @notice Get the user's token balance
function balanceOf(address user_) external view returns (uint256);
function balanceOf(
address user_
) external view returns (uint256);
}

/// @title TokenAllowlist Callback Contract
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@ contract BALwithAllocatedAllowlist is BaselineAxisLaunch {
/// - The auction has been completed
///
/// @param merkleRoot_ The new merkle root
function setMerkleRoot(bytes32 merkleRoot_) external onlyOwner {
function setMerkleRoot(
bytes32 merkleRoot_
) external onlyOwner {
// Revert if onCreate has not been called
if (lotId == type(uint96).max) {
revert Callback_InvalidState();
Expand Down
4 changes: 3 additions & 1 deletion src/callbacks/liquidity/BaselineV2/BALwithAllowlist.sol
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ contract BALwithAllowlist is BaselineAxisLaunch {
/// - The auction has been completed
///
/// @param merkleRoot_ The new merkle root
function setMerkleRoot(bytes32 merkleRoot_) external onlyOwner {
function setMerkleRoot(
bytes32 merkleRoot_
) external onlyOwner {
// Revert if onCreate has not been called
if (lotId == type(uint96).max) {
revert Callback_InvalidState();
Expand Down
8 changes: 6 additions & 2 deletions src/callbacks/liquidity/BaselineV2/BALwithTokenAllowlist.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import {BaselineAxisLaunch} from "./BaselineAxisLaunch.sol";
/// @notice Generic interface for tokens that implement a balanceOf function (includes ERC-20 and ERC-721)
interface ITokenBalance {
/// @notice Get the user's token balance
function balanceOf(address user_) external view returns (uint256);
function balanceOf(
address user_
) external view returns (uint256);
}

/// @notice TokenAllowlist version of the Baseline Axis Launch callback.
Expand Down Expand Up @@ -120,7 +122,9 @@ contract BALwithTokenAllowlist is BaselineAxisLaunch {

// ========== INTERNAL FUNCTIONS ========== //

function _canParticipate(address buyer_) internal view {
function _canParticipate(
address buyer_
) internal view {
// Check if the buyer's balance is above the threshold
if (tokenCheck.token.balanceOf(buyer_) < tokenCheck.threshold) {
revert Callback_NotAuthorized();
Expand Down
Loading
Loading