Documentation
¶
Index ¶
- Constants
- Variables
- type BidAsset
- type BidAssetType
- type BidConv
- type BidConvId
- type BidConvState
- type BidConvStore
- func (bcs *BidConvStore) Delete(key BidConvId) (bool, error)
- func (bcs *BidConvStore) Exists(key BidConvId) bool
- func (bcs *BidConvStore) FilterBidConvs(bidState BidConvState, owner keys.Address, assetName string, ...) []BidConv
- func (bcs *BidConvStore) Get(bidId BidConvId) (*BidConv, error)
- func (bcs *BidConvStore) GetState() *storage.State
- func (bcs *BidConvStore) Iterate(fn func(id BidConvId, bid *BidConv) bool) (stopped bool)
- func (bcs *BidConvStore) QueryAllStores(key BidConvId) (*BidConv, BidConvState, error)
- func (bcs *BidConvStore) Set(bid *BidConv) error
- func (bcs *BidConvStore) WithPrefixType(prefixType BidConvState) *BidConvStore
- func (bcs *BidConvStore) WithState(state *storage.State) *BidConvStore
- type BidDecision
- type BidMasterStore
- type BidOffer
- type BidOfferAmountStatus
- type BidOfferStatus
- type BidOfferStore
- func (bos *BidOfferStore) DeleteActiveOffer(offer BidOffer) error
- func (bos *BidOfferStore) GetActiveOffer(bId BidConvId, oType BidOfferType) (*BidOffer, error)
- func (bos *BidOfferStore) GetInActiveOffers(bId BidConvId, oType BidOfferType) []BidOffer
- func (bos *BidOfferStore) SetActiveOffer(offer BidOffer) error
- func (bos *BidOfferStore) SetInActiveOffer(offer BidOffer) error
- func (bos *BidOfferStore) WithState(state *storage.State) *BidOfferStore
- type BidOfferType
- type DomainAsset
- func (da *DomainAsset) ExchangeAsset(ctx *action.Context, bidder action.Address, preOwner action.Address) (bool, error)
- func (da *DomainAsset) NewAssetWithName(name string) BidAsset
- func (da *DomainAsset) ToString() string
- func (da *DomainAsset) ValidateAsset(ctx *action.Context, owner action.Address) (bool, error)
- type ExampleAsset
- func (ea *ExampleAsset) ExchangeAsset(ctx *action.Context, bidder action.Address, preOwner action.Address) (bool, error)
- func (ea *ExampleAsset) NewAssetWithName(name string) BidAsset
- func (ea *ExampleAsset) ToString() string
- func (ea *ExampleAsset) ValidateAsset(ctx *action.Context, owner action.Address) (bool, error)
Constants ¶
View Source
const ( //Bid States BidStateInvalid BidConvState = 0xEE BidStateActive BidConvState = 0x01 BidStateSucceed BidConvState = 0x02 BidStateCancelled BidConvState = 0x03 BidStateExpired BidConvState = 0x04 BidStateRejected BidConvState = 0x05 EmptyStr = "" //Bid Offer Type TypeBidOffer BidOfferType = 0x01 TypeCounterOffer BidOfferType = 0x02 TypeInvalid BidOfferType = 0x03 //Bid Offer Amount Lock Status BidAmountLocked BidOfferAmountStatus = 0x01 BidAmountUnlocked BidOfferAmountStatus = 0x02 CounterOfferAmount BidOfferAmountStatus = 0x03 BidAmountTransferred BidOfferAmountStatus = 0x04 //Bid Decision AcceptBid BidDecision = 0x01 RejectBid BidDecision = 0x02 //Bid Asset Type BidAssetInvalid BidAssetType = 0xEE BidAssetOns BidAssetType = 0x21 BidAssetExample BidAssetType = 0x22 //Bid Id length based on hash algorithm SHA256LENGTH int = 0x40 ActiveOfferPrefix string = "ACTIVE" InactiveOfferPrefix string = "INACTIVE" )
Variables ¶
View Source
var ( ErrInvalidBidConvId = codes.ProtocolError{bid_error.BidErrInvalidBidConvId, "invalid bid conversation id"} ErrInvalidAsset = codes.ProtocolError{bid_error.BidErrInvalidAsset, "invalid bid asset"} ErrFailedCreateBidConv = codes.ProtocolError{bid_error.BidErrFailedCreateBidConv, "failed to create bid conversation"} ErrGettingBidMasterStore = codes.ProtocolError{bid_error.BidErrGettingBidMasterStore, "failed to get bid master store"} ErrBidConvNotFound = codes.ProtocolError{bid_error.BidErrBidConvNotFound, "bid conversation not found"} ErrGettingBidConv = codes.ProtocolError{bid_error.BidErrGettingBidConv, "failed to get bid conversation"} ErrExpiredBid = codes.ProtocolError{bid_error.BidErrExpiredBid, "the bid is already expired"} ErrGettingActiveOffer = codes.ProtocolError{bid_error.BidErrGettingActiveOffer, "failed to get active offer"} ErrGettingActiveBidOffer = codes.ProtocolError{bid_error.BidErrGettingActiveBidOffer, "failed to get active bid offer"} ErrGettingActiveCounterOffer = codes.ProtocolError{bid_error.BidErrGettingActiveCounterOffer, "failed to get active counter offer"} ErrDeactivateOffer = codes.ProtocolError{bid_error.BidErrDeactivateOffer, "failed to deactivate offer"} ErrCloseBidConv = codes.ProtocolError{bid_error.BidErrCloseBidConv, "failed to close bid conversation"} ErrAmountMoreThanActiveCounterOffer = codes.ProtocolError{bid_error.BidErrAmountMoreThanActiveCounterOffer, "amount should not be larger than active counter offer amount"} ErrAmountLessThanActiveOffer = codes.ProtocolError{bid_error.BidErrAmountLessThanActiveOffer, "amount should not be less than active bid offer amount"} ErrLockAmount = codes.ProtocolError{bid_error.BidErrLockAmount, "failed to lock amount"} ErrUnlockAmount = codes.ProtocolError{bid_error.BidErrUnlockAmount, "failed to unlock amount"} ErrAddingOffer = codes.ProtocolError{bid_error.BidErrAddingOffer, "failed to add bid offer"} ErrAddingCounterOffer = codes.ProtocolError{bid_error.BidErrAddingCounterOffer, "failed to add counter offer"} ErrInvalidDeadline = codes.ProtocolError{bid_error.BidErrInvalidDeadline, "invalid bid conversation deadline"} ErrActiveBidConvExists = codes.ProtocolError{bid_error.BidErrActiveBidConvExists, "bid conversation with same id already exists"} ErrAddingBidConvToActiveStore = codes.ProtocolError{bid_error.BidErrAddingBidConvToActiveStore, "failed to add bid conversation to active store"} ErrWrongBidder = codes.ProtocolError{bid_error.BidErrWrongBidder, "bidder not match"} ErrWrongAssetOwner = codes.ProtocolError{bid_error.BidErrWrongAssetOwner, "asset owner not match"} ErrDeductingAmountFromBidder = codes.ProtocolError{bid_error.BidErrDeductingAmountFromBidder, "failed to deduct amount from bidder"} ErrAdddingAmountToOwner = codes.ProtocolError{bid_error.BidErrAdddingAmountToOwner, "failed to add amount to asset owner"} ErrSetOffer = codes.ProtocolError{bid_error.BidErrSetOffer, "failed to set offer"} ErrAssertingBidMasterStore = codes.ProtocolError{bid_error.BidErrAssertingBidMasterStore, "failed to assert bid master store"} ErrAddingBidConvToTargetStore = codes.ProtocolError{bid_error.BidErrAddingBidConvToTargetStore, "failed to add bid conversation to target store"} ErrDeletingBidConvFromActiveStore = codes.ProtocolError{bid_error.BidErrDeletingBidConvFromActiveStore, "failed to delete bid conversation from active store"} ErrInvalidOfferType = codes.ProtocolError{bid_error.BidErrInvalidOfferType, "invalid offer type"} ErrFailedToDeleteActiveOffer = codes.ProtocolError{bid_error.BidErrFailedToDeleteActiveOffer, "failed to delete active offer"} ErrInvalidBidderDecision = codes.ProtocolError{bid_error.BidErrInvalidBidderDecision, "invalid bidder decision"} ErrInvalidOwnerDecision = codes.ProtocolError{bid_error.BidErrInvalidOwnerDecision, "invalid owner decision"} ErrFailedToExchangeAsset = codes.ProtocolError{bid_error.BidErrFailedToExchangeAsset, "failed to exchange asset"} ErrFailedInSerialization = codes.ProtocolError{bid_error.BidErrFailedInSerialization, "failed to serialize"} ErrFailedInDeserialization = codes.ProtocolError{bid_error.BidErrFailedInDeserialization, "failed to deserialize"} ErrSettingRecord = codes.ProtocolError{bid_error.BidErrSettingRecord, "failed to set record"} ErrGettingRecord = codes.ProtocolError{bid_error.BidErrGettingRecord, "failed to get record"} ErrDeletingRecord = codes.ProtocolError{bid_error.BidErrDeletingRecord, "failed to delete record"} ErrWrongTypeForActiveOffer = codes.ProtocolError{bid_error.BidErrWrongTypeForActiveOffer, "active offer type is incorrect"} ErrInvalidDomain = codes.ProtocolError{bid_error.BidErrInvalidDomain, "error domain not valid"} ErrDomainNotExists = codes.ProtocolError{bid_error.BidErrDomainNotExists, "error domain does not exist, you can just create it"} ErrGettingDomain = codes.ProtocolError{bid_error.BidErrGettingDomain, "failed to get domain"} ErrDomainOnSale = codes.ProtocolError{bid_error.BidErrDomainOnSale, "error domain is on sale, you can just buy it"} ErrDomainOwnerUnmatch = codes.ProtocolError{bid_error.BidErrDomainOwnerUnmatch, "error domain does not owned by this owner"} ErrDomainExpired = codes.ProtocolError{bid_error.BidErrDomainExpired, "error domain expired, you can just create it"} ErrDomainNotChangeable = codes.ProtocolError{bid_error.BidErrDomainNotChangeable, "error domain not changeable, please wait for another 2 blocks"} )
Functions ¶
This section is empty.
Types ¶
type BidAssetType ¶
type BidAssetType int
type BidConv ¶
type BidConvState ¶
type BidConvState int
type BidConvStore ¶
type BidConvStore struct {
// contains filtered or unexported fields
}
func NewBidConvStore ¶
func (*BidConvStore) Exists ¶
func (bcs *BidConvStore) Exists(key BidConvId) bool
func (*BidConvStore) FilterBidConvs ¶
func (bcs *BidConvStore) FilterBidConvs(bidState BidConvState, owner keys.Address, assetName string, assetType BidAssetType, bidder keys.Address) []BidConv
func (*BidConvStore) GetState ¶
func (bcs *BidConvStore) GetState() *storage.State
func (*BidConvStore) Iterate ¶
func (bcs *BidConvStore) Iterate(fn func(id BidConvId, bid *BidConv) bool) (stopped bool)
func (*BidConvStore) QueryAllStores ¶
func (bcs *BidConvStore) QueryAllStores(key BidConvId) (*BidConv, BidConvState, error)
func (*BidConvStore) Set ¶
func (bcs *BidConvStore) Set(bid *BidConv) error
func (*BidConvStore) WithPrefixType ¶
func (bcs *BidConvStore) WithPrefixType(prefixType BidConvState) *BidConvStore
func (*BidConvStore) WithState ¶
func (bcs *BidConvStore) WithState(state *storage.State) *BidConvStore
type BidDecision ¶
type BidDecision int
type BidMasterStore ¶
type BidMasterStore struct { BidConv *BidConvStore BidOffer *BidOfferStore }
func ConstructBidMasterStore ¶
func ConstructBidMasterStore(bc *BidConvStore, bo *BidOfferStore) *BidMasterStore
func NewBidMasterStore ¶
func NewBidMasterStore(chainstate *storage.ChainState) *BidMasterStore
type BidOffer ¶
type BidOffer struct { BidConvId BidConvId `json:"bidConvId"` OfferType BidOfferType `json:"offerType"` OfferTime int64 `json:"offerTime"` AcceptTime int64 `json:"acceptTime"` RejectTime int64 `json:"rejectTime"` Amount action.Amount `json:"amount"` AmountStatus BidOfferAmountStatus `json:"amountStatus"` }
func NewBidOffer ¶
func NewBidOffer(bidConvId BidConvId, offerType BidOfferType, offerTime int64, amount action.Amount, amountStatus BidOfferAmountStatus) *BidOffer
type BidOfferAmountStatus ¶
type BidOfferAmountStatus int
type BidOfferStatus ¶
type BidOfferStatus int
type BidOfferStore ¶
func NewBidOfferStore ¶
func NewBidOfferStore(prefix string, state *storage.State) *BidOfferStore
func (*BidOfferStore) DeleteActiveOffer ¶
func (bos *BidOfferStore) DeleteActiveOffer(offer BidOffer) error
func (*BidOfferStore) GetActiveOffer ¶
func (bos *BidOfferStore) GetActiveOffer(bId BidConvId, oType BidOfferType) (*BidOffer, error)
func (*BidOfferStore) GetInActiveOffers ¶
func (bos *BidOfferStore) GetInActiveOffers(bId BidConvId, oType BidOfferType) []BidOffer
func (*BidOfferStore) SetActiveOffer ¶
func (bos *BidOfferStore) SetActiveOffer(offer BidOffer) error
func (*BidOfferStore) SetInActiveOffer ¶
func (bos *BidOfferStore) SetInActiveOffer(offer BidOffer) error
func (*BidOfferStore) WithState ¶
func (bos *BidOfferStore) WithState(state *storage.State) *BidOfferStore
type BidOfferType ¶
type BidOfferType int
type DomainAsset ¶
type DomainAsset struct {
// contains filtered or unexported fields
}
func (*DomainAsset) ExchangeAsset ¶
func (*DomainAsset) NewAssetWithName ¶
func (da *DomainAsset) NewAssetWithName(name string) BidAsset
func (*DomainAsset) ToString ¶
func (da *DomainAsset) ToString() string
func (*DomainAsset) ValidateAsset ¶
type ExampleAsset ¶
type ExampleAsset struct {
// contains filtered or unexported fields
}
func (*ExampleAsset) ExchangeAsset ¶
func (*ExampleAsset) NewAssetWithName ¶
func (ea *ExampleAsset) NewAssetWithName(name string) BidAsset
func (*ExampleAsset) ToString ¶
func (ea *ExampleAsset) ToString() string
func (*ExampleAsset) ValidateAsset ¶
Click to show internal directories.
Click to hide internal directories.