Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

v1 source realm

Package hearth escrows a single ecosystem raise in ugnot and later splits revenue deposits across contributors by pai...

Overview

Package hearth escrows a single ecosystem raise in ugnot and later splits revenue deposits across contributors by paid share.

Contribute accepts ugnot while the raise is open. Each call must be at least MinContribute. The running total cannot pass HardCap; excess ugnot is sent back to the caller. Hitting HardCap closes the raise.

Raise principal (WithdrawRaise) and revenue (DepositRevenue) are separate ledgers. Withdrawing the raise does not change shares. After Close, DepositRevenue opens an epoch. Settle pays the next batch of unpaid wallets for that epoch. Claim pays one caller. Integer dust stays in the realm and is not withdrawable.

Constants 1

const MinContribute, HardCap, MaxSeats, MaxSettle

 1const (
 2	// MinContribute is the smallest ugnot a Contribute call may accept (500 GNOT).
 3	MinContribute int64 = 500_000_000
 4	// HardCap is the maximum ugnot the raise will accept (150_000 GNOT).
 5	HardCap int64 = 150_000_000_000
 6	// MaxSeats is HardCap / MinContribute. A new address past this panics.
 7	MaxSeats int = 300
 8	// MaxSettle is the most wallets one Settle call will pay.
 9	MaxSettle int = 20
10)
source

Functions 35

func AdminCall

crossing Action
1func AdminCall(cur realm) bool
source

AdminCall reports whether the direct caller is the operator.

func Claim

crossing Action
1func Claim(cur realm, epoch int)
source

Claim pays the caller their unpaid share of one epoch.

func ClaimReward

crossing Action
1func ClaimReward(cur realm)
source

ClaimReward pays the caller the ugnot already credited to them.

func Claimed

Action
1func Claimed(epoch int, addr address) bool
source

Claimed reports whether addr was already paid or skipped for epoch.

func Close

crossing Action
1func Close(cur realm)
source

Close ends the raise before the cap so revenue epochs can start.

func Closed

Action
1func Closed() bool
source

Closed reports whether new contributions are rejected.

func DepositRevenue

crossing Action
1func DepositRevenue(cur realm)
source

DepositRevenue opens one epoch with the attached ugnot. Raise must be closed.

func DepositReward

crossing Action
1func DepositReward(cur realm)
source

DepositReward takes the operator's ugnot and credits each contributor got * seat / raised. Rounding dust stays withdrawable. Principal is unchanged. MinMonthlyUgnot is the monthly floor, not a cap. A larger deposit uses the same split.

func EpochAmount

Action
1func EpochAmount(epoch int) int64
source

EpochAmount returns the ugnot deposited for a 1-based epoch.

func HandleOf

Action
1func HandleOf(addr address) string
source

HandleOf returns the stored X handle, or empty.

func Init

crossing Action
1func Init(cur realm)
source

Init binds the operator to the calling EOA. Once.

func MinMonthlyUgnot

Action
1func MinMonthlyUgnot() int64
source

MinMonthlyUgnot is 5% of contributed ugnot. Deposits may be larger. A larger deposit still splits by contribution share.

func PlanAccept

Action
1func PlanAccept(got int64) (accept int64, refund int64, reason string)
source

PlanAccept is the contribute decision. A non-empty reason means the call must revert.

func PoolShare

Action
1func PoolShare(addr address) int64
source

PoolShare is the ugnot still owed to addr from deposits already split.

func Render

1func Render(_ string) string
source

Render shows the raise terms and totals. It does not list every seat.

func RevenueBank

Action
1func RevenueBank() int64
source

RevenueBank is deposited revenue not yet paid out, including dust.

func RewardOwed

Action
1func RewardOwed() int64
source

RewardOwed is ugnot credited to contributors and not yet claimed.

func SeatOf

Action
1func SeatOf(addr address) int64
source

SeatOf returns ugnot contributed by addr, or 0.

func SetHandle

crossing Action
1func SetHandle(cur realm, handle string)
source

SetHandle records a public X handle for the caller. Same handle is a no-op.

func Settle

crossing Action
1func Settle(cur realm, epoch int, maxN int) int
source

Settle pays up to maxN unpaid seats for one epoch, in address order. Returns how many seats it marked this call.

func ShareOf

Action
1func ShareOf(epoch int, addr address) int64
source

ShareOf is the ugnot addr would receive for epoch. Zero if none.

func Summary

Action
1func Summary() string
source

Summary is a single line for clients: admin|raised|raisedBank|revenueBank|closed|seats|epochs|cap|min|rewardDust|rewardOwed

func TransferAdmin

crossing Action
1func TransferAdmin(cur realm, next address)
source

TransferAdmin moves the operator. The raise ledger is unchanged.

func UserCall

crossing Action
1func UserCall(cur realm) bool
source

UserCall reports whether this crossing was a direct EOA MsgCall.

func WithdrawRaise

crossing Action
1func WithdrawRaise(cur realm)
source

WithdrawRaise sends the operator the raise principal still on the realm. It does not touch revenue and does not change shares.

func WithdrawReward

crossing Action
1func WithdrawReward(cur realm, amt int64)
source

WithdrawReward sends unallocated rounding dust back to the operator. amt 0 withdraws all dust. Credited shares cannot be withdrawn.

Imports 8

  • chain stdlib
  • chain/banker stdlib
  • chain/runtime/unsafe stdlib
  • gno.land/p/nt/avl/v0 package
  • math/bits stdlib
  • strconv stdlib
  • strings stdlib
  • time stdlib

Source Files 2