27 lines
571 B
Plaintext
27 lines
571 B
Plaintext
|
|
contract SpendContract =
|
|
function withdraw : (int) => int
|
|
|
|
contract SpendTest =
|
|
|
|
function spend(to, amount) =
|
|
let total = Contract.balance
|
|
Chain.spend(to, amount)
|
|
total - amount
|
|
|
|
function withdraw(amount) : int =
|
|
spend(Call.caller, amount)
|
|
|
|
function withdraw_from(account, amount) =
|
|
account.withdraw(amount)
|
|
withdraw(amount)
|
|
|
|
function spend_from(from, to, amount) =
|
|
from.withdraw(amount)
|
|
Chain.spend(to, amount)
|
|
Chain.balance(to)
|
|
|
|
function get_balance() = Contract.balance
|
|
function get_balance_of(a) = Chain.balance(a)
|
|
|