-
Notifications
You must be signed in to change notification settings - Fork 112
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
SOR pages #15
SOR pages #15
Conversation
A draft on SOR. While writing it down it became apparent, that we can simplify the interface by eliminating merging findRoute with buildSwap steps. Currently, finding a route and constructing a swap require knowledge of the exact in / out type. However, each of these actions uses a different term for this type. Still todo: useBpts option, it's not covered on the SDK yet, probably makes sense to just add, because it's low level logic with Vault / Relayer encoding. Otherwise the pages are now ready for review and I would appreciate your feedback.
Deploying with Cloudflare Pages
|
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 is a good start - left a few small suggestions
|
||
### Step 1. Pool data fetching | ||
The SOR requires information about the available pools and their current status, including the prices of tokens and the liquidity of the pools. It is essential to use the SOR based on up-to-date information, as outdated information can lead to incorrect slippage predictions and potentially result in failed swaps. |
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 might add an additional note here that fetchPools()
does a subgraph query under the hood. And then later in the flow pool balances are updated via an onchain call (configurable via a flag).
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.
Added explanation on a query sources, but will need to double check the onchain updates configuration if it's working as expected.
tokenOut: string, // address of tokenOut | ||
swapType: SwapTypes, // SwapExactIn or SwapExactOut - see above | ||
swapAmount: string, // amountIn or amountOut depending on the `swapType`; number as a string with 18 decimals |
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.
Not 100% clear if this should be wei or human scale. For these I would always add a comment like ex: 1.5 WETH
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.
True, it's always hard because of multiple ways it's used across the SDK. Would be good to make it consistent, maybe ethers v6 with BigInt will be a good excuse for the refactoring?
swapAmount: string, // amountIn or amountOut depending on the `swapType`; number as a string with 18 decimals | ||
swapOptions: { | ||
gasPrice: string // current gas price; number as a string with 18 decimals |
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.
Similar thing here where gas prices are commonly quoted in gwei but not entirely clear what unit type to enter here. Comment something like ex: For 10gwei use ...
}, | ||
useBpts: boolean // include join / exits in the path. transaction needs to be sent via Relayer contract | ||
): Promise<SwapInfo>; |
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.
Might be useful to show the SwapInfo type info
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.
And then maybe along with that have a dropdown section (see deprecated section on deployment addresses docs pages for example) with a JSON stringified example of a returned SwapInfo object. Might be overkill, but I think personally I'd find that useful to see. Your call
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.
Agree on having responses, it's always good to see what you can expect.
|
||
```javascript | ||
const swapInfo = await swaps.findRouteGivenIn({ |
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.
When should I use findRouteGivenIn()
vs getSwaps()
? Explaining any differences or decisions I have to make as a dev would be really useful
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.
It's SDK abstracted SOR vs naked SOR. I agree it will be too confusing, so I updated everything to use SDK swaps module with findRouteGivenIn / findRouteGivenOut. In join / exits we use ExactIn / ExactOut - that naming comes from smart contracts. I think we should be consistent and use the same naming here, eg: findRouteExactOut.
Merging this to have the content available for docs release. But we should still get these fixes in |
Thanks for merging, updates are coming. I'll be pushing a PR to the SDK adding useBpts option, so it will need to revised again later on. |
* WIP * tabs structure * tempale ui complete * calendar-lockTime componenst * install web3modal + basic implementation * move stuff into Wallet component * wip * VeSystem Overview (data fetching) (#5) * Add LaunchpadSubgraph class * fetch launchpad data from subgraph * update UI with data * change UI max-lock time (#3) * change UI max-lock time * Changed max lock time calculation --------- Co-authored-by: Pablo F. Mescher <pablo@protofire.io> * wip * create Admin Panel + default tabs * launchpad hooks: deploy, refactor deploy form * submit button indicator * List token names (#7) * Admin Panel - Rewards Distribution / Admin Pools (#8) * RewardsDistribution Tab * Admin Pools (no design) * Basic Tab Navigation * Available rewards modal placeholder (#9) * Replace lauchpadProvider by VeSystemProvider (#10) * Admin Pools (#11) * Set Multiple Available Rewards (#12) Co-authored-by: Luigi <luigibyte@gmail.com> * VeSystem Config Fields (#13) * Ve System Config Fields and Buttons (#14) * Ve system config unlock all (#15) * Ve System Config - Early Unlock (#16) * Fixed Modals UI (#17) * Set Early Penalty Speed & fix styles (#18) * Added search by bptToken address functionality (#19) Co-authored-by: Luigi <luigibyte@gmail.com> Co-authored-by: esis8 <eesis.dev@gmail.com> * Non admin flow pool details / lock (#20) * Tab Navigation * Pool Details Button * Lock Action * Approve Action * Pool Details Tab Data * Non Admin Flow - Withdraw (#21) * Adapt UI to work with new subgraph schema (#23) * Claim Modal (#22) * Update launchpad contract address (#24) * Available Rewards Modal (#25) * Properly formatting numbers (#26) * Admin Pools: Search by vested token address (#27) * Add Supply Vested % (#28) * fixed size buttons (#29) * Fix Calendar timestamp for adding rewards exact week (#30) * Network support first round (#33) * Add Polygon zkEVM * add config file * fixed design btn selector (#32) * Add contract addresses (#34) * add contract addresses * add subgraph urls * Missing Non Admin Feautures (#31) * EarlyWithdraw * increase_amount * increase_unlock_time * Increase Lock Detalis Modals (#35) * Add to early penalty * change texts * rename search placeholder * add activation functionality checkboxes (#36) * launchpad start-time fix * change texts * allow increase unlock * update contract address and abi * Claim External Rewards * catch error * fix lock timestamp issue * change title for user section * max lock time changes * Only Mumbai * add ethereum to fix issue * fix timezone issue (#37) * Network Support (#38) * networks: polygon, arbitrum, mumbai * Scope veSystems by admin (#40) * list veSystems by admin * fix switch network * remove code redundancy * Tooltips (#39) * Network support (#44) Add support for: * mainnet * optimisim * avalanche * base * gnosis Update contract addresses * Replace mumbai with sepolia (#45) * Added detailed documentation (#52) * Documentation added * Detailed docs and changes to launchpad page * Update admin-ve8020.md --------- Co-authored-by: Pablo F. Mescher <pfmescher@gmail.com> Co-authored-by: esis8 <eesis.dev@gmail.com> Co-authored-by: E Esis <111536784+esis8@users.noreply.github.com> Co-authored-by: Pablo F. Mescher <pablo@protofire.io> Co-authored-by: burns <103551202+burns2854@users.noreply.github.com>
A draft on SOR. While writing it down it became apparent, that we can simplify the interface by eliminating merging findRoute with buildSwap steps. Currently, finding a route and constructing a swap require knowledge of the exact in / out type. However, each of these actions uses a different term for this type.
Still todo: useBpts option, it's not covered on the SDK yet, probably makes sense to just add, because it's low level logic with Vault / Relayer encoding.
Otherwise the pages are now ready for review and I would appreciate your feedback.