Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check address to exclude #132

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions contracts/ResolutionManager/ResolutionManagerBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,14 @@ abstract contract ResolutionManagerBase {
executionTo.length == executionData.length,
"Resolution: length mismatch"
);
require(
addressedContributor == address(0) ||
_shareholderRegistry.isAtLeast(
_shareholderRegistry.CONTRIBUTOR_STATUS(),
addressedContributor
),
"Resolution: excluded address is not a contributor"
);
uint256 resolutionId = _currentResolutionId++;
emit ResolutionCreated(msg.sender, resolutionId);

Expand Down
16 changes: 15 additions & 1 deletion test/ResolutionManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ describe("Resolution", async () => {
});

describe("createResolutionWithExclusion", async () => {
it("allows to create an addressable resolution", async () => {
it("allows to create a resolution to exclude an address from voting", async () => {
await expect(
resolution
.connect(managingBoard)
Expand All @@ -247,6 +247,20 @@ describe("Resolution", async () => {
.withArgs(managingBoard.address, resolutionId);
});

it("doesn't allow to create a resolution to exclude an address that is not a contributor from voting", async () => {
await expect(
resolution
.connect(managingBoard)
.createResolutionWithExclusion(
"test",
0,
[],
[],
nonContributor.address
)
).revertedWith("Resolution: excluded address is not a contributor");
});

it("doesn't allow non contributors to create an addressable resolution", async () => {
await expect(
resolution
Expand Down