IrrigationProtocol / irrigation-contracts-diamond

MIT License
3 stars 1 forks source link

Sprinkler Contract Technical Spec #27

Closed JosephSaw closed 1 year ago

JosephSaw commented 1 year ago

Docs: https://docs.irrigation.finance/irrigation-protocol/irrigation-tools/the-sprinkler

In short, the sprinkler is an AMM to allow users to swap whitelisted assets for WATER. The AMM does not allow users to SELL WATER for other assets.

Functions

1. Swap Exact In Amount:

Required Params: Parameter Type
token address
exactTokenInAmount uint256

Note: Swaps the exact amount of token for WATER

2. Swap Exact Out Amount:

Required Params: Parameter Type
token address
maxTokenInAmount uint256 (Protects User from losing everything in care of Oracle error)
exactWaterOutAmount uint256

Note: Swaps an arbitrary amount of token for an exact amount of WATER

Getters

1. Get Whitelisted Tokens:

Returns: Parameter Type
tokens address []

2. Get Exact Swap In Amount:

Required Params: Parameter Type
token address
tokenInAmount uint256
Returns: Parameter Type
waterAmount uint256

3. Get Exact Out Amount:

Required Params: Parameter Type
token address
exactWaterOutAmount uint256
Returns: Parameter Type
exactTokenInAmount uint256