pcaversaccio / createx

Factory smart contract to make easier and safer usage of the `CREATE` and `CREATE2` EVM opcodes as well as of `CREATE3`-based (i.e. without an initcode factor) contract creations.
https://createx.rocks
GNU Affero General Public License v3.0
303 stars 18 forks source link

💥 Build a Simple SDK for Use Without Knowledge of the Interface, ABI, or Typechain Definitions #101

Closed tornadocontrib closed 6 months ago

tornadocontrib commented 6 months ago

Describe the desired feature:

Would be great if we could have some simple function exposed that could be used to deploy contracts with ethers.js provider ( or viem provider but I don't use viem ).

Something like

async function deployCreateX(signer: SignerWithAddress, salt: BytesLike, initCode: bytesLike): Promise<ContractResponse> {
   return await CreateX.deployCreate2(salt, initCode);
}

But with this function we don't need to import createx's ABI or type definitions for every projects.

Code example that solves the feature:

No response

pcaversaccio commented 6 months ago

@tornadocontrib I built exactly such an "SDK" via my Hardhat plugin xdeployer. No need to import anything, just npm install it and hit npx hardhat xdeploy :). Via the 3.0.0 release, CreateX got added.

A couple of caveats however:

The underlying reason behind these design decisions was to make it agnostic to any kind of CREATE2 factory that might need different handling of salt values and/or have different functions.

I'm closing this issue as I deem it as resolved. Please comment or reopen if you disagree.

tornadocontrib commented 6 months ago

@pcaversaccio Yes I saw it but since only works in Hardhat ( and since they are moving to a new deployment system called ignition ) would be great if you could create a type export with the function that could work with ethers.js

pcaversaccio commented 6 months ago

@pcaversaccio Yes I saw it but since only works in Hardhat ( and since they are moving to a new deployment system called ignition ) would be great if you could create a type export with the function that could work with ethers.js

Different people have different tastes and thus we let the community build external tooling and list it here. If you build a tooling that integrates CreateX, I will happily list it there as well. Furthermore, you can find and download the ABI in the various formats here. If you want to generate the typechain-types for CreateX, you can simply clone the CreateX repository and compile it with Hardhat: npx hardhat compile. I attached them to this comment as well: typechain-types.zip.

pcaversaccio commented 6 months ago

Let me mention that CreateX is the built-in factory for Hardhat Ignition (see here).