Updated fee logic for Valantis STEX AMM #20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Template: GlueX Liquidity Module Integration
Protocol Information
Summary of Integration
Provide a brief overview of your integration:
Implementation Details
Execution Functions Required
ABI:
At this address:
0x5365b6EF09253C7aBc0A9286eC578A9f4B413B7D
Functions Implemented
get_amount_out()
: uses the updated logic from the Valantis stepwise fee module, solidity code is currently privateget_amount_in()
: same as the aboveget_apy()
: pulled directly from the Valantis backendget_tvl()
: Gets reserves of stHYPE and HYPE, returns the sum minus any tokens pending LP withdrawalDynamic States Required for AMM Calculations
Specify any on-chain values that change frequently and are required for accurate AMM computations, such as:
Pool states:
0x68675DC8406252b6950128f6504A5E287Ef24ED0
0x39694eFF3b02248929120c73F90347013Aec834d
0x75d85d081E189F72d5C189e94d1c2cc0026AFB70
0x69e487aA3132708d08a979b2d07c5119Bb77F698
For pool reserves state, use the lens contract with the STEX address as input
reserves_token_0
reserves_token_1
amount_0_pending_unstaking
amount_1_pending_lp_withdrawal
amount_1_lending_pool
ABI:
getAllReserves(0x39694eFF3b02248929120c73F90347013Aec834d)
at lens addressFor fee parameters:
Contract address:
0x75d85d081E189F72d5C189e94d1c2cc0026AFB70
ABI:
Pool states you'll need from this:
fee_stepwise_in_bips
: UsegetToken0FeeInBips()
min_threshold_token_1
: UseminThresholdToken1()
max_threshold_token_1
: UsemaxThresholdToken1()
num_steps_token_0_fee_curve
: UsenumStepsToken0FeeCurve()
Withdrawal module, address:
0x69e487aA3132708d08a979b2d07c5119Bb77F698
ABI:
State that you'll need from this:
exchange_rate_to_token_0
: Callconvert_to_token_0(1 ether)
exchange_rate_to_token_1
: Callconvert_to_token_1(1 ether)
Static States Required for AMM Calculations
Specify any on-chain values that remain constant such as:
token0/token1:
ABI:
token0:
token1:
Note: We support swaps from HYPE/wHYPE -> stHYPE
Dependencies
For APY, you will have a dependency on
analytics-v3.valantis-analytics.xyz
. I'll get y'all the API token for thisOther Requirements
Test Results
Provide details of tests performed, including: