Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion compose.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
services:
gnodev:
build: ./contract/
command: gnodev -paths gno.land/r/volos/**,gno.land/r/gnoswap/** -node-rpc-listener 0.0.0.0:26657 -web-listener 0.0.0.0:8888
command: gnodev -paths gno.land/r/volos/**,gno.land/r/gnoswap/** -deploy-key g1e9mkmle8rgx4jy2398dal9320uul7g00tkyh42 -node-rpc-listener 0.0.0.0:26657 -web-listener 0.0.0.0:8888
develop:
watch:
- action: sync
Expand Down
7 changes: 2 additions & 5 deletions contract/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,8 @@ COPY --from=builder /go/bin/gnokey /app/gnokey

COPY --from=builder /app/src /app/src

COPY ./r/gnoswap/v1/test_token/bar/ /app/src/examples/gno.land/r/gnoswap/v1/test_token/bar/
COPY ./p/gnoswap/consts/ /app/src/examples/gno.land/p/gnoswap/consts/

# temporary
COPY ./r/volos/core/volos.gno /app/src/examples/gno.land/r/volos/core/volos.gno
COPY ./r/gnoswap/test_token/ /app/src/examples/gno.land/r/gnoswap/test_token/
COPY ./r/gnoswap/rbac/consts.gno /app/src/examples/gno.land/r/gnoswap/rbac/consts.gno

COPY ./keys.db /root/.config/gno/data/keys.db

Expand Down
143 changes: 0 additions & 143 deletions contract/p/gnoswap/consts/consts.gno

This file was deleted.

3 changes: 1 addition & 2 deletions contract/p/volos/math/shares_math.gno
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ var (
VIRTUAL_SHARES = u256.NewUint(1000000000) // 1 billion shares

// VIRTUAL_ASSETS represents the minimum number of assets that exist in a pool
// This matches VIRTUAL_SHARES to maintain 1:1 initial share ratio
VIRTUAL_ASSETS = u256.NewUint(1000000000) // 1 billion base units
VIRTUAL_ASSETS = u256.NewUint(1) // 1 base units
)

// ToSharesDown converts assets to shares, rounding down (used for supply)
Expand Down
40 changes: 40 additions & 0 deletions contract/r/gnoswap/rbac/consts.gno
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package rbac

import "std"

// Initial addresses for protocol roles.
const (
// ADMIN is the initial admin address for RBAC management.
ADMIN std.Address = "g1e9mkmle8rgx4jy2398dal9320uul7g00tkyh42"
// DEV_OPS is the initial DevOps address for operational tasks.
DEV_OPS std.Address = "g1e9mkmle8rgx4jy2398dal9320uul7g00tkyh42"
)

// Derived addresses for GnoSwap protocol packages.
var (
// GNS_ADDR is the derived address for the GNS token package.
GNS_ADDR std.Address = std.DerivePkgAddr("gno.land/r/gnoswap/gns")
// EMISSION_ADDR is the derived address for the emission package.
EMISSION_ADDR std.Address = std.DerivePkgAddr("gno.land/r/gnoswap/emission")

// POOL_ADDR is the derived address for the pool package.
POOL_ADDR std.Address = std.DerivePkgAddr("gno.land/r/gnoswap/v1/pool")
// POSITION_ADDR is the derived address for the position package.
POSITION_ADDR std.Address = std.DerivePkgAddr("gno.land/r/gnoswap/v1/position")
// ROUTER_ADDR is the derived address for the router package.
ROUTER_ADDR std.Address = std.DerivePkgAddr("gno.land/r/gnoswap/v1/router")
// STAKER_ADDR is the derived address for the staker package.
STAKER_ADDR std.Address = std.DerivePkgAddr("gno.land/r/gnoswap/v1/staker")
// PROTOCOL_FEE_ADDR is the derived address for the protocol fee package.
PROTOCOL_FEE_ADDR std.Address = std.DerivePkgAddr("gno.land/r/gnoswap/v1/protocol_fee")
// COMMUNITY_POOL_ADDR is the derived address for the community pool package.
COMMUNITY_POOL_ADDR std.Address = std.DerivePkgAddr("gno.land/r/gnoswap/v1/community_pool")
// GOV_GOVERNANCE_ADDR is the derived address for the governance package.
GOV_GOVERNANCE_ADDR std.Address = std.DerivePkgAddr("gno.land/r/gnoswap/v1/gov/governance")
// GOV_STAKER_ADDR is the derived address for the governance staker package.
GOV_STAKER_ADDR std.Address = std.DerivePkgAddr("gno.land/r/gnoswap/v1/gov/staker")
// GOV_XGNS_ADDR is the derived address for the xGNS governance package.
GOV_XGNS_ADDR std.Address = std.DerivePkgAddr("gno.land/r/gnoswap/v1/gov/xgns")
// LAUNCHPAD_ADDR is the derived address for the launchpad package.
LAUNCHPAD_ADDR std.Address = std.DerivePkgAddr("gno.land/r/gnoswap/v1/launchpad")
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import (
"std"
"strings"

"gno.land/p/demo/grc/grc20"
"gno.land/p/demo/ownable"
"gno.land/p/demo/ufmt"
"gno.land/p/demo/tokens/grc20"
"gno.land/p/nt/ownable"
"gno.land/p/nt/ufmt"

"gno.land/r/demo/grc20reg"
"gno.land/r/demo/defi/grc20reg"
)

var (
Expand Down
2 changes: 2 additions & 0 deletions contract/r/gnoswap/test_token/bar/gnomod.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module = "gno.land/r/onbloc/bar"
gno = "0.9"
80 changes: 80 additions & 0 deletions contract/r/gnoswap/test_token/baz/baz.gno
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package baz

import (
"std"
"strings"

"gno.land/p/demo/tokens/grc20"
"gno.land/p/nt/ownable"
"gno.land/p/nt/ufmt"

"gno.land/r/demo/defi/grc20reg"
)

var (
token, privateLedger = grc20.NewToken("Baz", "BAZ", 6)
owner = ownable.NewWithAddress("g1e9mkmle8rgx4jy2398dal9320uul7g00tkyh42") // ADMIN
)

func init() {
privateLedger.Mint(owner.Owner(), 100_000_000_000_000)
grc20reg.Register(cross, token, "")
}

func TotalSupply() int64 {
userTeller := token.CallerTeller()
return userTeller.TotalSupply()
}

func BalanceOf(owner std.Address) int64 {
userTeller := token.CallerTeller()
return userTeller.BalanceOf(owner)
}

func Allowance(owner, spender std.Address) int64 {
userTeller := token.CallerTeller()
return userTeller.Allowance(owner, spender)
}

func Transfer(cur realm, to std.Address, amount int64) {
userTeller := token.CallerTeller()
checkErr(userTeller.Transfer(to, amount))
}

func Approve(cur realm, spender std.Address, amount int64) {
userTeller := token.CallerTeller()
checkErr(userTeller.Approve(spender, amount))
}

func TransferFrom(cur realm, from, to std.Address, amount int64) {
userTeller := token.CallerTeller()
checkErr(userTeller.TransferFrom(from, to, amount))
}

func Burn(cur realm, from std.Address, amount int64) {
owner.AssertOwnedByPrevious()
checkErr(privateLedger.Burn(from, amount))
}

func Render(path string) string {
parts := strings.Split(path, "/")
c := len(parts)

switch {
case path == "":
return token.RenderHome()
case c == 2 && parts[0] == "balance":
owner := std.Address(parts[1])
userTeller := token.CallerTeller()
balance := userTeller.BalanceOf(owner)
return ufmt.Sprintf("%d\n", balance)
default:
return "404\n"
}
}

func checkErr(err error) {
if err != nil {
panic(err)
}
}
2 changes: 2 additions & 0 deletions contract/r/gnoswap/test_token/baz/gnomod.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module = "gno.land/r/onbloc/baz"
gno = "0.9"
Loading