Documentation
¶
Index ¶
- Constants
- type Address
- type Asset
- type AssetAssuranceSigned
- type AssetDeposited
- type LPDone
- type MultiSigWalletSecurity
- type MultisigWallet
- type Pair
- func (p Pair) AssetOfParticipant(address Address) Asset
- func (p Pair) HasAsset(asset Asset) bool
- func (p Pair) HasAssurancesForAsset(asset Asset) bool
- func (p Pair) HasDepositForAsset(asset Asset) bool
- func (p Pair) HasLPForAsset(asset Asset) bool
- func (p Pair) HasParticipant(address Address) bool
- func (p *Pair) Register(r eventsourcing.RegisterFunc)
- func (p *Pair) Transition(event eventsourcing.Event)
- type PairCreated
- type PairMatched
- type PairStatus
- type PairStatusChanged
- type Plan
- type PlanCreated
- type ProfitSharingStrategy
- type SignedTx
- type TxHash
- type WalletAddressConfirmed
- type WithdrawTxSigned
- type Withdrawn
Constants ¶
const EmptyAddress = ""
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssetAssuranceSigned ¶
type AssetAssuranceSigned struct {
Asset Asset `json:"asset,omitempty"`
Tx SignedTx `json:"tx,omitempty"`
}
AssetAssuranceSigned is the event for signing the assurance transaction for the asset.
type AssetDeposited ¶
type AssetDeposited struct {
Asset Asset `json:"asset,omitempty"`
TxHash TxHash `json:"tx_hash,omitempty"`
}
AssetDeposited is the event for signing the transfer transaction for the asset.
type LPDone ¶
type LPDone struct {
Asset Asset `json:"asset,omitempty"`
TxHash TxHash `json:"tx_hash,omitempty"`
Deadline time.Time `json:"deadline,omitempty"`
}
LPDone is the event for when the liquidity providing is done.
type MultiSigWalletSecurity ¶
type MultiSigWalletSecurity string
MultiSigWalletSecurity is the type of security method used for threshold signature wallet In case of 2-2, both parties need to agree on signing the withdrawal transaction and in case of 2-3, a third-party signer is added as mediator.
const (
MultiSigWalletSecurity2Of2 MultiSigWalletSecurity = "2-2"
)
type MultisigWallet ¶
type MultisigWallet struct {
PublicKeys map[Asset]string `json:"public_keys,omitempty"`
Addresses map[Asset]Address `json:"addresses,omitempty"`
EncryptionKey string `json:"encryption_key,omitempty"`
HexChainCode string `json:"hex_chain_code,omitempty"`
}
MultisigWallet is the shared wallet for the pair of participants
func (*MultisigWallet) AreAddressesEqual ¶
func (w *MultisigWallet) AreAddressesEqual(addresses map[Asset]Address) bool
type Pair ¶
type Pair struct {
eventsourcing.AggregateRoot
Status PairStatus `json:"status,omitempty"`
Assets []Asset `json:"assets,omitempty"`
ParticipantsAddress map[Asset]Address `json:"participants_address,omitempty"`
InvestingPeriod int `json:"investing_period,omitempty"`
WalletSecurity MultiSigWalletSecurity `json:"wallet_security,omitempty"`
ProfitSharingStrategy ProfitSharingStrategy `json:"profit_sharing_strategy,omitempty"`
LossProtection float64 `json:"loss_protection,omitempty"`
Wallet *MultisigWallet `json:"wallet,omitempty"`
Assurances map[Asset][]SignedTx `json:"assurances,omitempty"`
Deposits map[Asset]TxHash `json:"deposits,omitempty"`
WithdrawTx *SignedTx `json:"withdraw_tx,omitempty"`
LP map[Asset]TxHash `json:"lp,omitempty"`
Deadline time.Time `json:"deadline,omitempty"`
WithdrawnTx *TxHash `json:"withdrawn_tx,omitempty"`
}
Pair is the aggregate root for a pair of participates going through a liquidity providing process for a pair of crypto assets. We create a Pair for an individual participant for a plan with validated account address that has more than the required quantum of assets in $. After that the Pair is thrown in a queue or pool of Pairs with the ShareValue same as the quantum of the selected plan. The Pair is then matched with another participant who has interest in the same plan but with the counterpart asset. The participants then go through creating a shared wallet with the required security method and series of steps for the liquidity providing process.
func (Pair) AssetOfParticipant ¶
AssetOfParticipant returns the asset of the participant
func (Pair) HasAssurancesForAsset ¶
HasAssurancesForAsset checks if the pair has assurances for the asset
func (Pair) HasDepositForAsset ¶
HasDepositForAsset checks if the pair has deposits for the asset
func (Pair) HasLPForAsset ¶
HasLPForAsset checks if the pair has liquidity providing for the asset
func (Pair) HasParticipant ¶
HasParticipant checks if the pair has the participant
func (*Pair) Register ¶
func (p *Pair) Register(r eventsourcing.RegisterFunc)
Register implements aggregate.Register
func (*Pair) Transition ¶
func (p *Pair) Transition(event eventsourcing.Event)
Transition implements aggregate.Transition
type PairCreated ¶
type PairCreated struct {
ParticipantAsset Asset `json:"participant_asset,omitempty"`
ParticipantAddress Address `json:"participant_address,omitempty"`
SecondaryAsset Asset `json:"secondary_asset,omitempty"`
InvestingPeriod int `json:"investing_period,omitempty"`
WalletSecurity MultiSigWalletSecurity `json:"wallet_security,omitempty"`
ProfitSharingStrategy ProfitSharingStrategy `json:"profit_sharing_strategy,omitempty"`
LossProtection float64 `json:"loss_protection,omitempty"`
}
PairCreated is the event for creating a new pair for the first time.
type PairMatched ¶
type PairMatched struct {
ParticipantAddress Address `json:"participant_address,omitempty"`
WalletEncryptionKey string `json:"wallet_encryption_key,omitempty"`
WalletHexChainCode string `json:"wallet_hex_chain_code,omitempty"`
}
PairMatched is the event for matching a pair with another participant.
type PairStatus ¶
type PairStatus string
PairStatus is the type for the status of the pair
const ( PairStatusWaiting PairStatus = "waiting" PairStatusWalletConformation PairStatus = "wallet_conformation" PairStatusAssurance PairStatus = "assurance" PairStatusDeposit PairStatus = "deposit" PairStatusPreSignWithdrawal PairStatus = "pre_sign_withdrawal" PairStatusLP PairStatus = "lp" PairStatusWithdrawn PairStatus = "withdrawn" PairStatusInvalid PairStatus = "invalid" )
type PairStatusChanged ¶
type PairStatusChanged struct {
Status PairStatus `json:"status,omitempty"`
}
PairStatusChanged is the event for changing the status of the pair.
type Plan ¶
type Plan struct {
eventsourcing.AggregateRoot
Assets []Asset `json:"assets,omitempty"`
Security MultiSigWalletSecurity `json:"security,omitempty"`
Strategy ProfitSharingStrategy `json:"strategy,omitempty"`
Quantum int `json:"quantum,omitempty"`
LossProtection float64 `json:"loss_protection,omitempty"`
InvestingPeriod int `json:"investing_period,omitempty"`
}
Plan is the aggregate root for a plan that bases around a pair of crypto assets for liquidity providing, a security method for shared wallet authority between the parties (2 of 2) or (2 of 3 including mediator), a strategy for profit splitting, quantum of each asset's share in $, agreed loss limit and a time frame (in weeks) for the plan.
func (*Plan) Register ¶
func (p *Plan) Register(r eventsourcing.RegisterFunc)
Register implements aggregate.Register
func (*Plan) Transition ¶
func (p *Plan) Transition(event eventsourcing.Event)
Transition implements aggregate.Transition
type PlanCreated ¶
type PlanCreated struct {
Assets []Asset `json:"assets,omitempty"`
Security MultiSigWalletSecurity `json:"security,omitempty"`
Strategy ProfitSharingStrategy `json:"strategy,omitempty"`
Quantum int `json:"quantum,omitempty"`
LossProtection float64 `json:"loss_protection,omitempty"`
InvestingPeriod int `json:"investing_period,omitempty"`
}
PlanCreated is the event for creating a new plan for the first time.
type ProfitSharingStrategy ¶
type ProfitSharingStrategy string
ProfitSharingStrategy is the type of profit splitting strategy used for the plan PriceDependent is a strategy which splits the withdrawn assets based on how much assets price has changed at the withdrawal time compared to the time of deposit i.e. The participant who's assets dropped more gains less of the total share in $ value.
const (
)
type SignedTx ¶
type SignedTx struct {
Nonce int `json:"nonce"`
Tx []byte `json:"tx"`
Signature []byte `json:"signature"`
}
SignedTx is the type for the transactions that are signed by the participants
type WalletAddressConfirmed ¶
type WalletAddressConfirmed struct {
ParticipantAsset Asset `json:"participant,omitempty"`
PublicKey string `json:"public_key,omitempty"`
WalletAddresses map[Asset]Address `json:"addresses,omitempty"`
}
WalletAddressConfirmed is the event for confirming the shared wallet's addresses by the participants.
type WithdrawTxSigned ¶
type WithdrawTxSigned struct {
Tx SignedTx `json:"tx,omitempty"`
}
WithdrawTxSigned is the event for signing the withdrawal transaction.