mirror of
https://github.com/luxfi/erc-3643.git
synced 2026-10-30 16:58:28 +00:00
* ✨ integrate foundry alongside hardhat for dual testing framework - Add foundry.toml configuration - Reorganize test structure: test/forge/ and test/hardhat/ - Add Foundry scripts to package.json (build:forge, test:forge, coverage:forge) - Update hardhat.config.ts with evmVersion for compatibility - Add GitHub workflows and coverage scripts from template - Add Husky hooks (pre-commit, post-checkout, post-merge) - Add .vscode/settings.json for better IDE support - Disable coverage checks until tests are migrated (commented with TODO) This migration is based on TokenySolutions/contracts-template and enables gradual migration of tests from Hardhat (TypeScript) to Foundry (Solidity). Related to: BT-1418 * ✅ trex factory tests * ⚰️ remove trex suit * feat(forge): reorganize Foundry test structure and sync GitHub workflows - Move TREXFactorySetup to helpers folder - Rename TREXSuite.t.sol to TREXFactory.t.sol - Update fixture to inherit from Test for proper Foundry pattern - Transfer ownership to deployer address to match Hardhat behavior - Sync GitHub workflows with package.json scripts - Update test.yml to use npm run build and npm run test - Update push_checking.yml to use unified npm run lint - Update forge_coverage.sh to use npm run coverage * fix(ci): install Foundry and skip husky in push_checking workflow - Add Foundry installation step before npm ci - Set HUSKY=0 to skip husky setup in CI environment - Fixes 'forge: not found' error during npm prepare script * 🔧 keep hardhat settings * ✅ create addressess directly * ✅ removed test_StandardAddressesSet * ✅ fix lint * 💡 removed title natspecs * ✅ migrated trex factort tests * ✅ added test module multicall * ✅ migrate agent role test * ✅ migrate claim topics registry * ✅ migrated trusted issuer registry * ✅ migrate identity registry storage * ✅ migrated identity registry tests * ✅ migrated implementation authority test * ✅ migrated token agen restrictions * ✅ migrated token information test * ✅ migrated token recover * ✅ migrated token permit * ✅ migrated token transfer * ✅ migrated utilities upgrade * ✅ migrated freeze check * ✅ migrated compliance check in utilities test * ✅ migrated eligibility check * ✅ migrated transfer check in utilities * ✅ migrated compliance test * ✅ migrated gateway tests * 🔥 removed already defined events * 🗑️ imported Initializable error from openzeppelin * ➕ added already defined events and errors * ✅ added base test token * ✅ used idFactory * ♻️ refactored compliance test * ⚰️ remoced useless vm.prank * 🔧 deleted hardhat configurations * 💚 fixed ci * refactor: remove 100% coverage requirement from forge_coverage.sh - Remove strict 100% coverage checks that were causing workflow failures - Script now only generates and displays coverage report without failing - Aligns with previous behavior where coverage was informational only * ✅ resolve getVerifiedDetails * ✅ applied _getEligibility and remove via-ir from foundry.toml * ✅ cover tokena and token permit * ✅ cover compliance * ✅ cover identity registry * ✅ increased trex gateway coverage * ✅ increase coverage for trex factory * ✅ increased AbstractModuleUpgradeable.sol coverage * ⚰️ removed abstract module * 🔧 updted generate coverage * ✅ coverage 100% identity registry * ✅ coverage 100% trex gate way * ✅ coverage trex factory * ✅ coverage 100% AbstractModuleUpgradeable by test module * ✅ coverage IAFactory.sol * ✅ coverage 100% for implementation authority * ✅ coverage 1005 abstract proxy * ✅ coverage 100% claim topic registry * ✅ coverage 100% identity registry storage * ✅ coverage 100% modular compliance proxy * ✅ coverage trusted issuer registry proxy * ✅ coverage 100% identity registry * ✅ coverage 100% token proxy * 🚨 resolve linter in token information * ✅ coverage 100% roles * 🚨 resolve linter * 🔧 added no coverage for test, _testContracts and utils * ✅ coverage 100% for token.sol * ✅ coverage 100% for modular compliance * ✅ coverage 100% trusted issuer registry * 🔧 restore package.json * ✅ coverage 100% for utlity checker * 🚨 fix linter
137 lines
7.4 KiB
Solidity
137 lines
7.4 KiB
Solidity
// SPDX-License-Identifier: CC0-1.0
|
|
//
|
|
// :+#####%%%%%%%%%%%%%%+
|
|
// .-*@@@%+.:+%@@@@@%%#***%@@%=
|
|
// :=*%@@@#=. :#@@% *@@@%=
|
|
// .-+*%@%*-.:+%@@@@@@+. -*+: .=#. :%@@@%-
|
|
// :=*@@@@%%@@@@@@@@@%@@@- .=#@@@%@%= =@@@@#.
|
|
// -=+#%@@%#*=:. :%@@@@%. -*@@#*@@@@@@@#=:- *@@@@+
|
|
// =@@%=:. :=: *@@@@@%#- =%*%@@@@#+-. =+ :%@@@%-
|
|
// -@@%. .+@@@ =+=-. @@#- +@@@%- =@@@@%:
|
|
// :@@@. .+@@#%: : .=*=-::.-%@@@+*@@= +@@@@#.
|
|
// %@@: +@%%* =%@@@@@@@@@@@#. .*@%- +@@@@*.
|
|
// #@@= .+@@@@%:=*@@@@@- :%@%: .*@@@@+
|
|
// *@@* +@@@#-@@%-:%@@* +@@#. :%@@@@-
|
|
// -@@% .:-=++*##%%%@@@@@@@@@@@@*. :@+.@@@%: .#@@+ =@@@@#:
|
|
// .@@@*-+*#%%%@@@@@@@@@@@@@@@@%%#**@@%@@@. *@=*@@# :#@%= .#@@@@#-
|
|
// -%@@@@@@@@@@@@@@@*+==-:-@@@= *@# .#@*-=*@@@@%= -%@@@* =@@@@@%-
|
|
// -+%@@@#. %@%%= -@@:+@: -@@* *@@*-:: -%@@%=. .*@@@@@#
|
|
// *@@@* +@* *@@##@@- #@*@@+ -@@= . :+@@@#: .-+@@@%+-
|
|
// +@@@%*@@:..=@@@@* .@@@* .#@#. .=+- .=%@@@*. :+#@@@@*=:
|
|
// =@@@@%@@@@@@@@@@@@@@@@@@@@@@%- :+#*. :*@@@%=. .=#@@@@%+:
|
|
// .%@@= ..... .=#@@+. .#@@@*: -*%@@@@%+.
|
|
// +@@#+===---:::... .=%@@*- +@@@+. -*@@@@@%+.
|
|
// -@@@@@@@@@@@@@@@@@@@@@@%@@@@= -@@@+ -#@@@@@#=.
|
|
// ..:::---===+++***###%%%@@@#- .#@@+ -*@@@@@#=.
|
|
// @@@@@@+. +@@*. .+@@@@@%=.
|
|
// -@@@@@= =@@%: -#@@@@%+.
|
|
// +@@@@@. =@@@= .+@@@@@*:
|
|
// #@@@@#:%@@#. :*@@@@#-
|
|
// @@@@@%@@@= :#@@@@+.
|
|
// :@@@@@@@#.:#@@@%-
|
|
// +@@@@@@-.*@@@*:
|
|
// #@@@@#.=@@@+.
|
|
// @@@@+-%@%=
|
|
// :@@@#%@%=
|
|
// +@@@@%-
|
|
// :#%%=
|
|
//
|
|
pragma solidity 0.8.30;
|
|
import "@onchain-id/solidity/contracts/interface/IClaimIssuer.sol";
|
|
|
|
/// Events
|
|
|
|
/// @dev This event is emitted when a trusted issuer is added in the registry.
|
|
/// @param _trustedIssuer is the address of the trusted issuer's ClaimIssuer contract.
|
|
/// @param _claimTopics is the set of claims that the trusted issuer is allowed to emit.
|
|
event TrustedIssuerAdded(IClaimIssuer indexed _trustedIssuer, uint256[] _claimTopics);
|
|
|
|
/// @dev This event is emitted when a trusted issuer is removed from the registry.
|
|
/// @param _trustedIssuer is the address of the trusted issuer's ClaimIssuer contract.
|
|
event TrustedIssuerRemoved(IClaimIssuer indexed _trustedIssuer);
|
|
|
|
/// &dev This event is emitted when the set of claim topics is changed for a given trusted issuer.
|
|
/// @param _trustedIssuer is the address of the trusted issuer's ClaimIssuer contract
|
|
/// @param _claimTopics is the set of claims that the trusted issuer is allowed to emit.
|
|
event ClaimTopicsUpdated(IClaimIssuer indexed _trustedIssuer, uint256[] _claimTopics);
|
|
|
|
interface IERC3643TrustedIssuersRegistry {
|
|
|
|
// Functions
|
|
|
|
// Setters
|
|
/**
|
|
* @dev registers a ClaimIssuer contract as trusted claim issuer.
|
|
* Requires that a ClaimIssuer contract doesn't already exist
|
|
* Requires that the claimTopics set is not empty
|
|
* Requires that there is no more than 15 claimTopics
|
|
* Requires that there is no more than 50 Trusted issuers
|
|
* @param _trustedIssuer The ClaimIssuer contract address of the trusted claim issuer.
|
|
* @param _claimTopics the set of claim topics that the trusted issuer is allowed to emit
|
|
* This function can only be called by the owner of the Trusted Issuers Registry contract
|
|
* emits a `TrustedIssuerAdded` event
|
|
*/
|
|
function addTrustedIssuer(IClaimIssuer _trustedIssuer, uint256[] calldata _claimTopics) external;
|
|
|
|
/**
|
|
* @dev Removes the ClaimIssuer contract of a trusted claim issuer.
|
|
* Requires that the claim issuer contract to be registered first
|
|
* @param _trustedIssuer the claim issuer to remove.
|
|
* This function can only be called by the owner of the Trusted Issuers Registry contract
|
|
* emits a `TrustedIssuerRemoved` event
|
|
*/
|
|
function removeTrustedIssuer(IClaimIssuer _trustedIssuer) external;
|
|
|
|
/**
|
|
* @dev Updates the set of claim topics that a trusted issuer is allowed to emit.
|
|
* Requires that this ClaimIssuer contract already exists in the registry
|
|
* Requires that the provided claimTopics set is not empty
|
|
* Requires that there is no more than 15 claimTopics
|
|
* @param _trustedIssuer the claim issuer to update.
|
|
* @param _claimTopics the set of claim topics that the trusted issuer is allowed to emit
|
|
* This function can only be called by the owner of the Trusted Issuers Registry contract
|
|
* emits a `ClaimTopicsUpdated` event
|
|
*/
|
|
function updateIssuerClaimTopics(IClaimIssuer _trustedIssuer, uint256[] calldata _claimTopics) external;
|
|
|
|
/// Getters
|
|
|
|
/**
|
|
* @dev Function for getting all the trusted claim issuers stored.
|
|
* @return array of all claim issuers registered.
|
|
*/
|
|
function getTrustedIssuers() external view returns (IClaimIssuer[] memory);
|
|
|
|
/**
|
|
* @dev Function for getting all the trusted issuer allowed for a given claim topic.
|
|
* @param claimTopic the claim topic to get the trusted issuers for.
|
|
* @return array of all claim issuer addresses that are allowed for the given claim topic.
|
|
*/
|
|
function getTrustedIssuersForClaimTopic(uint256 claimTopic) external view returns (IClaimIssuer[] memory);
|
|
|
|
/**
|
|
* @dev Checks if the ClaimIssuer contract is trusted
|
|
* @param _issuer the address of the ClaimIssuer contract
|
|
* @return true if the issuer is trusted, false otherwise.
|
|
*/
|
|
function isTrustedIssuer(address _issuer) external view returns (bool);
|
|
|
|
/**
|
|
* @dev Function for getting all the claim topic of trusted claim issuer
|
|
* Requires the provided ClaimIssuer contract to be registered in the trusted issuers registry.
|
|
* @param _trustedIssuer the trusted issuer concerned.
|
|
* @return The set of claim topics that the trusted issuer is allowed to emit
|
|
*/
|
|
function getTrustedIssuerClaimTopics(IClaimIssuer _trustedIssuer) external view returns (uint256[] memory);
|
|
|
|
/**
|
|
* @dev Function for checking if the trusted claim issuer is allowed
|
|
* to emit a certain claim topic
|
|
* @param _issuer the address of the trusted issuer's ClaimIssuer contract
|
|
* @param _claimTopic the Claim Topic that has to be checked to know if the `issuer` is allowed to emit it
|
|
* @return true if the issuer is trusted for this claim topic.
|
|
*/
|
|
function hasClaimTopic(address _issuer, uint256 _claimTopic) external view returns (bool);
|
|
|
|
}
|