Skip to content

Commit

Permalink
Add to script specifying the Uniswap V3 pool fee
Browse files Browse the repository at this point in the history
  • Loading branch information
0xJem committed Jun 14, 2024
1 parent baf04c2 commit 25e61af
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
12 changes: 10 additions & 2 deletions script/ops/test/FixedPriceBatch-BaseDTL/TestData.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ contract TestData is Script, WithEnvironment {
string calldata chain_,
address quoteToken_,
address baseToken_,
address callback_
address callback_,
uint24 uniswapV3PoolFee_
) public returns (uint96) {
// Load addresses from .env
_loadEnv(chain_);
Expand All @@ -51,13 +52,20 @@ contract TestData is Script, WithEnvironment {
routingParams.callbacks = ICallback(callback_);
if (callback_ != address(0)) {
console2.log("Callback enabled");

bytes memory callbackImplParams = abi.encode("");
if (uniswapV3PoolFee_ > 0) {
console2.log("Setting Uniswap V3 pool fee to", uniswapV3PoolFee_);
callbackImplParams = abi.encode(uniswapV3PoolFee_);
}

routingParams.callbackData = abi.encode(
BaseDirectToLiquidity.OnCreateParams({
proceedsUtilisationPercent: 50_000, // 50%
vestingStart: 0,
vestingExpiry: 0,
recipient: msg.sender,
implParams: abi.encode("")
implParams: callbackImplParams
})
);

Expand Down
11 changes: 9 additions & 2 deletions script/ops/test/FixedPriceBatch-BaseDTL/createAuction.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# Usage:
# ./createAuction.sh --quoteToken <address> --baseToken <address> --callback <address> --envFile <.env> --broadcast <false>
# ./createAuction.sh --quoteToken <address> --baseToken <address> --callback <address> --poolFee <uint24> --envFile <.env> --broadcast <false>
#
# Expects the following environment variables:
# CHAIN: The chain to deploy to, based on values from the ./script/env.json file.
Expand Down Expand Up @@ -57,11 +57,18 @@ then
exit 1
fi

# If the pool fee is not set, set it to 0
if [ -z "$poolFee" ]
then
poolFee=0
fi

echo "Using chain: $CHAIN"
echo "Using RPC at URL: $RPC_URL"
echo "Using quote token: $quoteToken"
echo "Using base token: $baseToken"
echo "Using callback: $callback"
echo "Using pool fee (Uniswap V3 only): $poolFee"
echo "Deployer: $DEPLOYER_ADDRESS"

# Set BROADCAST_FLAG based on BROADCAST
Expand All @@ -74,6 +81,6 @@ else
fi

# Create auction
forge script ./script/ops/test/FixedPriceBatch-BaseDTL/TestData.s.sol:TestData --sig "createAuction(string,address,address,address)()" $CHAIN $quoteToken $baseToken $callback \
forge script ./script/ops/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

0 comments on commit 25e61af

Please sign in to comment.