mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-07-28 23:15:41 +00:00
fix(web): correct asset IDs/decimals + chain routing, string-BigInt amounts, presale signer
Fund-logic hardening (audit remediation):
- TransferModal: source asset id/decimals from the canonical MINTABLE_ASSETS
(wUSDT=1000, wDOT=1001, wETH=1002, wBTC=1003) instead of the wrong hardcoded
ids (BTC=3 was the deprecated "Old USDT", ETH=4, DOT=5). Route every non-native
asset through the Asset Hub api; only native HEZ uses the relay balances pallet.
Removes the latent wrong-asset / wrong-chain transfer.
- Replace BigInt(parseFloat(x)*10**dec) with string-based parseTokenInput in
TransferModal + 3 DEX init modals; BigInt(float) threw RangeError on common
fractional amounts (e.g. 100.3 HEZ), breaking sends and pool/bridge init.
- Presale.contribute now resolves a signer via getSigner and passes { signer }
to signAndSend (was signer-less -> broken for all users).
- presale.ts contribute/refund/claimVested now reject on dropped/invalid/usurped/
retracted tx states instead of hanging the UI forever.
This commit is contained in:
@@ -445,6 +445,10 @@ export async function contribute(
|
||||
if (status.isInBlock) {
|
||||
onStatus?.('Transaction in block...');
|
||||
}
|
||||
if (status.isDropped || status.isInvalid || status.isUsurped || status.isRetracted) {
|
||||
resolve({ success: false, error: 'Transaction was dropped or invalidated by the network. Please try again.' });
|
||||
return;
|
||||
}
|
||||
if (status.isFinalized) {
|
||||
if (dispatchError) {
|
||||
let errorMessage = 'Transaction failed';
|
||||
@@ -489,6 +493,10 @@ export async function refund(
|
||||
if (status.isInBlock) {
|
||||
onStatus?.('Refund in block...');
|
||||
}
|
||||
if (status.isDropped || status.isInvalid || status.isUsurped || status.isRetracted) {
|
||||
resolve({ success: false, error: 'Refund was dropped or invalidated by the network. Please try again.' });
|
||||
return;
|
||||
}
|
||||
if (status.isFinalized) {
|
||||
if (dispatchError) {
|
||||
let errorMessage = 'Refund failed';
|
||||
@@ -533,6 +541,10 @@ export async function claimVested(
|
||||
if (status.isInBlock) {
|
||||
onStatus?.('Claim in block...');
|
||||
}
|
||||
if (status.isDropped || status.isInvalid || status.isUsurped || status.isRetracted) {
|
||||
resolve({ success: false, error: 'Claim was dropped or invalidated by the network. Please try again.' });
|
||||
return;
|
||||
}
|
||||
if (status.isFinalized) {
|
||||
if (dispatchError) {
|
||||
let errorMessage = 'Claim failed';
|
||||
|
||||
Reference in New Issue
Block a user