Skip to content

Commit

Permalink
update contracts-deployer (#191)
Browse files Browse the repository at this point in the history
* Remove _compliance parameter from setSupplyLimit function of the SupplyLimitModule (#183)

* 🔖(version) Update version to 4.1.2

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

* 🐛 (proxy) modify IA storage slot

* 🔖 (version) update to version 4.1.3

---------

Co-authored-by: aliarbak <[email protected]>
  • Loading branch information
Joachim-Lebrun and aliarbak authored Feb 21, 2024
1 parent b3893f3 commit 7ac0205
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 29 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
# Change Log
All notable changes to this project will be documented in this file.

## [4.1.3]

### Update

- **AbstractProxy**: updated the storage slot for `TREXImplementationAuthority` from
`0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7` to
`0x821f3e4d3d679f19eacc940c87acf846ea6eae24a63058ea750304437a62aafc` to avoid issues with blockchain explorers
confusing the proxy pattern of T-REX for an ERC-1822 proxy (old storage slot was the slot used by ERC-1822) which
caused errors in displaying the right ABIs for proxies using this implementation.

## [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
7 changes: 4 additions & 3 deletions contracts/proxy/AbstractProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,19 @@ abstract contract AbstractProxy is IProxy, Initializable {
address implemAuth;
// solhint-disable-next-line no-inline-assembly
assembly {
implemAuth := sload(0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7)
implemAuth := sload(0x821f3e4d3d679f19eacc940c87acf846ea6eae24a63058ea750304437a62aafc)
}
return implemAuth;
}

/**
* @dev store the implementationAuthority contract address using the ERC-1822 implementation slot in storage
* @dev store the implementationAuthority contract address using the ERC-3643 implementation slot in storage
* the slot storage is the result of `keccak256("ERC-3643.proxy.beacon")`
*/
function _storeImplementationAuthority(address implementationAuthority) internal {
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7, implementationAuthority)
sstore(0x821f3e4d3d679f19eacc940c87acf846ea6eae24a63058ea750304437a62aafc, implementationAuthority)
}
}

Expand Down
2 changes: 1 addition & 1 deletion contracts/token/TokenStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ contract TokenStorage {
string internal _tokenSymbol;
uint8 internal _tokenDecimals;
address internal _tokenOnchainID;
string internal constant _TOKEN_VERSION = "4.1.1";
string internal constant _TOKEN_VERSION = "4.1.3";

/// @dev Variables of freeze and pause functions
mapping(address => bool) internal _frozen;
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.3",
"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 7ac0205

Please sign in to comment.