8
8
teleportermessenger "github.com/ava-labs/teleporter/abi-bindings/go/Teleporter/TeleporterMessenger"
9
9
"github.com/ava-labs/teleporter/tests/network"
10
10
"github.com/ava-labs/teleporter/tests/utils"
11
+ localUtils "github.com/ava-labs/teleporter/tests/utils/local-network-utils"
11
12
"github.com/ethereum/go-ethereum/common"
12
13
. "github.com/onsi/gomega"
13
14
)
@@ -25,19 +26,36 @@ func BasicSendReceive(network network.Network) {
25
26
subnets := network .GetSubnetsInfo ()
26
27
subnetAInfo := subnets [0 ]
27
28
subnetBInfo := subnets [1 ]
29
+ teleporterContractAddress := network .GetTeleporterContractAddress ()
28
30
fundedAddress , fundedKey := network .GetFundedAccountInfo ()
29
31
30
32
//
31
33
// Send a transaction to Subnet A to issue a Warp Message from the Teleporter contract to Subnet B
32
34
//
33
35
ctx := context .Background ()
34
36
37
+ feeAmount := big .NewInt (1 )
38
+ feeTokenAddress , feeToken := localUtils .DeployExampleERC20 (
39
+ ctx ,
40
+ fundedKey ,
41
+ subnetAInfo ,
42
+ )
43
+ localUtils .ExampleERC20Approve (
44
+ ctx ,
45
+ feeToken ,
46
+ teleporterContractAddress ,
47
+ big .NewInt (0 ).Mul (big .NewInt (1e18 ),
48
+ big .NewInt (10 )),
49
+ subnetAInfo ,
50
+ fundedKey ,
51
+ )
52
+
35
53
sendCrossChainMessageInput := teleportermessenger.TeleporterMessageInput {
36
54
DestinationChainID : subnetBInfo .BlockchainID ,
37
55
DestinationAddress : fundedAddress ,
38
56
FeeInfo : teleportermessenger.TeleporterFeeInfo {
39
- FeeTokenAddress : fundedAddress ,
40
- Amount : big . NewInt ( 0 ) ,
57
+ FeeTokenAddress : feeTokenAddress ,
58
+ Amount : feeAmount ,
41
59
},
42
60
RequiredGasLimit : big .NewInt (1 ),
43
61
AllowedRelayerAddresses : []common.Address {},
@@ -71,7 +89,9 @@ func BasicSendReceive(network network.Network) {
71
89
//
72
90
// Send a transaction to Subnet B to issue a Warp Message from the Teleporter contract to Subnet A
73
91
//
92
+
74
93
sendCrossChainMessageInput .DestinationChainID = subnetAInfo .BlockchainID
94
+ sendCrossChainMessageInput .FeeInfo .Amount = big .NewInt (0 )
75
95
receipt , teleporterMessageID = utils .SendCrossChainMessageAndWaitForAcceptance (
76
96
ctx ,
77
97
subnetBInfo ,
@@ -94,4 +114,8 @@ func BasicSendReceive(network network.Network) {
94
114
)
95
115
Expect (err ).Should (BeNil ())
96
116
Expect (delivered ).Should (BeTrue ())
117
+
118
+ utils .RedeemRelayerRewardsAndConfirm (
119
+ ctx , subnetAInfo , feeToken , feeTokenAddress , fundedKey , feeAmount ,
120
+ )
97
121
}
0 commit comments