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

feat: add support for custom gas token #310

Merged
merged 216 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from 203 commits
Commits
Show all changes
216 commits
Select commit Hold shift + click to select a range
0f6d1ca
adjust genAbi script
spsjvc Jul 10, 2023
9e9ef4c
copy bridger class
spsjvc Jul 10, 2023
44633d8
add native token property to L2 networ
spsjvc Jul 11, 2023
a88f940
add approval implementation and tests
spsjvc Jul 11, 2023
8ee89e2
add deposit
spsjvc Jul 11, 2023
5f1de81
extend eth bridger
spsjvc Jul 11, 2023
a06abfc
clean up
spsjvc Jul 13, 2023
7186838
return providers from testSetup
spsjvc Jul 13, 2023
ba8c7d4
clean up more
spsjvc Jul 14, 2023
21e0b31
don't export types
spsjvc Jul 14, 2023
7c6c3dc
extract test helpers and rename file
spsjvc Jul 14, 2023
bc1d82b
add more assertions
spsjvc Jul 14, 2023
b35868c
add test
spsjvc Jul 14, 2023
0bc5723
enable creating retryable tickets via erc20inbox
spsjvc Jul 18, 2023
4fedf32
improve test setup
spsjvc Jul 19, 2023
41913f7
cleanup
spsjvc Jul 19, 2023
2c5fb7c
add withdrawal test
spsjvc Jul 19, 2023
d19498e
clean up
spsjvc Jul 19, 2023
9193a0d
rename stuff
spsjvc Jul 19, 2023
1c426d7
test setup for custom fee token
spsjvc Jul 19, 2023
d149a0f
update to public and update comment
spsjvc Jul 19, 2023
374e894
improve approvals
spsjvc Jul 19, 2023
ff15160
remove async
spsjvc Jul 19, 2023
65ca1f2
refactor
spsjvc Jul 19, 2023
b5f747c
remove field
spsjvc Jul 19, 2023
78b13c1
refactor
spsjvc Jul 19, 2023
2ed6fcd
extract func
spsjvc Jul 19, 2023
522f852
add await
spsjvc Jul 19, 2023
363f988
unused imports
spsjvc Jul 19, 2023
828c529
add methods for approving custom fee token for gateways
spsjvc Jul 19, 2023
2e8143c
reverse cases
spsjvc Jul 19, 2023
fd63bb1
remove unused imports
spsjvc Jul 19, 2023
3033b90
reverse cases
spsjvc Jul 19, 2023
0dbdcaa
support erc-20 deposits paid by custom fee token
spsjvc Jul 19, 2023
4c67e85
rename stuff
spsjvc Jul 19, 2023
d75bddf
just commit
spsjvc Aug 2, 2023
11c1f8a
support L2 parent chains
brtkx Aug 2, 2023
7f758a5
add partnerChainIDs
brtkx Aug 2, 2023
b477a8a
extra error message
brtkx Aug 4, 2023
e14337b
update
brtkx Aug 9, 2023
8936273
add jsdoc
brtkx Aug 9, 2023
9ba357c
fix issues
brtkx Aug 9, 2023
50820b0
try thing
spsjvc Aug 10, 2023
f408fad
add parentChains, chains
brtkx Aug 11, 2023
0b030c2
reduce diff
brtkx Aug 11, 2023
2fd86ec
reduce diff
brtkx Aug 11, 2023
8205daa
clean up
brtkx Aug 11, 2023
2954097
clean up
brtkx Aug 11, 2023
96b7c23
fix addCustomNetwork
brtkx Aug 11, 2023
6365728
comment
brtkx Aug 11, 2023
2100d07
fix comments and addCustomNetwork
brtkx Aug 11, 2023
413f9e5
clean up
brtkx Aug 11, 2023
67e49c5
var name
brtkx Aug 11, 2023
7571156
fix
brtkx Aug 11, 2023
c086850
export types and methods
brtkx Aug 11, 2023
6f78538
fixes
brtkx Aug 11, 2023
796c64b
change bridger type for l1network
brtkx Aug 11, 2023
fbc4df7
chore: bump contracts to 1.1.0-alpha.4
gzeoneth Aug 14, 2023
eb15634
remove thing
spsjvc Aug 14, 2023
b850c2e
remove unused imporT
spsjvc Aug 14, 2023
3b4364d
v3.1.6-orbit-custom-fee-token.0
spsjvc Aug 14, 2023
100c3a8
chore: bump contracts to 1.1.0-alpha.5
gzeoneth Aug 14, 2023
2e76d7e
chore: bump contracts to 1.1.0-alpha.7
gzeoneth Aug 14, 2023
f07aab0
Merge branch 'feat-custom-fee-token' of github.com:OffchainLabs/arbit…
spsjvc Aug 15, 2023
1bf66bb
Merge branch 'main' of ssh://github.com/OffchainLabs/arbitrum-sdk int…
brtkx Aug 21, 2023
5a864e1
separate method for adding custom chains
brtkx Aug 21, 2023
7de3b79
spread l2networks
brtkx Aug 21, 2023
af42cc1
clean up
brtkx Aug 21, 2023
0f67d96
default blocktime to 12sec
brtkx Aug 21, 2023
d716532
clean up
brtkx Aug 21, 2023
b2f0c8b
clean up
brtkx Aug 21, 2023
d2e3502
fix assetBridger
brtkx Aug 21, 2023
649dca4
read l2network from l2Networks or chains
brtkx Aug 22, 2023
0119fd9
clean up
brtkx Aug 23, 2023
31ab5d3
unused import
brtkx Aug 23, 2023
4582b54
unused import
brtkx Aug 23, 2023
d3597cb
clean up, unit tests
brtkx Aug 24, 2023
ade62ad
Merge branch 'main' of ssh://github.com/OffchainLabs/arbitrum-sdk int…
brtkx Aug 24, 2023
3d22c14
v3.1.10-beta.0
gzeoneth Aug 28, 2023
cf3cfac
fix multicall
brtkx Aug 28, 2023
76eb545
Merge branch 'support-l2-parent-chains' of ssh://github.com/OffchainL…
brtkx Aug 28, 2023
41ffe31
Merge branch 'support-l2-parent-chains' into feat-custom-fee-token
spsjvc Sep 28, 2023
a589888
v
spsjvc Oct 2, 2023
ebc7870
Merge branch 'main' of ssh://github.com/OffchainLabs/arbitrum-sdk int…
brtkx Oct 5, 2023
c4934d8
merge main
brtkx Oct 5, 2023
158b8d4
bump version
spsjvc Oct 5, 2023
cc48da2
add stylus to partner chains for arb sepolia
brtkx Oct 5, 2023
980ca7a
bump version
spsjvc Oct 5, 2023
38cecca
Merge branch 'support-l2-parent-chains' into feat-custom-fee-token
spsjvc Nov 1, 2023
9615ca8
make consistent
spsjvc Nov 1, 2023
b150be0
bump version
spsjvc Nov 1, 2023
d35e6d6
handle zero address native token as eth
spsjvc Nov 3, 2023
d31e2ef
bump version
spsjvc Nov 3, 2023
388322a
Merge branch 'main' into support-l2-parent-chains
spsjvc Nov 3, 2023
8551202
bump version
spsjvc Nov 3, 2023
c84e20c
Merge branch 'support-l2-parent-chains' into feat-custom-fee-token
spsjvc Nov 3, 2023
611c48a
bump version
spsjvc Nov 3, 2023
cf61bb8
Testing the flat chains option
douglance Nov 18, 2023
814acf9
cleans up flat chains implementation
douglance Nov 20, 2023
500ced0
exports getters to fix unused function error
douglance Nov 20, 2023
a4999a6
sets type isOrbit to true rather than boolean
douglance Nov 21, 2023
c72eaac
swap getParentOf Network to getParentForNetwork
douglance Nov 21, 2023
08c27b3
swap getChildrenOf Network to getChildrenForNetwork
douglance Nov 21, 2023
ca6f1dc
responds to PR feedback
douglance Nov 21, 2023
21cbc1d
abstracts out getting chains by type
douglance Nov 28, 2023
0b194c2
Merge branch 'main' into dl/query
fionnachan Nov 30, 2023
49e7aea
responds to pr feedback
douglance Nov 30, 2023
769bb6c
Adds jsdocs for parent/child predicates
douglance Nov 30, 2023
b3737b6
fix lint issue
douglance Nov 30, 2023
6645ce8
actually fix lint issue
douglance Nov 30, 2023
5f3737a
updates `getNetwork` to return all parent chains for layer 1
douglance Nov 30, 2023
26538b4
removes exports from networks.ts
douglance Nov 30, 2023
290cf61
renames network object
douglance Nov 30, 2023
74a9f53
removes parentChain and l1NetworkOrParentChain from asset bridger
douglance Nov 30, 2023
34b7e28
adds generic customNetwork param to `addCustomNetwork`
douglance Dec 1, 2023
5b4b50b
fix add custom network param type
douglance Dec 1, 2023
f72e011
reverts change to addCustomNetwork
douglance Dec 4, 2023
e2a2dc9
implement pr changes
douglance Dec 12, 2023
a67a678
improves tests by resetting network state between tests
douglance Dec 15, 2023
842edcc
get rid of extra type
spsjvc Dec 18, 2023
bffe1f4
improves tests and simplifies AssetBridger constructor
douglance Dec 18, 2023
d63c7b6
Adds L1/L2Network types to asset bridger
douglance Dec 18, 2023
ee9f9d8
Merge branch 'main' into dl/query
douglance Jan 4, 2024
c6a0efa
update build script for l3 testing
douglance Jan 9, 2024
626ce8f
sets up tests to be orbit compatible
douglance Jan 9, 2024
058337a
reverts getL1Network type change
douglance Jan 9, 2024
5f50b5f
fix blocktime
douglance Jan 9, 2024
d259c2c
testing with restored build file
douglance Jan 9, 2024
c32084e
test with just l3-node
douglance Jan 9, 2024
e26e0f0
run only orbit tests
douglance Jan 9, 2024
c60f510
fix testnode ref
douglance Jan 9, 2024
584bb42
test without local network
douglance Jan 9, 2024
2cd6add
sets up l1 before localnetwork.json for orbit
douglance Jan 9, 2024
e0bdd34
improve ci labels
douglance Jan 9, 2024
743d168
Update name to use matrix label
douglance Jan 9, 2024
e2d9ba4
simplify name gen
douglance Jan 9, 2024
8d11b9c
clean up types (#389)
spsjvc Jan 10, 2024
0b5d100
clean up plus docs
spsjvc Jan 10, 2024
8379045
add test for l1Networks and l2Networks
spsjvc Jan 11, 2024
0c97ade
wrap in describe
spsjvc Jan 11, 2024
18f6d85
docs
spsjvc Jan 11, 2024
4c2ee0b
Merge branch 'main' into dl/query
spsjvc Jan 11, 2024
b775779
refactor: clean up networks (#390)
spsjvc Jan 11, 2024
2b7c643
bump version
spsjvc Jan 11, 2024
b14d4fb
Merge branch 'dl/query' into feat-custom-fee-token
spsjvc Jan 11, 2024
024ff03
bump packages
spsjvc Jan 11, 2024
aaa5997
bump version
spsjvc Jan 11, 2024
b68b6ca
chore: updates jsdoc comments on new functions/values
douglance Jan 12, 2024
edc038c
Merge branch 'main' into dl/query
douglance Jan 12, 2024
e8b29f7
swaps test setup to use arb_min_block_time
douglance Jan 16, 2024
da32655
adds more jsdoc comments to testsetup
douglance Jan 16, 2024
a1c70aa
adds another comment
douglance Jan 16, 2024
203d665
Merge branch 'dl/query' into feat-custom-fee-token
douglance Jan 18, 2024
c987678
clean up
spsjvc Jan 24, 2024
a118de2
clean up
spsjvc Jan 24, 2024
44d0036
update custom fee token support to prepare for merge to main (#398)
douglance Jan 26, 2024
400c457
Merge branch 'dl/query' into feat-custom-fee-token
douglance Jan 26, 2024
5200584
restores getParentChains to fix tests
douglance Jan 26, 2024
88f8fa5
Merge branch 'main' into dl/query
douglance Jan 26, 2024
b9e4e16
Merge branch 'dl/query' into feat-custom-fee-token
douglance Jan 26, 2024
6395ee2
linting
douglance Jan 26, 2024
eda81be
update lockfile
douglance Jan 29, 2024
be3708f
remove obsolete tests
spsjvc Jan 30, 2024
5824ef4
update ref
spsjvc Jan 30, 2024
48056bc
fix
spsjvc Feb 2, 2024
05b8540
revert comments
spsjvc Feb 2, 2024
555de69
remove obsolete test
spsjvc Feb 2, 2024
7fd3af8
start cleaning up tests
spsjvc Feb 2, 2024
5d95a0d
more
spsjvc Feb 2, 2024
0861bd1
add more assertions
spsjvc Feb 2, 2024
d478039
finish cleanup
spsjvc Feb 2, 2024
0d91ae4
bump version
spsjvc Feb 2, 2024
e1c5819
Merge branch 'dl/query' into feat-custom-fee-token
spsjvc Feb 2, 2024
c133974
revert changes
spsjvc Feb 2, 2024
abdc024
remove bangs
spsjvc Feb 2, 2024
6fe62da
bump
spsjvc Feb 2, 2024
61794ae
switch to early return
spsjvc Feb 2, 2024
4e9b557
clean up
spsjvc Feb 4, 2024
49a8c5b
move property up
spsjvc Feb 5, 2024
d1e2fc5
bump version
spsjvc Feb 5, 2024
8264a5b
Merge branch 'dl/query' into feat-custom-fee-token
spsjvc Feb 5, 2024
d1236dd
Merge branch 'main' into feat-custom-fee-token
spsjvc Feb 5, 2024
d2ea33a
fix script
spsjvc Feb 5, 2024
4fbb2ca
fix
spsjvc Feb 5, 2024
f2b43da
clean up job names
spsjvc Feb 5, 2024
eb31f69
use testnode bridge (#408)
godzillaba Feb 5, 2024
31243d1
Merge branch 'main' into feat-custom-fee-token
spsjvc Feb 5, 2024
27127b4
move nativeToken to parent class
spsjvc Feb 5, 2024
fdf1526
move nativeTokenIsEth to parent class
spsjvc Feb 5, 2024
45e63a8
clean up jsdoc
spsjvc Feb 5, 2024
243f020
clean up gen abi
spsjvc Feb 5, 2024
716fb1a
rename fee token to gas token
spsjvc Feb 5, 2024
b4ca425
remove check
spsjvc Feb 12, 2024
86380d2
add docs
spsjvc Feb 12, 2024
34dcdc5
clean up
spsjvc Feb 12, 2024
9e5ce1d
rename
spsjvc Feb 12, 2024
9c8a66e
add comment
spsjvc Feb 12, 2024
c21d321
Merge branch 'main' into feat-custom-fee-token
spsjvc Feb 12, 2024
f79541c
clean up
spsjvc Feb 12, 2024
b4a565b
add test
spsjvc Feb 12, 2024
ce42be3
fix
spsjvc Feb 12, 2024
2f1b5df
rename and jsdoc
spsjvc Feb 12, 2024
7caa388
bump version
spsjvc Feb 12, 2024
746cf4e
fix
spsjvc Feb 13, 2024
0f43ffa
remove unused script
spsjvc Feb 13, 2024
69aa6ef
rename for consistency
spsjvc Feb 13, 2024
ed9a199
clean up
spsjvc Feb 13, 2024
b541d27
patch
spsjvc Feb 13, 2024
8ed3593
clean up
spsjvc Feb 13, 2024
27fe056
oops
spsjvc Feb 13, 2024
4d5f968
clean up more
spsjvc Feb 13, 2024
abdf668
clean up more
spsjvc Feb 13, 2024
7028348
rename
spsjvc Feb 13, 2024
08f9af6
lol
spsjvc Feb 13, 2024
af5586f
bump contracts
spsjvc Feb 13, 2024
836bdb4
update values for L3
spsjvc Feb 14, 2024
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
27 changes: 20 additions & 7 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ env:

jobs:
install:
name: 'Install'
name: Install on Node.js v${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -27,7 +27,7 @@ jobs:
uses: OffchainLabs/actions/node-modules/install@main

lint:
name: Lint
name: Lint on Node.js v${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
verbose: false

audit:
name: Audit
name: Audit on Node.js v${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -97,7 +97,7 @@ jobs:
- run: yarn audit:ci

test-unit:
name: Test (Unit)
name: Test (Unit) on Node.js v${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -124,12 +124,25 @@ jobs:
run: CI=true yarn test:unit

test-integration:
name: Test (Integration) - ${{ matrix.orbit-test == '1' && 'Orbit' || 'No Orbit' }} - Node ${{ matrix.node-version }}
name: Test (Integration) on Node.js v${{ matrix.node-version }}${{ matrix.orbit-test == '1' && ' with L3' || '' }}${{ matrix.custom-fee == '1' && ' with custom gas token' || '' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false # runs all tests to completion even if one fails
matrix:
node-version: [16, 18, 20]
orbit-test: ['1', '0']
orbit-test: ['0', '1']
custom-fee: ['0']
include:
- orbit-test: '1'
custom-fee: '1'
node-version: 16
- orbit-test: '1'
custom-fee: '1'
node-version: 18
- orbit-test: '1'
custom-fee: '1'
node-version: 20

needs: install
env:
ORBIT_TEST: ${{ matrix.orbit-test }}
Expand All @@ -149,8 +162,8 @@ jobs:
uses: OffchainLabs/actions/run-nitro-test-node@main
with:
nitro-testnode-ref: master
no-token-bridge: true
l3-node: ${{ matrix.orbit-test == '1' }}
args: ${{ matrix.custom-fee == '1' && '--l3-fee-token' || '' }}

- name: Copy .env
run: cp ./.env-sample ./.env
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@arbitrum/sdk",
"version": "3.2.0",
"version": "3.3.0-beta.0",
"description": "Typescript library client-side interactions with Arbitrum",
"author": "Offchain Labs, Inc.",
"license": "Apache-2.0",
Expand Down Expand Up @@ -44,7 +44,8 @@
"setStandard": "ts-node scripts/setStandardGateways.ts",
"setCustom": "ts-node scripts/setArbCustomGateways.ts",
"cancelRetryable": "ts-node scripts/cancelRetryable.ts",
"bridgeStandardToken": "ts-node scripts/deployStandard.ts"
"bridgeStandardToken": "ts-node scripts/deployStandard.ts",
"fund": "ts-node scripts/fundCustomFeeToken.ts"
},
"dependencies": {
"@ethersproject/address": "^5.0.8",
Expand All @@ -54,8 +55,8 @@
"ethers": "^5.1.0"
},
"devDependencies": {
"@arbitrum/nitro-contracts": "1.1.0",
"@arbitrum/token-bridge-contracts": "1.2.0",
"@arbitrum/nitro-contracts": "^1.1.0",
spsjvc marked this conversation as resolved.
Show resolved Hide resolved
"@arbitrum/token-bridge-contracts": "^1.2.0",
spsjvc marked this conversation as resolved.
Show resolved Hide resolved
"@nomiclabs/hardhat-ethers": "^2.0.4",
"@typechain/ethers-v5": "9.0.0",
"@types/chai": "^4.2.11",
Expand Down
256 changes: 0 additions & 256 deletions scripts/deployBridge.ts

This file was deleted.

19 changes: 19 additions & 0 deletions scripts/fundCustomFeeToken.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { fundL1CustomFeeToken } from '../tests/integration/custom-fee-token/customFeeTokenTestHelpers'
import { getLocalNetworksFromFile } from './testSetup'

async function main() {
const localNetworks = getLocalNetworksFromFile()
if (!localNetworks) {
console.error('No local networks found')
//TODO: get token address from deployment somehow
}
const nativeTokenAddress = localNetworks?.l2Network.nativeToken
if (!nativeTokenAddress || nativeTokenAddress === undefined) {
console.error('No native token found')
return
}

await fundL1CustomFeeToken(nativeTokenAddress)
spsjvc marked this conversation as resolved.
Show resolved Hide resolved
}

main()
12 changes: 4 additions & 8 deletions scripts/genAbi.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,11 @@ async function main() {
// https://yarnpkg.com/advanced/rulebook#packages-should-never-write-inside-their-own-folder-outside-of-postinstall
// instead of writing in postinstall in each of those packages, we should target a local folder in sdk's postinstall

console.log('building nitro')
execSync(`${npmExec} run build`, {
cwd: nitroPath,
})
console.log('building @arbitrum/nitro-contracts')
execSync(`${npmExec} run build`, { cwd: nitroPath })

console.log('building token bridge')
execSync(`${npmExec} run build`, {
cwd: tokenBridgePath,
})
console.log('building @arbitrum/token-bridge-contracts')
execSync(`${npmExec} run build`, { cwd: tokenBridgePath })

console.log('Done compiling')

Expand Down
Loading
Loading