Skip to content

Commit c53ba6b

Browse files
authored
feat: add LCS3 (#90)
* add lcs 3 * add line * add link
1 parent d34a956 commit c53ba6b

File tree

8 files changed

+89
-1
lines changed

8 files changed

+89
-1
lines changed

live-coding/2-home-realm/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ session to do so. Please make a PR adding your code to the
2323

2424
## Video
2525

26-
Video recording will be uploaded soon.
26+
Video recording can be found [here](https://www.youtube.com/watch?v=ZI0ZGDMbj-U).

live-coding/3-grc20-token/README.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Gno Live Coding Session #3
2+
3+
#### Topic: Creating your own GRC20 token while Gno language features
4+
#### Date: Friday, Sept 13th 2024
5+
#### Presenter: [@leohhhn](https://github.com/leohhhn)
6+
7+
This Live Coding session creating a [`GRC20`](https://gno.land/p/demo/grc/grc20) token
8+
in Gno, while exploring Gno's language features, such as calling methods on
9+
exported top-level variables.
10+
11+
The code contains an example of a GRC20 token, example
12+
[`Run`](https://docs.gno.land/gno-tooling/cli/gnokey/state-changing-calls#run)
13+
scripts which enable interactions with it.
14+
15+
## Following up
16+
17+
We encourage anyone who wishes to build upon the example given in the coding
18+
session to do so. Please make a PR adding your code to the
19+
[`followup-work/`](./followup-work) folder, and ping the presenter.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Package run20 showcases a simple way to create a GRC20 token using the p/demo/grc/grc20 package.
2+
// This package also showcases how to use the MsgRun message type:
3+
// Exposing a variable of a type that contains exposed methods will expose those methods to the end-user as well.
4+
// In this example, it is the grc20.Token interface type.
5+
// Currently, the only way to interact with it is via MsgRun (https://docs.gno.land/gno-tooling/cli/gnokey/state-changing-calls#the-power-of-run)
6+
// The `example_interactions` folder contains Gno scripts that can be provided to the Run transactions to execute these methods.
7+
// This functionality is planned for MsgCall as well in the future.
8+
// For more token examples, check out wugnot, foo20, and bar20 in the examples/ folder in the Gno monorepo.
9+
package run20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package main
2+
3+
import (
4+
leon "gno.land/r/leon/token"
5+
)
6+
7+
// using the Approve method of the grc20.Token interface, which is the type of `leon.Token`
8+
// read more about Run in the official gno.land docs
9+
func main() {
10+
leon.Token.Approve("g10ahumypepd2qcrau7kahv8q78f7jcdns5tn54a", 10_000*1_000_000)
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package main
2+
3+
import (
4+
leon "gno.land/r/leon/token"
5+
)
6+
7+
// using the Transfer method of the grc20.Token interface, which is the type of `leon.Token`
8+
// read more about Run in the official gno.land docs
9+
func main() {
10+
leon.Token.Transfer("g10ahumypepd2qcrau7kahv8q78f7jcdns5tn54a", 10_000*1_000_000)
11+
leon.Token.Transfer("g13awn2575t8s2vf3svlprc4dg0e9z5wchejdxk8", 10_000*1_000_000)
12+
leon.Token.Transfer("g162jgpk4740r6a7g53cgz9ahxqtyuekgqchw6w9", 10_000*1_000_000)
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module gno.land/r/leon/run20
2+
3+
require (
4+
gno.land/p/demo/grc/grc20 v0.0.0-latest
5+
gno.land/r/leon/token/registry v0.0.0-latest
6+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package run20
2+
3+
import "gno.land/p/demo/grc/grc20"
4+
5+
var (
6+
// bank is a new instance of the grc20.Banker type which contains admin functionality, such as mint, burn, etc
7+
// should not be exported, unless you want to expose mint & burn functionality to all users
8+
bank = grc20.NewBanker("Gno Live Coding #3 Token", "LCS3", 6)
9+
// Token is an instance of the interface grc20.Token following the fungible token spec.
10+
// Token can be safely exposed, as contains only the subset of banker functionalities which are non-admin related.
11+
// This is why it is called a "safe object" - it's safe to expose to the public.
12+
Token = bank.Token()
13+
)
14+
15+
func init() {
16+
// minting initial balances
17+
_ = bank.Mint("g125em6arxsnj49vx35f0n0z34putv5ty3376fg5", 10000000000000) // leon
18+
_ = bank.Mint("g10ahumypepd2qcrau7kahv8q78f7jcdns5tn54a", 10_000*1_000_000) // malek
19+
_ = bank.Mint("g13awn2575t8s2vf3svlprc4dg0e9z5wchejdxk8", 10_000*1_000_000) // stefan n
20+
_ = bank.Mint("g162jgpk4740r6a7g53cgz9ahxqtyuekgqchw6w9", 10_000*1_000_000) // varmeta
21+
}
22+
23+
func Render(_ string) string {
24+
return bank.RenderHome()
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Followup work
2+
3+
To add your code for this GnoLCS, create a directory named after your GitHub username
4+
under this folder.
5+

0 commit comments

Comments
 (0)