mento-protocol / mento-sdk

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

Investigate mento-sdk error handling #23

Closed bayological closed 1 year ago

bayological commented 1 year ago

Description

We need to look into how we can better handle smart contract reverts and display errors that may be thrown when using the SDK. We should look into the following:

Acceptance Criteria

bayological commented 1 year ago

We can do the following in functions that return a transaction request:

Mapping revert reasons to friendly messages may be excessive. The revert reasons in our contracts are pretty self-explanatory but we also have a lot of messages. Creating a mapping for each of these reasons would be a lot.

@nvtaveras WDYT?

nvtaveras commented 1 year ago

@bayological SGTM! And regarding the mapping, maybe we can some of the the most relevant ones like circuit breaker tripped, trading limit exceeded, amountOut/In not enough?

bayological commented 1 year ago

@nvtaveras I created this issue. On the mapping, we could do that, but how do you see this being implemented? This would be more involved, but we can map something like "L1 Exceeded" to "Trading limit 1 for cUSD has been hit for this exchange". We'll need to have additional logic to determine the token, but we would have all that information available.