Skip to content

Commit

Permalink
Merge pull request #162 from gnoswap-labs/GSW-867-feat-common-calcula…
Browse files Browse the repository at this point in the history
…tion-logic-to-separate-package

GSW-867 feat common calculation logic to separate package
  • Loading branch information
r3v4s authored Feb 19, 2024
2 parents da92987 + 7f527e6 commit 614798e
Show file tree
Hide file tree
Showing 61 changed files with 889 additions and 1,009 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ To run unit tests, follow these steps:
2. Copy the `gnoswap` contracts into the Gno core:

```
$ cp -R _setup/* gov pool position router staker $WORKDIR/gno-for-swap/examples/gno.land/r/
$ cp -R _setup/* consts gov pool position router staker $WORKDIR/gno-for-swap/examples/gno.land/r/demo/
$ cp -R common $WORKDIR/gno-for-swap/examples/gno.land/p/demo/
```

### Run the Test Cases
Expand Down
20 changes: 13 additions & 7 deletions _setup/gns/gns.gno
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,27 @@ import (

var (
gns *grc20.AdminToken
admin std.Address = "g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5" // TODO: helper to change admin
ira std.Address = "g1paqttvcjcluuya9n9twyw7yacv54mt7ld3gvzm" // ToBeChanged: account for gnoswap staker's internal reward
admins []string
)

const (
admin std.Address = "g12l9splsyngcgefrwa52x5a7scc29e9v086m6p4" // r3v4_xxx: CHANGE WHEN DEPLOYING TO OFFICIAL NETWORK
INTERNAL_REWARD_ACCOUNT std.Address = "g1paqttvcjcluuya9n9twyw7yacv54mt7ld3gvzm" // r3v4_xxx: CHANGE WHEN DEPLOYING TO OFFICIAL NETWORK
)

func init() {
// r3v4_xxx: SET MAXIMUM SUPLLY

gns = grc20.NewAdminToken("Gnoswap", "GNS", 6)
gns.Mint(admin, 100_000_000_000_000) // @administrator
gns.Mint(ira, 400_000_000_000_000) // @ira
// gns.Mint(admin, 100_000_000_000_000) // @administrator
gns.Mint(INTERNAL_REWARD_ACCOUNT, 400_000_000_000_000) // @INTERNAL_REWARD_ACCOUNT
gns.Mint(std.Address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5"), 100_000_000_000) // default test1

stakerAddr := std.DerivePkgAddr("gno.land/r/demo/staker")
admins = append(admins, string(stakerAddr))
admins = append(admins, string(admin))

gns.Approve(ira, stakerAddr, 9_223_372_036_854_775_807) // max uint64
gns.Approve(INTERNAL_REWARD_ACCOUNT, stakerAddr, 9_223_372_036_854_775_807) // max uint64
}

// method proxies as public functions.
Expand Down Expand Up @@ -83,11 +89,11 @@ func TransferFrom(from, to users.AddressOrName, amount uint64) {
}

// faucet.
func Faucet(addr std.Address) {
func Faucet(addr std.Address) { // r3v4_xxx: REMOVE FAUCET WHEN DEPLOYING TO OFFICIAL NETWORK
gns.Mint(addr, 100_000_000)
}

func FaucetL() {
func FaucetL() { // r3v4_xxx: REMOVE FAUCET WHEN DEPLOYING TO OFFICIAL NETWORK
caller := std.PrevRealm().Addr()
gns.Mint(caller, 1_000_000_000_000)
}
Expand Down
15 changes: 0 additions & 15 deletions _setup/grc20_wrapper_test/gno.mod

This file was deleted.

37 changes: 0 additions & 37 deletions _setup/grc20_wrapper_test/grc20wrapper.gno

This file was deleted.

33 changes: 0 additions & 33 deletions _setup/grc20_wrapper_test/wrapper_bar.gno

This file was deleted.

33 changes: 0 additions & 33 deletions _setup/grc20_wrapper_test/wrapper_baz.gno

This file was deleted.

33 changes: 0 additions & 33 deletions _setup/grc20_wrapper_test/wrapper_foo.gno

This file was deleted.

33 changes: 0 additions & 33 deletions _setup/grc20_wrapper_test/wrapper_gns.gno

This file was deleted.

33 changes: 0 additions & 33 deletions _setup/grc20_wrapper_test/wrapper_obl.gno

This file was deleted.

33 changes: 0 additions & 33 deletions _setup/grc20_wrapper_test/wrapper_qux.gno

This file was deleted.

33 changes: 0 additions & 33 deletions _setup/grc20_wrapper_test/wrapper_wugnot.gno

This file was deleted.

Loading

0 comments on commit 614798e

Please sign in to comment.