Fixed example (#249)
This commit is contained in:
parent
4f554acee6
commit
dc977f7354
@ -1022,8 +1022,8 @@ contract FundMe =
|
|||||||
deadline : int,
|
deadline : int,
|
||||||
goal : int }
|
goal : int }
|
||||||
|
|
||||||
function spend(args : spend_args) =
|
stateful function spend(args : spend_args) =
|
||||||
raw_spend(args.recipient, args.amount)
|
Chain.spend(args.recipient, args.amount)
|
||||||
|
|
||||||
entrypoint init(beneficiary, deadline, goal) : state =
|
entrypoint init(beneficiary, deadline, goal) : state =
|
||||||
{ contributions = {},
|
{ contributions = {},
|
||||||
@ -1062,7 +1062,6 @@ contract FundMe =
|
|||||||
require(state.total >= state.goal, "Project was not funded")
|
require(state.total >= state.goal, "Project was not funded")
|
||||||
spend({recipient = state.beneficiary,
|
spend({recipient = state.beneficiary,
|
||||||
amount = Contract.balance })
|
amount = Contract.balance })
|
||||||
put(state{ beneficiary = #0 })
|
|
||||||
|
|
||||||
stateful function withdraw_contributor() =
|
stateful function withdraw_contributor() =
|
||||||
if(state.total >= state.goal)
|
if(state.total >= state.goal)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user