Skip to content
Open
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
6 changes: 6 additions & 0 deletions scripts/proposals/NovaFeeSweep/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"arbSysSendTxToL1Args": {
"l1Timelock": "0xE6841D92B0C345144506576eC13ECf5103aC7f49",
"calldata": "0x01d5062a000000000000000000000000c4448b71118c9071bcb9734a0eac55d18a153949000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000001d64bfd58bbc5089313cbb4cac6bc0dc5cf3e849834e8a91537a8ba2ba553146000000000000000000000000000000000000000000000000000000000003f48000000000000000000000000000000000000000000000000000000000000001246e6e8a6a00000000000000000000000036d0170d92f66e8949eb276c3ac4fea64f83704d0000000000000000000000000000000000000000000000663a9d579527ee69800000000000000000000000000000000000000000000000000004f94ae6af800000000000000000000000000036d0170d92f66e8949eb276c3ac4fea64f83704d00000000000000000000000036d0170d92f66e8949eb276c3ac4fea64f83704d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
}
}
66 changes: 66 additions & 0 deletions scripts/proposals/NovaFeeSweep/generate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// generates a proposal payload to sweep the Nova L1 Timelock alias ETH balance to the fee router contract.

import { BigNumber, ethers } from 'ethers'
import {
IInbox__factory,
L1ArbitrumTimelock__factory,
} from '../../../typechain-types'
import { JsonRpcProvider } from '@ethersproject/providers'
import fs from 'fs'
import { keccak256, toUtf8Bytes } from 'ethers/lib/utils'
;(async () => {
const l1TimelockAlias = '0xf7951d92b0c345144506576ec13ecf5103ac905a'
const novaInbox = '0xc4448b71118c9071Bcb9734A0EAc55D18A153949'
const novaToParentRouter = '0x36D0170D92F66e8949eB276C3AC4FEA64f83704d'
const maxL1GasPrice = ethers.utils.parseUnits('1000', 'gwei') // used to calculate maxSubmissionCost
const aliasBalance = await new JsonRpcProvider(
'https://nova.arbitrum.io/rpc'
).getBalance(l1TimelockAlias)

const timelockIface = L1ArbitrumTimelock__factory.createInterface()
const inboxIface = IInbox__factory.createInterface()

const maxSubmissionCost = calcSubmissionCost(maxL1GasPrice)

const unsafeCreateRetryableCalldata = inboxIface.encodeFunctionData(
'unsafeCreateRetryableTicket',
[
novaToParentRouter, // to
aliasBalance.sub(maxSubmissionCost), // l2CallValue
maxSubmissionCost, // maxSubmissionCost
novaToParentRouter, // excessFeeRefundAddress
novaToParentRouter, // callValueRefundAddress
0, // gasLimit
0, // maxFeePerGas
'0x', // calldata
]
)
const scheduleCalldata = timelockIface.encodeFunctionData('schedule', [
novaInbox,
0,
unsafeCreateRetryableCalldata,
'0x0000000000000000000000000000000000000000000000000000000000000000',
keccak256(toUtf8Bytes('Nova Fee Sweep')),
259200,
])

const output = {
arbSysSendTxToL1Args: {
l1Timelock: '0xE6841D92B0C345144506576eC13ECf5103aC7f49',
calldata: scheduleCalldata,
},
}

console.log(output)

fs.writeFileSync(
'./scripts/proposals/NovaFeeSweep/data.json',
JSON.stringify(output, null, 2)
)
})()

function calcSubmissionCost(baseFee: BigNumber) {
// data length is zero
// from the contract: return (1400 + 6 * dataLength) * (baseFee == 0 ? block.basefee : baseFee);
return baseFee.mul(1400)
}