diff --git a/.vscode/settings.json b/.vscode/settings.json index 3fd6b9c..167dfbd 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,6 @@ { "[typescript]": { "editor.defaultFormatter": "biomejs.biome" - } + }, + "solidity.compileUsingRemoteVersion": "v0.8.26+commit.8a97fa7a" } diff --git a/.yarn/install-state.gz b/.yarn/install-state.gz index 5e9540c..c9aa389 100644 Binary files a/.yarn/install-state.gz and b/.yarn/install-state.gz differ diff --git a/contracts/ApplicationManager.sol b/contracts/ApplicationManager.sol index f526bb2..5daa5ac 100644 --- a/contracts/ApplicationManager.sol +++ b/contracts/ApplicationManager.sol @@ -1,42 +1,31 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity 0.8.25; +pragma solidity 0.8.26; import {IApplicationManager} from "./IApplicationManager.sol"; contract ApplicationManager is IApplicationManager { - mapping(uint => Application) private applications_; - uint private nextApplicationId_; + mapping(uint => Application) private applications; + uint private nextApplicationId; constructor() {} - function nextApplicationId() external view returns (uint) { - return nextApplicationId_; + function getNextApplicationId() external view returns (uint) { + return nextApplicationId; } - function createApplication(Application memory _application) external { - applications_[nextApplicationId_] = _application; - emit ApplicationCreated( - nextApplicationId_, - applications_[nextApplicationId_] - ); - nextApplicationId_++; + function createApplication(Application memory application) external { + applications[nextApplicationId] = application; + emit ApplicationCreated(nextApplicationId, applications[nextApplicationId]); + nextApplicationId++; } - function updateApplication( - uint _id, - Application memory _application - ) external override {} + function updateApplication(uint id, Application memory application) external override {} - function deleteApplication(uint _id) external override {} + function deleteApplication(uint id) external override {} - function getApplication( - uint _id - ) external view returns (Application memory) { - return applications_[_id]; + function getApplication(uint id) external view returns (Application memory) { + return applications[id]; } - function getApplications( - uint _start, - uint _limit - ) external override returns (Application[] memory application) {} + function getApplications(uint start, uint limit) external override returns (Application[] memory application) {} } diff --git a/contracts/IApplicationManager.sol b/contracts/IApplicationManager.sol index b61563f..393a59e 100644 --- a/contracts/IApplicationManager.sol +++ b/contracts/IApplicationManager.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity 0.8.25; +pragma solidity 0.8.26; interface IApplicationManager { struct Application { @@ -11,23 +11,10 @@ interface IApplicationManager { event ApplicationUpdated(uint id, Application application); event ApplicationDeleted(uint id, Application application); - function nextApplicationId() external view returns (uint); - - function createApplication(Application memory _application) external; - - function updateApplication( - uint _id, - Application memory _application - ) external; - - function deleteApplication(uint _id) external; - - function getApplication( - uint _id - ) external view returns (Application memory); - - function getApplications( - uint _start, - uint _limit - ) external returns (Application[] memory application); + function getNextApplicationId() external view returns (uint); + function createApplication(Application memory application) external; + function updateApplication(uint id, Application memory application) external; + function deleteApplication(uint id) external; + function getApplication(uint id) external view returns (Application memory); + function getApplications(uint start, uint limit) external returns (Application[] memory); } diff --git a/hardhat.config.ts b/hardhat.config.ts index b52395c..ceefd33 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -3,7 +3,7 @@ import "@nomicfoundation/hardhat-toolbox-viem"; import "@nomiclabs/hardhat-solhint"; const config: HardhatUserConfig = { - solidity: "0.8.25", + solidity: "0.8.26", }; export default config; diff --git a/test/ApplicationManager.ts b/test/ApplicationManager.ts index a9c1224..fc3d36f 100644 --- a/test/ApplicationManager.ts +++ b/test/ApplicationManager.ts @@ -33,7 +33,7 @@ describe("ApplicationManager", () => { describe("Deployment", () => { it("Should set the nextxApplicationId to 0", async () => { const { contract } = await loadFixture(deploy); - expect(await contract.read.nextApplicationId()).to.equal( + expect(await contract.read.getNextApplicationId()).to.equal( parseUnits("0", 0), ); }); @@ -58,21 +58,21 @@ describe("ApplicationManager", () => { expect(await contract.write.createApplication([app])).to.be.string; }); it("Should increment nextApplicationId", async () => { - const t0 = await contract.read.nextApplicationId(); + const t0 = await contract.read.getNextApplicationId(); expect(t0).to.equal(parseUnits("0", 0)); await contract.write.createApplication([app]); - const t1 = await contract.read.nextApplicationId(); + const t1 = await contract.read.getNextApplicationId(); expect(t1).to.equal(parseUnits("1", 0)); }); it("Should create a new Application", async () => { - const applicationId = await contract.read.nextApplicationId(); + const applicationId = await contract.read.getNextApplicationId(); await contract.write.createApplication([app]); expect(await contract.read.getApplication([applicationId])).to.contain( app, ); }); it("Should emit the ApplicationCreated event with the new application's details", async () => { - const applicationId = await contract.read.nextApplicationId(); + const applicationId = await contract.read.getNextApplicationId(); const txHash = await contract.write.createApplication([app]); const events = await contract.getEvents.ApplicationCreated();