Skip to content

Commit 19bbfc9

Browse files
committed
fix: address feedback
1 parent 06192a0 commit 19bbfc9

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

packages/nextjs/components/oracle/PriceWidget.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ export const PriceWidget = ({ contractName }: PriceWidgetProps) => {
4444
prevPrice.current = currentPrice;
4545
}, [currentPrice]);
4646

47-
console.log(currentPrice, isLoading, isError);
48-
4947
return (
5048
<div className="flex flex-col gap-2">
5149
<h2 className="text-xl font-bold">Current Price</h2>

packages/nextjs/components/oracle/optimistic/SubmitAssertionButton.tsx

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ import { useGlobalState } from "~~/services/store/store";
1010
import { getRandomQuestion } from "~~/utils/helpers";
1111
import { notification } from "~~/utils/scaffold-eth";
1212

13+
const MINIMUM_REWARD = 0.21;
14+
const MINIMUM_ASSERTION_WINDOW = 3;
15+
1316
const 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

1922
const 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

Comments
 (0)