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: avalanche end-to-end tests #1174

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
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
46 changes: 46 additions & 0 deletions chain/avalanche/abi.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package avalanche

import (
_ "embed"
"math/big"

"github.com/ava-labs/coreth/precompile/contract"
)

var (
//go:embed abi.json
rawABI string

abi = contract.ParseABI(rawABI)
)

type Height struct {
RevisionNumber *big.Int
RevisionHeight *big.Int
}

type MsgSendPacket struct {
ChannelCapability *big.Int
SourcePort string
SourceChannel string
TimeoutHeight Height
TimeoutTimestamp *big.Int
Data []byte
}

type FungibleTokenPacketData struct {
// the token denomination to be transferred
Denom string `json:"denom"`
// the token amount to be transferred
Amount string `json:"amount"`
// the sender address
Sender string `json:"sender"`
// the recipient address on the destination chain
Receiver string `json:"receiver"`
// optional memo
Memo string `json:"memo,omitempty"`
}

func packSendPacket(msg MsgSendPacket) ([]byte, error) {
return abi.Pack("sendPacket", msg.ChannelCapability, msg.SourcePort, msg.SourceChannel, msg.TimeoutHeight, msg.TimeoutTimestamp, msg.Data)
}
50 changes: 50 additions & 0 deletions chain/avalanche/abi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[{
"inputs": [
{
"internalType": "uint256",
"name": "channelCapability",
"type": "uint256"
},
{
"internalType": "string",
"name": "sourcePort",
"type": "string"
},
{
"internalType": "string",
"name": "sourceChannel",
"type": "string"
},
{
"components": [
{
"internalType": "uint256",
"name": "revisionNumber",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "revisionHeight",
"type": "uint256"
}
],
"internalType": "struct Height",
"name": "timeoutHeight",
"type": "tuple"
},
{
"internalType": "uint256",
"name": "timeoutTimestamp",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "sendPacket",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}]
Loading
Loading