Skip to content

Commit

Permalink
run make fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
stefann-01 committed Dec 28, 2024
1 parent 142bd77 commit 20717b8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
8 changes: 4 additions & 4 deletions examples/gno.land/r/stefann/fomo3d/errors.gno
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ var (
// Game state errors
ErrGameInProgress = errors.New("fomo3d: game already in progress")
ErrGameNotInProgress = errors.New("fomo3d: game not in progress")
ErrGameEnded = errors.New("fomo3d: game has ended")
ErrGameTimeExpired = errors.New("fomo3d: game time expired")
ErrNoKeysPurchased = errors.New("fomo3d: no keys purchased")
ErrGameEnded = errors.New("fomo3d: game has ended")
ErrGameTimeExpired = errors.New("fomo3d: game time expired")
ErrNoKeysPurchased = errors.New("fomo3d: no keys purchased")

// Payment errors
ErrInvalidPayment = errors.New("fomo3d: must send ugnot only")
Expand All @@ -19,4 +19,4 @@ var (

// Fee errors
ErrNoFeesToClaim = errors.New("fomo3d: no owner fees to claim")
)
)
16 changes: 8 additions & 8 deletions examples/gno.land/r/stefann/fomo3d/fomo3d.gno
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import (

const (
MIN_KEY_PRICE int64 = 100000 // minimum key price in ugnot
TIME_EXTENSION int64 = 30 // time extension in blocks when new key is bought
MAX_TIME_EXTEND int64 = 86400 // max time that can be added (~24 hours @ 1s blocks)
TIME_EXTENSION int64 = 30 // time extension in blocks when new key is bought
MAX_TIME_EXTEND int64 = 86400 // max time that can be added (~24 hours @ 1s blocks)

// Distribution percentages (total 100%)
JACKPOT_PERCENT int64 = 47 // 47% goes to jackpot
Expand Down Expand Up @@ -57,7 +57,7 @@ var (

lastBuyer std.Address // last key buyer (potential winner)
players *avl.Tree // maps address -> PlayerInfo
totalKeys int64 // total number of keys in circulation
totalKeys int64 // total number of keys in circulation
ended bool

// Ownable instance
Expand Down Expand Up @@ -306,10 +306,10 @@ func Render(path string) string {
func RenderHome() string {
gameStart, gameEnd, _, lastBuyer, pot, price, totalKeys, isEnded := GetGameState()
// _, ownerFees := GetOwnerInfo()

var builder strings.Builder
builder.WriteString("# FOMO3D - The Ultimate Game of Greed\n\n")

// About section
builder.WriteString("## About the Game\n\n")
builder.WriteString("FOMO3D is a blockchain-based game that combines elements of lottery and investment mechanics. ")
Expand All @@ -335,7 +335,7 @@ func RenderHome() string {
builder.WriteString(ufmt.Sprintf("🏆 **Winner:** %s\n", lastBuyer))
} else {
builder.WriteString("🟢 **Game Status:** Active\n")
builder.WriteString(ufmt.Sprintf("⏱️ **Time Remaining:** %d blocks\n", gameEnd - std.GetHeight()))
builder.WriteString(ufmt.Sprintf("⏱️ **Time Remaining:** %d blocks\n", gameEnd-std.GetHeight()))
}
builder.WriteString(ufmt.Sprintf("💰 **Current Jackpot:** %d ugnot\n", pot))
builder.WriteString(ufmt.Sprintf("🔑 **Current Key Price:** %d ugnot\n", price))
Expand Down Expand Up @@ -376,12 +376,12 @@ func RenderPlayer(addr std.Address, keys int64, dividends int64) string {
builder.WriteString("## Your Holdings\n\n")
builder.WriteString(ufmt.Sprintf("🔑 **Keys Owned:** %d\n", keys))
builder.WriteString(ufmt.Sprintf("💰 **Unclaimed Dividends:** %d ugnot\n\n", dividends))

builder.WriteString("## Actions\n\n")
builder.WriteString("* To buy more keys, send GNOT to this realm with `BuyKeys()`\n")
if dividends > 0 {
builder.WriteString("* You have unclaimed dividends! Call `ClaimDividends()` to collect them\n")
}

return builder.String()
}
12 changes: 6 additions & 6 deletions examples/gno.land/r/stefann/fomo3d/fomo3d_test.gno
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func TestFullGameFlow(t *testing.T) {

// Verify player state
keys, dividends := GetPlayerInfo(player1)

shouldEqual(t, keys, int64(3))
shouldEqual(t, dividends, int64(0))
shouldEqual(t, lastBuyer, player1)
Expand All @@ -185,7 +185,7 @@ func TestFullGameFlow(t *testing.T) {

// Check player1 received dividends
keys1, dividends1 := GetPlayerInfo(player1)

shouldEqual(t, keys1, int64(3))
expectedDividends := payment * DIVIDENDS_PERCENT / 100 * 3 / totalKeys
shouldEqual(t, dividends1, expectedDividends)
Expand Down Expand Up @@ -236,7 +236,7 @@ func TestFullGameFlow(t *testing.T) {
shouldNoPanic(t, StartGame)
shouldEqual(t, ended, false)
shouldEqual(t, currentRound, int64(2))

shouldEqual(t, jackpot, expectedNextPot) // New round starts with previous round's nextPot
shouldEqual(t, nextPot, int64(0))
})
Expand Down Expand Up @@ -319,10 +319,10 @@ func TestClaimDividends(t *testing.T) {
func TestEndGame(t *testing.T) {
setupTestGame(t)
StartGame()

// Skip to end + 1 to ensure we're past the end block
std.TestSkipHeights(MAX_TIME_EXTEND + 1)

shouldPanic(t, EndGame) // Should panic because no keys purchased

// Reset and start new game
Expand All @@ -342,6 +342,6 @@ func TestEndGame(t *testing.T) {

// Skip to well past the end
std.TestSkipHeights(MAX_TIME_EXTEND + TIME_EXTENSION + 1)

shouldNoPanic(t, EndGame)
}

0 comments on commit 20717b8

Please sign in to comment.