Skip to content

Commit

Permalink
Remove _compliance parameter from setSupplyLimit function of the Supp…
Browse files Browse the repository at this point in the history
…lyLimitModule (#183)
  • Loading branch information
aliarbak authored Jan 3, 2024
1 parent 8db61c9 commit bdc453a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 25 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Change Log
All notable changes to this project will be documented in this file.

## [4.1.2]
- **Compliance Modules**:
- Removed `_compliance` parameter from `setSupplyLimit` function of the `SupplyLimitModule`

## [4.1.1]

No changes, republishing package.
Expand Down
6 changes: 3 additions & 3 deletions contracts/compliance/modular/modules/SupplyLimitModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ contract SupplyLimitModule is AbstractModule {
* Only the owner of the Compliance smart contract can call this function
* emits an `SupplyLimitSet` event
*/
function setSupplyLimit(address _compliance, uint256 _limit) external onlyComplianceCall {
_supplyLimits[_compliance] = _limit;
emit SupplyLimitSet(_compliance, _limit);
function setSupplyLimit(uint256 _limit) external onlyComplianceCall {
_supplyLimits[msg.sender] = _limit;
emit SupplyLimitSet(msg.sender, _limit);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tokenysolutions/t-rex",
"version": "4.1.1",
"version": "4.1.2",
"description": "A fully compliant environment for the issuance and use of tokenized securities.",
"main": "index.js",
"directories": {
Expand Down
24 changes: 5 additions & 19 deletions test/compliances/module-supply-limit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ describe('Compliance Module: SupplyLimit', () => {
it('should revert', async () => {
const context = await loadFixture(deploySupplyLimitFixture);

await expect(context.suite.complianceModule.setSupplyLimit(context.suite.compliance.address, 100)).to.revertedWith(
'only bound compliance can call',
);
await expect(context.suite.complianceModule.setSupplyLimit(100)).to.revertedWith('only bound compliance can call');
});
});

Expand All @@ -80,10 +78,7 @@ describe('Compliance Module: SupplyLimit', () => {
const context = await loadFixture(deploySupplyLimitFixture);

const tx = await context.suite.compliance.callModuleFunction(
new ethers.utils.Interface(['function setSupplyLimit(address _compliance, uint256 _limit)']).encodeFunctionData('setSupplyLimit', [
context.suite.compliance.address,
100,
]),
new ethers.utils.Interface(['function setSupplyLimit(uint256 _limit)']).encodeFunctionData('setSupplyLimit', [100]),
context.suite.complianceModule.address,
);

Expand All @@ -97,10 +92,7 @@ describe('Compliance Module: SupplyLimit', () => {
it('should return', async () => {
const context = await loadFixture(deploySupplyLimitFixture);
await context.suite.compliance.callModuleFunction(
new ethers.utils.Interface(['function setSupplyLimit(address _compliance, uint256 _limit)']).encodeFunctionData('setSupplyLimit', [
context.suite.compliance.address,
1600,
]),
new ethers.utils.Interface(['function setSupplyLimit(uint256 _limit)']).encodeFunctionData('setSupplyLimit', [1600]),
context.suite.complianceModule.address,
);
const supplyLimit = await context.suite.complianceModule.getSupplyLimit(context.suite.compliance.address);
Expand All @@ -118,10 +110,7 @@ describe('Compliance Module: SupplyLimit', () => {
const from = zeroAddress;

await context.suite.compliance.callModuleFunction(
new ethers.utils.Interface(['function setSupplyLimit(address _compliance, uint256 _limit)']).encodeFunctionData('setSupplyLimit', [
context.suite.compliance.address,
1600,
]),
new ethers.utils.Interface(['function setSupplyLimit(uint256 _limit)']).encodeFunctionData('setSupplyLimit', [1600]),
context.suite.complianceModule.address,
);

Expand All @@ -137,10 +126,7 @@ describe('Compliance Module: SupplyLimit', () => {
const from = zeroAddress;

await context.suite.compliance.callModuleFunction(
new ethers.utils.Interface(['function setSupplyLimit(address _compliance, uint256 _limit)']).encodeFunctionData('setSupplyLimit', [
context.suite.compliance.address,
1600,
]),
new ethers.utils.Interface(['function setSupplyLimit(uint256 _limit)']).encodeFunctionData('setSupplyLimit', [1600]),
context.suite.complianceModule.address,
);

Expand Down

0 comments on commit bdc453a

Please sign in to comment.