-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #269 from CMTA/manage-documents
Migrate Truffle test + Manage documents
- Loading branch information
Showing
223 changed files
with
10,496 additions
and
8,860 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
//SPDX-License-Identifier: MPL-2.0 | ||
|
||
pragma solidity ^0.8.20; | ||
import "../openzeppelin-contracts-upgradeable/contracts/proxy/utils/UUPSUpgradeable.sol"; | ||
import "./modules/CMTAT_BASE.sol"; | ||
import "./interfaces/engine/IEngine.sol"; | ||
contract CMTAT_PROXY_UUPS is CMTAT_BASE, UUPSUpgradeable { | ||
bytes32 public constant PROXY_UPGRADE_ROLE = keccak256("PROXY_UPGRADE_ROLE"); | ||
/** | ||
* @notice Contract version for the deployment with a proxy | ||
* @param forwarderIrrevocable address of the forwarder, required for the gasless support | ||
*/ | ||
/// @custom:oz-upgrades-unsafe-allow constructor | ||
constructor( | ||
address forwarderIrrevocable | ||
) MetaTxModule(forwarderIrrevocable) { | ||
// Disable the possibility to initialize the implementation | ||
_disableInitializers(); | ||
} | ||
|
||
/** | ||
* @notice | ||
* initialize the proxy contract | ||
* The calls to this function will revert if the contract was deployed without a proxy | ||
* @param admin address of the admin of contract (Access Control) | ||
* @param nameIrrevocable name of the token | ||
* @param symbolIrrevocable name of the symbol | ||
* @param decimalsIrrevocable number of decimals of the token, must be 0 to be compliant with Swiss law as per CMTAT specifications (non-zero decimal number may be needed for other use cases) | ||
* @param tokenId_ name of the tokenId | ||
* @param terms_ terms associated with the token | ||
* @param information_ additional information to describe the token | ||
* @param engines list of engines | ||
*/ | ||
function initialize( address admin, | ||
string memory nameIrrevocable, | ||
string memory symbolIrrevocable, | ||
uint8 decimalsIrrevocable, | ||
string memory tokenId_, | ||
string memory terms_, | ||
string memory information_, | ||
IEngine.Engine memory engines) public override initializer { | ||
CMTAT_BASE.initialize( admin, | ||
nameIrrevocable, | ||
symbolIrrevocable, | ||
decimalsIrrevocable, | ||
tokenId_, | ||
terms_, | ||
information_, | ||
engines); | ||
__UUPSUpgradeable_init_unchained(); | ||
} | ||
|
||
function _authorizeUpgrade(address) internal override onlyRole(PROXY_UPGRADE_ROLE) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
pragma solidity ^0.8.20; | ||
import "../IDebtGlobal.sol"; | ||
|
||
interface IDebtEngine is IDebtGlobal { | ||
/** | ||
* @dev Returns true if the operation is authorized, and false otherwise. | ||
*/ | ||
function debt() external view returns(IDebtGlobal.DebtBase memory); | ||
/** | ||
* @dev Returns true if the operation is authorized, and false otherwise. | ||
*/ | ||
function creditEvents() external view returns(IDebtGlobal.CreditEvents memory); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//SPDX-License-Identifier: MPL-2.0 | ||
import "./IDebtEngine.sol"; | ||
import "./IRuleEngine.sol"; | ||
import "./IAuthorizationEngine.sol"; | ||
import "./draft-IERC1643.sol"; | ||
|
||
pragma solidity ^0.8.20; | ||
|
||
/** | ||
* @notice interface to represent debt tokens | ||
*/ | ||
interface IEngine { | ||
struct Engine { | ||
IRuleEngine ruleEngine; | ||
IDebtEngine debtEngine; | ||
IAuthorizationEngine authorizationEngine; | ||
IERC1643 documentEngine; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
//SPDX-License-Identifier: MPL-2.0 | ||
|
||
pragma solidity ^0.8.20; | ||
|
||
/// @title IERC1643 Document Management | ||
/// (part of the ERC1400 Security Token Standards) | ||
interface IERC1643 { | ||
// Document Management | ||
function getDocument(bytes32 _name) external view returns (string memory , bytes32, uint256); | ||
function getAllDocuments() external view returns (bytes32[] memory); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
// SPDX-License-Identifier: MPL-2.0 | ||
pragma solidity ^0.8.20; | ||
import "../interfaces/IDebtGlobal.sol"; | ||
interface IDebtEngine is IDebtGlobal { | ||
function debt() external view returns (DebtBase memory); | ||
function creditEvents() external view returns (CreditEvents memory); | ||
function setDebt(DebtBase calldata debt_) external; | ||
function setCreditEvents(CreditEvents calldata creditEvents) external; | ||
} | ||
|
||
contract DebtEngineMock is IDebtEngine { | ||
DebtBase private _debt; | ||
CreditEvents private _creditEvents; | ||
|
||
function debt() external view override returns (DebtBase memory) { | ||
return _debt; | ||
} | ||
|
||
function creditEvents() external view override returns (CreditEvents memory) { | ||
return _creditEvents; | ||
} | ||
|
||
function setDebt(DebtBase calldata debt_) external override { | ||
_debt = debt_; | ||
} | ||
|
||
function setCreditEvents(CreditEvents calldata creditEvents_) external override { | ||
_creditEvents = creditEvents_; | ||
} | ||
} |
Oops, something went wrong.