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 LSP7Votes and LSP8Votes extension to support LSP-based Governance #980

Merged
merged 17 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 2 additions & 4 deletions .github/workflows/build-lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@ jobs:
- name: 🎨 Run ESLint on JS/TS files
run: npm run lint

# This will also generate the Typechain types used by the Chai tests
# This will also generate the Typechain types and the files with the constants used by the Chai tests
- name: 🏗️ Build contract artifacts
run: |
npm run build
npm run build:js
run: npm run build

# - name: 📚 generate ABI docs
# run: npm run build:docs
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,14 @@ jobs:

# `npm run build:js` will also generate the auto-generated constants for methods, errors and events,
# including extracting their devdocs and userdocs
# `npm run build:types` will generate:
# - the artifacts with abis for release (artifacts/*.json)
# - the wagmi hooks (types/index.ts)
# - the typed abis (types/index.ts)
- name: Prepare artifacts to publish
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
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,5 @@ gas_benchmark.md

# Custom setup
foundry_artifacts/

wagmi.config.bundled_*.mjs
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"plugins": ["prettier-plugin-solidity"],
"overrides": [
{
"files": ["*.js", "*.ts"],
"files": ["*.js", "*.ts", "*.mjs"],
"options": {
"tabWidth": 2,
"printWidth": 100,
Expand Down
3,385 changes: 2,501 additions & 884 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
],
"scripts": {
"preinstall": "npx --yes force-resolutions",
"build": "turbo build",
"build": "turbo build && turbo build:js",
"build:foundry": "turbo build:foundry",
"build:js": "turbo build:js",
"build:types": "turbo build:types",
"build:types": "turbo package && turbo build:types",
"clean": "turbo clean",
"format": "prettier --write .",
"lint": "turbo lint",
Expand Down Expand Up @@ -74,6 +74,7 @@
"@turbo/gen": "^1.12.3",
"@typechain/ethers-v6": "^0.5.1",
"@typechain/hardhat": "9.1.0",
"@wagmi/cli": "^2.1.18",
"all-contributors-cli": "^6.26.1",
"dotenv": "^16.0.3",
"esbuild": "^0.17.15",
Expand Down
27 changes: 11 additions & 16 deletions packages/lsp-smart-contracts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,42 @@ All notable changes to this project will be documented in this file. See [standa

## [0.15.0-rc.0](https://github.com/lukso-network/lsp-smart-contracts/compare/lsp-smart-contracts-v0.15.0-rc.0...lsp-smart-contracts-v0.15.0-rc.0) (2024-03-07)


### Miscellaneous Chores

* release 0.12.0 ([fbbec61](https://github.com/lukso-network/lsp-smart-contracts/commit/fbbec6199c6351721acedb35110fc1cc7bbb65ad))
* release 0.13.0 ([#817](https://github.com/lukso-network/lsp-smart-contracts/issues/817)) ([1bd2f5f](https://github.com/lukso-network/lsp-smart-contracts/commit/1bd2f5f699ecdbef857527cdac50df50dc051002))
- release 0.12.0 ([fbbec61](https://github.com/lukso-network/lsp-smart-contracts/commit/fbbec6199c6351721acedb35110fc1cc7bbb65ad))
- release 0.13.0 ([#817](https://github.com/lukso-network/lsp-smart-contracts/issues/817)) ([1bd2f5f](https://github.com/lukso-network/lsp-smart-contracts/commit/1bd2f5f699ecdbef857527cdac50df50dc051002))

## [0.15.0-rc.0](https://github.com/lukso-network/lsp-smart-contracts/compare/lsp-smart-contracts-v0.15.0-rc.0...lsp-smart-contracts-v0.15.0-rc.0) (2024-03-06)


### Miscellaneous Chores

* release 0.12.0 ([fbbec61](https://github.com/lukso-network/lsp-smart-contracts/commit/fbbec6199c6351721acedb35110fc1cc7bbb65ad))
* release 0.13.0 ([#817](https://github.com/lukso-network/lsp-smart-contracts/issues/817)) ([1bd2f5f](https://github.com/lukso-network/lsp-smart-contracts/commit/1bd2f5f699ecdbef857527cdac50df50dc051002))
- release 0.12.0 ([fbbec61](https://github.com/lukso-network/lsp-smart-contracts/commit/fbbec6199c6351721acedb35110fc1cc7bbb65ad))
- release 0.13.0 ([#817](https://github.com/lukso-network/lsp-smart-contracts/issues/817)) ([1bd2f5f](https://github.com/lukso-network/lsp-smart-contracts/commit/1bd2f5f699ecdbef857527cdac50df50dc051002))

## [0.15.0-rc.0](https://github.com/lukso-network/lsp-smart-contracts/compare/lsp-smart-contracts-v0.15.0-rc.0...lsp-smart-contracts-v0.15.0-rc.0) (2024-03-06)


### Miscellaneous Chores

* release 0.12.0 ([fbbec61](https://github.com/lukso-network/lsp-smart-contracts/commit/fbbec6199c6351721acedb35110fc1cc7bbb65ad))
* release 0.13.0 ([#817](https://github.com/lukso-network/lsp-smart-contracts/issues/817)) ([1bd2f5f](https://github.com/lukso-network/lsp-smart-contracts/commit/1bd2f5f699ecdbef857527cdac50df50dc051002))
- release 0.12.0 ([fbbec61](https://github.com/lukso-network/lsp-smart-contracts/commit/fbbec6199c6351721acedb35110fc1cc7bbb65ad))
- release 0.13.0 ([#817](https://github.com/lukso-network/lsp-smart-contracts/issues/817)) ([1bd2f5f](https://github.com/lukso-network/lsp-smart-contracts/commit/1bd2f5f699ecdbef857527cdac50df50dc051002))

## 0.15.0-rc.0 (2024-03-06)


### Miscellaneous Chores

* release 0.12.0 ([fbbec61](https://github.com/lukso-network/lsp-smart-contracts/commit/fbbec6199c6351721acedb35110fc1cc7bbb65ad))
* release 0.13.0 ([#817](https://github.com/lukso-network/lsp-smart-contracts/issues/817)) ([1bd2f5f](https://github.com/lukso-network/lsp-smart-contracts/commit/1bd2f5f699ecdbef857527cdac50df50dc051002))
- release 0.12.0 ([fbbec61](https://github.com/lukso-network/lsp-smart-contracts/commit/fbbec6199c6351721acedb35110fc1cc7bbb65ad))
- release 0.13.0 ([#817](https://github.com/lukso-network/lsp-smart-contracts/issues/817)) ([1bd2f5f](https://github.com/lukso-network/lsp-smart-contracts/commit/1bd2f5f699ecdbef857527cdac50df50dc051002))

## [0.14.0](https://github.com/lukso-network/lsp-smart-contracts/compare/lsp-smart-contracts-v0.13.0...lsp-smart-contracts-v0.14.0) (2023-12-06)


### ⚠ BREAKING CHANGES

* change set/get TokenId function name in LSP8 and `LSP8TokenIdSchema` to `LSP8TokenIdFormat` ([#822](https://github.com/lukso-network/lsp-smart-contracts/issues/822))
- change set/get TokenId function name in LSP8 and `LSP8TokenIdSchema` to `LSP8TokenIdFormat` ([#822](https://github.com/lukso-network/lsp-smart-contracts/issues/822))

### Code Refactoring

* change LSP4 Mapping data key from `bytes12` to `bytes10` ([#824](https://github.com/lukso-network/lsp-smart-contracts/pull/824))
* change set/get TokenId function name in LSP8 and `LSP8TokenIdSchema` to `LSP8TokenIdFormat` ([#822](https://github.com/lukso-network/lsp-smart-contracts/issues/822)) ([2bf84f6](https://github.com/lukso-network/lsp-smart-contracts/commit/2bf84f638926a9969385ce12f98f389b26ca0173))
- change LSP4 Mapping data key from `bytes12` to `bytes10` ([#824](https://github.com/lukso-network/lsp-smart-contracts/pull/824))
- change set/get TokenId function name in LSP8 and `LSP8TokenIdSchema` to `LSP8TokenIdFormat` ([#822](https://github.com/lukso-network/lsp-smart-contracts/issues/822)) ([2bf84f6](https://github.com/lukso-network/lsp-smart-contracts/commit/2bf84f638926a9969385ce12f98f389b26ca0173))

## [0.13.0](https://github.com/lukso-network/lsp-smart-contracts/compare/lsp-smart-contracts-v0.13.0...lsp-smart-contracts-v0.12.1) (2023-11-30)

Expand Down
10 changes: 10 additions & 0 deletions packages/lsp-smart-contracts/contracts/Mocks/LSP1TypeIDsTester.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import {
_TYPEID_LSP7_TOKENSRECIPIENT,
_TYPEID_LSP7_TOKENOPERATOR
} from "@lukso/lsp7-contracts/contracts/LSP7Constants.sol";
import {
_TYPEID_LSP7_VOTESDELEGATOR,
_TYPEID_LSP7_VOTESDELEGATEE
} from "@lukso/lsp7-contracts/contracts/extensions/LSP7VotesConstants.sol";
import {
_TYPEID_LSP8_TOKENSSENDER,
_TYPEID_LSP8_TOKENSRECIPIENT,
Expand Down Expand Up @@ -60,6 +64,12 @@ contract LSP1TypeIDsTester {
_typeIds[
"LSP7Tokens_OperatorNotification"
] = _TYPEID_LSP7_TOKENOPERATOR;
_typeIds[
"LSP7Tokens_VotesDelegatorNotification"
] = _TYPEID_LSP7_VOTESDELEGATOR;
_typeIds[
"LSP7Tokens_VotesDelegateeNotification"
] = _TYPEID_LSP7_VOTESDELEGATEE;
// ------------------

// ------ LSP8 ------
Expand Down
2 changes: 1 addition & 1 deletion packages/lsp-smart-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"build": "hardhat compile --show-stack-traces",
"build:foundry": "forge build",
"build:js": "unbuild",
"build:types": "npx typechain --target=ethers-v6 ./artifacts/*.json --out-dir types",
"build:types": "npx wagmi generate",
"build:docs": "hardhat dodoc && prettier -w ./docs && bash dodoc/postProcessingContracts.sh && dodoc/postProcessingLibraries.sh",
"clean": "hardhat clean && rm -Rf dist/",
"format": "prettier --write .",
Expand Down
19 changes: 19 additions & 0 deletions packages/lsp-smart-contracts/wagmi.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { defineConfig } from '@wagmi/cli';
import { react } from '@wagmi/cli/plugins';
import fs from 'fs';

const artifacts = fs.readdirSync('./artifacts', {});

const contractsWagmiInputs = artifacts.map((artifact) => {
const jsonArtifact = JSON.parse(fs.readFileSync(`./artifacts/${artifact}`, 'utf-8'));
return {
name: jsonArtifact.contractName,
abi: jsonArtifact.abi,
};
});

export default defineConfig({
out: 'types/index.ts',
contracts: contractsWagmiInputs,
plugins: [react()],
});
20 changes: 8 additions & 12 deletions packages/lsp0-contracts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,28 @@

## [0.15.0-rc.0](https://github.com/lukso-network/lsp-smart-contracts/compare/lsp0-contracts-v0.15.0-rc.0...lsp0-contracts-v0.15.0-rc.0) (2024-03-07)


### Miscellaneous Chores

* release 0.12.0 ([fbbec61](https://github.com/lukso-network/lsp-smart-contracts/commit/fbbec6199c6351721acedb35110fc1cc7bbb65ad))
* release 0.13.0 ([#817](https://github.com/lukso-network/lsp-smart-contracts/issues/817)) ([1bd2f5f](https://github.com/lukso-network/lsp-smart-contracts/commit/1bd2f5f699ecdbef857527cdac50df50dc051002))
- release 0.12.0 ([fbbec61](https://github.com/lukso-network/lsp-smart-contracts/commit/fbbec6199c6351721acedb35110fc1cc7bbb65ad))
- release 0.13.0 ([#817](https://github.com/lukso-network/lsp-smart-contracts/issues/817)) ([1bd2f5f](https://github.com/lukso-network/lsp-smart-contracts/commit/1bd2f5f699ecdbef857527cdac50df50dc051002))

## [0.15.0-rc.0](https://github.com/lukso-network/lsp-smart-contracts/compare/lsp0-contracts-v0.15.0-rc.0...lsp0-contracts-v0.15.0-rc.0) (2024-03-06)


### Miscellaneous Chores

* release 0.12.0 ([fbbec61](https://github.com/lukso-network/lsp-smart-contracts/commit/fbbec6199c6351721acedb35110fc1cc7bbb65ad))
* release 0.13.0 ([#817](https://github.com/lukso-network/lsp-smart-contracts/issues/817)) ([1bd2f5f](https://github.com/lukso-network/lsp-smart-contracts/commit/1bd2f5f699ecdbef857527cdac50df50dc051002))
- release 0.12.0 ([fbbec61](https://github.com/lukso-network/lsp-smart-contracts/commit/fbbec6199c6351721acedb35110fc1cc7bbb65ad))
- release 0.13.0 ([#817](https://github.com/lukso-network/lsp-smart-contracts/issues/817)) ([1bd2f5f](https://github.com/lukso-network/lsp-smart-contracts/commit/1bd2f5f699ecdbef857527cdac50df50dc051002))

## [0.15.0-rc.0](https://github.com/lukso-network/lsp-smart-contracts/compare/lsp0-contracts-v0.14.0...lsp0-contracts-v0.15.0-rc.0) (2024-03-06)


### Miscellaneous Chores

* release 0.12.0 ([fbbec61](https://github.com/lukso-network/lsp-smart-contracts/commit/fbbec6199c6351721acedb35110fc1cc7bbb65ad))
* release 0.13.0 ([#817](https://github.com/lukso-network/lsp-smart-contracts/issues/817)) ([1bd2f5f](https://github.com/lukso-network/lsp-smart-contracts/commit/1bd2f5f699ecdbef857527cdac50df50dc051002))
- release 0.12.0 ([fbbec61](https://github.com/lukso-network/lsp-smart-contracts/commit/fbbec6199c6351721acedb35110fc1cc7bbb65ad))
- release 0.13.0 ([#817](https://github.com/lukso-network/lsp-smart-contracts/issues/817)) ([1bd2f5f](https://github.com/lukso-network/lsp-smart-contracts/commit/1bd2f5f699ecdbef857527cdac50df50dc051002))

## 0.15.0-rc.0 (2024-03-06)


### Miscellaneous Chores

* release 0.12.0 ([fbbec61](https://github.com/lukso-network/lsp-smart-contracts/commit/fbbec6199c6351721acedb35110fc1cc7bbb65ad))
* release 0.13.0 ([#817](https://github.com/lukso-network/lsp-smart-contracts/issues/817)) ([1bd2f5f](https://github.com/lukso-network/lsp-smart-contracts/commit/1bd2f5f699ecdbef857527cdac50df50dc051002))
- release 0.12.0 ([fbbec61](https://github.com/lukso-network/lsp-smart-contracts/commit/fbbec6199c6351721acedb35110fc1cc7bbb65ad))
- release 0.13.0 ([#817](https://github.com/lukso-network/lsp-smart-contracts/issues/817)) ([1bd2f5f](https://github.com/lukso-network/lsp-smart-contracts/commit/1bd2f5f699ecdbef857527cdac50df50dc051002))
2 changes: 1 addition & 1 deletion packages/lsp0-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"package": "hardhat prepare-package",
"build": "hardhat compile --show-stack-traces",
"build:js": "unbuild",
"build:types": "npx typechain --target=ethers-v6 ./artifacts/*.json --out-dir types",
"build:types": "npx wagmi generate",
"clean": "hardhat clean && rm -Rf dist/",
"format": "prettier --write .",
"lint": "eslint . --ext .ts,.js",
Expand Down
19 changes: 19 additions & 0 deletions packages/lsp0-contracts/wagmi.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { defineConfig } from '@wagmi/cli';
import { react } from '@wagmi/cli/plugins';
import fs from 'fs';

const artifacts = fs.readdirSync('./artifacts', {});

const contractsWagmiInputs = artifacts.map((artifact) => {
const jsonArtifact = JSON.parse(fs.readFileSync(`./artifacts/${artifact}`, 'utf-8'));
return {
name: jsonArtifact.contractName,
abi: jsonArtifact.abi,
};
});

export default defineConfig({
out: 'types/index.ts',
contracts: contractsWagmiInputs,
plugins: [react()],
});
20 changes: 8 additions & 12 deletions packages/lsp1-contracts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,28 @@

## [0.15.0-rc.0](https://github.com/lukso-network/lsp-smart-contracts/compare/lsp1-contracts-v0.15.0-rc.0...lsp1-contracts-v0.15.0-rc.0) (2024-03-07)


### Miscellaneous Chores

* release 0.12.0 ([fbbec61](https://github.com/lukso-network/lsp-smart-contracts/commit/fbbec6199c6351721acedb35110fc1cc7bbb65ad))
* release 0.13.0 ([#817](https://github.com/lukso-network/lsp-smart-contracts/issues/817)) ([1bd2f5f](https://github.com/lukso-network/lsp-smart-contracts/commit/1bd2f5f699ecdbef857527cdac50df50dc051002))
- release 0.12.0 ([fbbec61](https://github.com/lukso-network/lsp-smart-contracts/commit/fbbec6199c6351721acedb35110fc1cc7bbb65ad))
- release 0.13.0 ([#817](https://github.com/lukso-network/lsp-smart-contracts/issues/817)) ([1bd2f5f](https://github.com/lukso-network/lsp-smart-contracts/commit/1bd2f5f699ecdbef857527cdac50df50dc051002))

## [0.15.0-rc.0](https://github.com/lukso-network/lsp-smart-contracts/compare/lsp1-contracts-v0.15.0-rc.0...lsp1-contracts-v0.15.0-rc.0) (2024-03-06)


### Miscellaneous Chores

* release 0.12.0 ([fbbec61](https://github.com/lukso-network/lsp-smart-contracts/commit/fbbec6199c6351721acedb35110fc1cc7bbb65ad))
* release 0.13.0 ([#817](https://github.com/lukso-network/lsp-smart-contracts/issues/817)) ([1bd2f5f](https://github.com/lukso-network/lsp-smart-contracts/commit/1bd2f5f699ecdbef857527cdac50df50dc051002))
- release 0.12.0 ([fbbec61](https://github.com/lukso-network/lsp-smart-contracts/commit/fbbec6199c6351721acedb35110fc1cc7bbb65ad))
- release 0.13.0 ([#817](https://github.com/lukso-network/lsp-smart-contracts/issues/817)) ([1bd2f5f](https://github.com/lukso-network/lsp-smart-contracts/commit/1bd2f5f699ecdbef857527cdac50df50dc051002))

## [0.15.0-rc.0](https://github.com/lukso-network/lsp-smart-contracts/compare/lsp1-contracts-v0.14.0...lsp1-contracts-v0.15.0-rc.0) (2024-03-06)


### Miscellaneous Chores

* release 0.12.0 ([fbbec61](https://github.com/lukso-network/lsp-smart-contracts/commit/fbbec6199c6351721acedb35110fc1cc7bbb65ad))
* release 0.13.0 ([#817](https://github.com/lukso-network/lsp-smart-contracts/issues/817)) ([1bd2f5f](https://github.com/lukso-network/lsp-smart-contracts/commit/1bd2f5f699ecdbef857527cdac50df50dc051002))
- release 0.12.0 ([fbbec61](https://github.com/lukso-network/lsp-smart-contracts/commit/fbbec6199c6351721acedb35110fc1cc7bbb65ad))
- release 0.13.0 ([#817](https://github.com/lukso-network/lsp-smart-contracts/issues/817)) ([1bd2f5f](https://github.com/lukso-network/lsp-smart-contracts/commit/1bd2f5f699ecdbef857527cdac50df50dc051002))

## 0.15.0-rc.0 (2024-03-06)


### Miscellaneous Chores

* release 0.12.0 ([fbbec61](https://github.com/lukso-network/lsp-smart-contracts/commit/fbbec6199c6351721acedb35110fc1cc7bbb65ad))
* release 0.13.0 ([#817](https://github.com/lukso-network/lsp-smart-contracts/issues/817)) ([1bd2f5f](https://github.com/lukso-network/lsp-smart-contracts/commit/1bd2f5f699ecdbef857527cdac50df50dc051002))
- release 0.12.0 ([fbbec61](https://github.com/lukso-network/lsp-smart-contracts/commit/fbbec6199c6351721acedb35110fc1cc7bbb65ad))
- release 0.13.0 ([#817](https://github.com/lukso-network/lsp-smart-contracts/issues/817)) ([1bd2f5f](https://github.com/lukso-network/lsp-smart-contracts/commit/1bd2f5f699ecdbef857527cdac50df50dc051002))
19 changes: 19 additions & 0 deletions packages/lsp1-contracts/wagmi.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { defineConfig } from '@wagmi/cli';
import { react } from '@wagmi/cli/plugins';
import fs from 'fs';

const artifacts = fs.readdirSync('./artifacts', {});

const contractsWagmiInputs = artifacts.map((artifact) => {
const jsonArtifact = JSON.parse(fs.readFileSync(`./artifacts/${artifact}`, 'utf-8'));
return {
name: jsonArtifact.contractName,
abi: jsonArtifact.abi,
};
});

export default defineConfig({
out: 'types/index.ts',
contracts: contractsWagmiInputs,
plugins: [react()],
});
Loading
Loading