Skip to content

Commit

Permalink
GitBook: [#154] Smart contract audit link fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeelimm authored and gitbook-bot committed Nov 18, 2021
1 parent 7bfc447 commit b31c799
Show file tree
Hide file tree
Showing 26 changed files with 885 additions and 972 deletions.
Binary file added .gitbook/assets/Mirror v2 Audit Report (1).pdf
Binary file not shown.
Binary file added .gitbook/assets/Mirror v2 Audit Report.pdf
Binary file not shown.
200 changes: 99 additions & 101 deletions contracts/collateral-oracle.md

Large diffs are not rendered by default.

245 changes: 105 additions & 140 deletions contracts/factory.md

Large diffs are not rendered by default.

185 changes: 92 additions & 93 deletions contracts/limit-order.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Limit Order

Limit Order allows submission, updates, and execution of buy and sell orders at a limit price specified by the users. Once the limit order is submitted and the limit price is reached, market-making agents can read the orders from the Limit Order contract and execute them when it provides an arbitrage opportunity.
To create a market-making bot for arbitrage opportunity, refer to this [Github link](https://github.com/Mirror-Protocol/mirror-contracts/tree/master/contracts/mirror_limit_order).
Limit Order allows submission, updates, and execution of buy and sell orders at a limit price specified by the users. Once the limit order is submitted and the limit price is reached, market-making agents can read the orders from the Limit Order contract and execute them when it provides an arbitrage opportunity.\
\
To create a market-making bot for arbitrage opportunity, refer to this [Github link](https://github.com/Mirror-Protocol/mirror-contracts/tree/master/contracts/mirror\_limit\_order).

## InitMsg

Expand Down Expand Up @@ -49,18 +49,18 @@ pub enum HandleMsg {
{% endtab %}
{% endtabs %}

| Key | Type | Description |
| :--- | :--- | :--- |
| `amount` | Uint128 | Token amount received |
| `sender` | HumanAddr | Sender of token transaction |
| `msg` | Binary | Base64-encoded string of JSON of [Receive Hook](https://docs.mirror.finance/contracts/limit-order#receive-hooks) |
| Key | Type | Description |
| -------- | --------- | ---------------------------------------------------------------------------------------------------------------- |
| `amount` | Uint128 | Token amount received |
| `sender` | HumanAddr | Sender of token transaction |
| `msg` | Binary | Base64-encoded string of JSON of [Receive Hook](https://docs.mirror.finance/contracts/limit-order#receive-hooks) |

### `SubmitOrder`

Creates a new Limit Order with a types and amount of tokens to be traded, specified by the user. `offer_asset` is locked until the order is executed or canceled by the creator.
Creates a new Limit Order with a types and amount of tokens to be traded, specified by the user. `offer_asset` is locked until the order is executed or canceled by the creator. \


When tokens other than native tokens are sent \(such as CW20\), it a [Receive Hook](https://docs.mirror.finance/contracts/limit-order#receive-hooks) must be sent to submit the order.
When tokens other than native tokens are sent (such as CW20), it a [Receive Hook](https://docs.mirror.finance/contracts/limit-order#receive-hooks) must be sent to submit the order. 

{% tabs %}
{% tab title="Rust" %}
Expand Down Expand Up @@ -101,14 +101,14 @@ pub enum HandleMsg {
{% endtab %}
{% endtabs %}
| Key | Type | Description |
| :--- | :--- | :--- |
| `offer_asset` | Asset | Asset to be submitted to Limit Order |
| `ask_asset` | Asset | Asset to receive when order is executed |
| Key | Type | Description |
| ------------- | ----- | --------------------------------------- |
| `offer_asset` | Asset | Asset to be submitted to Limit Order |
| `ask_asset` | Asset | Asset to receive when order is executed |
### `CancelOrder`
Order is canceled by the creator. `offer_asset` locked in this order is released and returned to the owner.
Order is canceled by the creator. `offer_asset` locked in this order is released and returned to the owner. 
{% tabs %}
{% tab title="Rust" %}
Expand All @@ -134,13 +134,13 @@ pub enum HandleMsg {
{% endtab %}
{% endtabs %}
| Key | Type | Description |
| :--- | :--- | :--- |
| `order_id` | u64 | Order ID |
| Key | Type | Description |
| ---------- | ---- | ----------- |
| `order_id` | u64 | Order ID |
### `ExecuteOrder`
Executes order against an existing limit order. You cannot submit more than the amount defined by `ask_asset - filled_asset_amounnt` in a specific order.
Executes order against an existing limit order. You cannot submit more than the amount defined by `ask_asset - filled_asset_amounnt` in a specific order. 
{% tabs %}
{% tab title="Rust" %}
Expand Down Expand Up @@ -174,10 +174,10 @@ pub enum HandleMsg {
{% endtab %}
{% endtabs %}
| Key | Type | Description |
| :--- | :--- | :--- |
| Key | Type | Description |
| --------------- | ----- | ------------------------------------- |
| `execute_asset` | Asset | Asset to be executed from Limit Order |
| `order_id` | u64 | Order ID |
| `order_id` | u64 | Order ID |
## Receive Hooks
Expand All @@ -187,9 +187,9 @@ If you send tokens to the Limit Order contract without issuing this hook, they w
### `SubmitOrder`
Issued when user sends CW20 tokens to Limit Order contract.
Issued when user sends CW20 tokens to Limit Order contract. 
Locks the sent amount to create a new order.
Locks the sent amount to create a new order. 
{% tabs %}
{% tab title="Rust" %}
Expand Down Expand Up @@ -222,15 +222,15 @@ pub enum Cw20HookMsg {
{% endtab %}
{% endtabs %}
| Key | Type | Description |
| :--- | :--- | :--- |
| Key | Type | Description |
| ----------- | ----- | ------------------------------------- |
| `ask_asset` | Asset | Asset to be executed from Limit Order |
### `ExecuteOrder`
Issued when arbitrageur sends and fulfills the amount of `ask_asset` to a specific limit order.
Reduces the balance of the `ask_asset` and `offer_asset` of the specified `order_id`. If all outstanding `ask_asset` has been filled, then the order is completed.
Issued when arbitrageur sends and fulfills the amount of `ask_asset` to a specific limit order. \
\
Reduces the balance of the `ask_asset` and `offer_asset` of the specified `order_id`. If all outstanding `ask_asset` has been filled, then the order is completed. 
{% tabs %}
{% tab title="Rust" %}
Expand All @@ -256,9 +256,9 @@ pub enum Cw20HookMsg {
{% endtab %}
{% endtabs %}
| Key | Type | Description |
| :--- | :--- | :--- |
| `order_id` | u64 | Order ID |
| Key | Type | Description |
| ---------- | ---- | ----------- |
| `order_id` | u64 | Order ID |
## QueryMsg
Expand All @@ -278,9 +278,9 @@ pub enum QueryMsg {
}
```
| Key | Type | Description |
| :--- | :--- | :--- |
| `order_id` | u64 | Order ID |
| Key | Type | Description |
| ---------- | ---- | ----------- |
| `order_id` | u64 | Order ID |
#### Response
Expand All @@ -295,14 +295,14 @@ pub struct OrderResponse {
pub filled_ask_amount: Uint128,
```
| Key | Type | Description |
| :--- | :--- | :--- |
| `order_id` | u64 | Order ID |
| `bidder_addr` | HumanAddr | Address of bidder |
| `offer_asset` | Asset | Amount of asset offered in order |
| `ask_asset` | Asset | Amount of asset asked in order |
| `filled_offer_amount` | Uint128 | Amount of offer asset already executed |
| `filled_ask_amount` | Uint128 | Amount of ask asset already executed |
| Key | Type | Description |
| --------------------- | --------- | -------------------------------------- |
| `order_id` | u64 | Order ID |
| `bidder_addr` | HumanAddr | Address of bidder |
| `offer_asset` | Asset | Amount of asset offered in order |
| `ask_asset` | Asset | Amount of asset asked in order |
| `filled_offer_amount` | Uint128 | Amount of offer asset already executed |
| `filled_ask_amount` | Uint128 | Amount of ask asset already executed |
{% endtab %}
{% tab title="JSON" %}
Expand All @@ -314,9 +314,9 @@ pub struct OrderResponse {
}
```
| Key | Type | Description |
| :--- | :--- | :--- |
| `order_id` | u64 | Order ID |
| Key | Type | Description |
| ---------- | ---- | ----------- |
| `order_id` | u64 | Order ID |
#### Response
Expand Down Expand Up @@ -347,14 +347,14 @@ pub struct OrderResponse {
}
```
| Key | Type | Description |
| :--- | :--- | :--- |
| `order_id` | u64 | Order ID |
| `bidder_addr` | HumanAddr | Address of bidder |
| `offer_asset` | Asset | Amount of asset offered in order |
| `ask_asset` | Asset | Amount of asset asked in order |
| `filled_offer_amount` | Uint128 | Amount of offer asset already executed |
| `filled_ask_amount` | Uint128 | Amount of ask asset already executed |
| Key | Type | Description |
| --------------------- | --------- | -------------------------------------- |
| `order_id` | u64 | Order ID |
| `bidder_addr` | HumanAddr | Address of bidder |
| `offer_asset` | Asset | Amount of asset offered in order |
| `ask_asset` | Asset | Amount of asset asked in order |
| `filled_offer_amount` | Uint128 | Amount of offer asset already executed |
| `filled_ask_amount` | Uint128 | Amount of ask asset already executed |
{% endtab %}
{% endtabs %}
Expand All @@ -376,12 +376,12 @@ pub enum QueryMsg {
}
```
| Key | Type | Description |
| :--- | :--- | :--- |
| `bidder_addr`\* | HumanAddr | Address of the order bidder |
| `start_after`\* | u64 | Begins search query at specific Order ID |
| `limit`\* | u32 | Limit of results to fetch |
| `order_by`\* | OrderBy | Can be ASC or DESC |
| Key | Type | Description |
| --------------- | --------- | ---------------------------------------- |
| `bidder_addr`\* | HumanAddr | Address of the order bidder |
| `start_after`\* | u64 | Begins search query at specific Order ID |
| `limit`\* | u32 | Limit of results to fetch |
| `order_by`\* | OrderBy | Can be ASC or DESC |
#### Response
Expand All @@ -392,18 +392,18 @@ pub struct OrdersResponse {
}
```
| Key | Type | Description |
| :--- | :--- | :--- |
| `orders` | Vec<OrderResponse> | Vector of user's order information |
| Key | Type | Description |
| :--- | :--- | :--- |
| `order_id` | u64 | Order ID |
| `bidder_addr` | HumanAddr | Address of bidder |
| `offer_asset` | Asset | Amount of asset offered in order |
| `ask_asset` | Asset | Amount of asset asked in order |
| `filled_offer_amount` | Uint128 | Amount of offer asset already executed |
| `filled_ask_amount` | Uint128 | Amount of ask asset already executed |
| Key | Type | Description |
| -------- | ------------------- | ---------------------------------- |
| `orders` | Vec\<OrderResponse> | Vector of user's order information |
| Key | Type | Description |
| --------------------- | --------- | -------------------------------------- |
| `order_id` | u64 | Order ID |
| `bidder_addr` | HumanAddr | Address of bidder |
| `offer_asset` | Asset | Amount of asset offered in order |
| `ask_asset` | Asset | Amount of asset asked in order |
| `filled_offer_amount` | Uint128 | Amount of offer asset already executed |
| `filled_ask_amount` | Uint128 | Amount of ask asset already executed |
{% endtab %}
{% tab title="JSON" %}
Expand All @@ -418,12 +418,12 @@ pub struct OrdersResponse {
}
```
| Key | Type | Description |
| :--- | :--- | :--- |
| `bidder_addr`\* | HumanAddr | Address of the order bidder |
| `start_after`\* | u64 | Begins search query at specific Order ID |
| `limit`\* | u32 | Limit of results to fetch |
| `order_by`\* | OrderBy | Can be ASC or DESC |
| Key | Type | Description |
| --------------- | --------- | ---------------------------------------- |
| `bidder_addr`\* | HumanAddr | Address of the order bidder |
| `start_after`\* | u64 | Begins search query at specific Order ID |
| `limit`\* | u32 | Limit of results to fetch |
| `order_by`\* | OrderBy | Can be ASC or DESC |
#### Response
Expand Down Expand Up @@ -479,14 +479,14 @@ pub struct OrdersResponse {
}
```
| Key | Type | Description |
| :--- | :--- | :--- |
| `order_id` | u64 | Order ID |
| `bidder_addr` | HumanAddr | Address of bidder |
| `offer_asset` | Asset | Amount of asset offered in order |
| `ask_asset` | Asset | Amount of asset asked in order |
| `filled_offer_amount` | Uint128 | Amount of offer asset already executed |
| `filled_ask_amount` | Uint128 | Amount of ask asset already executed |
| Key | Type | Description |
| --------------------- | --------- | -------------------------------------- |
| `order_id` | u64 | Order ID |
| `bidder_addr` | HumanAddr | Address of bidder |
| `offer_asset` | Asset | Amount of asset offered in order |
| `ask_asset` | Asset | Amount of asset asked in order |
| `filled_offer_amount` | Uint128 | Amount of offer asset already executed |
| `filled_ask_amount` | Uint128 | Amount of ask asset already executed |
{% endtab %}
{% endtabs %}
Expand Down Expand Up @@ -515,9 +515,9 @@ pub struct LastOrderIDResponse {
}
```
| Key | Type | Description |
| :--- | :--- | :--- |
| `last_order_id` | u64 | Index of the most recent order |
| Key | Type | Description |
| --------------- | ---- | ------------------------------ |
| `last_order_id` | u64 | Index of the most recent order |
{% endtab %}
{% tab title="JSON" %}
Expand All @@ -536,9 +536,8 @@ pub struct LastOrderIDResponse {
}
```
| Key | Type | Description |
| :--- | :--- | :--- |
| `last_order_id` | u64 | Index of the most recent order |
| Key | Type | Description |
| --------------- | ---- | ------------------------------ |
| `last_order_id` | u64 | Index of the most recent order |
{% endtab %}
{% endtabs %}
Loading

0 comments on commit b31c799

Please sign in to comment.