pub struct RubiconSession<M: Middleware + Clone + 'static> { /* private fields */ }
Expand description

RubiconSession wraps up all of the basic contracts that the protocol uses into one convenient struct. It provides all of the basic functions you would need to tracsact with the protocol. All of the view/pure functions are async, and will return the expected value. All of the mutating functions are sync, and will return a ContractCall. You can then take that ContractCall and manipulate it as you want (e.g. setting gas limits) before sending it to your configured provider with the .send() method.

Implementations

  • impl<M: Middleware + Clone + ’static> RubiconSession where ::Provider: PubsubClient,

Creates a new RubiconSession configured to Optimism Mainnet.

Creates a new RubiconSession configured to Optimism Kovan. OP Kovan is now considered obsolete. This requires that the aid feature is not set - the Market Aid contract is not deployed on OP Kovan.

Creates a new RubiconSession configured to Optimism Goerli. This requires that the aid feature is not set - the Market Aid contract is not deployed on OP Goerli.

Returns a reference to the RubiconMarket contract.

Returns a reference to the BathHouse contract.

Returns a reference to the BathPair contract.

Returns a reference to the Router contract.

Returns a reference to the ethers-rs chain enum.

Address associated with the current middleware, if it exists.

Are we on a legacy chain (pre EIP-1559)? If so, we have to use legacy TX calls…

Returns a ChainNativeAsset localized to the current chain.

Returns a ChainNativeAsset localized to the current chain, with size equal to zero.

Returns a ChainNativeAsset localized to the current chain, with size equal to 2^256-1.

Returns a ChainNativeAsset localized to the current chain. human_size is human readable, and is converted to wei behind the scenes.

Returns a ChainNativeAsset localized to the current chain. human_size is human readable, and is converted to wei behind the scenes.

Strategists have to be approved by the Rubicon protocol before they can place market making trades with pooled funds. This function returns true if the current middleware is an approved strategist.

Strategists have to be approved by the Rubicon protocol before they can place market making trades with pooled funds. This function returns true if the supplied address is an approved strategist.

This is a market buy, where we spend no more than max_fill_amount to buy buy_amt the returned value is the fill amount

This is a market sell, where we spend pay_amt to buy as much as possible of buy_gem (and we get at least min_fill_amount) the returned value is the filled amount

This represents a market sell, where we sell the source.size() worth of source.asset() in exchange for some undetermined amount target

This represents a market sell, where we sell the source.size() worth of source.asset() in exchange for some undetermined amount target

This is used to construct a limit order, where we want to sell pay_amt of pay_gem for at least buy_amt of buy_gem. The pos parameter should be None unless you know the new position of the order in the sorted orderbook. pay_gem and buy_gem must not be equal.

This constructs a limit order transaction. We want to sell source.size() of source.asset() for at least target.size() of target.asset(). source.asset() and target.asset() must not be equal.

This constructs a limit order transaction. We sell base_size worth of base for quote, at a price greater than or equal to price. price has units quote/base. Both price and base_size are in human readable units, not wei. base and quote must not be equal.

This constructs a limit order transaction. We buy base_size worth of base for quote, at a price less than or equal to price. price has units quote/base. Both price and base_size are in human readable units, not wei. base and quote must not be equal.

This constructs a limit order transaction. We want to sell quute_size worth of quote for base, at a price greater than or equal to price. price has units quote/base. Both price and quote_size are in human readable units, not wei. base and quote must not be equal.

This constructs a limit order transaction. We want to buy quute_size worth of quote for base, at a price less than or equal to price. price has units quote/base. Both price and quote_size are in human readable units, not wei. base and quote must not be equal.

Cancels an order that’s already on the Rubicon book

This is used to place a strategist trade on the market. Trades are placed in pairs - a bid and an ask. ask_num and ask_den are the numerator and denominator of the ask price, respectively. The same is true of the bid. token_pair is of the form [base, quote], where base != quote.

This returns a ContractCall that will place a series of paired market making trades.

This returns a ContractCall that requotes the given pair of orders.

This returns a ContractCall that requotes a series of paired strategist orders.

This returns a ContractCall that cancels an outstanding strategist orders.

This returns a ContractCall that cancels a list of outstanding strategist orders.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more