Skip to content
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

Support for rollup mode when using fee token #252

Merged
merged 163 commits into from
Apr 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
163 commits
Select commit Hold shift + click to select a range
36e3996
Start of custom fee tokens for rollups
yahgwai Sep 18, 2024
84ef567
Do not exclude batch reports when using fee token
gvladika Sep 19, 2024
8125656
Add condition for submitting the batch report, and do the scaling
gvladika Sep 19, 2024
74f9939
Add IFeeTokenPricer
gvladika Sep 19, 2024
504dbc0
Add getter and setter for pricer to the interface
gvladika Sep 19, 2024
44f3986
Add setter for feeTokenPricer
gvladika Sep 19, 2024
ef4f1fb
Add missing param
gvladika Sep 19, 2024
a6a3f55
Use new SeqInbox init param
gvladika Sep 19, 2024
f3eb844
Make existing tests work with feeTokenPricer
gvladika Sep 20, 2024
2897ce6
Format
gvladika Sep 20, 2024
70f6ad4
Add setFeeTokenPricer tests
gvladika Sep 20, 2024
213039f
Fee token pricing deployment
yahgwai Sep 20, 2024
4c643e1
Merge branch 'custom-fee-rollup' of https://github.com/OffchainLabs/n…
yahgwai Sep 20, 2024
57f46ed
Revert if trying to set fee token pricer when fee token is not used
gvladika Sep 20, 2024
33420d4
Add fuzz test for different exchange rates
gvladika Sep 23, 2024
8a1dfdd
Handle overflow case due to too high exchange rate
gvladika Sep 23, 2024
252f599
Updated erc20rollupeventinbox to do gas price scaling
yahgwai Sep 25, 2024
e852b6a
Merge branch 'custom-fee-rollup' of https://github.com/OffchainLabs/n…
yahgwai Sep 25, 2024
a702a08
Added integration test for batch poster reimbursement
yahgwai Sep 26, 2024
86c5a94
Update rollupInitialized test
gvladika Sep 26, 2024
1bcf1aa
Refactor tests and check initial cost is properly reported
gvladika Sep 26, 2024
e752cb7
Merge branch 'custom-fee-rollup' of https://github.com/OffchainLabs/n…
yahgwai Sep 26, 2024
14297dc
Added fee token pricer arg
yahgwai Sep 26, 2024
e3217ed
Use token fee pricer testnode ref
yahgwai Sep 26, 2024
cf42d00
Updated int fee token tests
yahgwai Sep 26, 2024
f64df33
Formatting
yahgwai Sep 26, 2024
70c19e8
Updated comments
yahgwai Sep 26, 2024
e3a7f9b
Formatting
yahgwai Sep 26, 2024
fcb4950
Try tests with init
yahgwai Sep 26, 2024
483171b
Added separate job for e2e tests
yahgwai Sep 26, 2024
913bf45
Missed test name change
yahgwai Sep 26, 2024
2956969
Disable while true condition linting
yahgwai Sep 26, 2024
1f33876
Fixed 4844 tests
yahgwai Sep 26, 2024
f22ec8c
Added fee token pricer address zero to arb rollup spec
yahgwai Sep 26, 2024
2b57aac
Formatting
yahgwai Sep 26, 2024
e6b0beb
Updated orbit ame
yahgwai Sep 26, 2024
2f876cf
Updated sigs and storage
yahgwai Sep 26, 2024
fde0833
Added estimate gas
yahgwai Sep 26, 2024
14a10ef
L1 wal balance console
yahgwai Sep 26, 2024
20ebdbe
Console logging
yahgwai Sep 26, 2024
782c792
Added gas price estimation
yahgwai Sep 26, 2024
9f17bcb
Update Slither db, no new findings
gvladika Sep 27, 2024
7f4161f
Add fuzz test for rollupInitialized
gvladika Sep 27, 2024
960d7da
Add ConstantExchangeRatePricer
gvladika Sep 30, 2024
e3cf8ed
Add OwnerAdjustableExchangeRatePricer
gvladika Sep 30, 2024
d0d31d3
Add uniswap v2 dependency
gvladika Sep 30, 2024
fcd2938
Add uniswap lib
gvladika Sep 30, 2024
0513e38
Uniswap v2 twap draft
gvladika Oct 1, 2024
96d2592
Merge branch 'develop' into custom-fee-rollup
gzeoneth Oct 1, 2024
cf9a962
Use local math files
gvladika Oct 2, 2024
0cb90fd
Return exchange rate
gvladika Oct 2, 2024
640a497
AMM trade tracker draft
gvladika Oct 2, 2024
93df126
Return exchange rate
gvladika Oct 2, 2024
d29724e
Add comments
gvladika Oct 2, 2024
3ce93dd
Fetch tokens
gvladika Oct 2, 2024
e0c7b7e
Add gas reporting hook
gvladika Oct 2, 2024
112c947
Update internal state
gvladika Oct 3, 2024
35aa8ac
Track exchange rate per spender
gvladika Oct 4, 2024
a90cc14
No need for ownable
gvladika Oct 4, 2024
85799f7
Avoid underflow
gvladika Oct 4, 2024
6ecce41
Owner sets deafult exchange rate
gvladika Oct 7, 2024
fc92cd2
Prvoide min amount of eth received to protect from slippage
gvladika Oct 7, 2024
a026be3
Scale to 18 decimals
gvladika Oct 7, 2024
db28e56
Use safe erc20
gvladika Oct 8, 2024
84090aa
Test swapTokenToEth
gvladika Oct 8, 2024
c003251
Test getExchangeRate
gvladika Oct 8, 2024
93fba73
Fix >18 decimals scaling
gvladika Oct 9, 2024
8475b0a
Simplify token spending calculation
gvladika Oct 9, 2024
2e5b248
Test state updates after batch is posted
gvladika Oct 9, 2024
a76a104
Make calldata cost adjustable
gvladika Oct 9, 2024
635cb84
No updates if ethAcc is 0
gvladika Oct 9, 2024
382b7f5
Control who can call gas hook and update internal state
gvladika Oct 9, 2024
58ca937
Add events and custom error
gvladika Oct 9, 2024
bf402da
Merge branch 'develop' into custom-fee-rollup
gvladika Oct 9, 2024
e071dde
Clean up
gvladika Oct 9, 2024
f050fdb
Update slither db
gvladika Oct 9, 2024
c015aaf
Update audit-ci.jsonc
gvladika Oct 9, 2024
5ba5abc
Provide trade deadline from outside
gvladika Oct 23, 2024
95a693e
Move fork tests to separate file
gvladika Oct 24, 2024
9193c21
Merge branch 'custom-fee-rollup' into fee-token-pricers
gvladika Oct 24, 2024
5711d1e
Updated format command
yahgwai Nov 28, 2024
d34fb05
Comment updates
yahgwai Nov 28, 2024
2cd9b03
Merge from develop
yahgwai Nov 28, 2024
931670e
Updated slither
yahgwai Nov 28, 2024
988b807
Updated slither
yahgwai Nov 28, 2024
51da15a
Merge from bold-merge
yahgwai Nov 29, 2024
5d4d1f9
Formatting
yahgwai Nov 29, 2024
af2754f
Updated signatures and storage
yahgwai Nov 29, 2024
36a4e3b
Slither
yahgwai Nov 29, 2024
049c5b2
Merge from custom-fee-rollup
yahgwai Nov 29, 2024
d7d3d1a
Toml update
yahgwai Nov 29, 2024
89542c1
Formatting and uniswap install
yahgwai Nov 29, 2024
9f56d06
Added trade tracker instead of amm trade tracker, and a readme
yahgwai Dec 13, 2024
b7a86ac
Updated readme and comments
yahgwai Dec 20, 2024
d6ed473
Merge from develop
yahgwai Dec 20, 2024
b805e8c
Formatting
yahgwai Dec 20, 2024
0858206
Merge branch 'custom-fee-rollup' into fee-token-pricers
yahgwai Dec 20, 2024
b757f17
Formatting
yahgwai Dec 20, 2024
bc05a75
Merge branch 'develop' into custom-fee-rollup
yahgwai Jan 10, 2025
57c8790
Updated fee token pricer zero in test helpers
yahgwai Jan 10, 2025
1ce7f05
Updated force include spec
yahgwai Jan 10, 2025
f514986
Merge branch 'custom-fee-rollup' into fee-token-pricers
gzeoneth Jan 13, 2025
f36b141
Test timeout action testnode
yahgwai Jan 14, 2025
d80ffd6
Dummy commit
yahgwai Jan 14, 2025
01be2d4
Fixed seq inbox tests
yahgwai Jan 21, 2025
a01c67f
Whitespace change
yahgwai Jan 29, 2025
c6c9340
Merge branch 'custom-fee-rollup' into fee-token-pricers
yahgwai Jan 29, 2025
c74fcb3
Use stable foundry
yahgwai Jan 30, 2025
fabf92f
Use main testnode
yahgwai Jan 30, 2025
473f602
Added pos arg
yahgwai Feb 4, 2025
d1c7ed6
Test ci
yahgwai Feb 5, 2025
9fb10c0
Try known arg combination
yahgwai Feb 6, 2025
198c0ba
Try different startup
yahgwai Feb 6, 2025
e264f22
Added pos arg
yahgwai Feb 6, 2025
7484023
Added no wait for l3 token bridge
yahgwai Feb 6, 2025
c2786a4
Added testnode ref
yahgwai Feb 6, 2025
afa248e
Removed reference to fee token pricer branch
yahgwai Feb 6, 2025
0137620
Try fee token pricer ref branch
yahgwai Feb 6, 2025
cf43bf7
Added fee token pricer args
yahgwai Feb 6, 2025
206f989
Use named branch
yahgwai Feb 7, 2025
043efa5
Comment commit
yahgwai Feb 7, 2025
d15f9d7
Added rollup creation changes
yahgwai Feb 7, 2025
fbafe1b
Merge branch 'develop' into custom-fee-rollup-ci
godzillaba Feb 7, 2025
27c28db
Merge pull request #302 from OffchainLabs/custom-fee-rollup-ci
yahgwai Feb 7, 2025
b52d292
Test output
yahgwai Feb 7, 2025
ae6d598
Merge branch 'custom-fee-rollup' of https://github.com/OffchainLabs/n…
yahgwai Feb 7, 2025
87b8501
Try timeout testnode
yahgwai Feb 7, 2025
c08389f
Add non zero loser stake escrow
yahgwai Feb 9, 2025
bb76d63
Added todo
yahgwai Feb 11, 2025
51a475a
Comment updates
yahgwai Feb 11, 2025
0481e0b
Merge branch 'custom-fee-rollup' into fee-token-pricers
yahgwai Feb 11, 2025
c9b45d3
Formatting
yahgwai Feb 11, 2025
c4ee8b8
Formatting
yahgwai Feb 11, 2025
13f2cac
Merge branch 'custom-fee-rollup' into fee-token-pricers
yahgwai Feb 11, 2025
9d647fe
fix: hardhat deploy getContract is deprecated
gzeoneth Mar 28, 2025
f5d1864
fix: unused
gzeoneth Mar 28, 2025
bff0c73
fix: test edge case
gzeoneth Mar 28, 2025
ae2d7a4
Merge branch 'develop' into fix-hh-deploy
gzeoneth Mar 28, 2025
72a991f
Merge branch 'develop' into fix-hh-deploy
gzeoneth Mar 28, 2025
b7844e9
Merge pull request #281 from OffchainLabs/fee-token-pricers
gzeoneth Mar 28, 2025
54d524f
Merge remote-tracking branch 'origin/develop' into custom-fee-rollup
gzeoneth Mar 28, 2025
75c15a3
ci: update testnode ref
gzeoneth Mar 28, 2025
3bdd739
chore: fix 4b and storage
gzeoneth Mar 28, 2025
f3388e6
fix: skip custom fee token test for eth rollup
gzeoneth Mar 28, 2025
86148f4
fix: use delay proof sig
gzeoneth Mar 28, 2025
b75bb2f
fix: isbold true
gzeoneth Mar 28, 2025
9ee8b8b
fix: stylus test
gzeoneth Mar 29, 2025
df733b4
chore: update RollupCreated event sig
gzeoneth Mar 29, 2025
ea236d9
chore: speed up confirmation
gzeoneth Mar 29, 2025
41518ea
fix: dummy stake token
gzeoneth Mar 29, 2025
b49dacf
test: workaround
gzeoneth Mar 29, 2025
ef18d1b
ci: run all e2e
gzeoneth Mar 29, 2025
2f27309
ci: skip test if the fee token pricer is not set
gzeoneth Mar 29, 2025
a3c2313
ci: dont wait forever
gzeoneth Mar 29, 2025
11fa729
Merge remote-tracking branch 'origin/fix-hh-deploy' into custom-fee-r…
gzeoneth Mar 29, 2025
a019af9
Merge branch 'develop' into custom-fee-rollup
godzillaba Apr 1, 2025
2a6127f
docs: remove stale comment
gzeoneth Apr 2, 2025
8aba166
chore: remove unused import
gzeoneth Apr 2, 2025
611b13d
feat: FeeTokenPricerSet event (#324)
gzeoneth Apr 2, 2025
2d98680
Merge remote-tracking branch 'origin/develop' into custom-fee-rollup
gzeoneth Apr 10, 2025
2db313a
chore: remove patch
gzeoneth Apr 10, 2025
052546a
chore: update slither db
gzeoneth Apr 10, 2025
9d0e90e
release: v3.1.0
gzeoneth Apr 10, 2025
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
163 changes: 83 additions & 80 deletions .github/workflows/contract-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,101 +154,104 @@ jobs:

- name: Test 4844
run: yarn test:4844
# test-e2e:
# name: Test e2e
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# with:
# submodules: recursive

# - uses: OffchainLabs/actions/run-nitro-test-node@main
# with:
# l3-node: true
# no-token-bridge: true
# no-l3-token-bridge: true
# nitro-contracts-branch: '${{ github.event.pull_request.head.sha || github.sha }}'
# nitro-testnode-ref: node-18
test-e2e:
name: Test e2e
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

# - name: Setup node/yarn
# uses: actions/setup-node@v3
# with:
# node-version: 18
# cache: 'yarn'
# cache-dependency-path: '**/yarn.lock'
- uses: OffchainLabs/actions/run-nitro-test-node@main
with:
l3-node: true
no-token-bridge: true
no-l3-token-bridge: true
nitro-contracts-branch: '${{ github.event.pull_request.head.sha || github.sha }}'
nitro-testnode-ref: v3-support

# - name: Install packages
# run: yarn
- name: Setup node/yarn
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'

# - name: Compile contracts
# run: yarn build
- name: Install packages
run: yarn

# - name: Run e2e tests
# run: yarn test:e2e
# test-e2e-custom-fee-token:
# name: Test e2e custom fee token
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# with:
# submodules: recursive
- name: Compile contracts
run: yarn build

# - uses: OffchainLabs/actions/run-nitro-test-node@main
# with:
# l3-node: true
# args: --l3-fee-token
# no-token-bridge: true
# no-l3-token-bridge: true
# nitro-contracts-branch: '${{ github.event.pull_request.head.sha || github.sha }}'
# nitro-testnode-ref: node-18
- name: Run e2e tests
run: yarn test:e2e

# - name: Setup node/yarn
# uses: actions/setup-node@v3
# with:
# node-version: 18
# cache: 'yarn'
# cache-dependency-path: '**/yarn.lock'
test-e2e-custom-fee-token:
name: Test e2e custom fee token
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

# - name: Install packages
# run: yarn
- uses: OffchainLabs/actions/run-nitro-test-node@main
with:
l3-node: true
args: --l3-fee-token
no-token-bridge: true
no-l3-token-bridge: true
nitro-contracts-branch: '${{ github.event.pull_request.head.sha || github.sha }}'
nitro-testnode-ref: v3-support

# - name: Compile contracts
# run: yarn build
- name: Setup node/yarn
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'

# - name: Run e2e tests
# run: yarn test:e2e
# test-e2e-fee-token-6-decimals:
# name: Test e2e fee token with 6 decimals
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# with:
# submodules: recursive
- name: Install packages
run: yarn

# - uses: OffchainLabs/actions/run-nitro-test-node@main
# with:
# l3-node: true
# args: --l3-fee-token --l3-fee-token-decimals 6
# no-token-bridge: true
# no-l3-token-bridge: true
# nitro-contracts-branch: '${{ github.event.pull_request.head.sha || github.sha }}'
# nitro-testnode-ref: 'non18-decimal-token-node-18'
- name: Compile contracts
run: yarn build

# - name: Setup node/yarn
# uses: actions/setup-node@v3
# with:
# node-version: 18
# cache: 'yarn'
# cache-dependency-path: '**/yarn.lock'
- name: Run e2e tests
run: yarn test:e2e

# - name: Install packages
# run: yarn
test-e2e-fee-token-6-decimals:
name: Test e2e fee token with 6 decimals and pricer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

# - name: Compile contracts
# run: yarn build
- uses: OffchainLabs/actions/run-nitro-test-node@main
with:
l3-node: true
args: --l3-fee-token --l3-fee-token-pricer --l3-fee-token-decimals 6
no-token-bridge: true
no-l3-token-bridge: true
nitro-testnode-ref: v3-support
nitro-contracts-branch: '${{ github.event.pull_request.head.sha || github.sha }}'

- name: Setup node/yarn
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'

- name: Install packages
run: yarn

- name: Compile contracts
run: yarn build

# - name: Run e2e tests
# run: yarn test:e2e
- name: Run e2e tests
run: yarn test:e2e

# bold-upgrade:
# name: BOLD upgrade test
Expand Down
14 changes: 10 additions & 4 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
src = 'src'
out = 'out'
libs = ['node_modules', 'lib']
cache_path = 'forge-cache/sol'
test = 'test/foundry'
cache_path = 'forge-cache/sol'
optimizer = true
optimizer_runs = 2000
via_ir = false
Expand All @@ -11,14 +12,16 @@ remappings = ['ds-test/=lib/forge-std/lib/ds-test/src/',
'forge-std/=lib/forge-std/src/',
'@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/',
'@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/',
'@offchainlabs/upgrade-executor/=node_modules/@offchainlabs/upgrade-executor/']
'@offchainlabs/upgrade-executor/=node_modules/@offchainlabs/upgrade-executor/',
'@uniswap/v2-core/=node_modules/@uniswap/v2-core/contracts',
'@uniswap/lib/=node_modules/@uniswap/lib/contracts']
fs_permissions = [{ access = "read", path = "./"}]

[profile.yul]
src = 'yul'
out = 'out/yul'
libs = ['node_modules', 'lib']
cache_path = 'forge-cache/yul'
cache_path = 'forge-cache/yul'
remappings = []
auto_detect_remappings = false

Expand All @@ -38,4 +41,7 @@ ignore = []
contract_new_lines = false
sort_imports = false

# See more config options https://github.com/foundry-rs/foundry/tree/master/config
[fuzz]
runs = 1000

# See more config options https://github.com/foundry-rs/foundry/tree/master/config
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@arbitrum/nitro-contracts",
"version": "3.0.1",
"version": "3.1.0",
"description": "Layer 2 precompiles and rollup for Arbitrum Nitro",
"author": "Offchain Labs, Inc.",
"license": "BUSL-1.1",
Expand Down Expand Up @@ -39,6 +39,8 @@
"test:compatibility": "yarn run build:0.6 && yarn run build:0.7",
"test:storage": "./test/storage/test.bash",
"test:signatures": "./test/signatures/test-sigs.bash",
"test:e2e:orbit": "hardhat test test/e2e/orbitChain.ts",
"test:e2e:orbit-fee-token-rollup": "hardhat test test/e2e/customFeeRollup.ts",
"test:e2e": "hardhat test test/e2e/*.ts",
"test:e2e:stylus": "hardhat test test/e2e/stylusDeployer.ts",
"test:upgrade": "./scripts/testUpgrade.bash",
Expand All @@ -51,6 +53,7 @@
"deploy-eth-rollup": "hardhat run scripts/createEthRollup.ts",
"deploy-erc20-rollup": "hardhat run scripts/createERC20Rollup.ts",
"create-rollup-testnode": "hardhat run scripts/local-deployment/deployCreatorAndCreateRollup.ts",
"slither-triage": "slither . --skip-assembly --triage-mode",
"script:bold-prepare": "hardhat run ./scripts/prepareBoldUpgrade.ts",
"script:bold-populate-lookup": "hardhat run ./scripts/populateLookup.ts",
"script:bold-local-execute": "hardhat run ./scripts/executeBoldUpgrade.ts",
Expand Down Expand Up @@ -78,6 +81,8 @@
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/eslint-plugin-tslint": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"@uniswap/lib": "^4.0.1-alpha",
"@uniswap/v2-core": "^1.0.1",
"audit-ci": "^6.6.1",
"chai": "^4.5.0",
"dotenv": "^16.4.7",
Expand Down
14 changes: 13 additions & 1 deletion scripts/createERC20Rollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,24 @@ async function main() {
throw new Error('STAKE_TOKEN_ADDRESS not set')
}

console.log('Creating new rollup with', customFeeTokenAddress, 'as fee token')
let feeTokenPricer = process.env.FEE_TOKEN_PRICER_ADDRESS
if (!feeTokenPricer) {
feeTokenPricer = ethers.constants.AddressZero
}

console.log(
'Creating new rollup with',
customFeeTokenAddress,
'as fee token and',
feeTokenPricer,
'as fee token pricer'
)
await createRollup(
deployer,
false,
rollupCreatorAddress,
customFeeTokenAddress,
feeTokenPricer,
stakeTokenAddress
)
}
Expand Down
2 changes: 2 additions & 0 deletions scripts/createEthRollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { createRollup } from './rollupCreation'

async function main() {
const feeToken = ethers.constants.AddressZero
const feeTokenPricer = ethers.constants.AddressZero
const rollupCreatorAddress = process.env.ROLLUP_CREATOR_ADDRESS
if (!rollupCreatorAddress) {
throw new Error('ROLLUP_CREATOR_ADDRESS not set')
Expand All @@ -21,6 +22,7 @@ async function main() {
false,
rollupCreatorAddress,
feeToken,
feeTokenPricer,
stakeTokenAddress
)
}
Expand Down
5 changes: 5 additions & 0 deletions scripts/local-deployment/deployCreatorAndCreateRollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ async function main() {
if (!feeToken) {
feeToken = ethers.constants.AddressZero
}
let feeTokenPricer = process.env.FEE_TOKEN_PRICER_ADDRESS as string
if (!feeTokenPricer) {
feeTokenPricer = ethers.constants.AddressZero
}

/// get stake token address, if undefined deploy WETH and set it as stake token
let stakeToken = process.env.STAKE_TOKEN_ADDRESS as string
Expand Down Expand Up @@ -88,6 +92,7 @@ async function main() {
true,
contracts.rollupCreator.address,
feeToken,
feeTokenPricer,
stakeToken
)

Expand Down
17 changes: 13 additions & 4 deletions scripts/rollupCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import '@nomiclabs/hardhat-ethers'
import { run } from 'hardhat'
import { abi as rollupCreatorAbi } from '../build/contracts/src/rollup/RollupCreator.sol/RollupCreator.json'
import { config, maxDataSize } from './config'
import { BigNumber, Signer } from 'ethers'
import { BigNumber, Event, Signer } from 'ethers'
import { ERC20, ERC20__factory, IERC20__factory } from '../build/types'
import { sleep } from './testSetup'
import { promises as fs } from 'fs'
Expand Down Expand Up @@ -66,6 +66,7 @@ export async function createRollup(
isDevDeployment: boolean,
rollupCreatorAddress: string,
feeToken: string,
feeTokenPricer: string,
stakeToken: string
): Promise<{
rollupCreationResult: RollupCreationResult
Expand All @@ -81,7 +82,7 @@ export async function createRollup(
rollupCreatorAddress,
rollupCreatorAbi,
signer
)
) as RollupCreator
const validatorWalletCreator = await rollupCreator.validatorWalletCreator()

try {
Expand All @@ -106,7 +107,12 @@ export async function createRollup(
// Call the createRollup function
console.log('Calling createRollup to generate a new rollup ...')
const deployParams = isDevDeployment
? await _getDevRollupConfig(feeToken, validatorWalletCreator, stakeToken)
? await _getDevRollupConfig(
feeToken,
feeTokenPricer,
validatorWalletCreator,
stakeToken
)
: {
config: config.rollupConfig,
validators: config.validators,
Expand All @@ -116,6 +122,7 @@ export async function createRollup(
maxFeePerGasForRetryables: MAX_FER_PER_GAS,
batchPosters: config.batchPosters,
batchPosterManager: config.batchPosterManager,
feeTokenPricer: feeTokenPricer,
}

const createRollupTx = await rollupCreator.createRollup(deployParams, {
Expand All @@ -124,7 +131,7 @@ export async function createRollup(
const createRollupReceipt = await createRollupTx.wait()

const rollupCreatedEvent = createRollupReceipt.events?.find(
(event: RollupCreatedEvent) =>
(event: Event): event is Event =>
event.event === 'RollupCreated' &&
event.address.toLowerCase() === rollupCreatorAddress.toLowerCase()
)
Expand Down Expand Up @@ -225,6 +232,7 @@ export async function createRollup(

async function _getDevRollupConfig(
feeToken: string,
feeTokenPricer: string,
validatorWalletCreator: string,
stakeToken: string
): Promise<RollupCreator.RollupDeploymentParamsStruct> {
Expand Down Expand Up @@ -347,6 +355,7 @@ async function _getDevRollupConfig(
maxFeePerGasForRetryables: MAX_FER_PER_GAS,
batchPosters: batchPosters,
batchPosterManager: batchPosterManager,
feeTokenPricer: feeTokenPricer,
}

function _createValidatorAddress(
Expand Down
2 changes: 1 addition & 1 deletion slither.db.json

Large diffs are not rendered by default.

Loading