mento-protocol / mento-sdk

An SDK for integrating applications with the Mento protocol
MIT License
0 stars 3 forks source link

Enhancing Error Handling and Checks in MentoV2 SDKs/Swaps #32

Closed denviljclarke closed 3 months ago

denviljclarke commented 7 months ago

Description

An issue has been identified by zvida, a Celo Terminal engineer, regarding the MentoV2 SDKs and swaps functionality. The problem occurred when the reserve runs out of axlUSDC, causing numerous flows to break. This issue is compounded by the lack of checks for actual values within the registry, leading to failures in swap operations due to insufficient funds in the reserve.

Specific Problems Identified:

  1. MentoV2 SDKs/Swaps Failure: The SDKs and swaps do not account for the reserve's actual balance, resulting in broken workflows when there's a shortage of axlUSDC.
  2. Confusing Error Messages: The contract does not verify reserve balances until a transfer is initiated, leading to unclear and confusing error messages.
  3. Lack of Pre-emptive Checks: Currently, there's no mechanism to check the reserve status in advance, either in the SDK or the broker contract, to prevent such failures.

Proposed Solutions

This issue is more about exploring error handling and logging as a whole in the SDK.

Action Items

Acceptance Criteria

denviljclarke commented 3 months ago

We've decided that this error handling should be done on by the SDK user, however based on this we've also decided it would be good to handle this type of error and provide some feedback to users when this occurs on the front on so I've created another issue to track this.