You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/2.developers/3.guides/13.cosmwasm-by-example/9.amm-product.md
+28-12Lines changed: 28 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,7 @@ parentSectionPath: /developers
7
7
---
8
8
9
9
# Constant Product Automatic Market Maker (AMM)
10
+
10
11
## Explanation
11
12
This contract is an Constant Product Automated Market Maker (AMM) for CosmWasm. This contract allows you to swap tokens. Liquidity providers can add liquidity to the market and receive a certain fee on every transaction that is set on instantiation. The code also includes various error handling and validation checks to ensure the correctness and security of the operations.
12
13
@@ -389,7 +390,6 @@ The owner can freeze deposits to the AMM by calling the execute_freeze_deposits
389
390
390
391
## Example
391
392
392
-
## Example
393
393
To create an AMM with CosmWasm, you can create the following files:
394
394
lib.rs
395
395
integration_tests.rs
@@ -398,6 +398,17 @@ msg.rs
398
398
error.rs
399
399
state.rs
400
400
401
+
## Cargo.toml
402
+
403
+
The following dependencies should be added to the `Cargo.toml` file:
404
+
405
+
```
406
+
cw20-base = { version = "0.16", features = ["library"] }
407
+
cw20 = { version = "0.16" }
408
+
```
409
+
410
+
Make sure `cw20-base` is added as a `library` using `features = ["library"]` so as to prevent any issues with adding the `instantiate`, `execute` and `query` entrypoints to the contract.
411
+
401
412
### lib.rs
402
413
403
414
::highlight-card
@@ -1532,6 +1543,8 @@ use cosmwasm_std::{Decimal, Uint128};
0 commit comments