Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DealAcceptedTopic = common.HexToHash("0x3a38edea6028913403c74ce8433c90eca94f4ca074d318d8cb77be5290ba4f15")
View Source
var DealClosedTopic = common.HexToHash("0x72615f99a62a6cc2f8452d5c0c9cbc5683995297e1d988f09bb1471d4eefb890")
View Source
var DealOpenedTopic = common.HexToHash("0x873cb35202fef184c9f8ee23c04e36dc38f3e26fb285224ca574a837be976848")
Functions ¶
This section is empty.
Types ¶
type Blockchainer ¶
Blockchainer interface describes operations with deals and tokens
type Dealer ¶
type Dealer interface {
// OpenDeal is function to open new deal in blockchain from given address,
// it have effect to change blockchain state, key is mandatory param
// other params caused by SONM office's agreement
// It could be called by client
// return transaction, not deal id
OpenDeal(key *ecdsa.PrivateKey, deal *pb.Deal) (*types.Transaction, error)
// OpenDealPending creates deal and waits for transaction to be committed on blockchain.
// wait is duration to wait for transaction commit, recommended value is 180 seconds.
OpenDealPending(ctx context.Context, key *ecdsa.PrivateKey, deal *pb.Deal, wait time.Duration) (*big.Int, error)
// AcceptDeal accepting deal by hub, causes that hub accept to sell its resources
// It could be called by hub
AcceptDeal(key *ecdsa.PrivateKey, id *big.Int) (*types.Transaction, error)
// CloseDeal closing deal by given id
// It could be called by client
CloseDeal(key *ecdsa.PrivateKey, id *big.Int) (*types.Transaction, error)
// GetDeals is returns ids by given address
GetDeals(address string) ([]*big.Int, error)
// GetDealInfo is returns deal info by given id
GetDealInfo(id *big.Int) (*pb.Deal, error)
// GetDealAmount return global deal counter
GetDealAmount() (*big.Int, error)
// GetOpenedDeal returns only opened deals by given hub/client addresses
GetOpenedDeal(hubAddr string, clientAddr string) ([]*big.Int, error)
// GetAcceptedDeal returns only accepted deals by given hub/client addresses
GetAcceptedDeal(hubAddr string, clientAddr string) ([]*big.Int, error)
// GetClosedDeal returns only closed deals by given hub/client addresses
GetClosedDeal(hubAddr string, clientAddr string) ([]*big.Int, error)
}
Dealer - interface above SONM deals client - who wanna buy hub - who wanna selling its resources WARN: this may change at future, by any proposal
type Tokener ¶
type Tokener interface {
// Approve - add allowance from caller to other contract to spend tokens
Approve(key *ecdsa.PrivateKey, to string, amount *big.Int) (*types.Transaction, error)
// Transfer token from caller
Transfer(key *ecdsa.PrivateKey, to string, amount *big.Int) (*types.Transaction, error)
// TransferFrom fallback function for contracts to transfer you allowance
TransferFrom(key *ecdsa.PrivateKey, from string, to string, amount *big.Int) (*types.Transaction, error)
// BalanceOf returns balance of given address
BalanceOf(address string) (*big.Int, error)
// AllowanceOf returns allowance of given address to spender account
AllowanceOf(from string, to string) (*big.Int, error)
// TotalSupply - all amount of emitted token
TotalSupply() (*big.Int, error)
// GetTokens - send 100 SNMT token for message caller
// this function added for MVP purposes and has been deleted later
GetTokens(key *ecdsa.PrivateKey) (*types.Transaction, error)
}
Tokener is go implementation of ERC20-compatibility token with full functionality high-level interface standart description with placed: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
Click to show internal directories.
Click to hide internal directories.