Documentation ¶
Index ¶
- func NewMsgServer(keeper Keeper) types.MsgServer
- type EpochHooks
- type Keeper
- func (k Keeper) AnteHandleCheck(ctx sdk.Context) error
- func (k Keeper) BuildHighestLiquidityRoute(ctx sdk.Context, swapDenom, tokenIn, tokenOut string, poolId uint64, ...) (poolmanagertypes.SwapAmountInRoutes, error)
- func (k Keeper) BuildHighestLiquidityRoutes(ctx sdk.Context, tokenIn, tokenOut string, poolId uint64, ...) ([]poolmanagertypes.SwapAmountInRoutes, error)
- func (k Keeper) BuildHotRoute(ctx sdk.Context, route *types.Route, poolId uint64, ...) (poolmanagertypes.SwapAmountInRoutes, error)
- func (k Keeper) BuildHotRoutes(ctx sdk.Context, tokenIn, tokenOut string, poolId uint64, ...) ([]poolmanagertypes.SwapAmountInRoutes, error)
- func (k Keeper) BuildRoutes(ctx sdk.Context, tokenIn, tokenOut string, poolId uint64, ...) []poolmanagertypes.SwapAmountInRoutes
- func (k Keeper) CheckAndUpdateRouteState(ctx sdk.Context, route poolmanagertypes.SwapAmountInRoutes, ...) error
- func (k Keeper) ConvertProfits(ctx sdk.Context, inputCoin sdk.Coin, profit sdk.Int) (sdk.Int, error)
- func (k Keeper) DeleteAllEntriesForKeyPrefix(ctx sdk.Context, keyPrefix []byte)
- func (k Keeper) DeleteAllPoolsForBaseDenom(ctx sdk.Context, baseDenom string)
- func (k Keeper) DeleteAllTokenPairArbRoutes(ctx sdk.Context)
- func (k Keeper) DeleteBaseDenoms(ctx sdk.Context)
- func (k Keeper) DeleteDeveloperFees(ctx sdk.Context, denom string)
- func (k Keeper) EpochHooks() epochstypes.EpochHooks
- func (k Keeper) EstimateMultihopProfit(ctx sdk.Context, inputDenom string, amount sdk.Int, ...) (sdk.Coin, sdk.Int, error)
- func (k Keeper) ExecuteTrade(ctx sdk.Context, route poolmanagertypes.SwapAmountInRoutes, inputCoin sdk.Coin) error
- func (k Keeper) FindMaxProfitForRoute(ctx sdk.Context, route poolmanagertypes.SwapAmountInRoutes, inputDenom string) (sdk.Coin, sdk.Int, error)
- func (k Keeper) GetAdminAccount(ctx sdk.Context) (sdk.AccAddress, error)
- func (k Keeper) GetAllBaseDenoms(ctx sdk.Context) ([]*types.BaseDenom, error)
- func (k Keeper) GetAllDeveloperFees(ctx sdk.Context) ([]sdk.Coin, error)
- func (k Keeper) GetAllProfits(ctx sdk.Context) []*sdk.Coin
- func (k Keeper) GetAllProfitsByRoute(ctx sdk.Context, route []uint64) []*sdk.Coin
- func (k Keeper) GetAllRoutes(ctx sdk.Context) ([][]uint64, error)
- func (k Keeper) GetAllTokenPairArbRoutes(ctx sdk.Context) ([]*types.TokenPairArbRoutes, error)
- func (k Keeper) GetDaysSinceModuleGenesis(ctx sdk.Context) (uint64, error)
- func (k Keeper) GetDeveloperAccount(ctx sdk.Context) (sdk.AccAddress, error)
- func (k Keeper) GetDeveloperFees(ctx sdk.Context, denom string) (sdk.Coin, error)
- func (k Keeper) GetHighestLiquidityPools(ctx sdk.Context, baseDenomPools map[string]map[string]LiquidityPoolStruct) error
- func (k Keeper) GetLatestBlockHeight(ctx sdk.Context) (uint64, error)
- func (k Keeper) GetMaxPointsPerBlock(ctx sdk.Context) (uint64, error)
- func (k Keeper) GetMaxPointsPerTx(ctx sdk.Context) (uint64, error)
- func (k Keeper) GetNumberOfTrades(ctx sdk.Context) (sdk.Int, error)
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetPointCountForBlock(ctx sdk.Context) (uint64, error)
- func (k Keeper) GetPoolForDenomPair(ctx sdk.Context, baseDenom, denomToMatch string) (uint64, error)
- func (k Keeper) GetPoolWeights(ctx sdk.Context) *types.PoolWeights
- func (k Keeper) GetProfitsByDenom(ctx sdk.Context, denom string) (sdk.Coin, error)
- func (k Keeper) GetProfitsByRoute(ctx sdk.Context, route []uint64, denom string) (sdk.Coin, error)
- func (k Keeper) GetProtoRevEnabled(ctx sdk.Context) (bool, error)
- func (k Keeper) GetTokenPairArbRoutes(ctx sdk.Context, tokenA, tokenB string) (*types.TokenPairArbRoutes, error)
- func (k Keeper) GetTradesByRoute(ctx sdk.Context, route []uint64) (sdk.Int, error)
- func (k Keeper) IncrementNumberOfTrades(ctx sdk.Context) error
- func (k Keeper) IncrementPointCountForBlock(ctx sdk.Context, amount uint64) error
- func (k Keeper) IncrementTradesByRoute(ctx sdk.Context, route []uint64) error
- func (k Keeper) IsValidPool(ctx sdk.Context, poolId uint64) error
- func (k Keeper) IterateRoutes(ctx sdk.Context, routes []poolmanagertypes.SwapAmountInRoutes) (sdk.Coin, sdk.Int, poolmanagertypes.SwapAmountInRoutes)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) ProtoRevTrade(ctx sdk.Context, swappedPools []SwapToBackrun) error
- func (k Keeper) RemainingPoolPointsForTx(ctx sdk.Context) (*uint64, error)
- func (k Keeper) SendDeveloperFeesToDeveloperAccount(ctx sdk.Context) error
- func (k Keeper) SetAdminAccount(ctx sdk.Context, adminAccount sdk.AccAddress)
- func (k Keeper) SetBaseDenoms(ctx sdk.Context, baseDenoms []*types.BaseDenom) error
- func (k Keeper) SetDaysSinceModuleGenesis(ctx sdk.Context, daysSinceGenesis uint64)
- func (k Keeper) SetDeveloperAccount(ctx sdk.Context, developerAccount sdk.AccAddress)
- func (k Keeper) SetDeveloperFees(ctx sdk.Context, developerFees sdk.Coin) error
- func (k Keeper) SetLatestBlockHeight(ctx sdk.Context, blockHeight uint64)
- func (k Keeper) SetMaxPointsPerBlock(ctx sdk.Context, maxPoints uint64) error
- func (k Keeper) SetMaxPointsPerTx(ctx sdk.Context, maxPoints uint64) error
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetPointCountForBlock(ctx sdk.Context, txCount uint64)
- func (k Keeper) SetPoolForDenomPair(ctx sdk.Context, baseDenom, denomToMatch string, poolId uint64)
- func (k Keeper) SetPoolWeights(ctx sdk.Context, poolWeights types.PoolWeights)
- func (k Keeper) SetProtoRevEnabled(ctx sdk.Context, enabled bool)
- func (k Keeper) SetTokenPairArbRoutes(ctx sdk.Context, tokenA, tokenB string, tokenPair *types.TokenPairArbRoutes) error
- func (k Keeper) UpdateDeveloperFees(ctx sdk.Context, denom string, profit sdk.Int) error
- func (k Keeper) UpdatePools(ctx sdk.Context) error
- func (k Keeper) UpdateProfitsByDenom(ctx sdk.Context, denom string, tradeProfit sdk.Int) error
- func (k Keeper) UpdateProfitsByRoute(ctx sdk.Context, route []uint64, denom string, profit sdk.Int) error
- func (k Keeper) UpdateStatistics(ctx sdk.Context, route poolmanagertypes.SwapAmountInRoutes, denom string, ...) error
- type LiquidityPoolStruct
- type MsgServer
- func (m MsgServer) AdminCheck(ctx sdk.Context, admin string) error
- func (m MsgServer) SetBaseDenoms(c context.Context, msg *types.MsgSetBaseDenoms) (*types.MsgSetBaseDenomsResponse, error)
- func (m MsgServer) SetDeveloperAccount(c context.Context, msg *types.MsgSetDeveloperAccount) (*types.MsgSetDeveloperAccountResponse, error)
- func (m MsgServer) SetHotRoutes(c context.Context, msg *types.MsgSetHotRoutes) (*types.MsgSetHotRoutesResponse, error)
- func (m MsgServer) SetMaxPoolPointsPerBlock(c context.Context, msg *types.MsgSetMaxPoolPointsPerBlock) (*types.MsgSetMaxPoolPointsPerBlockResponse, error)
- func (m MsgServer) SetMaxPoolPointsPerTx(c context.Context, msg *types.MsgSetMaxPoolPointsPerTx) (*types.MsgSetMaxPoolPointsPerTxResponse, error)
- func (m MsgServer) SetPoolWeights(c context.Context, msg *types.MsgSetPoolWeights) (*types.MsgSetPoolWeightsResponse, error)
- type ProtoRevDecorator
- type Querier
- func (q Querier) GetProtoRevAdminAccount(c context.Context, req *types.QueryGetProtoRevAdminAccountRequest) (*types.QueryGetProtoRevAdminAccountResponse, error)
- func (q Querier) GetProtoRevAllProfits(c context.Context, req *types.QueryGetProtoRevAllProfitsRequest) (*types.QueryGetProtoRevAllProfitsResponse, error)
- func (q Querier) GetProtoRevAllRouteStatistics(c context.Context, req *types.QueryGetProtoRevAllRouteStatisticsRequest) (*types.QueryGetProtoRevAllRouteStatisticsResponse, error)
- func (q Querier) GetProtoRevBaseDenoms(c context.Context, req *types.QueryGetProtoRevBaseDenomsRequest) (*types.QueryGetProtoRevBaseDenomsResponse, error)
- func (q Querier) GetProtoRevDeveloperAccount(c context.Context, req *types.QueryGetProtoRevDeveloperAccountRequest) (*types.QueryGetProtoRevDeveloperAccountResponse, error)
- func (q Querier) GetProtoRevEnabled(c context.Context, req *types.QueryGetProtoRevEnabledRequest) (*types.QueryGetProtoRevEnabledResponse, error)
- func (q Querier) GetProtoRevMaxPoolPointsPerBlock(c context.Context, req *types.QueryGetProtoRevMaxPoolPointsPerBlockRequest) (*types.QueryGetProtoRevMaxPoolPointsPerBlockResponse, error)
- func (q Querier) GetProtoRevMaxPoolPointsPerTx(c context.Context, req *types.QueryGetProtoRevMaxPoolPointsPerTxRequest) (*types.QueryGetProtoRevMaxPoolPointsPerTxResponse, error)
- func (q Querier) GetProtoRevNumberOfTrades(c context.Context, req *types.QueryGetProtoRevNumberOfTradesRequest) (*types.QueryGetProtoRevNumberOfTradesResponse, error)
- func (q Querier) GetProtoRevPoolWeights(c context.Context, req *types.QueryGetProtoRevPoolWeightsRequest) (*types.QueryGetProtoRevPoolWeightsResponse, error)
- func (q Querier) GetProtoRevProfitsByDenom(c context.Context, req *types.QueryGetProtoRevProfitsByDenomRequest) (*types.QueryGetProtoRevProfitsByDenomResponse, error)
- func (q Querier) GetProtoRevStatisticsByRoute(c context.Context, req *types.QueryGetProtoRevStatisticsByRouteRequest) (*types.QueryGetProtoRevStatisticsByRouteResponse, error)
- func (q Querier) GetProtoRevTokenPairArbRoutes(c context.Context, req *types.QueryGetProtoRevTokenPairArbRoutesRequest) (*types.QueryGetProtoRevTokenPairArbRoutesResponse, error)
- func (q Querier) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- type SwapToBackrun
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMsgServer ¶
NewMsgServer returns an implementation of the MsgServer interface for the provided Keeper.
Types ¶
type EpochHooks ¶
type EpochHooks struct {
// contains filtered or unexported fields
}
func (EpochHooks) AfterEpochEnd ¶
AfterEpochEnd is the epoch end hook.
func (EpochHooks) BeforeEpochStart ¶
func (h EpochHooks) BeforeEpochStart(ctx sdk.Context, epochIdentifier string, epochNumber int64) error
BeforeEpochStart is the epoch start hook.
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeKey sdk.StoreKey, ps paramtypes.Subspace, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, gammKeeper types.GAMMKeeper, epochKeeper types.EpochKeeper, poolmanagerKeeper types.PoolManagerKeeper, ) Keeper
func (Keeper) AnteHandleCheck ¶
AnteHandleCheck checks if the module is enabled and if the number of routes to be processed per block has been reached.
func (Keeper) BuildHighestLiquidityRoute ¶
func (k Keeper) BuildHighestLiquidityRoute(ctx sdk.Context, swapDenom, tokenIn, tokenOut string, poolId uint64, remainingPoolPoints *uint64) (poolmanagertypes.SwapAmountInRoutes, error)
BuildHighestLiquidityRoute constructs a cyclic arbitrage route that is starts/ends with swapDenom (ex. mer) given the swap (tokenIn, tokenOut, poolId).
func (Keeper) BuildHighestLiquidityRoutes ¶
func (k Keeper) BuildHighestLiquidityRoutes(ctx sdk.Context, tokenIn, tokenOut string, poolId uint64, remainingPoolPoints *uint64) ([]poolmanagertypes.SwapAmountInRoutes, error)
BuildHighestLiquidityRoutes builds cyclic arbitrage routes using the highest liquidity method. The base denoms are sorted by priority and routes are built in a greedy manner.
func (Keeper) BuildHotRoute ¶
func (k Keeper) BuildHotRoute(ctx sdk.Context, route *types.Route, poolId uint64, remainingPoolPoints *uint64) (poolmanagertypes.SwapAmountInRoutes, error)
BuildHotRoute constructs a cyclic arbitrage route given a hot route and swap that should be placed in the hot route.
func (Keeper) BuildHotRoutes ¶
func (k Keeper) BuildHotRoutes(ctx sdk.Context, tokenIn, tokenOut string, poolId uint64, remainingPoolPoints *uint64) ([]poolmanagertypes.SwapAmountInRoutes, error)
BuildHotRoutes builds all of the possible arbitrage routes using the hot routes method.
func (Keeper) BuildRoutes ¶
func (k Keeper) BuildRoutes(ctx sdk.Context, tokenIn, tokenOut string, poolId uint64, remainingPoolPoints *uint64) []poolmanagertypes.SwapAmountInRoutes
BuildRoutes builds all of the possible arbitrage routes given the tokenIn, tokenOut and poolId that were used in the swap.
func (Keeper) CheckAndUpdateRouteState ¶
func (k Keeper) CheckAndUpdateRouteState(ctx sdk.Context, route poolmanagertypes.SwapAmountInRoutes, remainingPoolPoints *uint64) error
CheckAndUpdateRouteState checks if the cyclic arbitrage route that was created via the highest liquidity route or hot route method is valid. If the route is too expensive to iterate through, has a inactive or invalid pool, or unsupported pool type, an error is returned.
func (Keeper) ConvertProfits ¶
func (k Keeper) ConvertProfits(ctx sdk.Context, inputCoin sdk.Coin, profit sdk.Int) (sdk.Int, error)
ConvertProfits converts the profit denom to umer to allow for a fair comparison of profits
func (Keeper) DeleteAllEntriesForKeyPrefix ¶
DeleteAllEntriesForKeyPrefix deletes all the entries from the store for the given key prefix
func (Keeper) DeleteAllPoolsForBaseDenom ¶
DeleteAllPoolsForBaseDenom deletes all the pools for the given base denom
func (Keeper) DeleteAllTokenPairArbRoutes ¶
DeleteAllTokenPairArbRoutes deletes all the token pair arb routes
func (Keeper) DeleteBaseDenoms ¶
DeleteBaseDenoms deletes all of the base denoms
func (Keeper) DeleteDeveloperFees ¶
DeleteDeveloperFees deletes the developer fees given a denom
func (Keeper) EpochHooks ¶
func (k Keeper) EpochHooks() epochstypes.EpochHooks
func (Keeper) EstimateMultihopProfit ¶
func (k Keeper) EstimateMultihopProfit(ctx sdk.Context, inputDenom string, amount sdk.Int, route poolmanagertypes.SwapAmountInRoutes) (sdk.Coin, sdk.Int, error)
EstimateMultihopProfit estimates the profit for a given route by estimating the amount out given the amount in for the first pool in the route and then subtracting the amount in from the amount out to get the profit
func (Keeper) ExecuteTrade ¶
func (k Keeper) ExecuteTrade(ctx sdk.Context, route poolmanagertypes.SwapAmountInRoutes, inputCoin sdk.Coin) error
ExecuteTrade inputs a route, amount in, and rebalances the pool
func (Keeper) FindMaxProfitForRoute ¶
func (k Keeper) FindMaxProfitForRoute(ctx sdk.Context, route poolmanagertypes.SwapAmountInRoutes, inputDenom string) (sdk.Coin, sdk.Int, error)
FindMaxProfitRoute runs a binary search to find the max profit for a given route
func (Keeper) GetAdminAccount ¶
GetAdminAccount returns the admin account for protorev
func (Keeper) GetAllBaseDenoms ¶
GetAllBaseDenoms returns all of the base denoms (sorted by priority in descending order) used to build cyclic arbitrage routes
func (Keeper) GetAllDeveloperFees ¶
GetAllDeveloperFees returns all the developer fees the developer account can withdraw
func (Keeper) GetAllProfits ¶
GetAllProfits returns all of the profits made by the ProtoRev module.
func (Keeper) GetAllProfitsByRoute ¶
GetAllProfitsByRoute returns all of the profits made by the ProtoRev module for the given route
func (Keeper) GetAllRoutes ¶
GetAllRoutes returns all of the routes that the ProtoRev module has traded on
func (Keeper) GetAllTokenPairArbRoutes ¶
GetAllTokenPairArbRoutes returns all the token pair arb routes
func (Keeper) GetDaysSinceModuleGenesis ¶
GetDaysSinceModuleGenesis returns the number of days since the module was initialized
func (Keeper) GetDeveloperAccount ¶
GetDeveloperAccount returns the developer account for protorev
func (Keeper) GetDeveloperFees ¶
GetDeveloperFees returns the fees the developers can withdraw from the module account
func (Keeper) GetHighestLiquidityPools ¶
func (k Keeper) GetHighestLiquidityPools(ctx sdk.Context, baseDenomPools map[string]map[string]LiquidityPoolStruct) error
GetHighestLiquidityPools returns the highest liquidity pools for all base denoms
func (Keeper) GetLatestBlockHeight ¶
GetLatestBlockHeight returns the latest block height that protorev was run on
func (Keeper) GetMaxPointsPerBlock ¶
GetMaxPointsPerBlock returns the max number of pool points that can be consumed per block. A pool point is roughly equivalent to 1 ms of simulation & execution time.
func (Keeper) GetMaxPointsPerTx ¶
GetMaxPointsPerTx returns the max number of pool points that can be consumed per transaction. A pool point is roughly equivalent to 1 ms of simulation & execution time.
func (Keeper) GetNumberOfTrades ¶
GetNumberOfTrades returns the number of trades executed by the ProtoRev module
func (Keeper) GetPointCountForBlock ¶
GetPointCountForBlock returns the number of pool points that have been consumed in the current block
func (Keeper) GetPoolForDenomPair ¶
func (k Keeper) GetPoolForDenomPair(ctx sdk.Context, baseDenom, denomToMatch string) (uint64, error)
GetPoolForDenomPair returns the id of the highest liquidty pool between the base denom and the denom to match
func (Keeper) GetPoolWeights ¶
func (k Keeper) GetPoolWeights(ctx sdk.Context) *types.PoolWeights
GetPoolWeights retrieves the weights of different pool types. The weight of a pool type roughly corresponds to the amount of time it will take to simulate and execute a swap on that pool type (in ms).
func (Keeper) GetProfitsByDenom ¶
GetProfitsByDenom returns the profits made by the ProtoRev module for the given denom
func (Keeper) GetProfitsByRoute ¶
GetProfitsByRoute returns the profits made by the ProtoRev module for the given route and denom
func (Keeper) GetProtoRevEnabled ¶
GetProtoRevEnabled returns whether protorev is enabled
func (Keeper) GetTokenPairArbRoutes ¶
func (k Keeper) GetTokenPairArbRoutes(ctx sdk.Context, tokenA, tokenB string) (*types.TokenPairArbRoutes, error)
GetTokenPairArbRoutes returns the token pair arb routes given two denoms
func (Keeper) GetTradesByRoute ¶
GetTradesByRoute returns the number of trades executed by the ProtoRev module for the given route
func (Keeper) IncrementNumberOfTrades ¶
IncrementNumberOfTrades increments the number of trades executed by the ProtoRev module
func (Keeper) IncrementPointCountForBlock ¶
IncrementPointCountForBlock increments the number of pool points that have been consumed in the current block
func (Keeper) IncrementTradesByRoute ¶
IncrementTradesByRoute increments the number of trades executed by the ProtoRev module for the given route
func (Keeper) IsValidPool ¶
IsValidPool checks if the pool is active and exists
func (Keeper) IterateRoutes ¶
func (k Keeper) IterateRoutes(ctx sdk.Context, routes []poolmanagertypes.SwapAmountInRoutes) (sdk.Coin, sdk.Int, poolmanagertypes.SwapAmountInRoutes)
IterateRoutes checks the profitability of every single route that is passed in and returns the optimal route if there is one
func (Keeper) ProtoRevTrade ¶
func (k Keeper) ProtoRevTrade(ctx sdk.Context, swappedPools []SwapToBackrun) error
ProtoRevTrade wraps around the build routes, iterate routes, and execute trade functionality to execute cyclic arbitrage trades if they exist. It returns an error if there was an issue executing any single trade.
func (Keeper) RemainingPoolPointsForTx ¶
RemainingPoolPointsForTx calculates the number of pool points that can be consumed in the current transaction. Returns a pointer that will be used throughout the lifetime of a transaction.
func (Keeper) SendDeveloperFeesToDeveloperAccount ¶
SendDeveloperFeesToDeveloperAccount sends the developer fees from the module account to the developer account
func (Keeper) SetAdminAccount ¶
func (k Keeper) SetAdminAccount(ctx sdk.Context, adminAccount sdk.AccAddress)
SetAdminAccount sets the admin account for protorev
func (Keeper) SetBaseDenoms ¶
SetBaseDenoms sets all of the base denoms used to build cyclic arbitrage routes. The base denoms priority order is going to match the order of the base denoms in the slice.
func (Keeper) SetDaysSinceModuleGenesis ¶
SetDaysSinceModuleGenesis updates the number of days since genesis
func (Keeper) SetDeveloperAccount ¶
func (k Keeper) SetDeveloperAccount(ctx sdk.Context, developerAccount sdk.AccAddress)
SetDeveloperAccount sets the developer account for protorev that will receive a portion of arbitrage profits
func (Keeper) SetDeveloperFees ¶
SetDeveloperFees sets the fees the developers can withdraw from the module account
func (Keeper) SetLatestBlockHeight ¶
SetLatestBlockHeight sets the latest block height that protorev was run on
func (Keeper) SetMaxPointsPerBlock ¶
SetMaxPointsPerBlock sets the max number of pool points that can be consumed per block. A pool point is roughly equivalent to 1 ms of simulation & execution time.
func (Keeper) SetMaxPointsPerTx ¶
SetMaxPointsPerTx sets the max number of pool points that can be consumed per transaction. A pool point is roughly equivalent to 1 ms of simulation & execution time.
func (Keeper) SetPointCountForBlock ¶
SetPointCountForBlock sets the number of pool points that have been consumed in the current block
func (Keeper) SetPoolForDenomPair ¶
SetPoolForDenomPair sets the id of the highest liquidty pool between the base denom and the denom to match
func (Keeper) SetPoolWeights ¶
func (k Keeper) SetPoolWeights(ctx sdk.Context, poolWeights types.PoolWeights)
SetPoolWeights sets the weights of different pool types.
func (Keeper) SetProtoRevEnabled ¶
SetProtoRevEnabled sets whether the protorev post handler is enabled
func (Keeper) SetTokenPairArbRoutes ¶
func (k Keeper) SetTokenPairArbRoutes(ctx sdk.Context, tokenA, tokenB string, tokenPair *types.TokenPairArbRoutes) error
SetTokenPairArbRoutes sets the token pair arb routes given two denoms
func (Keeper) UpdateDeveloperFees ¶
UpdateDeveloperFees updates the fees that developers can withdraw from the module account
func (Keeper) UpdatePools ¶
UpdatePools first deletes all of the pools paired with any base denom in the store and then adds the highest liquidity pools that match to the store
func (Keeper) UpdateProfitsByDenom ¶
UpdateProfitsByDenom updates the profits made by the ProtoRev module for the given denom
func (Keeper) UpdateProfitsByRoute ¶
func (k Keeper) UpdateProfitsByRoute(ctx sdk.Context, route []uint64, denom string, profit sdk.Int) error
UpdateProfitsByRoute updates the profits made by the ProtoRev module for the given route and denom
func (Keeper) UpdateStatistics ¶
func (k Keeper) UpdateStatistics(ctx sdk.Context, route poolmanagertypes.SwapAmountInRoutes, denom string, profit sdk.Int) error
UpdateStatistics updates the module statistics after each trade is executed
type LiquidityPoolStruct ¶
Struct used to track the pool with the highest liquidity
type MsgServer ¶
type MsgServer struct {
// contains filtered or unexported fields
}
func (MsgServer) AdminCheck ¶
AdminCheck ensures that the admin account is set and that the sender is the admin account
func (MsgServer) SetBaseDenoms ¶
func (m MsgServer) SetBaseDenoms(c context.Context, msg *types.MsgSetBaseDenoms) (*types.MsgSetBaseDenomsResponse, error)
SetBaseDenoms sets the base denoms that will be used to generate cyclic arbitrage routes
func (MsgServer) SetDeveloperAccount ¶
func (m MsgServer) SetDeveloperAccount(c context.Context, msg *types.MsgSetDeveloperAccount) (*types.MsgSetDeveloperAccountResponse, error)
SetDeveloperAccount sets the developer account that will receive fees
func (MsgServer) SetHotRoutes ¶
func (m MsgServer) SetHotRoutes(c context.Context, msg *types.MsgSetHotRoutes) (*types.MsgSetHotRoutesResponse, error)
SetHotRoutes sets the hot routes for ProtoRev
func (MsgServer) SetMaxPoolPointsPerBlock ¶
func (m MsgServer) SetMaxPoolPointsPerBlock(c context.Context, msg *types.MsgSetMaxPoolPointsPerBlock) (*types.MsgSetMaxPoolPointsPerBlockResponse, error)
SetMaxPoolPointsPerBlock sets the maximum number of pool points that can be consumed per block
func (MsgServer) SetMaxPoolPointsPerTx ¶
func (m MsgServer) SetMaxPoolPointsPerTx(c context.Context, msg *types.MsgSetMaxPoolPointsPerTx) (*types.MsgSetMaxPoolPointsPerTxResponse, error)
SetMaxPoolPointsPerTx sets the maximum number of pool points that can be consumed per tx
func (MsgServer) SetPoolWeights ¶
func (m MsgServer) SetPoolWeights(c context.Context, msg *types.MsgSetPoolWeights) (*types.MsgSetPoolWeightsResponse, error)
SetPoolWeights sets the weights corresponding to each pool type. This distinction is necessary because the pool types have different execution times. Each weight roughly corresponds to the amount of time (in ms) it takes to simulate and execute a trade.
type ProtoRevDecorator ¶
type ProtoRevDecorator struct {
ProtoRevKeeper Keeper
}
func NewProtoRevDecorator ¶
func NewProtoRevDecorator(protoRevDecorator Keeper) ProtoRevDecorator
func (ProtoRevDecorator) AnteHandle ¶
func (protoRevDec ProtoRevDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error)
This posthandler will first check if there were any swaps in the tx. If so, collect all of the pools, build routes for cyclic arbitrage, and then execute the optimal route if it exists.
type Querier ¶
type Querier struct {
Keeper
}
Querier defines a wrapper around the x/protorev keeper providing gRPC method handlers.
func NewQuerier ¶
func (Querier) GetProtoRevAdminAccount ¶
func (q Querier) GetProtoRevAdminAccount(c context.Context, req *types.QueryGetProtoRevAdminAccountRequest) (*types.QueryGetProtoRevAdminAccountResponse, error)
GetProtoRevAdminAccount queries the admin account that is allowed to execute admin functions
func (Querier) GetProtoRevAllProfits ¶
func (q Querier) GetProtoRevAllProfits(c context.Context, req *types.QueryGetProtoRevAllProfitsRequest) (*types.QueryGetProtoRevAllProfitsResponse, error)
GetProtoRevAllProfits queries all of the profits from the module
func (Querier) GetProtoRevAllRouteStatistics ¶
func (q Querier) GetProtoRevAllRouteStatistics(c context.Context, req *types.QueryGetProtoRevAllRouteStatisticsRequest) (*types.QueryGetProtoRevAllRouteStatisticsResponse, error)
GetProtoRevAllRouteStatistics queries all of routes that the module has arbitrage against and the number of trades executed on each route and the total profits for each route
func (Querier) GetProtoRevBaseDenoms ¶
func (q Querier) GetProtoRevBaseDenoms(c context.Context, req *types.QueryGetProtoRevBaseDenomsRequest) (*types.QueryGetProtoRevBaseDenomsResponse, error)
GetProtoRevBaseDenoms queries the base denoms that are being used for arbitrage
func (Querier) GetProtoRevDeveloperAccount ¶
func (q Querier) GetProtoRevDeveloperAccount(c context.Context, req *types.QueryGetProtoRevDeveloperAccountRequest) (*types.QueryGetProtoRevDeveloperAccountResponse, error)
GetProtoRevDeveloperAccount queries the developer account that is accumulating the profits from the module
func (Querier) GetProtoRevEnabled ¶
func (q Querier) GetProtoRevEnabled(c context.Context, req *types.QueryGetProtoRevEnabledRequest) (*types.QueryGetProtoRevEnabledResponse, error)
GetProtoRevEnabled queries whether the module is enabled or not
func (Querier) GetProtoRevMaxPoolPointsPerBlock ¶
func (q Querier) GetProtoRevMaxPoolPointsPerBlock(c context.Context, req *types.QueryGetProtoRevMaxPoolPointsPerBlockRequest) (*types.QueryGetProtoRevMaxPoolPointsPerBlockResponse, error)
GetProtoRevPoolPointsPerBlock queries the maximum number of pool points that can be consumed per block
func (Querier) GetProtoRevMaxPoolPointsPerTx ¶
func (q Querier) GetProtoRevMaxPoolPointsPerTx(c context.Context, req *types.QueryGetProtoRevMaxPoolPointsPerTxRequest) (*types.QueryGetProtoRevMaxPoolPointsPerTxResponse, error)
GetProtoRevPoolPointsPerTx queries the maximum number of pool points that can be consumed per transaction
func (Querier) GetProtoRevNumberOfTrades ¶
func (q Querier) GetProtoRevNumberOfTrades(c context.Context, req *types.QueryGetProtoRevNumberOfTradesRequest) (*types.QueryGetProtoRevNumberOfTradesResponse, error)
GetProtoRevNumberOfTrades queries the number of trades the module has executed
func (Querier) GetProtoRevPoolWeights ¶
func (q Querier) GetProtoRevPoolWeights(c context.Context, req *types.QueryGetProtoRevPoolWeightsRequest) (*types.QueryGetProtoRevPoolWeightsResponse, error)
GetProtoRevPoolWeights queries the weights of each pool type that is being used for arbitrage
func (Querier) GetProtoRevProfitsByDenom ¶
func (q Querier) GetProtoRevProfitsByDenom(c context.Context, req *types.QueryGetProtoRevProfitsByDenomRequest) (*types.QueryGetProtoRevProfitsByDenomResponse, error)
GetProtoRevProfitsByDenom queries the profits of the module by denom
func (Querier) GetProtoRevStatisticsByRoute ¶
func (q Querier) GetProtoRevStatisticsByRoute(c context.Context, req *types.QueryGetProtoRevStatisticsByRouteRequest) (*types.QueryGetProtoRevStatisticsByRouteResponse, error)
GetProtoRevStatisticsByRoute queries the number of arbitrages and profits that have been executed for a given route
func (Querier) GetProtoRevTokenPairArbRoutes ¶
func (q Querier) GetProtoRevTokenPairArbRoutes(c context.Context, req *types.QueryGetProtoRevTokenPairArbRoutesRequest) (*types.QueryGetProtoRevTokenPairArbRoutesResponse, error)
GetProtoRevTokenPairArbRoutes queries the hot routes that the module is utilizing for cyclic arbitrage route generation
func (Querier) Params ¶
func (q Querier) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
Params queries the parameters of the module.
type SwapToBackrun ¶
func ExtractSwappedPools ¶
func ExtractSwappedPools(tx sdk.Tx) []SwapToBackrun
ExtractSwappedPools checks if there were any swaps made on pools and if so returns a list of all the pools that were swapped on and metadata about the swap