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

crowdfund state

Back to all declarations

Campaign

type

Campaign holds the state of a single crowdfunding campaign.

Value

crowdfund.Campaign

campaigns

*v0.Tree

// padded id -> \*Campaign (ordered by id)

Open
OID
0d4c03…b8b9:4
campaigns details

Inspect pointer

nextID

int

Value

1

key

func(id int) string

key zero-pads an id so avl iteration is in numeric order.

Open
OID
0d4c03…b8b9:7
key details

Inspect func

mustGet

func(id int) *crowdfund.Campaign
Open
OID
0d4c03…b8b9:9
mustGet details

Inspect func

Launch

func(goal uint64, durationBlocks int) int

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

Open
OID
0d4c03…b8b9:10
Launch details

Inspect func

Pledge

func(id int, amount uint64)

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

Open
OID
0d4c03…b8b9:11
Pledge details

Inspect func

Unpledge

func(id int, amount uint64)

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

Open
OID
0d4c03…b8b9:12
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
0d4c03…b8b9:13
Claim details

Inspect func

Refund

func(id int)

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

Open
OID
0d4c03…b8b9:14
Refund details

Inspect func

pct

func(pledged uint64, goal uint64) int

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

Open
OID
0d4c03…b8b9:15
pct details

Inspect func

progressBar

func(pledged uint64, goal uint64) string

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

Open
OID
0d4c03…b8b9:16
progressBar details

Inspect func

state

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

state describes a campaign relative to a given block height.

Open
OID
0d4c03…b8b9:17
state details

Inspect func

Render

func(path string) string

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

Open
OID
0d4c03…b8b9:18
Render details

Inspect func
Campaign : type =crowdfund.Campaign
campaigns : *v0.Tree Inspect
nextID : int =1
key : func(id int) string Inspect
mustGet : func(id int) *crowdfund.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 *crowdfund.Campaign, height int64) string Inspect
Render : func(path string) string Inspect