Skip to content

Commit

Permalink
Merge branch 'main' into feat/88/compile
Browse files Browse the repository at this point in the history
  • Loading branch information
sirnicolaz authored Nov 10, 2023
2 parents 11088c0 + 4c1be51 commit e48bb6c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
7 changes: 7 additions & 0 deletions contracts/InternalMarket/InternalMarket.sol
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ contract InternalMarket is Initializable, HasRole, InternalMarketBase {
* @param amount The amount of tokens to offer for sale.
*/
function makeOffer(uint256 amount) public virtual {
require(
_shareholderRegistry.isAtLeast(
_shareholderRegistry.CONTRIBUTOR_STATUS(),
msg.sender
),
"InternalMarket: only contributors can make offers"
);
_makeOffer(_msgSender(), amount);
}

Expand Down
5 changes: 5 additions & 0 deletions test/Integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,11 @@ describe("Integration", async () => {
"Resolution: account cannot vote"
);

// user3 cannot offer tokens
await expect(internalMarket.connect(user3).makeOffer(10)).revertedWith(
"InternalMarket: only contributors can make offers"
);

// ... and finally the world is saved.
expect(await resolutionManager.getResolutionResult(resolutionId)).to.be
.true;
Expand Down
7 changes: 7 additions & 0 deletions test/InternalMarket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,13 @@ describe("InternalMarket", async () => {
);
});

it("should revert when called by a non-contributor", async () => {
registry.isAtLeast.returns(false);
await expect(internalMarket.makeOffer(1000)).revertedWith(
"InternalMarket: only contributors can make offers"
);
});

describe("redeem", async () => {
describe("with some unlocked tokens", async () => {
beforeEach(async () => {
Expand Down
2 changes: 1 addition & 1 deletion test/RedemptionController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ describe("RedemptionController", () => {
);
});

describe.only("when 10 tokens are redeemable", async () => {
describe("when 10 tokens are redeemable", async () => {
beforeEach(async () => {
await redemptionController.afterMint(account.address, 10);
await redemptionController.afterOffer(account.address, 10);
Expand Down

0 comments on commit e48bb6c

Please sign in to comment.