Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/warm-eagles-glow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@exactly/mobile": patch
---

🐛 align propose and execute block timestamps
22 changes: 19 additions & 3 deletions src/utils/useSimulateProposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,25 @@ export default function useSimulateProposal({
args: account ? [account] : undefined,
},
{ address: multicall3Address, abi: multicall3Abi, functionName: "getCurrentBlockTimestamp" },
{
address: multicall3Address,
abi: [
{
type: "function",
name: "getBlockNumber",
inputs: [],
outputs: [{ type: "uint256" }],
stateMutability: "view",
},
],
functionName: "getBlockNumber",
},
Comment thread
devin-ai-integration[bot] marked this conversation as resolved.
Comment thread
cruzdanilo marked this conversation as resolved.
{ address: exaPreviewerAddress, abi: exaPreviewerAbi, functionName: "assets" },
] as const,
allowFailure: true,
query: { enabled: enabled && !!account },
});
const [plugins, delay, nonce, timestamp, assets] = reads ?? [];
const [plugins, delay, nonce, timestamp, blockNumber, assets] = reads ?? [];
const installedPlugins = plugins?.status === "success" ? plugins.result : undefined;
const { data: pluginMetadata } = useReadExaPluginPluginMetadata({
address: installedPlugins?.[0],
Expand Down Expand Up @@ -153,8 +166,10 @@ export default function useSimulateProposal({
args: [nonce.result] as const,
};
const simulation = useSimulateBlocks({
blockNumber: blockNumber?.status === "success" ? blockNumber.result : undefined,
blocks: [
{
blockOverrides: timestamp?.status === "success" ? { time: timestamp.result } : undefined,
Comment thread
cruzdanilo marked this conversation as resolved.
calls: request
? [
{
Expand All @@ -167,7 +182,7 @@ export default function useSimulateProposal({
},
{
blockOverrides:
delay?.status === "success" && timestamp?.status === "success"
timestamp?.status === "success" && delay?.status === "success"
? { time: timestamp.result + delay.result }
: undefined,
calls: executeRequest
Expand All @@ -192,7 +207,8 @@ export default function useSimulateProposal({
request !== undefined &&
executeRequest !== undefined &&
delay?.status === "success" &&
timestamp?.status === "success",
timestamp?.status === "success" &&
blockNumber?.status === "success",
},
});
const propose = simulation.data?.[0]?.calls[0];
Expand Down
Loading