Skip to content

Commit

Permalink
refactor: rename dstChain to chain (#595)
Browse files Browse the repository at this point in the history
Co-authored-by: fx0x55 <80245546+fx0x55@users.noreply.github.com>
  • Loading branch information
zakir-code and fx0x55 committed Jul 24, 2024
1 parent a4bb1b5 commit 156326f
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 26 deletions.
28 changes: 14 additions & 14 deletions contract/ICrossChain.go

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions solidity/contracts/bridge/ICrossChain.sol
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ interface ICrossChain is IFIP20CrossChain, IBridgeCall {
) external view returns (uint256 _amount);

function executeClaim(
string memory _dstChainId,
string memory _chain,
uint256 _eventNonce
) external returns (bool _result);

Expand Down Expand Up @@ -107,6 +107,6 @@ interface ICrossChain is IFIP20CrossChain, IBridgeCall {
event ExecuteClaimEvent(
address indexed _sender,
uint256 _eventNonce,
string _dstChain
string _chain
);
}
2 changes: 1 addition & 1 deletion tests/contract/CrossChainTest.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/crosschain_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ func (suite *CrosschainTestSuite) ExecuteClaim() *ethtypes.Transaction {
suite.Require().True(len(externalClaims) > 0)

pack, err := precompile.NewExecuteClaimMethod(nil).PackInput(crosschaintypes.ExecuteClaimArgs{
DstChain: suite.chainName,
Chain: suite.chainName,
EventNonce: new(big.Int).SetUint64(externalClaims[0].GetEventNonce()),
})
suite.Require().NoError(err)
Expand Down
6 changes: 3 additions & 3 deletions x/crosschain/precompile/execute_claim.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (m *ExecuteClaimMethod) Run(evm *vm.EVM, contract *vm.Contract) ([]byte, er
return nil, err
}

crosschainKeeper, has := m.router.GetRoute(args.DstChain)
crosschainKeeper, has := m.router.GetRoute(args.Chain)
if !has {
return nil, errors.New("chain not support")
}
Expand All @@ -61,7 +61,7 @@ func (m *ExecuteClaimMethod) Run(evm *vm.EVM, contract *vm.Contract) ([]byte, er
if err = crosschainKeeper.ExecuteClaim(ctx, args.EventNonce.Uint64()); err != nil {
return err
}
data, topic, err := m.NewExecuteClaimEvent(contract.Caller(), args.EventNonce, args.DstChain)
data, topic, err := m.NewExecuteClaimEvent(contract.Caller(), args.EventNonce, args.Chain)
if err != nil {
return err
}
Expand All @@ -85,7 +85,7 @@ func (m *ExecuteClaimMethod) NewExecuteClaimEvent(sender common.Address, eventNo
}

func (m *ExecuteClaimMethod) PackInput(args crosschaintypes.ExecuteClaimArgs) ([]byte, error) {
arguments, err := m.Method.Inputs.Pack(args.DstChain, args.EventNonce)
arguments, err := m.Method.Inputs.Pack(args.Chain, args.EventNonce)
if err != nil {
return nil, err
}
Expand Down
6 changes: 3 additions & 3 deletions x/crosschain/precompile/execute_claim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ import (
func TestExecuteClaimMethod_ABI(t *testing.T) {
executeClaim := precompile.NewExecuteClaimMethod(nil)

methodStr := `function executeClaim(string _dstChainId, uint256 _eventNonce) returns(bool _result)`
methodStr := `function executeClaim(string _chain, uint256 _eventNonce) returns(bool _result)`
assert.Equal(t, methodStr, executeClaim.Method.String())

eventStr := `event ExecuteClaimEvent(address indexed _sender, uint256 _eventNonce, string _dstChain)`
eventStr := `event ExecuteClaimEvent(address indexed _sender, uint256 _eventNonce, string _chain)`
assert.Equal(t, eventStr, executeClaim.Event.String())
}

func TestExecuteClaimMethod_PackInput(t *testing.T) {
executeClaim := precompile.NewExecuteClaimMethod(nil)
input, err := executeClaim.PackInput(types.ExecuteClaimArgs{
DstChain: ethtypes.ModuleName,
Chain: ethtypes.ModuleName,
EventNonce: big.NewInt(1),
})
assert.NoError(t, err)
Expand Down
4 changes: 2 additions & 2 deletions x/crosschain/types/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,12 @@ func (args *AddPendingPoolRewardArgs) Validate() error {
}

type ExecuteClaimArgs struct {
DstChain string `abi:"_dstChainId"`
Chain string `abi:"_chain"`
EventNonce *big.Int `abi:"_eventNonce"`
}

func (args *ExecuteClaimArgs) Validate() error {
if err := ValidateModuleName(args.DstChain); err != nil {
if err := ValidateModuleName(args.Chain); err != nil {
return err
}
if args.EventNonce == nil || args.EventNonce.Sign() <= 0 {
Expand Down

0 comments on commit 156326f

Please sign in to comment.