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

Deploy factory multi chain #2

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions catERC20
Submodule catERC20 added at 621823
12 changes: 0 additions & 12 deletions script/Counter.s.sol

This file was deleted.

51 changes: 51 additions & 0 deletions script/DeployFactory.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

import { Script, console } from 'forge-std/Script.sol';
import { BaseMultiChainDeployer } from 'GeneralisedIncentives/script/BaseMultiChainDeployer.s.sol';
import { CatERC20Factory } from '../src/catERC20Factory.sol';

contract DeployFactory is BaseMultiChainDeployer {

CatERC20Factory public catERC20Factory;
bytes32 constant salt = 0x1234567890abcdef1234567890abcdef1239967890abcdef1234567890abcdef;

function _deployFactory() internal {
catERC20Factory = new CatERC20Factory{salt: salt}();
console.log("CatERC20Factory deployed at:", address(catERC20Factory));
}

function _deployXERC20() internal {
catERC20Factory = new CatERC20Factory{salt: salt}();
console.log("CatERC20Factory deployed at:", address(catERC20Factory));

uint256[] memory minterLimits = new uint256[](0);
uint256[] memory burnerLimits = new uint256[](0);
address[] memory bridges = new address[](0);

address deployedToken = catERC20Factory.deployXERC20("Test", "TS", minterLimits, burnerLimits, bridges);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The deploy function does more than just deploy the factory now.

A deployment script should be explcit in what it does. forge script DeployFactory --sig "deployToAllChains()" should be expected to deploy the factory not also an xERC20 token.

console.log("ERC20 Token deployed at:", deployedToken);
}

// Function to deploy to all chains, with salt fixed
function deployFactoryToAllChains() iter_chains(chain_list) broadcast external {
_deployFactory();
}

// Function to deploy to specific chains, with salt fixed
function deployFactoryToAllChains(string[] memory chains) iter_chains_string(chains) broadcast public {
_deployFactory();
}

// Function to deploy to all chains, with salt fixed
function deployXERC20ToAllChains() iter_chains(chain_list) broadcast external {
_deployXERC20();
}

// Function to deploy to specific chains, with salt fixed
function deployXERC20ToAllChains(string[] memory chains) iter_chains_string(chains) broadcast public {
_deployXERC20();
}


}
2 changes: 1 addition & 1 deletion src/catERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -282,4 +282,4 @@ contract CatERC20 is ERC20, Ownable, IXERC20 {
return uint256(int256(newCurrentLimit) + deltaLimit);
}
}
}
}