Skip to content

Improve error handling of emp-mint task when insufficient collateral is available to mint minSponsorToken amount #73

@krisoshea-eth

Description

@krisoshea-eth

When calling the 'create' function in an EMP contract on Etherscan, if the proposed collateral amount yields a number of synth tokens below the minSponsorToken value which was defined when the EMP contract was created, the transaction request will still be registered and sent to the user's wallet to sign. However, because the collateral amount yields a minSponsorToken value that is below what was set when the EMP was created, the user's wallet returns an error message that says 'gas cannot be estimated / unable to estimate gas' and the wallet will suggest a very high gas fee to deter the user from signing the transaction.

Similarly, when using the 'emp-mint' task, if the proposed collateral amount yields a number of synth tokens below the minSponsorToken quantity which was defined when the EMP contract was created or if there is insufficient collateral balance in the wallet used to mint the required minSponsorToken quantity, the transaction request will begin but the mint will fail as the collateral amount yields a minSponsorToken value that is below what was set when the EMP was created. The error message returned is Error: cannot estimate gas; transaction may fail or may require manual gas limit

On the Sumero UI, this is not an issue because if the collateral value yields a minSponsorToken value that is below the minimum required amount, the user cannot call the function which initiates the transaction.

To improve the error handling of the emp-mint task and calling the 'create' function directly on Etherscan, we need to set a requirement that checks if the proposed collateral is high enough to pay for minSponsorTokens in order for the transaction signature request to be sent as well as a requirement that checks to see if the wallet collateral balance is sufficient to deposit the collateral required.

Basically, the emp-mint task should error out saying “insufficient collateral” or "below minSponsorToken"

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingenhancementNew feature or requestinvalidThis doesn't seem right

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions