Documentation ¶
Index ¶
- func DeleteOptionData(store types.KVStore, data OptionData)
- func EscrowTxBytes(tx EscrowTx) []byte
- func OptionsTxBytes(tx OptionsTx) []byte
- func StoreOptionData(store types.KVStore, data OptionData)
- type BuyOptionTx
- type CreateEscrowTx
- type CreateOptionTx
- type DisolveOptionTx
- type EscrowData
- type EscrowTx
- type ExerciseOptionTx
- type ExpireEscrowTx
- type OptionData
- type OptionHolder
- type OptionIssue
- type OptionsTx
- type ResolveEscrowTx
- type SellOptionTx
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteOptionData ¶
func DeleteOptionData(store types.KVStore, data OptionData)
func EscrowTxBytes ¶
func OptionsTxBytes ¶
func StoreOptionData ¶
func StoreOptionData(store types.KVStore, data OptionData)
Types ¶
type BuyOptionTx ¶
type BuyOptionTx struct {
Addr []byte // address of the refered option
}
BuyOptionTx is used to purchase the right to exercise the option
type CreateEscrowTx ¶
type CreateEscrowTx struct { Recipient []byte Arbiter []byte Expiration uint64 // height when the offer expires }
CreateEscrowTx is used to create an escrow in the first place
type CreateOptionTx ¶
type CreateOptionTx struct { Expiration uint64 // height when the offer expires Trade types.Coins // this is the money that can exercise the option }
CreateOptionTx is used to create an option in the first place
type DisolveOptionTx ¶
type DisolveOptionTx struct {
Addr []byte // address of the refered option
}
DisolveOptionTx returns Bond to issue if expired or unpurchased
type EscrowData ¶
type EscrowData struct { Sender []byte Recipient []byte Arbiter []byte Expiration uint64 // height when the offer expires (0 = never) Amount types.Coins }
EscrowData is our principal data structure in the db
func LoadEscrow ¶
func LoadEscrow(store types.KVStore, addr []byte) (EscrowData, error)
func ParseEscrow ¶
func ParseEscrow(data []byte) (EscrowData, error)
func (EscrowData) Address ¶
func (d EscrowData) Address() []byte
Address is the ripemd160 hash of the escrow contents, which is constant
func (EscrowData) Bytes ¶
func (d EscrowData) Bytes() []byte
func (EscrowData) IsExpired ¶
func (d EscrowData) IsExpired(h uint64) bool
type ExerciseOptionTx ¶
type ExerciseOptionTx struct {
Addr []byte // address of the refered option
}
ExerciseOptionTx must send Trade and recieve Bond
type ExpireEscrowTx ¶
type ExpireEscrowTx struct {
Escrow []byte
}
ExpireEscrowTx can be signed by anyone, and only succeeds if the Expiration height has passed. All coins go back to the Sender (Intended to be used by the sender to recover old payments)
type OptionData ¶
type OptionData struct { OptionIssue OptionHolder }
OptionData is our principal data structure in the db
func LoadOptionData ¶
func LoadOptionData(store types.KVStore, addr []byte) (OptionData, error)
func ParseOptionData ¶
func ParseOptionData(data []byte) (OptionData, error)
func (OptionData) Bytes ¶
func (d OptionData) Bytes() []byte
func (OptionData) CanBuy ¶
func (d OptionData) CanBuy(buyer []byte) bool
To buy, this option must be for sale, and the buyer must be listed (or an open sale)
func (OptionData) CanDissolve ¶
func (d OptionData) CanDissolve(addr []byte, h uint64) bool
CanDissolve if it is expired, or the holder, issue, and caller are the same
func (OptionData) CanExercise ¶
func (d OptionData) CanExercise(addr []byte, h uint64) bool
func (OptionData) CanSell ¶
func (d OptionData) CanSell(buyer []byte) bool
type OptionHolder ¶
type OptionHolder struct { // this is for buying/selling the option (should be a separate struct?) Holder []byte NewHolder []byte // set to allow for only one buyer, empty for any buyer Price types.Coins // required payment to transfer ownership }
OptionHolder is the dynamic section of who can excercise the options
type OptionIssue ¶
type OptionIssue struct { // this is for the normal option functionality Issuer []byte Serial int // this sequence number is from the apptx that created it Expiration uint64 // height when the offer expires (0 = never) Bond types.Coins // this is stored upon creation of the option Trade types.Coins // this is the money that can exercise the option }
OptionIssue is the constant part, created wth the option, never changes
func (OptionIssue) Address ¶
func (i OptionIssue) Address() []byte
Address is the ripemd160 hash of the constant part of the option
func (OptionIssue) Bytes ¶
func (i OptionIssue) Bytes() []byte
func (OptionIssue) IsExpired ¶
func (i OptionIssue) IsExpired(h uint64) bool
type ResolveEscrowTx ¶
type ResolveEscrowTx struct { Escrow []byte Payout bool // if true, to Recipient, else back to Sender }
ResolveEscrowTx must be signed by the Arbiter and resolves the escrow by sending the money to Sender or Recipient as specified