@wopr-network/platform-core 1.35.1 → 1.35.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/billing/crypto/btc/settler.js +3 -2
- package/dist/billing/crypto/evm/eth-settler.js +3 -1
- package/dist/billing/crypto/unified-checkout.js +1 -1
- package/package.json +1 -1
- package/src/billing/crypto/btc/settler.ts +3 -2
- package/src/billing/crypto/evm/eth-settler.ts +3 -1
- package/src/billing/crypto/unified-checkout.ts +1 -1
|
@@ -28,8 +28,9 @@ export async function settleBtcPayment(deps, event) {
|
|
|
28
28
|
if (await creditLedger.hasReferenceId(creditRef)) {
|
|
29
29
|
return { handled: true, status: "Settled", tenant: charge.tenantId, creditedCents: 0 };
|
|
30
30
|
}
|
|
31
|
-
//
|
|
32
|
-
|
|
31
|
+
// 2% underpayment tolerance for oracle price drift between checkout and settlement.
|
|
32
|
+
const UNDERPAYMENT_TOLERANCE = 0.98;
|
|
33
|
+
if (event.amountUsdCents < charge.amountUsdCents * UNDERPAYMENT_TOLERANCE) {
|
|
33
34
|
return { handled: true, status: "Settled", tenant: charge.tenantId, creditedCents: 0 };
|
|
34
35
|
}
|
|
35
36
|
const creditCents = charge.amountUsdCents;
|
|
@@ -26,7 +26,9 @@ export async function settleEthPayment(deps, event) {
|
|
|
26
26
|
if (await creditLedger.hasReferenceId(creditRef)) {
|
|
27
27
|
return { handled: true, status: "Settled", tenant: charge.tenantId, creditedCents: 0 };
|
|
28
28
|
}
|
|
29
|
-
|
|
29
|
+
// 2% underpayment tolerance for oracle price drift between checkout and settlement.
|
|
30
|
+
const UNDERPAYMENT_TOLERANCE = 0.98;
|
|
31
|
+
if (event.amountUsdCents < charge.amountUsdCents * UNDERPAYMENT_TOLERANCE) {
|
|
30
32
|
return { handled: true, status: "Settled", tenant: charge.tenantId, creditedCents: 0 };
|
|
31
33
|
}
|
|
32
34
|
const creditCents = charge.amountUsdCents;
|
|
@@ -53,7 +53,7 @@ async function handleNativeEvm(deps, method, tenant, amountUsdCents, amountUsd)
|
|
|
53
53
|
amountUsd,
|
|
54
54
|
token: "ETH",
|
|
55
55
|
chain: method.chain,
|
|
56
|
-
referenceId:
|
|
56
|
+
referenceId: `${method.type}:${method.chain}:${depositAddress}`,
|
|
57
57
|
priceCents,
|
|
58
58
|
};
|
|
59
59
|
}
|
package/package.json
CHANGED
|
@@ -44,8 +44,9 @@ export async function settleBtcPayment(deps: BtcSettlerDeps, event: BtcPaymentEv
|
|
|
44
44
|
return { handled: true, status: "Settled", tenant: charge.tenantId, creditedCents: 0 };
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
//
|
|
48
|
-
|
|
47
|
+
// 2% underpayment tolerance for oracle price drift between checkout and settlement.
|
|
48
|
+
const UNDERPAYMENT_TOLERANCE = 0.98;
|
|
49
|
+
if (event.amountUsdCents < charge.amountUsdCents * UNDERPAYMENT_TOLERANCE) {
|
|
49
50
|
return { handled: true, status: "Settled", tenant: charge.tenantId, creditedCents: 0 };
|
|
50
51
|
}
|
|
51
52
|
|
|
@@ -42,7 +42,9 @@ export async function settleEthPayment(deps: EthSettlerDeps, event: EthPaymentEv
|
|
|
42
42
|
return { handled: true, status: "Settled", tenant: charge.tenantId, creditedCents: 0 };
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
// 2% underpayment tolerance for oracle price drift between checkout and settlement.
|
|
46
|
+
const UNDERPAYMENT_TOLERANCE = 0.98;
|
|
47
|
+
if (event.amountUsdCents < charge.amountUsdCents * UNDERPAYMENT_TOLERANCE) {
|
|
46
48
|
return { handled: true, status: "Settled", tenant: charge.tenantId, creditedCents: 0 };
|
|
47
49
|
}
|
|
48
50
|
|