z5d_transfer_filetest.gno
1.35 Kb · 37 lines
1// PKGPATH: gno.land/r/aib/main
2package main
3
4import (
5 "testing"
6 "time"
7
8 tmtesting "gno.land/p/aib/ibc/lightclient/tendermint/testing"
9 "gno.land/p/aib/ibc/types"
10
11 "gno.land/r/aib/ibc/apps/testing/grc20test"
12 "gno.land/r/aib/ibc/apps/transfer"
13 "gno.land/r/aib/ibc/core"
14)
15
16// TransferGRC20: no approval (insufficient allowance)
17func main(cur realm) {
18 var (
19 chainID = "chain-id-2"
20 clientState = tmtesting.NewClientState(chainID, types.NewHeight(2, 2))
21 apphash = tmtesting.Hash("apphash")
22 trustedValset = tmtesting.GenValset()
23 consensusState = tmtesting.GenConsensusState(time.Now(), apphash, trustedValset.Hash())
24 )
25 clientID := core.CreateClient(cross(cur), clientState, consensusState)
26 core.RegisterCounterparty(cross(cur), clientID, [][]byte{[]byte("iavlStoreKey"), []byte("prefix2")}, "07-tendermint-2")
27
28 // Mint tokens but do NOT approve the transfer app
29 grc20test.Mint(cross(cur), cur.Previous().Address(), 1000)
30
31 denom := "gno.land/r/aib/ibc/apps/testing/grc20test." + grc20test.Slug
32 testing.SetRealm(testing.NewUserRealm("g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm"))
33 transfer.Transfer(cross(cur), clientID, "atone1user", denom, 100, uint64(time.Now().Add(time.Hour).Unix()), "")
34}
35
36// Error:
37// send packet failed for payload #0 app "transfer": escrow GRC20 gno.land/r/aib/ibc/apps/testing/grc20test.TEST error: insufficient allowance