Skip to content

Commit

Permalink
Draft: test relayer reward redemption
Browse files Browse the repository at this point in the history
  • Loading branch information
feuGeneA committed Nov 20, 2023
1 parent 98deca9 commit 3034b20
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/add_fee_amount.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,27 @@ func AddFeeAmount(network network.Network) {
amount, err := subnetATeleporterMessenger.CheckRelayerRewardAmount(&bind.CallOpts{}, fundedAddress, mockTokenAddress)
Expect(err).Should(BeNil())
Expect(amount).Should(Equal(additionalFeeAmount.Add(additionalFeeAmount, initFeeAmount)))

// Redeem the relayer reward amount
balanceBeforeRedemption, err := mockToken.BalanceOf(
&bind.CallOpts{}, fundedAddress,
)
Expect(err).Should(BeNil())
// TODO: figure out why the following is reverting with message
// "execution reverted: TeleporterMessenger: no reward to redeem"
transaction, err := subnetATeleporterMessenger.RedeemRelayerRewards(
&bind.TransactOpts{}, fundedAddress,
)
Expect(err).Should(BeNil())
receipt := utils.SendTransactionAndWaitForAcceptance(
ctx, subnetAInfo, transaction, true,
)
Expect(receipt.Status).Should(Equal(1))
balanceAfterRedemption, err := mockToken.BalanceOf(
&bind.CallOpts{}, fundedAddress,
)
Expect(err).Should(BeNil())
Expect(balanceAfterRedemption).Should(
Equal(big.NewInt(0).Add(balanceBeforeRedemption, amount)),
)
}

0 comments on commit 3034b20

Please sign in to comment.