Search Apps Documentation Source Content File Folder Download Copy Actions Download

z5d_transfer_filetest.gno

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