fix contract trapped (#6973)

This commit is contained in:
Andreea Eftene 2022-02-11 13:43:06 +01:00 committed by GitHub
parent 1023603a41
commit d42da8da93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 18 deletions

View File

@ -92,7 +92,7 @@ function Upload ({ onClose }: Props): React.ReactElement {
? code.tx[contractAbi.constructors[constructorIndex].method]({
gasLimit: weight.weight,
storageDepositLimit: null,
value
value: contractAbi?.constructors[constructorIndex].isPayable ? value : undefined
}, ...params)
: null;
} catch (e) {
@ -200,14 +200,17 @@ function Upload ({ onClose }: Props): React.ReactElement {
params={contractAbi.constructors[constructorIndex].args}
registry={contractAbi.registry}
/>
<InputBalance
help={t<string>('The balance to transfer from the `origin` to the newly created contract.')}
isError={!isValueValid}
isZeroable={hasStorageDeposit}
label={t<string>('value')}
onChange={setValue}
value={value}
/>
{contractAbi.constructors[constructorIndex].isPayable && (
<InputBalance
help={t<string>('The balance to transfer from the `origin` to the newly created contract.')}
isError={!isValueValid}
isZeroable={hasStorageDeposit}
label={t<string>('value')}
onChange={setValue}
value={value}
/>
)
}
<InputMegaGas
help={t<string>('The maximum amount of gas that can be used by this deployment, if the code requires more, the deployment will fail')}
weight={weight}

View File

@ -86,7 +86,7 @@ function Deploy ({ codeHash, constructorIndex = 0, onClose, setConstructorIndex
? salt
: null,
storageDepositLimit: null,
value
value: contractAbi?.constructors[constructorIndex].isPayable ? value : undefined
}, ...params);
} catch (error) {
return null;
@ -172,14 +172,16 @@ function Deploy ({ codeHash, constructorIndex = 0, onClose, setConstructorIndex
/>
</>
)}
<InputBalance
help={t<string>('The balance to transfer from the `origin` to the newly created contract.')}
isError={!isValueValid}
isZeroable={hasStorageDeposit}
label={t<string>('value')}
onChange={setValue}
value={value}
/>
{contractAbi?.constructors[constructorIndex].isPayable && (
<InputBalance
help={t<string>('The balance to transfer from the `origin` to the newly created contract.')}
isError={!isValueValid}
isZeroable={hasStorageDeposit}
label={t<string>('value')}
onChange={setValue}
value={value}
/>
)}
<Input
help={t<string>('A hex or string value that acts as a salt for this deployment.')}
isDisabled={!withSalt}