sophia/test/contracts/spend_test.aes
2019-06-28 09:42:28 +02:00

27 lines
621 B
Plaintext

contract SpendContract =
entrypoint withdraw : (int) => int
contract SpendTest =
stateful entrypoint spend(to, amount) =
let total = Contract.balance
Chain.spend(to, amount)
total - amount
stateful entrypoint withdraw(amount) : int =
spend(Call.caller, amount)
stateful entrypoint withdraw_from(account, amount) =
account.withdraw(amount)
withdraw(amount)
stateful entrypoint spend_from(from, to, amount) =
from.withdraw(amount)
Chain.spend(to, amount)
Chain.balance(to)
entrypoint get_balance() = Contract.balance
entrypoint get_balance_of(a) = Chain.balance(a)