-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
711 changed files
with
123,688 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json", | ||
"changelog": [ | ||
"@changesets/changelog-github", | ||
{ | ||
"repo": "OpenZeppelin/openzeppelin-contracts" | ||
} | ||
], | ||
"commit": false, | ||
"access": "public", | ||
"baseBranch": "master" | ||
} |
5 changes: 5 additions & 0 deletions
5
lib/openzeppelin-contracts/.changeset/eighty-hounds-promise.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'openzeppelin-solidity': minor | ||
--- | ||
|
||
`Strings`: Add `parseUint`, `parseInt`, `parseHexUint` and `parseAddress` to parse strings into numbers and addresses. Also provide variants of these functions that parse substrings, and `tryXxx` variants that do not revert on invalid input. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"openzeppelin-solidity": minor | ||
--- | ||
|
||
`Clones`: Add `cloneWithImmutableArgs` and `cloneDeterministicWithImmutableArgs` variants that create clones with per-instance immutable arguments. The immutable arguments can be retrieved using `fetchCloneArgs`. The corresponding `predictDeterministicWithImmutableArgs` function is also included. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'openzeppelin-solidity': patch | ||
--- | ||
|
||
`VotesExtended`: Create an extension of `Votes` which checkpoints balances and delegates. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'openzeppelin-solidity': minor | ||
--- | ||
|
||
`CAIP2` and `CAIP10`: Add libraries for formatting and parsing CAIP-2 and CAIP-10 identifiers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'openzeppelin-solidity': patch | ||
--- | ||
|
||
`GovernorCountingOverridable`: Add a governor counting module that enables token holders to override the vote of their delegate. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'openzeppelin-solidity': minor | ||
--- | ||
|
||
`Bytes`: Add a library of common operation that operate on `bytes` objects. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'openzeppelin-solidity': minor | ||
--- | ||
|
||
`ERC1363Utils`: Add helper similar to the existing `ERC721Utils` and `ERC1155Utils` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
comment: off | ||
github_checks: | ||
annotations: false | ||
coverage: | ||
status: | ||
patch: | ||
default: | ||
target: 95% | ||
only_pulls: true | ||
project: | ||
default: | ||
threshold: 1% | ||
ignore: | ||
- "test" | ||
- "contracts/mocks" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# EditorConfig is awesome: https://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = false | ||
max_line_length = 120 | ||
|
||
[*.sol] | ||
indent_size = 4 | ||
|
||
[*.js] | ||
indent_size = 2 | ||
|
||
[*.{adoc,md}] | ||
max_line_length = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"root": true, | ||
"extends" : [ | ||
"eslint:recommended", | ||
"prettier", | ||
], | ||
"env": { | ||
"es2022": true, | ||
"browser": true, | ||
"node": true, | ||
"mocha": true, | ||
}, | ||
"globals" : { | ||
"artifacts": "readonly", | ||
"contract": "readonly", | ||
"web3": "readonly", | ||
"extendEnvironment": "readonly", | ||
"expect": "readonly", | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
if [ "${CI:-"false"}" != "true" ]; then | ||
npm run test:generation | ||
npm run lint | ||
fi |
21 changes: 21 additions & 0 deletions
21
lib/openzeppelin-contracts/.github/ISSUE_TEMPLATE/bug_report.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
name: Bug report | ||
about: Report a bug in OpenZeppelin Contracts | ||
|
||
--- | ||
|
||
<!-- Briefly describe the issue you're experiencing. Tell us what you were trying to do and what happened instead. --> | ||
|
||
<!-- Remember, this is not a place to ask for help debugging code. For that, we welcome you in the OpenZeppelin Community Forum: https://forum.openzeppelin.com/. --> | ||
|
||
**💻 Environment** | ||
|
||
<!-- Tell us what version of OpenZeppelin Contracts you're using, and how you're using it: Hardhat, Remix, etc. --> | ||
|
||
**📝 Details** | ||
|
||
<!-- Describe the problem you have been experiencing in more detail. Include as much information as you think is relevant. Keep in mind that transactions can fail for many reasons; context is key here. --> | ||
|
||
**🔢 Code to reproduce bug** | ||
|
||
<!-- We will be able to better help if you provide a minimal example that triggers the bug. --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
contact_links: | ||
- name: Questions & Support Requests | ||
url: https://forum.openzeppelin.com/c/support/contracts/18 | ||
about: Ask in the OpenZeppelin Forum |
14 changes: 14 additions & 0 deletions
14
lib/openzeppelin-contracts/.github/ISSUE_TEMPLATE/feature_request.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest an idea for OpenZeppelin Contracts | ||
|
||
--- | ||
|
||
**🧐 Motivation** | ||
<!-- Is your feature request related to a specific problem? Is it just a crazy idea? Tell us about it! --> | ||
|
||
**📝 Details** | ||
<!-- Please describe your feature request in detail. --> | ||
|
||
<!-- Make sure that you have reviewed the OpenZeppelin Contracts Contributor Guidelines. --> | ||
<!-- https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/CONTRIBUTING.md --> |
20 changes: 20 additions & 0 deletions
20
lib/openzeppelin-contracts/.github/PULL_REQUEST_TEMPLATE.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!-- Thank you for your interest in contributing to OpenZeppelin! --> | ||
|
||
<!-- Consider opening an issue for discussion prior to submitting a PR. --> | ||
<!-- New features will be merged faster if they were first discussed and designed with the team. --> | ||
|
||
Fixes #???? <!-- Fill in with issue number --> | ||
|
||
<!-- Describe the changes introduced in this pull request. --> | ||
<!-- Include any context necessary for understanding the PR's purpose. --> | ||
|
||
|
||
#### PR Checklist | ||
|
||
<!-- Before merging the pull request all of the following must be complete. --> | ||
<!-- Feel free to submit a PR or Draft PR even if some items are pending. --> | ||
<!-- Some of the items may not apply. --> | ||
|
||
- [ ] Tests | ||
- [ ] Documentation | ||
- [ ] Changeset entry (run `npx changeset add`) |
50 changes: 50 additions & 0 deletions
50
lib/openzeppelin-contracts/.github/actions/gas-compare/action.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Compare gas costs | ||
description: Compare gas costs between branches | ||
inputs: | ||
token: | ||
description: github token | ||
required: true | ||
report: | ||
description: report to read from | ||
required: false | ||
default: gasReporterOutput.json | ||
out_report: | ||
description: report to read | ||
required: false | ||
default: ${{ github.ref_name }}.gasreport.json | ||
ref_report: | ||
description: report to read from | ||
required: false | ||
default: ${{ github.base_ref }}.gasreport.json | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Download reference report | ||
if: github.event_name == 'pull_request' | ||
run: | | ||
RUN_ID=`gh run list --repo ${{ github.repository }} --branch ${{ github.base_ref }} --workflow ${{ github.workflow }} --limit 100 --json 'conclusion,databaseId,event' --jq 'map(select(.conclusion=="success" and .event!="pull_request"))[0].databaseId'` | ||
gh run download ${RUN_ID} --repo ${{ github.repository }} -n gasreport | ||
env: | ||
GITHUB_TOKEN: ${{ inputs.token }} | ||
shell: bash | ||
continue-on-error: true | ||
id: reference | ||
- name: Compare reports | ||
if: steps.reference.outcome == 'success' && github.event_name == 'pull_request' | ||
run: | | ||
node scripts/checks/compareGasReports.js ${{ inputs.report }} ${{ inputs.ref_report }} >> $GITHUB_STEP_SUMMARY | ||
env: | ||
STYLE: markdown | ||
shell: bash | ||
- name: Rename report for upload | ||
if: github.event_name != 'pull_request' | ||
run: | | ||
mv ${{ inputs.report }} ${{ inputs.out_report }} | ||
shell: bash | ||
- name: Save report | ||
if: github.event_name != 'pull_request' | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: gasreport | ||
path: ${{ inputs.out_report }} |
22 changes: 22 additions & 0 deletions
22
lib/openzeppelin-contracts/.github/actions/setup/action.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Setup | ||
description: Common environment setup | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.x | ||
- uses: actions/cache@v4 | ||
id: cache | ||
with: | ||
path: '**/node_modules' | ||
key: npm-v3-${{ hashFiles('**/package-lock.json') }} | ||
- name: Install dependencies | ||
run: npm ci | ||
shell: bash | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: nightly |
56 changes: 56 additions & 0 deletions
56
lib/openzeppelin-contracts/.github/actions/storage-layout/action.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Compare storage layouts | ||
description: Compare storage layouts between branches | ||
inputs: | ||
token: | ||
description: github token | ||
required: true | ||
buildinfo: | ||
description: compilation artifacts | ||
required: false | ||
default: artifacts/build-info/*.json | ||
layout: | ||
description: extracted storage layout | ||
required: false | ||
default: HEAD.layout.json | ||
out_layout: | ||
description: storage layout to upload | ||
required: false | ||
default: ${{ github.ref_name }}.layout.json | ||
ref_layout: | ||
description: storage layout for the reference branch | ||
required: false | ||
default: ${{ github.base_ref }}.layout.json | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Extract layout | ||
run: | | ||
node scripts/checks/extract-layout.js ${{ inputs.buildinfo }} > ${{ inputs.layout }} | ||
shell: bash | ||
- name: Download reference | ||
if: github.event_name == 'pull_request' | ||
run: | | ||
RUN_ID=`gh run list --repo ${{ github.repository }} --branch ${{ github.base_ref }} --workflow ${{ github.workflow }} --limit 100 --json 'conclusion,databaseId,event' --jq 'map(select(.conclusion=="success" and .event!="pull_request"))[0].databaseId'` | ||
gh run download ${RUN_ID} --repo ${{ github.repository }} -n layout | ||
env: | ||
GITHUB_TOKEN: ${{ inputs.token }} | ||
shell: bash | ||
continue-on-error: true | ||
id: reference | ||
- name: Compare layouts | ||
if: steps.reference.outcome == 'success' && github.event_name == 'pull_request' | ||
run: | | ||
node scripts/checks/compare-layout.js --head ${{ inputs.layout }} --ref ${{ inputs.ref_layout }} | ||
shell: bash | ||
- name: Rename artifacts for upload | ||
if: github.event_name != 'pull_request' | ||
run: | | ||
mv ${{ inputs.layout }} ${{ inputs.out_layout }} | ||
shell: bash | ||
- name: Save artifacts | ||
if: github.event_name != 'pull_request' | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: layout | ||
path: ${{ inputs.out_layout }} |
18 changes: 18 additions & 0 deletions
18
lib/openzeppelin-contracts/.github/workflows/actionlint.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: lint workflows | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- '.github/**/*.ya?ml' | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Add problem matchers | ||
run: | | ||
# https://github.com/rhysd/actionlint/blob/3a2f2c7/docs/usage.md#problem-matchers | ||
curl -LO https://raw.githubusercontent.com/rhysd/actionlint/main/.github/actionlint-matcher.json | ||
echo "::add-matcher::actionlint-matcher.json" | ||
- uses: docker://rhysd/actionlint:latest |
28 changes: 28 additions & 0 deletions
28
lib/openzeppelin-contracts/.github/workflows/changeset.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: changeset | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
types: | ||
- opened | ||
- synchronize | ||
- labeled | ||
- unlabeled | ||
|
||
concurrency: | ||
group: changeset-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
if: ${{ !contains(github.event.pull_request.labels.*.name, 'ignore-changeset') }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Include history so Changesets finds merge-base | ||
- name: Set up environment | ||
uses: ./.github/actions/setup | ||
- name: Check changeset | ||
run: npx changeset status --since=origin/${{ github.base_ref }} |
Oops, something went wrong.