- Main contracts:
- Order & Order Batching Validators
/validator/order_validator.ak
- Pool Validator
/validator/pool_validator.ak
- LP Minting Policy
/validator/lp_minting_policy.ak
- Order & Order Batching Validators
- Library: under
/lib/stableswap
package
- Install npm: https://docs.npmjs.com/downloading-and-installing-node-js-and-npm
- Install Aiken v1.0.21-alpha: https://aiken-lang.org/installation-instructions
- Run
aiken build
to double check scripts bytecode inplutus.json
file - Run
npm install
to install necessary dependencies - Run
npx ts-node --esm build-plutus.ts
to build scripts with initial parameters. The result isstableswap-script.json
file
- Run
aiken check
to run all unit tests of the contract - Minswap Testnet Preprod website: https://testnet-preprod.minswap.org/
Minswap Stableswap Contracts depends on contract's parameters:
- Pool NFT: must be minted by Time-Lock script and its quantity must be 1
- Assets: the stable assets which the Pool supports trading
- Multiples: is the multiple of stable assets, using for calculation between stable assets with different decimals.
- Fee: the numerator of the fee % users need to pay when interacting with the pool
- Admin Fee: the numerator of the % of the fee that goes to Admin
- Fee Denominator: is the denominator of fee and admin_fee, which help calculation more accurate
- License Curreny Symbol: used for minting Batcher License assets.
- Admin Asset: is used to identify Admin
- Maximum Deadline Range: is the maximum expiration time of Batcher license from now
When these parameters are prepared, the Smart Contract can be built by using buiid-plutus.ts
script.
In the Stableswap system, an entity known as the "Batcher" plays a crucial role in processing User Requests (Orders). Batchers are centralized agents, authorized by the Protocol Owner through a Batcher License Asset.
The Pool NFT is a key component in Stableswap, uniquely identifying each Pool and playing a pivotal role. It is responsible for authorizing LP Token Minting. However, if the Pool NFT and the Pool are not configured correctly, it could potentially compromise the LP Minting Policy Contract.
-
Legitimate Initialization:
- Mint a single Pool NFT using a Time-Lock Script.
- Utilize the Pool NFT to establish a Stable Pool.
-
Malicious Initialization:
- Failure to mint the Pool NFT via Time-Lock Script, or minting more than one Asset.
- Misuse of the Pool NFT to mint LP Tokens prior to the creation of the Stable Pool.
To ensure security and uniqueness, users intending to interact with Stable Pools outside of the Minswap interface must verify that the Pool NFT has been minted correctly. This verification is crucial to ensure that the Pool NFT is unique and cannot be replicated or minted again.