-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add curve support in pricing module #514
Conversation
cli failing for some other reasons |
yeah the user for the server got nuked, needs to be re-created |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't bother checking the math, The changes you made though will require db changes on our end, should be no problem though. The tests won't pass but the build, fmt and clippy should.
crates/brontes-pricing/src/protocols/curve/curve_stable_pool/batch_request/mod.rs
Outdated
Show resolved
Hide resolved
crates/brontes-pricing/src/protocols/curve/curve_stable_pool/curve_stable_pool_math/fee_math.rs
Outdated
Show resolved
Hide resolved
...ricing/src/protocols/curve/curve_stable_pool/curve_stable_pool_math/stable_swap_invariant.rs
Outdated
Show resolved
Hide resolved
...ricing/src/protocols/curve/curve_stable_pool/curve_stable_pool_math/stable_swap_invariant.rs
Outdated
Show resolved
Hide resolved
crates/brontes-pricing/src/protocols/curve/curve_stable_pool/mod.rs
Outdated
Show resolved
Hide resolved
crates/brontes-pricing/src/protocols/curve/curve_stable_pool/mod.rs
Outdated
Show resolved
Hide resolved
5d5a6e7
to
7855a3f
Compare
just slot address and bytecode locations of variables used are need to be added |
trait definitions for |
// contract immutable variables | ||
pub price_scale_packed: U256, | ||
pub future_a_gamma_time: U256, | ||
//update this on executions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
few pools in which future_a_gamma_time
is specified, d_value
needs to be updated due to ramping, on every swap function, will add this code to cover these types of pools as well
fee: U256::ZERO, | ||
admin_fee: U256::ZERO, | ||
a_value: U256::ZERO, | ||
rates: RATES.to_vec(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
majority of pools use these base rates(RATES
) only, which are set during contract deployment, and then updated subsequently on various actions, but some TriCrypto
use different base rates or do not use them at all(a different rate calculation method), will add code to incorporate those few pools.
); | ||
|
||
// Positions of crypto pool immutables in the bytecode | ||
const PRICE_SCALE_PACKED_RANGE: std::ops::Range<usize> = ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these will be set now
) -> Result<(), AmmError> { | ||
|
||
// Pool Storage Slots | ||
let d_value_slot: FixedBytes<32> = FixedBytes::new([""]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this as well
93d0120
to
c9f43c9
Compare
c9f43c9
to
76e6738
Compare
closes #501
This pr adds support for curve protocol in pricing-module
Overview:
Curve consists of a variety of pools such as base-pools, liquidity-pools, meta-pools, plain-pools, tri-crypto pools etc. But at a higher level, all these pools can be classified into two broad groups based on the underlying AMM model used for pool balancing basically into two types that are Stable-Swap pools which use the stable-swap invariant model, and Crypto-Swap pools which use the crypto-swap invariant model.
General-Solution:
Stable-Swap pools
base pools
meta pools
plain pools
other underlying pools
Crypto-Swap pools
underlying pools
stable_pool
as well