This commit is contained in:
Jayant Krishnamurthy 2023-07-09 09:46:10 -07:00 committed by Ali Behjati
parent 5ddef8797e
commit 1564364420
2 changed files with 25 additions and 0 deletions

View File

@ -69,6 +69,17 @@ export class AptosPriceListener extends ChainPriceListener {
// Derivation path for aptos accounts
export const APTOS_ACCOUNT_HD_PATH = "m/44'/637'/0'/0'/0'";
/**
* The `AptosPricePusher` is designed for high-throughput of price updates.
* Achieving this property requires sacrificing some nice-to-have features of other
* pusher implementations that can reduce cost when running multiple pushers. Specifically,
* this implementation does not use `update_price_feeds_if_necssary` and simulate the transaction
* before submission.
*
* If multiple instances of this pusher are running in parallel, both of them will
* land all of their pushed updates on-chain.
*/
export class AptosPricePusher implements IPricePusher {
// The last sequence number that has a transaction submitted.
private lastSequenceNumber: number | undefined;

View File

@ -91,6 +91,20 @@ export class SuiPriceListener extends ChainPriceListener {
}
}
/**
* The `SuiPricePusher` is designed for high-throughput of price updates.
* Achieving this property requires sacrificing some nice-to-have features of other
* pusher implementations that can reduce cost when running multiple pushers. It also requires
* jumping through some Sui-specific hoops in order to maximize parallelism.
*
* The two main design features are:
* 1. This implementation does not use `update_price_feeds_if_necssary` and simulate the transaction
* before submission. If multiple instances of this pusher are running in parallel, all of them will
* land all of their pushed updates on-chain.
* 2. The pusher will split the Coin balance in the provided account into a pool of different Coin objects.
* Each transaction will be allocated a Coin object from this pool as needed. This process enables the
* transactions to avoid referencing the same owned objects, which allows them to be processed in parallel.
*/
export class SuiPricePusher implements IPricePusher {
constructor(
private readonly signer: RawSigner,