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

feat: upgrade gno version #1462

Merged
merged 11 commits into from
Dec 20, 2024
Merged
2 changes: 1 addition & 1 deletion .gnoversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9786fa366f922f04e1251ec6f1df6423b4fd2bf4
c8cd8f4b6ccbe9f4ee5622032228553496186d51
6 changes: 0 additions & 6 deletions gno/p/dao_core/gno.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
module gno.land/p/teritori/dao_core

require (
gno.land/p/demo/json v0.0.0-latest
gno.land/p/teritori/dao_interfaces v0.0.0-latest
gno.land/p/teritori/jsonutil v0.0.0-latest
)
5 changes: 0 additions & 5 deletions gno/p/dao_interfaces/gno.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
module gno.land/p/teritori/dao_interfaces

require (
gno.land/p/demo/avl v0.0.0-latest
gno.land/p/demo/json v0.0.0-latest
)
8 changes: 0 additions & 8 deletions gno/p/dao_proposal_single/gno.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1 @@
module gno.land/p/teritori/dao_proposal_single

require (
gno.land/p/demo/avl v0.0.0-latest
gno.land/p/demo/json v0.0.0-latest
gno.land/p/teritori/dao_interfaces v0.0.0-latest
gno.land/p/teritori/dao_utils v0.0.0-latest
gno.land/p/teritori/jsonutil v0.0.0-latest
)
7 changes: 0 additions & 7 deletions gno/p/dao_roles_group/gno.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
module gno.land/p/teritori/dao_roles_group

require (
gno.land/p/demo/json v0.0.0-latest
gno.land/p/teritori/dao_interfaces v0.0.0-latest
gno.land/p/teritori/jsonutil v0.0.0-latest
gno.land/p/teritori/role_manager v0.0.0-latest
)
5 changes: 0 additions & 5 deletions gno/p/dao_utils/gno.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
module gno.land/p/teritori/dao_utils

require (
gno.land/p/demo/json v0.0.0-latest
gno.land/p/teritori/jsonutil v0.0.0-latest
)
7 changes: 0 additions & 7 deletions gno/p/dao_voting_group/gno.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
module gno.land/p/teritori/dao_voting_group

require (
gno.land/p/demo/json v0.0.0-latest
gno.land/p/teritori/dao_interfaces v0.0.0-latest
gno.land/p/teritori/havl v0.0.0-latest
gno.land/p/teritori/jsonutil v0.0.0-latest
)
2 changes: 0 additions & 2 deletions gno/p/flags_index/gno.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
module gno.land/p/teritori/flags_index

require gno.land/p/demo/avl v0.0.0-latest
2 changes: 0 additions & 2 deletions gno/p/havl/gno.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
module gno.land/p/teritori/havl

require gno.land/p/demo/avl v0.0.0-latest
7 changes: 0 additions & 7 deletions gno/p/jsonutil/gno.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
module gno.land/p/teritori/jsonutil

require (
gno.land/p/demo/avl v0.0.0-latest
gno.land/p/demo/json v0.0.0-latest
gno.land/p/demo/users v0.0.0-latest
gno.land/r/demo/users v0.0.0-latest
)
16 changes: 0 additions & 16 deletions gno/p/jsonutil/jsonutil.gno
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import (

"gno.land/p/demo/avl"
"gno.land/p/demo/json"
"gno.land/p/demo/users"
rusers "gno.land/r/demo/users"
)

func UnionNode(variant string, value *json.Node) *json.Node {
Expand Down Expand Up @@ -129,17 +127,3 @@ func MustAddress(value *json.Node) std.Address {

return addr
}

func AddressOrNameNode(aon users.AddressOrName) *json.Node {
return json.StringNode("", string(aon))
}

func MustAddressOrName(value *json.Node) users.AddressOrName {
aon := users.AddressOrName(value.MustString())
address := rusers.Resolve(aon)
if !address.IsValid() {
panic("invalid address or name")
}

return aon
}
6 changes: 0 additions & 6 deletions gno/p/role_manager/gno.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
module gno.land/p/teritori/role_manager

require (
gno.land/p/demo/avl v0.0.0-latest
gno.land/p/demo/ownable v0.0.0-latest
gno.land/p/demo/testutils v0.0.0-latest
)
6 changes: 0 additions & 6 deletions gno/p/ujson/gno.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
module gno.land/p/teritori/ujson

require (
gno.land/p/demo/avl v0.0.0-latest
gno.land/p/demo/users v0.0.0-latest
gno.land/p/teritori/utf16 v0.0.0-latest
)
8 changes: 0 additions & 8 deletions gno/r/cockpit/gno.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1 @@
module gno.land/r/teritori/cockpit

require (
gno.land/p/demo/mux v0.0.0-latest
gno.land/p/demo/users v0.0.0-latest
gno.land/r/demo/profile v0.0.0-latest
gno.land/r/demo/users v0.0.0-latest
gno.land/r/gnoland/ghverify v0.0.0-latest
)
15 changes: 0 additions & 15 deletions gno/r/dao_realm/gno.mod
Original file line number Diff line number Diff line change
@@ -1,16 +1 @@
module gno.land/r/teritori/dao_realm

require (
gno.land/p/demo/json v0.0.0-latest
gno.land/p/teritori/dao_core v0.0.0-latest
gno.land/p/teritori/dao_interfaces v0.0.0-latest
gno.land/p/teritori/dao_proposal_single v0.0.0-latest
gno.land/p/teritori/dao_roles_group v0.0.0-latest
gno.land/p/teritori/dao_utils v0.0.0-latest
gno.land/p/teritori/dao_voting_group v0.0.0-latest
gno.land/p/teritori/havl v0.0.0-latest
gno.land/r/demo/profile v0.0.0-latest
gno.land/r/teritori/dao_registry v0.0.0-latest
gno.land/r/teritori/social_feeds v0.0.0-latest
gno.land/r/teritori/tori v0.0.0-latest
)
8 changes: 0 additions & 8 deletions gno/r/dao_registry/gno.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1 @@
module gno.land/r/teritori/dao_registry

require (
gno.land/p/demo/avl v0.0.0-latest
gno.land/p/demo/json v0.0.0-latest
gno.land/p/demo/ufmt v0.0.0-latest
gno.land/p/teritori/dao_interfaces v0.0.0-latest
gno.land/p/teritori/jsonutil v0.0.0-latest
)
6 changes: 3 additions & 3 deletions gno/r/launchpad_grc20/airdrop_grc20.gno
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func Claim(airdropID uint64, proofs []merkle.Node) {
panic("invalid proof")
}

airdrop.token.banker.Mint(caller, airdrop.amountPerAddr)
airdrop.token.privateLedger.Mint(caller, airdrop.amountPerAddr)

airdrop.alreadyClaimed.Set(caller.String(), true)
}
Expand All @@ -128,8 +128,8 @@ func (a *Airdrop) isOnGoing() bool {
func (a *Airdrop) ToJSON() *json.Node {
return json.ObjectNode("", map[string]*json.Node{
"id": json.StringNode("", ufmt.Sprintf("%d", uint64(a.id))),
"tokenName": json.StringNode("", a.token.banker.GetName()),
"tokenSymbol": json.StringNode("", a.token.banker.GetSymbol()),
"tokenName": json.StringNode("", a.token.GetName()),
"tokenSymbol": json.StringNode("", a.token.GetSymbol()),
"amountPerAddr": json.StringNode("", strconv.FormatUint(a.amountPerAddr, 10)),
"startTimestamp": json.StringNode("", strconv.FormatInt(a.startTimestamp, 10)),
"endTimestamp": json.StringNode("", strconv.FormatInt(a.endTimestamp, 10)),
Expand Down
4 changes: 2 additions & 2 deletions gno/r/launchpad_grc20/airdrop_grc20_test.gno
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,8 @@ func TestClaim(t *testing.T) {
if !airdrop.hasAlreadyClaimed(test.input.addr) {
t.Errorf("Expected address be set as claimed, but it is not")
}
if airdrop.token.banker.BalanceOf(test.input.addr) != test.expected.balance {
t.Errorf("Expected balance to be %d, got %d", test.expected.balance, airdrop.token.banker.BalanceOf(test.input.addr))
if airdrop.token.BalanceOf(test.input.addr) != test.expected.balance {
t.Errorf("Expected balance to be %d, got %d", test.expected.balance, airdrop.token.BalanceOf(test.input.addr))
}
}
})
Expand Down
12 changes: 0 additions & 12 deletions gno/r/launchpad_grc20/gno.mod
Original file line number Diff line number Diff line change
@@ -1,13 +1 @@
module gno.land/r/teritori/launchpad_grc20

require (
gno.land/p/demo/avl v0.0.0-latest
gno.land/p/demo/grc/grc20 v0.0.0-latest
gno.land/p/demo/json v0.0.0-latest
gno.land/p/demo/merkle v0.0.0-latest
gno.land/p/demo/mux v0.0.0-latest
gno.land/p/demo/ownable v0.0.0-latest
gno.land/p/demo/seqid v0.0.0-latest
gno.land/p/demo/ufmt v0.0.0-latest
gno.land/p/teritori/jsonutil v0.0.0-latest
)
36 changes: 18 additions & 18 deletions gno/r/launchpad_grc20/render.gno
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ func renderTokenPage(res *mux.ResponseWriter, req *mux.Request) {
res.Write("## Last tokens created\n")

for _, token := range lastTokensCreated {
res.Write(ufmt.Sprintf("### Name: %s - Symbol: %s\n", token.banker.GetName(), token.banker.GetSymbol()))
res.Write(ufmt.Sprintf("#### Total Supply: %d %s\n", token.banker.TotalSupply(), token.banker.GetSymbol()))
res.Write(ufmt.Sprintf("#### Decimals: %d\n", token.banker.GetDecimals()))
res.Write(ufmt.Sprintf("### Name: %s - Symbol: %s\n", token.GetName(), token.GetSymbol()))
res.Write(ufmt.Sprintf("#### Total Supply: %d %s\n", token.TotalSupply(), token.GetSymbol()))
res.Write(ufmt.Sprintf("#### Decimals: %d\n", token.GetDecimals()))
res.Write(ufmt.Sprintf("#### Admin: %s\n\n", token.admin.Owner().String()))
res.Write(ufmt.Sprintf("> Link: [:token/%s](launchpad_grc20:token/%s)\n\n", token.banker.GetName(), token.banker.GetName()))
res.Write(ufmt.Sprintf("> Link: [:token/%s](launchpad_grc20:token/%s)\n\n", token.GetName(), token.GetName()))
}
}
renderFooter(res, "")
Expand All @@ -68,11 +68,11 @@ func renderTokenDetailPage(res *mux.ResponseWriter, req *mux.Request) {

res.Write("# 🪙 Token Details 🪙\n")

res.Write(ufmt.Sprintf("### Name: %s - Symbol: %s\n", token.banker.GetName(), token.banker.GetSymbol()))
res.Write(ufmt.Sprintf("#### Total Supply: %d %s\n", token.banker.TotalSupply(), token.banker.GetSymbol()))
res.Write(ufmt.Sprintf("#### Decimals: %d\n", token.banker.GetDecimals()))
res.Write(ufmt.Sprintf("### Name: %s - Symbol: %s\n", token.GetName(), token.GetSymbol()))
res.Write(ufmt.Sprintf("#### Total Supply: %d %s\n", token.TotalSupply(), token.GetSymbol()))
res.Write(ufmt.Sprintf("#### Decimals: %d\n", token.GetDecimals()))
res.Write(ufmt.Sprintf("#### Admin: %s\n\n", token.admin.Owner().String()))
res.Write(ufmt.Sprintf("#### Total Supply Cap (0 = unlimited): %d %s\n\n", token.totalSupplyCap, token.banker.GetSymbol()))
res.Write(ufmt.Sprintf("#### Total Supply Cap (0 = unlimited): %d %s\n\n", token.totalSupplyCap, token.GetSymbol()))

if token.allowMint {
res.Write("#### Mintable: true\n\n")
Expand Down Expand Up @@ -107,7 +107,7 @@ func renderTokenDetailPage(res *mux.ResponseWriter, req *mux.Request) {
sale := mustGetSale(uint64(id))
res.Write(ufmt.Sprintf("### Sale #%d\n", uint64(id)))
res.Write(ufmt.Sprintf("#### Price per token: %d $GNOT\n", sale.pricePerToken))
res.Write(ufmt.Sprintf("#### Limit per address: %d $%s\n", sale.limitPerAddr, token.banker.GetSymbol()))
res.Write(ufmt.Sprintf("#### Limit per address: %d $%s\n", sale.limitPerAddr, token.GetSymbol()))
res.Write(ufmt.Sprintf("#### Min goal: %d $GNOT\n", sale.minGoal))
res.Write(ufmt.Sprintf("#### Max goal: %d $GNOT\n", sale.maxGoal))
res.Write(ufmt.Sprintf("#### Already sold: %d $GNOT\n\n", sale.alreadySold))
Expand All @@ -120,10 +120,10 @@ func renderTokenBalancePage(res *mux.ResponseWriter, req *mux.Request) {
tokenName := req.GetVar("name")
address := req.GetVar("address")
token := mustGetToken(tokenName)
balance := token.banker.BalanceOf(std.Address(address))
balance := token.BalanceOf(std.Address(address))

res.Write("# 🪙 Token Balance 🪙\n")
res.Write(ufmt.Sprintf("### 📍 Address: %s\n ### 🏦 Balance: %d %s\n", address, balance, token.banker.GetSymbol()))
res.Write(ufmt.Sprintf("### 📍 Address: %s\n ### 🏦 Balance: %d %s\n", address, balance, token.GetSymbol()))
renderFooter(res, "../../../")
}

Expand All @@ -144,7 +144,7 @@ func renderAirdropPage(res *mux.ResponseWriter, req *mux.Request) {
}
airdrop := mustGetAirdrop(uint64(i))
res.Write(ufmt.Sprintf("### Airdrop #%d\n", i))
res.Write(ufmt.Sprintf("#### Token: %s\n", airdrop.token.banker.GetName()))
res.Write(ufmt.Sprintf("#### Token: %s\n", airdrop.token.GetName()))
if airdrop.isOnGoing() {
res.Write("#### Status: Ongoing\n")
} else {
Expand Down Expand Up @@ -175,7 +175,7 @@ func renderAirdropDetailPage(res *mux.ResponseWriter, req *mux.Request) {

res.Write(ufmt.Sprintf("# 🎁 Airdrop #%d Details 🎁\n", airdropID))

res.Write(ufmt.Sprintf("### Token: %s\n", airdrop.token.banker.GetName()))
res.Write(ufmt.Sprintf("### Token: %s\n", airdrop.token.GetName()))
if airdrop.isOnGoing() {
res.Write("### Status: Ongoing\n")
} else {
Expand Down Expand Up @@ -234,7 +234,7 @@ func renderSalePage(res *mux.ResponseWriter, req *mux.Request) {
}
sale := mustGetSale(uint64(i))
res.Write(ufmt.Sprintf("### Sale #%d\n", i))
res.Write(ufmt.Sprintf("#### Token: %s\n", sale.token.banker.GetName()))
res.Write(ufmt.Sprintf("#### Token: %s\n", sale.token.GetName()))
if sale.isOnGoing() {
res.Write("#### Status: Ongoing\n")
} else {
Expand All @@ -252,7 +252,7 @@ func renderSalePage(res *mux.ResponseWriter, req *mux.Request) {
res.Write("#### Sale is public\n")
}
res.Write(ufmt.Sprintf("#### Price per token: %d $GNOT\n", sale.pricePerToken))
res.Write(ufmt.Sprintf("#### Limit per address: %d $%s\n", sale.limitPerAddr, sale.token.banker.GetSymbol()))
res.Write(ufmt.Sprintf("#### Limit per address: %d $%s\n", sale.limitPerAddr, sale.token.GetSymbol()))
res.Write(ufmt.Sprintf("#### Min goal: %d $GNOT\n", sale.minGoal))
res.Write(ufmt.Sprintf("#### Max goal: %d $GNOT\n", sale.maxGoal))
res.Write(ufmt.Sprintf("#### Already sold: %d $GNOT\n\n", sale.alreadySold))
Expand All @@ -272,7 +272,7 @@ func renderSaleDetailPage(res *mux.ResponseWriter, req *mux.Request) {

res.Write(ufmt.Sprintf("# 🛒 Sale #%d Details 🛒\n", saleID))

res.Write(ufmt.Sprintf("### Token: %s\n", sale.token.banker.GetName()))
res.Write(ufmt.Sprintf("### Token: %s\n", sale.token.GetName()))
if sale.isOnGoing() {
res.Write("### Status: Ongoing\n")
} else {
Expand All @@ -290,7 +290,7 @@ func renderSaleDetailPage(res *mux.ResponseWriter, req *mux.Request) {
res.Write("### Sale is public\n")
}
res.Write(ufmt.Sprintf("### Price per token: %d $GNOT\n", sale.pricePerToken))
res.Write(ufmt.Sprintf("### Limit per address: %d $%s\n", sale.limitPerAddr, sale.token.banker.GetSymbol()))
res.Write(ufmt.Sprintf("### Limit per address: %d $%s\n", sale.limitPerAddr, sale.token.GetSymbol()))
res.Write(ufmt.Sprintf("### Min goal: %d $GNOT\n", sale.minGoal))
res.Write(ufmt.Sprintf("### Max goal: %d $GNOT\n", sale.maxGoal))
res.Write(ufmt.Sprintf("### Already sold: %d $GNOT\n\n", sale.alreadySold))
Expand All @@ -312,7 +312,7 @@ func renderSaleBalancePage(res *mux.ResponseWriter, req *mux.Request) {

res.Write("# 🛒 Sale Balance 🛒\n")
res.Write(ufmt.Sprintf("### 🛒 Sale ID: %d\n", saleID))
res.Write(ufmt.Sprintf("### 📍 Address: %s\n ### 🏦 Balance (Tokens from this sale only): %d %s\n", address, balance, sale.token.banker.GetSymbol()))
res.Write(ufmt.Sprintf("### 📍 Address: %s\n ### 🏦 Balance (Tokens from this sale only): %d %s\n", address, balance, sale.token.GetSymbol()))

res.Write("> ⚠️ *The tokens will be transfered or refunded after the sale ends depending if the sale reached the min goal or not* ⚠️\n")
renderFooter(res, "../../../")
Expand Down
11 changes: 6 additions & 5 deletions gno/r/launchpad_grc20/sale_grc20.gno
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ func NewSale(tokenName, merkleRoot string, startTimestamp, endTimestamp int64, p

realmAddr := std.CurrentRealm().Addr()
if mintToken {
token.banker.Mint(realmAddr, maxGoal)
token.privateLedger.Mint(realmAddr, maxGoal)
} else {
err := token.banker.Transfer(owner, realmAddr, maxGoal)
err := token.privateLedger.Transfer(owner, realmAddr, maxGoal)
if err != nil {
panic("error while transferring tokens to the realm, " + err.Error())
}
Expand Down Expand Up @@ -152,7 +152,7 @@ func Finalize(saleID uint64) {
// If the min goal is not reached, refund all the buyers and send the tokens back to the owner
if sale.alreadySold < sale.minGoal {
sale.refundAllBuyers()
err := sale.token.banker.Transfer(realmAddr, sale.owner, sale.alreadySold)
err := sale.token.privateLedger.Transfer(realmAddr, sale.owner, sale.alreadySold)
if err != nil {
panic("error while transferring back tokens to the owner, " + err.Error())
}
Expand Down Expand Up @@ -202,6 +202,7 @@ func (s *Sale) buy(buyer std.Address, amount uint64, proofs []merkle.Node) {
sentCoin := sentCoins[0]

banker := std.GetBanker(std.BankerTypeOrigSend)

realmAddr := std.CurrentRealm().Addr()

total := amount
Expand Down Expand Up @@ -259,7 +260,7 @@ func (s *Sale) payAllBuyers() {
s.buyers.Iterate("", "", func(key string, value interface{}) bool {
buyer := std.Address(key)
amount := value.(uint64)
err := s.token.banker.Transfer(realmAddr, buyer, amount)
err := s.token.privateLedger.Transfer(realmAddr, buyer, amount)
if err != nil {
panic("error while transferring tokens to the buyer, " + err.Error())
}
Expand All @@ -270,7 +271,7 @@ func (s *Sale) payAllBuyers() {
func (s *Sale) ToJSON() *json.Node {
return json.ObjectNode("", map[string]*json.Node{
"id": json.StringNode("", ufmt.Sprintf("%d", uint64(s.id))),
"tokenName": json.StringNode("", s.token.banker.GetName()),
"tokenName": json.StringNode("", s.token.GetName()),
"pricePerToken": json.StringNode("", strconv.FormatUint(s.pricePerToken, 10)),
"limitPerAddr": json.StringNode("", strconv.FormatUint(s.limitPerAddr, 10)),
"minGoal": json.StringNode("", strconv.FormatUint(s.minGoal, 10)),
Expand Down
Loading
Loading