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

Remove _compliance parameter from setSupplyLimit function of the SupplyLimitModule #183

Merged
merged 3 commits into from
Jan 3, 2024
Merged
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
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