forked from paraswap/paraswap-dex-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add generic rfq implementation
Resolves BACK-760.
- Loading branch information
1 parent
d7a6f21
commit 7d3a3cc
Showing
16 changed files
with
1,251 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import express from 'express'; | ||
|
||
const app = express(); | ||
|
||
const markets = { | ||
id: 'WETH-DAI', | ||
base: { | ||
address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', | ||
decimals: 18, | ||
type: 'erc20', | ||
}, | ||
quote: { | ||
address: '0x6B175474E89094C44Da98b954EedeAC495271d0F', | ||
decimals: 18, | ||
type: 'erc20', | ||
}, | ||
status: 'available', | ||
}; | ||
|
||
const prices = { | ||
'WETH-DAI': { | ||
buyAmounts: [ | ||
'1.166200000000000000', | ||
'1.166200000000000000', | ||
'1.166200000000000000', | ||
'1.166200000000000000', | ||
'1.166200000000000000', | ||
'1.169000000000000000', | ||
], | ||
buyPrices: [ | ||
'1333.425240000000000000', | ||
'1333.024812000000000000', | ||
'1332.624384000000000000', | ||
'1332.223956000000000000', | ||
'1331.823528000000000000', | ||
'1331.423100000000000000', | ||
], | ||
sellAmounts: [ | ||
'1.166200000000000000', | ||
'1.166200000000000000', | ||
'1.166200000000000000', | ||
'1.166200000000000000', | ||
'1.166200000000000000', | ||
'1.169000000000000000', | ||
], | ||
sellPrices: [ | ||
'1336.745410000000000000', | ||
'1337.146033000000000000', | ||
'1337.546656000000000000', | ||
'1337.947279000000000000', | ||
'1338.347902000000000000', | ||
'1338.748525000000000000', | ||
], | ||
}, | ||
}; | ||
|
||
app.get('/markets', (req, res) => { | ||
return res.status(200).json(markets); | ||
}); | ||
|
||
app.get('/prices', (req, res) => { | ||
return res.status(200).json(prices); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import dotenv from 'dotenv'; | ||
dotenv.config(); | ||
|
||
import { Network, ContractMethod, SwapSide } from '../../constants'; | ||
import { StaticJsonRpcProvider } from '@ethersproject/providers'; | ||
import { generateConfig } from '../../config'; | ||
import { testE2E } from '../../../tests/utils-e2e'; | ||
import { Tokens, Holders } from '../../../tests/constants-e2e'; | ||
|
||
describe('GenericRFQ E2E Mainnet', () => { | ||
const network = Network.MAINNET; | ||
const tokens = Tokens[network]; | ||
const holders = Holders[network]; | ||
const provider = new StaticJsonRpcProvider( | ||
generateConfig(network).privateHttpProvider, | ||
network, | ||
); | ||
|
||
describe('GenericRFQ', () => { | ||
const dexKey = 'GenericRFQ'; | ||
|
||
describe('Simpleswap', () => { | ||
it('ETH -> TOKEN', async () => { | ||
await testE2E( | ||
tokens.ETH, | ||
tokens.USDC, | ||
holders.ETH, | ||
'7000000000000000000', | ||
SwapSide.SELL, | ||
dexKey, | ||
ContractMethod.simpleSwap, | ||
network, | ||
provider, | ||
); | ||
}); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.