Skip to content

Commit

Permalink
Pass token to deploy scripts as address
Browse files Browse the repository at this point in the history
  • Loading branch information
MattPereira committed Aug 18, 2024
1 parent d2f3fdf commit fb5c846
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
18 changes: 9 additions & 9 deletions packages/foundry/script/01_DeployConstantSum.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { ConstantSumFactory } from "../contracts/pools/ConstantSumFactory.sol";
* @notice Deploys, registers, and initializes a Constant Sum Pool
*/
contract DeployConstantSum is PoolHelpers, ScaffoldHelpers {
function run(IERC20 token1, IERC20 token2) external {
function run(address token1, address token2) external {
// Set the deployment configurations
uint32 pauseWindowDuration = 365 days;
PoolRegistrationConfig memory regConfig = getPoolRegistrationConfig(token1, token2);
Expand Down Expand Up @@ -74,8 +74,8 @@ contract DeployConstantSum is PoolHelpers, ScaffoldHelpers {
* All WITH_RATE tokens need a rate provider, and may or may not be yield-bearing.
*/
function getPoolRegistrationConfig(
IERC20 token1,
IERC20 token2
address token1,
address token2
) internal view returns (PoolRegistrationConfig memory config) {
string memory name = "Constant Sum Pool"; // name for the pool
string memory symbol = "CSP"; // symbol for the BPT
Expand All @@ -86,13 +86,13 @@ contract DeployConstantSum is PoolHelpers, ScaffoldHelpers {

TokenConfig[] memory tokenConfig = new TokenConfig[](2); // An array of descriptors for the tokens the pool will manage.
tokenConfig[0] = TokenConfig({ // Make sure to have proper token order (alphanumeric)
token: token1,
token: IERC20(token1),
tokenType: TokenType.STANDARD, // STANDARD or WITH_RATE
rateProvider: IRateProvider(address(0)), // The rate provider for a token (see further documentation above)
paysYieldFees: false // Flag indicating whether yield fees should be charged on this token
});
tokenConfig[1] = TokenConfig({ // Make sure to have proper token order (alphanumeric)
token: token2,
token: IERC20(token2),
tokenType: TokenType.STANDARD, // STANDARD or WITH_RATE
rateProvider: IRateProvider(address(0)), // The rate provider for a token (see further documentation above)
paysYieldFees: false // Flag indicating whether yield fees should be charged on this token
Expand Down Expand Up @@ -128,12 +128,12 @@ contract DeployConstantSum is PoolHelpers, ScaffoldHelpers {
* @notice this is where the amounts of tokens to be initially added to the pool are set
*/
function getPoolInitializationConfig(
IERC20 token1,
IERC20 token2
address token1,
address token2
) internal pure returns (PoolInitializationConfig memory config) {
IERC20[] memory tokens = new IERC20[](2); // Array of tokens to be used in the pool
tokens[0] = token1;
tokens[1] = token2;
tokens[0] = IERC20(token1);
tokens[1] = IERC20(token2);
uint256[] memory exactAmountsIn = new uint256[](2); // Exact amounts of tokens to be added, sorted in token alphanumeric order
exactAmountsIn[0] = 50e18; // amount of token1 to send during pool initialization
exactAmountsIn[1] = 50e18; // amount of token2 to send during pool initialization
Expand Down
20 changes: 10 additions & 10 deletions packages/foundry/script/02_DeployConstantProduct.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { ConstantProductFactory } from "../contracts/pools/ConstantProductFactor
* @notice Deploys a factory and hooks contract and then deploys, registers, and initializes a constant product pool
*/
contract DeployConstantProduct is PoolHelpers, ScaffoldHelpers {
function run(IERC20 token1, IERC20 token2, IERC20 veBAL) external {
function run(address token1, address token2, address veBAL) external {
// Set the deployment configurations
uint32 pauseWindowDuration = 365 days;
PoolRegistrationConfig memory regConfig = getPoolRegistrationConfig(token1, token2);
Expand All @@ -41,7 +41,7 @@ contract DeployConstantProduct is PoolHelpers, ScaffoldHelpers {
IVault(vault),
address(factory),
address(router),
IERC20(veBAL)
veBAL
);
console.log("VeBALFeeDiscountHook deployed at address: %s", address(poolHooksContract));

Expand Down Expand Up @@ -85,8 +85,8 @@ contract DeployConstantProduct is PoolHelpers, ScaffoldHelpers {
* All WITH_RATE tokens need a rate provider, and may or may not be yield-bearing.
*/
function getPoolRegistrationConfig(
IERC20 token1,
IERC20 token2
address token1,
address token2
) internal view returns (PoolRegistrationConfig memory config) {
string memory name = "Constant Product Pool"; // name for the pool
string memory symbol = "CPP"; // symbol for the BPT
Expand All @@ -97,13 +97,13 @@ contract DeployConstantProduct is PoolHelpers, ScaffoldHelpers {

TokenConfig[] memory tokenConfig = new TokenConfig[](2); // An array of descriptors for the tokens the pool will manage
tokenConfig[0] = TokenConfig({ // Make sure to have proper token order (alphanumeric)
token: token1,
token: IERC20(token1),
tokenType: TokenType.STANDARD, // STANDARD or WITH_RATE
rateProvider: IRateProvider(address(0)), // The rate provider for a token (see further documentation above)
paysYieldFees: false // Flag indicating whether yield fees should be charged on this token
});
tokenConfig[1] = TokenConfig({ // Make sure to have proper token order (alphanumeric)
token: token2,
token: IERC20(token2),
tokenType: TokenType.STANDARD, // STANDARD or WITH_RATE
rateProvider: IRateProvider(address(0)), // The rate provider for a token (see further documentation above)
paysYieldFees: false // Flag indicating whether yield fees should be charged on this token
Expand Down Expand Up @@ -139,12 +139,12 @@ contract DeployConstantProduct is PoolHelpers, ScaffoldHelpers {
* @notice This is where the amounts of tokens to seed the pool with initial liquidity are set
*/
function getPoolInitializationConfig(
IERC20 token1,
IERC20 token2
address token1,
address token2
) internal pure returns (PoolInitializationConfig memory config) {
IERC20[] memory tokens = new IERC20[](2); // Array of tokens to be used in the pool
tokens[0] = token1;
tokens[1] = token2;
tokens[0] = IERC20(token1);
tokens[1] = IERC20(token2);
uint256[] memory exactAmountsIn = new uint256[](2); // Exact amounts of tokens to be added, sorted in token alphanumeric order
exactAmountsIn[0] = 50e18; // amount of token1 to send during pool initialization
exactAmountsIn[1] = 50e18; // amount of token2 to send during pool initialization
Expand Down
4 changes: 2 additions & 2 deletions packages/foundry/script/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ contract DeployScript is ScaffoldHelpers {

// Deploy a constant sum factory and a pool
DeployConstantSum deployConstantSum = new DeployConstantSum();
deployConstantSum.run(mockToken1, mockToken2);
deployConstantSum.run(address(mockToken1), address(mockToken2));

// Deploy a constant product factory, a hooks contract, and a pool
DeployConstantProduct deployConstantProduct = new DeployConstantProduct();
deployConstantProduct.run(mockToken1, mockToken2, mockVeBAL);
deployConstantProduct.run(address(mockToken1), address(mockToken2), address(mockVeBAL));
}

modifier export() {
Expand Down

0 comments on commit fb5c846

Please sign in to comment.