Interface
Storage
variable seller : address = @tz1h4CiqWxNe4UxSpkwXy617RM6DaK6NU76P
variable buyer : address = @tz1h4CiqWxNe4UxSpkwXy617RM6DaK6NU76P
variable taxcollector : address = @tz1h4CiqWxNe4UxSpkwXy617RM6DaK6NU76P
variable price : tez = 0tz
constant taxrate : rational = 20%
constant securityrate : rational = 110%
constant deadline : date = now + 1d
states =
| Created initial
| Aborted
| Funded
| InTransit
| Completed
Entry points
Transitions
transition abortCreated () {
called by buyer
from Created
to Aborted
}
transition abortFunded () {
called by buyer
from Funded
to Aborted
}
transition abort () {
from any
to Aborted when { now > deadline }
}
Fund
transition fund () {
called by buyer
from Created
to Funded when { transferred >= (100% + taxrate + securityrate) * price }
}
Complete
transition complete () {
called by buyer
from Funded
to Completed
with effect {
...
}
}