Skip to content

Commit

Permalink
Merge from develop
Browse files Browse the repository at this point in the history
  • Loading branch information
yahgwai committed Oct 25, 2023
2 parents b7b2f49 + 5dbca3c commit 0b9ba23
Show file tree
Hide file tree
Showing 82 changed files with 7,565 additions and 1,170 deletions.
7 changes: 7 additions & 0 deletions .env.sample.goerli
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ROLLUP_CREATOR_ADDRESS=""
ARBISCAN_API_KEY=""
## deployer key
DEVNET_PRIVKEY=""

## optional - address of already deployed ERC20 token which shall be used as rollup's fee token
FEE_TOKEN_ADDRESS=""
25 changes: 25 additions & 0 deletions .github/workflows/contract-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,31 @@ on:
- develop

jobs:
test-unit:
name: Test unit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

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

- name: Install packages
run: yarn

- name: Run unit tests
run: forge test
tests:
name: Contract tests
runs-on: ubuntu-8
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ deployments/
/test/prover/spec-proofs/*.json
/test/storage/*-old.dot
scripts/config.ts
forge-cache/
out/
.env
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ coverage/**
deployments/**
src/lib/abi/**
.nyc_output
out/**
lib/**
14 changes: 14 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[profile.default]
src = 'src'
out = 'out'
libs = ['node_modules', 'lib']
test = 'test/foundry'
cache_path = 'forge-cache'
optimizer = true
optimizer_runs = 20000
via_ir = false

[fmt]
number_underscore = 'thousands'
line_length = 100
# See more config options https://github.com/foundry-rs/foundry/tree/master/config
18 changes: 18 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import '@typechain/hardhat'
import 'solidity-coverage'
import 'hardhat-gas-reporter'
import 'hardhat-ignore-warnings'
import dotenv from 'dotenv'

dotenv.config()

const solidity = {
compilers: [
Expand Down Expand Up @@ -113,6 +116,12 @@ module.exports = {
? [process.env['DEVNET_PRIVKEY']]
: [],
},
arbSepolia: {
url: 'https://sepolia-rollup.arbitrum.io/rpc',
accounts: process.env['DEVNET_PRIVKEY']
? [process.env['DEVNET_PRIVKEY']]
: [],
},
arb1: {
url: 'https://arb1.arbitrum.io/rpc',
accounts: process.env['MAINNET_PRIVKEY']
Expand All @@ -139,6 +148,7 @@ module.exports = {
arbitrumTestnet: process.env['ARBISCAN_API_KEY'],
nova: process.env['NOVA_ARBISCAN_API_KEY'],
arbGoerliRollup: process.env['ARBISCAN_API_KEY'],
arbSepolia: process.env['ARBISCAN_API_KEY'],
},
customChains: [
{
Expand All @@ -157,6 +167,14 @@ module.exports = {
browserURL: 'https://goerli.arbiscan.io/',
},
},
{
network: 'arbSepolia',
chainId: 421614,
urls: {
apiURL: 'https://sepolia-explorer.arbitrum.io/api',
browserURL: 'https://sepolia-explorer.arbitrum.io/',
},
},
],
},
mocha: {
Expand Down
1 change: 1 addition & 0 deletions lib/forge-std
Submodule forge-std added at e8a047
14 changes: 12 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@arbitrum/nitro-contracts",
"version": "1.0.2",
"version": "1.1.0-beta.0",
"description": "Layer 2 precompiles and rollup for Arbitrum Nitro",
"author": "Offchain Labs, Inc.",
"license": "BUSL-1.1",
Expand All @@ -9,12 +9,15 @@
"url": "git+https://github.com/offchainlabs/nitro-contracts.git"
},
"files": [
"src/"
"src/",
"build/contracts/src",
"build/contracts/@openzeppelin"
],
"bugs": {
"url": "https://github.com/offchainlabs/nitro-contracts/issues"
},
"scripts": {
"prepublishOnly": "hardhat clean && hardhat compile",
"build": "hardhat compile",
"lint:test": "eslint ./test",
"solhint": "solhint -f table src/**/*.sol",
Expand All @@ -24,18 +27,24 @@
"build:0.7": "INTERFACE_TESTER_SOLC_VERSION=0.7.0 yarn run build",
"test:compatibility": "yarn run build:0.6 && yarn run build:0.7",
"test:storage": "./test/storage/test.bash",
"test:e2e": "hardhat test test/e2e/*.ts",
"postinstall": "patch-package",
"deploy-factory": "hardhat run scripts/deployment.ts",
"deploy-rollup": "hardhat run scripts/rollupCreation.ts",
"deploy-eth-rollup": "hardhat run scripts/createEthRollup.ts",
"deploy-erc20-rollup": "hardhat run scripts/createERC20Rollup.ts",
"test": "hardhat --network hardhat test test/contract/*.spec.ts"
},
"dependencies": {
"@offchainlabs/upgrade-executor": "1.1.0-beta.0",
"@openzeppelin/contracts": "4.5.0",
"@openzeppelin/contracts-upgradeable": "4.5.2",
"patch-package": "^6.4.7"
},
"private": false,
"devDependencies": {
"@arbitrum/sdk": "^3.1.3",
"@ethersproject/providers": "^5.7.2",
"@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers@^0.3.0-beta.13",
"@nomiclabs/hardhat-etherscan": "^3.1.0",
"@nomiclabs/hardhat-waffle": "^2.0.1",
Expand All @@ -48,6 +57,7 @@
"@typescript-eslint/eslint-plugin-tslint": "^5.27.1",
"@typescript-eslint/parser": "^5.14.0",
"chai": "^4.3.4",
"dotenv": "^16.3.1",
"eslint": "^8.23.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-mocha": "^9.0.0",
Expand Down
5 changes: 5 additions & 0 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ds-test/=lib/forge-std/lib/ds-test/src/
forge-std/=lib/forge-std/src/

@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/
@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/
41 changes: 41 additions & 0 deletions scripts/createERC20Rollup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { ethers } from 'hardhat'
import '@nomiclabs/hardhat-ethers'
import { Signer } from 'ethers'
import { createRollup } from './rollupCreation'
import { TestToken__factory } from '../build/types'

async function deployERC20Token(deployer: Signer): Promise<string> {
const factory = await new TestToken__factory(deployer).deploy(
ethers.utils.parseEther('1000000000')
)
const feeToken = await factory.deployed()

return feeToken.address
}

async function main() {
const [deployer] = await ethers.getSigners()

let customFeeTokenAddress = process.env.FEE_TOKEN_ADDRESS
if (!customFeeTokenAddress) {
console.log(
'FEE_TOKEN_ADDRESS env var not provided, deploying new ERC20 token'
)
customFeeTokenAddress = await deployERC20Token(deployer)
}
if (!ethers.utils.isAddress(customFeeTokenAddress)) {
throw new Error(
'Fee token address ' + customFeeTokenAddress + ' is not a valid address!'
)
}

console.log('Creating new rollup with', customFeeTokenAddress, 'as fee token')
await createRollup(customFeeTokenAddress)
}

main()
.then(() => process.exit(0))
.catch((error: Error) => {
console.error(error)
process.exit(1)
})
13 changes: 13 additions & 0 deletions scripts/createEthRollup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import '@nomiclabs/hardhat-ethers'
import { createRollup } from './rollupCreation'

async function main() {
await createRollup()
}

main()
.then(() => process.exit(0))
.catch((error: Error) => {
console.error(error)
process.exit(1)
})
Loading

0 comments on commit 0b9ba23

Please sign in to comment.