forked from Astrea-Payouts/astrea
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfees.ts
More file actions
20 lines (18 loc) · 734 Bytes
/
Copy pathfees.ts
File metadata and controls
20 lines (18 loc) · 734 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// ADR-005: Trustless Work charges a fixed, hardcoded 0.3% protocol fee per
// milestone release, confirmed against the K01 spike and TW's own whitepaper.
export const TRUSTLESS_WORK_FEE_RATE = 0.003;
export function netAmountAfterFee(
grossAmount: number,
platformFeeRate = 0,
): number {
return grossAmount * (1 - TRUSTLESS_WORK_FEE_RATE - platformFeeRate);
}
// product-flows.md Flow 2: the organizer's opt-in "cover the fee" amount —
// funding this instead of the raw prize makes the winner's net receipt equal
// the advertised prize exactly.
export function amountToFundForExactNet(
targetNetAmount: number,
platformFeeRate = 0,
): number {
return targetNetAmount / (1 - TRUSTLESS_WORK_FEE_RATE - platformFeeRate);
}