netgum / archanova

Archanova monorepo
https://archanova.io/
19 stars 11 forks source link

Reverting when calling deployAccount #66

Closed ochikov closed 4 years ago

ochikov commented 4 years ago

Revert error is throwing when try to use:

await this.sdk.deployAccount(sdkConstants.GasPriceStrategies.Avg);

THE CODE:

const accountBalance = await this.provider.getBalance(this.props.accountAddress);
         console.log('HERE Account Balance', accountBalance.toString()) // 20000000000000000
                const estimateResult = await this.sdk.estimateAccountDeployment(sdkConstants.GasPriceStrategies.Avg)
                console.log('HERE Estimate Result', estimateResult.totalCost.toString()) // 650000000000000

                let totalCost = ethers.utils.parseEther('0.01').add(estimateResult.totalCost.toString());
                console.log('HERE TOTAL COST', totalCost.toString()) // 10650000000000000
if (accountBalance.gte(totalCost)) {
               const hash = await this.sdk.deployAccount(sdkConstants.GasPriceStrategies.Avg);
}

THE ERROR:

Error: reverted
    at new Error (Error.js:7)
    at Function.fromAny (Error.js:32)
    at Function.throwFromAny (Error.js:38)
    at Sdk.js:46
    at shims.js:1
    at K (shims.js:1)
    at z (shims.js:1)
    at E (shims.js:1)
    at MessagePort.p (shims.js:1)

Tested both on kovan and ropsten