Skip to content

Commit

Permalink
Add balanceInfo in ERC20BaseModule, improve schema
Browse files Browse the repository at this point in the history
  • Loading branch information
rya-sge committed Mar 18, 2024
1 parent d6a14ec commit 5d183e2
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 9 deletions.
2 changes: 1 addition & 1 deletion contracts/mocks/AuthorizationEngineMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pragma solidity ^0.8.20;
import "../interfaces/engine/IAuthorizationEngine.sol";

/*
@title a mock for testing, not suitable for production
* @title a mock for testing, not suitable for production
*/
contract AuthorizationEngineMock is IAuthorizationEngine {
address nextAdmin;
Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/RuleEngine/RuleEngineMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import "./RuleMock.sol";
import "./CodeList.sol";

/*
@title a mock for testing, not suitable for production
* @title a mock for testing, not suitable for production
*/
contract RuleEngineMock is IRuleEngineMock {
IRule[] internal _rules;
Expand Down
4 changes: 2 additions & 2 deletions contracts/mocks/RuleEngine/RuleMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import "./interfaces/IRule.sol";
import "./CodeList.sol";

/*
@title a mock for testing, not suitable for production
* @title a mock for testing, not suitable for production
*/
contract RuleMock is IRule, CodeList {
function validateTransfer(
Expand All @@ -18,7 +18,7 @@ contract RuleMock is IRule, CodeList {
}

/**
@dev 20 the limit of the maximum amount
* @dev 20 the limit of the maximum amount
*/
function detectTransferRestriction(
address /* _from */,
Expand Down
4 changes: 2 additions & 2 deletions contracts/modules/CMTAT_BASE.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import "./wrapper/core/EnforcementModule.sol";
import "./wrapper/core/ERC20BaseModule.sol";
import "./wrapper/core/PauseModule.sol";
/*
SnapshotModule:
Add this import in case you add the SnapshotModule
* SnapshotModule:
* Add this import in case you add the SnapshotModule
*/
import "./wrapper/extensions/ERC20SnapshotModule.sol";

Expand Down
11 changes: 11 additions & 0 deletions contracts/modules/wrapper/core/ERC20BaseModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,16 @@ abstract contract ERC20BaseModule is ERC20Upgradeable {
return result;
}

/**
* @param from address
* @param to address
* @dev useful for the snapshot rule
*/
function balanceInfo(address from, address to) public view returns(uint256 fromBalance, uint256 toBalance, uint256 totalSupply) {
fromBalance = ERC20Upgradeable.balanceOf(from);
toBalance = ERC20Upgradeable.balanceOf(to);
totalSupply = ERC20Upgradeable.totalSupply();
}

uint256[50] private __gap;
}
Binary file added doc/schema/drawio/Engine-DebtVault.drawio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/schema/drawio/Engine-RuleEngine.drawio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion doc/schema/drawio/Engine.drawio
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<mxfile host="Electron" modified="2024-01-22T16:39:21.216Z" agent="5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/20.6.2 Chrome/106.0.5249.199 Electron/21.3.3 Safari/537.36" etag="B_WfKLa2oXxgwmXu4CIb" version="20.6.2" type="device" pages="2"><diagram name="AuthorizationEngine" id="LucZvkCPMq8z-S9me4Yl">1Vrdc+MmEP9rNNM+xKPv2I+J89Hp3PVuLtdp05cbLGGLBgsVodi+v74gIUuAHMuJ5Th+SMQCK9j97bK7yPKmy/U9BVnymcQQW64dry3vxnJdLxyP+T9B2VQUN3SCirKgKK5oTkN4QD+hJNqSWqAY5spARghmKFOJEUlTGDGFBiglK3XYnGD1rRlYQIPwEAFsUv9CMUvkNjwvbDp+g2iR1K8OA7/qWYJ6tNxKnoCYrFok79byppQQVj0t11OIhfhqwfy+evw+nRTjZ/jn51suOfvL/eNFxezukCnbPVCYsuOydivWzwAXUmAL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+8c9n+43BOIkzX5KZi4AHYiYfEpn+rLu46DzVq9H1KKo9EA/mW5MXHYWq9cJ1V86YyROsXR4wqgluUPl3BGwDCfMuzp59HhLft7dfkffrib//hNu4Ornt1vDL7acSqg6+V2fF+V/0O/UDTOHVcmpngT0nIbHUNS9cQ8oE3Xtd46rpBhsoqP/HHxB0t9c/DlWIde4sGOsxgUq+2oMXt7c/T5iPnz3O5Po5n8=</diagram></mxfile>
<mxfile host="Electron" modified="2024-03-11T14:12:48.379Z" agent="5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/20.6.2 Chrome/106.0.5249.199 Electron/21.3.3 Safari/537.36" etag="RKnOwahraWetuiixzaji" version="20.6.2" type="device" pages="3"><diagram name="AuthorizationEngine" id="LucZvkCPMq8z-S9me4Yl">1Vrdc+MmEP9rNNM+xKNv24+J89Hp3PVuLtdp05cbImGLBgsVodi+v74gIUuAHMuJ5Th+SMQCK9j97bK7yPJmy/UdBVnymcQQW64dry3v2nJdbxxM+D9B2VQUN3SCirKgKK5oTkO4Rz+hJNqSWqAY5spARghmKFOJEUlTGDGFBiglK3XYnGD1rRlYQINwHwFsUv9CMUvkNjwvbDp+g2iR1K8OA7/qWYJ6tNxKnoCYrFok78byZpQQVj0t1zOIhfhqwfy+evg+mxaTZ/jn5xsuOfvL3cNFxez2kCnbPVCYsuOydivWzwAXUmALClL2jWD4C+V/LHcmFBFFpEjZr5bY963lhpgv4+qRCqGwjRR1+F8hJHE1Jym7yEsgXPIBjp9xNF01/fxpIf5T+Eye4M43uQpzl3JyDMVWbD53lSAG7zMQid4Vhy6nJWyJecuRS5BQdPzylb3kJ+X8DCmD6xZ8pDzvIFlCRjd8SN07ltCQ1hHK5qpBmlOjJ2mBrJ4GJLgXW86N/viDVOEB6vQMdRqChGl8KeyKtyIM8hxFquxUQcM1Yn+L51EgWw9ynHi+XreGXW/qRsq30pokmg/tvmZa2arnvU1rOSloBPdDnQG6gC/xk/4NxopjMTHQUnLQo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z0ThocOIdcoFeSSkKd7XG2YKq6JhtcoVFNMdugInanevCHH4f3pdXHdkUfO1jmx6x/9j5j2OVkHHThVUP5ZJlwYLv71rjDl+bX0k5HHTo5o4NIxuqjW+IMkp4dEvgUWvP7ypYKEObxLSxOfuooTJdyde45vIBgcQLP0za3HsMdAopb7Ahm9DCJWS/A4fTE367fxwsGPG/+Dw==</diagram></mxfile>
30 changes: 28 additions & 2 deletions test/common/ERC20BaseModuleCommon.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const {
} = require('../../openzeppelin-contracts-upgradeable/test/helpers/customError')
const { should } = require('chai').should()

function BaseModuleCommon (admin, address1, address2, address3, proxyTest) {
function ERC20BaseModuleCommon (admin, address1, address2, address3, proxyTest) {
context('Token structure', function () {
it('testHasTheDefinedName', async function () {
// Act + Assert
Expand All @@ -20,6 +20,32 @@ function BaseModuleCommon (admin, address1, address2, address3, proxyTest) {
})
})

context('Balance', function () {
const TOKEN_AMOUNTS = [BN(31), BN(32), BN(33)]
const TOKEN_INITIAL_SUPPLY = TOKEN_AMOUNTS.reduce((a, b) => {
return a.add(b)
})
beforeEach(async function () {
await this.cmtat.mint(address1, TOKEN_AMOUNTS[0], { from: admin })
await this.cmtat.mint(address2, TOKEN_AMOUNTS[1], { from: admin })
await this.cmtat.mint(address3, TOKEN_AMOUNTS[2], { from: admin })
})
it('testHasTheCorrectBalanceInfo', async function () {
// Act + Assert
// Assert
let result = await this.cmtat.balanceInfo(address1, address2);
result[0].should.be.bignumber.equal(
TOKEN_AMOUNTS[0]
);
result[1].should.be.bignumber.equal(
TOKEN_AMOUNTS[1]
);
result[2].should.be.bignumber.equal(
TOKEN_INITIAL_SUPPLY
);
})
})

context('Allowance', function () {
// address1 -> address3
it('testApproveAllowance', async function () {
Expand Down Expand Up @@ -362,4 +388,4 @@ function BaseModuleCommon (admin, address1, address2, address3, proxyTest) {
})
})
}
module.exports = BaseModuleCommon
module.exports = ERC20BaseModuleCommon

0 comments on commit 5d183e2

Please sign in to comment.