-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added initial testing for deployments and getting factory connected t…
…o nextjs package
- Loading branch information
1 parent
990cf6d
commit 2fb9eed
Showing
8 changed files
with
2,011 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,4 +37,4 @@ | |
"lint-staged": "~13.2.2" | ||
}, | ||
"packageManager": "yarn@3.2.3" | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.17; | ||
|
||
import "@openzeppelin/contracts/access/AccessControl.sol"; | ||
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; | ||
import "./IGivingCircle.sol"; | ||
import "./KYCController.sol"; | ||
import "./partialIERC20.sol"; | ||
import "./Initialization.sol"; | ||
import "./Proposals.sol"; | ||
import {GivingCircle} from "./GivingCircle.sol"; | ||
|
||
contract GivingCircleStandalone is GivingCircle { | ||
constructor(Initialization.GivingCircleInitialization memory init) { | ||
initialize(init); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,4 +25,4 @@ | |
"@types/prettier": "2", | ||
"@types/qrcode": "1" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.13; | ||
|
||
import "forge-std/Test.sol"; | ||
import "../contracts/YourContract.sol"; | ||
import {GivingCirclesFactory} from "../contracts/GivingCirclesFactory.sol"; | ||
import {GivingCircle} from "../contracts/GivingCircle.sol"; | ||
import {Initialization} from "../contracts/Initialization.sol"; | ||
import {TestERC20} from "../contracts/TestERC20.sol"; | ||
|
||
contract YourContractTest is Test { | ||
YourContract public yourContract; | ||
GivingCirclesFactory public factory; | ||
|
||
function setUp() public { | ||
yourContract = new YourContract(vm.addr(1)); | ||
address[] memory admins = new address[](1); | ||
admins[0] = vm.addr(1); | ||
|
||
factory = new GivingCirclesFactory(admins); | ||
} | ||
|
||
function testMe() public view { | ||
require(factory.hasRole(factory.DEFAULT_ADMIN_ROLE(), vm.addr(1))); | ||
} | ||
|
||
function testDeployCircle() public deployCircleAndSetAsImplementation {} | ||
|
||
function testCreateCircle() | ||
public | ||
setCircleCreator(vm.addr(1)) | ||
deployCircleAndSetAsImplementation | ||
{ | ||
vm.startPrank(vm.addr(1)); | ||
|
||
Initialization.GivingCircleInitialization memory init; | ||
init.name = "Test Circle"; | ||
init.beansToDispursePerAttendee = 1; | ||
|
||
address[] memory leaders = new address[](1); | ||
leaders[0] = vm.addr(1); | ||
init.circleLeaders = leaders; | ||
factory.createGivingCircle(init); | ||
vm.stopPrank(); | ||
|
||
require(factory.instancesCount() == 1); | ||
} | ||
|
||
modifier setCircleCreator(address addr) { | ||
vm.startPrank(vm.addr(1)); | ||
factory.grantRole(factory.CIRCLE_CREATOR_ROLE(), addr); | ||
vm.stopPrank(); | ||
_; | ||
} | ||
|
||
modifier deployCircleAndSetAsImplementation() { | ||
vm.startPrank(vm.addr(1)); | ||
GivingCircle implementation = new GivingCircle(); | ||
factory.setImplementation(address(implementation)); | ||
vm.stopPrank(); | ||
require(address(factory.implementation()) == address(implementation)); | ||
_; | ||
} | ||
} |
Oops, something went wrong.