mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 15:11:02 +00:00
contracts: Fix some minor bugs around instantiation (#8879)
* Fix output of wrongly outputted error
The "Tombstoned a contract that is below the subsistence threshold: {:?}" was
triggered when too few balance was provided. It was a false alarm.
* Fix return of wrong code_len
* Split up `NotCallable` into more fine grained errors
* Fix typos in docs
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
* RentNotPayed -> RentNotPaid
* Fix typo: payed -> paid
It is OK to change the in-storage field name because:
1. The SCALE encoding is not based on names only on position.
2. The struct is not public (only to the crate).
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
This commit is contained in:
committed by
GitHub
parent
a28a517c53
commit
c92d4a2638
@@ -601,14 +601,16 @@ where
|
||||
let transfer_failed = Error::<E::T>::TransferFailed.into();
|
||||
let not_funded = Error::<E::T>::NewContractNotFunded.into();
|
||||
let no_code = Error::<E::T>::CodeNotFound.into();
|
||||
let invalid_contract = Error::<E::T>::NotCallable.into();
|
||||
let not_found = Error::<E::T>::ContractNotFound.into();
|
||||
let is_tombstone = Error::<E::T>::ContractIsTombstone.into();
|
||||
let rent_not_paid = Error::<E::T>::RentNotPaid.into();
|
||||
|
||||
match from {
|
||||
x if x == below_sub => Ok(BelowSubsistenceThreshold),
|
||||
x if x == transfer_failed => Ok(TransferFailed),
|
||||
x if x == not_funded => Ok(NewContractNotFunded),
|
||||
x if x == no_code => Ok(CodeNotFound),
|
||||
x if x == invalid_contract => Ok(NotCallable),
|
||||
x if (x == not_found || x == is_tombstone || x == rent_not_paid) => Ok(NotCallable),
|
||||
err => Err(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user