Documentation ¶
Overview ¶
Package escrow implements an Escrow.
> An escrow is a financial arrangement where a third party holds and regulates > payment of the funds required for two parties involved in a given transaction. > It helps make transactions more secure by keeping the payment in a secure > escrow account which is only released when all of the terms of an agreement are > met as overseen by the escrow company.
Escrow holds funds. The arbiter or source (sender) can release them to the recipient. The recipient (destination) can return them to the sender (source). Upon timeout, they will be returned to the sender (source).
Index ¶
- Variables
- func Condition(key []byte) weave.Condition
- func NewBucket() orm.ModelBucket
- func NewEscrow(id []byte, source weave.Address, destination weave.Address, ...) orm.Object
- func RegisterQuery(qr weave.QueryRouter)
- func RegisterRoutes(r weave.Registry, auth x.Authenticator, cashctrl cash.Controller)
- type CreateEscrowHandler
- type CreateMsg
- func (*CreateMsg) Descriptor() ([]byte, []int)
- func (m *CreateMsg) GetAmount() []*coin.Coin
- func (m *CreateMsg) GetArbiter() github_com_iov_one_weave.Address
- func (m *CreateMsg) GetDestination() github_com_iov_one_weave.Address
- func (m *CreateMsg) GetMemo() string
- func (m *CreateMsg) GetMetadata() *weave.Metadata
- func (m *CreateMsg) GetSource() github_com_iov_one_weave.Address
- func (m *CreateMsg) GetTimeout() github_com_iov_one_weave.UnixTime
- func (m *CreateMsg) Marshal() (dAtA []byte, err error)
- func (m *CreateMsg) MarshalTo(dAtA []byte) (int, error)
- func (CreateMsg) Path() string
- func (*CreateMsg) ProtoMessage()
- func (m *CreateMsg) Reset()
- func (m *CreateMsg) Size() (n int)
- func (m *CreateMsg) String() string
- func (m *CreateMsg) Unmarshal(dAtA []byte) error
- func (m *CreateMsg) Validate() error
- func (m *CreateMsg) XXX_DiscardUnknown()
- func (m *CreateMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *CreateMsg) XXX_Merge(src proto.Message)
- func (m *CreateMsg) XXX_Size() int
- func (m *CreateMsg) XXX_Unmarshal(b []byte) error
- type Escrow
- func (*Escrow) Descriptor() ([]byte, []int)
- func (m *Escrow) GetAddress() github_com_iov_one_weave.Address
- func (m *Escrow) GetArbiter() github_com_iov_one_weave.Address
- func (m *Escrow) GetDestination() github_com_iov_one_weave.Address
- func (m *Escrow) GetMemo() string
- func (m *Escrow) GetMetadata() *weave.Metadata
- func (m *Escrow) GetSource() github_com_iov_one_weave.Address
- func (m *Escrow) GetTimeout() github_com_iov_one_weave.UnixTime
- func (m *Escrow) Marshal() (dAtA []byte, err error)
- func (m *Escrow) MarshalTo(dAtA []byte) (int, error)
- func (*Escrow) ProtoMessage()
- func (m *Escrow) Reset()
- func (m *Escrow) Size() (n int)
- func (m *Escrow) String() string
- func (m *Escrow) Unmarshal(dAtA []byte) error
- func (e *Escrow) Validate() error
- func (m *Escrow) XXX_DiscardUnknown()
- func (m *Escrow) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Escrow) XXX_Merge(src proto.Message)
- func (m *Escrow) XXX_Size() int
- func (m *Escrow) XXX_Unmarshal(b []byte) error
- type Initializer
- type ReleaseEscrowHandler
- type ReleaseMsg
- func (*ReleaseMsg) Descriptor() ([]byte, []int)
- func (m *ReleaseMsg) GetAmount() []*coin.Coin
- func (m *ReleaseMsg) GetEscrowId() []byte
- func (m *ReleaseMsg) GetMetadata() *weave.Metadata
- func (m *ReleaseMsg) Marshal() (dAtA []byte, err error)
- func (m *ReleaseMsg) MarshalTo(dAtA []byte) (int, error)
- func (ReleaseMsg) Path() string
- func (*ReleaseMsg) ProtoMessage()
- func (m *ReleaseMsg) Reset()
- func (m *ReleaseMsg) Size() (n int)
- func (m *ReleaseMsg) String() string
- func (m *ReleaseMsg) Unmarshal(dAtA []byte) error
- func (m *ReleaseMsg) Validate() error
- func (m *ReleaseMsg) XXX_DiscardUnknown()
- func (m *ReleaseMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ReleaseMsg) XXX_Merge(src proto.Message)
- func (m *ReleaseMsg) XXX_Size() int
- func (m *ReleaseMsg) XXX_Unmarshal(b []byte) error
- type ReturnEscrowHandler
- type ReturnMsg
- func (*ReturnMsg) Descriptor() ([]byte, []int)
- func (m *ReturnMsg) GetEscrowId() []byte
- func (m *ReturnMsg) GetMetadata() *weave.Metadata
- func (m *ReturnMsg) Marshal() (dAtA []byte, err error)
- func (m *ReturnMsg) MarshalTo(dAtA []byte) (int, error)
- func (ReturnMsg) Path() string
- func (*ReturnMsg) ProtoMessage()
- func (m *ReturnMsg) Reset()
- func (m *ReturnMsg) Size() (n int)
- func (m *ReturnMsg) String() string
- func (m *ReturnMsg) Unmarshal(dAtA []byte) error
- func (m *ReturnMsg) Validate() error
- func (m *ReturnMsg) XXX_DiscardUnknown()
- func (m *ReturnMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ReturnMsg) XXX_Merge(src proto.Message)
- func (m *ReturnMsg) XXX_Size() int
- func (m *ReturnMsg) XXX_Unmarshal(b []byte) error
- type UpdateEscrowHandler
- type UpdatePartiesMsg
- func (*UpdatePartiesMsg) Descriptor() ([]byte, []int)
- func (m *UpdatePartiesMsg) GetArbiter() github_com_iov_one_weave.Address
- func (m *UpdatePartiesMsg) GetDestination() github_com_iov_one_weave.Address
- func (m *UpdatePartiesMsg) GetEscrowId() []byte
- func (m *UpdatePartiesMsg) GetMetadata() *weave.Metadata
- func (m *UpdatePartiesMsg) GetSource() github_com_iov_one_weave.Address
- func (m *UpdatePartiesMsg) Marshal() (dAtA []byte, err error)
- func (m *UpdatePartiesMsg) MarshalTo(dAtA []byte) (int, error)
- func (UpdatePartiesMsg) Path() string
- func (*UpdatePartiesMsg) ProtoMessage()
- func (m *UpdatePartiesMsg) Reset()
- func (m *UpdatePartiesMsg) Size() (n int)
- func (m *UpdatePartiesMsg) String() string
- func (m *UpdatePartiesMsg) Unmarshal(dAtA []byte) error
- func (m *UpdatePartiesMsg) Validate() error
- func (m *UpdatePartiesMsg) XXX_DiscardUnknown()
- func (m *UpdatePartiesMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *UpdatePartiesMsg) XXX_Merge(src proto.Message)
- func (m *UpdatePartiesMsg) XXX_Size() int
- func (m *UpdatePartiesMsg) XXX_Unmarshal(b []byte) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidLengthCodec = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowCodec = fmt.Errorf("proto: integer overflow") )
Functions ¶
func NewBucket ¶
func NewBucket() orm.ModelBucket
func NewEscrow ¶
func NewEscrow( id []byte, source weave.Address, destination weave.Address, arbiter weave.Address, amount coin.Coins, timeout weave.UnixTime, memo string, ) orm.Object
NewEscrow creates an escrow orm.Object
func RegisterQuery ¶
func RegisterQuery(qr weave.QueryRouter)
RegisterQuery will register this bucket as "/escrows"
func RegisterRoutes ¶
func RegisterRoutes(r weave.Registry, auth x.Authenticator, cashctrl cash.Controller)
RegisterRoutes will instantiate and register all handlers in this package
Types ¶
type CreateEscrowHandler ¶
type CreateEscrowHandler struct {
// contains filtered or unexported fields
}
CreateEscrowHandler will set a name for objects in this bucket
type CreateMsg ¶ added in v0.17.0
type CreateMsg struct { Metadata *weave.Metadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` Source github_com_iov_one_weave.Address `protobuf:"bytes,2,opt,name=source,proto3,casttype=github.com/iov-one/weave.Address" json:"source,omitempty"` Arbiter github_com_iov_one_weave.Address `protobuf:"bytes,3,opt,name=arbiter,proto3,casttype=github.com/iov-one/weave.Address" json:"arbiter,omitempty"` Destination github_com_iov_one_weave.Address `protobuf:"bytes,4,opt,name=destination,proto3,casttype=github.com/iov-one/weave.Address" json:"destination,omitempty"` // amount may contain multiple token types Amount []*coin.Coin `protobuf:"bytes,5,rep,name=amount,proto3" json:"amount,omitempty"` // Timeout represents wall clock time. Timeout github_com_iov_one_weave.UnixTime `protobuf:"varint,6,opt,name=timeout,proto3,casttype=github.com/iov-one/weave.UnixTime" json:"timeout,omitempty"` // max length 128 character Memo string `protobuf:"bytes,7,opt,name=memo,proto3" json:"memo,omitempty"` }
CreateMsg is a request to create an Escrow with some tokens. Message must be authorized by the source.
func NewCreateMsg ¶
func NewCreateMsg( source weave.Address, recipient weave.Address, arbiter weave.Address, amount coin.Coins, timeout weave.UnixTime, memo string, ) *CreateMsg
NewCreateMsg is a helper to quickly build a create escrow message
func (*CreateMsg) Descriptor ¶ added in v0.17.0
func (*CreateMsg) GetArbiter ¶ added in v0.17.0
func (m *CreateMsg) GetArbiter() github_com_iov_one_weave.Address
func (*CreateMsg) GetDestination ¶ added in v0.18.0
func (m *CreateMsg) GetDestination() github_com_iov_one_weave.Address
func (*CreateMsg) GetMetadata ¶ added in v0.17.0
func (*CreateMsg) GetSource ¶ added in v0.18.0
func (m *CreateMsg) GetSource() github_com_iov_one_weave.Address
func (*CreateMsg) GetTimeout ¶ added in v0.17.0
func (m *CreateMsg) GetTimeout() github_com_iov_one_weave.UnixTime
func (*CreateMsg) ProtoMessage ¶ added in v0.17.0
func (*CreateMsg) ProtoMessage()
func (*CreateMsg) XXX_DiscardUnknown ¶ added in v0.17.0
func (m *CreateMsg) XXX_DiscardUnknown()
func (*CreateMsg) XXX_Marshal ¶ added in v0.17.0
func (*CreateMsg) XXX_Unmarshal ¶ added in v0.17.0
type Escrow ¶
type Escrow struct { Metadata *weave.Metadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` Source github_com_iov_one_weave.Address `protobuf:"bytes,2,opt,name=source,proto3,casttype=github.com/iov-one/weave.Address" json:"source,omitempty"` Arbiter github_com_iov_one_weave.Address `protobuf:"bytes,3,opt,name=arbiter,proto3,casttype=github.com/iov-one/weave.Address" json:"arbiter,omitempty"` Destination github_com_iov_one_weave.Address `protobuf:"bytes,4,opt,name=destination,proto3,casttype=github.com/iov-one/weave.Address" json:"destination,omitempty"` // If unreleased before timeout, escrow will return to source. // Timeout represents wall clock time as read from the block header. Timeout // is represented using POSIX time format. // Expiration time is inclusive meaning that the escrow expires as soon as // the current time is equal or greater than timeout value. // nonexpired: [created, timeout) // expired: [timeout, infinity) Timeout github_com_iov_one_weave.UnixTime `protobuf:"varint,5,opt,name=timeout,proto3,casttype=github.com/iov-one/weave.UnixTime" json:"timeout,omitempty"` // max length 128 character Memo string `protobuf:"bytes,6,opt,name=memo,proto3" json:"memo,omitempty"` // Address of this entity. Set during creation and does not change. Address github_com_iov_one_weave.Address `protobuf:"bytes,7,opt,name=address,proto3,casttype=github.com/iov-one/weave.Address" json:"address,omitempty"` }
Escrow holds some coins. The arbiter or source can release them to the destination. The destination can return them to the source. Upon timeout, they will be returned to the source.
func AsEscrow ¶
AsEscrow extracts an *Escrow value or nil from the object Must be called on a Bucket result that is an *Escrow, will panic on bad type.
func (*Escrow) Descriptor ¶
func (*Escrow) GetAddress ¶ added in v0.19.0
func (m *Escrow) GetAddress() github_com_iov_one_weave.Address
func (*Escrow) GetArbiter ¶
func (m *Escrow) GetArbiter() github_com_iov_one_weave.Address
func (*Escrow) GetDestination ¶ added in v0.18.0
func (m *Escrow) GetDestination() github_com_iov_one_weave.Address
func (*Escrow) GetMetadata ¶ added in v0.15.0
func (*Escrow) GetSource ¶ added in v0.18.0
func (m *Escrow) GetSource() github_com_iov_one_weave.Address
func (*Escrow) GetTimeout ¶
func (m *Escrow) GetTimeout() github_com_iov_one_weave.UnixTime
func (*Escrow) ProtoMessage ¶
func (*Escrow) ProtoMessage()
func (*Escrow) XXX_DiscardUnknown ¶ added in v0.12.0
func (m *Escrow) XXX_DiscardUnknown()
func (*Escrow) XXX_Marshal ¶ added in v0.12.0
func (*Escrow) XXX_Unmarshal ¶ added in v0.12.0
type Initializer ¶ added in v0.12.0
type Initializer struct {
Minter cash.CoinMinter
}
Initializer fulfils the Initializer interface to load data from the genesis file
func (*Initializer) FromGenesis ¶ added in v0.12.0
func (i *Initializer) FromGenesis(opts weave.Options, params weave.GenesisParams, kv weave.KVStore) error
FromGenesis will parse initial escrow info from genesis and save it in the database.
type ReleaseEscrowHandler ¶
type ReleaseEscrowHandler struct {
// contains filtered or unexported fields
}
ReleaseEscrowHandler will set a name for objects in this bucket.
type ReleaseMsg ¶ added in v0.17.0
type ReleaseMsg struct { Metadata *weave.Metadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` EscrowId []byte `protobuf:"bytes,2,opt,name=escrow_id,json=escrowId,proto3" json:"escrow_id,omitempty"` Amount []*coin.Coin `protobuf:"bytes,3,rep,name=amount,proto3" json:"amount,omitempty"` }
ReleaseMsg releases the content to the destination. Message must be authorized by the source or arbiter. If amount not provided, defaults to entire escrow, May be a subset of the current balance.
func (*ReleaseMsg) Descriptor ¶ added in v0.17.0
func (*ReleaseMsg) Descriptor() ([]byte, []int)
func (*ReleaseMsg) GetAmount ¶ added in v0.17.0
func (m *ReleaseMsg) GetAmount() []*coin.Coin
func (*ReleaseMsg) GetEscrowId ¶ added in v0.17.0
func (m *ReleaseMsg) GetEscrowId() []byte
func (*ReleaseMsg) GetMetadata ¶ added in v0.17.0
func (m *ReleaseMsg) GetMetadata() *weave.Metadata
func (*ReleaseMsg) Marshal ¶ added in v0.17.0
func (m *ReleaseMsg) Marshal() (dAtA []byte, err error)
func (*ReleaseMsg) MarshalTo ¶ added in v0.17.0
func (m *ReleaseMsg) MarshalTo(dAtA []byte) (int, error)
func (ReleaseMsg) Path ¶ added in v0.17.0
func (ReleaseMsg) Path() string
func (*ReleaseMsg) ProtoMessage ¶ added in v0.17.0
func (*ReleaseMsg) ProtoMessage()
func (*ReleaseMsg) Reset ¶ added in v0.17.0
func (m *ReleaseMsg) Reset()
func (*ReleaseMsg) Size ¶ added in v0.17.0
func (m *ReleaseMsg) Size() (n int)
func (*ReleaseMsg) String ¶ added in v0.17.0
func (m *ReleaseMsg) String() string
func (*ReleaseMsg) Unmarshal ¶ added in v0.17.0
func (m *ReleaseMsg) Unmarshal(dAtA []byte) error
func (*ReleaseMsg) Validate ¶ added in v0.17.0
func (m *ReleaseMsg) Validate() error
Validate makes sure that this is sensible
func (*ReleaseMsg) XXX_DiscardUnknown ¶ added in v0.17.0
func (m *ReleaseMsg) XXX_DiscardUnknown()
func (*ReleaseMsg) XXX_Marshal ¶ added in v0.17.0
func (m *ReleaseMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ReleaseMsg) XXX_Merge ¶ added in v0.17.0
func (m *ReleaseMsg) XXX_Merge(src proto.Message)
func (*ReleaseMsg) XXX_Size ¶ added in v0.17.0
func (m *ReleaseMsg) XXX_Size() int
func (*ReleaseMsg) XXX_Unmarshal ¶ added in v0.17.0
func (m *ReleaseMsg) XXX_Unmarshal(b []byte) error
type ReturnEscrowHandler ¶
type ReturnEscrowHandler struct {
// contains filtered or unexported fields
}
ReturnEscrowHandler will set a name for objects in this bucket
type ReturnMsg ¶ added in v0.17.0
type ReturnMsg struct { Metadata *weave.Metadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` EscrowId []byte `protobuf:"bytes,2,opt,name=escrow_id,json=escrowId,proto3" json:"escrow_id,omitempty"` }
ReturnMsg returns the content to the source. Must be authorized by the source or an expired timeout
func (*ReturnMsg) Descriptor ¶ added in v0.17.0
func (*ReturnMsg) GetEscrowId ¶ added in v0.17.0
func (*ReturnMsg) GetMetadata ¶ added in v0.17.0
func (*ReturnMsg) ProtoMessage ¶ added in v0.17.0
func (*ReturnMsg) ProtoMessage()
func (*ReturnMsg) XXX_DiscardUnknown ¶ added in v0.17.0
func (m *ReturnMsg) XXX_DiscardUnknown()
func (*ReturnMsg) XXX_Marshal ¶ added in v0.17.0
func (*ReturnMsg) XXX_Unmarshal ¶ added in v0.17.0
type UpdateEscrowHandler ¶
type UpdateEscrowHandler struct {
// contains filtered or unexported fields
}
UpdateEscrowHandler will set a name for objects in this bucket.
type UpdatePartiesMsg ¶ added in v0.17.0
type UpdatePartiesMsg struct { Metadata *weave.Metadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` EscrowId []byte `protobuf:"bytes,2,opt,name=escrow_id,json=escrowId,proto3" json:"escrow_id,omitempty"` Source github_com_iov_one_weave.Address `protobuf:"bytes,3,opt,name=source,proto3,casttype=github.com/iov-one/weave.Address" json:"source,omitempty"` Arbiter github_com_iov_one_weave.Address `protobuf:"bytes,4,opt,name=arbiter,proto3,casttype=github.com/iov-one/weave.Address" json:"arbiter,omitempty"` Destination github_com_iov_one_weave.Address `protobuf:"bytes,5,opt,name=destination,proto3,casttype=github.com/iov-one/weave.Address" json:"destination,omitempty"` }
UpdatePartiesMsg changes any of the parties of the escrow: source, arbiter, destination. This must be authorized by the current holder of that position (eg. only source can update source).
Represents delegating responsibility
func (*UpdatePartiesMsg) Descriptor ¶ added in v0.17.0
func (*UpdatePartiesMsg) Descriptor() ([]byte, []int)
func (*UpdatePartiesMsg) GetArbiter ¶ added in v0.17.0
func (m *UpdatePartiesMsg) GetArbiter() github_com_iov_one_weave.Address
func (*UpdatePartiesMsg) GetDestination ¶ added in v0.18.0
func (m *UpdatePartiesMsg) GetDestination() github_com_iov_one_weave.Address
func (*UpdatePartiesMsg) GetEscrowId ¶ added in v0.17.0
func (m *UpdatePartiesMsg) GetEscrowId() []byte
func (*UpdatePartiesMsg) GetMetadata ¶ added in v0.17.0
func (m *UpdatePartiesMsg) GetMetadata() *weave.Metadata
func (*UpdatePartiesMsg) GetSource ¶ added in v0.18.0
func (m *UpdatePartiesMsg) GetSource() github_com_iov_one_weave.Address
func (*UpdatePartiesMsg) Marshal ¶ added in v0.17.0
func (m *UpdatePartiesMsg) Marshal() (dAtA []byte, err error)
func (*UpdatePartiesMsg) MarshalTo ¶ added in v0.17.0
func (m *UpdatePartiesMsg) MarshalTo(dAtA []byte) (int, error)
func (UpdatePartiesMsg) Path ¶ added in v0.17.0
func (UpdatePartiesMsg) Path() string
func (*UpdatePartiesMsg) ProtoMessage ¶ added in v0.17.0
func (*UpdatePartiesMsg) ProtoMessage()
func (*UpdatePartiesMsg) Reset ¶ added in v0.17.0
func (m *UpdatePartiesMsg) Reset()
func (*UpdatePartiesMsg) Size ¶ added in v0.17.0
func (m *UpdatePartiesMsg) Size() (n int)
func (*UpdatePartiesMsg) String ¶ added in v0.17.0
func (m *UpdatePartiesMsg) String() string
func (*UpdatePartiesMsg) Unmarshal ¶ added in v0.17.0
func (m *UpdatePartiesMsg) Unmarshal(dAtA []byte) error
func (*UpdatePartiesMsg) Validate ¶ added in v0.17.0
func (m *UpdatePartiesMsg) Validate() error
Validate makes sure any included items are valid permissions and there is at least one change
func (*UpdatePartiesMsg) XXX_DiscardUnknown ¶ added in v0.17.0
func (m *UpdatePartiesMsg) XXX_DiscardUnknown()
func (*UpdatePartiesMsg) XXX_Marshal ¶ added in v0.17.0
func (m *UpdatePartiesMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*UpdatePartiesMsg) XXX_Merge ¶ added in v0.17.0
func (m *UpdatePartiesMsg) XXX_Merge(src proto.Message)
func (*UpdatePartiesMsg) XXX_Size ¶ added in v0.17.0
func (m *UpdatePartiesMsg) XXX_Size() int
func (*UpdatePartiesMsg) XXX_Unmarshal ¶ added in v0.17.0
func (m *UpdatePartiesMsg) XXX_Unmarshal(b []byte) error