-
Notifications
You must be signed in to change notification settings - Fork 373
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: new realm /r/demo/art/haiku #860
base: master
Are you sure you want to change the base?
Conversation
Loving it. I'm a strong advocate for seemingly trivial PRs that foster creativity, embrace diversity, and unveil novel patterns. |
for _, line := range strings.Split(rawwordlist, "\n") { | ||
line = strings.TrimSpace(line) | ||
word := strings.Replace(line, ";", "", -1) | ||
wordsWithSyllables.Set(word, strings.Count(line, ";")+1) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should encourage offchain codegen for such needs.
It also reminds me what @albttx is doing with merkle tree based airdrops.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another option is to work on a pager system to initialize a contract with a lot of data:
// func init()
var paused = true
func InitBatch(batch string, done bool) {
assertIsAdmin()
handleBatch(batch)
if done {
paused = false
}
}
func PublicMethod() {
assertIsNotPaused()
// ...
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @moul, I've been going through some iterations on this and haven't really enabled a big improvement yet.
offchain codegen for such needs.
I'm not sure I am grokking this solution - what do you mean by offchain here? Is there an example to follow?
Another option is to work on a pager
Yeah - this option makes sense - if I understand correctly I can just load up the wordlist from the calling gno maketx call
with an authorized call to add words...that solution works, but I feel like it would miss out on one of the gno.land benefits - that the source code is available to publicly view (unless there is a way to view a avl.Tree
of a realm?). In this example, it is nice that the wordlist is publicly available so it is completely transparent about the inclusion rules to submit poems.
c07f08f
to
3e6d139
Compare
sorry! did not mean to clsoe this PR, I rebased the branch and it seemed to have closed it automatically. I'm working on bringing it up to speed on the current main |
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #860 +/- ##
=======================================
Coverage 47.08% 47.08%
=======================================
Files 365 365
Lines 61156 61156
=======================================
Hits 28793 28793
Misses 30011 30011
Partials 2352 2352
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
also, I should note that I wanted to use the |
Background:
/r/demo/art/haiku
is a implementation of a smart contract for creating and transferring text-based NFTs that conform to haiku poetry standards. The contract integrates a 240 kB wordlist into the contract that is used to check syllable counts and whether words are valid English, so that only valid Haikus can be added. Haikus are given a "rarity" score that can be used as a indicator of artificial scarcity.Add this realm to gno.land:
Mint a haiku:
Transfer a haiku:
In this case the
g1kn4yg8cxc65e6zgzwykwmng2wczkk2mwu5xsgv
is the recipient address and thebe95708bce28ee9eea54a3ab6a719e24b9408aa753c3583ad8a2336b87ec3ca9
is the token ID of the haiku to transfer (available from gno.land). Only owners can transfer.Register a user:
If you register a user, then your username will show up on the haiku pages instead of the address, using the
users
realm.Screenshots
All haikus displayed on main page.
Clicking on a user shows their creations:
Clicking on a user collection shows their collection:
Rendering of a single haiku:
Rarity static page information: