Agoric / agoric-sdk

monorepo for the Agoric Javascript smart contract platform
Apache License 2.0
327 stars 206 forks source link

Implement AMM curve for like-asset pairs in Agoric #3203

Closed rowgraus closed 9 months ago

rowgraus commented 3 years ago

Description

Implement a curve for Agoric's Automated Market Maker (AMM) which minimizes slippage, similar to curve.fi's StableSwap in Ethereum.

A completed bounty will include:

Context

Standard X*Y=K automated market maker (AMM) curves are meant for asset pairs which have relative volatility and require price responses (slippage) based on trades.

However, there is a large demand for AMM swaps of like-assets (e.g., USDC-USDT, WBTC-TBTC, ETH-sETH) - particularly stablecoin pairs - for which the slippage driven by X*Y=K curves is not desirable. Curve.Fi's StableSwap implementation on Ethereum has had great success driving high volume of these trades.

Agoric's stable local currency RUN will need to trade against other stablecoins with minimal slippage. This adjusted curve implementation will allow for that.

Acceptance Criteria

Time Estimation

2-3 weeks

Reward

$9,600

Payment will be made in USD (fiat currency) via wire transfer. The developer is responsible for providing their completed tax documents (W9 for US based developers and/or W8 or W8-BEN-E for non-US based developers) and providing their banking details in order to receive payment.

Applicant Assessment Criteria

Important: Please provide a clear workplan for how you will approach this bounty. Use the work plan as an initial demonstration that you would be a good candidate. Bounties will require coordination with the Agoric team, so unfortunately only plans submitted in English will be considered.

Applicants will be assessed based on the following criteria:

References

gitcoinbot commented 3 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 6400.0 USD (6396.8 USD @ $1.0/USD) attached to it as part of the Agoric fund.

gitcoinbot commented 3 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


The funding of 6400.0 USD (6396.8 USD @ $1.0/USD) attached to this issue has been cancelled by the bounty submitter

gitcoinbot commented 3 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 9600.0 USD (9595.2 USD @ $1.0/USD) attached to it as part of the Agoric fund.

gitcoinbot commented 3 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Workers have applied to start work.

These users each claimed they can complete the work by 265 years, 4 months from now. Please review their action plans below:

1) astrovicis has applied to start work _(Funders only: approve worker | reject worker)_.

Learn more on the Gitcoin Issue Details page.

gitcoinbot commented 3 years ago

@branmcf Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

branmcf commented 3 years ago

Beginning work this weekend!

gitcoinbot commented 3 years ago

@branmcf Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

branmcf commented 3 years ago

I met with Chris about a week ago to discuss the initial steps for implementing stableCurve.js and test-stableCurve.js. Since our initial meeting, I've been working on implementing these two files with some additional clarification provided by Chris and dckc.

Targeting to have a WIP PR for stableCurve.js and test-stableCurve.js by EOW. If everything looks good, I'll implement the simulation next weekend then we can discuss the necessary changes to MultipoolAutoSwap early next week!

branmcf commented 3 years ago

Quick update: stableCurve.js is nearly dev complete and I have brought over all test cases from test-bondingCurves.js to test-stableCurve.js.

Next steps are finishing up the first-pass of the stableCurve.js implementation and getting all tests passing!

Note: In order to get the testGetPriceStable test cases to pass I will need to compute the expectedOutput for each case. I think bringing the logic of get_dy_underlying into a spreadsheet will be sufficient, but I'll let you know if additional work (e.g. porting Curve Vyper code to Python) is required for this.

branmcf commented 3 years ago

I came across Saddle Finance today which appears to be a Solidity implementation of StableSwap. They have very thorough documentation so I'm going to take a couple of days to compare my stableCurve.js code with the Saddle implementation and make any necessary changes!

branmcf commented 3 years ago

I had to put down this bounty last week due to work. I'll be resuming work on the bounty tomorrow. Happy Labor Day!

branmcf commented 3 years ago

Work is still in progress.

branmcf commented 3 years ago

Bounty is still in progress. I hope everyone is having fun at Mainnet!

dckc commented 2 years ago

I see some recent collaboration in https://github.com/robor-systems/agoric-amm-curve/pull/5

dckc commented 2 years ago

looks like @Chris-Hibbert and @Hussain-7 are just about in sync: https://github.com/robor-systems/agoric-amm-curve/pull/4

dckc commented 2 years ago

@Chris-Hibbert what's the commit hash of the work that we accepted for this bounty?

Chris-Hibbert commented 2 years ago

59533a5ff27aa4aadeeb8e2f96285d988f6de21c