Skip to content

Commit 1f9bb0f

Browse files
committed
fix: max uint
1 parent a78826c commit 1f9bb0f

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

programs/defi-wrapper/use-cases/timelock-governance/common/write.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
callReadMethodSilent,
99
addressPrompt,
1010
textPrompt,
11+
stringToBigInt,
1112
} from 'utils';
1213
import { common } from './main.js';
1314
import { Address, Hex, stringToHex, isHex, Hash } from 'viem';
@@ -38,8 +39,11 @@ commonWrite
3839
.description('execute a scheduled timelock operation')
3940
.argument(...TIMELOCK_ARGUMENT)
4041
.argument('[target]', 'target contract address', stringToAddress)
41-
.argument('[value]', 'value to send (in ETH, default: 0)', (v) =>
42-
v ? BigInt(v) : 0n,
42+
.argument(
43+
'[value]',
44+
'ETH value to send (in wei, default: 0)',
45+
stringToBigInt,
46+
0n,
4347
)
4448
.argument('[payload]', 'call data payload (hex)')
4549
.option(

programs/defi-wrapper/use-cases/timelock-governance/pool/write.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
textPrompt,
2121
} from 'utils';
2222
import { pool } from './main.js';
23-
import { Address, encodeFunctionData } from 'viem';
23+
import { Address, encodeFunctionData, maxUint16 } from 'viem';
2424
import { getStvStethPoolContract } from 'contracts/defi-wrapper/index.js';
2525
import { StvPoolAbi, StvStETHPoolAbi } from 'abi/defi-wrapper/index.js';
2626

@@ -63,9 +63,9 @@ const promptMaxSocializablePortionBP = async (
6363
maxSocializablePortionBP = maxSocializablePortionBPInput;
6464
}
6565

66-
if (maxSocializablePortionBP < 0 || maxSocializablePortionBP > 65535) {
66+
if (maxSocializablePortionBP < 0 || maxSocializablePortionBP > maxUint16) {
6767
throw new Error(
68-
'maxSocializablePortionBP must be between 0 and 65535 (uint16)',
68+
`maxSocializablePortionBP must be between 0 and ${maxUint16} (uint16)`,
6969
);
7070
}
7171
return maxSocializablePortionBP;

0 commit comments

Comments
 (0)