-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4d31dea
commit 0bf13d1
Showing
4 changed files
with
201 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# utility to convert go_generate.go to zksync version | ||
|
||
def update_go_generate(file_path): | ||
updated_lines = [] | ||
|
||
with open(file_path, 'r') as file: | ||
for line in file: | ||
if "//go:generate" in line: | ||
parts = line.strip().split() # Split the line into parts | ||
bin_path = parts[5] | ||
# Generate the .zbin path with `.sol` insertion | ||
zbin_path = bin_path.replace("solc", "zksolc").replace("/v0.8.24/", "/v1.5.6/").replace(".bin", ".sol/") + bin_path.split('/')[-1].replace(".bin", ".zbin") | ||
parts.append(zbin_path) | ||
|
||
parts[3] = "./generation/generate_zks/wrap.go" | ||
|
||
line = " ".join(parts) + "\n" | ||
print(line) | ||
|
||
updated_lines.append(line) | ||
|
||
# Write back to the file | ||
with open(file_path, 'w') as file: | ||
file.writelines(updated_lines) | ||
|
||
# Example usage | ||
update_go_generate('go_generate_zks.go') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package generated_zks | ||
|
||
import ( | ||
"github.com/ethereum/go-ethereum/common" | ||
"github.com/ethereum/go-ethereum/core/types" | ||
// zkSyncAccounts "github.com/zksync-sdk/zksync2-go/accounts" | ||
// zkSyncClient "github.com/zksync-sdk/zksync2-go/clients" | ||
// zktypes "github.com/zksync-sdk/zksync2-go/types" | ||
) | ||
|
||
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), | ||
// } | ||
|
||
// tx := types.NewTx(dtx) | ||
// customTransaction := CustomTransaction{Transaction: tx, CustomHash: resp.Hash} | ||
// return &customTransaction | ||
// } | ||
|
||
// func IsZkSync(backend bind.ContractBackend) bool { | ||
// client, ok := backend.(*ethclient.Client) | ||
// if !ok { | ||
// return false | ||
// } | ||
// chainId, err := client.ChainID(context.Background()) | ||
// if err != nil { | ||
// return false | ||
// } | ||
// switch chainId.Uint64() { | ||
|
||
// case 324, 280, 300: | ||
// return true | ||
// } | ||
// return false | ||
// } | ||
|
||
// type ZkSyncContract struct { | ||
// zkclient *zkSyncClient.Client | ||
// wallet *zkSyncAccounts.Wallet | ||
// } | ||
|
||
// // NewZkSyncContract creates and returns a new ZkSyncContract instance. | ||
// func NewZkSyncContract(auth *bind.TransactOpts, backend bind.ContractBackend, contractBytes []byte, contractAbi *abi.ABI, params ...interface{}) (common.Address, *CustomTransaction, *bind.BoundContract, error) { | ||
// client, ok := backend.(*ethclient.Client) | ||
// if !ok { | ||
// return common.Address{}, nil, nil, fmt.Errorf("backend is not an *ethclient.Client") | ||
// } | ||
|
||
// // Retrieve wallet from context safely | ||
// walletValue := auth.Context.Value("wallet") | ||
// wallet, ok := walletValue.(*zkSyncAccounts.Wallet) | ||
// if !ok || wallet == nil { | ||
// return common.Address{}, nil, nil, fmt.Errorf("wallet not found in context or invalid type") | ||
// } | ||
|
||
// zkclient := zkSyncClient.NewClient(client.Client()) | ||
|
||
// constructor, _ := contractAbi.Pack("", params...) | ||
|
||
// hash, _ := wallet.DeployWithCreate(nil, zkSyncAccounts.CreateTransaction{ | ||
// Bytecode: contractBytes, | ||
// Calldata: constructor, | ||
// }) | ||
// receipt, _ := zkclient.WaitMined(context.Background(), hash) | ||
// tx, _, _ := zkclient.TransactionByHash(context.Background(), hash) | ||
// ethTx := ConvertToTransaction(*tx) | ||
// address := receipt.ContractAddress | ||
// contractBind := bind.NewBoundContract(address, *contractAbi, backend, backend, backend) | ||
// return address, ethTx, contractBind, nil | ||
// } |
9 changes: 7 additions & 2 deletions
9
core/gethwrappers/ccip/generated_zks/rmn_proxy_contract/rmn_proxy_contract.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.