IrrigationProtocol / irrigation-contracts-diamond

MIT License
3 stars 1 forks source link

Water Tower Contract Technical Spec #26

Closed JosephSaw closed 1 year ago

JosephSaw commented 1 year ago

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

In short, the water tower is used to share protocol fees in ETH. To be eligible for these ETH rewards users will need to first stake WATER.

Functions:

1. Storing Water: (Depositing)

Required Params: Parameter Type
amount uint256
autoIrrigate boolean

Events Emitted: WaterStored(address indexed user, uint256 amount, boolean autoIrrigate)

2. Unstoring Water: (Withdrawing)

Required Params: Parameter Type
amount uint256

Events Emitted: WaterUnstored(address indexed user, uint256 amount)

3. Claim Rewards: (Claiming ETH Rewards)

Required Params: Parameter Type
amount uint256

Events Emitted: RewardClaimed(address indexed user, uint256 amount)

4. Irrigate Rewards: (Irrigate)

Required Params: Parameter Type
amount uint256

Events Emitted: Irrigated(address indexed user, uint256 amount)

Function Description: https://docs.irrigation.finance/irrigation-protocol/irrigation-tools/the-water-tower#irrigate-rewards

Auto-compounds ETH rewards into more Water, which will then be deposited on behalf of the user

Getters

1. Get User:

Required Params: Parameter Type
user address
Returns: Parameter Type
waterStored uint256
autoIrrigate boolean

2. Get User Pending Rewards:

Required Params: Parameter Type
user address
Returns: Parameter Type
pendingRewards uint256

3. Get Total Water Stored:

Returns: Parameter Type
totalWaterStored uint256

4. Irrigation Bonus:

Required Params: Parameter Type
irrigateAmount uint256
Returns: Parameter Type
bonusWater uint256

Note: Need to discuss with the team on how bonus is supposed to be calculated

5. Farmer's Market Unlocked:

Required Params: Parameter Type
user address
Returns: Parameter Type
farmerMarketUnlocked boolean

Function Description: Currently, you need to deposit 32 WATER to unlock Farmer's Market. This contract returns whether the farmer's market is unlocked for the user