Documentation ¶
Index ¶
- Variables
- type Interface
- type IssueFunc
- type SendChequeFunc
- type Service
- func (s *Service) EmitCheque(ctx context.Context, peer string, amount *big.Int, contractId string, ...) (balance *big.Int, err error)
- func (s *Service) GetChainID() int64
- func (s *Service) Handler(ctx context.Context, requestPid string, encodedCheque string, ...) (err error)
- func (s *Service) SetSwap(swap Swap)
- type Swap
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Req *cmds.Request Env cmds.Environment )
View Source
var ( ErrNegotiateRate = errors.New("exchange rates mismatch") ErrGetBeneficiary = errors.New("get beneficiary err") )
Functions ¶
This section is empty.
Types ¶
type Interface ¶
type Interface interface { // EmitCheque sends a signed cheque to a peer. EmitCheque(ctx context.Context, peer string, amount *big.Int, contractId string, token common.Address, issue IssueFunc) (balance *big.Int, err error) }
Interface is the main interface to send messages over swap protocol.
type SendChequeFunc ¶
type SendChequeFunc vault.SendChequeFunc
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the main implementation of the swap protocol.
var SwapProtocol *Service
func New ¶
func New(beneficiary common.Address, priceOracle priceoracle.Service) *Service
New creates a new swap protocol Service.
func (*Service) EmitCheque ¶
func (s *Service) EmitCheque(ctx context.Context, peer string, amount *big.Int, contractId string, token common.Address, issue IssueFunc) (balance *big.Int, err error)
InitiateCheque attempts to send a cheque to a peer.
func (*Service) GetChainID ¶
type Swap ¶
type Swap interface { // ReceiveCheque is called by the swap protocol if a cheque is received. ReceiveCheque(ctx context.Context, peer string, cheque *vault.SignedCheque, realAmount *big.Int, token common.Address) error GetChainid() int64 PutBeneficiary(peer string, beneficiary common.Address) (common.Address, error) Beneficiary(peer string) (beneficiary common.Address, known bool, err error) }
Swap is the interface the settlement layer should implement to receive cheques.
Click to show internal directories.
Click to hide internal directories.