Documentation ¶
Overview ¶
Package protocol has functions that are used by both the maker and taker during execution of the swap.
Index ¶
- Variables
- func AssetSymbol(b backend.Backend, asset types.EthAsset) (string, error)
- func CheckSwapID(log *ethtypes.Log, eventNameTopic [32]byte, contractSwapID types.Hash) error
- func ClaimMonero(ctx context.Context, env common.Environment, info *swap.Info, ...) error
- func GetClaimKeypair(skA, skB *mcrypto.PrivateSpendKey, vkA, vkB *mcrypto.PrivateViewKey) *mcrypto.PrivateKeyPair
- type KeysAndProof
- type SwapManager
- type VerifyResult
Constants ¶
This section is empty.
Variables ¶
var ( // ErrLogNotForUs is returned when a log is found that doesn't have the given contract swap ID. ErrLogNotForUs = errors.New("found log that isn't for our swap") )
Functions ¶
func AssetSymbol ¶
AssetSymbol returns the symbol for the given asset.
func CheckSwapID ¶
CheckSwapID checks if the given log is for the given swap ID.
func ClaimMonero ¶
func ClaimMonero( ctx context.Context, env common.Environment, info *swap.Info, xmrClient monero.WalletClient, kpAB *mcrypto.PrivateKeyPair, depositAddr *mcrypto.Address, noTransferBack bool, sm SwapManager, ) error
ClaimMonero claims the XMR located in the wallet controlled by the private keypair `kpAB`. If noTransferBack is unset, it sweeps the XMR to `depositAddr`.
func GetClaimKeypair ¶
func GetClaimKeypair( skA, skB *mcrypto.PrivateSpendKey, vkA, vkB *mcrypto.PrivateViewKey, ) *mcrypto.PrivateKeyPair
GetClaimKeypair returns the private key pair required for a monero claim. The key pair is the summation of each party's private spend and view keys: (s_a + s_b) and (v_a + v_b).
Types ¶
type KeysAndProof ¶
type KeysAndProof struct { DLEqProof *dleq.Proof Secp256k1PublicKey *secp256k1.PublicKey PrivateKeyPair *mcrypto.PrivateKeyPair PublicKeyPair *mcrypto.PublicKeyPair }
KeysAndProof contains a DLEq proof, a secp256k1 public key, and ed25519 public and private keypairs.
func GenerateKeysAndProof ¶
func GenerateKeysAndProof() (*KeysAndProof, error)
GenerateKeysAndProof generates keys on the secp256k1 and ed25519 curves as well as a DLEq proof between the two.
type SwapManager ¶ added in v0.2.0
type SwapManager interface { WriteSwapToDB(info *swap.Info) error PushNewStatus(offerID types.Hash, status types.Status) }
SwapManager is the subset of the swap.Manager interface needed by ClaimMonero
type VerifyResult ¶
type VerifyResult struct { Secp256k1PublicKey *secp256k1.PublicKey Ed25519PublicKey *mcrypto.PublicKey }
VerifyResult is returned from verifying a DLEq proof.
func VerifyKeysAndProof ¶
func VerifyKeysAndProof( proofData []byte, secp256k1Pub *secp256k1.PublicKey, ed25519Pub *mcrypto.PublicKey, ) (*VerifyResult, error)
VerifyKeysAndProof verifies the given DLEq proof and asserts that the resulting secp256k1 key corresponds to the given key.
Directories ¶
Path | Synopsis |
---|---|
Package backend provides the portion of top-level swapd instance management that is shared by both the maker and the taker.
|
Package backend provides the portion of top-level swapd instance management that is shared by both the maker and the taker. |
Package swap is a generated GoMock package.
|
Package swap is a generated GoMock package. |
Package txsender provides a common Sender interface for swapd instances.
|
Package txsender provides a common Sender interface for swapd instances. |
Package xmrmaker manages the swap state of individual swaps where the local swapd instance is offering Monero and accepting Ethereum assets in return.
|
Package xmrmaker manages the swap state of individual swaps where the local swapd instance is offering Monero and accepting Ethereum assets in return. |
offers
Package offers is a generated GoMock package.
|
Package offers is a generated GoMock package. |
Package xmrtaker manages the swap state of individual swaps where the local swapd instance is offering Ethereum assets and accepting Monero in return.
|
Package xmrtaker manages the swap state of individual swaps where the local swapd instance is offering Ethereum assets and accepting Monero in return. |