Skip to content

Commit

Permalink
feat(examples): Remove or update out-of-date examples (#1759)
Browse files Browse the repository at this point in the history
  • Loading branch information
dontrolle authored Jan 29, 2024
1 parent 6dfc67f commit fe81bcf
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 210 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Next version

- Upgrade or remove `examples/how-tos` so they match the new version of the Mangrove core protocol and SDK
- Upgrade `examples/tutorials/on-the-fly-offer.js` to new Mangrove core protocol and SDK
- fix: Coerce ticks to tickSpacing when given as arguments
- feat: Add integration test of tickSpacing>1
Expand Down
24 changes: 15 additions & 9 deletions examples/how-tos/fill-or-kill.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,32 @@ const wallet = new ethers.Wallet(process.env.PRIVATE_KEY, provider); // Use eith
// Connect the API to Mangrove
const mgv = await Mangrove.connect({ signer: wallet });

// Connect mgv to a DAI, USDC market
const market = await mgv.market({ base: "DAI", quote: "USDC" });
// Connect mgv to a USDC, USDT market
const market = await mgv.market({
base: "USDC",
quote: "USDT",
tickSpacing: 1,
});

const usdtToken = await mgv.token("USDT");

// await market.quote.contract.mintTo( // minting USDC if you are on testnet
// await market.quote.contract.mintTo( // minting USDT if you are on testnet
// process.env.ADMIN_ADDRESS,
// mgv.toUnits(10000, market.quote.decimals)
// usdtToken.toUnits(100000)
// );

// Check it's live, should display the best asks of the DAI, USDC market
// Check that we're live. Should display the best asks of the USDC, USDT market.
market.consoleAsks();

// approve that the mangroveOrder contract can use your USDC (quote) funds
await mgv.offerLogic(mgv.orderContract.address).approveToken(market.quote.name);
const restingOrderRouterAddress = await mgv.getRestingOrderRouterAddress();

await usdtToken.approve(restingOrderRouterAddress);

let buyPromises = await market.buy({
volume: 2000,
price: 1.3,
limitPrice: 1.3,
fillOrKill: true,
});

const result = await buyPromises.result;

console.log(result);
78 changes: 0 additions & 78 deletions examples/how-tos/reuse-offer.js

This file was deleted.

56 changes: 0 additions & 56 deletions examples/how-tos/snipe-offer.js

This file was deleted.

67 changes: 0 additions & 67 deletions examples/how-tos/update-offer.js

This file was deleted.

0 comments on commit fe81bcf

Please sign in to comment.