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
151 lines
8.1 KiB
Solidity
151 lines
8.1 KiB
Solidity
// SPDX-License-Identifier: CC0-1.0
|
|
//
|
|
// :+#####%%%%%%%%%%%%%%+
|
|
// .-*@@@%+.:+%@@@@@%%#***%@@%=
|
|
// :=*%@@@#=. :#@@% *@@@%=
|
|
// .-+*%@%*-.:+%@@@@@@+. -*+: .=#. :%@@@%-
|
|
// :=*@@@@%%@@@@@@@@@%@@@- .=#@@@%@%= =@@@@#.
|
|
// -=+#%@@%#*=:. :%@@@@%. -*@@#*@@@@@@@#=:- *@@@@+
|
|
// =@@%=:. :=: *@@@@@%#- =%*%@@@@#+-. =+ :%@@@%-
|
|
// -@@%. .+@@@ =+=-. @@#- +@@@%- =@@@@%:
|
|
// :@@@. .+@@#%: : .=*=-::.-%@@@+*@@= +@@@@#.
|
|
// %@@: +@%%* =%@@@@@@@@@@@#. .*@%- +@@@@*.
|
|
// #@@= .+@@@@%:=*@@@@@- :%@%: .*@@@@+
|
|
// *@@* +@@@#-@@%-:%@@* +@@#. :%@@@@-
|
|
// -@@% .:-=++*##%%%@@@@@@@@@@@@*. :@+.@@@%: .#@@+ =@@@@#:
|
|
// .@@@*-+*#%%%@@@@@@@@@@@@@@@@%%#**@@%@@@. *@=*@@# :#@%= .#@@@@#-
|
|
// -%@@@@@@@@@@@@@@@*+==-:-@@@= *@# .#@*-=*@@@@%= -%@@@* =@@@@@%-
|
|
// -+%@@@#. %@%%= -@@:+@: -@@* *@@*-:: -%@@%=. .*@@@@@#
|
|
// *@@@* +@* *@@##@@- #@*@@+ -@@= . :+@@@#: .-+@@@%+-
|
|
// +@@@%*@@:..=@@@@* .@@@* .#@#. .=+- .=%@@@*. :+#@@@@*=:
|
|
// =@@@@%@@@@@@@@@@@@@@@@@@@@@@%- :+#*. :*@@@%=. .=#@@@@%+:
|
|
// .%@@= ..... .=#@@+. .#@@@*: -*%@@@@%+.
|
|
// +@@#+===---:::... .=%@@*- +@@@+. -*@@@@@%+.
|
|
// -@@@@@@@@@@@@@@@@@@@@@@%@@@@= -@@@+ -#@@@@@#=.
|
|
// ..:::---===+++***###%%%@@@#- .#@@+ -*@@@@@#=.
|
|
// @@@@@@+. +@@*. .+@@@@@%=.
|
|
// -@@@@@= =@@%: -#@@@@%+.
|
|
// +@@@@@. =@@@= .+@@@@@*:
|
|
// #@@@@#:%@@#. :*@@@@#-
|
|
// @@@@@%@@@= :#@@@@+.
|
|
// :@@@@@@@#.:#@@@%-
|
|
// +@@@@@@-.*@@@*:
|
|
// #@@@@#.=@@@+.
|
|
// @@@@+-%@%=
|
|
// :@@@#%@%=
|
|
// +@@@@%-
|
|
// :#%%=
|
|
//
|
|
pragma solidity 0.8.30;
|
|
import "@onchain-id/solidity/contracts/interface/IIdentity.sol";
|
|
|
|
/// events
|
|
|
|
/// @dev This event is emitted when an Identity is registered into the storage contract.
|
|
/// @param _investorAddress` is the address of the investor's wallet.
|
|
/// @param _identity` is the address of the Identity smart contract (onchainID).
|
|
event IdentityStored(address indexed _investorAddress, IIdentity indexed _identity);
|
|
|
|
/// @dev This event is emitted when an Identity is removed from the storage contract.
|
|
/// @param _investorAddress is the address of the investor's wallet.
|
|
/// @param _identity is the address of the Identity smart contract (onchainID).
|
|
event IdentityUnstored(address indexed _investorAddress, IIdentity indexed _identity);
|
|
|
|
/// @dev This event is emitted when an Identity has been updated.
|
|
/// @param _oldIdentity is the old Identity contract's address to update.
|
|
/// @param _newIdentity is the new Identity contract's.
|
|
event IdentityModified(IIdentity indexed _oldIdentity, IIdentity indexed _newIdentity);
|
|
|
|
/// @dev This event is emitted when an Identity's country has been updated.
|
|
/// @param _investorAddress is the address on which the country has been updated.
|
|
/// @param _country is the numeric code (ISO 3166-1) of the new country.
|
|
event CountryModified(address indexed _investorAddress, uint16 indexed _country);
|
|
|
|
/// @dev This event is emitted when an Identity Registry is bound to the storage contract.
|
|
/// @param _identityRegistry is the address of the identity registry added.
|
|
event IdentityRegistryBound(address indexed _identityRegistry);
|
|
|
|
/// @dev This event is emitted when an Identity Registry is unbound from the storage contract.
|
|
/// @param _identityRegistry is the address of the identity registry removed.
|
|
event IdentityRegistryUnbound(address indexed _identityRegistry);
|
|
|
|
interface IERC3643IdentityRegistryStorage {
|
|
|
|
/// functions
|
|
/**
|
|
* @dev adds an identity contract corresponding to a user address in the storage.
|
|
* Requires that the user doesn't have an identity contract already registered.
|
|
* This function can only be called by an address set as agent of the smart contract
|
|
* @param _userAddress The address of the user
|
|
* @param _identity The address of the user's identity contract
|
|
* @param _country The country of the investor
|
|
* emits `IdentityStored` event
|
|
*/
|
|
function addIdentityToStorage(address _userAddress, IIdentity _identity, uint16 _country) external;
|
|
|
|
/**
|
|
* @dev Removes an user from the storage.
|
|
* Requires that the user have an identity contract already deployed that will be deleted.
|
|
* This function can only be called by an address set as agent of the smart contract
|
|
* @param _userAddress The address of the user to be removed
|
|
* emits `IdentityUnstored` event
|
|
*/
|
|
function removeIdentityFromStorage(address _userAddress) external;
|
|
|
|
/**
|
|
* @dev Updates the country corresponding to a user address.
|
|
* Requires that the user should have an identity contract already deployed that will be replaced.
|
|
* This function can only be called by an address set as agent of the smart contract
|
|
* @param _userAddress The address of the user
|
|
* @param _country The new country of the user
|
|
* emits `CountryModified` event
|
|
*/
|
|
function modifyStoredInvestorCountry(address _userAddress, uint16 _country) external;
|
|
|
|
/**
|
|
* @dev Updates an identity contract corresponding to a user address.
|
|
* Requires that the user address should be the owner of the identity contract.
|
|
* Requires that the user should have an identity contract already deployed that will be replaced.
|
|
* This function can only be called by an address set as agent of the smart contract
|
|
* @param _userAddress The address of the user
|
|
* @param _identity The address of the user's new identity contract
|
|
* emits `IdentityModified` event
|
|
*/
|
|
function modifyStoredIdentity(address _userAddress, IIdentity _identity) external;
|
|
|
|
/**
|
|
* @notice Adds an identity registry as agent of the Identity Registry Storage Contract.
|
|
* This function can only be called by the wallet set as owner of the smart contract
|
|
* This function adds the identity registry to the list of identityRegistries linked to the storage contract
|
|
* cannot bind more than 300 IR to 1 IRS
|
|
* @param _identityRegistry The identity registry address to add.
|
|
*/
|
|
function bindIdentityRegistry(address _identityRegistry) external;
|
|
|
|
/**
|
|
* @notice Removes an identity registry from being agent of the Identity Registry Storage Contract.
|
|
* This function can only be called by the wallet set as owner of the smart contract
|
|
* This function removes the identity registry from the list of identityRegistries linked to the storage contract
|
|
* @param _identityRegistry The identity registry address to remove.
|
|
*/
|
|
function unbindIdentityRegistry(address _identityRegistry) external;
|
|
|
|
/**
|
|
* @dev Returns the identity registries linked to the storage contract
|
|
*/
|
|
function linkedIdentityRegistries() external view returns (address[] memory);
|
|
|
|
/**
|
|
* @dev Returns the onchainID of an investor.
|
|
* @param _userAddress The wallet of the investor
|
|
*/
|
|
function storedIdentity(address _userAddress) external view returns (IIdentity);
|
|
|
|
/**
|
|
* @dev Returns the country code of an investor.
|
|
* @param _userAddress The wallet of the investor
|
|
*/
|
|
function storedInvestorCountry(address _userAddress) external view returns (uint16);
|
|
|
|
}
|