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

fix(std): add full denom in banker issue & remove coin #3239

Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
308ba23
feat: expect full denom in issue & remove coins + add RealmDenom func…
MikaelVallenet Nov 28, 2024
d9692ab
feat: expect full denom in issue & remove coins + add RealmDenom func…
MikaelVallenet Nov 28, 2024
3f26af8
fix: enhance panic messages
MikaelVallenet Nov 28, 2024
f9aab75
fix: test
MikaelVallenet Nov 28, 2024
1d700f6
Merge branch 'master' into dev/mikaelvallenet/feat/full-denom-banker-…
MikaelVallenet Nov 28, 2024
1b90a88
fix: test
MikaelVallenet Nov 28, 2024
8ab1cc3
fix: add gas wanted in test since stdlib got bigger
MikaelVallenet Nov 28, 2024
54bc8c0
fix: tests
MikaelVallenet Nov 28, 2024
2d734e8
fix: tests
MikaelVallenet Nov 28, 2024
b1a9b8b
fix: tests
MikaelVallenet Nov 28, 2024
f2c3ed1
fix: fix regex by adding starting & ending char + add tests
MikaelVallenet Nov 29, 2024
de1d78b
fix: test
MikaelVallenet Nov 29, 2024
9c14a1f
fix: refactor assertDenom to follow DRY principles
MikaelVallenet Nov 29, 2024
6f14ce0
Merge branch 'master' into dev/mikaelvallenet/feat/full-denom-banker-…
MikaelVallenet Nov 29, 2024
daf9d8e
chore: rename denom functions
MikaelVallenet Dec 2, 2024
4e4f3e9
chore: update error message with new functions names
MikaelVallenet Dec 2, 2024
714fca3
chore: update error message with new functions names
MikaelVallenet Dec 2, 2024
6c26042
Merge branch 'master' into dev/mikaelvallenet/feat/full-denom-banker-…
MikaelVallenet Dec 2, 2024
fae0a3a
docs: update doc with new informations
MikaelVallenet Dec 2, 2024
a9fe4d5
docs: lint add newline at end of the file
MikaelVallenet Dec 2, 2024
f725991
fix: gno test update output expected
MikaelVallenet Dec 2, 2024
42c8434
Merge branch 'master' into dev/mikaelvallenet/feat/full-denom-banker-…
MikaelVallenet Dec 3, 2024
2dcd479
Merge branch 'master' of github.com:gnolang/gno into dev/mikaelvallen…
thehowl Dec 7, 2024
8de2b22
Merge branch 'master' into dev/mikaelvallenet/feat/full-denom-banker-…
MikaelVallenet Dec 9, 2024
903e06e
fix: revert denom nomenclature & add helper function instead of regexp
MikaelVallenet Dec 9, 2024
efb8a38
docs: use term qualified documentation and move function into realm s…
MikaelVallenet Dec 9, 2024
6616158
docs: adapt to new nomenclature
MikaelVallenet Dec 9, 2024
f59f49e
docs: fix forgotten mistake
MikaelVallenet Dec 9, 2024
0cafb10
fix: remove unused regexp
MikaelVallenet Dec 9, 2024
d8c18c5
test: fix
MikaelVallenet Dec 9, 2024
d68ef0d
test: fix
MikaelVallenet Dec 9, 2024
70ec4da
Update gnovm/stdlibs/std/frame.gno
thehowl Dec 10, 2024
7c6ceb6
Update docs/reference/stdlibs/std/banker.md
thehowl Dec 10, 2024
3e491eb
fixup
thehowl Dec 10, 2024
78f8d3a
Merge branch 'master' of github.com:gnolang/gno into dev/mikaelvallen…
thehowl Dec 10, 2024
7e81bcb
fixup error message
thehowl Dec 10, 2024
c05e445
feat: change naming to CoinDenom
MikaelVallenet Dec 12, 2024
437e1b3
docs: format
MikaelVallenet Dec 12, 2024
e2cd2e7
docs: format
MikaelVallenet Dec 12, 2024
63d820d
docs: format
MikaelVallenet Dec 12, 2024
b4edafd
Merge branch 'master' into dev/mikaelvallenet/feat/full-denom-banker-…
MikaelVallenet Dec 12, 2024
3f50ba6
Update docs/reference/stdlibs/std/chain.md
MikaelVallenet Dec 12, 2024
f58aba5
Update docs/reference/stdlibs/std/realm.md
MikaelVallenet Dec 12, 2024
fec2919
Update docs/reference/stdlibs/std/realm.md
MikaelVallenet Dec 12, 2024
12be379
Update docs/reference/stdlibs/std/chain.md
MikaelVallenet Dec 12, 2024
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
3 changes: 3 additions & 0 deletions docs/reference/stdlibs/std/banker.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ Returns `Banker` of the specified type.
```go
banker := std.GetBanker(std.<BankerType>)
```

⚠️ Methods of `Banker` expect qualified denomination of the coins, [see more here](#realm.md#realmdenom).
thehowl marked this conversation as resolved.
Show resolved Hide resolved

---

## GetCoins
Expand Down
31 changes: 31 additions & 0 deletions docs/reference/stdlibs/std/realm.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type Realm struct {
func (r Realm) Addr() Address {...}
func (r Realm) PkgPath() string {...}
func (r Realm) IsUser() bool {...}
func (r Realm) Denom(denom string) string {...}
```

## Addr
Expand All @@ -39,3 +40,33 @@ Checks if the realm it was called upon is a user realm.
```go
if r.IsUser() {...}
```

## Denom
Composes a qualified denomination string from the realm's pkg path and the provided base denomination. e.g `/gno.land/r/demo/blog:ugnot`. This method should be used when interacting with the `Banker` interface.
leohhhn marked this conversation as resolved.
Show resolved Hide resolved

#### Parameters
- `denom` **string** - The base denomination used to build the qualified denomination. Must start with a lowercase letter, followed by 2–15 lowercase letters or digits.

#### Usage
```go
denom := r.Denom("ugnot")
```

---

## RealmDenom
```go
func RealmDenom(pkgPath, denom string) string
```
leohhhn marked this conversation as resolved.
Show resolved Hide resolved

Composes a qualified denomination string from the realm's pkg path and the provided base denomination. e.g `/gno.land/r/demo/blog:ugnot`. This method should be used when interacting with the `Banker` interface. It can also be used as a method of the `Realm` object, see [Realm.Denom](realm.md#denom).

#### Parameters
- `pkgPath` **string** - package path of the realm
- `denom` **string** - The base denomination used to build the qualified denomination. Must start with a lowercase letter, followed by 2–15 lowercase letters or digits.

#### Usage
```go
denom := std.RealmDenom("gno.land/r/demo/blog", "ugnot")
```

40 changes: 20 additions & 20 deletions gno.land/cmd/gnoland/testdata/assertorigincall.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -33,85 +33,85 @@ gnoland start

# Test cases
## 1. MsgCall -> myrlm.A: PANIC
! gnokey maketx call -pkgpath gno.land/r/myrlm -func A -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1
! gnokey maketx call -pkgpath gno.land/r/myrlm -func A -gas-fee 100000ugnot -gas-wanted 5000000 -broadcast -chainid tendermint_test test1
stderr 'invalid non-origin call'

## 2. MsgCall -> myrlm.B: PASS
gnokey maketx call -pkgpath gno.land/r/myrlm -func B -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1
gnokey maketx call -pkgpath gno.land/r/myrlm -func B -gas-fee 100000ugnot -gas-wanted 5000000 -broadcast -chainid tendermint_test test1
stdout 'OK!'

## 3. MsgCall -> myrlm.C: PASS
gnokey maketx call -pkgpath gno.land/r/myrlm -func C -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1
gnokey maketx call -pkgpath gno.land/r/myrlm -func C -gas-fee 100000ugnot -gas-wanted 5000000 -broadcast -chainid tendermint_test test1
stdout 'OK!'

## 4. MsgCall -> r/foo.A -> myrlm.A: PANIC
! gnokey maketx call -pkgpath gno.land/r/foo -func A -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1
! gnokey maketx call -pkgpath gno.land/r/foo -func A -gas-fee 100000ugnot -gas-wanted 5000000 -broadcast -chainid tendermint_test test1
stderr 'invalid non-origin call'

## 5. MsgCall -> r/foo.B -> myrlm.B: PASS
gnokey maketx call -pkgpath gno.land/r/foo -func B -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1
gnokey maketx call -pkgpath gno.land/r/foo -func B -gas-fee 100000ugnot -gas-wanted 5000000 -broadcast -chainid tendermint_test test1
stdout 'OK!'

## 6. MsgCall -> r/foo.C -> myrlm.C: PANIC
! gnokey maketx call -pkgpath gno.land/r/foo -func C -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1
! gnokey maketx call -pkgpath gno.land/r/foo -func C -gas-fee 100000ugnot -gas-wanted 5000000 -broadcast -chainid tendermint_test test1
stderr 'invalid non-origin call'

## remove due to update to maketx call can only call realm (case 7,8,9)
## 7. MsgCall -> p/demo/bar.A: PANIC
## ! gnokey maketx call -pkgpath gno.land/p/demo/bar -func A -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1
## ! gnokey maketx call -pkgpath gno.land/p/demo/bar -func A -gas-fee 100000ugnot -gas-wanted 5000000 -broadcast -chainid tendermint_test test1
## stderr 'invalid non-origin call'

## 8. MsgCall -> p/demo/bar.B: PASS
## gnokey maketx call -pkgpath gno.land/p/demo/bar -func B -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1
## gnokey maketx call -pkgpath gno.land/p/demo/bar -func B -gas-fee 100000ugnot -gas-wanted 5000000 -broadcast -chainid tendermint_test test1
## stdout 'OK!'

## 9. MsgCall -> p/demo/bar.C: PANIC
## ! gnokey maketx call -pkgpath gno.land/p/demo/bar -func C -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1
## ! gnokey maketx call -pkgpath gno.land/p/demo/bar -func C -gas-fee 100000ugnot -gas-wanted 5000000 -broadcast -chainid tendermint_test test1
## stderr 'invalid non-origin call'

## 10. MsgRun -> run.main -> myrlm.A: PANIC
! gnokey maketx run -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1 $WORK/run/myrlmA.gno
! gnokey maketx run -gas-fee 100000ugnot -gas-wanted 5000000 -broadcast -chainid tendermint_test test1 $WORK/run/myrlmA.gno
stderr 'invalid non-origin call'

## 11. MsgRun -> run.main -> myrlm.B: PASS
gnokey maketx run -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1 $WORK/run/myrlmB.gno
gnokey maketx run -gas-fee 100000ugnot -gas-wanted 5000000 -broadcast -chainid tendermint_test test1 $WORK/run/myrlmB.gno
stdout 'OK!'

## 12. MsgRun -> run.main -> myrlm.C: PANIC
! gnokey maketx run -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1 $WORK/run/myrlmC.gno
! gnokey maketx run -gas-fee 100000ugnot -gas-wanted 5000000 -broadcast -chainid tendermint_test test1 $WORK/run/myrlmC.gno
stderr 'invalid non-origin call'

## 13. MsgRun -> run.main -> foo.A: PANIC
! gnokey maketx run -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1 $WORK/run/fooA.gno
! gnokey maketx run -gas-fee 100000ugnot -gas-wanted 5000000 -broadcast -chainid tendermint_test test1 $WORK/run/fooA.gno
stderr 'invalid non-origin call'

## 14. MsgRun -> run.main -> foo.B: PASS
gnokey maketx run -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1 $WORK/run/fooB.gno
gnokey maketx run -gas-fee 100000ugnot -gas-wanted 5000000 -broadcast -chainid tendermint_test test1 $WORK/run/fooB.gno
stdout 'OK!'

## 15. MsgRun -> run.main -> foo.C: PANIC
! gnokey maketx run -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1 $WORK/run/fooC.gno
! gnokey maketx run -gas-fee 100000ugnot -gas-wanted 5000000 -broadcast -chainid tendermint_test test1 $WORK/run/fooC.gno
stderr 'invalid non-origin call'

## 16. MsgRun -> run.main -> bar.A: PANIC
! gnokey maketx run -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1 $WORK/run/barA.gno
! gnokey maketx run -gas-fee 100000ugnot -gas-wanted 5000000 -broadcast -chainid tendermint_test test1 $WORK/run/barA.gno
stderr 'invalid non-origin call'

## 17. MsgRun -> run.main -> bar.B: PASS
gnokey maketx run -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1 $WORK/run/barB.gno
gnokey maketx run -gas-fee 100000ugnot -gas-wanted 5000000 -broadcast -chainid tendermint_test test1 $WORK/run/barB.gno
stdout 'OK!'

## 18. MsgRun -> run.main -> bar.C: PANIC
! gnokey maketx run -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1 $WORK/run/barC.gno
! gnokey maketx run -gas-fee 100000ugnot -gas-wanted 5000000 -broadcast -chainid tendermint_test test1 $WORK/run/barC.gno
stderr 'invalid non-origin call'

## remove testcase 19 due to maketx call forced to call a realm
## 19. MsgCall -> std.AssertOriginCall: pass
## gnokey maketx call -pkgpath std -func AssertOriginCall -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1
## gnokey maketx call -pkgpath std -func AssertOriginCall -gas-fee 100000ugnot -gas-wanted 5000000 -broadcast -chainid tendermint_test test1
## stdout 'OK!'

## 20. MsgRun -> std.AssertOriginCall: PANIC
! gnokey maketx run -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1 $WORK/run/baz.gno
! gnokey maketx run -gas-fee 100000ugnot -gas-wanted 5000000 -broadcast -chainid tendermint_test test1 $WORK/run/baz.gno
stderr 'invalid non-origin call'


Expand Down
8 changes: 4 additions & 4 deletions gno.land/cmd/gnoland/testdata/grc20_registry.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ loadpkg gno.land/r/registry $WORK/registry
gnoland start

# we call Transfer with foo20, before it's registered
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 4000000 -broadcast -chainid=tendermint_test test1
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 5000000 -broadcast -chainid=tendermint_test test1
stdout 'not found'

# add foo20, and foo20wrapper
gnokey maketx addpkg -pkgdir $WORK/foo20 -pkgpath gno.land/r/foo20 -gas-fee 1000000ugnot -gas-wanted 4000000 -broadcast -chainid=tendermint_test test1
gnokey maketx addpkg -pkgdir $WORK/foo20wrapper -pkgpath gno.land/r/foo20wrapper -gas-fee 1000000ugnot -gas-wanted 4000000 -broadcast -chainid=tendermint_test test1
gnokey maketx addpkg -pkgdir $WORK/foo20 -pkgpath gno.land/r/foo20 -gas-fee 1000000ugnot -gas-wanted 5000000 -broadcast -chainid=tendermint_test test1
gnokey maketx addpkg -pkgdir $WORK/foo20wrapper -pkgpath gno.land/r/foo20wrapper -gas-fee 1000000ugnot -gas-wanted 5000000 -broadcast -chainid=tendermint_test test1

# we call Transfer with foo20, after it's registered
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 4000000 -broadcast -chainid=tendermint_test test1
gnokey maketx call -pkgpath gno.land/r/registry -func TransferByName -args 'foo20' -args 'g123456789' -args '42' -gas-fee 1000000ugnot -gas-wanted 5000000 -broadcast -chainid=tendermint_test test1
stdout 'same address, success!'

-- registry/registry.gno --
Expand Down
22 changes: 11 additions & 11 deletions gno.land/cmd/gnoland/testdata/prevrealm.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ env RFOO_ADDR=g1evezrh92xaucffmtgsaa3rvmz5s8kedffsg469

# Test cases
## 1. MsgCall -> myrlm.A: user address
gnokey maketx call -pkgpath gno.land/r/myrlm -func A -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1
gnokey maketx call -pkgpath gno.land/r/myrlm -func A -gas-fee 100000ugnot -gas-wanted 5000000 -broadcast -chainid tendermint_test test1
stdout ${USER_ADDR_test1}

## 2. MsgCall -> myrealm.B -> myrlm.A: user address
gnokey maketx call -pkgpath gno.land/r/myrlm -func B -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1
gnokey maketx call -pkgpath gno.land/r/myrlm -func B -gas-fee 100000ugnot -gas-wanted 5000000 -broadcast -chainid tendermint_test test1
stdout ${USER_ADDR_test1}

## 3. MsgCall -> r/foo.A -> myrlm.A: r/foo
gnokey maketx call -pkgpath gno.land/r/foo -func A -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1
gnokey maketx call -pkgpath gno.land/r/foo -func A -gas-fee 100000ugnot -gas-wanted 5000000 -broadcast -chainid tendermint_test test1
stdout ${RFOO_ADDR}

## 4. MsgCall -> r/foo.B -> myrlm.B -> r/foo.A: r/foo
gnokey maketx call -pkgpath gno.land/r/foo -func B -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1
gnokey maketx call -pkgpath gno.land/r/foo -func B -gas-fee 100000ugnot -gas-wanted 5000000 -broadcast -chainid tendermint_test test1
stdout ${RFOO_ADDR}

## remove due to update to maketx call can only call realm (case 5, 6, 13)
Expand All @@ -59,35 +59,35 @@ stdout ${RFOO_ADDR}
## stdout ${USER_ADDR_test1}

## 7. MsgRun -> myrlm.A: user address
gnokey maketx run -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1 $WORK/run/myrlmA.gno
gnokey maketx run -gas-fee 100000ugnot -gas-wanted 5000000 -broadcast -chainid tendermint_test test1 $WORK/run/myrlmA.gno
stdout ${USER_ADDR_test1}

## 8. MsgRun -> myrealm.B -> myrlm.A: user address
gnokey maketx run -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1 $WORK/run/myrlmB.gno
gnokey maketx run -gas-fee 100000ugnot -gas-wanted 5000000 -broadcast -chainid tendermint_test test1 $WORK/run/myrlmB.gno
stdout ${USER_ADDR_test1}

## 9. MsgRun -> r/foo.A -> myrlm.A: r/foo
gnokey maketx run -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1 $WORK/run/fooA.gno
gnokey maketx run -gas-fee 100000ugnot -gas-wanted 5000000 -broadcast -chainid tendermint_test test1 $WORK/run/fooA.gno
stdout ${RFOO_ADDR}

## 10. MsgRun -> r/foo.B -> myrlm.B -> r/foo.A: r/foo
gnokey maketx run -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1 $WORK/run/fooB.gno
gnokey maketx run -gas-fee 100000ugnot -gas-wanted 5000000 -broadcast -chainid tendermint_test test1 $WORK/run/fooB.gno
stdout ${RFOO_ADDR}

## 11. MsgRun -> p/demo/bar.A: user address
gnokey maketx run -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1 $WORK/run/barA.gno
gnokey maketx run -gas-fee 100000ugnot -gas-wanted 5000000 -broadcast -chainid tendermint_test test1 $WORK/run/barA.gno
stdout ${USER_ADDR_test1}

## 12. MsgRun -> p/demo/bar.B: user address
gnokey maketx run -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1 $WORK/run/barB.gno
gnokey maketx run -gas-fee 100000ugnot -gas-wanted 5000000 -broadcast -chainid tendermint_test test1 $WORK/run/barB.gno
stdout ${USER_ADDR_test1}

## 13. MsgCall -> std.PrevRealm(): user address
## gnokey maketx call -pkgpath std -func PrevRealm -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1
## stdout ${USER_ADDR_test1}

## 14. MsgRun -> std.PrevRealm(): user address
gnokey maketx run -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1 $WORK/run/baz.gno
gnokey maketx run -gas-fee 100000ugnot -gas-wanted 5000000 -broadcast -chainid tendermint_test test1 $WORK/run/baz.gno
stdout ${USER_ADDR_test1}

-- r/myrlm/myrlm.gno --
Expand Down
40 changes: 38 additions & 2 deletions gno.land/cmd/gnoland/testdata/realm_banker_issued_coin_denom.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ gnokey maketx addpkg -pkgdir $WORK/short -pkgpath gno.land/r/test/realm_banker -
## add realm_banker with long package_name
gnokey maketx addpkg -pkgdir $WORK/long -pkgpath gno.land/r/test/package89_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_1234567890 -gas-fee 1000000ugnot -gas-wanted 100000000 -broadcast -chainid=tendermint_test test1

## add invalid realm_denom
gnokey maketx addpkg -pkgdir $WORK/invalid_realm_denom -pkgpath gno.land/r/test/invalid_realm_denom -gas-fee 1000000ugnot -gas-wanted 100000000 -broadcast -chainid=tendermint_test test1

## test2 spend all balance
gnokey maketx send -send "9999999ugnot" -to g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5 -gas-fee 1ugnot -gas-wanted 10000000 -broadcast -chainid=tendermint_test test2

Expand Down Expand Up @@ -52,6 +55,22 @@ gnokey maketx call -pkgpath gno.land/r/test/package89_123456789_123456789_123456
gnokey query bank/balances/g1cq2ecdq3eyn5qa0fzznpurg87zq3k77g63q6u7
stdout '"100/gno.land/r/test/package89_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_1234567890:ugnot"'

## mint invalid base denom
! gnokey maketx call -pkgpath gno.land/r/test/realm_banker -func Mint -args "g1cq2ecdq3eyn5qa0fzznpurg87zq3k77g63q6u7" -args "2gnot" -args "100" -gas-fee 1000000ugnot -gas-wanted 10000000 -broadcast -chainid=tendermint_test test1
stderr 'cannot issue coins with invalid denom base name, it should start by a lowercase letter and be followed by 2-15 lowercase letters or digits'

## burn invalid base denom
! gnokey maketx call -pkgpath gno.land/r/test/realm_banker -func Burn -args "g1cq2ecdq3eyn5qa0fzznpurg87zq3k77g63q6u7" -args "2gnot" -args "100" -gas-fee 1000000ugnot -gas-wanted 10000000 -broadcast -chainid=tendermint_test test1
stderr 'cannot issue coins with invalid denom base name, it should start by a lowercase letter and be followed by 2-15 lowercase letters or digits'

## mint invalid realm denom
! gnokey maketx call -pkgpath gno.land/r/test/invalid_realm_denom -func Mint -args "g1cq2ecdq3eyn5qa0fzznpurg87zq3k77g63q6u7" -args "ugnot" -args "100" -gas-fee 1000000ugnot -gas-wanted 10000000 -broadcast -chainid=tendermint_test test1
stderr 'cannot issue coins with denom not prefixed by: / \+ std.CurrentRealm\(\).PkgPath\(\) \+ :'

## burn invalid realm denom
! gnokey maketx call -pkgpath gno.land/r/test/invalid_realm_denom -func Burn -args "g1cq2ecdq3eyn5qa0fzznpurg87zq3k77g63q6u7" -args "ugnot" -args "100" -gas-fee 1000000ugnot -gas-wanted 10000000 -broadcast -chainid=tendermint_test test1
stderr 'cannot issue coins with denom not prefixed by: / \+ std.CurrentRealm\(\).PkgPath\(\) \+ :'

-- short/realm_banker.gno --
package realm_banker

Expand All @@ -61,12 +80,12 @@ import (

func Mint(addr std.Address, denom string, amount int64) {
banker := std.GetBanker(std.BankerTypeRealmIssue)
banker.IssueCoin(addr, denom, amount)
banker.IssueCoin(addr, std.CurrentRealm().Denom(denom), amount)
thehowl marked this conversation as resolved.
Show resolved Hide resolved
}

func Burn(addr std.Address, denom string, amount int64) {
banker := std.GetBanker(std.BankerTypeRealmIssue)
banker.RemoveCoin(addr, denom, amount)
banker.RemoveCoin(addr, std.CurrentRealm().Denom(denom), amount)
}

-- long/realm_banker.gno --
Expand All @@ -77,6 +96,23 @@ import (
"std"
)

func Mint(addr std.Address, denom string, amount int64) {
banker := std.GetBanker(std.BankerTypeRealmIssue)
banker.IssueCoin(addr, std.CurrentRealm().Denom(denom), amount)
}

func Burn(addr std.Address, denom string, amount int64) {
banker := std.GetBanker(std.BankerTypeRealmIssue)
banker.RemoveCoin(addr, std.CurrentRealm().Denom(denom), amount)
}

-- invalid_realm_denom/realm_banker.gno --
package invalid_realm_denom

import (
"std"
)

func Mint(addr std.Address, denom string, amount int64) {
banker := std.GetBanker(std.BankerTypeRealmIssue)
banker.IssueCoin(addr, denom, amount)
Expand Down
14 changes: 7 additions & 7 deletions gno.land/pkg/gnoclient/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func TestCallSingle_Integration(t *testing.T) {
// Make Tx config
baseCfg := BaseTxCfg{
GasFee: ugnot.ValueString(10000),
GasWanted: 8000000,
GasWanted: 9000000,
AccountNumber: 0,
SequenceNumber: 0,
Memo: "",
Expand Down Expand Up @@ -93,7 +93,7 @@ func TestCallMultiple_Integration(t *testing.T) {
// Make Tx config
baseCfg := BaseTxCfg{
GasFee: ugnot.ValueString(10000),
GasWanted: 8000000,
GasWanted: 9000000,
AccountNumber: 0,
SequenceNumber: 0,
Memo: "",
Expand Down Expand Up @@ -155,7 +155,7 @@ func TestSendSingle_Integration(t *testing.T) {
// Make Tx config
baseCfg := BaseTxCfg{
GasFee: ugnot.ValueString(10000),
GasWanted: 8000000,
GasWanted: 9000000,
AccountNumber: 0,
SequenceNumber: 0,
Memo: "",
Expand Down Expand Up @@ -219,7 +219,7 @@ func TestSendMultiple_Integration(t *testing.T) {
// Make Tx config
baseCfg := BaseTxCfg{
GasFee: ugnot.ValueString(10000),
GasWanted: 8000000,
GasWanted: 9000000,
AccountNumber: 0,
SequenceNumber: 0,
Memo: "",
Expand Down Expand Up @@ -291,7 +291,7 @@ func TestRunSingle_Integration(t *testing.T) {
// Make Tx config
baseCfg := BaseTxCfg{
GasFee: ugnot.ValueString(10000),
GasWanted: 8000000,
GasWanted: 9000000,
AccountNumber: 0,
SequenceNumber: 0,
Memo: "",
Expand Down Expand Up @@ -452,7 +452,7 @@ func TestAddPackageSingle_Integration(t *testing.T) {
// Make Tx config
baseCfg := BaseTxCfg{
GasFee: ugnot.ValueString(10000),
GasWanted: 8000000,
GasWanted: 9000000,
AccountNumber: 0,
SequenceNumber: 0,
Memo: "",
Expand Down Expand Up @@ -537,7 +537,7 @@ func TestAddPackageMultiple_Integration(t *testing.T) {
// Make Tx config
baseCfg := BaseTxCfg{
GasFee: ugnot.ValueString(10000),
GasWanted: 8000000,
GasWanted: 9000000,
AccountNumber: 0,
SequenceNumber: 0,
Memo: "",
Expand Down
Loading
Loading