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

Dev #366

Merged
merged 205 commits into from
Sep 6, 2023
Merged

Dev #366

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
205 commits
Select commit Hold shift + click to select a range
3fed6ee
build(deps-dev): bump @types/node from 20.1.1 to 20.1.3
dependabot[bot] May 12, 2023
82621d9
feat: implement mintable token predicate contracts (#234)
QEDK May 15, 2023
f6bdd1c
Merge branch 'dev' into dependabot/npm_and_yarn/dev/types/node-20.1.3
gretzke May 15, 2023
eaa1970
Merge pull request #232 from 0xPolygon/dependabot/npm_and_yarn/dev/ty…
gretzke May 15, 2023
a0a9468
build(deps-dev): bump @openzeppelin/hardhat-upgrades
dependabot[bot] May 15, 2023
907187a
Merge pull request #237 from 0xPolygon/dependabot/npm_and_yarn/dev/op…
gretzke May 15, 2023
8d9c2d0
Merge branch 'main' into dev
QEDK May 15, 2023
fb51c2e
build(deps-dev): bump @types/node from 20.1.3 to 20.1.4
dependabot[bot] May 15, 2023
4494680
Merge pull request #238 from 0xPolygon/dependabot/npm_and_yarn/dev/ty…
gretzke May 15, 2023
ac93369
build(deps-dev): bump @types/node from 20.1.4 to 20.1.6
dependabot[bot] May 16, 2023
9b8b371
Merge pull request #240 from 0xPolygon/dependabot/npm_and_yarn/dev/ty…
gretzke May 17, 2023
f94998f
build(deps-dev): bump @types/node from 20.1.6 to 20.1.7
dependabot[bot] May 17, 2023
988067e
Merge pull request #241 from 0xPolygon/dependabot/npm_and_yarn/dev/ty…
gretzke May 17, 2023
d94d604
move from ERC20Snapshot to ERC20Votes so it can be used with Governor…
gretzke May 17, 2023
cf4dc35
Initial commit: Governance
gretzke May 17, 2023
8e3f428
build(deps-dev): bump @types/node from 20.1.7 to 20.2.1
dependabot[bot] May 18, 2023
18a2ece
Merge pull request #243 from 0xPolygon/dependabot/npm_and_yarn/dev/ty…
gretzke May 20, 2023
7db2941
feat: implement access list for mintable predicates
QEDK May 20, 2023
a94c94d
move from ERC20Snapshot to ERC20Votes so it can be used with Governor…
gretzke May 17, 2023
2a8d464
Initial commit: Governance
gretzke May 17, 2023
4b499bf
build(deps-dev): bump @types/node from 20.2.1 to 20.2.3
dependabot[bot] May 22, 2023
1bd1da5
Revert "Initial commit: Governance"
gretzke May 23, 2023
5d392c7
Revert "move from ERC20Snapshot to ERC20Votes so it can be used with …
gretzke May 23, 2023
f549df1
Merge pull request #246 from 0xPolygon/revert-242-feat/governance
gretzke May 23, 2023
80f888d
Merge pull request #245 from 0xPolygon/dependabot/npm_and_yarn/dev/ty…
gretzke May 23, 2023
0a943e7
Merge branch 'dev' into feat/governance
gretzke May 23, 2023
cffe03b
build(deps): bump @openzeppelin/contracts-upgradeable
dependabot[bot] May 23, 2023
7cd97c0
Merge pull request #249 from 0xPolygon/dependabot/npm_and_yarn/dev/op…
gretzke May 24, 2023
941a288
build(deps): bump @openzeppelin/contracts from 4.8.3 to 4.9.0
dependabot[bot] May 24, 2023
9b28414
Merge pull request #248 from 0xPolygon/dependabot/npm_and_yarn/dev/op…
gretzke May 24, 2023
3c55166
Merge branch 'dev' into feat/governance
gretzke May 24, 2023
172a237
feat: map native token in mintable predicate init
QEDK May 25, 2023
76676b2
test: reset before tests
QEDK May 25, 2023
fa2faeb
build(deps-dev): bump @openzeppelin/hardhat-upgrades
dependabot[bot] May 29, 2023
97a7247
build(deps-dev): bump @types/node from 20.2.3 to 20.2.5
dependabot[bot] May 29, 2023
c0ae2e8
Merge pull request #253 from 0xPolygon/dependabot/npm_and_yarn/dev/ty…
gretzke May 29, 2023
879eb90
Merge pull request #252 from 0xPolygon/dependabot/npm_and_yarn/dev/op…
gretzke May 29, 2023
8cd478b
Revert "feat: map native token in mintable predicate init" (#255)
QEDK May 31, 2023
ed4c3df
build(deps-dev): bump dotenv from 16.0.3 to 16.1.3
dependabot[bot] May 31, 2023
3986b2e
build(deps): bump hardhat from 2.14.0 to 2.14.1
dependabot[bot] May 31, 2023
9380574
Merge pull request #256 from 0xPolygon/dependabot/npm_and_yarn/dev/do…
gretzke Jun 1, 2023
e1fb1e8
build(deps-dev): bump typescript from 5.0.4 to 5.1.3
dependabot[bot] Jun 1, 2023
e059b7e
feat: upgrade coveralls action version
QEDK Jun 1, 2023
8018074
Merge pull request #257 from 0xPolygon/dependabot/npm_and_yarn/dev/ha…
gretzke Jun 2, 2023
7bade47
fix: fix access list to occur on token deposits for mintable predicates
QEDK Jun 1, 2023
2b35cb8
Merge pull request #260 from 0xPolygon/feat/upgrade-coveralls
gretzke Jun 2, 2023
91b7348
Merge branch 'dev' into dependabot/npm_and_yarn/dev/typescript-5.1.3
gretzke Jun 2, 2023
ad47fc8
Merge pull request #261 from 0xPolygon/dependabot/npm_and_yarn/dev/ty…
gretzke Jun 2, 2023
56914f5
feat: implement recommended changes
QEDK May 31, 2023
66e4c0e
test: fix tests
QEDK May 31, 2023
762a1f8
feat: remove assertion for user input
QEDK May 31, 2023
9d84d14
feat: make error messages uniform
QEDK May 31, 2023
1410373
fix: add additional check in entrypoint function
QEDK Jun 1, 2023
5f243cc
fix: store vars in memory
QEDK Jun 4, 2023
061d9a9
fix: fix native token NatSpec
QEDK Jun 4, 2023
4b3e974
fix: validator init var typo
QEDK Jun 4, 2023
f27207e
fix: make event param indexed
QEDK Jun 4, 2023
f91dbb4
fix: fix forge tests
QEDK Jun 4, 2023
d36b88f
Merge pull request #263 from 0xPolygon/feat/cs-audit-informational
gretzke Jun 4, 2023
212dcbe
build(deps-dev): bump dotenv from 16.1.3 to 16.1.4
dependabot[bot] Jun 5, 2023
69cddac
feat: add storage gaps to contracts
QEDK Jun 5, 2023
02eb9a9
Merge pull request #264 from 0xPolygon/dependabot/npm_and_yarn/dev/do…
gretzke Jun 5, 2023
a45a522
Merge pull request #265 from 0xPolygon/fix/storage-gaps
gretzke Jun 5, 2023
0a20e38
feat: implement merkle lib in assembly
QEDK Jun 5, 2023
bc639f4
feat: shave off another 8 gas by masking
QEDK Jun 6, 2023
aa7dd1f
lint: fix annoying lint
QEDK Jun 6, 2023
ab564c9
feat: increase rejects in foundry conf
QEDK Jun 6, 2023
b8c7678
fix: add invalid index fix
QEDK Jun 7, 2023
01a39dd
build(deps): bump @openzeppelin/contracts-upgradeable
dependabot[bot] Jun 7, 2023
bd83c15
build(deps): bump @openzeppelin/contracts from 4.9.0 to 4.9.1
dependabot[bot] Jun 7, 2023
5ba6595
Merge pull request #266 from 0xPolygon/dependabot/npm_and_yarn/dev/op…
gretzke Jun 8, 2023
868c6ca
Merge branch 'dev' into dependabot/npm_and_yarn/dev/openzeppelin/cont…
gretzke Jun 8, 2023
a27f81b
Merge pull request #267 from 0xPolygon/dependabot/npm_and_yarn/dev/op…
gretzke Jun 8, 2023
99b65bd
feat: make mint and burn functions virtual
QEDK Jun 8, 2023
5db6d92
feat: add functionality to test with height + tests
QEDK Jun 9, 2023
3857b34
feat: make more functions virtual
QEDK Jun 13, 2023
b6090db
chore: add code comments
QEDK Jun 13, 2023
f398fc0
test: add tests with large trees
QEDK Jun 13, 2023
c0fe6b6
Merge pull request #273 from 0xPolygon/feat/native-token-virtual
gretzke Jun 13, 2023
9a9120e
fix: fix error message in StateReceiver tests
QEDK Jun 13, 2023
befb417
feat: introduce token supply in native token init
QEDK Jun 13, 2023
5a68054
fix: fix minor test init
QEDK Jun 13, 2023
8da70d7
Convert StakeManagerLib and ChildChainLib to abstract contracts. Add …
drinkcoffee Jun 25, 2023
80a14ce
Addressed pull request feedback
drinkcoffee Jul 4, 2023
762c249
Change storage gap variable names to __gap and private storage variab…
drinkcoffee Jul 6, 2023
50eb483
build(deps): bump hardhat from 2.14.1 to 2.15.0
dependabot[bot] Jun 8, 2023
061938e
build(deps): bump mcl-wasm from 1.0.6 to 1.1.0
dependabot[bot] Jun 13, 2023
4709f7d
build(deps-dev): bump dotenv from 16.1.4 to 16.3.1
dependabot[bot] Jun 19, 2023
d003e0d
build(deps-dev): bump @types/node from 20.2.5 to 20.3.3
dependabot[bot] Jul 3, 2023
2de13ae
build(deps-dev): bump @types/node from 20.3.3 to 20.4.0
dependabot[bot] Jul 6, 2023
d0efbcd
Rebased to dev branch
drinkcoffee Jul 10, 2023
6e75d45
feat: implement req changes
ZeroEkkusu Jul 11, 2023
7b338da
fix: improve names
ZeroEkkusu Jul 12, 2023
edd68e5
Merge branch 'dev' into zx/feat/governance
ZeroEkkusu Jul 12, 2023
102d402
docs: add comments
ZeroEkkusu Jul 12, 2023
a01a4c3
Merge pull request #294 from 0xPolygon/zx/feat/governance
ZeroEkkusu Jul 12, 2023
feeccad
fix: parametarize numerator
ZeroEkkusu Jul 12, 2023
bb2a805
Merge pull request #247 from 0xPolygon/feat/governance
ZeroEkkusu Jul 13, 2023
d2a5490
fix: gov, add initializers
ZeroEkkusu Jul 14, 2023
7d0210a
test: update `ForkParams` tests
ZeroEkkusu Jul 14, 2023
0257db4
test: update `NetworkParams` tests
ZeroEkkusu Jul 14, 2023
1b3941a
fix: slither
ZeroEkkusu Jul 14, 2023
525f7e2
build(deps): bump @openzeppelin/contracts from 4.9.1 to 4.9.2
dependabot[bot] Jul 6, 2023
fb5d754
build(deps): bump @openzeppelin/contracts-upgradeable
dependabot[bot] Jul 14, 2023
fdc0749
build(deps-dev): bump @defi-wonderland/smock from 2.3.4 to 2.3.5
dependabot[bot] Jul 6, 2023
99aa143
build(deps-dev): bump typescript from 5.1.3 to 5.1.6
dependabot[bot] Jul 6, 2023
f366b67
Merge remote-tracking branch 'origin/dev' into storage-gaps
drinkcoffee Jul 16, 2023
a9f21c5
fix(gov): remove `minStake` `blockGasLimit`
ZeroEkkusu Jul 17, 2023
3c3b121
Fixed prettier issues
drinkcoffee Jul 17, 2023
eb0b22a
fix(gov): pass `epochSize`
ZeroEkkusu Jul 24, 2023
34f3a0d
fix: correct event typo
ZeroEkkusu Jul 24, 2023
74f026e
Merge pull request #310 from 0xPolygon/fix/epoch-size
gretzke Jul 27, 2023
ae4bb4f
feat(gov): add `sprintSize`
ZeroEkkusu Jul 27, 2023
f7a1fc9
Merge pull request #314 from 0xPolygon/feat/sprint-size
gretzke Jul 27, 2023
210ca80
Merge branch 'storage-gaps' into storage-gaps
QEDK Aug 2, 2023
13105ea
Fix slither issues
drinkcoffee Aug 2, 2023
942dbf9
Merge pull request #281 from drinkcoffee/storage-gaps
gretzke Aug 2, 2023
84fc4d0
fix coverage
gretzke Aug 2, 2023
1f564c2
Merge pull request #319 from 0xPolygon/storage-gaps
gretzke Aug 3, 2023
dae4379
build(deps-dev): bump @types/node from 20.4.0 to 20.4.6
dependabot[bot] Aug 3, 2023
f7d064f
Exclude openzeppelin and mocks from documentation
gretzke Aug 3, 2023
b347f82
fix typos
gretzke Aug 3, 2023
b00e519
Merge pull request #318 from 0xPolygon/dependabot/npm_and_yarn/dev/ty…
gretzke Aug 3, 2023
642f43b
build(deps-dev): bump eslint-plugin-import from 2.27.5 to 2.28.0
dependabot[bot] Aug 3, 2023
0e7aacb
build(deps): bump @openzeppelin/contracts from 4.9.2 to 4.9.3
dependabot[bot] Aug 3, 2023
7b719f2
build(deps): bump mcl-wasm from 1.1.0 to 1.2.0
dependabot[bot] Aug 3, 2023
e9c879e
fix: relax param req
ZeroEkkusu Aug 9, 2023
dd5147b
fix: update `initialize`
ZeroEkkusu Aug 9, 2023
d7030e9
Merge pull request #326 from 0xPolygon/fix/params-zero
gretzke Aug 9, 2023
fe994df
Merge pull request #323 from 0xPolygon/dependabot/npm_and_yarn/dev/op…
gretzke Aug 9, 2023
015426d
Merge pull request #324 from 0xPolygon/dependabot/npm_and_yarn/dev/mc…
gretzke Aug 9, 2023
69b5c33
Merge pull request #322 from 0xPolygon/dependabot/npm_and_yarn/dev/es…
gretzke Aug 9, 2023
722ac60
build(deps): bump @openzeppelin/contracts-upgradeable
dependabot[bot] Aug 9, 2023
083ba59
Small corrections on smart contracts
criadoperez Aug 10, 2023
ea389f3
feat: make contracts legacy-compat
ZeroEkkusu Aug 17, 2023
e025e70
RFC 11: Double Signer Slashing (#336)
DhairyaSethi Aug 18, 2023
7a1b6e8
Merge branch 'dev' into hardfork
ZeroEkkusu Aug 18, 2023
69e8905
feat: add genesis proxies and scripts
ZeroEkkusu Aug 18, 2023
0aedf60
Merge pull request #338 from 0xPolygon/hardfork
ZeroEkkusu Aug 18, 2023
0b6b1f5
Slither Fixes (#341)
DhairyaSethi Aug 21, 2023
7f75f22
ci: prep contracts for maintenance
ZeroEkkusu Aug 21, 2023
0428def
docs: fix link
ZeroEkkusu Aug 21, 2023
bb9e133
ci: install node modules
ZeroEkkusu Aug 21, 2023
4eb8da4
fix: lint
ZeroEkkusu Aug 21, 2023
4438732
Merge pull request #342 from 0xPolygon/ci/future-maintenance
ZeroEkkusu Aug 21, 2023
cb6633f
feat: add proxies
ZeroEkkusu Aug 21, 2023
e407e89
refactor: improve structure
ZeroEkkusu Aug 21, 2023
252a294
Merge pull request #344 from 0xPolygon/feat/proxies
ZeroEkkusu Aug 21, 2023
c2b9468
added proxy/hf docs, natspec, code comments (#343)
wschwab Aug 22, 2023
0321682
feat: make contracts and proxies legacy-compat
ZeroEkkusu Aug 23, 2023
f8e185a
Merge branch 'dev' into fix/legacy-compat
ZeroEkkusu Aug 23, 2023
b60d7eb
fix: slither
ZeroEkkusu Aug 23, 2023
3c50236
fix: slither again
ZeroEkkusu Aug 23, 2023
50fb6da
Update contracts/root/staking/StakeManager.sol
ZeroEkkusu Aug 23, 2023
47faa88
Update contracts/root/staking/StakeManagerChildData.sol
ZeroEkkusu Aug 23, 2023
070e6a6
Update contracts/root/staking/StakeManagerStakingData.sol
ZeroEkkusu Aug 23, 2023
c5305be
refactor: clarify calc
ZeroEkkusu Aug 23, 2023
331d806
Merge pull request #348 from 0xPolygon/fix/legacy-compat
ZeroEkkusu Aug 23, 2023
1c04797
docs: explain proxy usage
ZeroEkkusu Aug 23, 2023
8e8eeb0
Merge pull request #349 from 0xPolygon/docs/proxies
ZeroEkkusu Aug 23, 2023
cfb71ef
docs: fix typo
ZeroEkkusu Aug 23, 2023
39b379c
Merge pull request #350 from 0xPolygon/docs/proxies-typo
ZeroEkkusu Aug 23, 2023
3f6125e
refactor: simplify proxy names (#351)
ZeroEkkusu Aug 24, 2023
8c74822
fix: proxies
ZeroEkkusu Aug 24, 2023
760b244
fix: correct string
ZeroEkkusu Aug 24, 2023
3bbed4e
fix: update imports
ZeroEkkusu Aug 24, 2023
948c41e
Merge pull request #352 from 0xPolygon/fix/proxies
ZeroEkkusu Aug 24, 2023
3807282
chore: remove old proxy
ZeroEkkusu Aug 28, 2023
1bc45ac
Merge pull request #355 from 0xPolygon/chore/rm-old-proxy
ZeroEkkusu Aug 28, 2023
1504559
Unstake validator on child during slash (#346)
DhairyaSethi Aug 28, 2023
5140142
build(deps-dev): bump @types/node from 20.4.6 to 20.5.7
dependabot[bot] Aug 28, 2023
fb7737c
Add new parameter
goran-ethernal Aug 31, 2023
bf47346
Small fix
goran-ethernal Aug 31, 2023
5f41f72
tests fix
goran-ethernal Aug 31, 2023
f1f9b10
Fix tests 2
goran-ethernal Aug 31, 2023
3a94bb7
Add tests
goran-ethernal Aug 31, 2023
7db01cb
feat: discard hardfork
ZeroEkkusu Sep 1, 2023
bcd6b41
slither fixes
gretzke Sep 1, 2023
c436901
Merge pull request #361 from 0xPolygon/feat/discard-hf
gretzke Sep 1, 2023
f1be3e9
Merge pull request #325 from 0xPolygon/dependabot/npm_and_yarn/dev/op…
gretzke Sep 1, 2023
b6e631f
Merge pull request #357 from 0xPolygon/dependabot/npm_and_yarn/dev/ty…
gretzke Sep 1, 2023
c2feb65
build(deps-dev): bump solhint from 3.4.1 to 3.6.2
dependabot[bot] Sep 1, 2023
be03196
Merge branch 'dev' into governance/add-new-parameter
ZeroEkkusu Sep 1, 2023
2bec973
Merge pull request #360 from goran-ethernal/governance/add-new-parameter
ZeroEkkusu Sep 1, 2023
4e25d0f
build(deps): bump hardhat from 2.17.1 to 2.17.2
dependabot[bot] Sep 1, 2023
2f9c0f5
build(deps): bump mcl-wasm from 1.2.0 to 1.3.0
dependabot[bot] Sep 1, 2023
39c635a
Merge pull request #365 from 0xPolygon/dependabot/npm_and_yarn/dev/mc…
gretzke Sep 1, 2023
22bd2d4
Merge pull request #364 from 0xPolygon/dependabot/npm_and_yarn/dev/ha…
gretzke Sep 1, 2023
33db490
Merge pull request #339 from 0xPolygon/dependabot/npm_and_yarn/dev/so…
gretzke Sep 1, 2023
edeb618
build(deps-dev): bump eslint-plugin-import from 2.28.0 to 2.28.1
dependabot[bot] Sep 4, 2023
ffbb519
build(deps-dev): bump @types/chai from 4.3.5 to 4.3.6
dependabot[bot] Sep 4, 2023
441b55d
Add 712 init call, reorg variable, delete unused directory
gretzke Sep 4, 2023
cfa5626
Merge pull request #370 from 0xPolygon/dependabot/npm_and_yarn/dev/ty…
gretzke Sep 4, 2023
f0efa81
Merge pull request #368 from 0xPolygon/dependabot/npm_and_yarn/dev/es…
gretzke Sep 4, 2023
795259c
build(deps-dev): bump eslint-config-prettier from 8.8.0 to 9.0.0
dependabot[bot] Sep 4, 2023
d14e6ae
build(deps-dev): bump @types/node from 20.5.7 to 20.5.9
dependabot[bot] Sep 5, 2023
8ba58b7
Remove check that epoch reward is 0
goran-ethernal Sep 6, 2023
8579247
Merge pull request #374 from 0xPolygon/dependabot/npm_and_yarn/dev/ty…
gretzke Sep 6, 2023
45c0f74
Merge pull request #373 from 0xPolygon/feat/var-reorg
gretzke Sep 6, 2023
db49d14
Merge branch 'dev' into feat/merkle-yul
gretzke Sep 6, 2023
04bd6d2
Merge pull request #376 from goran-ethernal/enable-zero-epoch-rewards
gretzke Sep 6, 2023
2e45503
Merge pull request #369 from 0xPolygon/dependabot/npm_and_yarn/dev/es…
gretzke Sep 6, 2023
53fbdca
chore: slither disable assembly, incorrect-shift
DhairyaSethi Sep 6, 2023
a135e54
chore: reorder slither, solhint disable
DhairyaSethi Sep 6, 2023
6de1fe6
Merge pull request #274 from 0xPolygon/feat/merkle-yul
gretzke Sep 6, 2023
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
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ jobs:
with:
node-version: "18.x"
cache: "npm"
- run: rm foundry.toml
- uses: crytic/[email protected]
with:
node-version: 18
Expand All @@ -89,7 +88,7 @@ jobs:
- name: solidity-coverage
run: npx hardhat coverage
- name: coveralls
uses: coverallsapp/github-action@1.1.3
uses: coverallsapp/github-action@v2.1.2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
forge_coverage:
Expand All @@ -109,4 +108,4 @@ jobs:
cache: "npm"
- run: npm ci
- name: Print coverage
run: forge coverage
run: forge b; forge coverage
36 changes: 24 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,24 @@ This repository contains the smart contract suite used in Polygon's ecosystems.

## Contents

- [Repo Architecture](#repo-architecture)
- [Contracts](#contracts)
- [General Repo Layout](#general-repo-layout)
- [Using This Repo](#using-this-repo)
- [Requirements](#requirements)
- [Installation](#installation)
- [Compiling Contracts](#compiling-contracts)
- [Running Tests](#running-tests)
- [Check Test Coverage](#check-test-coverage)
- [Run Slither](#run-slither)
- [Continuous Integration](#continuous-integration)
- [Documentation](#documentation)
- [Core Contracts](#core-contracts)
- [Contents](#contents)
- [Repo Architecture](#repo-architecture)
- [Contracts](#contracts)
- [General Repo Layout](#general-repo-layout)
- [Using This Repo](#using-this-repo)
- [Requirements](#requirements)
- [General Repo Layout](#general-repo-layout-1)
- [Installation](#installation)
- [Deployment](#deployment)
- [Environment Setup](#environment-setup)
- [Compiling Contracts](#compiling-contracts)
- [Running tests](#running-tests)
- [Linting](#linting)
- [Check Test Coverage](#check-test-coverage)
- [Run Slither](#run-slither)
- [Continuous Integration](#continuous-integration)
- [Documentation](#documentation)

## Repo Architecture

Expand Down Expand Up @@ -152,6 +158,12 @@ Install Foundry libs:
forge install
```

### Deployment

Deploying these contracts in the context of a production blockchain is out of the scope of this repo, as it requires a client that has support of the Edge specification integrated. At current, Edge maintains its own client [here](https://github.com/0xPolygon/polygon-edge), which can be consulted.

One point that is worth emphasizing in this context is that from the perspective of launching a Supernet is understanding genesis contracts. Another is that for at least the time being, the decision has been made to proxify all genesis contracts in order to facilitate upgrades/updates without necessitating a hardfork or regenesis. All deployment scripts in `script/deployment` use OpenZeppelin's `TransparentUpgradeableProxy`.

### Environment Setup

There are a few things that should be done to set up the repo once you've cloned it and installed the dependencies and libraries. An important step for various parts of the repo to work properly is to set up a `.env` file. There is an `.example.env` file provided, copy it and rename the copy `.env`.
Expand Down
3 changes: 3 additions & 0 deletions contracts/child/ChildERC1155.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

pragma solidity ^0.8.19;

import "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol";

Check warning on line 6 in contracts/child/ChildERC1155.sol

View workflow job for this annotation

GitHub Actions / lint

global import of path @openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)

Check warning on line 6 in contracts/child/ChildERC1155.sol

View workflow job for this annotation

GitHub Actions / lint

global import of path @openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)
import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";

Check warning on line 7 in contracts/child/ChildERC1155.sol

View workflow job for this annotation

GitHub Actions / lint

global import of path @openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)

Check warning on line 7 in contracts/child/ChildERC1155.sol

View workflow job for this annotation

GitHub Actions / lint

global import of path @openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)
import "../lib/EIP712MetaTransaction.sol";

Check warning on line 8 in contracts/child/ChildERC1155.sol

View workflow job for this annotation

GitHub Actions / lint

global import of path ../lib/EIP712MetaTransaction.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)

Check warning on line 8 in contracts/child/ChildERC1155.sol

View workflow job for this annotation

GitHub Actions / lint

global import of path ../lib/EIP712MetaTransaction.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)
import "../interfaces/child/IChildERC1155.sol";

Check warning on line 9 in contracts/child/ChildERC1155.sol

View workflow job for this annotation

GitHub Actions / lint

global import of path ../interfaces/child/IChildERC1155.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)

Check warning on line 9 in contracts/child/ChildERC1155.sol

View workflow job for this annotation

GitHub Actions / lint

global import of path ../interfaces/child/IChildERC1155.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)

/**
@title ChildERC1155
Expand All @@ -20,7 +20,7 @@
address private _rootToken;

modifier onlyPredicate() {
require(msg.sender == _predicate, "ChildERC1155: Only predicate can call");

Check warning on line 23 in contracts/child/ChildERC1155.sol

View workflow job for this annotation

GitHub Actions / lint

Error message for require is too long: 37 counted / 32 allowed

Check warning on line 23 in contracts/child/ChildERC1155.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements

Check warning on line 23 in contracts/child/ChildERC1155.sol

View workflow job for this annotation

GitHub Actions / lint

Error message for require is too long: 37 counted / 32 allowed

Check warning on line 23 in contracts/child/ChildERC1155.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements
_;
}

Expand All @@ -28,7 +28,7 @@
* @inheritdoc IChildERC1155
*/
function initialize(address rootToken_, string calldata uri_) external initializer {
require(rootToken_ != address(0), "ChildERC1155: BAD_INITIALIZATION");

Check warning on line 31 in contracts/child/ChildERC1155.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements

Check warning on line 31 in contracts/child/ChildERC1155.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements
_rootToken = rootToken_;
_predicate = msg.sender;
__ERC1155_init(uri_);
Expand Down Expand Up @@ -67,7 +67,7 @@
uint256[] calldata amounts
) external onlyPredicate returns (bool) {
uint256 length = accounts.length;
require(length == tokenIds.length && length == amounts.length, "ChildERC1155: array len mismatch");

Check warning on line 70 in contracts/child/ChildERC1155.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements

Check warning on line 70 in contracts/child/ChildERC1155.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements
for (uint256 i = 0; i < length; ) {
_mint(accounts[i], tokenIds[i], amounts[i], "");
unchecked {
Expand Down Expand Up @@ -102,4 +102,7 @@
function _msgSender() internal view virtual override(EIP712MetaTransaction, ContextUpgradeable) returns (address) {
return EIP712MetaTransaction._msgSender();
}

// slither-disable-next-line unused-state,naming-convention
uint256[50] private __gap;
}
7 changes: 5 additions & 2 deletions contracts/child/ChildERC1155Predicate.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

Check warning on line 4 in contracts/child/ChildERC1155Predicate.sol

View workflow job for this annotation

GitHub Actions / lint

global import of path @openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)

Check warning on line 4 in contracts/child/ChildERC1155Predicate.sol

View workflow job for this annotation

GitHub Actions / lint

global import of path @openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";

Check warning on line 5 in contracts/child/ChildERC1155Predicate.sol

View workflow job for this annotation

GitHub Actions / lint

global import of path @openzeppelin/contracts/token/ERC1155/IERC1155.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)

Check warning on line 5 in contracts/child/ChildERC1155Predicate.sol

View workflow job for this annotation

GitHub Actions / lint

global import of path @openzeppelin/contracts/token/ERC1155/IERC1155.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)
import "@openzeppelin/contracts/proxy/Clones.sol";
import "../interfaces/child/IChildERC1155Predicate.sol";
import "../interfaces/child/IChildERC1155.sol";
Expand Down Expand Up @@ -72,7 +72,7 @@
}

/**
* @notice Initilization function for ChildERC1155Predicate
* @notice Initialization function for ChildERC1155Predicate
* @param newL2StateSender Address of L2StateSender to send exit information to
* @param newStateReceiver Address of StateReceiver to receive deposit information from
* @param newRootERC1155Predicate Address of root ERC1155 predicate to communicate with
Expand Down Expand Up @@ -157,7 +157,7 @@
}

/**
* @notice Internal initilization function for ChildERC1155Predicate
* @notice Internal initialization function for ChildERC1155Predicate
* @param newL2StateSender Address of L2StateSender to send exit information to
* @param newStateReceiver Address of StateReceiver to receive deposit information from
* @param newRootERC1155Predicate Address of root ERC1155 predicate to communicate with
Expand Down Expand Up @@ -335,4 +335,7 @@
return false;
}
}

// slither-disable-next-line unused-state,naming-convention
uint256[50] private __gap;
}
3 changes: 3 additions & 0 deletions contracts/child/ChildERC1155PredicateAccessList.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,7 @@ contract ChildERC1155PredicateAccessList is AccessList, ChildERC1155Predicate {
function _beforeTokenWithdraw() internal virtual override {
_checkAccessList();
}

// slither-disable-next-line unused-state,naming-convention
uint256[50] private __gap;
}
3 changes: 3 additions & 0 deletions contracts/child/ChildERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,7 @@ contract ChildERC20 is EIP712MetaTransaction, ERC20Upgradeable, IChildERC20 {
function _msgSender() internal view virtual override(EIP712MetaTransaction, ContextUpgradeable) returns (address) {
return EIP712MetaTransaction._msgSender();
}

// slither-disable-next-line unused-state,naming-convention
uint256[50] private __gap;
}
5 changes: 4 additions & 1 deletion contracts/child/ChildERC20Predicate.sol
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ contract ChildERC20Predicate is IChildERC20Predicate, Initializable, System {
event L2TokenMapped(address indexed rootToken, address indexed childToken);

/**
* @notice Initilization function for ChildERC20Predicate
* @notice Initialization function for ChildERC20Predicate
* @param newL2StateSender Address of L2StateSender to send exit information to
* @param newStateReceiver Address of StateReceiver to receive deposit information from
* @param newRootERC20Predicate Address of root ERC20 predicate to communicate with
Expand Down Expand Up @@ -226,4 +226,7 @@ contract ChildERC20Predicate is IChildERC20Predicate, Initializable, System {
// slither-disable-next-line reentrancy-events
emit L2TokenMapped(rootToken, address(childToken));
}

// slither-disable-next-line unused-state,naming-convention
uint256[50] private __gap;
}
3 changes: 3 additions & 0 deletions contracts/child/ChildERC20PredicateAccessList.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,7 @@ contract ChildERC20PredicateAccessList is AccessList, ChildERC20Predicate {
function _beforeTokenWithdraw() internal virtual override {
_checkAccessList();
}

// slither-disable-next-line unused-state,naming-convention
uint256[50] private __gap;
}
3 changes: 3 additions & 0 deletions contracts/child/ChildERC721.sol
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,7 @@ contract ChildERC721 is EIP712MetaTransaction, ERC721Upgradeable, IChildERC721 {
function _msgSender() internal view virtual override(EIP712MetaTransaction, ContextUpgradeable) returns (address) {
return EIP712MetaTransaction._msgSender();
}

// slither-disable-next-line unused-state,naming-convention
uint256[50] private __gap;
}
7 changes: 5 additions & 2 deletions contracts/child/ChildERC721Predicate.sol
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ contract ChildERC721Predicate is IChildERC721Predicate, Initializable, System {
}

/**
* @notice Initilization function for ChildERC721Predicate
* @notice Initialization function for ChildERC721Predicate
* @param newL2StateSender Address of L2StateSender to send exit information to
* @param newStateReceiver Address of StateReceiver to receive deposit information from
* @param newRootERC721Predicate Address of root ERC721 predicate to communicate with
Expand Down Expand Up @@ -149,7 +149,7 @@ contract ChildERC721Predicate is IChildERC721Predicate, Initializable, System {
}

/**
* @notice Initilization function for ChildERC721Predicate
* @notice Initialization function for ChildERC721Predicate
* @param newL2StateSender Address of L2StateSender to send exit information to
* @param newStateReceiver Address of StateReceiver to receive deposit information from
* @param newRootERC721Predicate Address of root ERC721 predicate to communicate with
Expand Down Expand Up @@ -314,4 +314,7 @@ contract ChildERC721Predicate is IChildERC721Predicate, Initializable, System {
return false;
}
}

// slither-disable-next-line unused-state,naming-convention
uint256[50] private __gap;
}
3 changes: 3 additions & 0 deletions contracts/child/ChildERC721PredicateAccessList.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,7 @@ contract ChildERC721PredicateAccessList is AccessList, ChildERC721Predicate {
function _beforeTokenWithdraw() internal virtual override {
_checkAccessList();
}

// slither-disable-next-line unused-state,naming-convention
uint256[50] private __gap;
}
6 changes: 3 additions & 3 deletions contracts/child/EIP1559Burn.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ import "../interfaces/child/IChildERC20Predicate.sol";
contract EIP1559Burn is Initializable {
IChildERC20Predicate public childERC20Predicate;
address public burnDestination;
IChildERC20 private constant NATIVE_TOKEN = IChildERC20(0x0000000000000000000000000000000000001010);
IChildERC20 private constant _NATIVE_TOKEN = IChildERC20(0x0000000000000000000000000000000000001010);

event NativeTokenBurnt(address indexed burner, uint256 amount);

// slither-disable-next-line locked-ether
receive() external payable {} // solhint-disable-line no-empty-blocks

/**
* @notice Initilization function for EIP1559 burn contract
* @notice Initialization function for EIP1559 burn contract
* @param newChildERC20Predicate Address of the ERC20 predicate on child chain
* @param newBurnDestination Address on the root chain to burn the tokens and send to
* @dev Can only be called once
Expand All @@ -42,7 +42,7 @@ contract EIP1559Burn is Initializable {

uint256 balance = address(this).balance;

childERC20Predicate.withdrawTo(NATIVE_TOKEN, burnDestination, balance);
childERC20Predicate.withdrawTo(_NATIVE_TOKEN, burnDestination, balance);
// slither-disable-next-line reentrancy-events
emit NativeTokenBurnt(msg.sender, balance);
}
Expand Down
7 changes: 4 additions & 3 deletions contracts/child/ForkParams.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,25 @@
pragma solidity 0.8.19;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

/**
@title ForkParams
@author Polygon Technology (@QEDK)
@notice Configurable softfork features that are read by the client on each epoch
@dev The contract allows for configurable softfork parameters without genesis updation
*/
contract ForkParams is Ownable {
contract ForkParams is Ownable, Initializable {
mapping(bytes32 => uint256) public featureToBlockNumber; // keccak256("FEATURE_NAME") -> blockNumber

event NewFeature(bytes32 indexed feature, uint256 indexed block);
event UpdatedFeature(bytes32 indexed feature, uint256 indexed block);

/**
* @notice constructor function to set the owner
* @notice initialize function to set the owner
* @param newOwner address to transfer the ownership to
*/
constructor(address newOwner) {
function initialize(address newOwner) public initializer {
_transferOwnership(newOwner);
}

Expand Down
3 changes: 3 additions & 0 deletions contracts/child/L2StateSender.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,7 @@ contract L2StateSender is IStateSender {

emit L2StateSynced(++counter, msg.sender, receiver, data);
}

// slither-disable-next-line unused-state,naming-convention
uint256[50] private __gap;
}
32 changes: 17 additions & 15 deletions contracts/child/NativeERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ contract NativeERC20 is Context, Initializable, System, INativeERC20 {
address rootToken_,
string calldata name_,
string calldata symbol_,
uint8 decimals_
) external initializer onlySystemCall {
uint8 decimals_,
uint256 tokenSupply_
) external virtual initializer onlySystemCall {
// slither-disable-next-line missing-zero-check,events-access
_predicate = predicate_;
// slither-disable-next-line missing-zero-check
Expand All @@ -53,6 +54,7 @@ contract NativeERC20 is Context, Initializable, System, INativeERC20 {
_symbol = symbol_;
// slither-disable-next-line events-maths
_decimals = decimals_;
_totalSupply = tokenSupply_;
}

/**
Expand All @@ -63,7 +65,7 @@ contract NativeERC20 is Context, Initializable, System, INativeERC20 {
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address to, uint256 amount) external returns (bool) {
function transfer(address to, uint256 amount) external virtual returns (bool) {
address owner = _msgSender();
_transfer(owner, to, amount);
return true;
Expand All @@ -79,7 +81,7 @@ contract NativeERC20 is Context, Initializable, System, INativeERC20 {
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) external returns (bool) {
function approve(address spender, uint256 amount) external virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, amount);
return true;
Expand All @@ -101,7 +103,7 @@ contract NativeERC20 is Context, Initializable, System, INativeERC20 {
* - the caller must have allowance for ``from``'s tokens of at least
* `amount`.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool) {
function transferFrom(address from, address to, uint256 amount) external virtual returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, amount);
_transfer(from, to, amount);
Expand All @@ -120,7 +122,7 @@ contract NativeERC20 is Context, Initializable, System, INativeERC20 {
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) external returns (bool) {
function increaseAllowance(address spender, uint256 addedValue) external virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, allowance(owner, spender) + addedValue);
return true;
Expand All @@ -140,7 +142,7 @@ contract NativeERC20 is Context, Initializable, System, INativeERC20 {
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool) {
function decreaseAllowance(address spender, uint256 subtractedValue) external virtual returns (bool) {
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, spender);
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
Expand All @@ -154,7 +156,7 @@ contract NativeERC20 is Context, Initializable, System, INativeERC20 {
/**
* @inheritdoc INativeERC20
*/
function mint(address account, uint256 amount) external onlyPredicate returns (bool) {
function mint(address account, uint256 amount) external virtual onlyPredicate returns (bool) {
_mint(account, amount);

return true;
Expand All @@ -163,7 +165,7 @@ contract NativeERC20 is Context, Initializable, System, INativeERC20 {
/**
* @inheritdoc INativeERC20
*/
function burn(address account, uint256 amount) external onlyPredicate returns (bool) {
function burn(address account, uint256 amount) external virtual onlyPredicate returns (bool) {
_burn(account, amount);

return true;
Expand Down Expand Up @@ -218,7 +220,7 @@ contract NativeERC20 is Context, Initializable, System, INativeERC20 {
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view returns (uint256) {
function allowance(address owner, address spender) public view virtual returns (uint256) {
return _allowances[owner][spender];
}

Expand Down Expand Up @@ -250,7 +252,7 @@ contract NativeERC20 is Context, Initializable, System, INativeERC20 {
* - `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
*/
function _transfer(address from, address to, uint256 amount) internal {
function _transfer(address from, address to, uint256 amount) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");

Expand All @@ -270,7 +272,7 @@ contract NativeERC20 is Context, Initializable, System, INativeERC20 {
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");

_totalSupply += amount;
Expand All @@ -293,7 +295,7 @@ contract NativeERC20 is Context, Initializable, System, INativeERC20 {
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal {
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");

_totalSupply -= amount;
Expand All @@ -318,7 +320,7 @@ contract NativeERC20 is Context, Initializable, System, INativeERC20 {
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal {
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");

Expand All @@ -334,7 +336,7 @@ contract NativeERC20 is Context, Initializable, System, INativeERC20 {
*
* Might emit an {Approval} event.
*/
function _spendAllowance(address owner, address spender, uint256 amount) internal {
function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
Expand Down
Loading
Loading