From 946ad04e5149ca3cb64a815def22787dab47ba13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Espen=20H=C3=B8jsgaard?= Date: Wed, 17 Jan 2024 10:07:16 +0100 Subject: [PATCH] move developer/contracts to developer/protocol (#218) --- docs/developers/README.md | 4 ++-- .../SDK/getting-started/_preparation-post.md | 2 +- docs/developers/SDK/getting-started/basic-offer.md | 2 +- docs/developers/SDK/getting-started/deploy-kandel.md | 2 +- docs/developers/SDK/guides/fill-or-kill.md | 2 +- .../SDK/technical-references/api-overview.md | 2 +- ...the-role-of-gas-price-updater-bots-in-mangrove.md | 2 +- docs/developers/{contracts => protocol}/README.md | 0 .../background/_category_.json | 0 .../background/offer-maker.md | 0 .../background/offer-taker.md | 0 .../background/taker-compensation.md | 0 .../getting-started/_category_.json | 0 .../{contracts => protocol}/guides/_category_.json | 0 .../technical-references/_category_.json | 0 .../technical-references/_contract-addresses-raw.md | 0 .../technical-references/codebase.md | 0 .../context-addresses-version.json | 0 .../technical-references/contract-addresses.md | 0 .../governance-parameters/README.md | 0 .../governance-parameters/global-variables.md | 0 .../governance-parameters/local-variables.md | 0 .../governance-parameters/mangrove-configuration.md | 0 .../technical-references/mangrove-core-version.json | 0 .../mangrove-deployments-version.json | 0 .../technical-references/mangrove-js-version.json | 0 .../mangrove-strats-version.json | 0 .../technical-references/overview.md | 0 .../technical-references/periphery/README.md | 0 .../technical-references/periphery/oracle.md | 0 .../technical-references/periphery/reader.md | 0 .../taking-and-making-offers/README.md | 0 .../taking-and-making-offers/offer-cleaning.md | 0 .../taking-and-making-offers/offer-list.md | 0 .../reactive-offer/README.md | 0 .../reactive-offer/executing-offers.md | 0 .../reactive-offer/gas-requirement.md | 0 .../reactive-offer/maker-contract.md | 0 .../reactive-offer/offer-data-structures.md | 0 .../reactive-offer/offer-provision.md | 0 .../taking-and-making-offers/taker-order/README.md | 0 .../taker-order/delegate-takers.md | 0 .../taking-and-making-offers/views-on-offers.md | 0 .../technical-references/tick-ratio.md | 0 docs/developers/strat-lib/README.md | 2 +- .../background/offer-maker/mangrove-offer.md | 2 +- .../strat-lib/getting-started/smart-offer.md | 4 ++-- docs/developers/strat-lib/guides/DirectHowTo.md | 12 ++++++------ docs/developers/strat-lib/guides/HowToTest.md | 10 +++++----- docs/developers/strat-lib/guides/approvals.md | 4 ++-- docs/developers/strat-lib/guides/howToRenege.md | 8 ++++---- docs/developers/strat-lib/guides/howtoGasreq.md | 2 +- .../strat-lib/technical-references/main-hooks.md | 12 ++++++------ docs/developers/terms/bounty.md | 4 ++-- docs/developers/terms/density.md | 2 +- docs/developers/terms/gasprice.md | 4 ++-- docs/developers/terms/gasreq.md | 2 +- docs/developers/terms/gives.md | 2 +- docs/developers/terms/maker-contract.md | 4 ++-- docs/developers/terms/makerExecute.md | 2 +- docs/developers/terms/makerPosthook.md | 2 +- docs/developers/terms/offer-id.md | 4 ++-- docs/developers/terms/offer-list.md | 2 +- docs/developers/terms/offer-logic.md | 8 ++++---- docs/developers/terms/on-the-fly-offer.md | 6 +++--- docs/developers/terms/price.md | 4 ++-- docs/developers/terms/provision.md | 2 +- docs/developers/terms/ratio.md | 4 ++-- docs/developers/terms/renege.md | 2 +- docs/developers/terms/smart-offer.md | 4 ++-- docs/developers/terms/taker-fee.md | 2 +- docs/developers/terms/tick.md | 2 +- docs/developers/terms/tickSpacing.md | 4 ++-- docs/developers/terms/wants.md | 2 +- docs/general/FAQ/README.md | 10 +++++----- .../concepts/makers-takers-keepers/keepers.md | 2 +- .../concepts/makers-takers-keepers/makers.md | 2 +- .../concepts/makers-takers-keepers/takers.md | 2 +- .../how-does-kandel-work/more-on-failing-offers.md | 6 +++--- package.json | 10 +++++----- scripts/addresses-to-md.js | 2 +- sidebars.js | 6 +++--- 82 files changed, 90 insertions(+), 90 deletions(-) rename docs/developers/{contracts => protocol}/README.md (100%) rename docs/developers/{contracts => protocol}/background/_category_.json (100%) rename docs/developers/{contracts => protocol}/background/offer-maker.md (100%) rename docs/developers/{contracts => protocol}/background/offer-taker.md (100%) rename docs/developers/{contracts => protocol}/background/taker-compensation.md (100%) rename docs/developers/{contracts => protocol}/getting-started/_category_.json (100%) rename docs/developers/{contracts => protocol}/guides/_category_.json (100%) rename docs/developers/{contracts => protocol}/technical-references/_category_.json (100%) rename docs/developers/{contracts => protocol}/technical-references/_contract-addresses-raw.md (100%) rename docs/developers/{contracts => protocol}/technical-references/codebase.md (100%) rename docs/developers/{contracts => protocol}/technical-references/context-addresses-version.json (100%) rename docs/developers/{contracts => protocol}/technical-references/contract-addresses.md (100%) rename docs/developers/{contracts => protocol}/technical-references/governance-parameters/README.md (100%) rename docs/developers/{contracts => protocol}/technical-references/governance-parameters/global-variables.md (100%) rename docs/developers/{contracts => protocol}/technical-references/governance-parameters/local-variables.md (100%) rename docs/developers/{contracts => protocol}/technical-references/governance-parameters/mangrove-configuration.md (100%) rename docs/developers/{contracts => protocol}/technical-references/mangrove-core-version.json (100%) rename docs/developers/{contracts => protocol}/technical-references/mangrove-deployments-version.json (100%) rename docs/developers/{contracts => protocol}/technical-references/mangrove-js-version.json (100%) rename docs/developers/{contracts => protocol}/technical-references/mangrove-strats-version.json (100%) rename docs/developers/{contracts => protocol}/technical-references/overview.md (100%) rename docs/developers/{contracts => protocol}/technical-references/periphery/README.md (100%) rename docs/developers/{contracts => protocol}/technical-references/periphery/oracle.md (100%) rename docs/developers/{contracts => protocol}/technical-references/periphery/reader.md (100%) rename docs/developers/{contracts => protocol}/technical-references/taking-and-making-offers/README.md (100%) rename docs/developers/{contracts => protocol}/technical-references/taking-and-making-offers/offer-cleaning.md (100%) rename docs/developers/{contracts => protocol}/technical-references/taking-and-making-offers/offer-list.md (100%) rename docs/developers/{contracts => protocol}/technical-references/taking-and-making-offers/reactive-offer/README.md (100%) rename docs/developers/{contracts => protocol}/technical-references/taking-and-making-offers/reactive-offer/executing-offers.md (100%) rename docs/developers/{contracts => protocol}/technical-references/taking-and-making-offers/reactive-offer/gas-requirement.md (100%) rename docs/developers/{contracts => protocol}/technical-references/taking-and-making-offers/reactive-offer/maker-contract.md (100%) rename docs/developers/{contracts => protocol}/technical-references/taking-and-making-offers/reactive-offer/offer-data-structures.md (100%) rename docs/developers/{contracts => protocol}/technical-references/taking-and-making-offers/reactive-offer/offer-provision.md (100%) rename docs/developers/{contracts => protocol}/technical-references/taking-and-making-offers/taker-order/README.md (100%) rename docs/developers/{contracts => protocol}/technical-references/taking-and-making-offers/taker-order/delegate-takers.md (100%) rename docs/developers/{contracts => protocol}/technical-references/taking-and-making-offers/views-on-offers.md (100%) rename docs/developers/{contracts => protocol}/technical-references/tick-ratio.md (100%) diff --git a/docs/developers/README.md b/docs/developers/README.md index 7bed7442..71c31e07 100644 --- a/docs/developers/README.md +++ b/docs/developers/README.md @@ -7,11 +7,11 @@ sidebar_position: 1 The Mangrove Developers documentation section exists to help developers: -* learn about Mangrove [core protocol](./contracts/README.md), +* learn about Mangrove [core protocol](./protocol/README.md), * understand how trading [strategies](./strat-lib/README.md) can be created and plugged in, * use and integrate our [SDK](./SDK/README.md), * set up [Keeper bots](./keeper-bots/README.md). -We suggest you start by reading [this introduction](./contracts/README.md). +We suggest you start by reading [this introduction](./protocol/README.md). If there's anything that is missing, or if you have questions, feel free to reach out via [Discord](https://discord.gg/rk9Qthz5YE). diff --git a/docs/developers/SDK/getting-started/_preparation-post.md b/docs/developers/SDK/getting-started/_preparation-post.md index a85f1f1a..5e34a23f 100644 --- a/docs/developers/SDK/getting-started/_preparation-post.md +++ b/docs/developers/SDK/getting-started/_preparation-post.md @@ -16,7 +16,7 @@ export LOCAL_URL=http://127.0.0.1:8545 # Url for the local chain that anvil star ## Local chain -The tutorials can be run directly on networks where Mangrove is deployed (see [Addresses](../../contracts/technical-references/contract-addresses.md)). However on a real network you will spend real tokens, so we recommend starting on test networks with a test account. +The tutorials can be run directly on networks where Mangrove is deployed (see [Addresses](../../protocol/technical-references/contract-addresses.md)). However on a real network you will spend real tokens, so we recommend starting on test networks with a test account. To further speed things up we run tutorials on a local fork of a chain using Foundry's `anvil` tool. diff --git a/docs/developers/SDK/getting-started/basic-offer.md b/docs/developers/SDK/getting-started/basic-offer.md index 6d7f49a0..2776995a 100644 --- a/docs/developers/SDK/getting-started/basic-offer.md +++ b/docs/developers/SDK/getting-started/basic-offer.md @@ -11,7 +11,7 @@ Posting a simple offer is also referred to as an %%on-the-fly offer|on-the-fly-o The tutorial assumes knowledge of JavaScript. Follow [preparation](./preparation.md) to create a new `tutorial` folder. -Make sure to use a chain where Mangrove is live. You can find all live addresses for Mangrove [here](../../contracts/technical-references/contract-addresses.md) +Make sure to use a chain where Mangrove is live. You can find all live addresses for Mangrove [here](../../protocol/technical-references/contract-addresses.md) :::info diff --git a/docs/developers/SDK/getting-started/deploy-kandel.md b/docs/developers/SDK/getting-started/deploy-kandel.md index 50205cc9..7cd7f3ac 100644 --- a/docs/developers/SDK/getting-started/deploy-kandel.md +++ b/docs/developers/SDK/getting-started/deploy-kandel.md @@ -11,7 +11,7 @@ This tutorial covers how to deploy a Kandel strategy from a developer standpoint * The tutorial assumes knowledge of JavaScript * Follow [preparation](./preparation.md) to create a new `tutorial` folder. -* Make sure to use a chain where Mangrove is live - you can find all live addresses for Mangrove [here](../../contracts/technical-references/contract-addresses.md) +* Make sure to use a chain where Mangrove is live - you can find all live addresses for Mangrove [here](../../protocol/technical-references/contract-addresses.md) * For a more simple tutorial to get acquainted with Mangrove, we recommend [Deploy a simple offer](./basic-offer.md) ### Start local node diff --git a/docs/developers/SDK/guides/fill-or-kill.md b/docs/developers/SDK/guides/fill-or-kill.md index 0b9f32f7..1e0f37a5 100644 --- a/docs/developers/SDK/guides/fill-or-kill.md +++ b/docs/developers/SDK/guides/fill-or-kill.md @@ -13,7 +13,7 @@ We assume you know how to connect to Mangrove. We are going to be buying 2000 US ### Approvals -After having connected to Mangrove, we then have to make sure that we have the correct approvals for transferring our USDC tokens. When approving for transfers we have to determine what contract is going to make the actual transfers. If we were to use the normal [`buy`](../technical-references/code/classes/Market#-buy) function for a market, we would be using the Mangrove protocol, to make a standard [market order](../../contracts/technical-references/taking-and-making-offers/taker-order/README.md#market-order). This would mean that we would have to approve Mangrove to make transfers of USDC on our behalf. +After having connected to Mangrove, we then have to make sure that we have the correct approvals for transferring our USDC tokens. When approving for transfers we have to determine what contract is going to make the actual transfers. If we were to use the normal [`buy`](../technical-references/code/classes/Market#-buy) function for a market, we would be using the Mangrove protocol, to make a standard [market order](../../protocol/technical-references/taking-and-making-offers/taker-order/README.md#market-order). This would mean that we would have to approve Mangrove to make transfers of USDC on our behalf. In this case we are not going to be using the Mangrove protocol directly. Instead we are going to be using a different contract, provided by the [Mangrove strat lib](../../strat-lib/README.md) - the [MangroveOrder](../../strat-lib/technical-references/code/strats/src/strategies/MangroveOrder) contract. This contract makes it possible to make a real FoK order and not just a normal market order. This means that we need to approve the MangroveOrder contract to handle all our USDC transfers. One way of doing this, would be to just call approve directly on the USDC token, with the MangroveOrder contract as spender. But because strategies made with the Mangrove strat lib, can be using a more complex way of dealing with transfers, we should not rely on calling approve directly on the token. Instead we will create an %%OfferLogic|offer-logic%% using the MangroveOrder contract. This will provide us with an 'approveToken' function. This function will handle all the necessary approvals in order to use a token with the contract. diff --git a/docs/developers/SDK/technical-references/api-overview.md b/docs/developers/SDK/technical-references/api-overview.md index fc0735bb..3c88299b 100644 --- a/docs/developers/SDK/technical-references/api-overview.md +++ b/docs/developers/SDK/technical-references/api-overview.md @@ -38,7 +38,7 @@ mgv = await Mangrove.connect( { }); ``` -You can test you are indeed connected to the [deployed Mangrove](../../contracts/technical-references/contract-addresses.md) by asking for the current global configuration of Mangrove: +You can test you are indeed connected to the [deployed Mangrove](../../protocol/technical-references/contract-addresses.md) by asking for the current global configuration of Mangrove: `config = await mgv.config()` diff --git a/docs/developers/keeper-bots/background/the-role-of-gas-price-updater-bots-in-mangrove.md b/docs/developers/keeper-bots/background/the-role-of-gas-price-updater-bots-in-mangrove.md index b5c2d926..cf76eb7f 100644 --- a/docs/developers/keeper-bots/background/the-role-of-gas-price-updater-bots-in-mangrove.md +++ b/docs/developers/keeper-bots/background/the-role-of-gas-price-updater-bots-in-mangrove.md @@ -4,7 +4,7 @@ sidebar_position: 2 # The role of gas price updater bots in Mangrove -Mangrove needs the gas price to [determine the remuneration](../../contracts/technical-references/taking-and-making-offers/reactive-offer/offer-provision.md#bounty) of takers for removing a failing offer from a list. On chains where the gas price varies, Mangrove [uses](../../contracts/technical-references/governance-parameters/global-variables) an [oracle](../../contracts/technical-references/periphery/oracle) to get the gas price. +Mangrove needs the gas price to [determine the remuneration](../../protocol/technical-references/taking-and-making-offers/reactive-offer/offer-provision.md#bounty) of takers for removing a failing offer from a list. On chains where the gas price varies, Mangrove [uses](../../protocol/technical-references/governance-parameters/global-variables) an [oracle](../../protocol/technical-references/periphery/oracle) to get the gas price. The role of the gas price updater bot is simply to push up-to-date gas prices to the oracle contract whenever the gas price changes significantly. diff --git a/docs/developers/contracts/README.md b/docs/developers/protocol/README.md similarity index 100% rename from docs/developers/contracts/README.md rename to docs/developers/protocol/README.md diff --git a/docs/developers/contracts/background/_category_.json b/docs/developers/protocol/background/_category_.json similarity index 100% rename from docs/developers/contracts/background/_category_.json rename to docs/developers/protocol/background/_category_.json diff --git a/docs/developers/contracts/background/offer-maker.md b/docs/developers/protocol/background/offer-maker.md similarity index 100% rename from docs/developers/contracts/background/offer-maker.md rename to docs/developers/protocol/background/offer-maker.md diff --git a/docs/developers/contracts/background/offer-taker.md b/docs/developers/protocol/background/offer-taker.md similarity index 100% rename from docs/developers/contracts/background/offer-taker.md rename to docs/developers/protocol/background/offer-taker.md diff --git a/docs/developers/contracts/background/taker-compensation.md b/docs/developers/protocol/background/taker-compensation.md similarity index 100% rename from docs/developers/contracts/background/taker-compensation.md rename to docs/developers/protocol/background/taker-compensation.md diff --git a/docs/developers/contracts/getting-started/_category_.json b/docs/developers/protocol/getting-started/_category_.json similarity index 100% rename from docs/developers/contracts/getting-started/_category_.json rename to docs/developers/protocol/getting-started/_category_.json diff --git a/docs/developers/contracts/guides/_category_.json b/docs/developers/protocol/guides/_category_.json similarity index 100% rename from docs/developers/contracts/guides/_category_.json rename to docs/developers/protocol/guides/_category_.json diff --git a/docs/developers/contracts/technical-references/_category_.json b/docs/developers/protocol/technical-references/_category_.json similarity index 100% rename from docs/developers/contracts/technical-references/_category_.json rename to docs/developers/protocol/technical-references/_category_.json diff --git a/docs/developers/contracts/technical-references/_contract-addresses-raw.md b/docs/developers/protocol/technical-references/_contract-addresses-raw.md similarity index 100% rename from docs/developers/contracts/technical-references/_contract-addresses-raw.md rename to docs/developers/protocol/technical-references/_contract-addresses-raw.md diff --git a/docs/developers/contracts/technical-references/codebase.md b/docs/developers/protocol/technical-references/codebase.md similarity index 100% rename from docs/developers/contracts/technical-references/codebase.md rename to docs/developers/protocol/technical-references/codebase.md diff --git a/docs/developers/contracts/technical-references/context-addresses-version.json b/docs/developers/protocol/technical-references/context-addresses-version.json similarity index 100% rename from docs/developers/contracts/technical-references/context-addresses-version.json rename to docs/developers/protocol/technical-references/context-addresses-version.json diff --git a/docs/developers/contracts/technical-references/contract-addresses.md b/docs/developers/protocol/technical-references/contract-addresses.md similarity index 100% rename from docs/developers/contracts/technical-references/contract-addresses.md rename to docs/developers/protocol/technical-references/contract-addresses.md diff --git a/docs/developers/contracts/technical-references/governance-parameters/README.md b/docs/developers/protocol/technical-references/governance-parameters/README.md similarity index 100% rename from docs/developers/contracts/technical-references/governance-parameters/README.md rename to docs/developers/protocol/technical-references/governance-parameters/README.md diff --git a/docs/developers/contracts/technical-references/governance-parameters/global-variables.md b/docs/developers/protocol/technical-references/governance-parameters/global-variables.md similarity index 100% rename from docs/developers/contracts/technical-references/governance-parameters/global-variables.md rename to docs/developers/protocol/technical-references/governance-parameters/global-variables.md diff --git a/docs/developers/contracts/technical-references/governance-parameters/local-variables.md b/docs/developers/protocol/technical-references/governance-parameters/local-variables.md similarity index 100% rename from docs/developers/contracts/technical-references/governance-parameters/local-variables.md rename to docs/developers/protocol/technical-references/governance-parameters/local-variables.md diff --git a/docs/developers/contracts/technical-references/governance-parameters/mangrove-configuration.md b/docs/developers/protocol/technical-references/governance-parameters/mangrove-configuration.md similarity index 100% rename from docs/developers/contracts/technical-references/governance-parameters/mangrove-configuration.md rename to docs/developers/protocol/technical-references/governance-parameters/mangrove-configuration.md diff --git a/docs/developers/contracts/technical-references/mangrove-core-version.json b/docs/developers/protocol/technical-references/mangrove-core-version.json similarity index 100% rename from docs/developers/contracts/technical-references/mangrove-core-version.json rename to docs/developers/protocol/technical-references/mangrove-core-version.json diff --git a/docs/developers/contracts/technical-references/mangrove-deployments-version.json b/docs/developers/protocol/technical-references/mangrove-deployments-version.json similarity index 100% rename from docs/developers/contracts/technical-references/mangrove-deployments-version.json rename to docs/developers/protocol/technical-references/mangrove-deployments-version.json diff --git a/docs/developers/contracts/technical-references/mangrove-js-version.json b/docs/developers/protocol/technical-references/mangrove-js-version.json similarity index 100% rename from docs/developers/contracts/technical-references/mangrove-js-version.json rename to docs/developers/protocol/technical-references/mangrove-js-version.json diff --git a/docs/developers/contracts/technical-references/mangrove-strats-version.json b/docs/developers/protocol/technical-references/mangrove-strats-version.json similarity index 100% rename from docs/developers/contracts/technical-references/mangrove-strats-version.json rename to docs/developers/protocol/technical-references/mangrove-strats-version.json diff --git a/docs/developers/contracts/technical-references/overview.md b/docs/developers/protocol/technical-references/overview.md similarity index 100% rename from docs/developers/contracts/technical-references/overview.md rename to docs/developers/protocol/technical-references/overview.md diff --git a/docs/developers/contracts/technical-references/periphery/README.md b/docs/developers/protocol/technical-references/periphery/README.md similarity index 100% rename from docs/developers/contracts/technical-references/periphery/README.md rename to docs/developers/protocol/technical-references/periphery/README.md diff --git a/docs/developers/contracts/technical-references/periphery/oracle.md b/docs/developers/protocol/technical-references/periphery/oracle.md similarity index 100% rename from docs/developers/contracts/technical-references/periphery/oracle.md rename to docs/developers/protocol/technical-references/periphery/oracle.md diff --git a/docs/developers/contracts/technical-references/periphery/reader.md b/docs/developers/protocol/technical-references/periphery/reader.md similarity index 100% rename from docs/developers/contracts/technical-references/periphery/reader.md rename to docs/developers/protocol/technical-references/periphery/reader.md diff --git a/docs/developers/contracts/technical-references/taking-and-making-offers/README.md b/docs/developers/protocol/technical-references/taking-and-making-offers/README.md similarity index 100% rename from docs/developers/contracts/technical-references/taking-and-making-offers/README.md rename to docs/developers/protocol/technical-references/taking-and-making-offers/README.md diff --git a/docs/developers/contracts/technical-references/taking-and-making-offers/offer-cleaning.md b/docs/developers/protocol/technical-references/taking-and-making-offers/offer-cleaning.md similarity index 100% rename from docs/developers/contracts/technical-references/taking-and-making-offers/offer-cleaning.md rename to docs/developers/protocol/technical-references/taking-and-making-offers/offer-cleaning.md diff --git a/docs/developers/contracts/technical-references/taking-and-making-offers/offer-list.md b/docs/developers/protocol/technical-references/taking-and-making-offers/offer-list.md similarity index 100% rename from docs/developers/contracts/technical-references/taking-and-making-offers/offer-list.md rename to docs/developers/protocol/technical-references/taking-and-making-offers/offer-list.md diff --git a/docs/developers/contracts/technical-references/taking-and-making-offers/reactive-offer/README.md b/docs/developers/protocol/technical-references/taking-and-making-offers/reactive-offer/README.md similarity index 100% rename from docs/developers/contracts/technical-references/taking-and-making-offers/reactive-offer/README.md rename to docs/developers/protocol/technical-references/taking-and-making-offers/reactive-offer/README.md diff --git a/docs/developers/contracts/technical-references/taking-and-making-offers/reactive-offer/executing-offers.md b/docs/developers/protocol/technical-references/taking-and-making-offers/reactive-offer/executing-offers.md similarity index 100% rename from docs/developers/contracts/technical-references/taking-and-making-offers/reactive-offer/executing-offers.md rename to docs/developers/protocol/technical-references/taking-and-making-offers/reactive-offer/executing-offers.md diff --git a/docs/developers/contracts/technical-references/taking-and-making-offers/reactive-offer/gas-requirement.md b/docs/developers/protocol/technical-references/taking-and-making-offers/reactive-offer/gas-requirement.md similarity index 100% rename from docs/developers/contracts/technical-references/taking-and-making-offers/reactive-offer/gas-requirement.md rename to docs/developers/protocol/technical-references/taking-and-making-offers/reactive-offer/gas-requirement.md diff --git a/docs/developers/contracts/technical-references/taking-and-making-offers/reactive-offer/maker-contract.md b/docs/developers/protocol/technical-references/taking-and-making-offers/reactive-offer/maker-contract.md similarity index 100% rename from docs/developers/contracts/technical-references/taking-and-making-offers/reactive-offer/maker-contract.md rename to docs/developers/protocol/technical-references/taking-and-making-offers/reactive-offer/maker-contract.md diff --git a/docs/developers/contracts/technical-references/taking-and-making-offers/reactive-offer/offer-data-structures.md b/docs/developers/protocol/technical-references/taking-and-making-offers/reactive-offer/offer-data-structures.md similarity index 100% rename from docs/developers/contracts/technical-references/taking-and-making-offers/reactive-offer/offer-data-structures.md rename to docs/developers/protocol/technical-references/taking-and-making-offers/reactive-offer/offer-data-structures.md diff --git a/docs/developers/contracts/technical-references/taking-and-making-offers/reactive-offer/offer-provision.md b/docs/developers/protocol/technical-references/taking-and-making-offers/reactive-offer/offer-provision.md similarity index 100% rename from docs/developers/contracts/technical-references/taking-and-making-offers/reactive-offer/offer-provision.md rename to docs/developers/protocol/technical-references/taking-and-making-offers/reactive-offer/offer-provision.md diff --git a/docs/developers/contracts/technical-references/taking-and-making-offers/taker-order/README.md b/docs/developers/protocol/technical-references/taking-and-making-offers/taker-order/README.md similarity index 100% rename from docs/developers/contracts/technical-references/taking-and-making-offers/taker-order/README.md rename to docs/developers/protocol/technical-references/taking-and-making-offers/taker-order/README.md diff --git a/docs/developers/contracts/technical-references/taking-and-making-offers/taker-order/delegate-takers.md b/docs/developers/protocol/technical-references/taking-and-making-offers/taker-order/delegate-takers.md similarity index 100% rename from docs/developers/contracts/technical-references/taking-and-making-offers/taker-order/delegate-takers.md rename to docs/developers/protocol/technical-references/taking-and-making-offers/taker-order/delegate-takers.md diff --git a/docs/developers/contracts/technical-references/taking-and-making-offers/views-on-offers.md b/docs/developers/protocol/technical-references/taking-and-making-offers/views-on-offers.md similarity index 100% rename from docs/developers/contracts/technical-references/taking-and-making-offers/views-on-offers.md rename to docs/developers/protocol/technical-references/taking-and-making-offers/views-on-offers.md diff --git a/docs/developers/contracts/technical-references/tick-ratio.md b/docs/developers/protocol/technical-references/tick-ratio.md similarity index 100% rename from docs/developers/contracts/technical-references/tick-ratio.md rename to docs/developers/protocol/technical-references/tick-ratio.md diff --git a/docs/developers/strat-lib/README.md b/docs/developers/strat-lib/README.md index 231d6111..0dece6a5 100644 --- a/docs/developers/strat-lib/README.md +++ b/docs/developers/strat-lib/README.md @@ -24,7 +24,7 @@ If you have questions about how to use the Strat library, which are not answered ### Choosing the right starting point -Depending on the complexity of the %%offer logic|offer-logic%% your contract implements, you need to choose from which building block you will start to build your %%maker contract|maker-contract%% from. At the very least your logic must provide an implementation of the [`IMaker`](https://github.com/mangrovedao/mangrove-core/blob/2ae172805fd8b309c30b2dc877dba66245abbb3e/src/core/MgvLib.sol#L420-L430) interface [required by Mangrove](../contracts/technical-references/taking-and-making-offers/reactive-offer/maker-contract.md). +Depending on the complexity of the %%offer logic|offer-logic%% your contract implements, you need to choose from which building block you will start to build your %%maker contract|maker-contract%% from. At the very least your logic must provide an implementation of the [`IMaker`](https://github.com/mangrovedao/mangrove-core/blob/2ae172805fd8b309c30b2dc877dba66245abbb3e/src/core/MgvLib.sol#L420-L430) interface [required by Mangrove](../protocol/technical-references/taking-and-making-offers/reactive-offer/maker-contract.md). However, we suggest utilizing the building blocks in the strat lib. The first design choice is to decide whether owning offers posted by your contract is the sole privilege of the contract's admin or whether your contract's logic wishes to support multiple offer owners, in a permissionless fashion. In the first case, you want your contract to inherit [Direct](./background/offer-maker/direct.md), in the latter you want to start from a [Forwarder](./background/offer-maker/forwarder.md) contract which has a pre-established code infrastructure to handle multiple ownership. diff --git a/docs/developers/strat-lib/background/offer-maker/mangrove-offer.md b/docs/developers/strat-lib/background/offer-maker/mangrove-offer.md index d795afea..e18f5bc3 100644 --- a/docs/developers/strat-lib/background/offer-maker/mangrove-offer.md +++ b/docs/developers/strat-lib/background/offer-maker/mangrove-offer.md @@ -20,7 +20,7 @@ When an offer is taken, Mangrove transfers the funds from the taker to Mangrove ### Pre trade hooks -* [Lastlook](../../technical-references/main-hooks.md#last-look-before-trade) is meant for having a lastlook before the funds are transferred to the taker. It then returns a value that `makerPosthook` can use, to get information of how e.g. the markets looked, when `makerExecute` was executed. This can be useful since, `makerPosthook` may be called several orders later. See [Executing offers](../../../contracts/technical-references/taking-and-making-offers/reactive-offer/executing-offers.md) for more information. +* [Lastlook](../../technical-references/main-hooks.md#last-look-before-trade) is meant for having a lastlook before the funds are transferred to the taker. It then returns a value that `makerPosthook` can use, to get information of how e.g. the markets looked, when `makerExecute` was executed. This can be useful since, `makerPosthook` may be called several orders later. See [Executing offers](../../../protocol/technical-references/taking-and-making-offers/reactive-offer/executing-offers.md) for more information. * [Put](../../technical-references/main-hooks.md#managing-takers-payment) is meant as an option for the maker to transfer the given funds from the contract to e.g. the reserve. This could be useful if you don't want to leave the funds on the contract. diff --git a/docs/developers/strat-lib/getting-started/smart-offer.md b/docs/developers/strat-lib/getting-started/smart-offer.md index 6c507e7f..8d537973 100644 --- a/docs/developers/strat-lib/getting-started/smart-offer.md +++ b/docs/developers/strat-lib/getting-started/smart-offer.md @@ -100,7 +100,7 @@ Start another terminal and import environment variables again source .env ``` -Now, create the `OfferMakerTutorial` contract on the `anvil` node with your private key by pointing to its local `rpc-url`, and supplying the parameters for Mangrove core contract (get it from [Addresses](../../contracts/technical-references/contract-addresses.md) for the network you have forked). +Now, create the `OfferMakerTutorial` contract on the `anvil` node with your private key by pointing to its local `rpc-url`, and supplying the parameters for Mangrove core contract (get it from [Addresses](../../protocol/technical-references/contract-addresses.md) for the network you have forked). You can also add it to your `.env` file. ```bash @@ -154,7 +154,7 @@ Now that the contract is ready, we can use it to post an offer - note that we ha In our example, we are offering 1 WBTC (gives) at tick 50 (tick 50 means the price ratio is `1.0001^50`). :::info Note -Later, if you'd like to take your own offer with a [market order](../../contracts/technical-references/taking-and-making-offers/taker-order/README.md#market-order) for testing purpose, it would be handy to have your offer at the very top of the book (i.e. with the best price possible). To do this, you could post your offer with the smallest tick (`-887272`), or use the [`MIN_TICK`](https://github.com/mangrovedao/mangrove-core/blob/2ae172805fd8b309c30b2dc877dba66245abbb3e/lib/core/Constants.sol#L52) constant in your test contract. +Later, if you'd like to take your own offer with a [market order](../../protocol/technical-references/taking-and-making-offers/taker-order/README.md#market-order) for testing purpose, it would be handy to have your offer at the very top of the book (i.e. with the best price possible). To do this, you could post your offer with the smallest tick (`-887272`), or use the [`MIN_TICK`](https://github.com/mangrovedao/mangrove-core/blob/2ae172805fd8b309c30b2dc877dba66245abbb3e/lib/core/Constants.sol#L52) constant in your test contract. ::: ```bash diff --git a/docs/developers/strat-lib/guides/DirectHowTo.md b/docs/developers/strat-lib/guides/DirectHowTo.md index 62786dca..91dc5144 100644 --- a/docs/developers/strat-lib/guides/DirectHowTo.md +++ b/docs/developers/strat-lib/guides/DirectHowTo.md @@ -50,7 +50,7 @@ We use 30K for default %%`gasreq`|gasreq%% of our strat. This does not leave roo With this constructor in place we almost have a deployable maker contract. `Direct` already provides the implementation of a default %%offer logic|offer-logic%% as well as internal functions to post, update and retract offers posted by our contract. -However, `Direct` does not expose any function able to [create new offers](../../contracts/technical-references/taking-and-making-offers/reactive-offer/README.md#posting-a-new-offer) on Mangrove, since the [`_newOffer`](../technical-references/code/strats/src/strategies/offer_maker/abstract/Direct.md) function of Direct is internal. The requirement in our constructor to implement `ILiquidityProvider` imposes on us to have a public `newOffer` function. Using `ILiquidityProvider` ensures our contract is compatible with the [Mangrove SDK](../../SDK/README.md), which expects the `ILiquidityProvider` ABI. +However, `Direct` does not expose any function able to [create new offers](../../protocol/technical-references/taking-and-making-offers/reactive-offer/README.md#posting-a-new-offer) on Mangrove, since the [`_newOffer`](../technical-references/code/strats/src/strategies/offer_maker/abstract/Direct.md) function of Direct is internal. The requirement in our constructor to implement `ILiquidityProvider` imposes on us to have a public `newOffer` function. Using `ILiquidityProvider` ensures our contract is compatible with the [Mangrove SDK](../../SDK/README.md), which expects the `ILiquidityProvider` ABI. Our implementation of `newOffer` is simply to expose the internal `_newOffer` provided by Direct making sure the function is admin restricted (`Direct` provides the appropriate modifier `onlyAdmin`): @@ -81,7 +81,7 @@ Of course, if we offer `N` tokens *both* on the (`BASE`, `STABLE1`) and the (`BA We have a design choice here. Either we 1. let the second offer fail and compensate the taker with our offer's %%bounty|bounty%%, or, -2. incorporate in our offer logic that we wish to [retract](../../contracts/technical-references/taking-and-making-offers/reactive-offer/README.md#retracting-an-offer) the second offer when the first one is taken. +2. incorporate in our offer logic that we wish to [retract](../../protocol/technical-references/taking-and-making-offers/reactive-offer/README.md#retracting-an-offer) the second offer when the first one is taken. Let's follow the second design principle as it allows us to illustrate how to use the %%hooks|hook%% provided by `Direct` to update offer prices or to retract offers. @@ -103,7 +103,7 @@ As in the example above, we need to create a way for the maker contract to post We already know some of the parameters we need to implement posting new offers, since we gave them in the constructor: We know the %%inbound|inbound%% and the %%outbound|outbound%% tokens of both offers. Also, we do not want the %%offer owner|offer-owner%% to have to specify new offer's %%`gasprice`|gasprice%% and %%`gasreq`|gasreq%% so we just use default values. -If we specify a `gasprice` of zero when posting the offer, Mangrove will use [its own gas price](../../contracts/technical-references/governance-parameters/global-variables.md#gas-price-and-oracle). For `gasreq`, we can use the public getter `offerGasreq()`, which returns the default gas requirement for the contract plus the gas required for the %%router|router%%. +If we specify a `gasprice` of zero when posting the offer, Mangrove will use [its own gas price](../../protocol/technical-references/governance-parameters/global-variables.md#gas-price-and-oracle). For `gasreq`, we can use the public getter `offerGasreq()`, which returns the default gas requirement for the contract plus the gas required for the %%router|router%%. This leaves us having to provide the amount that the offer should %%`give`|gives%% in `BASE` token, and the amount of `STABLE1` and `STABLE2`, which the offer %%wants|wants%% - `wants1` and `wants2`. We also need to specify the TODO:%pivot ids|pivot-id% for insertion of the two offers (`pivot1` and `pivot2`) in the relevant %%offer lists|offer-list%%. As for `OfferMaker`, we only want the admin of the contract to able to post offers, so we use the modifier `onlyAdmin` again. @@ -111,11 +111,11 @@ This leaves us having to provide the amount that the offer should %%`give`|gives https://github.com/mangrovedao/mangrove-strats/blob/a265abeb96a053e386d346c7c9e431878382749c/src/toy_strategies/offer_maker/Amplifier.sol#L60-L115 ``` -In the implementation of `newAmplifiedOffers` notice the calls to the offer data getter `MGV.offers(address, address, uint)`: This returns a packed data structure `offer` whose fields `f` can be unpacked by doing `offer.f()` (see the documentation for the [offer data structure](../../contracts/technical-references/taking-and-making-offers/views-on-offers.md#views-on-offers)). +In the implementation of `newAmplifiedOffers` notice the calls to the offer data getter `MGV.offers(address, address, uint)`: This returns a packed data structure `offer` whose fields `f` can be unpacked by doing `offer.f()` (see the documentation for the [offer data structure](../../protocol/technical-references/taking-and-making-offers/views-on-offers.md#views-on-offers)). :::info possible gas optimization -If both our amplified offers were once live on Mangrove, but are no longer (either after a retract or because one of them was consumed by a taker), it is more gas efficient to [update the offers](../../contracts/technical-references/taking-and-making-offers/reactive-offer/README.md#updating-an-existing-offer) to reinstate them on the %%offer list|offer-list%%, rather than creating new ones as we do in the above code. +If both our amplified offers were once live on Mangrove, but are no longer (either after a retract or because one of them was consumed by a taker), it is more gas efficient to [update the offers](../../protocol/technical-references/taking-and-making-offers/reactive-offer/README.md#updating-an-existing-offer) to reinstate them on the %%offer list|offer-list%%, rather than creating new ones as we do in the above code. ::: @@ -153,7 +153,7 @@ During the execution of the %%offer logic|offer-logic%% it may occur that the ta * the offer was completely filled * the offer is %%partially filled|maker-partial-fill%% but its residual is below the offer list's %%density|density%% -* the offer no longer has enough %%provision|provision%%. This last case may occur if one is reposting an offer that has failed (because a part of the %%provision|provision%% was turned into a %%bounty|bounty%%), or because Mangrove's %%gasprice|gasprice%% is now above the offer's gasprice. (This may happen, if Mangrove updated its [own gasprice](../../contracts/technical-references/governance-parameters/global-variables.md#gas-price-and-oracle) after the offer was last posted.) +* the offer no longer has enough %%provision|provision%%. This last case may occur if one is reposting an offer that has failed (because a part of the %%provision|provision%% was turned into a %%bounty|bounty%%), or because Mangrove's %%gasprice|gasprice%% is now above the offer's gasprice. (This may happen, if Mangrove updated its [own gasprice](../../protocol/technical-references/governance-parameters/global-variables.md#gas-price-and-oracle) after the offer was last posted.) In all of these cases we wish to retract the other offer from the book. diff --git a/docs/developers/strat-lib/guides/HowToTest.md b/docs/developers/strat-lib/guides/HowToTest.md index cf6e9dde..a9b71015 100644 --- a/docs/developers/strat-lib/guides/HowToTest.md +++ b/docs/developers/strat-lib/guides/HowToTest.md @@ -20,7 +20,7 @@ The first thing to do is to import the relevant contracts. As mentioned, we are The Mangrove test library provides other helpers. We import `Polygon` - a helper to fork the polygon chain. We do this because we want to use the real addresses for WETH, USDC and DAI. (This is not strictly necessary - we could just create some test tokens and use those instead.) -We also import the `Amplifier` contract - the contract that we wish to test. The last thing we import is `MgvStructs`, which contain struct definitions for the [offer views](../../contracts/technical-references/taking-and-making-offers/views-on-offers.md), which we shall need in the test. +We also import the `Amplifier` contract - the contract that we wish to test. The last thing we import is `MgvStructs`, which contain struct definitions for the [offer views](../../protocol/technical-references/taking-and-making-offers/views-on-offers.md), which we shall need in the test. The console import is not strictly needed - however, it can be very useful, if we want to log something to the console while we are developing the test. Let us import it for now. @@ -56,7 +56,7 @@ https://github.com/mangrovedao/mangrove-strats/blob/a265abeb96a053e386d346c7c9e4 With `setUp` done, let us write the first test. -We start by testing that we can take the offer fully without any rejections, and that after [trade execution](../../contracts/technical-references/taking-and-making-offers/reactive-offer/maker-contract.md#trade-execution) both offers are retracted (recall that was how we [decided to implement](DirectHowTo.md#advanced-direct-offer-liquidity-amplification-with-amplifier) `Amplifier`). Let us call the test `test_success_fill` - in line with the naming guidelines of the [Foundry test framework](https://book.getfoundry.sh/forge/tests). +We start by testing that we can take the offer fully without any rejections, and that after [trade execution](../../protocol/technical-references/taking-and-making-offers/reactive-offer/maker-contract.md#trade-execution) both offers are retracted (recall that was how we [decided to implement](DirectHowTo.md#advanced-direct-offer-liquidity-amplification-with-amplifier) `Amplifier`). Let us call the test `test_success_fill` - in line with the naming guidelines of the [Foundry test framework](https://book.getfoundry.sh/forge/tests). Breaking the problem down, for this test, we need to @@ -92,7 +92,7 @@ Let us unfold the specification for the test itself. For this first test, we want to * post and fund a pair of offers using [`Amplifier.newAmplifiedOffers(...)`](./DirectHowTo.md#publishing-amplified-liquidity), -* [snipe](../../contracts/technical-references/taking-and-making-offers/taker-order/README.md#offer-sniping) *one* of the offers, and, +* [snipe](../../protocol/technical-references/taking-and-making-offers/taker-order/README.md#offer-sniping) *one* of the offers, and, * verify these properties * both maker and taker received tokens as expected * after trade execution *both* offers are retracted @@ -111,7 +111,7 @@ https://github.com/mangrovedao/mangrove-strats/blob/a265abeb96a053e386d346c7c9e4 #### Taking a Single Offer -Mangrove provides [snipe](../../contracts/technical-references/taking-and-making-offers/taker-order/README.md#offer-sniping) exactly for taking a *specific* offer. +Mangrove provides [snipe](../../protocol/technical-references/taking-and-making-offers/taker-order/README.md#offer-sniping) exactly for taking a *specific* offer. We make sure to impersonate the taker that we setup an address for [above](#test-contract-and-setup). (Recall that Foundry provides [`vm.prank()`](https://book.getfoundry.sh/cheatcodes/prank) for this exact purpose.) @@ -139,7 +139,7 @@ In verifying, we use a few helper functions provided by `MangroveTest` * `cash(token, amount)` - that helps us ensure that we use the correct decimals for a specific token, * `minusFee(address_outbound, address_inbound, price)` - that calculates the fee for a given market and price, -and a few view functions provided by Mangrove, `offers()` and `isLive()` (see [Views on Offers](../../contracts/technical-references/taking-and-making-offers/views-on-offers.md)). +and a few view functions provided by Mangrove, `offers()` and `isLive()` (see [Views on Offers](../../protocol/technical-references/taking-and-making-offers/views-on-offers.md)). ## Running Tests with Foundry diff --git a/docs/developers/strat-lib/guides/approvals.md b/docs/developers/strat-lib/guides/approvals.md index 7f3b7c59..65cadc99 100644 --- a/docs/developers/strat-lib/guides/approvals.md +++ b/docs/developers/strat-lib/guides/approvals.md @@ -10,9 +10,9 @@ During trade settlement, Mangrove needs certain approvals for transferring funds ### Call sequence overview -In the following, we shall refer to the diagram depicting an [overview of the call sequence](../../contracts/technical-references/overview.md#call-sequence-overview) for a successful trade when a maker [offer is taken](../../contracts/technical-references/taking-and-making-offers/taker-order/README.md) with a market order. For easy reference, the diagram is included below. +In the following, we shall refer to the diagram depicting an [overview of the call sequence](../../protocol/technical-references/overview.md#call-sequence-overview) for a successful trade when a maker [offer is taken](../../protocol/technical-references/taking-and-making-offers/taker-order/README.md) with a market order. For easy reference, the diagram is included below. -Refer to [Contracts -> Technical Reference -> Overview](../../contracts/technical-references/overview.md) and the pages linked there for more details on trade execution on Mangrove. +Refer to [Protocol -> Technical Reference -> Overview](../../protocol/technical-references/overview.md) and the pages linked there for more details on trade execution on Mangrove. import useBaseUrl from '@docusaurus/useBaseUrl'; diff --git a/docs/developers/strat-lib/guides/howToRenege.md b/docs/developers/strat-lib/guides/howToRenege.md index 3121bc31..2169fd52 100644 --- a/docs/developers/strat-lib/guides/howToRenege.md +++ b/docs/developers/strat-lib/guides/howToRenege.md @@ -8,7 +8,7 @@ sidebar_position: 3 ## Example -A maker can %%renege|renege%% on a trade if the market conditions are no longer favorable. This can be done in [multiple ways](../../contracts/technical-references/taking-and-making-offers/reactive-offer/maker-contract.md), but the strat lib has made it easy by adding a [`__lastLook__`](../technical-references/code/strats/src/strategies/MangroveOffer.md#lastlook) function which can be overridden. +A maker can %%renege|renege%% on a trade if the market conditions are no longer favorable. This can be done in [multiple ways](../../protocol/technical-references/taking-and-making-offers/reactive-offer/maker-contract.md), but the strat lib has made it easy by adding a [`__lastLook__`](../technical-references/code/strats/src/strategies/MangroveOffer.md#lastlook) function which can be overridden. You can follow the [smart offer tutorial](../getting-started/smart-offer.md), and extend it with the following function: @@ -16,16 +16,16 @@ You can follow the [smart offer tutorial](../getting-started/smart-offer.md), an https://github.com/mangrovedao/mangrove-strats/blob/a265abeb96a053e386d346c7c9e431878382749c/src/toy_strategies/offer_maker/tutorial/OfferMakerTutorialResidual.sol#L77-L80 ``` -This override of the `__lastLook__` will renege if the offer is not fully taken. Note that since the %%provision|provision%% is lost as a %%bounty|bounty%% to the taker, care must be taken to select the right circumstances to renege. This uses the mechanisms for compensating the taker on failure, and therefore the maker should [renege early](../../contracts/background/taker-compensation.md#encouraging-early-renege). +This override of the `__lastLook__` will renege if the offer is not fully taken. Note that since the %%provision|provision%% is lost as a %%bounty|bounty%% to the taker, care must be taken to select the right circumstances to renege. This uses the mechanisms for compensating the taker on failure, and therefore the maker should [renege early](../../protocol/background/taker-compensation.md#encouraging-early-renege). ## Exercises 1. Try posting an offer with a %%maker contract|maker-contract%% with the above implementation of `__lastlook__` above. -2. Then, try out targeting this offer with a [market order](../../contracts/technical-references/taking-and-making-offers/taker-order/README.md#market-order) that takes only _part_ of the tokens that the offer %%gives|gives%%. The result should be a `makerExecute` fail with the reason that the offer must be fully taken. +2. Then, try out targeting this offer with a [market order](../../protocol/technical-references/taking-and-making-offers/taker-order/README.md#market-order) that takes only _part_ of the tokens that the offer %%gives|gives%%. The result should be a `makerExecute` fail with the reason that the offer must be fully taken. :::info Note -For your offer to be targeted by a market order, it needs to sit at the top of the order book. Make sure to choose a very favorable price (i.e. tick) when posting your offer. For an example of how to calculate a tick from a ratio, check the Solidity snippets of [Posting a new offer](../../contracts/technical-references/taking-and-making-offers/reactive-offer/README.md). +For your offer to be targeted by a market order, it needs to sit at the top of the order book. Make sure to choose a very favorable price (i.e. tick) when posting your offer. For an example of how to calculate a tick from a ratio, check the Solidity snippets of [Posting a new offer](../../protocol/technical-references/taking-and-making-offers/reactive-offer/README.md). ::: In a [Foundry](https://book.getfoundry.sh/getting-started/installation) trace, it would look like this: diff --git a/docs/developers/strat-lib/guides/howtoGasreq.md b/docs/developers/strat-lib/guides/howtoGasreq.md index ab31a154..aa8be0b4 100644 --- a/docs/developers/strat-lib/guides/howtoGasreq.md +++ b/docs/developers/strat-lib/guides/howtoGasreq.md @@ -13,7 +13,7 @@ To determine the `gasreq`, you need to measure the **worst case gas usage **when As a strat builder, you should **verify your gas usage** in some specific scenarios, and **compare deltas to other scenarios** tested [here](https://github.com/mangrovedao/mangrove-core/blob/2ae172805fd8b309c30b2dc877dba66245abbb3e/test/core/gas/README.md#scenarios). You should then use the results to set a `gasreq` for your strat which covers the desired worst-case scenarios. The gas measurements are for the inner-most operation. -The gasreq should be taken into account when [provisioning](../../contracts/technical-references/taking-and-making-offers/reactive-offer/offer-provision.md). +The gasreq should be taken into account when [provisioning](../../protocol/technical-references/taking-and-making-offers/reactive-offer/offer-provision.md). ## Exisiting strategies diff --git a/docs/developers/strat-lib/technical-references/main-hooks.md b/docs/developers/strat-lib/technical-references/main-hooks.md index 3716ecad..ab902e2a 100644 --- a/docs/developers/strat-lib/technical-references/main-hooks.md +++ b/docs/developers/strat-lib/technical-references/main-hooks.md @@ -12,7 +12,7 @@ sidebar_position: 1 https://github.com/mangrovedao/mangrove-strats/blob/a265abeb96a053e386d346c7c9e431878382749c/src/strategies/MangroveOffer.sol#L201-L209 ``` -* **Input**: [taker `order`](../../contracts/technical-references/taking-and-making-offers/reactive-offer/offer-data-structures.md#mgvlibsingleorder)'s recap data. +* **Input**: [taker `order`](../../protocol/technical-references/taking-and-making-offers/reactive-offer/offer-data-structures.md#mgvlibsingleorder)'s recap data. * **Output**: `data` to be passed to %%`makerPosthook`|makerPosthook%% if the call does not throw. * **Default behavior**: returns `"mgvOffer/proceed"`. * **Usage**: override to insert requirements so as to renege on trade prior to transferring funds, as `lastLook` is the first hook being called during an %%offer logic|offer-logic%%'s execution @@ -25,7 +25,7 @@ https://github.com/mangrovedao/mangrove-strats/blob/a265abeb96a053e386d346c7c9e4 * **Input**s: * `amount` of %%inbound|inbound%% token received by the logic and that can still be relocated at the beginning of this hook. - * [taker `order`](../../contracts/technical-references/taking-and-making-offers/reactive-offer/offer-data-structures.md#mgvlibsingleorder)'s recap data. + * [taker `order`](../../protocol/technical-references/taking-and-making-offers/reactive-offer/offer-data-structures.md#mgvlibsingleorder)'s recap data. * **Output**: `missingPut` is the amount of inbound tokens whose location are not yet determined at the end of this hook's execution. * **Default behavior**: leaves all inbound tokens allocated to the balance of the maker contract and returns 0. * **Usage**: override to change the location where taker's payment should be deposited. Override this only if this is important for outbound tokens delivery (for instance if inbound tokens are used to borrow). @@ -38,7 +38,7 @@ https://github.com/mangrovedao/mangrove-strats/blob/a265abeb96a053e386d346c7c9e4 * **Input**: * `amount` of %%outbound|outbound%% tokens that needs to be brought to the balance of the maker contract at the beginning of this hook's execution (in order to comply with the taker's order). - * [taker `order`](../../contracts/technical-references/taking-and-making-offers/reactive-offer/offer-data-structures.md#mgvlibsingleorder)'s recap data. + * [taker `order`](../../protocol/technical-references/taking-and-making-offers/reactive-offer/offer-data-structures.md#mgvlibsingleorder)'s recap data. * **Output**: `missingGet` is the amount of outbound tokens that still need to be brought to the balance of the maker contract at the end of this hook's execution. * **Default behavior**: returns the difference between the outbound token balance of the maker contract and `amount` if positive and 0 otherwise. * **Usage**: override this hook to define a more complex strategy for sourcing liquidity (for instance redeem from a lender, transfer outbound token from an EOA etc.). This hook is used to call the logic's %%router|router%% if any. @@ -52,7 +52,7 @@ https://github.com/mangrovedao/mangrove-strats/blob/a265abeb96a053e386d346c7c9e4 ``` * **Input**: - * [taker `order`](../../contracts/technical-references/taking-and-making-offers/reactive-offer/offer-data-structures.md#mgvlibsingleorder)'s recap data. + * [taker `order`](../../protocol/technical-references/taking-and-making-offers/reactive-offer/offer-data-structures.md#mgvlibsingleorder)'s recap data. * `maker_data` either the message returned by `makerExecute`'s [last look](#last-look-before-trade) if trade execution did not revert, or the revert reason (truncated to its first 32 bytes). * **Output**: a `bytes32 makerData` that can be passed to the overridden hook and ignored otherwise. * **Default behavior**: reposts offer residual in case of a partial fill, adapting what the offer gives to match the original price of the offer. @@ -65,8 +65,8 @@ https://github.com/mangrovedao/mangrove-strats/blob/a265abeb96a053e386d346c7c9e4 ``` * **Input**: - * [taker `order`](../../contracts/technical-references/taking-and-making-offers/reactive-offer/offer-data-structures.md#mgvlibsingleorder)'s recap data. - * `result` Mangrove recap of failed trade data [result](../../contracts/technical-references/taking-and-making-offers/reactive-offer/offer-data-structures.md#mgvliborderresult) + * [taker `order`](../../protocol/technical-references/taking-and-making-offers/reactive-offer/offer-data-structures.md#mgvlibsingleorder)'s recap data. + * `result` Mangrove recap of failed trade data [result](../../protocol/technical-references/taking-and-making-offers/reactive-offer/offer-data-structures.md#mgvliborderresult) * **Output**: a `bytes32 data` that can be passed to the overridden hook and ignored otherwise. * **Default behavior**: Skipped. * **Usage**: this hook is only reached in the offer logic if trade was not settled correctly by Mangrove. Override this hook to customize what should be done after the maker offer has failed. Note that if this hook is reached during offer logic's execution, maker contract has already emitted the following log: diff --git a/docs/developers/terms/bounty.md b/docs/developers/terms/bounty.md index 1a6b8b4c..5fad5dd3 100644 --- a/docs/developers/terms/bounty.md +++ b/docs/developers/terms/bounty.md @@ -13,5 +13,5 @@ Bounties serve two purposes: Bounties are paid by the %%offer owner|offer-owner%% and are taken from the [provision](./provision.md) they deposited with Mangrove when posting the offer. ## References -* [Provision and offer bounty](../contracts/technical-references/taking-and-making-offers/reactive-offer/offer-provision.md#provision-and-offer-bounty) -* [Cleaning offers](../contracts/background/offer-taker#cleaning-offers) \ No newline at end of file +* [Provision and offer bounty](../protocol/technical-references/taking-and-making-offers/reactive-offer/offer-provision.md#provision-and-offer-bounty) +* [Cleaning offers](../protocol/background/offer-taker#cleaning-offers) \ No newline at end of file diff --git a/docs/developers/terms/density.md b/docs/developers/terms/density.md index 3b26b06e..5d6f6e35 100644 --- a/docs/developers/terms/density.md +++ b/docs/developers/terms/density.md @@ -19,5 +19,5 @@ _Density_ is the ratio of tokens promised by an offer over the gas it requires t * We store the density as a float with 2 bits for the mantissa, 7 for the exponent, and an exponent bias of 32. ## References -* [Local variable: density](../contracts/technical-references/governance-parameters/local-variables.md#density) +* [Local variable: density](../protocol/technical-references/governance-parameters/local-variables.md#density) * More information on [DensityLib.sol](pathname:///MgvDoc/#densitylib.sol) in the annotated codebase \ No newline at end of file diff --git a/docs/developers/terms/gasprice.md b/docs/developers/terms/gasprice.md index f2b50c8e..3be36a66 100644 --- a/docs/developers/terms/gasprice.md +++ b/docs/developers/terms/gasprice.md @@ -7,5 +7,5 @@ hoverText: An estimate of the price of a gas unit in native token amount. The _gasprice_ is an estimate of the price of a gas unit, in native token amount. Mangrove maintains its own gasprice parameter, which is set by Governance updates. Offers on Mangrove are posted with their own gasprice, which must be at the time they are posted, higher or equal to Mangrove's. ## References -* [Global variable: gasprice](../contracts/technical-references/governance-parameters/global-variables.md#gas-price-and-oracle) -* [Offer gasprice](../contracts/technical-references/taking-and-making-offers/reactive-offer/offer-data-structures.md#mgvlibsingleorder) \ No newline at end of file +* [Global variable: gasprice](../protocol/technical-references/governance-parameters/global-variables.md#gas-price-and-oracle) +* [Offer gasprice](../protocol/technical-references/taking-and-making-offers/reactive-offer/offer-data-structures.md#mgvlibsingleorder) \ No newline at end of file diff --git a/docs/developers/terms/gasreq.md b/docs/developers/terms/gasreq.md index 2de45844..273f4329 100644 --- a/docs/developers/terms/gasreq.md +++ b/docs/developers/terms/gasreq.md @@ -7,5 +7,5 @@ hoverText: An upper bound of the gas units that an offer requires when called by The `gasreq` of an offer is an upper bound on the gas units that the offer requires when called by Mangrove. ## References -* [Technical reference](../contracts/technical-references/taking-and-making-offers/reactive-offer/gas-requirement.md) for details +* [Technical reference](../protocol/technical-references/taking-and-making-offers/reactive-offer/gas-requirement.md) for details * [Strat Lib -> How to determine gas requirements](../strat-lib/guides/howtoGasreq.md) diff --git a/docs/developers/terms/gives.md b/docs/developers/terms/gives.md index 96c228cb..83039665 100644 --- a/docs/developers/terms/gives.md +++ b/docs/developers/terms/gives.md @@ -6,4 +6,4 @@ hoverText: The volume of tokens an offer promises in exchange of the full volume The volume of tokens an offer promises to _give_ in exchange of the full volume of required (or %%wanted|wants%%) tokens. -You can read more about Gives and Wants in the [Tick and Ratio](..//contracts/technical-references/tick-ratio.md#price--wants) section. +You can read more about Gives and Wants in the [Tick and Ratio](..//protocol/technical-references/tick-ratio.md#price--wants) section. diff --git a/docs/developers/terms/maker-contract.md b/docs/developers/terms/maker-contract.md index 12f4aaa7..96037500 100644 --- a/docs/developers/terms/maker-contract.md +++ b/docs/developers/terms/maker-contract.md @@ -5,11 +5,11 @@ hoverText: A maker contract is a smart contract that is bound to a smart offer p --- A _maker contract_ is a smart contract that is bound to a %%smart offer|smart-offer%% posted on Mangrove. -It is the contract that is called by Mangrove should the offer be matched during a [taker order](../contracts/technical-references/taking-and-making-offers/taker-order/README.md). +It is the contract that is called by Mangrove should the offer be matched during a [taker order](../protocol/technical-references/taking-and-making-offers/taker-order/README.md). In addition to implementing the %%offer logic|offer-logic%% it must provide public functions to post and update offers on Mangrove. ## References -* Technical reference for [Maker contracts](../contracts/technical-references/taking-and-making-offers/reactive-offer/maker-contract.md). +* Technical reference for [Maker contracts](../protocol/technical-references/taking-and-making-offers/reactive-offer/maker-contract.md). * The [Strat Lib](../strat-lib/README.md) provides makers with a basis for writing custom maker contracts. \ No newline at end of file diff --git a/docs/developers/terms/makerExecute.md b/docs/developers/terms/makerExecute.md index d1b774bb..3c023829 100644 --- a/docs/developers/terms/makerExecute.md +++ b/docs/developers/terms/makerExecute.md @@ -7,5 +7,5 @@ hoverText: Callback function of an offer logic that is called by Mangrove prior Callback function of an %%offer logic|offer-logic%% that is called by Mangrove immediately prior to trade settlement. ## Reference -* Technical reference for [trade execution](../contracts/technical-references/taking-and-making-offers/reactive-offer/maker-contract.md#trade-execution) +* Technical reference for [trade execution](../protocol/technical-references/taking-and-making-offers/reactive-offer/maker-contract.md#trade-execution) * [Strat Lib -> MangroveOffer code](../strat-lib/technical-references/code/strats/src/strategies/MangroveOffer.md#makerexecute) \ No newline at end of file diff --git a/docs/developers/terms/makerPosthook.md b/docs/developers/terms/makerPosthook.md index a01f9c16..288c112e 100644 --- a/docs/developers/terms/makerPosthook.md +++ b/docs/developers/terms/makerPosthook.md @@ -7,5 +7,5 @@ hoverText: The callback function of an offer logic that is called by Mangrove im The callback function of an %%offer logic|offer-logic%% that is called by Mangrove immediately after trade settlement. ## Reference -* Technical reference for [trade post-hook](../contracts/technical-references/taking-and-making-offers/reactive-offer/maker-contract.md#trade-posthook) +* Technical reference for [trade post-hook](../protocol/technical-references/taking-and-making-offers/reactive-offer/maker-contract.md#trade-posthook) * [Strat Lib -> MangroveOffer code](../strat-lib/technical-references/code/strats/src/strategies/MangroveOffer.md#makerposthook) \ No newline at end of file diff --git a/docs/developers/terms/offer-id.md b/docs/developers/terms/offer-id.md index f753233c..b7e10df1 100644 --- a/docs/developers/terms/offer-id.md +++ b/docs/developers/terms/offer-id.md @@ -7,5 +7,5 @@ hoverText: The identifier of an offer in a given offer list. The _identifier_ of an offer in a given %%offer list|offer-list%%. ## References -* [Order data structure](../contracts/technical-references/taking-and-making-offers/reactive-offer/offer-data-structures.md#mgvlibsingleorder) -* [Views on offers](../contracts/technical-references/taking-and-making-offers/views-on-offers.md) \ No newline at end of file +* [Order data structure](../protocol/technical-references/taking-and-making-offers/reactive-offer/offer-data-structures.md#mgvlibsingleorder) +* [Views on offers](../protocol/technical-references/taking-and-making-offers/views-on-offers.md) \ No newline at end of file diff --git a/docs/developers/terms/offer-list.md b/docs/developers/terms/offer-list.md index 500fcae7..fccf42b9 100644 --- a/docs/developers/terms/offer-list.md +++ b/docs/developers/terms/offer-list.md @@ -7,4 +7,4 @@ hoverText: A list of offers on the same token pair, ranked from best price to wo An _offer list_ is list of offers on the same token pair, ranked from best price to worst price. ## References -* Technical reference for [Offer lists](../contracts/technical-references/taking-and-making-offers/offer-list.md). +* Technical reference for [Offer lists](../protocol/technical-references/taking-and-making-offers/offer-list.md). diff --git a/docs/developers/terms/offer-logic.md b/docs/developers/terms/offer-logic.md index d1a8f2be..6f64bfcd 100644 --- a/docs/developers/terms/offer-logic.md +++ b/docs/developers/terms/offer-logic.md @@ -4,9 +4,9 @@ title: Offer Logic hoverText: The part of a maker contract that is executed as a consequence of a call by Mangrove when processing a taker order. --- -The _offer logic_ is the part of the %%maker contract|maker-contract%% that executes as a consequence of a call by Mangrove. The offer logic is split into [trade execution](../contracts/technical-references/taking-and-making-offers/reactive-offer/maker-contract.md#trade-execution) implemented by %%`makerExecute`|makerExecute%% -and [trade posthook](../contracts/technical-references/taking-and-making-offers/reactive-offer/maker-contract.md#trade-posthook) implemented by %%`makerPosthook`|makerPosthook%%. +The _offer logic_ is the part of the %%maker contract|maker-contract%% that executes as a consequence of a call by Mangrove. The offer logic is split into [trade execution](../protocol/technical-references/taking-and-making-offers/reactive-offer/maker-contract.md#trade-execution) implemented by %%`makerExecute`|makerExecute%% +and [trade posthook](../protocol/technical-references/taking-and-making-offers/reactive-offer/maker-contract.md#trade-posthook) implemented by %%`makerPosthook`|makerPosthook%%. ## References -* [Offer Logic](../contracts/background/offer-maker.md#executing-offers) -* [Offer execution](../contracts/technical-references/taking-and-making-offers/reactive-offer/executing-offers.md) \ No newline at end of file +* [Offer Logic](../protocol/background/offer-maker.md#executing-offers) +* [Offer execution](../protocol/technical-references/taking-and-making-offers/reactive-offer/executing-offers.md) \ No newline at end of file diff --git a/docs/developers/terms/on-the-fly-offer.md b/docs/developers/terms/on-the-fly-offer.md index 1fce1f10..047bb196 100644 --- a/docs/developers/terms/on-the-fly-offer.md +++ b/docs/developers/terms/on-the-fly-offer.md @@ -6,13 +6,13 @@ hoverText: An offer posted by an EOA, in contrast with a smart offer, which is p An *on-the-fly offer* is posted by an EOA (i.e., an Externally-Owned Account, cf. [ethereum.org -> Account Types](https://ethereum.org/en/developers/docs/accounts/#types-of-account)). This is in contrast with a %%smart offer|smart-offer%% that is posted by a smart contract. -An on-the-fly offer can be listed on Mangrove but is not equipped with any on-chain [logic](../contracts/technical-references/taking-and-making-offers/reactive-offer/README.md) that executes when the offer is taken. +An on-the-fly offer can be listed on Mangrove but is not equipped with any on-chain [logic](../protocol/technical-references/taking-and-making-offers/reactive-offer/README.md) that executes when the offer is taken. -Whenever an on-the-fly offer is matched by a [taker order](../contracts/background/offer-taker.md#taking-offers), the offer sources its liquidity on the EOA. +Whenever an on-the-fly offer is matched by a [taker order](../protocol/background/offer-taker.md#taking-offers), the offer sources its liquidity on the EOA. :::caution An on-the-fly offer is not reactive (it has no code) and therefore cannot repost its residual if any. -* For example, let's consider a WETH/DAI market with an on-the-fly offer giving 1500 DAI (`gives`) at a [ratio](../contracts/technical-references/tick-ratio.md#ratio) of 0.0006. +* For example, let's consider a WETH/DAI market with an on-the-fly offer giving 1500 DAI (`gives`) at a [ratio](../protocol/technical-references/tick-ratio.md#ratio) of 0.0006. * This offer is then matched by a taker order consuming only 750 DAI. * After this transaction, it will be removed from the book since it has been partially filled. ::: \ No newline at end of file diff --git a/docs/developers/terms/price.md b/docs/developers/terms/price.md index 30c3b899..432fb772 100644 --- a/docs/developers/terms/price.md +++ b/docs/developers/terms/price.md @@ -24,8 +24,8 @@ As always when dealing with ERC-20 tokens, care must be taken to handle decimals Just as for token *amounts*, ratios and prices have both raw and user representations. -See the [Ticks, ratios, and prices](../contracts/technical-references/tick-ratio.md) page for a detailed explanation, including formulae for converting between these representations. +See the [Ticks, ratios, and prices](../protocol/technical-references/tick-ratio.md) page for a detailed explanation, including formulae for converting between these representations. ::: ## References -* Technical reference for [ticks, ratios, and prices](../contracts/technical-references/tick-ratio.md) +* Technical reference for [ticks, ratios, and prices](../protocol/technical-references/tick-ratio.md) diff --git a/docs/developers/terms/provision.md b/docs/developers/terms/provision.md index 731cd952..c4fe54d9 100644 --- a/docs/developers/terms/provision.md +++ b/docs/developers/terms/provision.md @@ -8,4 +8,4 @@ The _provision_ of an offer is an amount of native tokens that is attached to th ## References -* Technical reference for [Offer provision](../contracts/technical-references/taking-and-making-offers/reactive-offer/offer-provision.md). +* Technical reference for [Offer provision](../protocol/technical-references/taking-and-making-offers/reactive-offer/offer-provision.md). diff --git a/docs/developers/terms/ratio.md b/docs/developers/terms/ratio.md index 01c47eec..aa1d1dcc 100644 --- a/docs/developers/terms/ratio.md +++ b/docs/developers/terms/ratio.md @@ -26,9 +26,9 @@ As always when dealing with ERC-20 tokens, care must be taken to handle decimals Just as for token *amounts*, ratios and prices have both raw and user representations. -See the [Ticks, ratios, and prices](../contracts/technical-references/tick-ratio.md) page for a detailed explanation, including formulae for converting between these representations. +See the [Ticks, ratios, and prices](../protocol/technical-references/tick-ratio.md) page for a detailed explanation, including formulae for converting between these representations. ::: ## References -* Technical reference for [ticks, ratios, and prices](../contracts/technical-references/tick-ratio.md) +* Technical reference for [ticks, ratios, and prices](../protocol/technical-references/tick-ratio.md) diff --git a/docs/developers/terms/renege.md b/docs/developers/terms/renege.md index d1808e10..38818c05 100644 --- a/docs/developers/terms/renege.md +++ b/docs/developers/terms/renege.md @@ -4,7 +4,7 @@ title: Renege hoverText: Makers can renege on the offer to trade by incorporating defensive code in the maker contract (e.g., because the market conditions changed). --- -Makers can [compensate the taker and renege](../contracts/background/taker-compensation.md) on the offer to trade (e.g., because the market conditions changed) by incorporating defensive code in the maker contract. This is also known as %%last look|last-look%%. +Makers can [compensate the taker and renege](../protocol/background/taker-compensation.md) on the offer to trade (e.g., because the market conditions changed) by incorporating defensive code in the maker contract. This is also known as %%last look|last-look%%. ## References * The Strat Lib provides %%hooks|hook%% for last look - see the guide on [reneging with last look](../strat-lib/guides/howToRenege.md). diff --git a/docs/developers/terms/smart-offer.md b/docs/developers/terms/smart-offer.md index c12b8ef0..2b61238b 100644 --- a/docs/developers/terms/smart-offer.md +++ b/docs/developers/terms/smart-offer.md @@ -10,5 +10,5 @@ The contract bound to the smart offer is referred to as the %%maker contract|mak ## References -* [Making liquidity available](../contracts/background/offer-maker.md) -* [Maker contract](../contracts/technical-references/taking-and-making-offers/reactive-offer/maker-contract.md) +* [Making liquidity available](../protocol/background/offer-maker.md) +* [Maker contract](../protocol/technical-references/taking-and-making-offers/reactive-offer/maker-contract.md) diff --git a/docs/developers/terms/taker-fee.md b/docs/developers/terms/taker-fee.md index af785f27..dc0b995a 100644 --- a/docs/developers/terms/taker-fee.md +++ b/docs/developers/terms/taker-fee.md @@ -7,4 +7,4 @@ hoverText: A portion of the tokens promised to the taker that are sent to the Ma The _taker fee_ is a portion of the tokens promised to the taker that are sent to the Mangrove protocol's vault. ## References -* [Local variable: taker fee](../contracts/technical-references/governance-parameters/local-variables.md#taker-fees). \ No newline at end of file +* [Local variable: taker fee](../protocol/technical-references/governance-parameters/local-variables.md#taker-fees). \ No newline at end of file diff --git a/docs/developers/terms/tick.md b/docs/developers/terms/tick.md index 99eef413..66e27df6 100644 --- a/docs/developers/terms/tick.md +++ b/docs/developers/terms/tick.md @@ -11,4 +11,4 @@ Note that some markets may use bigger increments by setting %%tickSpacing|tickSp ## References -* Technical reference for [ticks, ratios, and prices](../contracts/technical-references/tick-ratio.md) +* Technical reference for [ticks, ratios, and prices](../protocol/technical-references/tick-ratio.md) diff --git a/docs/developers/terms/tickSpacing.md b/docs/developers/terms/tickSpacing.md index 9ea1541c..3408061f 100644 --- a/docs/developers/terms/tickSpacing.md +++ b/docs/developers/terms/tickSpacing.md @@ -4,10 +4,10 @@ title: tickSpacing hoverText: Controls the granularity of available price points in an offer list. --- -The granularity of available price points in an [offer list](../contracts/technical-references/taking-and-making-offers/offer-list.md) is controlled by the `tickSpacing` parameter. With a high `tickSpacing`, fewer price points are available, but the gas cost of market orders is lower since a smaller part of the tick tree has to be explored. +The granularity of available price points in an [offer list](../protocol/technical-references/taking-and-making-offers/offer-list.md) is controlled by the `tickSpacing` parameter. With a high `tickSpacing`, fewer price points are available, but the gas cost of market orders is lower since a smaller part of the tick tree has to be explored. The available prices in an offer list are `1.0001^i` for all `MIN_TICK <= i <= MAX_TICK` such that `i % tickSpacing = 0`. ## References -* More information on the [Tick and Ratio](../contracts/technical-references/tick-ratio.md) page. \ No newline at end of file +* More information on the [Tick and Ratio](../protocol/technical-references/tick-ratio.md) page. \ No newline at end of file diff --git a/docs/developers/terms/wants.md b/docs/developers/terms/wants.md index 3b973a48..5851b2f9 100644 --- a/docs/developers/terms/wants.md +++ b/docs/developers/terms/wants.md @@ -6,4 +6,4 @@ hoverText: The volume of tokens an offer wants in exchange of the full volume of The volume of tokens an offer _wants_ in exchange of the full volume of promised (or %%given|gives%%) tokens. -You can read more about Wants and Gives in the [Tick and Ratio](..//contracts/technical-references/tick-ratio.md#price--wants) section. +You can read more about Wants and Gives in the [Tick and Ratio](..//protocol/technical-references/tick-ratio.md#price--wants) section. diff --git a/docs/general/FAQ/README.md b/docs/general/FAQ/README.md index 6611b9dc..bed7270b 100644 --- a/docs/general/FAQ/README.md +++ b/docs/general/FAQ/README.md @@ -27,7 +27,7 @@ Here are a few reasons as to why your transactions are failing on Mangrove excha Fees on Mangrove are paid by the taker: The fee is taken from the tokens that the taker has bought. -Read more about fees [here](../web-app/trade/taker-fee.md), and also [here](../../developers/contracts/technical-references/governance-parameters/local-variables.md#taker-fees) +Read more about fees [here](../web-app/trade/taker-fee.md), and also [here](../../developers/protocol/technical-references/governance-parameters/local-variables.md#taker-fees) @@ -65,7 +65,7 @@ Read more about fees [here](../web-app/trade/taker-fee.md), and also [here](../. ### Where can I get Mangroveโ€™s addresses? -The deployment addresses for the core contract for Mangrove, as well as the most important periphery contracts are available at [Contracts โ†’ Deployment Addresses](../../developers/contracts/technical-references/contract-addresses.md). +The deployment addresses for the core contract for Mangrove, as well as the most important periphery contracts are available at [Protocol โ†’ Deployment Addresses](../../developers/protocol/technical-references/contract-addresses.md).
@@ -83,7 +83,7 @@ There are subtle differences between the various limit orders available on our T ### Who pays the gas on Mangrove? -If the offer succeeds, the gas costs for the [execution of the trade](../../developers/contracts/technical-references/taking-and-making-offers/reactive-offer/executing-offers.md) are paid by the offer taker. If the offer fails the taker is compensated for these gas costs - see [What happens when an offer fails?](#what-happens-when-an-offer-fails) +If the offer succeeds, the gas costs for the [execution of the trade](../../developers/protocol/technical-references/taking-and-making-offers/reactive-offer/executing-offers.md) are paid by the offer taker. If the offer fails the taker is compensated for these gas costs - see [What happens when an offer fails?](#what-happens-when-an-offer-fails)
@@ -91,7 +91,7 @@ If the offer succeeds, the gas costs for the [execution of the trade](../../deve ### What happens when an offer fails? -Offers in the order book may fail when taken, either because the maker consciously chose to [renege on the offer to trade](../../developers/contracts/background/taker-compensation.md), or because the maker contract reverted for other reasons. In that case, the taker has wasted some gas and will be compensated using the [offer provision](../../developers/contracts/technical-references/taking-and-making-offers/reactive-offer/offer-provision.md) (in native token) that the maker has deposited in Mangrove. +Offers in the order book may fail when taken, either because the maker consciously chose to [renege on the offer to trade](../../developers/protocol/background/taker-compensation.md), or because the maker contract reverted for other reasons. In that case, the taker has wasted some gas and will be compensated using the [offer provision](../../developers/protocol/technical-references/taking-and-making-offers/reactive-offer/offer-provision.md) (in native token) that the maker has deposited in Mangrove.
@@ -99,7 +99,7 @@ Offers in the order book may fail when taken, either because the maker conscious ### Are Mangrove market orders the same as traditional market orders? -Mangrove's [market orders](../../developers/contracts/technical-references/taking-and-making-offers/taker-order/README.md) are DeFi market orders - which are different from market orders in TradFi: +Mangrove's [market orders](../../developers/protocol/technical-references/taking-and-making-offers/taker-order/README.md) are DeFi market orders - which are different from market orders in TradFi: In TradFi, a market order is an order to buy or sell immediately at the best available price. diff --git a/docs/general/high-level/concepts/makers-takers-keepers/keepers.md b/docs/general/high-level/concepts/makers-takers-keepers/keepers.md index ebaad6be..3a5bc6c2 100644 --- a/docs/general/high-level/concepts/makers-takers-keepers/keepers.md +++ b/docs/general/high-level/concepts/makers-takers-keepers/keepers.md @@ -6,6 +6,6 @@ sidebar_position: 3 # Keepers -Mangrove's order book may be cluttered over time with irrelevant orders when the market conditions evolvent. Therefore, bots (or [Keepers](../../../../developers/keeper-bots/README.md)) are continuously scanning the book. They are responsible for detecting failing offers and making them fail on-chain by "[sniped](../../../../developers/contracts/technical-references/taking-and-making-offers/taker-order/#offer-sniping)" them, with a gas price set such that the offer's bounty compensates for the spent gas. They act as [guardians](../../../../developers/keeper-bots/background/the-role-of-cleaning-bots-in-mangrove) of the Mangrove ecosystem. ๐Ÿค– +Mangrove's order book may be cluttered over time with irrelevant orders when the market conditions evolvent. Therefore, bots (or [Keepers](../../../../developers/keeper-bots/README.md)) are continuously scanning the book. They are responsible for detecting failing offers and making them fail on-chain by "[sniped](../../../../developers/protocol/technical-references/taking-and-making-offers/taker-order/#offer-sniping)" them, with a gas price set such that the offer's bounty compensates for the spent gas. They act as [guardians](../../../../developers/keeper-bots/background/the-role-of-cleaning-bots-in-mangrove) of the Mangrove ecosystem. ๐Ÿค– Keepers are also in charge of [keeping the gas price updated](../../../../developers/keeper-bots/background/the-role-of-gas-price-updater-bots-in-mangrove) to determine the remuneration of takers for removing a failing offer from a list. \ No newline at end of file diff --git a/docs/general/high-level/concepts/makers-takers-keepers/makers.md b/docs/general/high-level/concepts/makers-takers-keepers/makers.md index 5a957492..838a521f 100644 --- a/docs/general/high-level/concepts/makers-takers-keepers/makers.md +++ b/docs/general/high-level/concepts/makers-takers-keepers/makers.md @@ -8,7 +8,7 @@ sidebar_position: 1 They create and own the offers on Mangrove. For example, they promise to give a Taker some apples ๐ŸŽ if he gives them oranges ๐ŸŠ in return. That is why Mangrove is beautiful: Makers can plant their apples in their garden, or someone else's, until a Taker that wants some apples picks their offer. -We are explaining Makers in more detail in the [Developer section](../../../../developers/contracts/technical-references/overview.md#makers) (relax, it's still very much understandable). +We are explaining Makers in more detail in the [Developer section](../../../../developers/protocol/technical-references/overview.md#makers) (relax, it's still very much understandable). import useBaseUrl from '@docusaurus/useBaseUrl'; diff --git a/docs/general/high-level/concepts/makers-takers-keepers/takers.md b/docs/general/high-level/concepts/makers-takers-keepers/takers.md index 1f8c1f4a..141f9dfd 100644 --- a/docs/general/high-level/concepts/makers-takers-keepers/takers.md +++ b/docs/general/high-level/concepts/makers-takers-keepers/takers.md @@ -6,7 +6,7 @@ sidebar_position: 2 # Takers -Just like a classical orderbook, the Taker can buy or sell assets on Mangrove, with [market](../../../web-app/trade/how-to-market-order.md) or [limit orders](../../../web-app/trade/how-to-limit-order.md). Offers can be taken using general orders or "[sniped](../../../../developers/contracts/technical-references/taking-and-making-offers/taker-order/#offer-sniping)" individually, as part of the strategies enabled by Mangrove's platform design. ๐Ÿงฟ +Just like a classical orderbook, the Taker can buy or sell assets on Mangrove, with [market](../../../web-app/trade/how-to-market-order.md) or [limit orders](../../../web-app/trade/how-to-limit-order.md). Offers can be taken using general orders or "[sniped](../../../../developers/protocol/technical-references/taking-and-making-offers/taker-order/#offer-sniping)" individually, as part of the strategies enabled by Mangrove's platform design. ๐Ÿงฟ Takers may typically operate via a web front-end or with the help of our [SDK](../../../../developers/SDK/README.md) to develop off-chain apps that interact with Mangrove ecosystem. diff --git a/docs/general/kandel/how-does-kandel-work/more-on-failing-offers.md b/docs/general/kandel/how-does-kandel-work/more-on-failing-offers.md index ebb4365f..d25ab72e 100644 --- a/docs/general/kandel/how-does-kandel-work/more-on-failing-offers.md +++ b/docs/general/kandel/how-does-kandel-work/more-on-failing-offers.md @@ -15,14 +15,14 @@ This section explains the reasons why some offers might fail using Kandel. When we talk about an offer "failing", we mean that it could not execute. An offer can also fail to update itself. While we won't go into details in this part of the documentation, it is important to mention and differentiate those cases to further understand Kandel strategy's behavior. * [`makerExecute()`](../../../developers/strat-lib/technical-references/code/strats/src/strategies/MangroveOffer/#makerexecute): it is the callback function that is called when an offer is matched. Its role is to execute all offers that were posted on Mangrove by a given contract. - * A failure in `makerExecute()` means the trade is canceled, and the [bounty](../../../developers/terms/bounty) is given to the Taker as a [compensation](../../../developers/contracts/technical-references/taking-and-making-offers/taker-order/#bounties-for-taking-failing-offers). The offer is removed from the book. + * A failure in `makerExecute()` means the trade is canceled, and the [bounty](../../../developers/terms/bounty) is given to the Taker as a [compensation](../../../developers/protocol/technical-references/taking-and-making-offers/taker-order/#bounties-for-taking-failing-offers). The offer is removed from the book. * [`makerPosthook()`](../../../developers/strat-lib/technical-references/code/strats/src/strategies/MangroveOffer/#makerposthook): it is the callback function that is called after the offer execution (i.e. after a successful execution of `makerExecute()`). * A failure in `makerPosthook()` means the offer cannot update or repost itself after being taken. It does not cancel the trade, since it is called after `makerExecute()`. :::info Note -For a more visual explanation, see the [call sequence overview](../../../developers/contracts/technical-references/overview#call-sequence-overview) diagram. +For a more visual explanation, see the [call sequence overview](../../../developers/protocol/technical-references/overview#call-sequence-overview) diagram. ::: ## Kandel and `makerExecute()` failure @@ -49,7 +49,7 @@ Non-reposted liquidity will be placed into the [Unallocated liquidity](./strateg Reposting offers is handled with [`makerPosthook()`](../../../developers/strat-lib/technical-references/code/strats/src/strategies/MangroveOffer/#makerposthook), and failure could happen if: * The residual of a partially taken offer is too small with regard to [density](../../../developers/terms/density): - * A partially taken offer is the result of a Taker either partially [sniping](../../../developers/contracts/technical-references/taking-and-making-offers/taker-order/#offer-sniping) an offer, or placing a Market order + * A partially taken offer is the result of a Taker either partially [sniping](../../../developers/protocol/technical-references/taking-and-making-offers/taker-order/#offer-sniping) an offer, or placing a Market order * If an offer is almost entirely taken, the remainder (dust) could be too small to pass the density check, leading to a failure to repost itself diff --git a/package.json b/package.json index e500adcd..13666f5c 100644 --- a/package.json +++ b/package.json @@ -8,11 +8,11 @@ "build": "yarn install && docusaurus build", "swizzle": "docusaurus swizzle", "update-generated": "yarn coreversion && yarn stratsversion && yarn jsversion && yarn deploymentsversion && yarn contextversion && yarn natspec && yarn doccore && docusaurus build", - "coreversion": "yarn info \"@mangrovedao/mangrove-core\" --json > docs/developers/contracts/technical-references/mangrove-core-version.json", - "stratsversion": "yarn info \"@mangrovedao/mangrove-strats\" --json > docs/developers/contracts/technical-references/mangrove-strats-version.json", - "jsversion": "yarn info \"@mangrovedao/mangrove.js\" --json > docs/developers/contracts/technical-references/mangrove-js-version.json", - "deploymentsversion": "yarn info \"@mangrovedao/mangrove-deployments\" --json > docs/developers/contracts/technical-references/mangrove-deployments-version.json", - "contextversion": "yarn info \"@mangrovedao/context-addresses\" --json > docs/developers/contracts/technical-references/context-addresses-version.json", + "coreversion": "yarn info \"@mangrovedao/mangrove-core\" --json > docs/developers/protocol/technical-references/mangrove-core-version.json", + "stratsversion": "yarn info \"@mangrovedao/mangrove-strats\" --json > docs/developers/protocol/technical-references/mangrove-strats-version.json", + "jsversion": "yarn info \"@mangrovedao/mangrove.js\" --json > docs/developers/protocol/technical-references/mangrove-js-version.json", + "deploymentsversion": "yarn info \"@mangrovedao/mangrove-deployments\" --json > docs/developers/protocol/technical-references/mangrove-deployments-version.json", + "contextversion": "yarn info \"@mangrovedao/context-addresses\" --json > docs/developers/protocol/technical-references/context-addresses-version.json", "predocgen": "bash git diff-index --quiet HEAD -- || echo \"You have uncommitted changes\"", "docgen-core": "docusaurus parse && docusaurus glossary && docusaurus build", "docgen": "(git diff-index --quiet HEAD -- || (echo \"You have uncommitted changes\" && exit 1)) && yarn docgen-core", diff --git a/scripts/addresses-to-md.js b/scripts/addresses-to-md.js index 143ed5a3..f18479b0 100644 --- a/scripts/addresses-to-md.js +++ b/scripts/addresses-to-md.js @@ -85,7 +85,7 @@ const main = async () => { } } - writeFileSync("docs/developers/contracts/technical-references/_contract-addresses-raw.md",md); + writeFileSync("docs/developers/protocol/technical-references/_contract-addresses-raw.md",md); } diff --git a/sidebars.js b/sidebars.js index 83948fe5..a7aba703 100644 --- a/sidebars.js +++ b/sidebars.js @@ -155,12 +155,12 @@ const sidebars = { }, { type: 'category', - label: 'Contracts', + label: 'Protocol', collapsed: false, items: [ { type: 'autogenerated', - dirName: 'developers/contracts', + dirName: 'developers/protocol', }, ], }, @@ -204,7 +204,7 @@ const sidebars = { items: [ { type: 'doc', - id: 'developers/contracts/technical-references/contract-addresses', + id: 'developers/protocol/technical-references/contract-addresses', label: '๐Ÿš Deployment addresses', }, {