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

refactor(contract): IBridgeCallback to IBridgeCallContext #830

Merged
merged 1 commit into from
Dec 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contract/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ echo "===> Compiling contracts"
[[ ! -d "$project_dir/contract/artifacts" ]] && mkdir -p "$project_dir/contract/artifacts"

contracts=(WFXUpgradable FIP20Upgradable IStaking IError ERC1967Proxy)
contracts+=(IFxBridgeLogic IBridgeCallback ICrosschain)
contracts+=(IFxBridgeLogic IBridgeCallContext ICrosschain)
contracts+=(BridgeFeeQuote BridgeFeeOracle BridgeProxy)
contracts+=(CrosschainTest StakingTest ERC721TokenTest)

Expand Down
10 changes: 5 additions & 5 deletions contract/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ var (
Code: []byte{},
}

fxBridgeABI = MustABIJson(IFxBridgeLogicMetaData.ABI)
bridgeCallbackABI = MustABIJson(IBridgeCallbackMetaData.ABI)
errorABI = MustABIJson(IErrorMetaData.ABI)
fxBridgeABI = MustABIJson(IFxBridgeLogicMetaData.ABI)
bridgeCallContextABI = MustABIJson(IBridgeCallContextMetaData.ABI)
errorABI = MustABIJson(IErrorMetaData.ABI)
)

type Caller interface {
Expand Down Expand Up @@ -136,8 +136,8 @@ func PackRetErrV2(err error) ([]byte, error) {
return pack, err
}

func PackBridgeCallback(sender, receiver common.Address, tokens []common.Address, amounts []*big.Int, data, memo []byte) ([]byte, error) {
return bridgeCallbackABI.Pack("bridgeCallback",
func PackOnBridgeCall(sender, receiver common.Address, tokens []common.Address, amounts []*big.Int, data, memo []byte) ([]byte, error) {
return bridgeCallContextABI.Pack("onBridgeCall",
sender,
receiver,
tokens,
Expand Down
4 changes: 2 additions & 2 deletions contract/contract_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ func TestPackBridgeCallback(t *testing.T) {
// memo string
memo: common.Hex2Bytes("6d656d6f00000000000000000000000000000000000000000000000000000000"),
},
expected: "139975660000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006423b872dd000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000206d656d6f00000000000000000000000000000000000000000000000000000000",
expected: "57ffc0920000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006423b872dd000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000206d656d6f00000000000000000000000000000000000000000000000000000000",
err: nil,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
result, err := contract.PackBridgeCallback(tt.args.sender, tt.args.receiver, tt.args._tokens, tt.args._amounts, tt.args.data, tt.args.memo)
result, err := contract.PackOnBridgeCall(tt.args.sender, tt.args.receiver, tt.args._tokens, tt.args._amounts, tt.args.data, tt.args.memo)
if tt.err != nil {
require.Error(t, err)
require.EqualValues(t, tt.err.Error(), err.Error())
Expand Down
223 changes: 223 additions & 0 deletions contract/ibridge_call_context.sol.go

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

Loading
Loading