Documentation ¶
Overview ¶
Package example provides smart contracts for building example of system work.
Entities:
MemberDomain - domain that allows to add new members to system. Usage: factory := NewMemberDomainFactory(factoryParent) mDomain, error := factory.Create(domainParent) record, err := mDomain.CreateMember() memberProxy, err := mDomain.GetMember(record) Member - smart contract that represent user of the system. Usage: // because type of member is a child of memberDomain factory := NewMemberFactory(memberDomain) m, error := factory.Create(parent)
////
WalletDomain - domain that allows to add new wallets to system Usage: factory := NewWalletDomainFactory(factoryParent) wDomain, err := factory.Create(domainParent) // since Create inject composite to member err := wDomain.CreateWallet(member) Wallet - smart contract that represent wallet Usage: factory := NewWalletFactory(walletDomain) w, err := factory.Create(parent)
////
Get user balance example: wFactory := NewWalletFactory(walletDomain) w := m.GetOrCreateComposite(wFactory) w.GetBalance()
////
Allowance - smart contract that represent allowance during money transmission between wallets Usage: factory := NewAllowanceFactory(walletDomain) al, err := factory.Create(parent)
Index ¶
- Constants
- func NewAllowanceFactory(parent object.Parent) (object.CompositeFactory, error)
- func NewMemberDomainFactory(parent object.Parent) object.Factory
- func NewMemberFactory(parent object.Parent) object.Factory
- func NewWalletDomainFactory(pt object.Parent) object.Factory
- func NewWalletFactory(parent object.Parent) object.CompositeFactory
- type Allowance
- type AllowanceCompositeCollection
- type Member
- type MemberDomain
- type Wallet
- type WalletDomain
Constants ¶
View Source
const MemberDomainName = "MemberDomain"
MemberDomainName is a name for member domain.
View Source
const WalletDomainName = "WalletDomain"
WalletDomainName is a name for wallet domain.
Variables ¶
This section is empty.
Functions ¶
func NewAllowanceFactory ¶ added in v0.0.3
func NewAllowanceFactory(parent object.Parent) (object.CompositeFactory, error)
func NewMemberDomainFactory ¶
NewMemberDomainFactory creates new factory for MemberDomain.
func NewMemberFactory ¶
NewMemberFactory creates new factory for Member.
func NewWalletFactory ¶
func NewWalletFactory(parent object.Parent) object.CompositeFactory
Types ¶
type Allowance ¶ added in v0.0.3
type AllowanceCompositeCollection ¶ added in v0.0.3
type AllowanceCompositeCollection struct { contract.BaseCompositeCollection // contains filtered or unexported fields }
func (*AllowanceCompositeCollection) GetClass ¶ added in v0.0.3
func (acc *AllowanceCompositeCollection) GetClass() object.Proxy
func (*AllowanceCompositeCollection) GetClassID ¶ added in v0.0.3
func (acc *AllowanceCompositeCollection) GetClassID() string
func (*AllowanceCompositeCollection) GetInterfaceKey ¶ added in v0.0.3
func (*AllowanceCompositeCollection) GetInterfaceKey() string
func (*AllowanceCompositeCollection) GetParent ¶ added in v0.0.3
func (acc *AllowanceCompositeCollection) GetParent() object.Parent
type Member ¶
type Member interface { object.ComposingContainer contract.SmartContract GetUsername() string GetPublicKey() string }
type MemberDomain ¶
type MemberDomain interface { // Base domain implementation. domain.Domain // CreateMember is used to create new member as a child to domain storage. CreateMember() (string, error) // GetMember returns member from its record in domain storage. GetMember(string) (Member, error) }
MemberDomain is a contract that allows to add new members to system.
Click to show internal directories.
Click to hide internal directories.