diff --git a/contracts/scripts/native_solc_zksolc_compile_ccip b/contracts/scripts/native_solc_zksolc_compile_ccip new file mode 100755 index 0000000000..c85f238b06 --- /dev/null +++ b/contracts/scripts/native_solc_zksolc_compile_ccip @@ -0,0 +1,235 @@ +#!/usr/bin/env bash + +set -e + +echo " ┌──────────────────────────────────────────────┐" +echo " │ Compiling CCIP contracts... │" +echo " └──────────────────────────────────────────────┘" + +SOLC_VERSION="0.8.24" +OPTIMIZE_RUNS=26000 +OPTIMIZE_RUNS_OFFRAMP=18000 +OPTIMIZE_RUNS_ONRAMP=4100 +OPTIMIZE_RUNS_MULTI_OFFRAMP=800 + + +SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" +python3 -m pip install --require-hashes -r "$SCRIPTPATH"/requirements.txt +solc-select install $SOLC_VERSION +solc-select use $SOLC_VERSION +export SOLC_VERSION=$SOLC_VERSION + +ROOT="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; cd ../../ && pwd -P )" + +compileContract () { + local contract + contract=$(basename "$1" ".sol") + + local optimize_runs=$OPTIMIZE_RUNS + + case $1 in + "ccip/offRamp/EVM2EVMOffRamp.sol") + echo "OffRamp uses $OPTIMIZE_RUNS_OFFRAMP optimizer runs." + optimize_runs=$OPTIMIZE_RUNS_OFFRAMP + ;; + "ccip/offRamp/OffRamp.sol") + echo "MultiOffRamp uses $OPTIMIZE_RUNS_MULTI_OFFRAMP optimizer runs." + optimize_runs=$OPTIMIZE_RUNS_MULTI_OFFRAMP + ;; + "ccip/onRamp/EVM2EVMOnRamp.sol") + echo "OnRamp uses $OPTIMIZE_RUNS_ONRAMP optimizer runs." + optimize_runs=$OPTIMIZE_RUNS_ONRAMP + ;; + "ccip/test/helpers/CCIPReaderTester.sol") + echo "CCIPReaderTester uses 1 optimizer runs for reduced contract size." + optimize_runs=1 + ;; + esac + + solc --overwrite --optimize --optimize-runs $optimize_runs --metadata-hash none \ + -o "$ROOT"/contracts/solc/v$SOLC_VERSION/"$contract" \ + --abi --bin --allow-paths "$ROOT"/contracts/src/v0.8 \ + --bin-runtime --hashes --metadata --metadata-literal --combined-json abi,hashes,metadata,srcmap,srcmap-runtime \ + --evm-version paris \ + "$ROOT"/contracts/src/v0.8/"$1" +} + +compileContractZK () { + local contract + contract=$(basename "$1" ".sol") + + local optimize_runs=$OPTIMIZE_RUNS + + case $1 in + "ccip/offRamp/EVM2EVMOffRamp.sol") + echo "OffRamp uses $OPTIMIZE_RUNS_OFFRAMP optimizer runs." + optimize_runs=$OPTIMIZE_RUNS_OFFRAMP + ;; + "ccip/offRamp/OffRamp.sol") + echo "MultiOffRamp uses $OPTIMIZE_RUNS_MULTI_OFFRAMP optimizer runs." + optimize_runs=$OPTIMIZE_RUNS_MULTI_OFFRAMP + ;; + "ccip/onRamp/EVM2EVMOnRamp.sol") + echo "OnRamp uses $OPTIMIZE_RUNS_ONRAMP optimizer runs." + optimize_runs=$OPTIMIZE_RUNS_ONRAMP + ;; + "ccip/test/helpers/CCIPReaderTester.sol") + echo "CCIPReaderTester uses 1 optimizer runs for reduced contract size." + optimize_runs=1 + ;; + esac + + zksolc --overwrite -O3 \ + -o "$ROOT"/contracts/zksolc/v$SOLC_VERSION/"$contract" \ + --bin --allow-paths "$ROOT"/contracts/src/v0.8 \ + --metadata --metadata-literal \ + "$ROOT"/contracts/src/v0.8/"$1" +} + + + + +# Solc produces and overwrites intermediary contracts. +# Contracts should be ordered in reverse-import-complexity-order to minimize overwrite risks. +compileContract ccip/offRamp/EVM2EVMOffRamp.sol +compileContract ccip/offRamp/OffRamp.sol +compileContract ccip/rmn/RMNRemote.sol +compileContract ccip/applications/PingPongDemo.sol +compileContract ccip/applications/SelfFundedPingPong.sol +compileContract ccip/applications/EtherSenderReceiver.sol +compileContract ccip/onRamp/OnRamp.sol +compileContract ccip/onRamp/EVM2EVMOnRamp.sol +compileContract ccip/CommitStore.sol +compileContract ccip/MultiAggregateRateLimiter.sol +compileContract ccip/Router.sol +compileContract ccip/FeeQuoter.sol +compileContract ccip/RMN.sol +compileContract ccip/ARMProxy.sol +compileContract ccip/tokenAdminRegistry/TokenAdminRegistry.sol +compileContract ccip/tokenAdminRegistry/RegistryModuleOwnerCustom.sol +compileContract ccip/capability/CCIPHome.sol +compileContract ccip/NonceManager.sol +compileContract shared/token/ERC677/BurnMintERC677.sol +compileContract ccip/PriceRegistry.sol + + +# Pools +compileContract ccip/pools/LockReleaseTokenPool.sol +compileContract ccip/pools/BurnMintTokenPool.sol +compileContract ccip/pools/BurnFromMintTokenPool.sol +compileContract ccip/pools/BurnWithFromMintTokenPool.sol +compileContract ccip/pools/LockReleaseTokenPoolAndProxy.sol +compileContract ccip/pools/BurnMintTokenPoolAndProxy.sol +compileContract ccip/pools/BurnWithFromMintTokenPoolAndProxy.sol +compileContract ccip/pools/BurnWithFromMintRebasingTokenPool.sol +compileContract ccip/pools/TokenPool.sol + + +# Test helpers +compileContract ccip/test/helpers/BurnMintERC677Helper.sol +compileContract ccip/test/helpers/CommitStoreHelper.sol +compileContract ccip/test/helpers/MessageHasher.sol +compileContract ccip/test/helpers/CCIPReaderTester.sol +compileContract ccip/test/helpers/ReportCodec.sol +compileContract ccip/test/helpers/receivers/MaybeRevertMessageReceiver.sol +compileContract ccip/test/helpers/MultiOCR3Helper.sol +compileContract ccip/test/mocks/MockE2EUSDCTokenMessenger.sol +compileContract ccip/test/mocks/MockE2EUSDCTransmitter.sol +compileContract ccip/test/WETH9.sol + + +# Encoding Utils +compileContract ccip/interfaces/encodingutils/ICCIPEncodingUtils.sol + +# Customer contracts +compileContract ccip/pools/USDC/USDCTokenPool.sol + +compileContract tests/MockV3Aggregator.sol + + + + +compileContractZK ccip/offRamp/EVM2EVMOffRamp.sol +compileContractZK ccip/offRamp/OffRamp.sol +compileContractZK ccip/rmn/RMNRemote.sol +compileContractZK ccip/applications/PingPongDemo.sol +compileContractZK ccip/applications/SelfFundedPingPong.sol +compileContractZK ccip/applications/EtherSenderReceiver.sol +compileContractZK ccip/onRamp/OnRamp.sol +compileContractZK ccip/onRamp/EVM2EVMOnRamp.sol +compileContractZK ccip/CommitStore.sol +compileContractZK ccip/MultiAggregateRateLimiter.sol +compileContractZK ccip/Router.sol +compileContractZK ccip/FeeQuoter.sol +compileContractZK ccip/RMN.sol +compileContractZK ccip/ARMProxy.sol +compileContractZK ccip/tokenAdminRegistry/TokenAdminRegistry.sol +compileContractZK ccip/tokenAdminRegistry/RegistryModuleOwnerCustom.sol +compileContractZK ccip/capability/CCIPHome.sol +compileContractZK ccip/NonceManager.sol +compileContractZK shared/token/ERC677/BurnMintERC677.sol +compileContractZK ccip/PriceRegistry.sol + + +# Pools +compileContractZK ccip/pools/LockReleaseTokenPool.sol +compileContractZK ccip/pools/BurnMintTokenPool.sol +compileContractZK ccip/pools/BurnFromMintTokenPool.sol +compileContractZK ccip/pools/BurnWithFromMintTokenPool.sol +compileContractZK ccip/pools/LockReleaseTokenPoolAndProxy.sol +compileContractZK ccip/pools/BurnMintTokenPoolAndProxy.sol +compileContractZK ccip/pools/BurnWithFromMintTokenPoolAndProxy.sol +compileContractZK ccip/pools/BurnWithFromMintRebasingTokenPool.sol +compileContractZK ccip/pools/TokenPool.sol + + +# Test helpers +compileContractZK ccip/test/helpers/BurnMintERC677Helper.sol +compileContractZK ccip/test/helpers/CommitStoreHelper.sol +compileContractZK ccip/test/helpers/MessageHasher.sol +compileContractZK ccip/test/helpers/CCIPReaderTester.sol +compileContractZK ccip/test/helpers/ReportCodec.sol +compileContractZK ccip/test/helpers/receivers/MaybeRevertMessageReceiver.sol +compileContractZK ccip/test/helpers/MultiOCR3Helper.sol +compileContractZK ccip/test/mocks/MockE2EUSDCTokenMessenger.sol +compileContractZK ccip/test/mocks/MockE2EUSDCTransmitter.sol +# this breaks with paybale error +compileContractZK ccip/test/WETH9.sol + + +# Encoding Utils +compileContractZK ccip/interfaces/encodingutils/ICCIPEncodingUtils.sol + +# Customer contracts +compileContractZK ccip/pools/USDC/USDCTokenPool.sol + +compileContractZK tests/MockV3Aggregator.sol + + +SOLC_VERSION="0.8.19" +solc-select install $SOLC_VERSION +solc-select use $SOLC_VERSION +export SOLC_VERSION=$SOLC_VERSION + +compileContractShared () { + local contract + contract=$(basename "$1" ".sol") + + solc --overwrite --optimize --optimize-runs $OPTIMIZE_RUNS --metadata-hash none \ + -o "$ROOT"/contracts/solc/v$SOLC_VERSION/"$contract" \ + --abi --bin --allow-paths "$ROOT"/contracts/src/v0.8\ + "$ROOT"/contracts/src/v0.8/"$1" +} + +compileContractSharedZK () { + local contract + contract=$(basename "$1" ".sol") + + zksolc --overwrite -O3 \ + -o "$ROOT"/contracts/zksolc/v$SOLC_VERSION/"$contract" \ + --bin --allow-paths "$ROOT"/contracts/src/v0.8 \ + "$ROOT"/contracts/src/v0.8/"$1" +} + +compileContractShared shared/token/ERC677/LinkToken.sol +compileContractSharedZK shared/token/ERC677/LinkToken.sol \ No newline at end of file diff --git a/contracts/src/v0.8/ccip/test/WETH9.sol b/contracts/src/v0.8/ccip/test/WETH9.sol index fbc19ee2c4..db6cd096d5 100644 --- a/contracts/src/v0.8/ccip/test/WETH9.sol +++ b/contracts/src/v0.8/ccip/test/WETH9.sol @@ -46,7 +46,7 @@ contract WETH9 { function withdraw(uint256 wad) external { require(balanceOf[msg.sender] >= wad); balanceOf[msg.sender] -= wad; - payable(msg.sender).transfer(wad); + payable(msg.sender).call{value: wad}(""); emit Withdrawal(msg.sender, wad); } diff --git a/core/gethwrappers/abigen.go b/core/gethwrappers/abigen.go index af085f30d9..b237a4028b 100644 --- a/core/gethwrappers/abigen.go +++ b/core/gethwrappers/abigen.go @@ -28,9 +28,88 @@ const headerComment = `// Code generated - DO NOT EDIT. // AbigenArgs is the arguments to the abigen executable. E.g., Bin is the -bin // arg. type AbigenArgs struct { - Bin, ABI, Out, Type, Pkg string + Bin, ABI, Out, Type, Pkg, ZkBinPath string } +var zkDeployCode = (` +type CustomTransaction struct { + *types.Transaction + CustomHash common.Hash +} + +func (tx *CustomTransaction) Hash() common.Hash { + return tx.CustomHash +} + +func ConvertToTransaction(resp zktypes.TransactionResponse) *CustomTransaction { + dtx := &types.DynamicFeeTx{ + ChainID: resp.ChainID.ToInt(), + Nonce: uint64(resp.Nonce), + GasTipCap: resp.MaxPriorityFeePerGas.ToInt(), + GasFeeCap: resp.MaxFeePerGas.ToInt(), + To: &resp.To, + Value: resp.Value.ToInt(), + Data: resp.Data, + Gas: uint64(resp.Gas), + } + + // Create the transaction + tx := types.NewTx(dtx) + customTransaction := CustomTransaction{Transaction: tx, CustomHash: resp.Hash} + return &customTransaction +} +// this should generated.CustomTransaction +func DeployZkSync%s(auth *bind.TransactOpts, backend bind.ContractBackend, params ...interface{}) (common.Address, *CustomTransaction, *%s, error) { + client, ok := backend.(*ethclient.Client) + if !ok { + return common.Address{}, nil, nil, errors.New("backend is not an ethclient") + } + fmt.Println("Deploying zksync contract") + zksyncClient := zkSyncClient.NewClient(client.Client()) + fmt.Println("getting wallet") + wallet := auth.Context.Value("wallet").(*zkSyncAccounts.Wallet) + fmt.Println("got wallet") + fmt.Println("getting bytes") + decodedBytes := common.FromHex(%sZkBin) + fmt.Println("deploying") + %sAbi, err := %sMetaData.GetAbi() + if err != nil { + return common.Address{}, nil, nil, err + } + constructor, err := %sAbi.Pack("", params...) + if err != nil { + return common.Address{}, nil, nil, err + } + hash, err := wallet.DeployWithCreate(nil, zkSyncAccounts.CreateTransaction{ + Bytecode: decodedBytes, + Calldata: constructor, + }) + if err != nil { + return common.Address{}, nil, nil, err + } + fmt.Println("hash of tx", hash) + receipt, err := zksyncClient.WaitMined(context.Background(), hash) + if err != nil { + return common.Address{}, nil, nil, err + } + tx, _, err := zksyncClient.TransactionByHash(context.Background(), hash) + if err != nil { + return common.Address{}, nil, nil, err + } + fmt.Println("tx hash", tx.Hash) + // this should generated.ConvertToTransaction + ethTx := ConvertToTransaction(*tx) + address := receipt.ContractAddress + + parsed, err := %sMetaData.GetAbi() + contractBind := bind.NewBoundContract(address, *parsed, backend, backend, backend) + + contractReturn := &%s{address: address, abi: *parsed, %sCaller: %sCaller{contract: contractBind}, %sTransactor: %sTransactor{contract: contractBind}, %sFilterer: %sFilterer{contract: contractBind}} + + return address, ethTx, contractReturn, err +} +`) + // Abigen calls Abigen with the given arguments // // It might seem like a shame, to shell out to another golang program like @@ -71,10 +150,17 @@ func Abigen(a AbigenArgs) { Exit("failure while building "+a.Pkg+" wrapper, stderr: "+buildResponse.String(), err) } - ImproveAbigenOutput(a.Out, a.ABI) + zkbytes, err := os.ReadFile(a.ZkBinPath) + if err != nil { + fmt.Println("Error reading file:", err) + return + } + zkHexString := string(zkbytes) + + ImproveAbigenOutput(a.Out, a.ABI, zkHexString) } -func ImproveAbigenOutput(path string, abiPath string) { +func ImproveAbigenOutput(path string, abiPath string, zkHexString string) { abiBytes, err := os.ReadFile(abiPath) if err != nil { Exit("Error while improving abigen output", err) @@ -97,9 +183,20 @@ func ImproveAbigenOutput(path string, abiPath string) { } contractName := getContractName(fileNode) fileNode = addContractStructFields(contractName, fileNode) + + // zksync + fileNode = addZKSyncImports(fset, fileNode) + fileNode = addZKSyncBin(fileNode, contractName, zkHexString) + fileNode = addZKSyncLogic(contractName, fset, fileNode) + fileNode = replaceAnonymousStructs(contractName, fileNode) bs = generateCode(fset, fileNode) bs = writeAdditionalMethods(contractName, logNames, abi, bs) + + // zksync + zkSyncDeployFunction := strings.ReplaceAll(zkDeployCode, "%s", contractName) + bs = append(bs, []byte(fmt.Sprintf("%s\n", zkSyncDeployFunction))...) + err = os.WriteFile(path, bs, 0600) if err != nil { Exit("Error while writing improved abigen source", err) @@ -311,6 +408,169 @@ func addContractStructFieldsToDeployMethod(contractName string, fileNode *ast.Fi }, nil).(*ast.File) } +func updateReturnStatements(funcDecl *ast.FuncDecl, params []ast.Expr) { + // Use ast.Inspect to traverse the entire function body + ast.Inspect(funcDecl.Body, func(n ast.Node) bool { + if returnStmt, ok := n.(*ast.ReturnStmt); ok { + fmt.Println("Found return statement") + if len(returnStmt.Results) > 0 { + if callExpr, ok := returnStmt.Results[0].(*ast.CallExpr); ok { + // Update the arguments of the DeployZkSync function call + fmt.Println("Updating DeployZkSync function call arguments") + callExpr.Args = params + } + } + } + return true + }) +} + +// Add the fields to the returned struct in the 'Deploy' method. +func addZKSyncLogic(contractName string, fset *token.FileSet, fileNode *ast.File) *ast.File { + return astutil.Apply(fileNode, func(cursor *astutil.Cursor) bool { + x, is := cursor.Node().(*ast.FuncDecl) + if !is { + return true + } else if x.Name.Name != "Deploy"+contractName { + return false + } + + // Extract the parameters from the existing function x + var params []ast.Expr + for _, param := range x.Type.Params.List { + for _, name := range param.Names { + params = append(params, ast.NewIdent(name.Name)) + } + } + + newCode := fmt.Sprintf(` + package main + func tempFunc() { + client, ok := backend.(*ethclient.Client) + if !ok { + return common.Address{}, nil, nil, errors.New("backend is not an ethclient") + } + chainId, err := client.ChainID(context.Background()) + if err != nil { + return common.Address{}, nil, nil, err + } + switch chainId.Uint64() { + // this is not sustainable, but it's a quick fix for now + case 324, 280, 300: + return DeployZkSync%s(auth, backend) + } + } + `, contractName) + // Parse the new code snippet as a temporary function to get the statements + tempNode, err := parser.ParseFile(fset, "", newCode, parser.ParseComments) + if err != nil { + panic(err) + } + + for _, decl := range tempNode.Decls { + if funcDecl, ok := decl.(*ast.FuncDecl); ok && funcDecl.Name.Name == "tempFunc" { + fmt.Println("Found function:", funcDecl.Name.Name) + // Update return statements + updateReturnStatements(funcDecl, params) + } + } + + // Extract the body of the temporary function as statements + var newStatements []ast.Stmt + for _, decl := range tempNode.Decls { + if funcDecl, ok := decl.(*ast.FuncDecl); ok && funcDecl.Name.Name == "tempFunc" { + + newStatements = funcDecl.Body.List + break + } + } + x.Body.List = append(newStatements, x.Body.List...) + + // zksync + // x.Type.Results.List[1].Type = &ast.StarExpr{ + // X: &ast.SelectorExpr{ + // X: &ast.Ident{Name: "generated"}, + // Sel: &ast.Ident{Name: "CustomTransaction"}, + // }, + // } + x.Type.Results.List[1].Type = &ast.StarExpr{ + X: &ast.Ident{Name: "CustomTransaction"}, + } + + for _, stmt := range x.Body.List { + returnStmt, is := stmt.(*ast.ReturnStmt) + if !is { + continue + } + if len(returnStmt.Results) < 3 { + continue + } + + // zksync + // convert tx to &CustomTransaction{Transaction: tx, customHash: tx.Hash()} + txExpr, ok := returnStmt.Results[1].(*ast.Ident) + if !ok { + return true + } + if txExpr.Name != "tx" { + return true + } + txField := &ast.KeyValueExpr{ + Key: ast.NewIdent("Transaction"), + Value: ast.NewIdent("tx"), + } + hashField := &ast.KeyValueExpr{ + Key: ast.NewIdent("CustomHash"), + Value: &ast.CallExpr{ + Fun: &ast.SelectorExpr{ + X: ast.NewIdent("tx"), + Sel: ast.NewIdent("Hash"), + }, + }, + } + newRet := &ast.CompositeLit{ + Type: &ast.Ident{Name: "CustomTransaction"}, + Elts: []ast.Expr{txField, hashField}, + } + pointerRet := &ast.UnaryExpr{Op: token.AND, X: newRet} + returnStmt.Results[1] = pointerRet + } + + return false + }, nil).(*ast.File) +} + +func addZKSyncImports(fset *token.FileSet, fileNode *ast.File) *ast.File { + astutil.AddImport(fset, fileNode, "github.com/ethereum/go-ethereum/ethclient") + astutil.AddImport(fset, fileNode, "context") + astutil.AddNamedImport(fset, fileNode, "zkSyncClient", "github.com/zksync-sdk/zksync2-go/clients") + astutil.AddNamedImport(fset, fileNode, "zkSyncAccounts", "github.com/zksync-sdk/zksync2-go/accounts") + astutil.AddNamedImport(fset, fileNode, "zktypes", "github.com/zksync-sdk/zksync2-go/types") + return fileNode +} + +func addZKSyncBin(fileNode *ast.File, contractName string, zkHexString string) *ast.File { + // zksync + newVarSpec := &ast.ValueSpec{ + Names: []*ast.Ident{ast.NewIdent(fmt.Sprintf("%sZkBin", contractName))}, + Type: ast.NewIdent("string"), + Values: []ast.Expr{ + &ast.BasicLit{ + Kind: token.STRING, + Value: fmt.Sprintf("(\"0x%s\")", zkHexString), + }, + }, + } + newVarDecl := &ast.GenDecl{ + Tok: token.VAR, + Specs: []ast.Spec{newVarSpec}, + } + + // Insert the new variable declaration at the top of the file (before existing functions) + fileNode.Decls = append(fileNode.Decls, newVarDecl) + return fileNode +} + func getLogNames(fileNode *ast.File) []string { var logNames []string astutil.Apply(fileNode, func(cursor *astutil.Cursor) bool { diff --git a/core/gethwrappers/ccip/go_gen_zk.go b/core/gethwrappers/ccip/go_gen_zk.go new file mode 100644 index 0000000000..fccadd089d --- /dev/null +++ b/core/gethwrappers/ccip/go_gen_zk.go @@ -0,0 +1,22 @@ +package ccip + +// go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.24/ARMProxy/ARMProxy.abi ../../../contracts/solc/v0.8.24/ARMProxy/ARMProxy.bin RMNProxyContract rmn_proxy_contract ../../../contracts/zksolc/v0.8.24/ARMProxy/ARMProxy.sol/ARMProxy.zbin +// go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.24/RMN/RMN.abi ../../../contracts/solc/v0.8.24/RMN/RMN.bin RMNContract rmn_contract ../../../contracts/zksolc/v0.8.24/RMN/RMN.sol/RMN.zbin + +// go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.24/TokenAdminRegistry/TokenAdminRegistry.abi ../../../contracts/solc/v0.8.24/TokenAdminRegistry/TokenAdminRegistry.bin TokenAdminRegistry token_admin_registry ../../../contracts/zksolc/v0.8.24/TokenAdminRegistry/TokenAdminRegistry.sol/TokenAdminRegistry.zbin +// go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.24/RegistryModuleOwnerCustom/RegistryModuleOwnerCustom.abi ../../../contracts/solc/v0.8.24/RegistryModuleOwnerCustom/RegistryModuleOwnerCustom.bin RegistryModuleOwnerCustom registry_module_owner_custom ../../../contracts/zksolc/v0.8.24/RegistryModuleOwnerCustom/RegistryModuleOwnerCustom.sol/RegistryModuleOwnerCustom.zbin +// go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.24/FeeQuoter/FeeQuoter.abi ../../../contracts/solc/v0.8.24/FeeQuoter/FeeQuoter.bin FeeQuoter fee_quoter ../../../contracts/zksolc/v0.8.24/FeeQuoter/FeeQuoter.sol/FeeQuoter.zbin + +// go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.24/EVM2EVMOnRamp/EVM2EVMOnRamp.abi ../../../contracts/solc/v0.8.24/EVM2EVMOnRamp/EVM2EVMOnRamp.bin EVM2EVMOnRamp evm_2_evm_onramp ../../../contracts/zksolc/v0.8.24/EVM2EVMOnRamp/EVM2EVMOnRamp.sol/EVM2EVMOnRamp.zbin +// go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.24/EVM2EVMOffRamp/EVM2EVMOffRamp.abi ../../../contracts/solc/v0.8.24/EVM2EVMOffRamp/EVM2EVMOffRamp.bin EVM2EVMOffRamp evm_2_evm_offramp ../../../contracts/zksolc/v0.8.24/EVM2EVMOffRamp/EVM2EVMOffRamp.sol/EVM2EVMOffRamp.zbin +// go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.24/CommitStore/CommitStore.abi ../../../contracts/solc/v0.8.24/CommitStore/CommitStore.bin CommitStore commit_store ../../../contracts/zksolc/v0.8.24/CommitStore/CommitStore.sol/CommitStore.zbin + +// go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.24/Router/Router.abi ../../../contracts/solc/v0.8.24/Router/Router.bin Router router ../../../contracts/zksolc/v0.8.24/Router/Router.sol/Router.zbin +// go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.24/PriceRegistry/PriceRegistry.abi ../../../contracts/solc/v0.8.24/PriceRegistry/PriceRegistry.bin PriceRegistry price_registry_1_2_0 ../../../contracts/zksolc/v0.8.24/PriceRegistry/PriceRegistry.sol/PriceRegistry.zbin + +// go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.24/LockReleaseTokenPool/LockReleaseTokenPool.abi ../../../contracts/solc/v0.8.24/LockReleaseTokenPool/LockReleaseTokenPool.bin LockReleaseTokenPool lock_release_token_pool ../../../contracts/zksolc/v0.8.24/LockReleaseTokenPool/LockReleaseTokenPool.sol/LockReleaseTokenPool.zbin + +//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/LinkToken/LinkToken.abi ../../../contracts/solc/v0.8.19/LinkToken/LinkToken.bin LinkToken link_token ../../../contracts/zksolc/v0.8.19/LinkToken/LinkToken.sol/LinkToken.zbin +//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.24/WETH9/WETH9.abi ../../../contracts/solc/v0.8.24/WETH9/WETH9.bin WETH9 weth9 ../../../contracts/zksolc/v0.8.24/WETH9/WETH9.sol/WETH9.zbin + +//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.24/SelfFundedPingPong/SelfFundedPingPong.abi ../../../contracts/solc/v0.8.24/SelfFundedPingPong/SelfFundedPingPong.bin SelfFundedPingPong self_funded_ping_pong ../../../contracts/zksolc/v0.8.24/SelfFundedPingPong/SelfFundedPingPong.sol/SelfFundedPingPong.zbin diff --git a/core/gethwrappers/generation/generate/wrap.go b/core/gethwrappers/generation/generate/wrap.go index 967e703d39..ddb0ef0526 100644 --- a/core/gethwrappers/generation/generate/wrap.go +++ b/core/gethwrappers/generation/generate/wrap.go @@ -15,6 +15,7 @@ func main() { binPath := os.Args[2] className := os.Args[3] pkgName := os.Args[4] + zkBinPath := os.Args[5] fmt.Println("Generating", pkgName, "contract wrapper") cwd, err := os.Getwd() // gethwrappers directory @@ -28,7 +29,7 @@ func main() { outPath := filepath.Join(outDir, pkgName+".go") gethwrappers2.Abigen(gethwrappers2.AbigenArgs{ - Bin: binPath, ABI: abiPath, Out: outPath, Type: className, Pkg: pkgName, + Bin: binPath, ABI: abiPath, Out: outPath, Type: className, Pkg: pkgName, ZkBinPath: zkBinPath, }) // Build succeeded, so update the versions db with the new contract data