Intro
Many Zeros gives you a secure and trust minimized way to deploy your EVM smart contracts to the same vanity address across chains.
Quickstart - Foundry
- Install the SDK by running
forge install philogy/manyzeros-foundryin your project - Import in your deploy script/test
import {MANY_ZEROS} from "manyzeros-foundry/IManyZeros.sol";
note
To use Many Zeros in an environment such as tests where it's not
deployed you can import and call the deployIntoEnvironmentUsingCheatcodes function:
import {Test} from "forge-std/Test.sol";
import {MANY_ZEROS, deployIntoEnvironmentUsingCheatcodes} from "manyzeros-foundry/IManyZeros.sol";
contract MyTest is Test {
function setUp() public {
deployIntoEnvironmentUsingCheatcodes();
}
}
- Buy an address at manyzeros.xyz or generate your own.
- Add the deployment code:
// Fetches the initcode in a type safe way.
vm.interceptInitcode();
bytes memory initcode;
try new MyContract(param1, param2) { assert(false); }
catch (bytes memory interceptedInitcode) {
initcode = interceptedInitcode;
}
// Performs the actual deployment via many zeros.
MyContract myContract = MyContract(MANY_ZEROS.deploy(id, initcode));