Documentation ¶
Index ¶
- Variables
- type Broker
- type Config
- type Engine
- func (e *Engine) ADtoID(ad *types.AccountDetails) string
- func (e *Engine) AssetExists(assetID string) bool
- func (e *Engine) BondSpotUpdate(ctx context.Context, market string, transfer *types.Transfer) (*types.LedgerMovement, error)
- func (e *Engine) BondUpdate(ctx context.Context, market string, transfer *types.Transfer) (*types.LedgerMovement, error)
- func (e *Engine) CanCoverBond(market, party, asset string, amount *num.Uint) bool
- func (e *Engine) CheckLeftOverBalance(ctx context.Context, settle *types.Account, transfers []*types.Transfer, ...) (*types.LedgerMovement, error)
- func (e *Engine) Checkpoint() ([]byte, error)
- func (e *Engine) ClearInsurancepool(ctx context.Context, mktID, asset string, clearFees bool) ([]*types.LedgerMovement, error)
- func (e *Engine) ClearMarket(ctx context.Context, mktID, asset string, parties []string, keepInsurance bool) ([]*types.LedgerMovement, error)
- func (e *Engine) ClearPartyMarginAccount(ctx context.Context, party, market, asset string) (*types.LedgerMovement, error)
- func (e *Engine) ClearSpotMarket(ctx context.Context, mktID, quoteAsset string) ([]*types.LedgerMovement, error)
- func (e *Engine) CreateMarketAccounts(ctx context.Context, marketID, asset string) (insuranceID, settleID string, err error)
- func (e *Engine) CreatePartyBondAccount(ctx context.Context, partyID, marketID, asset string) (string, error)
- func (e *Engine) CreatePartyGeneralAccount(ctx context.Context, partyID, asset string) (string, error)
- func (e *Engine) CreatePartyHoldingAccount(ctx context.Context, partyID, asset string) (string, error)
- func (e *Engine) CreatePartyLiquidityFeeAccount(ctx context.Context, partyID, marketID, asset string) (string, error)
- func (e *Engine) CreatePartyMarginAccount(ctx context.Context, partyID, marketID, asset string) (string, error)
- func (e *Engine) CreateSpotMarketAccounts(ctx context.Context, marketID, quoteAsset string) error
- func (e *Engine) Deposit(ctx context.Context, partyID, asset string, amount *num.Uint) (*types.LedgerMovement, error)
- func (e *Engine) EnableAsset(ctx context.Context, asset types.Asset) error
- func (e *Engine) FinalSettlement(ctx context.Context, marketID string, transfers []*types.Transfer, ...) ([]*types.LedgerMovement, error)
- func (e *Engine) GetAccountByID(id string) (*types.Account, error)
- func (e *Engine) GetAllVestingQuantumBalance(party string) *num.Uint
- func (e *Engine) GetAssetQuantum(asset string) (num.Decimal, error)
- func (e *Engine) GetEnabledAssets() []string
- func (e *Engine) GetGlobalInsuranceAccount(asset string) (*types.Account, error)
- func (e *Engine) GetGlobalRewardAccount(asset string) (*types.Account, error)
- func (e *Engine) GetInfraFeeAccountIDs() []string
- func (e *Engine) GetInsurancePoolBalance(marketID, asset string) (*num.Uint, bool)
- func (e *Engine) GetLiquidityFeesBonusDistributionAccount(marketID, asset string) (*types.Account, error)
- func (e *Engine) GetMarketInsurancePoolAccount(market, asset string) (*types.Account, error)
- func (e *Engine) GetMarketLiquidityFeeAccount(market, asset string) (*types.Account, error)
- func (e *Engine) GetMarketMakerFeeAccount(market, asset string) (*types.Account, error)
- func (e *Engine) GetNetworkTreasuryAccount(asset string) (*types.Account, error)
- func (e *Engine) GetOrCreateGlobalInsuranceAccount(ctx context.Context, asset string) *types.Account
- func (e *Engine) GetOrCreateLiquidityFeesBonusDistributionAccount(ctx context.Context, marketID, asset string) (*types.Account, error)
- func (e *Engine) GetOrCreateMarketInsurancePoolAccount(ctx context.Context, market, asset string) *types.Account
- func (e *Engine) GetOrCreateNetworkTreasuryAccount(ctx context.Context, asset string) *types.Account
- func (e *Engine) GetOrCreatePartyBondAccount(ctx context.Context, partyID, marketID, asset string) (*types.Account, error)
- func (e *Engine) GetOrCreatePartyLiquidityFeeAccount(ctx context.Context, partyID, marketID, asset string) (*types.Account, error)
- func (e *Engine) GetOrCreatePartyVestedRewardAccount(ctx context.Context, partyID, asset string) *types.Account
- func (e *Engine) GetOrCreatePartyVestingRewardAccount(ctx context.Context, partyID, asset string) *types.Account
- func (e *Engine) GetOrCreateRewardAccount(ctx context.Context, asset string, market string, ...) (*types.Account, error)
- func (e *Engine) GetPartyBondAccount(market, partyID, asset string) (*types.Account, error)
- func (e *Engine) GetPartyGeneralAccount(partyID, asset string) (*types.Account, error)
- func (e *Engine) GetPartyHoldingAccount(party, asset string) (*types.Account, error)
- func (e *Engine) GetPartyLiquidityFeeAccount(market, partyID, asset string) (*types.Account, error)
- func (e *Engine) GetPartyMargin(pos events.MarketPosition, asset, marketID string) (events.Margin, error)
- func (e *Engine) GetPartyMarginAccount(market, party, asset string) (*types.Account, error)
- func (e *Engine) GetPartyVestedRewardAccount(partyID, asset string) (*types.Account, error)
- func (e *Engine) GetPendingTransfersAccount(asset string) *types.Account
- func (e *Engine) GetRewardAccountsByType(rewardAcccountType types.AccountType) []*types.Account
- func (e *Engine) GetState(k string) ([]byte, []types.StateProvider, error)
- func (e *Engine) GetSystemAccountBalance(asset, market string, accountType types.AccountType) (*num.Uint, error)
- func (e *Engine) GetVestingRecovery() map[string]map[string]*num.Uint
- func (e *Engine) GovernanceTransferFunds(ctx context.Context, transfers []*types.Transfer, ...) ([]*types.LedgerMovement, error)
- func (e *Engine) HasGeneralAccount(party, asset string) bool
- func (e *Engine) Hash() []byte
- func (e *Engine) IncrementBalance(ctx context.Context, id string, inc *num.Uint) error
- func (e *Engine) Keys() []string
- func (e *Engine) Load(ctx context.Context, data []byte) error
- func (e *Engine) LoadState(ctx context.Context, p *types.Payload) ([]types.StateProvider, error)
- func (e *Engine) MarginUpdate(ctx context.Context, marketID string, updates []events.Risk) ([]*types.LedgerMovement, []events.Margin, []events.Margin, error)
- func (e *Engine) MarginUpdateOnOrder(ctx context.Context, marketID string, update events.Risk) (*types.LedgerMovement, events.Margin, error)
- func (e *Engine) MarkToMarket(ctx context.Context, marketID string, transfers []events.Transfer, ...) ([]events.Margin, []*types.LedgerMovement, error)
- func (e *Engine) Name() types.CheckpointName
- func (e *Engine) Namespace() types.SnapshotNamespace
- func (e *Engine) PartyHasSufficientBalance(asset, partyID string, amount *num.Uint) error
- func (e *Engine) PerpsFundingSettlement(ctx context.Context, marketID string, transfers []events.Transfer, ...) ([]events.Margin, []*types.LedgerMovement, error)
- func (e *Engine) PropagateAssetUpdate(ctx context.Context, asset types.Asset) error
- func (e *Engine) ReleaseFromHoldingAccount(ctx context.Context, transfer *types.Transfer) (*types.LedgerMovement, error)
- func (e *Engine) ReloadConf(cfg Config)
- func (e *Engine) RemoveBondAccount(partyID, marketID, asset string) error
- func (e *Engine) RemoveDistressed(ctx context.Context, parties []events.MarketPosition, marketID, asset string) (*types.LedgerMovement, error)
- func (e *Engine) RemoveLiquidityFeesBonusDistributionAccount(partyID, marketID, asset string) error
- func (e *Engine) RestoreCheckpointBalance(ctx context.Context, market, party, asset string, typ types.AccountType, ...) (*types.LedgerMovement, error)
- func (e *Engine) RollbackMarginUpdateOnOrder(ctx context.Context, marketID string, assetID string, transfer *types.Transfer) (*types.LedgerMovement, error)
- func (e *Engine) Stopped() bool
- func (e *Engine) SuccessorInsuranceFraction(ctx context.Context, successor, parent, asset string, fraction num.Decimal) *types.LedgerMovement
- func (e *Engine) TransferFees(ctx context.Context, marketID string, assetID string, ft events.FeesTransfer) ([]*types.LedgerMovement, error)
- func (e *Engine) TransferFeesContinuousTrading(ctx context.Context, marketID string, assetID string, ft events.FeesTransfer) ([]*types.LedgerMovement, error)
- func (e *Engine) TransferFunds(ctx context.Context, transfers []*types.Transfer, ...) ([]*types.LedgerMovement, error)
- func (e *Engine) TransferRewards(ctx context.Context, rewardAccountID string, transfers []*types.Transfer) ([]*types.LedgerMovement, error)
- func (e *Engine) TransferSpot(ctx context.Context, partyID, toPartyID, asset string, quantity *num.Uint) (*types.LedgerMovement, error)
- func (e *Engine) TransferSpotFees(ctx context.Context, marketID string, assetID string, ft events.FeesTransfer) ([]*types.LedgerMovement, error)
- func (e *Engine) TransferSpotFeesContinuousTrading(ctx context.Context, marketID string, assetID string, ft events.FeesTransfer) ([]*types.LedgerMovement, error)
- func (e *Engine) TransferToHoldingAccount(ctx context.Context, transfer *types.Transfer) (*types.LedgerMovement, error)
- func (e *Engine) TransferVestedRewards(ctx context.Context, transfers []*types.Transfer) ([]*types.LedgerMovement, error)
- func (e *Engine) UpdateBalance(ctx context.Context, id string, balance *num.Uint) error
- func (e *Engine) Withdraw(ctx context.Context, partyID, asset string, amount *num.Uint) (*types.LedgerMovement, error)
- type TimeService
Constants ¶
This section is empty.
Variables ¶
var ( // ErrSystemAccountsMissing signals that a system account is missing, which may means that the // collateral engine have not been initialised properly. ErrSystemAccountsMissing = errors.New("system accounts missing for collateral engine to work") // ErrFeeAccountsMissing signals that a fee account is missing, which may means that the // collateral engine have not been initialised properly. ErrFeeAccountsMissing = errors.New("fee accounts missing for collateral engine to work") // ErrPartyAccountsMissing signals that the accounts for this party do not exists. ErrPartyAccountsMissing = errors.New("party accounts missing, cannot collect") // ErrAccountDoesNotExist signals that an account par of a transfer do not exists. ErrAccountDoesNotExist = errors.New("account does not exists") ErrNoGeneralAccountWhenCreateMarginAccount = errors.New("party general account missing when trying to create a margin account") ErrNoGeneralAccountWhenCreateBondAccount = errors.New("party general account missing when trying to create a bond account") ErrMinAmountNotReached = errors.New("unable to reach minimum amount transfer") ErrPartyHasNoTokenAccount = errors.New("no token account for party") ErrSettlementBalanceNotZero = errors.New("settlement balance should be zero") // E991 YOU HAVE TOO MUCH ROPE TO HANG YOURSELF // ErrAssetAlreadyEnabled signals the given asset has already been enabled in this engine. ErrAssetAlreadyEnabled = errors.New("asset already enabled") ErrAssetHasNotBeenEnabled = errors.New("asset has not been enabled") // ErrInvalidAssetID signals that an asset id does not exists. ErrInvalidAssetID = errors.New("invalid asset ID") // ErrInsufficientFundsToPayFees the party do not have enough funds to pay the feeds. ErrInsufficientFundsToPayFees = errors.New("insufficient funds to pay fees") // ErrInvalidTransferTypeForFeeRequest an invalid transfer type was send to build a fee transfer request. ErrInvalidTransferTypeForFeeRequest = errors.New("an invalid transfer type was send to build a fee transfer request") // ErrNotEnoughFundsToWithdraw a party requested to withdraw more than on its general account. ErrNotEnoughFundsToWithdraw = errors.New("not enough funds to withdraw") // ErrInsufficientFundsInAsset is returned if the party doesn't have sufficient funds to cover their order quantity. ErrInsufficientFundsInAsset = errors.New("insufficient funds for order") )
var ( ErrInvalidSnapshotNamespace = errors.New("invalid snapshot namespace") ErrUnknownSnapshotType = errors.New("snapshot data type not known") )
Functions ¶
This section is empty.
Types ¶
type Broker ¶
Broker send events we no longer need to generate this mock here, we can use the broker/mocks package instead.
type Config ¶
Config represent the configuration of the collateral engine.
func NewDefaultConfig ¶
func NewDefaultConfig() Config
NewDefaultConfig creates an instance of the package specific configuration, given a pointer to a logger instance to be used for logging within the package.
type Engine ¶
type Engine struct { Config // contains filtered or unexported fields }
Engine is handling the power of the collateral.
func (*Engine) AssetExists ¶
AssetExists no errors if the asset exists.
func (*Engine) BondSpotUpdate ¶ added in v0.72.0
func (e *Engine) BondSpotUpdate(ctx context.Context, market string, transfer *types.Transfer) (*types.LedgerMovement, error)
BondUpdate is to be used for any bond account transfers in a spot market. Update on new orders, updates on commitment changes, or on slashing.
func (*Engine) BondUpdate ¶
func (e *Engine) BondUpdate(ctx context.Context, market string, transfer *types.Transfer) (*types.LedgerMovement, error)
BondUpdate is to be used for any bond account transfers. Update on new orders, updates on commitment changes, or on slashing.
func (*Engine) CanCoverBond ¶
func (*Engine) CheckLeftOverBalance ¶ added in v0.58.0
func (*Engine) Checkpoint ¶
func (*Engine) ClearInsurancepool ¶ added in v0.72.0
func (*Engine) ClearMarket ¶
func (e *Engine) ClearMarket(ctx context.Context, mktID, asset string, parties []string, keepInsurance bool) ([]*types.LedgerMovement, error)
ClearMarket will remove all monies or accounts for parties allocated for a market (margin accounts) when the market reach end of life (maturity).
func (*Engine) ClearPartyMarginAccount ¶
func (*Engine) ClearSpotMarket ¶ added in v0.72.0
func (e *Engine) ClearSpotMarket(ctx context.Context, mktID, quoteAsset string) ([]*types.LedgerMovement, error)
ClearSpotMarket moves remaining LP fees to the global reward account and removes market accounts.
func (*Engine) CreateMarketAccounts ¶
func (e *Engine) CreateMarketAccounts(ctx context.Context, marketID, asset string) (insuranceID, settleID string, err error)
CreateMarketAccounts will create all required accounts for a market once a new market is accepted through the network.
func (*Engine) CreatePartyBondAccount ¶
func (e *Engine) CreatePartyBondAccount(ctx context.Context, partyID, marketID, asset string) (string, error)
CreatePartyBondAccount creates a bond account if it does not exist, will return an error if no general account exist for the party for the given asset.
func (*Engine) CreatePartyGeneralAccount ¶
func (e *Engine) CreatePartyGeneralAccount(ctx context.Context, partyID, asset string) (string, error)
CreatePartyGeneralAccount create the general account for a party.
func (*Engine) CreatePartyHoldingAccount ¶ added in v0.72.0
func (e *Engine) CreatePartyHoldingAccount(ctx context.Context, partyID, asset string) (string, error)
CreatePartyHoldingAccount creates a holding account for a party.
func (*Engine) CreatePartyLiquidityFeeAccount ¶ added in v0.72.0
func (e *Engine) CreatePartyLiquidityFeeAccount(ctx context.Context, partyID, marketID, asset string) (string, error)
CreatePartyLiquidityFeeAccount creates a bond account if it does not exist, will return an error if no general account exist for the party for the given asset.
func (*Engine) CreatePartyMarginAccount ¶
func (e *Engine) CreatePartyMarginAccount(ctx context.Context, partyID, marketID, asset string) (string, error)
CreatePartyMarginAccount creates a margin account if it does not exist, will return an error if no general account exist for the party for the given asset.
func (*Engine) CreateSpotMarketAccounts ¶ added in v0.72.0
CreateSpotMarketAccounts creates the required accounts for a market.
func (*Engine) Deposit ¶
func (e *Engine) Deposit(ctx context.Context, partyID, asset string, amount *num.Uint) (*types.LedgerMovement, error)
Deposit will deposit the given amount into the party account.
func (*Engine) EnableAsset ¶
EnableAsset adds a new asset in the collateral engine this enable the asset to be used by new markets or parties to deposit funds.
func (*Engine) FinalSettlement ¶
func (e *Engine) FinalSettlement(ctx context.Context, marketID string, transfers []*types.Transfer, factor *num.Uint) ([]*types.LedgerMovement, error)
FinalSettlement will process the list of transfers instructed by other engines This func currently only expects TransferType_{LOSS,WIN} transfers other transfer types have dedicated funcs (MarkToMarket, MarginUpdate).
func (*Engine) GetAccountByID ¶
GetAccountByID will return an account using the given id.
func (*Engine) GetAllVestingQuantumBalance ¶ added in v0.73.0
func (*Engine) GetAssetQuantum ¶
func (*Engine) GetEnabledAssets ¶
GetEnabledAssets returns the asset IDs of all enabled assets.
func (*Engine) GetGlobalInsuranceAccount ¶ added in v0.73.0
func (*Engine) GetGlobalRewardAccount ¶
func (*Engine) GetInfraFeeAccountIDs ¶
GetInfraFeeAccountIDs returns the account IDs of the infrastructure fee accounts for all enabled assets.
func (*Engine) GetInsurancePoolBalance ¶ added in v0.72.0
func (*Engine) GetLiquidityFeesBonusDistributionAccount ¶ added in v0.72.0
func (*Engine) GetMarketInsurancePoolAccount ¶
func (*Engine) GetMarketLiquidityFeeAccount ¶
func (*Engine) GetMarketMakerFeeAccount ¶ added in v0.72.0
func (*Engine) GetNetworkTreasuryAccount ¶ added in v0.73.0
func (*Engine) GetOrCreateGlobalInsuranceAccount ¶ added in v0.73.0
func (*Engine) GetOrCreateLiquidityFeesBonusDistributionAccount ¶ added in v0.72.0
func (e *Engine) GetOrCreateLiquidityFeesBonusDistributionAccount( ctx context.Context, marketID, asset string, ) (*types.Account, error)
GetOrCreateLiquidityFeesBonusDistributionAccount returns a liquidity fees bonus distribution account given a set of parameters. crates it if not exists.
func (*Engine) GetOrCreateMarketInsurancePoolAccount ¶ added in v0.71.0
func (*Engine) GetOrCreateNetworkTreasuryAccount ¶ added in v0.73.0
func (*Engine) GetOrCreatePartyBondAccount ¶
func (e *Engine) GetOrCreatePartyBondAccount(ctx context.Context, partyID, marketID, asset string) (*types.Account, error)
GetOrCreatePartyBondAccount returns a bond account given a set of parameters. crates it if not exists.
func (*Engine) GetOrCreatePartyLiquidityFeeAccount ¶ added in v0.72.0
func (e *Engine) GetOrCreatePartyLiquidityFeeAccount(ctx context.Context, partyID, marketID, asset string) (*types.Account, error)
GetOrCreatePartyLiquidityFeeAccount returns a party liquidity fee account given a set of parameters. Crates it if not exists.
func (*Engine) GetOrCreatePartyVestedRewardAccount ¶ added in v0.73.0
func (e *Engine) GetOrCreatePartyVestedRewardAccount(ctx context.Context, partyID, asset string) *types.Account
GetOrCreatePartyVestedAccount create the general account for a party.
func (*Engine) GetOrCreatePartyVestingRewardAccount ¶ added in v0.73.0
func (e *Engine) GetOrCreatePartyVestingRewardAccount(ctx context.Context, partyID, asset string) *types.Account
GetOrCreatePartyVestingAccount create the general account for a party.
func (*Engine) GetOrCreateRewardAccount ¶
func (e *Engine) GetOrCreateRewardAccount(ctx context.Context, asset string, market string, rewardAcccountType types.AccountType) (*types.Account, error)
GetRewardAccount returns a reward accound by asset and type.
func (*Engine) GetPartyBondAccount ¶
GetPartyBondAccount returns a general account given the partyID.
func (*Engine) GetPartyGeneralAccount ¶
GetPartyGeneralAccount returns a general account given the partyID.
func (*Engine) GetPartyHoldingAccount ¶ added in v0.73.0
GetPartyHoldingAccount returns a holding account given the partyID and market.
func (*Engine) GetPartyLiquidityFeeAccount ¶ added in v0.72.0
GetPartyLiquidityFeeAccount returns a liquidity fee account account given the partyID.
func (*Engine) GetPartyMargin ¶
func (e *Engine) GetPartyMargin(pos events.MarketPosition, asset, marketID string) (events.Margin, error)
GetPartyMargin will return the current margin for a given party.
func (*Engine) GetPartyMarginAccount ¶
GetPartyMarginAccount returns a margin account given the partyID and market.
func (*Engine) GetPartyVestedRewardAccount ¶ added in v0.73.0
func (*Engine) GetPendingTransfersAccount ¶
GetPendingTransferAccount return the pending transfers account for the asset.
func (*Engine) GetRewardAccountsByType ¶
func (e *Engine) GetRewardAccountsByType(rewardAcccountType types.AccountType) []*types.Account
func (*Engine) GetSystemAccountBalance ¶ added in v0.72.0
func (*Engine) GetVestingRecovery ¶ added in v0.73.0
func (*Engine) GovernanceTransferFunds ¶ added in v0.72.0
func (*Engine) HasGeneralAccount ¶
func (*Engine) IncrementBalance ¶
IncrementBalance will increment the balance of a given account using the given value.
func (*Engine) MarginUpdate ¶
func (e *Engine) MarginUpdate(ctx context.Context, marketID string, updates []events.Risk) ([]*types.LedgerMovement, []events.Margin, []events.Margin, error)
MarginUpdate will run the margin updates over a set of risk events (margin updates).
func (*Engine) MarginUpdateOnOrder ¶
func (e *Engine) MarginUpdateOnOrder(ctx context.Context, marketID string, update events.Risk) (*types.LedgerMovement, events.Margin, error)
MarginUpdateOnOrder will run the margin updates over a set of risk events (margin updates).
func (*Engine) MarkToMarket ¶
func (e *Engine) MarkToMarket(ctx context.Context, marketID string, transfers []events.Transfer, asset string) ([]events.Margin, []*types.LedgerMovement, error)
MarkToMarket will run the mark to market settlement over a given set of positions return ledger move stuff here, too (separate return value, because we need to stream those).
func (*Engine) Name ¶
func (e *Engine) Name() types.CheckpointName
func (*Engine) Namespace ¶
func (e *Engine) Namespace() types.SnapshotNamespace
func (*Engine) PartyHasSufficientBalance ¶ added in v0.72.0
PartyHasSufficientBalance checks if the party has sufficient amount in the general account.
func (*Engine) PerpsFundingSettlement ¶ added in v0.73.0
func (e *Engine) PerpsFundingSettlement(ctx context.Context, marketID string, transfers []events.Transfer, asset string, round *num.Uint) ([]events.Margin, []*types.LedgerMovement, error)
PerpsFundingSettlement will run a funding settlement over given positions. This works exactly the same as a MTM settlement, but uses different transfer types.
func (*Engine) PropagateAssetUpdate ¶
func (*Engine) ReleaseFromHoldingAccount ¶ added in v0.72.0
func (e *Engine) ReleaseFromHoldingAccount(ctx context.Context, transfer *types.Transfer) (*types.LedgerMovement, error)
ReleaseFromHoldingAccount releases locked funds from holding account back to the general account of the party.
func (*Engine) ReloadConf ¶
ReloadConf updates the internal configuration of the collateral engine.
func (*Engine) RemoveBondAccount ¶ added in v0.69.0
func (*Engine) RemoveDistressed ¶
func (e *Engine) RemoveDistressed(ctx context.Context, parties []events.MarketPosition, marketID, asset string) (*types.LedgerMovement, error)
RemoveDistressed will remove all distressed party in the event positions for a given market and asset.
func (*Engine) RemoveLiquidityFeesBonusDistributionAccount ¶ added in v0.72.0
func (*Engine) RestoreCheckpointBalance ¶ added in v0.56.0
func (e *Engine) RestoreCheckpointBalance( ctx context.Context, market, party, asset string, typ types.AccountType, amount *num.Uint, ) (*types.LedgerMovement, error)
RestoreCheckpointBalance will credit account with a balance from a checkpoint. This function assume the accounts have been created before.
func (*Engine) RollbackMarginUpdateOnOrder ¶
func (e *Engine) RollbackMarginUpdateOnOrder(ctx context.Context, marketID string, assetID string, transfer *types.Transfer) (*types.LedgerMovement, error)
RollbackMarginUpdateOnOrder moves funds from the margin to the general account.
func (*Engine) SuccessorInsuranceFraction ¶ added in v0.72.0
func (*Engine) TransferFees ¶
func (e *Engine) TransferFees(ctx context.Context, marketID string, assetID string, ft events.FeesTransfer) ([]*types.LedgerMovement, error)
func (*Engine) TransferFeesContinuousTrading ¶
func (e *Engine) TransferFeesContinuousTrading(ctx context.Context, marketID string, assetID string, ft events.FeesTransfer) ([]*types.LedgerMovement, error)
func (*Engine) TransferFunds ¶
func (e *Engine) TransferFunds( ctx context.Context, transfers []*types.Transfer, accountTypes []types.AccountType, references []string, feeTransfers []*types.Transfer, feeTransfersAccountType []types.AccountType, ) ([]*types.LedgerMovement, error)
func (*Engine) TransferRewards ¶
func (e *Engine) TransferRewards(ctx context.Context, rewardAccountID string, transfers []*types.Transfer) ([]*types.LedgerMovement, error)
TransferRewards takes a slice of transfers and serves them to transfer rewards from the reward account to parties general account.
func (*Engine) TransferSpot ¶ added in v0.72.0
func (e *Engine) TransferSpot(ctx context.Context, partyID, toPartyID, asset string, quantity *num.Uint) (*types.LedgerMovement, error)
TransferSpot transfers the given asset/quantity from partyID to partyID. The source partyID general account must exist in the asset, the target partyID general account in the asset is created if it doesn't yet exist.
func (*Engine) TransferSpotFees ¶ added in v0.72.0
func (e *Engine) TransferSpotFees(ctx context.Context, marketID string, assetID string, ft events.FeesTransfer) ([]*types.LedgerMovement, error)
func (*Engine) TransferSpotFeesContinuousTrading ¶ added in v0.72.0
func (e *Engine) TransferSpotFeesContinuousTrading(ctx context.Context, marketID string, assetID string, ft events.FeesTransfer) ([]*types.LedgerMovement, error)
func (*Engine) TransferToHoldingAccount ¶ added in v0.72.0
func (e *Engine) TransferToHoldingAccount(ctx context.Context, transfer *types.Transfer) (*types.LedgerMovement, error)
TransferToHoldingAccount locks funds from general account into holding account account of the party.
func (*Engine) TransferVestedRewards ¶ added in v0.73.0
func (*Engine) UpdateBalance ¶
UpdateBalance will update the balance of a given account.
type TimeService ¶
TimeService provide the time of the vega node.