Skip to content

Commit c51b979

Browse files
authored
feat: add some important local settings (#14)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added Solidity language settings for VSCode across multiple projects. - **Refactor** - Updated `runs-on` configuration to `namespace-profile-btp-scs` in GitHub workflows for multiple projects. - Removed `timeout` property from Hardhat configuration files across various projects. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent deef62d commit c51b979

File tree

7 files changed

+40
-97
lines changed

7 files changed

+40
-97
lines changed

.github/workflows/pr-labels.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ permissions:
2323

2424
jobs:
2525
labels:
26-
runs-on: ubuntu-latest
26+
#runs-on: ubuntu-latest
27+
runs-on: namespace-profile-btp-scs
2728
steps:
2829
- uses: fuxingloh/multi-labeler@v4

.github/workflows/solidity.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,6 @@ jobs:
4747
apk update
4848
apk add --no-cache cairo-dev jpeg-dev pango-dev giflib-dev build-base g++ pkgconfig
4949
50-
- name: Fetch semgrep rules
51-
uses: actions/checkout@v4
52-
with:
53-
repository: decurity/semgrep-smart-contracts
54-
path: rules
55-
56-
- run: semgrep ci --sarif --output=semgrep.sarif || true
57-
env:
58-
SEMGREP_RULES: rules/solidity/security rules/solidity/performance
59-
6050
- uses: crytic/slither-action@v0.4.0
6151
id: slither
6252
with:

.vscode/settings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"[solidity]": {
3+
"editor.defaultFormatter": "NomicFoundation.hardhat-solidity"
4+
},
5+
"solidity.formatter": "forge",
6+
"solidity.telemetry": false,
7+
"taskManager.exclude": "lib|install|tsc|hardhat"
8+
}

contracts/ExampleSupplyChain.sol

Lines changed: 22 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,7 @@ contract ExampleSupplyChain is Ownable {
1818
//////////////////////////////////////////////////////////////////
1919

2020
event CreateLotEvent(
21-
string lotType,
22-
string quantity,
23-
string operatorId,
24-
string originId,
25-
string lotNo,
26-
string transporterId
21+
string lotType, string quantity, string operatorId, string originId, string lotNo, string transporterId
2722
);
2823

2924
event FirstProcessEvent(
@@ -53,11 +48,7 @@ contract ExampleSupplyChain is Ownable {
5348
);
5449

5550
event TransportEvent(
56-
string packageId,
57-
string operatorId,
58-
string transporterId,
59-
string cartonId,
60-
string transportLotId
51+
string packageId, string operatorId, string transporterId, string cartonId, string transportLotId
6152
);
6253

6354
//////////////////////////////////////////////////////////////////
@@ -77,15 +68,10 @@ contract ExampleSupplyChain is Ownable {
7768
string memory originId,
7869
string memory lotNo,
7970
string memory transporterId
80-
) external {
81-
emit CreateLotEvent(
82-
lotType,
83-
quantity,
84-
operatorId,
85-
originId,
86-
lotNo,
87-
transporterId
88-
);
71+
)
72+
external
73+
{
74+
emit CreateLotEvent(lotType, quantity, operatorId, originId, lotNo, transporterId);
8975
}
9076

9177
function registerFirstProcess(
@@ -94,16 +80,13 @@ contract ExampleSupplyChain is Ownable {
9480
string memory machineId,
9581
string memory processingHouseId,
9682
string memory timestamp
97-
) external {
83+
)
84+
external
85+
{
9886
_firstProcessLotId += 1;
9987

10088
emit FirstProcessEvent(
101-
lotNos,
102-
operatorId,
103-
machineId,
104-
processingHouseId,
105-
timestamp,
106-
Strings.toString(_firstProcessLotId)
89+
lotNos, operatorId, machineId, processingHouseId, timestamp, Strings.toString(_firstProcessLotId)
10790
);
10891
}
10992

@@ -112,15 +95,13 @@ contract ExampleSupplyChain is Ownable {
11295
string memory machineId,
11396
string memory operatorId,
11497
string memory secondProcessOutputLotId
115-
) external {
98+
)
99+
external
100+
{
116101
_secondProcessLotId += 1;
117102

118103
emit SecondProcessEvent(
119-
firstProcessLotIds,
120-
machineId,
121-
operatorId,
122-
secondProcessOutputLotId,
123-
Strings.toString(_secondProcessLotId)
104+
firstProcessLotIds, machineId, operatorId, secondProcessOutputLotId, Strings.toString(_secondProcessLotId)
124105
);
125106
}
126107

@@ -130,16 +111,13 @@ contract ExampleSupplyChain is Ownable {
130111
string memory packageId,
131112
string memory weight,
132113
string memory packagingType
133-
) external {
114+
)
115+
external
116+
{
134117
_packingLotId += 1;
135118

136119
emit PackagingEvent(
137-
secondProcessLotId,
138-
operatorId,
139-
packageId,
140-
weight,
141-
packagingType,
142-
Strings.toString(_packingLotId)
120+
secondProcessLotId, operatorId, packageId, weight, packagingType, Strings.toString(_packingLotId)
143121
);
144122
}
145123

@@ -148,15 +126,11 @@ contract ExampleSupplyChain is Ownable {
148126
string memory operatorId,
149127
string memory transporterId,
150128
string memory cartonId
151-
) external {
129+
)
130+
external
131+
{
152132
_transportLotId += 1;
153133

154-
emit TransportEvent(
155-
packageId,
156-
operatorId,
157-
transporterId,
158-
cartonId,
159-
Strings.toString(_transportLotId)
160-
);
134+
emit TransportEvent(packageId, operatorId, transporterId, cartonId, Strings.toString(_transportLotId));
161135
}
162136
}

foundry.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@
2828
gas_reports = ["*"]
2929
fuzz = { runs = 1_000 }
3030
auto_detect_solc = false
31-
extra_output_files = [ "metadata" ]
31+
extra_output_files = [ "metadata" ]
32+
viaIR = true

hardhat.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const config: HardhatUserConfig = {
77
solidity: {
88
version: "0.8.24",
99
settings: {
10+
viaIR: true,
1011
optimizer: {
1112
enabled: true,
1213
runs: 10_000,
@@ -18,7 +19,6 @@ const config: HardhatUserConfig = {
1819
btp: {
1920
url: process.env.BTP_RPC_URL || "",
2021
gasPrice: process.env.BTP_GAS_PRICE ? parseInt(process.env.BTP_GAS_PRICE) : "auto",
21-
timeout: 100_000,
2222
},
2323
},
2424
etherscan: {

test/ExampleSupplyChain.t.sol

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,9 @@ contract ExampleSupplyChainTest is Test {
2323
vm.expectEmit(true, true, true, true);
2424

2525
// Emit the expected event
26-
emit ExampleSupplyChain.CreateLotEvent(
27-
lotType,
28-
quantity,
29-
operatorId,
30-
originId,
31-
lotNo,
32-
transporterId
33-
);
26+
emit ExampleSupplyChain.CreateLotEvent(lotType, quantity, operatorId, originId, lotNo, transporterId);
3427

35-
supplyChain.createLot(
36-
lotType,
37-
quantity,
38-
operatorId,
39-
originId,
40-
lotNo,
41-
transporterId
42-
);
28+
supplyChain.createLot(lotType, quantity, operatorId, originId, lotNo, transporterId);
4329
}
4430

4531
function testRegisterFirstProcessEmitsEvent() public {
@@ -64,13 +50,7 @@ contract ExampleSupplyChainTest is Test {
6450
);
6551

6652
// Call the function that should emit the event
67-
supplyChain.registerFirstProcess(
68-
lotNos,
69-
operatorId,
70-
machineId,
71-
processingHouseId,
72-
timestamp
73-
);
53+
supplyChain.registerFirstProcess(lotNos, operatorId, machineId, processingHouseId, timestamp);
7454
}
7555

7656
function testRegisterSecondProcessEmitsEvent() public {
@@ -93,12 +73,7 @@ contract ExampleSupplyChainTest is Test {
9373
);
9474

9575
// Call the function that should emit the event
96-
supplyChain.registerSecondProcess(
97-
firstProcessLotIds,
98-
machineId,
99-
operatorId,
100-
secondProcessOutputLotId
101-
);
76+
supplyChain.registerSecondProcess(firstProcessLotIds, machineId, operatorId, secondProcessOutputLotId);
10277
}
10378

10479
function testPackingEmitsEvent() public {
@@ -123,13 +98,7 @@ contract ExampleSupplyChainTest is Test {
12398
);
12499

125100
// Call the function that should emit the event
126-
supplyChain.packing(
127-
secondProcessLotId,
128-
operatorId,
129-
packageId,
130-
weight,
131-
packagingType
132-
);
101+
supplyChain.packing(secondProcessLotId, operatorId, packageId, weight, packagingType);
133102
}
134103

135104
function testTransportEmitsEvent() public {

0 commit comments

Comments
 (0)