-
Notifications
You must be signed in to change notification settings - Fork 10
Auto-Redeem + Expiry-Based Slack Alerts #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
27a35d8
add auto redeem
mahsamoosavi c2bf3dd
add private key to the env sample
mahsamoosavi 654a326
mark auto redeemed tickets as Ignore in Notion
mahsamoosavi cdb6d3e
Revert "mark auto redeemed tickets as Ignore in Notion"
mahsamoosavi 206d1af
update State to "Bot Success" or "Bot Failed" based on auto-redeem re…
mahsamoosavi 75439e3
Update packages/retryable-monitor/handlers/notion/alertUntriagedRetra…
mahsamoosavi dc1b174
Update packages/retryable-monitor/handlers/notion/alertUntriagedRetra…
mahsamoosavi 3682e0c
Merge remote-tracking branch 'origin/main' into add-auto-redeem
mahsamoosavi be41b10
Merge branch 'add-auto-redeem' of https://github.com/OffchainLabs/arb…
mahsamoosavi a47300a
improve retryable alert flow and rename Notion column to Bot Redempti…
mahsamoosavi fd77cf8
add explicit type for Notion query response to resolve TS7022
mahsamoosavi 2462f48
write 'Bot Redemption Status' on create/update/executed
mahsamoosavi 2bd9b9d
improve redeemRetryable with env check, existing redeem detection, an…
mahsamoosavi 163cc4d
update comments
mahsamoosavi 1508b46
add --autoRedeem flag to enable optional silent redemption of retryables
mahsamoosavi be12747
add 24–72h Slack alert for Should Redeem when auto-redeem is disabled
mahsamoosavi f01bdae
Rename env-sample's PRIVATE_KEY
mahsamoosavi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { providers, Wallet } from 'ethers' | ||
import { | ||
ParentTransactionReceipt, | ||
ParentToChildMessageStatus, | ||
} from '@arbitrum/sdk' | ||
import { getConfig, DEFAULT_CONFIG_PATH } from '../../utils' | ||
import dotenv from 'dotenv' | ||
|
||
dotenv.config() | ||
|
||
export const redeemRetryable = async (parentTxHash: string): Promise<string> => { | ||
mahsamoosavi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const config = getConfig({ configPath: DEFAULT_CONFIG_PATH }) | ||
|
||
for (const childChain of config.childChains) { | ||
try { | ||
const parentChainProvider = new providers.JsonRpcProvider(childChain.parentRpcUrl) | ||
const receipt = await parentChainProvider.getTransactionReceipt(parentTxHash) | ||
if (!receipt) continue // not found on this chain | ||
|
||
// If we found the receipt, this is our matching chain | ||
const childChainProvider = new providers.JsonRpcProvider(childChain.orbitRpcUrl) | ||
const wallet = new Wallet(process.env.PRIVATE_KEY!, childChainProvider) | ||
|
||
const parentReceipt = new ParentTransactionReceipt(receipt) | ||
const messages = await parentReceipt.getParentToChildMessages(wallet) | ||
const message = messages[0] | ||
|
||
const result = await message.getSuccessfulRedeem() | ||
if (result.status === ParentToChildMessageStatus.REDEEMED) { | ||
return result.childTxReceipt.transactionHash | ||
} | ||
|
||
const tx = await message.redeem() | ||
const redeemReceipt = await tx.waitForRedeem() | ||
return redeemReceipt.transactionHash | ||
} catch (err) { | ||
// Catch and move to next chain silently | ||
continue | ||
} | ||
} | ||
|
||
throw new Error(`❌ Parent tx ${parentTxHash} not found on any known parent chain.`) | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.