Update tests for entrypoints

This commit is contained in:
Ulf Norell
2019-06-27 14:16:33 +02:00
parent 85408a12a2
commit 6a59e455ce
51 changed files with 465 additions and 446 deletions
+3 -3
View File
@@ -10,13 +10,13 @@ contract DutchAuction =
sold : bool }
// Add to work around current lack of predefined functions
private stateful function spend(to, amount) =
stateful function spend(to, amount) =
let total = Contract.balance
Chain.spend(to, amount)
total - amount
// TTL set by user on posting contract, typically (start - end ) div dec
public function init(beneficiary, start, decrease) : state =
entrypoint init(beneficiary, start, decrease) : state =
require(start > 0 && decrease > 0, "bad args")
{ start_amount = start,
start_height = Chain.block_height,
@@ -27,7 +27,7 @@ contract DutchAuction =
// -- API
// We are the buyer... interesting case to buy for someone else and keep 10%
public stateful function bid() =
stateful entrypoint bid() =
require( !(state.sold), "sold")
let cost =
state.start_amount - (Chain.block_height - state.start_height) * state.dec