Skip to content

Commit 0b63685

Browse files
Fix modifiers order to follow Solidity style guides (#450)
Co-authored-by: Eric Lau <[email protected]>
1 parent ae185dd commit 0b63685

21 files changed

+45
-36
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ Contracts Wizard is a web application to interactively build a contract out of c
1212

1313
Install dependencies with `yarn install`.
1414

15-
`packages/core` contains the code generation logic for each language under separately named subfolders.
15+
`packages/core` contains the code generation logic for each language under separately named subfolders. From each language's subfolder:
16+
- Run `yarn test` to run the tests.
17+
- Run `yarn test:update-snapshots` to update AVA snapshots and run the tests.
1618

1719
`packages/ui` is the interface built in Svelte. From the `packages/ui` directory, run `yarn dev` to spin up a local server to develop the UI.
1820

packages/core/cairo/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"update_scarb_project": "ts-node src/scripts/update-scarb-project.ts",
1919
"prepublish": "rimraf dist *.tsbuildinfo",
2020
"test": "ava",
21+
"test:update-snapshots": "ava --update-snapshots",
2122
"test:watch": "ava --watch",
2223
"version": "node ../../../scripts/bump-changelog.js"
2324
},

packages/core/solidity/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
- Fix modifiers order to follow Solidity style guides. ([#450](https://github.com/OpenZeppelin/contracts-wizard/pull/450))
6+
37
## 0.5.1 (2025-02-05)
48

59
- **Potentially breaking changes**:

packages/core/solidity/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"prepare": "tsc && node dist/scripts/prepare.js",
1818
"prepublish": "rimraf dist *.tsbuildinfo && hardhat clean",
1919
"test": "ava",
20+
"test:update-snapshots": "ava --update-snapshots",
2021
"test:watch": "ava --watch",
2122
"version": "node ../../../scripts/bump-changelog.js",
2223
"update-env": "rm ./src/environments/hardhat/package-lock.json && npm install --package-lock-only --prefix ./src/environments/hardhat && rm ./src/environments/hardhat/upgradeable/package-lock.json && npm install --package-lock-only --prefix ./src/environments/hardhat/upgradeable"

packages/core/solidity/src/contract.test.ts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ Generated by [AVA](https://avajs.dev).
154154
pragma solidity ^0.8.22;␊
155155
156156
contract Foo {␊
157-
function _otherFunction() internal whenNotPaused override(ERC20, OtherParent) {␊
157+
function _otherFunction() internal override(ERC20, OtherParent) whenNotPaused {␊
158158
super._otherFunction();␊
159159
}␊
160160
}␊
4 Bytes
Binary file not shown.

packages/core/solidity/src/custom.test.ts.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@ Generated by [AVA](https://avajs.dev).
7676
_disableInitializers();␊
7777
}␊
7878
79-
function initialize(address initialOwner) initializer public {␊
79+
function initialize(address initialOwner) public initializer {␊
8080
__Ownable_init(initialOwner);␊
8181
__UUPSUpgradeable_init();␊
8282
}␊
8383
8484
function _authorizeUpgrade(address newImplementation)␊
8585
internal␊
86-
onlyOwner␊
8786
override␊
87+
onlyOwner␊
8888
{}␊
8989
}␊
9090
`
@@ -166,15 +166,15 @@ Generated by [AVA](https://avajs.dev).
166166
_disableInitializers();␊
167167
}␊
168168
169-
function initialize(address initialOwner) initializer public {␊
169+
function initialize(address initialOwner) public initializer {␊
170170
__Ownable_init(initialOwner);␊
171171
__UUPSUpgradeable_init();␊
172172
}␊
173173
174174
function _authorizeUpgrade(address newImplementation)␊
175175
internal␊
176-
onlyOwner␊
177176
override␊
177+
onlyOwner␊
178178
{}␊
179179
}␊
180180
`
2 Bytes
Binary file not shown.

packages/core/solidity/src/erc1155.test.ts.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ Generated by [AVA](https://avajs.dev).
354354
}␊
355355
356356
function initialize(address defaultAdmin, address pauser, address minter)␊
357-
initializer public␊
357+
public initializer
358358
{␊
359359
__ERC1155_init("https://gateway.pinata.cloud/ipfs/QmcP9hxrnC1T5ATPmq2saFeAM1ypFX9BnAswCdHB9JCjLA/");␊
360360
__AccessControl_init();␊
@@ -439,7 +439,7 @@ Generated by [AVA](https://avajs.dev).
439439
}␊
440440
441441
function initialize(address defaultAdmin, address pauser, address minter, address upgrader)␊
442-
initializer public␊
442+
public initializer
443443
{␊
444444
__ERC1155_init("https://gateway.pinata.cloud/ipfs/QmcP9hxrnC1T5ATPmq2saFeAM1ypFX9BnAswCdHB9JCjLA/");␊
445445
__AccessControl_init();␊
@@ -481,8 +481,8 @@ Generated by [AVA](https://avajs.dev).
481481
482482
function _authorizeUpgrade(address newImplementation)␊
483483
internal␊
484-
onlyRole(UPGRADER_ROLE)␊
485484
override␊
485+
onlyRole(UPGRADER_ROLE)␊
486486
{}␊
487487
488488
// The following functions are overrides required by Solidity.␊
@@ -526,7 +526,7 @@ Generated by [AVA](https://avajs.dev).
526526
_disableInitializers();␊
527527
}␊
528528
529-
function initialize(address initialAuthority) initializer public {␊
529+
function initialize(address initialAuthority) public initializer {␊
530530
__ERC1155_init("https://gateway.pinata.cloud/ipfs/QmcP9hxrnC1T5ATPmq2saFeAM1ypFX9BnAswCdHB9JCjLA/");␊
531531
__AccessManaged_init(initialAuthority);␊
532532
__ERC1155Pausable_init();␊
@@ -562,8 +562,8 @@ Generated by [AVA](https://avajs.dev).
562562
563563
function _authorizeUpgrade(address newImplementation)␊
564564
internal␊
565-
restricted␊
566565
override␊
566+
restricted␊
567567
{}␊
568568
569569
// The following functions are overrides required by Solidity.␊
-8 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)