Skip to content

Commit

Permalink
Improve doc and test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
rya-sge committed Sep 10, 2024
1 parent f71f425 commit 98567c0
Show file tree
Hide file tree
Showing 131 changed files with 1,582 additions and 1,014 deletions.
1 change: 1 addition & 0 deletions contracts/CMTAT_PROXY.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pragma solidity ^0.8.20;

import "./modules/CMTAT_BASE.sol";


/**
* @title CMTAT version for a proxy deployment (Transparent or Beacon proxy)
*/
Expand Down
1 change: 1 addition & 0 deletions contracts/CMTAT_PROXY_UUPS.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pragma solidity ^0.8.20;
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "./modules/CMTAT_BASE.sol";


/**
* @title CMTAT version for a proxy deployment with UUPS proxy
*/
Expand Down
1 change: 1 addition & 0 deletions contracts/CMTAT_STANDALONE.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pragma solidity ^0.8.20;

import "./modules/CMTAT_BASE.sol";


/**
* @title CMTAT version for a standalone deployment (without proxy)
*/
Expand Down
4 changes: 3 additions & 1 deletion contracts/deployment/CMTAT_TP_FACTORY.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ pragma solidity ^0.8.20;

import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
import "../CMTAT_PROXY.sol";
import '@openzeppelin/contracts/utils/Create2.sol';
import "@openzeppelin/contracts/utils/Create2.sol";
import "./libraries/CMTATFactoryInvariant.sol";
import "./libraries/CMTATFactoryBase.sol";


/**
* @notice Factory to deploy CMTAT with a transparent proxy
*
Expand Down
4 changes: 3 additions & 1 deletion contracts/deployment/CMTAT_UUPS_FACTORY.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ pragma solidity ^0.8.20;

import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
import "../CMTAT_PROXY_UUPS.sol";
import '@openzeppelin/contracts/utils/Create2.sol';
import "@openzeppelin/contracts/utils/Create2.sol";
import "./libraries/CMTATFactoryInvariant.sol";
import "./libraries/CMTATFactoryBase.sol";


/**
* @notice Factory to deploy CMTAT with a UUPS proxy
*
Expand Down
3 changes: 2 additions & 1 deletion contracts/interfaces/ICMTATConstructor.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
//SPDX-License-Identifier: MPL-2.0
pragma solidity ^0.8.20;
import "./engine/IDebtEngine.sol";
import "./engine/IRuleEngine.sol";
import "./engine/IAuthorizationEngine.sol";
import "./engine/draft-IERC1643.sol";

pragma solidity ^0.8.20;


/**
* @notice interface to represent arguments used for CMTAT constructor / initialize
Expand Down
1 change: 1 addition & 0 deletions contracts/mocks/AuthorizationEngineMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pragma solidity ^0.8.20;

import "../interfaces/engine/IAuthorizationEngine.sol";


/*
* @title a mock for testing, not suitable for production
*/
Expand Down
1 change: 1 addition & 0 deletions contracts/mocks/MinimalForwarderMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pragma solidity ^0.8.20;

import "@openzeppelin/contracts-upgradeable/metatx/ERC2771ForwarderUpgradeable.sol";


/*
* @title a MinimalForwarderMock for testing, not suitable for production
*/
Expand Down
1 change: 1 addition & 0 deletions contracts/mocks/RuleEngine/RuleMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ pragma solidity ^0.8.20;
import "./interfaces/IRule.sol";
import "./CodeList.sol";


/*
* @title a mock for testing, not suitable for production
*/
Expand Down
1 change: 1 addition & 0 deletions contracts/test/proxy/CMTAT_PROXY_TEST.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pragma solidity ^0.8.20;

import "../../CMTAT_PROXY.sol";


/**
* @title a contrat used to test the proxy upgrade functionality
*/
Expand Down
1 change: 1 addition & 0 deletions contracts/test/proxy/CMTAT_PROXY_TEST_UUPS.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pragma solidity ^0.8.20;

import "../../CMTAT_PROXY_UUPS.sol";


/**
* @title a contrat used to test the proxy upgrade functionality
*/
Expand Down
10 changes: 4 additions & 6 deletions doc/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ are the latest ones that we tested:

- npm 10.2.5
- Hardhat ^2.22.7
- Solidity 0.8.26 (via solc-js)
- Solidity 0.8.27 (via solc-js)
- Node 20.5.0
- OpenZeppelin
- OpenZeppelin Contracts Upgradeable (submodule) [v5.0.2](https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/releases/tag/v5.0.2)
- OpenZeppelin Contracts (Node.js module) [v5.0.2](https://github.com/OpenZeppelin/openzeppelin-contracts/releases/tag/v5.0.2)
- Reason n°1: libraries and interfaces are no longer available inside the upgradeable version since the version v5.0.0.
- Reason n°2: It is not installed as a github submodule because it will create conflicts with the imports inside OpenZeppelin which use the Node.js version.
- OpenZeppelin Contracts (Node.js module) [v5.0.2](https://github.com/OpenZeppelin/openzeppelin-contracts/releases/tag/v5.0.2)
- OpenZeppelin Contracts Upgradeable (Node.js module) [v5.0.2](https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/releases/tag/v5.0.2)
- Test: OpenZeppelin Contracts Upgradeable (submodule) [v5.0.2](https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/releases/tag/v5.0.2)


## Installation
Expand Down
15 changes: 12 additions & 3 deletions doc/general/test/coverage/contracts/CMTAT_PROXY.sol.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ <h1>
17
18
19
20</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
20
21
22
23</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
Expand All @@ -78,7 +81,10 @@ <h1>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">197×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">198×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">//SPDX-License-Identifier: MPL-2.0
Expand All @@ -87,6 +93,9 @@ <h1>
&nbsp;
import "./modules/CMTAT_BASE.sol";
&nbsp;
/**
* @title CMTAT version for a proxy deployment (Transparent or Beacon proxy)
*/
contract CMTAT_PROXY is CMTAT_BASE {
/**
* @notice Contract version for the deployment with a proxy
Expand All @@ -106,7 +115,7 @@ <h1>
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Aug 09 2024 14:44:48 GMT+0200 (Central European Summer Time)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Tue Sep 10 2024 15:33:31 GMT+0200 (Central European Summer Time)
</div>
</div>
<script src="../prettify.js"></script>
Expand Down
16 changes: 14 additions & 2 deletions doc/general/test/coverage/contracts/CMTAT_PROXY_UUPS.sol.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,15 @@ <h1>
47
48
49
50</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
50
51
52
53
54</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
Expand Down Expand Up @@ -146,6 +154,10 @@ <h1>
pragma solidity ^0.8.20;
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "./modules/CMTAT_BASE.sol";
&nbsp;
/**
* @title CMTAT version for a proxy deployment with UUPS proxy
*/
contract CMTAT_PROXY_UUPS is CMTAT_BASE, UUPSUpgradeable {
bytes32 public constant PROXY_UPGRADE_ROLE = keccak256("PROXY_UPGRADE_ROLE");
/**
Expand Down Expand Up @@ -196,7 +208,7 @@ <h1>
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Aug 09 2024 14:44:48 GMT+0200 (Central European Summer Time)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Tue Sep 10 2024 15:33:31 GMT+0200 (Central European Summer Time)
</div>
</div>
<script src="../prettify.js"></script>
Expand Down
15 changes: 12 additions & 3 deletions doc/general/test/coverage/contracts/CMTAT_STANDALONE.sol.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ <h1>
31
32
33
34</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
34
35
36
37</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
Expand All @@ -101,7 +104,10 @@ <h1>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">189×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">191×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
Expand All @@ -115,6 +121,9 @@ <h1>
&nbsp;
import "./modules/CMTAT_BASE.sol";
&nbsp;
/**
* @title CMTAT version for a standalone deployment (without proxy)
*/
contract CMTAT_STANDALONE is CMTAT_BASE {
/**
* @notice Contract version for standalone deployment
Expand Down Expand Up @@ -148,7 +157,7 @@ <h1>
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Aug 09 2024 14:44:48 GMT+0200 (Central European Summer Time)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Tue Sep 10 2024 15:33:31 GMT+0200 (Central European Summer Time)
</div>
</div>
<script src="../prettify.js"></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,13 @@ <h1>
100
101
102
103</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
103
104
105
106
107
108
109</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
Expand Down Expand Up @@ -187,6 +192,9 @@ <h1>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes"></span>
<span class="cline-any cline-yes"></span>
<span class="cline-any cline-neutral">&nbsp;</span>
Expand Down Expand Up @@ -214,6 +222,18 @@ <h1>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes"></span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes"></span>
<span class="cline-any cline-yes"></span>
<span class="cline-any cline-yes"></span>
Expand All @@ -239,22 +259,13 @@ <h1>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes"></span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes"></span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">//SPDX-License-Identifier: MPL-2.0
pragma solidity ^0.8.20;
&nbsp;
import "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol";
&nbsp;
import '@openzeppelin/contracts/utils/Create2.sol';
import '@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol';
import "../CMTAT_PROXY.sol";
import "../modules/CMTAT_BASE.sol";
import "./libraries/CMTATFactoryRoot.sol";
&nbsp;
&nbsp;
Expand All @@ -280,6 +291,9 @@ <h1>
beacon = new UpgradeableBeacon(implementation_, beaconOwner);
}
&nbsp;
/*//////////////////////////////////////////////////////////////
PUBLIC/EXTERNAL FUNCTIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice deploy CMTAT with a beacon proxy
*
Expand Down Expand Up @@ -311,6 +325,18 @@ <h1>
cmtatArgument);
return Create2.computeAddress(deploymentSalt, keccak256(bytecode), address(this) );
}
&nbsp;
/**
* @notice get the implementation address from the beacon
* @return implementation address
*/
function implementation() public view returns (address) {
return beacon.implementation();
}
&nbsp;
/*//////////////////////////////////////////////////////////////
INTERNAL FUNCTIONS
//////////////////////////////////////////////////////////////*/
&nbsp;
/**
* @notice Deploy CMTAT and push the created CMTAT in the list
Expand Down Expand Up @@ -341,21 +367,13 @@ <h1>
);
bytecode = abi.encodePacked(type(BeaconProxy).creationCode, abi.encode(address(beacon), _implementation));
}
&nbsp;
/**
* @notice get the implementation address from the beacon
* @return implementation address
*/
function implementation() public view returns (address) {
return beacon.implementation();
}
}</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Aug 09 2024 14:44:48 GMT+0200 (Central European Summer Time)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Tue Sep 10 2024 15:33:31 GMT+0200 (Central European Summer Time)
</div>
</div>
<script src="../../prettify.js"></script>
Expand Down
Loading

0 comments on commit 98567c0

Please sign in to comment.