diff --git a/.deploys/pinned-contracts/43113/0x433e3b673b4edf8d02a3b7a38600eba1cd6c22c7.json b/.deploys/pinned-contracts/43113/0x433e3b673b4edf8d02a3b7a38600eba1cd6c22c7.json new file mode 100644 index 0000000..25050fd --- /dev/null +++ b/.deploys/pinned-contracts/43113/0x433e3b673b4edf8d02a3b7a38600eba1cd6c22c7.json @@ -0,0 +1,94 @@ +{ + "name": "ProjectFactory", + "address": "0x433e3b673b4edf8d02a3b7a38600eba1cd6c22c7", + "abi": [ + { + "inputs": [ + { + "internalType": "string", + "name": "_projectName", + "type": "string" + }, + { + "internalType": "string", + "name": "_projectDescription", + "type": "string" + }, + { + "internalType": "address payable", + "name": "_developerAddress", + "type": "address" + } + ], + "name": "createProject", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_developer", + "type": "address" + } + ], + "name": "getProjectsByDeveloper", + "outputs": [ + { + "internalType": "contract Project[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "name": "getProjectsByOwner", + "outputs": [ + { + "internalType": "contract Project[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "projects", + "outputs": [ + { + "internalType": "contract Project", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "filePath": "ProjectFactory/contracts/projectfactory.sol", + "pinnedAt": 1742680042033 +} \ No newline at end of file diff --git a/tests/tests/projectfactory_test.sol b/tests/tests/projectfactory_test.sol new file mode 100644 index 0000000..e14dee1 --- /dev/null +++ b/tests/tests/projectfactory_test.sol @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: GPL-3.0 + +pragma solidity >=0.4.22 <0.9.0; + +// This import is automatically injected by Remix +import "remix_tests.sol"; + +// This import is required to use custom transaction context +// Although it may fail compilation in 'Solidity Compiler' plugin +// But it will work fine in 'Solidity Unit Testing' plugin +import "remix_accounts.sol"; +import "../contracts/projectfactory.sol"; + +// File name has to end with '_test.sol', this file can contain more than one testSuite contracts +contract testSuite { + + /// 'beforeAll' runs before all other tests + /// More special functions are: 'beforeEach', 'beforeAll', 'afterEach' & 'afterAll' + function beforeAll() public { + // + Assert.equal(uint(1), uint(1), "1 should be equal to 1"); + } + + function checkSuccess() public { + // Use 'Assert' methods: https://remix-ide.readthedocs.io/en/latest/assert_library.html + Assert.ok(2 == 2, 'should be true'); + Assert.greaterThan(uint(2), uint(1), "2 should be greater than to 1"); + Assert.lesserThan(uint(2), uint(3), "2 should be lesser than to 3"); + } + + function checkSuccess2() public pure returns (bool) { + // Use the return value (true or false) to test the contract + return true; + } + + function checkFailure() public { + Assert.notEqual(uint(1), uint(1), "1 should not be equal to 1"); + } + + /// Custom Transaction Context: https://remix-ide.readthedocs.io/en/latest/unittesting.html#customization + /// #sender: account-1 + /// #value: 100 + function checkSenderAndValue() public payable { + // account index varies 0-9, value is in wei + Assert.equal(msg.sender, TestsAccounts.getAccount(1), "Invalid sender"); + Assert.equal(msg.value, 100, "Invalid value"); + } +} + \ No newline at end of file