@@ -10,6 +10,9 @@ import { useGlobalState } from "~~/services/store/store";
1010import { getRandomQuestion } from "~~/utils/helpers" ;
1111import { notification } from "~~/utils/scaffold-eth" ;
1212
13+ const MINIMUM_REWARD = 0.21 ;
14+ const MINIMUM_ASSERTION_WINDOW = 3 ;
15+
1316const getStartTimestamp = ( timestamp : bigint , startInMinutes : string ) => {
1417 if ( startInMinutes . length === 0 ) return 0n ;
1518 if ( Number ( startInMinutes ) === 0 ) return 0n ;
@@ -18,7 +21,7 @@ const getStartTimestamp = (timestamp: bigint, startInMinutes: string) => {
1821
1922const getEndTimestamp = ( timestamp : bigint , startTimestamp : bigint , durationInMinutes : string ) => {
2023 if ( durationInMinutes . length === 0 ) return 0n ;
21- if ( Number ( durationInMinutes ) === 3 ) return 0n ;
24+ if ( Number ( durationInMinutes ) === MINIMUM_ASSERTION_WINDOW ) return 0n ;
2225 if ( startTimestamp === 0n ) return timestamp + BigInt ( durationInMinutes ) * 60n ;
2326 return startTimestamp + BigInt ( durationInMinutes ) * 60n ;
2427} ;
@@ -46,10 +49,18 @@ const SubmitAssertionModal = ({ isOpen, onClose }: SubmitAssertionModalProps) =>
4649
4750 const handleSubmit = async ( e : React . FormEvent ) => {
4851 e . preventDefault ( ) ;
49- if ( durationInMinutes . length > 0 && Number ( durationInMinutes ) < 3 ) {
50- notification . error ( "Duration must be at least 3 minutes or leave blank to use default value" ) ;
52+ if ( durationInMinutes . length > 0 && Number ( durationInMinutes ) < MINIMUM_ASSERTION_WINDOW ) {
53+ notification . error (
54+ `Duration must be at least ${ MINIMUM_ASSERTION_WINDOW } minutes or leave blank to use default value` ,
55+ ) ;
5156 return ;
5257 }
58+
59+ if ( Number ( reward ) < MINIMUM_REWARD ) {
60+ notification . error ( `Reward must be at least ${ MINIMUM_REWARD } ETH` ) ;
61+ return ;
62+ }
63+
5364 if ( ! publicClient ) {
5465 notification . error ( "Public client not found" ) ;
5566 return ;
@@ -164,7 +175,7 @@ const SubmitAssertionModal = ({ isOpen, onClose }: SubmitAssertionModalProps) =>
164175 </ label >
165176 < IntegerInput
166177 name = "reward"
167- placeholder = "0.22"
178+ placeholder = { `Minimum ${ MINIMUM_REWARD } ETH` }
168179 value = { reward }
169180 onChange = { newValue => setReward ( newValue ) }
170181 disableMultiplyBy1e18
@@ -190,7 +201,7 @@ const SubmitAssertionModal = ({ isOpen, onClose }: SubmitAssertionModalProps) =>
190201 </ label >
191202 < IntegerInput
192203 name = "endTime"
193- placeholder = " minimum 3 minutes"
204+ placeholder = { ` minimum ${ MINIMUM_ASSERTION_WINDOW } minutes` }
194205 value = { durationInMinutes }
195206 onChange = { newValue => setDurationInMinutes ( newValue ) }
196207 disableMultiplyBy1e18
0 commit comments