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

merge to main #909

Merged
merged 29 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
7b18579
fix: remove unused state variable in LSP8 (#827)
CJ42 Dec 6, 2023
00a3142
docs: update LSP16 description (#838)
fhildeb Jan 3, 2024
b947ab3
chore: add `virtual` keyword in burn() in LSP8Burnable (#835)
YamenMerhi Jan 9, 2024
9795fed
refactor: [L-05] tokenIds and dataKeys can have different lengths in …
YamenMerhi Jan 9, 2024
99e9ffa
docs: [L-06] revokeOperator() does not protect against the double-spe…
YamenMerhi Jan 9, 2024
eb1f5e2
chore: remove duplicated check in isOperatorFor in LSP8 (#837)
YamenMerhi Jan 9, 2024
482c7b2
refactor: adjust LSP16 natspec and parameter name (#839)
YamenMerhi Jan 9, 2024
0a96dd4
ci: change event triggers for benchmark CI to include forks (#840)
YamenMerhi Jan 9, 2024
bca670f
ci: revert changes related to Benchmark CI (#842)
YamenMerhi Jan 10, 2024
7dec730
fix: restrict owner change in _beforeTokenTransfer
skimaharvey Jan 10, 2024
b6de951
fix: move _beforeTokenTransfer before balance check (#843)
skimaharvey Jan 11, 2024
cb696c9
fix: add existence check before the _beforeTokenTransfer hook (#844)
skimaharvey Jan 11, 2024
8605f99
docs: update auto-generated docs
CJ42 Jan 11, 2024
d043643
refactor: remove LSP7 & LSP8 compatible contracts (#845)
b00ste Jan 12, 2024
7d81c0d
Update and rename LSP16UniversalFactory.md to README.md (#848)
YamenMerhi Jan 12, 2024
e5fa354
docs: add `TESTING.md` (#847)
YamenMerhi Jan 15, 2024
4a82269
ci: create deployment script to deploy + verify base contracts on mai…
CJ42 Jan 24, 2024
7221a1e
docs: add latest LSP7 + LSP8 Tokens audit report (#861)
CJ42 Jan 25, 2024
364a3ef
feat: Add types for attributes (#870)
dzbo Feb 5, 2024
f2b1bc6
Make `attributes` optional (#872)
dzbo Feb 27, 2024
692fa6e
feat: Add contract asset type (#891)
dzbo Feb 27, 2024
654eb8b
feat!: allow Operator to revoke himself (#893)
YamenMerhi Feb 28, 2024
f77b558
Setup LSP Smart Contracts as Monorepo on develop (#902)
CJ42 Mar 4, 2024
2190438
docs: improve documentation for releasing specific packages
CJ42 Mar 4, 2024
c75470b
chore: release lsp-smart-contracts 0.15.0-rc.0 (#903)
CJ42 Mar 4, 2024
c885492
chore: release lsp7-contracts 0.15.0-rc.0 (#904)
CJ42 Mar 4, 2024
7dd1a1f
chore: release lsp8-contracts 0.15.0-rc.0 (#905)
CJ42 Mar 4, 2024
b5846a5
chore: try resolve merge conflicts for `package.json` from `develop` …
CJ42 Mar 5, 2024
122556d
Merge branch 'main' into resolve-conflicts-main (as cherry-pick) (#908)
CJ42 Mar 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 0 additions & 12 deletions .eslintrc.json

This file was deleted.

9 changes: 7 additions & 2 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:

# compare gas diff only when editing Solidity smart contract code
paths:
- "contracts/**/*.sol"
- "packages/**/contracts/**/*.sol"

# do not run on releases (merging to main)
branches-ignore:
Expand All @@ -22,6 +22,9 @@ on:
jobs:
benchmark:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./packages/lsp-smart-contracts

steps:
- name: Checkout base branch
Expand All @@ -40,7 +43,9 @@ jobs:
run: npm ci

- name: 🏗️ Build contract artifacts
run: npx hardhat compile
run: |
npm run build
npm run build:turbo

- name: 🧪 Run Benchmark tests
# Rename the file to be able to generate benchmark JSON report
Expand Down
109 changes: 21 additions & 88 deletions .github/workflows/build-lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ name: Node.js CI - Build + Lint + Test
on: pull_request

jobs:
build:
build-lint-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
- name: Use Node.js '16.15.0'
uses: actions/setup-node@v2
- name: Use Node.js v20
uses: actions/setup-node@v3
with:
node-version: "16.15.0"
node-version: "20.x"
cache: "npm"

- name: 📦 Install dependencies
Expand All @@ -29,87 +29,20 @@ jobs:

# This will also generate the Typechain types used by the Chai tests
- name: 🏗️ Build contract artifacts
run: npx hardhat compile

- name: 📤 cache dependencies + build
uses: actions/cache@v2
with:
path: |
artifacts
node_modules
types
contracts.ts
key: ${{ github.run_id }}

- name: 🧪 run import/requires tests
run: npm run test:importRequire

- name: 📚 generate ABI docs
run: npm run build:docs

- name: 🔍 check if ABI auto-generated docs need to be updated
run: |-
if [[ $(git diff --name-only) != "" ]];
then
echo "Error: Please generate ABI docs after making changes to Solidity code and Natspec comments!"
exit 1
fi

test-suites:
strategy:
matrix:
lsp:
[
"up",
"upinit",
"lsp1",
"lsp2",
"lsp6",
"lsp6init",
"lsp7",
"lsp7init",
"lsp8",
"lsp8init",
"lsp9",
"lsp9init",
"lsp11",
"lsp11init",
"lsp17",
"lsp17extensions",
"lsp20",
"lsp20init",
"lsp23",
"universalfactory",
"reentrancy",
"reentrancyinit",
"mocks",
]

runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v3

- name: 📥 restore cache
uses: actions/cache@v2
id: "build-cache"
with:
path: |
artifacts
node_modules
types
contracts.ts
key: ${{ github.run_id }}

- name: Use Node.js v16
uses: actions/setup-node@v2
with:
node-version: "16.x"
cache: "npm"

- name: Install dependencies
if: steps.build-cache.outputs.cache-hit != 'true'
run: npm ci

- name: 🧪 run tests
run: npm run test:${{ matrix.lsp }}
run: |
npm run build
npm run build:js

# - name: 📚 generate ABI docs
# run: npm run build:docs

# - name: 🔍 check if ABI auto-generated docs need to be updated
# run: |-
# if [[ $(git diff --name-only) != "" ]];
# then
# echo "Error: Please generate ABI docs after making changes to Solidity code and Natspec comments!"
# exit 1
# fi

- name: 🧪 Run tests for each package
run: npm run test
98 changes: 31 additions & 67 deletions .github/workflows/deploy-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
name: Deploy + Verify Contracts on Testnet

env:
# 0x983aBC616f2442bAB7a917E6bb8660Df8b01F3bF
CONTRACT_VERIFICATION_TESTNET_PK: ${{ secrets.CONTRACT_VERIFICATION_TESTNET_PK }}
DEPLOYER_ADDRESS: "0x983aBC616f2442bAB7a917E6bb8660Df8b01F3bF"
# 0xF0efeD8d49c0FA6CFC861Bf0311b6B3a4414e4b7
CONTRACT_VERIFICATION_MAINNET_PK: ${{ secrets.CONTRACT_VERIFICATION_MAINNET_PK }}

on:
workflow_dispatch:
Expand All @@ -12,83 +14,45 @@ on:
- "main"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Use Node.js '16.15.0'
uses: actions/setup-node@v3
with:
node-version: "16.x"
cache: "npm"

- name: Install dependencies
run: npm ci

# This will also generate the Typechain types used by the Chai tests
- name: Build contract artifacts
run: npx hardhat compile

- name: cache dependencies + build
uses: actions/cache@v2
with:
path: |
artifacts
node_modules
types
contracts.ts
key: ${{ github.run_id }}

deploy-verify:
runs-on: ubuntu-latest
needs: [build]
strategy:
# run each base contract verification one after the other to prevent submitting multiple transactions at the same time with the same nonce.
max-parallel: 1
matrix:
contracts: [
# Standard contracts
"UniversalProfile",
"LSP6KeyManager",
"LSP1UniversalReceiverDelegateUP",
"LSP1UniversalReceiverDelegateVault",
"LSP7Mintable",
"LSP8Mintable",
"LSP9Vault",
# Base contracts (for proxies)
"UniversalProfileInit",
"LSP6KeyManagerInit",
"LSP7MintableInit",
"LSP8MintableInit",
"LSP9VaultInit",
]
network: ["luksoTestnet", "luksoMainnet"]

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: restore cache
uses: actions/cache@v2
id: "build-cache"
with:
path: |
artifacts
node_modules
types
contracts.ts
key: ${{ github.run_id }}

- name: Use Node.js v16
- name: Use Node.js v20
uses: actions/setup-node@v3
with:
node-version: "16.x"
node-version: "20.x"
cache: "npm"

- name: Install dependencies
if: steps.build-cache.outputs.cache-hit != 'true'
run: npm ci

- name: Verify Deployer Balance
run: npx ts-node ./scripts/ci/check-deployer-balance.ts
- name: Build contract artifacts
run: npm run build

- name: Deploy + Verify ${{ matrix.contracts }} on Testnet
run: sh ./scripts/ci/deploy-verify.sh -n luksoTestnet -c ${{ matrix.contracts }}
- name: Verify Deployer Balance
run: npx hardhat verify-balance --network ${{ matrix.network }}

# We do not deploy the standard contracts on mainnet for the following reasons:
# 1) standard contracts are expensive to deploy on mainnet
# 2) user's universal profiles use the minimal proxy pattern,
#
# therefore we only need the base contracts to be deployed on mainnet.
- name: Select tags based on network to deploy
run: |
TAGS="base"
if [[ ${{ matrix.network }} == "luksoTestnet"]]; then
TAGS+=",standard"
fi

- name: Deploy contracts on network
run: npx hardhat deploy --network ${{ matrix.network }} --tags $TAGS --write true

# Loop through deployment files and recover address of deployed contracts to verify
- name: Verify deployed contracts on mainnet
run: npx hardhat verify-all --network ${{ matrix.network }}
38 changes: 20 additions & 18 deletions .github/workflows/foundry-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on:
pull_request:
# compare gas diff only when editing Solidity smart contract code
paths:
- "contracts/**/*.sol"
- "tests/foundry/**/*.sol"
- "packages/**/*.sol"
- "packages/lsp-smart-contracts/tests/foundry/**/*.sol"

jobs:
foundry-tests:
Expand All @@ -24,7 +24,9 @@ jobs:
run: npm ci

- name: NPM build
run: npx hardhat compile
run: |
npm run build
npm run build:foundry

- name: Run Foundry tests
run: npm run test:foundry
Expand All @@ -34,18 +36,18 @@ jobs:
# due to non-deterministic fuzzing (but still use pseudo-random fuzzing seeds)
FOUNDRY_FUZZ_SEED: 0x${{ github.event.pull_request.base.sha || github.sha }}

- name: Compare gas reports
uses: Rubilmax/[email protected]
with:
summaryQuantile: 0.9 # only display the 10% most significant gas diffs in the summary (defaults to 20%)
sortCriteria: avg,max # sort diff rows by criteria
sortOrders: desc,asc # and directions
id: gas_diff

- name: Add gas diff to sticky comment
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
uses: marocchino/sticky-pull-request-comment@v2
with:
# delete the comment in case changes no longer impact gas costs
delete: ${{ !steps.gas_diff.outputs.markdown }}
message: ${{ steps.gas_diff.outputs.markdown }}
# - name: Compare gas reports
# uses: Rubilmax/[email protected]
# with:
# summaryQuantile: 0.9 # only display the 10% most significant gas diffs in the summary (defaults to 20%)
# sortCriteria: avg,max # sort diff rows by criteria
# sortOrders: desc,asc # and directions
# id: gas_diff

# - name: Add gas diff to sticky comment
# if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
# uses: marocchino/sticky-pull-request-comment@v2
# with:
# # delete the comment in case changes no longer impact gas costs
# delete: ${{ !steps.gas_diff.outputs.markdown }}
# message: ${{ steps.gas_diff.outputs.markdown }}
18 changes: 12 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,32 +28,38 @@ jobs:
# a new release is created:

- uses: actions/checkout@v3
if: ${{ steps.release.outputs.release_created }}
if: ${{ steps.release.outputs.releases_created }}

- name: Use Node.js '16.15.0'
uses: actions/setup-node@v2
if: ${{ steps.release.outputs.release_created }}
if: ${{ steps.release.outputs.releases_created }}
with:
node-version: "16.15.0"
registry-url: "https://registry.npmjs.org"
scope: "@lukso"
cache: "npm"

- name: Install Dependencies
if: ${{ steps.release.outputs.release_created }}
if: ${{ steps.release.outputs.releases_created }}
run: npm ci

# `npm run build:js` will also generate the auto-generated constants for methods, errors and events,
# including extracting their devdocs and userdocs
- name: Prepare artifacts to publish
if: ${{ steps.release.outputs.release_created }}
if: ${{ steps.release.outputs.releases_created }}
run: |
npm run build
npm run build:js
npm run package
npm run build:types

- name: Publish on NPM
if: ${{ steps.release.outputs.release_created }}
run: npm publish --access public
if: ${{ steps.release.outputs.releases_created }}
run: |
(cat <<END > outputs.json
${{toJSON(steps.release.outputs)}}
END
)
node ./publish.mjs outputs.json
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_KEY }}
Loading
Loading