-
Notifications
You must be signed in to change notification settings - Fork 386
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into dependabot/github_actions/actions-c5109b1630
- Loading branch information
Showing
11 changed files
with
1,485 additions
and
2,965 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module gno.land/r/x/test_prev | ||
|
||
require ( | ||
gno.land/p/demo/grc/grc20 v0.0.0-latest | ||
gno.land/p/demo/ufmt v0.0.0-latest | ||
gno.land/p/demo/users v0.0.0-latest | ||
gno.land/r/demo/users v0.0.0-latest | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package test_prev | ||
|
||
import ( | ||
"std" | ||
|
||
pusers "gno.land/p/demo/users" | ||
"gno.land/r/demo/foo20" | ||
) | ||
|
||
func DoSomeWithUserBalance() string { | ||
caller := std.GetOrigCaller() | ||
balance := foo20.BalanceOf(pusers.AddressOrName(caller)) | ||
|
||
if balance > 100 { | ||
return "rich user" | ||
} | ||
return "poor user" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package test_prev | ||
|
||
import ( | ||
"std" | ||
"testing" | ||
|
||
"gno.land/r/demo/foo20" | ||
) | ||
|
||
func TestDoSomeWithUserBalancePoor(t *testing.T) { | ||
std.TestSetOrigCaller("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5") | ||
if DoSomeWithUserBalance() != "poor user" { | ||
t.Error("expected poor user") | ||
} | ||
} | ||
|
||
func TestDoSomeWithUserBalanceRichButPoor(t *testing.T) { | ||
std.TestSetOrigCaller("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5") | ||
foo20.Faucet() // foo20 will mint tokens to this realm(std.PrevRealm) not user | ||
if DoSomeWithUserBalance() != "poor user" { | ||
t.Error("expected poor user") | ||
} | ||
} | ||
|
||
func TestDoSomeWithUserBalanceRich(t *testing.T) { | ||
std.TestSetPrevAddr("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5") | ||
|
||
foo20.Faucet() // foo20 will mint tokens to this realm not user | ||
if DoSomeWithUserBalance() != "rich user" { | ||
t.Error("expected rich user") | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
Apache License | ||
Version 2.0, January 2004 | ||
http://www.apache.org/licenses/ | ||
|