Skip to content
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

feat(examples): Remove or update out-of-date examples #1759

Merged
merged 3 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Loading