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

feat: initialize a prototypes #162

Merged
merged 33 commits into from
Jul 3, 2024
Merged

feat: initialize a prototypes #162

merged 33 commits into from
Jul 3, 2024

Conversation

lumtis
Copy link
Member

@lumtis lumtis commented Jun 18, 2024

Initialize a prototypes directory in contracts and tests for new prototypes development.

Prototypes is initialize with a very trivial gateway contract.

Later these smart contracts can be moved to a new location depending on the plan moving forward.

Close: #159

Summary by CodeRabbit

  • New Features

    • Introduced ERC20 custody functionality with withdraw and withdrawAndCall capabilities.
    • Added GatewayEVM and GatewayZEVM contracts for cross-chain smart contract interactions and token transfers.
    • Implemented Receiver and TestERC20 contracts for handling ERC20 token interactions.
    • Introduced TestZContract for cross-chain call handling.
    • Added ZRC20New contract with enhanced token transfer functionalities.
  • Bug Fixes

    • N/A
  • Documentation

    • N/A

@lumtis lumtis marked this pull request as draft June 18, 2024 13:01
@lumtis lumtis marked this pull request as ready for review June 19, 2024 15:38
Copy link
Contributor

@skosito skosito left a comment

Choose a reason for hiding this comment

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

looks good as POC, just 2 comments for missing docs

contracts/prototypes/Gateway.sol Outdated Show resolved Hide resolved
contracts/prototypes/ERC20CustodyNew.sol Outdated Show resolved Hide resolved
@lumtis lumtis linked an issue Jun 20, 2024 that may be closed by this pull request
@lumtis
Copy link
Member Author

lumtis commented Jul 2, 2024

@coderabbitai can you rewrite the Sequence Diagram(s) for all the Solidity smart contracts in the PR?

Copy link
Contributor

coderabbitai bot commented Jul 2, 2024

Tip

For best results, initiate chat on the files or code changes.

@lumtis: Here are the sequence diagrams for the Solidity smart contracts in the PR:

ERC20CustodyNew.sol Sequence Diagram

sequenceDiagram
    participant User
    participant ERC20CustodyNew

    User->>ERC20CustodyNew: withdraw(token, to, amount)
    ERC20CustodyNew-->>User: Withdraw event

    User->>ERC20CustodyNew: withdrawAndCall(token, to, amount, data)
    ERC20CustodyNew-->>User: WithdrawAndCall event
Loading

GatewayEVM.sol Sequence Diagram

sequenceDiagram
    participant User
    participant GatewayEVM

    User->>GatewayEVM: initialize(_tssAddress)
    User->>GatewayEVM: execute(destination, data)
    GatewayEVM-->>User: Executed event

    User->>GatewayEVM: executeWithERC20(token, to, amount, data)
    GatewayEVM-->>User: ExecutedWithERC20 event

    User->>GatewayEVM: deposit(receiver)
    GatewayEVM-->>User: Deposit event

    User->>GatewayEVM: depositAndCall(receiver, payload)
    GatewayEVM-->>User: Call event

    User->>GatewayEVM: setCustody(_custody)
Loading

GatewayEVMUpgradeTest.sol Sequence Diagram

sequenceDiagram
    participant User
    participant GatewayEVMUpgradeTest

    User->>GatewayEVMUpgradeTest: initialize(_tssAddress)
    User->>GatewayEVMUpgradeTest: execute(destination, data)
    GatewayEVMUpgradeTest-->>User: ExecutedV2 event

    User->>GatewayEVMUpgradeTest: executeWithERC20(token, to, amount, data)
    GatewayEVMUpgradeTest-->>User: ExecutedWithERC20 event

    User->>GatewayEVMUpgradeTest: sendERC20(recipient, token, amount)
    GatewayEVMUpgradeTest-->>User: SendERC20 event

    User->>GatewayEVMUpgradeTest: send(recipient, amount)
    GatewayEVMUpgradeTest-->>User: Send event

    User->>GatewayEVMUpgradeTest: setCustody(_custody)
Loading

Receiver.sol Sequence Diagram

sequenceDiagram
    participant User
    participant Receiver

    User->>Receiver: receiveA(str, num, flag)
    Receiver-->>User: ReceivedA event

    User->>Receiver: receiveB(strs, nums, flag)
    Receiver-->>User: ReceivedB event

    User->>Receiver: receiveC(amount, token, destination)
    Receiver-->>User: ReceivedC event

    User->>Receiver: receiveD()
    Receiver-->>User: ReceivedD event
Loading

TestERC20.sol Sequence Diagram

sequenceDiagram
    participant User
    participant TestERC20

    User->>TestERC20: mint(to, amount)
Loading

GatewayZEVM.sol Sequence Diagram

sequenceDiagram
    participant User
    participant GatewayZEVM

    User->>GatewayZEVM: initialize()
    User->>GatewayZEVM: withdraw(receiver, amount, zrc20)
    GatewayZEVM-->>User: Withdrawal event

    User->>GatewayZEVM: withdrawAndCall(receiver, amount, zrc20, message)
    GatewayZEVM-->>User: Withdrawal event

    User->>GatewayZEVM: call(receiver, message)
    GatewayZEVM-->>User: Call event
Loading

Sender.sol Sequence Diagram

sequenceDiagram
    participant User
    participant Sender

    User->>Sender: callReceiver(receiver, str, num, flag)
    User->>Sender: withdrawAndCallReceiver(receiver, amount, zrc20, str, num, flag)
Loading

TestZContract.sol Sequence Diagram

sequenceDiagram
    participant User
    participant TestZContract

    User->>TestZContract: onCrossChainCall(context, zrc20, amount, message)
    TestZContract-->>User: ContextData event
Loading

ZRC20New.sol Sequence Diagram

sequenceDiagram
    participant User
    participant ZRC20New

    User->>ZRC20New: name()
    User->>ZRC20New: symbol()
    User->>ZRC20New: decimals()
    User->>ZRC20New: totalSupply()
    User->>ZRC20New: balanceOf(account)
    User->>ZRC20New: transfer(recipient, amount)
    User->>ZRC20New: allowance(owner, spender)
    User->>ZRC20New: approve(spender, amount)
    User->>ZRC20New: transferFrom(sender, recipient, amount)
    User->>ZRC20New: burn(amount)
    User->>ZRC20New: deposit(to, amount)
    User->>ZRC20New: withdraw(to, amount)
    User->>ZRC20New: withdrawGasFee()
    User->>ZRC20New: updateSystemContractAddress(addr)
    User->>ZRC20New: updateGasLimit(gasLimit)
    User->>ZRC20New: updateProtocolFlatFee(protocolFlatFee)
Loading

Let me know if any adjustments are needed!

Analysis chain
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Gathering the function definitions and interactions in the Solidity files
for file in contracts/prototypes/**/*.sol; do
  echo "File: $file"
  echo "Functions:"
  ast-grep --lang solidity --pattern 'function $_($_) $_' $file
  echo "Events:"
  ast-grep --lang solidity --pattern 'event $_($_)' $file
  echo "Errors:"
  ast-grep --lang solidity --pattern 'error $_($_)' $file
  echo "Imports:"
  ast-grep --lang solidity --pattern 'import $_' $file
  echo
done

Length of output: 12107



Script:

#!/bin/bash
# Gathering the function definitions and interactions in the Solidity files
for file in contracts/prototypes/**/*.sol; do
  echo "File: $file"
  echo "Functions:"
  rg --no-filename 'function ' $file
  echo "Events:"
  rg --no-filename 'event ' $file
  echo "Errors:"
  rg --no-filename 'error ' $file
  echo "Imports:"
  rg --no-filename 'import ' $file
  echo
done

Length of output: 15556

event WithdrawAndCall(address indexed token, address indexed to, uint256 amount, bytes data);

constructor(address _gateway) {
gateway = IGatewayEVM(_gateway);
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: add a zero address validation

contracts/prototypes/evm/ERC20CustodyNew.sol Show resolved Hide resolved
IERC20(token).transfer(address(gateway), amount);

// Forward the call to the Gateway contract
gateway.executeWithERC20(token, to, amount, data);
Copy link
Contributor

Choose a reason for hiding this comment

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

executeWithERC20 will happen always, even if the previous transfer to the gateway failed; is it a valid scenario?

Copy link
Member Author

Choose a reason for hiding this comment

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

No it should fail in this case
So if transfer returns a boolean, we need to check the returned value

Copy link
Contributor

@skosito skosito Jul 3, 2024

Choose a reason for hiding this comment

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

should we use safeTransfer instead?
EDIT: will change to safeTransfer because that seems cleaner than always checking response bool value but let me know your thoughts

contracts/prototypes/evm/GatewayEVM.sol Show resolved Hide resolved
contracts/prototypes/evm/ERC20CustodyNew.sol Show resolved Hide resolved
contracts/prototypes/evm/GatewayEVM.sol Show resolved Hide resolved
contracts/prototypes/zevm/GatewayZEVM.sol Show resolved Hide resolved
contracts/prototypes/zevm/GatewayZEVM.sol Show resolved Hide resolved
}

// Withdraw ZRC20 tokens to external chain
function withdraw(bytes memory receiver, uint256 amount, address zrc20) external {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm probably lacking some context here on how the system contracts works; where do we control that msg.sender has the funds trying to be withdrawn?

Copy link
Contributor

Choose a reason for hiding this comment

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

i added more explicit revert errors, but it will revert if that is the case, maybe we can add check at the beginning, but this should be good enough?

contracts/prototypes/zevm/ZRC20New.sol Outdated Show resolved Hide resolved
contracts/prototypes/zevm/ZRC20New.sol Show resolved Hide resolved
lumtis and others added 2 commits July 3, 2024 12:39
Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>
This was referenced Jul 3, 2024
@skosito
Copy link
Contributor

skosito commented Jul 3, 2024

@lumtis @andresaiello @fbac I addressed all comments, and opened 2 more issues from not addressed comments:
#205
#206

please recheck when you get a chance

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 35

Outside diff range and nitpick comments (6)
pkg/contracts/prototypes/zevm/sender.sol/sender.go (6)

Line range hint 367-369: Ensure proper error handling in FilterWithdraw.

The function handles errors well, but consider adding more context to the error messages for better debugging.

-  return nil, err
+  return nil, fmt.Errorf("FilterWithdraw: %w", err)

Line range hint 388-390: Ensure proper error handling in WatchWithdraw.

The function handles errors well, but consider adding more context to the error messages for better debugging.

-  return nil, err
+  return nil, fmt.Errorf("WatchWithdraw: %w", err)

Line range hint 425-426: Ensure proper error handling in ParseWithdraw.

The function handles errors well, but consider adding more context to the error messages for better debugging.

-  return nil, err
+  return nil, fmt.Errorf("ParseWithdraw: %w", err)

Line range hint 522-524: Ensure proper error handling in FilterWithdrawAndCall.

The function handles errors well, but consider adding more context to the error messages for better debugging.

-  return nil, err
+  return nil, fmt.Errorf("FilterWithdrawAndCall: %w", err)

Line range hint 543-545: Ensure proper error handling in WatchWithdrawAndCall.

The function handles errors well, but consider adding more context to the error messages for better debugging.

-  return nil, err
+  return nil, fmt.Errorf("WatchWithdrawAndCall: %w", err)

Line range hint 580-581: Ensure proper error handling in ParseWithdrawAndCall.

The function handles errors well, but consider adding more context to the error messages for better debugging.

-  return nil, err
+  return nil, fmt.Errorf("ParseWithdrawAndCall: %w", err)
Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7db93dd and efd62ce.

Files ignored due to path filters (11)
  • contracts/prototypes/evm/ERC20CustodyNew.sol is excluded by none and included by none
  • contracts/prototypes/evm/GatewayEVM.sol is excluded by none and included by none
  • contracts/prototypes/evm/GatewayEVMUpgradeTest.sol is excluded by none and included by none
  • contracts/prototypes/evm/Receiver.sol is excluded by none and included by none
  • contracts/prototypes/zevm/GatewayZEVM.sol is excluded by none and included by none
  • contracts/prototypes/zevm/Sender.sol is excluded by none and included by none
  • contracts/prototypes/zevm/ZRC20New.sol is excluded by none and included by none
  • contracts/zevm/ZRC20.sol is excluded by none and included by none
  • test/prototypes/GatewayEVM.spec.ts is excluded by none and included by none
  • test/prototypes/GatewayEVMUpgrade.spec.ts is excluded by none and included by none
  • test/prototypes/GatewayIntegration.spec.ts is excluded by none and included by none
Files selected for processing (6)
  • pkg/contracts/prototypes/evm/erc20custodynew.sol/erc20custodynew.go (1 hunks)
  • pkg/contracts/prototypes/evm/receiver.sol/receiver.go (1 hunks)
  • pkg/contracts/prototypes/zevm/gatewayzevm.sol/gatewayzevm.go (1 hunks)
  • pkg/contracts/prototypes/zevm/sender.sol/sender.go (1 hunks)
  • pkg/contracts/prototypes/zevm/zrc20new.sol/zrc20new.go (1 hunks)
  • pkg/contracts/zevm/zrc20.sol/zrc20.go (1 hunks)
Files not summarized due to errors (4)
  • pkg/contracts/prototypes/evm/receiver.sol/receiver.go: Error: Message exceeds token limit
  • pkg/contracts/prototypes/zevm/gatewayzevm.sol/gatewayzevm.go: Error: Message exceeds token limit
  • pkg/contracts/prototypes/zevm/zrc20new.sol/zrc20new.go: Error: Message exceeds token limit
  • pkg/contracts/zevm/zrc20.sol/zrc20.go: Error: Message exceeds token limit
Additional comments not posted (25)
pkg/contracts/prototypes/zevm/sender.sol/sender.go (1)

261-262: Ensure proper error handling in WithdrawAndCallReceiver.

The function handles errors well, but consider adding more context to the error messages for better debugging.

-  return _Sender.contract.Transact(opts, "withdrawAndCallReceiver", receiver, amount, zrc20, str, num, flag)
+  return _Sender.contract.Transact(opts, "withdrawAndCallReceiver", receiver, amount, zrc20, str, num, flag)

Likely invalid or redundant comment.

pkg/contracts/prototypes/evm/receiver.sol/receiver.go (10)

1-3: Header Comment: Verify the auto-generation tool.

Ensure that the auto-generation tool used to create this file is up-to-date and correctly configured.


19-30: Reference Imports: Verify the usage of referenced imports.

Ensure that the referenced imports are correctly used within the file to suppress errors.


46-61: Deployment Function: Ensure error handling and deployment logic.

Verify that the DeployReceiver function correctly handles errors and deploys the contract.


63-120: Struct Definitions: Verify the correctness of struct definitions.

Ensure that the struct definitions for Receiver, ReceiverCaller, ReceiverTransactor, and ReceiverFilterer are correctly implemented.


85-120: Session Struct Definitions: Verify the correctness of session struct definitions.

Ensure that the session struct definitions for ReceiverSession, ReceiverCallerSession, and ReceiverTransactorSession are correctly implemented.


107-120: Raw Binding Struct Definitions: Verify the correctness of raw binding struct definitions.

Ensure that the raw binding struct definitions for ReceiverRaw, ReceiverCallerRaw, and ReceiverTransactorRaw are correctly implemented.


122-165: Contract Creation Functions: Ensure error handling and correctness.

Verify that the functions for creating instances of the Receiver contract and its bindings (NewReceiver, NewReceiverCaller, NewReceiverTransactor, NewReceiverFilterer, and bindReceiver) are correctly implemented and handle errors appropriately.


167-833: Method Bindings: Verify the correctness of method bindings.

Ensure that the method bindings for contract methods (Call, Transfer, Transact, etc.) and events (FilterReceivedERC20, WatchReceivedERC20, ParseReceivedERC20, etc.) are correctly implemented.


32-36: Metadata: Verify the contract metadata.

Ensure that the metadata for the Receiver contract is correctly defined and matches the Solidity contract.


6-17: Import Statements: Check for unused imports.

Verify that all imported packages are necessary for the functionality of the file.

pkg/contracts/zevm/zrc20.sol/zrc20.go (10)

Line range hint 44-61: Verify the correctness of the DeployZRC20 function.

Ensure that the function correctly handles errors and passes parameters for contract deployment.


Line range hint 629-631: Verify the correctness of the FilterWithdrawal function and event filtering logic.

Ensure that the function correctly filters the Withdrawal event.


Line range hint 539-541: Verify the correctness of the FilterUpdatedProtocolFlatFee function and event filtering logic.

Ensure that the function correctly filters the UpdatedProtocolFlatFee event.

Verification successful

Verification Successful: FilterUpdatedProtocolFlatFee function and event filtering logic are correct.

The FilterUpdatedProtocolFlatFee function correctly filters the UpdatedProtocolFlatFee event as expected. The event is correctly referenced and handled in the codebase.

  • pkg/contracts/zevm/zrc20.sol/zrc20.go: The function FilterUpdatedProtocolFlatFee and the event UpdatedProtocolFlatFee are implemented correctly.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the correctness of the FilterUpdatedProtocolFlatFee function and event filtering logic.

# Test: Check if the function correctly filters the UpdatedProtocolFlatFee event.
go test -run '^TestFilterUpdatedProtocolFlatFee$' pkg/contracts/zevm/zrc20.sol

Length of output: 150



Script:

#!/bin/bash
# Search for the definition of the FilterUpdatedProtocolFlatFee function in the codebase
ast-grep --lang go --pattern 'func FilterUpdatedProtocolFlatFee($_) $_' 

# Search for the UpdatedProtocolFlatFee event in the codebase to see how it is used and filtered
rg 'UpdatedProtocolFlatFee'

Length of output: 58384


Line range hint 404-406: Verify the correctness of the FilterDeposit function and event filtering logic.

Ensure that the function correctly filters the Deposit event.


Line range hint 494-496: Verify the correctness of the FilterUpdatedGasLimit function and event filtering logic.

Ensure that the function correctly filters the UpdatedGasLimit event.


Line range hint 584-586: Verify the correctness of the FilterUpdatedSystemContract function and event filtering logic.

Ensure that the function correctly filters the UpdatedSystemContract event.

Verification successful

Verification Successful: The FilterUpdatedSystemContract function correctly filters the UpdatedSystemContract event and handles errors appropriately.

  • The function calls _ZRC20.contract.FilterLogs(opts, "UpdatedSystemContract") to filter logs for the UpdatedSystemContract event.
  • It checks for errors and returns nil and the error if any.
  • It returns a ZRC20UpdatedSystemContractIterator initialized with the filtered logs and subscription.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the correctness of the FilterUpdatedSystemContract function and event filtering logic.

# Test: Check if the function correctly filters the UpdatedSystemContract event.
go test -run '^TestFilterUpdatedSystemContract$' pkg/contracts/zevm/zrc20.sol

Length of output: 149



Script:

#!/bin/bash
# Locate the implementation of the FilterUpdatedSystemContract function in the codebase
ast-grep --lang go --pattern 'func FilterUpdatedSystemContract($_) $_' > result.txt
cat result.txt

Length of output: 89



Script:

#!/bin/bash
# Use rg to search for the term FilterUpdatedSystemContract across the entire codebase
rg 'FilterUpdatedSystemContract'

Length of output: 3282



Script:

#!/bin/bash
# Extract the implementation of the FilterUpdatedSystemContract function from pkg/contracts/zevm/zrc20.sol/zrc20.go
ast-grep --lang go --pattern 'func (_ZRC20 *ZRC20Filterer) FilterUpdatedSystemContract(opts *bind.FilterOpts) (*ZRC20UpdatedSystemContractIterator, error) {
  $$$
}' pkg/contracts/zevm/zrc20.sol/zrc20.go

Length of output: 924


Line range hint 359-361: Verify the correctness of the FilterApproval function and event filtering logic.

Ensure that the function correctly filters the Approval event.


Line range hint 449-451: Verify the correctness of the FilterTransfer function and event filtering logic.

Ensure that the function correctly filters the Transfer event.

Verification successful

Verification of the FilterTransfer function and event filtering logic

The FilterTransfer function in the pkg/contracts/zevm/zrc20.sol/zrc20.go file correctly filters the Transfer event by setting up filtering rules for the from and to addresses, retrieving logs that match these rules, and returning an iterator for the logs.

  • File: pkg/contracts/zevm/zrc20.sol/zrc20.go
  • Lines: 1176-1192
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the correctness of the FilterTransfer function and event filtering logic.

# Test: Check if the function correctly filters the Transfer event.
go test -run '^TestFilterTransfer$' pkg/contracts/zevm/zrc20.sol

Length of output: 136



Script:

#!/bin/bash
# Find the implementation of the FilterTransfer function in the codebase
ast-grep --lang go --pattern 'func ($_ *$_) FilterTransfer($_) ($_)' 

# Search for test cases related to the FilterTransfer function
rg 'FilterTransfer' --type go --tests

Length of output: 540



Script:

#!/bin/bash
# Find the implementation of the FilterTransfer function in the codebase
ast-grep --lang go --pattern 'func ($_ *$_) FilterTransfer($_) ($_)' 

# Search for test cases related to the FilterTransfer function
rg 'FilterTransfer' --type go

Length of output: 14618



Script:

#!/bin/bash
# Display the implementation of the FilterTransfer function in the specified file
ast-grep --lang go --pattern 'func (_ZRC20 *ZRC20Filterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*ZRC20TransferIterator, error)' pkg/contracts/zevm/zrc20.sol/zrc20.go

Length of output: 1513


35-35: Verify the correctness of the ABI and binary data.

Ensure that the ABI and binary data are correctly generated and correspond to the Solidity contract.


Line range hint 64-74: Verify the correctness and completeness of the ZRC20 struct and its methods.

Ensure that the struct and its methods are correctly defined and complete.

Verification successful

ZRC20 struct is correctly defined and complete.

The ZRC20 struct in pkg/contracts/zevm/zrc20.sol/zrc20.go is correctly defined with the necessary fields (ZRC20Caller, ZRC20Transactor, and ZRC20Filterer). There are no associated methods using the (z *ZRC20) receiver pattern, which is consistent with its intended use as a binding for the Ethereum contract.

  • pkg/contracts/zevm/zrc20.sol/zrc20.go:
    • ZRC20 struct definition: lines 64-68
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the correctness and completeness of the ZRC20 struct and its methods.

# Test: Check if the struct and its methods are correctly defined and complete.
go test -run '^TestZRC20Methods$' pkg/contracts/zevm/zrc20.sol

Length of output: 134



Script:

#!/bin/bash
# Description: Verify the correctness and completeness of the ZRC20 struct and its methods by inspecting the code.

# Search for the ZRC20 struct definition
ast-grep --lang go --pattern $'type ZRC20 struct {
  $$$
}' 

# Search for methods associated with the ZRC20 struct
rg 'func (\(z \*ZRC20\))' 

Length of output: 487



Script:

#!/bin/bash
# Description: Verify the correctness and completeness of the ZRC20 struct and its methods by inspecting the code.

# Search for any methods associated with the ZRC20 struct using different receiver patterns
rg 'func .*ZRC20\)' 

# Search for any usage patterns related to the ZRC20 struct
rg 'ZRC20' 

Length of output: 293369

pkg/contracts/prototypes/zevm/zrc20new.sol/zrc20new.go (4)

845-882: LGTM!

The code changes are approved.


124-127: Improve error handling message.

The error message for bindZRC20New should be more descriptive to indicate the context of the error.

-		return nil, err
+		return nil, fmt.Errorf("failed to bind ZRC20New contract: %w", err)

Likely invalid or redundant comment.


48-54: Improve error handling message.

The error message for parsed == nil should be more descriptive to indicate the context of the error.

-		return common.Address{}, nil, nil, errors.New("GetABI returned nil")
+		return common.Address{}, nil, nil, errors.New("ZRC20NewMetaData.GetABI returned nil")

Likely invalid or redundant comment.


151-153: Improve error handling message.

The error message for bindZRC20New should be more descriptive to indicate the context of the error.

-		return nil, err
+		return nil, fmt.Errorf("failed to bind ZRC20NewFilterer contract: %w", err)

Likely invalid or redundant comment.

@skosito skosito merged commit a8343cb into main Jul 3, 2024
9 checks passed
@skosito skosito deleted the init-prototypes branch July 3, 2024 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
8 participants