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 state

Back to all declarations

Campaign

type

Campaign holds the state of a single crowdfunding campaign. It carries no ID field: the id belongs to the store, which hands it back on lookup and iteration.

Value

v1.Campaign

campaigns

*v0.Store

campaigns assigns the campaign ids. v0 kept its own nextID plus a key() that zero-padded to width 12, which stopped ordering Render past 10^12, and its own mustGet whose panic did not say which campaign was missing.

Open
OID
05ff28…1f01:4
campaigns details

Inspect pointer

Launch

func(goal uint64, durationBlocks int) int

Launch creates a new campaign owned by the caller and returns its id.

Open
OID
05ff28…1f01:9
Launch details

Inspect func

Pledge

func(id int, amount uint64)

Pledge backs campaign id with amount (before the deadline).

Open
OID
05ff28…1f01:10
Pledge details

Inspect func

Unpledge

func(id int, amount uint64)

Unpledge withdraws amount from the caller's pledge (before the deadline).

Open
OID
05ff28…1f01:11
Unpledge details

Inspect func

Claim

func(id int)

Claim lets the creator take the funds if the goal was met after the deadline.

Open
OID
05ff28…1f01:12
Claim details

Inspect func

Refund

func(id int)

Refund returns the caller's pledge if the campaign failed after the deadline.

Open
OID
05ff28…1f01:13
Refund details

Inspect func

pct

func(pledged uint64, goal uint64) int

pct returns the funded percentage (0..100).

Open
OID
05ff28…1f01:14
pct details

Inspect func

progressBar

func(pledged uint64, goal uint64) string

progressBar renders a fixed-width ▓░ bar for pledged/goal.

Open
OID
05ff28…1f01:15
progressBar details

Inspect func

state

func(c *v1.Campaign, height int64) string

state describes a campaign relative to a given block height.

Open
OID
05ff28…1f01:16
state details

Inspect func

Render

func(path string) string

Render shows all campaigns with a progress bar, goal, pledged and state.

Open
OID
05ff28…1f01:17
Render details

Inspect func
Campaign : type =v1.Campaign
campaigns : *v0.Store Inspect
mustGet : func(id int) *v1.Campaign Inspect
Launch : func(goal uint64, durationBlocks int) int Inspect
Pledge : func(id int, amount uint64) Inspect
Unpledge : func(id int, amount uint64) Inspect
Claim : func(id int) Inspect
Refund : func(id int) Inspect
pct : func(pledged uint64, goal uint64) int Inspect
progressBar : func(pledged uint64, goal uint64) string Inspect
state : func(c *v1.Campaign, height int64) string Inspect
Render : func(path string) string Inspect