Skip to content

Commit

Permalink
corrects mistake on twaprice index
Browse files Browse the repository at this point in the history
  • Loading branch information
maxcoto committed Jan 4, 2024
1 parent b6b6f2a commit 1459e63
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion contracts/AMM/CurveAMM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ contract CurveAMM {
uint256 quoteFactor = 1e18;
uint256 priceFactor = 10 ** ChainlinkLibrary.getDecimals(oracleBase);

uint256 quote = pool.price_oracle(SWEEP_IDX);
uint256 quote = pool.price_oracle(USDX_IDX);
uint256 price = ChainlinkLibrary.getPrice(oracleBase, sequencer, frequency);

return quote * price * returnFactor / (priceFactor * quoteFactor);
Expand Down
7 changes: 6 additions & 1 deletion test/assets/curve_market_maker.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { tokens, wallets, chainlink, curve, deployments } = require('../../utils/
const { Const, impersonate, toBN, sendEth } = require("../../utils/helper_functions");
let poolAddress;

contract('Curve Market Maker', async () => {
contract.only('Curve Market Maker', async () => {
before(async () => {
[borrower] = await ethers.getSigners();

Expand Down Expand Up @@ -238,4 +238,9 @@ contract('Curve Market Maker', async () => {
expect(usdcBefore).to.be.lessThan(usdcAfter);
});

it('fetches Sweep prices correctly', async () => {
price = await amm.getPrice();
twaPrice = await amm.getTWAPrice();
});

});

0 comments on commit 1459e63

Please sign in to comment.