File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
modules/sdk-coin-flrp/src/lib Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,8 @@ export const MINIMUM_FEE = '1000000'; // 1M nanoFLR minimum fee
3030
3131// Validator constants
3232export const MIN_DELEGATION_FEE_BASIS_POINTS = 20000 ; // 2% minimum delegation fee
33+ export const BASIS_POINTS_DIVISOR = 10000 ; // Divisor to convert basis points to decimal
34+ export const PERCENTAGE_MULTIPLIER = 100 ; // Multiplier to convert decimal to percentage
3335
3436// Transaction ID prefix
3537export const TRANSACTION_ID_PREFIX = 'flare-atomic-tx-' ; // Prefix for transaction IDs
Original file line number Diff line number Diff line change @@ -5,10 +5,12 @@ import { Tx } from './iface';
55import { TransactionWithExtensions } from './types' ;
66import {
77 ADD_PERMISSIONLESS_VALIDATOR_TYPE ,
8+ BASIS_POINTS_DIVISOR ,
89 BLS_PUBLIC_KEY_COMPRESSED_LENGTH ,
910 BLS_PUBLIC_KEY_UNCOMPRESSED_LENGTH ,
1011 BLS_SIGNATURE_LENGTH ,
1112 MIN_DELEGATION_FEE_BASIS_POINTS ,
13+ PERCENTAGE_MULTIPLIER ,
1214} from './constants' ;
1315import { createHexRegex } from './utils' ;
1416
@@ -162,9 +164,12 @@ export class PermissionlessValidatorTxBuilder extends AtomicTransactionBuilder {
162164 */
163165 validateDelegationFeeRate ( delegationFeeRate : number ) : void {
164166 // For Flare, use a minimum delegation fee of 2% (20000 basis points)
165- const minDelegationFee = MIN_DELEGATION_FEE_BASIS_POINTS ; // 2%
167+ const minDelegationFee = MIN_DELEGATION_FEE_BASIS_POINTS ;
166168 if ( delegationFeeRate < minDelegationFee ) {
167- throw new BuildTransactionError ( `Delegation fee cannot be less than ${ minDelegationFee } basis points (2%)` ) ;
169+ const minDelegationFeePercent = ( minDelegationFee / BASIS_POINTS_DIVISOR ) * PERCENTAGE_MULTIPLIER ;
170+ throw new BuildTransactionError (
171+ `Delegation fee cannot be less than ${ minDelegationFee } basis points (${ minDelegationFeePercent } %)`
172+ ) ;
168173 }
169174 }
170175
You can’t perform that action at this time.
0 commit comments