Skip to content

feat(gnovm)!: xform2 #4316

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

Open
wants to merge 183 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
183 commits
Select commit Hold shift + click to select a range
619bddb
add xform
jaekwon May 8, 2025
b6a4de8
add preprocess2 and hack lint
jaekwon May 8, 2025
dc00ab6
...
jaekwon May 8, 2025
cc0842f
refactor
jaekwon May 8, 2025
32e2e78
gnomod/lint/transpile etc
jaekwon May 10, 2025
17faaca
improve flow and documentation
jaekwon May 10, 2025
4fc804c
gimp
jaekwon May 10, 2025
77e5e28
fix multi error passthrough
jaekwon May 11, 2025
4911675
added adr/lint_transpile.md; naming fixes; lint/test works
jaekwon May 11, 2025
56b6cdb
...
jaekwon May 11, 2025
cbba489
xpiling works ish
jaekwon May 12, 2025
7cf9fc1
...
jaekwon May 12, 2025
07086ad
...
jaekwon May 12, 2025
7fcfae4
...
jaekwon May 12, 2025
ca1ebe0
...
jaekwon May 12, 2025
18159fd
fix tests/files
jaekwon May 12, 2025
cae70df
separate _test and filetest files
jaekwon May 13, 2025
f7688c5
fix tests
jaekwon May 13, 2025
f8bfd7b
fix tests
jaekwon May 13, 2025
c3ef149
fix gnovm tests; type-checking for test files work
jaekwon May 14, 2025
da16108
intermediate...
jaekwon May 15, 2025
6c37d67
intermediate...
jaekwon May 15, 2025
3bc9349
fix more tests
jaekwon May 16, 2025
48675f0
fix all file tests
jaekwon May 16, 2025
6dee37a
recursive10.gno; recursive11.gno
jaekwon May 16, 2025
40e90e3
remove spurious files from testing/base
jaekwon May 16, 2025
4f970ec
...
jaekwon May 16, 2025
36e2213
...
jaekwon May 16, 2025
fe061b5
...
jaekwon May 16, 2025
64b048a
...
jaekwon May 16, 2025
086ff7e
...
jaekwon May 16, 2025
a27e8ed
fix stdlibs/fmt test
jaekwon May 17, 2025
495f2c3
fix stdlib tests except one re: genstd
jaekwon May 18, 2025
8b2b7f2
lint.*Error -> gno.*Error
jaekwon May 18, 2025
33454fb
fix all gnovm tests; FINALLY
jaekwon May 18, 2025
113825e
gno fix
jaekwon May 19, 2025
7f280ba
fix tests related to span/location StringXXX().
jaekwon May 19, 2025
ce758b8
replaceWithDirPath -> guessFilePathLoc; reParseRecover works with Span
jaekwon May 19, 2025
1184e22
don't skip preprocessing for funclitexpr inside a func decl
jaekwon May 19, 2025
36f4f39
add two funclit tests
ltzmaxwell May 20, 2025
6dce366
check parent blocknode to ensure correct skip for funcLit
ltzmaxwell May 20, 2025
1ed62d7
fix grc20
ltzmaxwell May 20, 2025
3bac84a
fix p/moul/collection
ltzmaxwell May 20, 2025
6b39db0
fix p/moul/txlink
ltzmaxwell May 20, 2025
1743abf
fix r/demo/atomicswap
ltzmaxwell May 20, 2025
5a953fa
fix p/moul/helplink
ltzmaxwell May 20, 2025
e8c6bbc
fix r/gnoland/monit
ltzmaxwell May 20, 2025
b653d6c
fix r/gov/dao/v3/memberstore
moul May 20, 2025
a7d74e7
fix: generate missing gno.mod files
moul May 20, 2025
9d643a8
fix: p/moul/helplink
moul May 20, 2025
6aac30c
a few more simple typecheck fix
ltzmaxwell May 20, 2025
009e942
merge master
ltzmaxwell May 20, 2025
54a2a35
fix r/x/nir1218_evaluation_
ltzmaxwell May 20, 2025
427ac06
Revert "fix: generate missing gno.mod files"
moul May 20, 2025
241cbbe
fix printf usage in gno fix
moul May 20, 2025
c7bf362
Make filetests go .Check with completely separate go fileset
jaekwon May 20, 2025
85c6d69
add back .gnobuiltins.go for filetests
jaekwon May 20, 2025
0c1be82
...
jaekwon May 20, 2025
6461424
...
jaekwon May 20, 2025
8d0bf15
future-proof ATTR_PREPROCESS_SKIPPED
jaekwon May 20, 2025
14d28e8
lint and fix fixes regarding preprocessed package node and store caching
jaekwon May 21, 2025
c7763c8
chore: lint
gfanton May 20, 2025
fef0553
fix: gnoland
gfanton May 20, 2025
2b8794e
fix: gnodev
gfanton May 20, 2025
c3ed31f
fix: keeper load
gfanton May 21, 2025
86df1e0
realm interface methods; address/gnocoins/gnocoin
jaekwon May 19, 2025
f2cd251
uverse method declaration; address.String, address.IsValid
jaekwon May 19, 2025
7a56fc1
gno 0.9 runtime and fixing support
jaekwon May 20, 2025
c87057b
OpEnterCrossing; gConcreteRealmType; gAddressType methods
jaekwon May 20, 2025
1d453fa
...
jaekwon May 21, 2025
328d196
property sort normal/_test/filetests
jaekwon May 21, 2025
992923e
type-check fix examples more
jaekwon May 21, 2025
c6479fa
support both gnobuiltins.gno versions
jaekwon May 21, 2025
73189df
fix fixer
jaekwon May 21, 2025
69e7be8
fix parser; don't remove main() from filetests
jaekwon May 21, 2025
33a5bf9
begin only-filetests
jaekwon May 21, 2025
ff4f0fe
isCrossing_gno0p0 legacy
jaekwon May 21, 2025
0e4b034
validate mempackage; minor cleaning
jaekwon May 22, 2025
7248e38
mods for test/files fixing
jaekwon May 22, 2025
27813c7
RunMainMaybeCrossing; .cur; fix uverse .grealm
jaekwon May 22, 2025
2148f88
intermediate _cross_gno0p0; XXX need to disable in prod
jaekwon May 23, 2025
d904ce5
fix preparation step w/ conflicting types for 'cross'
jaekwon May 23, 2025
2e4bcda
...
jaekwon May 23, 2025
a1471b2
...
jaekwon May 23, 2025
2f3be11
fix linter _test linting
jaekwon May 23, 2025
0e1a75e
fv.IsCrossing fix; address.IsValid() fix
jaekwon May 23, 2025
81cd502
fix issue with un-preprocessed node constructed during package selectors
jaekwon May 23, 2025
65f8314
fix leon/hor test output
jaekwon May 23, 2025
b5b799c
add examples transpile
jaekwon May 23, 2025
6233864
add test files transpile (incomplete)
jaekwon May 23, 2025
b2f97f9
first attempt and deeper finding
jaekwon May 24, 2025
e96a34c
...
jaekwon May 24, 2025
c22f086
...
jaekwon May 24, 2025
6c0416a
add cur to containing function if it isn't there
jaekwon May 25, 2025
5179202
Revert "add examples transpile"
jaekwon May 25, 2025
1558f66
Revert "add test files transpile (incomplete)"
jaekwon May 25, 2025
c576e0e
support init(cur) too; fix regression in compositelit xform
jaekwon May 25, 2025
075b6ac
some cleanup; don't let parameter in Test* files.
jaekwon May 25, 2025
7e3e1e2
TestFoo(cur realm, t *testing.T)
jaekwon May 26, 2025
cfed13e
more findmore fixes; polish
jaekwon May 26, 2025
67c591b
urequire/uassert takes func(realm) too
jaekwon May 26, 2025
837a38d
Revert "urequire/uassert takes func(realm) too"
jaekwon May 26, 2025
f03e648
add examples xform
jaekwon May 26, 2025
e05ba54
urequire/uassert takes func(realm) too
jaekwon May 26, 2025
a9a176d
manual fixes
jaekwon May 26, 2025
09f075a
added failed typecheck
piux2 May 27, 2025
daed7d3
...
jaekwon May 29, 2025
32a5bc9
GetTypeExprForExpr() and GetTypeExprForPath()
jaekwon May 26, 2025
d11cc15
...
jaekwon May 29, 2025
2206454
Revert "manual fixes"
jaekwon May 29, 2025
4360a18
Revert "urequire/uassert takes func(realm) too"
jaekwon May 29, 2025
dfcf17f
Revert "add examples xform"
jaekwon May 29, 2025
96eae7c
revert crossrealm examples
jaekwon May 29, 2025
6a7e3c7
transform for interface starting
jaekwon May 29, 2025
3620d27
GetTypeDeclFor[Path|Expr]; file names are just strings; GetOriginForP…
jaekwon May 29, 2025
06cfdd8
GetNameSourceForPath; NameSource; xform interface types completely
jaekwon May 30, 2025
a8994a9
fixes for transpiler
jaekwon May 30, 2025
5c94ca8
urequire/uassert takes func(realm) too
jaekwon May 26, 2025
cf8f21c
transpile tests/files and then examples
jaekwon May 30, 2025
bd6da3a
manual fixes
jaekwon May 26, 2025
e9a4bbc
update some golden tests
jaekwon May 30, 2025
dcec7f3
fix regression in import package name blanks
jaekwon May 30, 2025
93d43b1
Revert "manual fixes"
jaekwon May 30, 2025
ba4c43e
Revert "transpile tests/files and then examples"
jaekwon May 30, 2025
aed8379
manual copy from master
jaekwon May 30, 2025
3e515dc
add fixed tests/files and then examples
jaekwon May 30, 2025
6a0866f
urequire/uassert takes func(realm) too
jaekwon May 26, 2025
d48a178
manual fixes
jaekwon May 26, 2025
5054ba9
fix zrealm_borrow0.gno
jaekwon May 30, 2025
b5059e0
Merge branch 'fix/crossrealm/xform2' of github.com:gnolang/gno into f…
thehowl May 30, 2025
b79178b
Merge branch 'master' of github.com:gnolang/gno into dev/morgan/cross…
thehowl May 30, 2025
d19a9a3
initStaticBlock on any node
jaekwon May 31, 2025
a3ab18b
fix repl; fix regx
jaekwon May 31, 2025
fff2c07
tishrei
jaekwon May 31, 2025
64df95d
comment on hebrew calendar
jaekwon May 31, 2025
d2e755b
C
jaekwon May 31, 2025
6c3bc61
improve LEAVE CALL EXPR code order; fix unknown issue *((*Foo)(&Bar{}…
jaekwon Jun 1, 2025
381f0a2
fix tests/files/zrealm_*; fix demo/tests/crossrealm*
jaekwon Jun 1, 2025
baa7995
update golden files
jaekwon Jun 1, 2025
80e0603
fix some txtar tests
jaekwon Jun 1, 2025
0163f8f
fix addpkg_domain.txtar
piux2 Jun 1, 2025
8c40ee3
fix txtar
piux2 Jun 1, 2025
ff5d361
Allow msg run without a mod file and fix txtar
piux2 Jun 1, 2025
5f57e46
add a revive testing case
piux2 Jun 1, 2025
efb5874
chore: generate files
aeddi Jun 2, 2025
bf055cd
chore: ignore files generated by go tests
aeddi Jun 2, 2025
0599ca9
chore: go mod tidy
aeddi Jun 2, 2025
fdc72b9
fix(txtar): inner gno mod
gfanton Jun 2, 2025
102f1de
fix: r/gfanton/gnomaze
aeddi Jun 2, 2025
1f66a5d
type-check mode for gno fix support; fix repl tests
jaekwon Jun 2, 2025
22afe60
avoid using switch f.(type) in uassert,due to a known issue and fixed…
piux2 Jun 2, 2025
432fdfc
allow gnokey to call public functions
piux2 Jun 3, 2025
bcffce9
verify previous realm for msg call from gnokey
piux2 Jun 3, 2025
2537ce0
fix(txtar): pkgloader
gfanton Jun 2, 2025
987f03f
wip(txtar): fmt + gno fix
gfanton Jun 3, 2025
7cb2704
fix(txtar): pkgloader
gfanton Jun 3, 2025
3e41460
chore: improve message
gfanton Jun 3, 2025
a3cdb13
fix(txtar): gas simu + assert
gfanton Jun 3, 2025
0e9bb43
wip(txtar): remove crossing ref
gfanton Jun 3, 2025
354bfae
wip(txtar): fix govdar + others
gfanton Jun 3, 2025
629a1ec
wip(txtar): prevrealm + grc20
gfanton Jun 3, 2025
de5c9ef
fix(txtar): remaining tests
gfanton Jun 3, 2025
a1f076f
fix(txtar): issue 1786
gfanton Jun 3, 2025
458a700
Merge branch 'master' of github.com:gnolang/gno into fix/crossrealm/x…
thehowl Jun 3, 2025
0db0e5c
fix(examples): various fixes
gfanton Jun 3, 2025
ea1a64b
chore(gno.land): lint
gfanton Jun 3, 2025
839477b
fixup transpile --gobuild
thehowl Jun 3, 2025
33df14c
Merge branch 'fix/crossrealm/xform2' of github.com:gnolang/gno into f…
thehowl Jun 3, 2025
9a03209
make genstd not pick up builtin
thehowl Jun 3, 2025
50f6901
fixup lint and others
thehowl Jun 3, 2025
cc072eb
gnovm lint fix
thehowl Jun 3, 2025
e65e3a9
fixup examples lint
thehowl Jun 3, 2025
9261f60
fixes for most things
thehowl Jun 3, 2025
a7654fe
Merge branch 'master' of github.com:gnolang/gno into fix/crossrealm/x…
thehowl Jun 3, 2025
e9cf32f
fix(gno.land): vm test
gfanton Jun 3, 2025
b4783f1
fixed vm file test and txtar
piux2 Jun 3, 2025
92e1c70
merge master; modify gas for some tests
ltzmaxwell Jun 4, 2025
15c5f9e
type check cache
thehowl Jun 4, 2025
221d530
Merge branch 'master' of github.com:gnolang/gno into fix/crossrealm/x…
thehowl Jun 4, 2025
a6a13bf
Merge branch 'master' of github.com:gnolang/gno into fix/crossrealm/x…
thehowl Jun 5, 2025
8ea3ad5
WIP(keeper): fix add package - temp fix
gfanton Jun 2, 2025
8b3b8f7
fix(txtar): obj pointer
gfanton Jun 5, 2025
9e3690f
fix(gno.land): remaining tests
gfanton Jun 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion .github/golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ linters:
- gosec # Security problems
- gofmt # Whether the code was gofmt-ed
- goimports # Unused imports
- goconst # Repeated strings that could be replaced by a constant
- dogsled # Checks assignments with too many blank identifiers (e.g. x, , , _, := f())
- errname # Checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error
- errorlint # errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13
Expand Down
2 changes: 2 additions & 0 deletions examples/gno.land/p/agherasie/forms/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module gno.land/p/agherasie/forms

gno 0.9
2 changes: 2 additions & 0 deletions examples/gno.land/p/archives/bank/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module gno.land/p/demo/bank

gno 0.9
2 changes: 2 additions & 0 deletions examples/gno.land/p/demo/acl/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module gno.land/p/demo/acl

gno 0.9
2 changes: 2 additions & 0 deletions examples/gno.land/p/demo/avl/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module gno.land/p/demo/avl

gno 0.9
2 changes: 2 additions & 0 deletions examples/gno.land/p/demo/avl/list/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module gno.land/p/demo/avl/list

gno 0.9
2 changes: 2 additions & 0 deletions examples/gno.land/p/demo/avl/pager/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module gno.land/p/demo/avl/pager

gno 0.9
2 changes: 2 additions & 0 deletions examples/gno.land/p/demo/avl/rolist/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module gno.land/p/demo/avl/rolist

gno 0.9
2 changes: 2 additions & 0 deletions examples/gno.land/p/demo/avl/rotree/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module gno.land/p/demo/avl/rotree

gno 0.9
4 changes: 1 addition & 3 deletions examples/gno.land/p/demo/avl/z_0_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ func init() {
// node, _ = node.Set("key0", "value0")
}

func main() {
crossing()

func main(cur realm) {
var updated bool
node, updated = node.Set("key1", "value1")
// println(node, updated)
Expand Down
4 changes: 1 addition & 3 deletions examples/gno.land/p/demo/avl/z_1_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ func init() {
node, _ = node.Set("key1", "value1")
}

func main() {
crossing()

func main(cur realm) {
var updated bool
node, updated = node.Set("key2", "value2")
// println(node, updated)
Expand Down
4 changes: 1 addition & 3 deletions examples/gno.land/p/demo/avl/z_2_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ func init() {
tree.Set("key1", "value1")
}

func main() {
crossing()

func main(cur realm) {
var updated bool
updated = tree.Set("key2", "value2")
println(updated, tree.Size())
Expand Down
2 changes: 2 additions & 0 deletions examples/gno.land/p/demo/avlhelpers/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module gno.land/p/demo/avlhelpers

gno 0.9
2 changes: 2 additions & 0 deletions examples/gno.land/p/demo/bf/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module gno.land/p/demo/bf

gno 0.9
2 changes: 2 additions & 0 deletions examples/gno.land/p/demo/blog/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module gno.land/p/demo/blog

gno 0.9
2 changes: 2 additions & 0 deletions examples/gno.land/p/demo/btree/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module gno.land/p/demo/btree

gno 0.9
2 changes: 2 additions & 0 deletions examples/gno.land/p/demo/cford32/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module gno.land/p/demo/cford32

gno 0.9
2 changes: 2 additions & 0 deletions examples/gno.land/p/demo/combinederr/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module gno.land/p/demo/combinederr

gno 0.9
2 changes: 2 additions & 0 deletions examples/gno.land/p/demo/context/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module gno.land/p/demo/context

gno 0.9
2 changes: 2 additions & 0 deletions examples/gno.land/p/demo/diff/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module gno.land/p/demo/diff

gno 0.9
2 changes: 2 additions & 0 deletions examples/gno.land/p/demo/dom/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module gno.land/p/demo/dom

gno 0.9
2 changes: 2 additions & 0 deletions examples/gno.land/p/demo/entropy/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module gno.land/p/demo/entropy

gno 0.9
2 changes: 2 additions & 0 deletions examples/gno.land/p/demo/flow/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module gno.land/p/demo/flow

gno 0.9
2 changes: 2 additions & 0 deletions examples/gno.land/p/demo/fqname/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module gno.land/p/demo/fqname

gno 0.9
2 changes: 2 additions & 0 deletions examples/gno.land/p/demo/gnode/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module gno.land/p/demo/gnode

gno 0.9
2 changes: 2 additions & 0 deletions examples/gno.land/p/demo/gnorkle/agent/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module gno.land/p/demo/gnorkle/agent

gno 0.9
12 changes: 6 additions & 6 deletions examples/gno.land/p/demo/gnorkle/agent/whitelist.gno
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ func (m *Whitelist) AddAddresses(addresses []string) {
m.store = avl.NewTree()
}

for _, address := range addresses {
m.store.Set(address, struct{}{})
for _, address_XXX := range addresses {
m.store.Set(address_XXX, struct{}{})
}
}

// RemoveAddress removes the given address from the whitelist if it exists.
func (m *Whitelist) RemoveAddress(address string) {
func (m *Whitelist) RemoveAddress(address_XXX string) {
if m.store == nil {
return
}

m.store.Remove(address)
m.store.Remove(address_XXX)
}

// HasDefinition returns true if the whitelist has a definition. It retuns false if
Expand All @@ -41,10 +41,10 @@ func (m Whitelist) HasDefinition() bool {
}

// HasAddress returns true if the given address is in the whitelist.
func (m Whitelist) HasAddress(address string) bool {
func (m Whitelist) HasAddress(address_XXX string) bool {
if m.store == nil {
return false
}

return m.store.Has(address)
return m.store.Has(address_XXX)
}
2 changes: 2 additions & 0 deletions examples/gno.land/p/demo/gnorkle/feed/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module gno.land/p/demo/gnorkle/feed

gno 0.9
2 changes: 2 additions & 0 deletions examples/gno.land/p/demo/gnorkle/feeds/static/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module gno.land/p/demo/gnorkle/feeds/static

gno 0.9
2 changes: 2 additions & 0 deletions examples/gno.land/p/demo/gnorkle/gnorkle/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module gno.land/p/demo/gnorkle/gnorkle

gno 0.9
16 changes: 8 additions & 8 deletions examples/gno.land/p/demo/gnorkle/gnorkle/whitelist.gno
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ package gnorkle
type Whitelist interface {
ClearAddresses()
AddAddresses(addresses []string)
RemoveAddress(address string)
RemoveAddress(address_XXX string)
HasDefinition() bool
HasAddress(address string) bool
HasAddress(address_XXX string) bool
}

// ClearWhitelist clears the whitelist of the instance or feed depending on the feed ID.
Expand Down Expand Up @@ -42,9 +42,9 @@ func (i *Instance) AddToWhitelist(feedID string, addresses []string) error {
}

// RemoveFromWhitelist removes the given address from the whitelist of the instance or feed depending on the feed ID.
func (i *Instance) RemoveFromWhitelist(feedID string, address string) error {
func (i *Instance) RemoveFromWhitelist(feedID string, address_XXX string) error {
if feedID == "" {
i.whitelist.RemoveAddress(address)
i.whitelist.RemoveAddress(address_XXX)
return nil
}

Expand All @@ -53,19 +53,19 @@ func (i *Instance) RemoveFromWhitelist(feedID string, address string) error {
return err
}

feedWithWhitelist.RemoveAddress(address)
feedWithWhitelist.RemoveAddress(address_XXX)
return nil
}

// addressWhiteListed returns true if:
// - the feed has a white list and the address is whitelisted, or
// - the feed has no white list and the instance has a white list and the address is whitelisted, or
// - the feed has no white list and the instance has no white list.
func addressIsWhitelisted(instanceWhitelist, feedWhitelist Whitelist, address string, instanceWhitelistedOverride *bool) bool {
func addressIsWhitelisted(instanceWhitelist, feedWhitelist Whitelist, address_XXX string, instanceWhitelistedOverride *bool) bool {
// A feed whitelist takes priority, so it will return false if the feed has a whitelist and the caller is
// not a part of it. An empty whitelist defers to the instance whitelist.
if feedWhitelist != nil {
if feedWhitelist.HasDefinition() && !feedWhitelist.HasAddress(address) {
if feedWhitelist.HasDefinition() && !feedWhitelist.HasAddress(address_XXX) {
return false
}

Expand All @@ -92,5 +92,5 @@ func addressIsWhitelisted(instanceWhitelist, feedWhitelist Whitelist, address st
}

// The instance whitelist is defined so if the address is present then it is allowed.
return instanceWhitelist.HasAddress(address)
return instanceWhitelist.HasAddress(address_XXX)
}
2 changes: 2 additions & 0 deletions examples/gno.land/p/demo/gnorkle/ingester/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module gno.land/p/demo/gnorkle/ingester

gno 0.9
2 changes: 2 additions & 0 deletions examples/gno.land/p/demo/gnorkle/ingesters/single/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module gno.land/p/demo/gnorkle/ingesters/single

gno 0.9
2 changes: 2 additions & 0 deletions examples/gno.land/p/demo/gnorkle/message/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module gno.land/p/demo/gnorkle/message

gno 0.9
2 changes: 2 additions & 0 deletions examples/gno.land/p/demo/gnorkle/storage/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module gno.land/p/demo/gnorkle/storage

gno 0.9
2 changes: 2 additions & 0 deletions examples/gno.land/p/demo/gnorkle/storage/simple/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module gno.land/p/demo/gnorkle/storage/simple

gno 0.9
2 changes: 2 additions & 0 deletions examples/gno.land/p/demo/grc/exts/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module gno.land/p/demo/grc/exts

gno 0.9
2 changes: 2 additions & 0 deletions examples/gno.land/p/demo/grc/grc1155/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module gno.land/p/demo/grc/grc1155

gno 0.9
2 changes: 2 additions & 0 deletions examples/gno.land/p/demo/grc/grc20/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module gno.land/p/demo/grc/grc20

gno 0.9
28 changes: 14 additions & 14 deletions examples/gno.land/p/demo/grc/grc20/token.gno
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ func (tok Token) TotalSupply() int64 { return tok.ledger.totalSupply }
func (tok Token) KnownAccounts() int { return tok.ledger.balances.Size() }

// BalanceOf returns the balance of the specified address.
func (tok Token) BalanceOf(address std.Address) int64 {
return tok.ledger.balanceOf(address)
func (tok Token) BalanceOf(address_XXX std.Address) int64 {
return tok.ledger.balanceOf(address_XXX)
}

// Allowance returns the allowance of the specified owner and spender.
Expand Down Expand Up @@ -192,8 +192,8 @@ func (led *PrivateLedger) Approve(owner, spender std.Address, amount int64) erro
}

// Mint increases the total supply of the token and adds the specified amount to the specified address.
func (led *PrivateLedger) Mint(address std.Address, amount int64) error {
if !address.IsValid() {
func (led *PrivateLedger) Mint(address_XXX std.Address, amount int64) error {
if !address_XXX.IsValid() {
return ErrInvalidAddress
}
if amount < 0 {
Expand All @@ -206,43 +206,43 @@ func (led *PrivateLedger) Mint(address std.Address, amount int64) error {
}

led.totalSupply += amount
currentBalance := led.balanceOf(address)
currentBalance := led.balanceOf(address_XXX)
newBalance := overflow.Add64p(currentBalance, amount)

led.balances.Set(string(address), newBalance)
led.balances.Set(string(address_XXX), newBalance)

std.Emit(
TransferEvent,
"from", "",
"to", string(address),
"to", string(address_XXX),
"value", strconv.Itoa(int(amount)),
)

return nil
}

// Burn decreases the total supply of the token and subtracts the specified amount from the specified address.
func (led *PrivateLedger) Burn(address std.Address, amount int64) error {
if !address.IsValid() {
func (led *PrivateLedger) Burn(address_XXX std.Address, amount int64) error {
if !address_XXX.IsValid() {
return ErrInvalidAddress
}
if amount < 0 {
return ErrInvalidAmount
}

currentBalance := led.balanceOf(address)
currentBalance := led.balanceOf(address_XXX)
if currentBalance < amount {
return ErrInsufficientBalance
}

led.totalSupply = overflow.Sub64p(led.totalSupply, amount)
newBalance := overflow.Sub64p(currentBalance, amount)

led.balances.Set(string(address), newBalance)
led.balances.Set(string(address_XXX), newBalance)

std.Emit(
TransferEvent,
"from", string(address),
"from", string(address_XXX),
"to", "",
"value", strconv.Itoa(int(amount)),
)
Expand All @@ -251,8 +251,8 @@ func (led *PrivateLedger) Burn(address std.Address, amount int64) error {
}

// balanceOf returns the balance of the specified address.
func (led PrivateLedger) balanceOf(address std.Address) int64 {
balance, found := led.balances.Get(address.String())
func (led PrivateLedger) balanceOf(address_XXX std.Address) int64 {
balance, found := led.balances.Get(address_XXX.String())
if !found {
return 0
}
Expand Down
Loading
Loading