{"constructor_args":"0x000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","is_partially_verified":true,"is_changed_bytecode":false,"abi":[{"inputs":[{"internalType":"bool","name":"referenceStatus","type":"bool"},{"internalType":"address","name":"trexFactory","type":"address"},{"internalType":"address","name":"iaFactory","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"iaFactory","type":"address"}],"name":"IAFactorySet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":true,"internalType":"address","name":"_newImplementationAuthority","type":"address"}],"name":"ImplementationAuthorityChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"referenceStatus","type":"bool"},{"indexed":false,"internalType":"address","name":"trexFactory","type":"address"}],"name":"ImplementationAuthoritySet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"trexFactory","type":"address"}],"name":"TREXFactorySet","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint8","name":"major","type":"uint8"},{"internalType":"uint8","name":"minor","type":"uint8"},{"internalType":"uint8","name":"patch","type":"uint8"}],"indexed":true,"internalType":"struct ITREXImplementationAuthority.Version","name":"version","type":"tuple"},{"components":[{"internalType":"address","name":"tokenImplementation","type":"address"},{"internalType":"address","name":"ctrImplementation","type":"address"},{"internalType":"address","name":"irImplementation","type":"address"},{"internalType":"address","name":"irsImplementation","type":"address"},{"internalType":"address","name":"tirImplementation","type":"address"},{"internalType":"address","name":"mcImplementation","type":"address"}],"indexed":true,"internalType":"struct ITREXImplementationAuthority.TREXContracts","name":"trex","type":"tuple"}],"name":"TREXVersionAdded","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint8","name":"major","type":"uint8"},{"internalType":"uint8","name":"minor","type":"uint8"},{"internalType":"uint8","name":"patch","type":"uint8"}],"indexed":true,"internalType":"struct ITREXImplementationAuthority.Version","name":"version","type":"tuple"},{"components":[{"internalType":"address","name":"tokenImplementation","type":"address"},{"internalType":"address","name":"ctrImplementation","type":"address"},{"internalType":"address","name":"irImplementation","type":"address"},{"internalType":"address","name":"irsImplementation","type":"address"},{"internalType":"address","name":"tirImplementation","type":"address"},{"internalType":"address","name":"mcImplementation","type":"address"}],"indexed":true,"internalType":"struct ITREXImplementationAuthority.TREXContracts","name":"trex","type":"tuple"}],"name":"TREXVersionFetched","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint8","name":"major","type":"uint8"},{"internalType":"uint8","name":"minor","type":"uint8"},{"internalType":"uint8","name":"patch","type":"uint8"}],"indexed":true,"internalType":"struct ITREXImplementationAuthority.Version","name":"version","type":"tuple"}],"name":"VersionUpdated","type":"event"},{"inputs":[{"components":[{"internalType":"uint8","name":"major","type":"uint8"},{"internalType":"uint8","name":"minor","type":"uint8"},{"internalType":"uint8","name":"patch","type":"uint8"}],"internalType":"struct ITREXImplementationAuthority.Version","name":"_version","type":"tuple"},{"components":[{"internalType":"address","name":"tokenImplementation","type":"address"},{"internalType":"address","name":"ctrImplementation","type":"address"},{"internalType":"address","name":"irImplementation","type":"address"},{"internalType":"address","name":"irsImplementation","type":"address"},{"internalType":"address","name":"tirImplementation","type":"address"},{"internalType":"address","name":"mcImplementation","type":"address"}],"internalType":"struct ITREXImplementationAuthority.TREXContracts","name":"_trex","type":"tuple"}],"name":"addAndUseTREXVersion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint8","name":"major","type":"uint8"},{"internalType":"uint8","name":"minor","type":"uint8"},{"internalType":"uint8","name":"patch","type":"uint8"}],"internalType":"struct ITREXImplementationAuthority.Version","name":"_version","type":"tuple"},{"components":[{"internalType":"address","name":"tokenImplementation","type":"address"},{"internalType":"address","name":"ctrImplementation","type":"address"},{"internalType":"address","name":"irImplementation","type":"address"},{"internalType":"address","name":"irsImplementation","type":"address"},{"internalType":"address","name":"tirImplementation","type":"address"},{"internalType":"address","name":"mcImplementation","type":"address"}],"internalType":"struct ITREXImplementationAuthority.TREXContracts","name":"_trex","type":"tuple"}],"name":"addTREXVersion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_newImplementationAuthority","type":"address"}],"name":"changeImplementationAuthority","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint8","name":"major","type":"uint8"},{"internalType":"uint8","name":"minor","type":"uint8"},{"internalType":"uint8","name":"patch","type":"uint8"}],"internalType":"struct ITREXImplementationAuthority.Version","name":"_version","type":"tuple"}],"name":"fetchVersion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getCTRImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint8","name":"major","type":"uint8"},{"internalType":"uint8","name":"minor","type":"uint8"},{"internalType":"uint8","name":"patch","type":"uint8"}],"internalType":"struct ITREXImplementationAuthority.Version","name":"_version","type":"tuple"}],"name":"getContracts","outputs":[{"components":[{"internalType":"address","name":"tokenImplementation","type":"address"},{"internalType":"address","name":"ctrImplementation","type":"address"},{"internalType":"address","name":"irImplementation","type":"address"},{"internalType":"address","name":"irsImplementation","type":"address"},{"internalType":"address","name":"tirImplementation","type":"address"},{"internalType":"address","name":"mcImplementation","type":"address"}],"internalType":"struct ITREXImplementationAuthority.TREXContracts","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentVersion","outputs":[{"components":[{"internalType":"uint8","name":"major","type":"uint8"},{"internalType":"uint8","name":"minor","type":"uint8"},{"internalType":"uint8","name":"patch","type":"uint8"}],"internalType":"struct ITREXImplementationAuthority.Version","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getIRImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getIRSImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMCImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getReferenceContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTIRImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTREXFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokenImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isReferenceContract","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"iaFactory","type":"address"}],"name":"setIAFactory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"trexFactory","type":"address"}],"name":"setTREXFactory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint8","name":"major","type":"uint8"},{"internalType":"uint8","name":"minor","type":"uint8"},{"internalType":"uint8","name":"patch","type":"uint8"}],"internalType":"struct ITREXImplementationAuthority.Version","name":"_version","type":"tuple"}],"name":"useTREXVersion","outputs":[],"stateMutability":"nonpayable","type":"function"}],"conflicting_implementations":null,"certified":false,"additional_sources":[{"file_path":"@erc3643org/erc-3643/contracts/compliance/modular/IModularCompliance.sol","source_code":"// SPDX-License-Identifier: GPL-3.0\n//\n//                                             :+#####%%%%%%%%%%%%%%+\n//                                         .-*@@@%+.:+%@@@@@%%#***%@@%=\n//                                     :=*%@@@#=.      :#@@%       *@@@%=\n//                       .-+*%@%*-.:+%@@@@@@+.     -*+:  .=#.       :%@@@%-\n//                   :=*@@@@%%@@@@@@@@@%@@@-   .=#@@@%@%=             =@@@@#.\n//             -=+#%@@%#*=:.  :%@@@@%.   -*@@#*@@@@@@@#=:-              *@@@@+\n//            =@@%=:.     :=:   *@@@@@%#-   =%*%@@@@#+-.        =+       :%@@@%-\n//           -@@%.     .+@@@     =+=-.         @@#-           +@@@%-       =@@@@%:\n//          :@@@.    .+@@#%:                   :    .=*=-::.-%@@@+*@@=       +@@@@#.\n//          %@@:    +@%%*                         =%@@@@@@@@@@@#.  .*@%-       +@@@@*.\n//         #@@=                                .+@@@@%:=*@@@@@-      :%@%:      .*@@@@+\n//        *@@*                                +@@@#-@@%-:%@@*          +@@#.      :%@@@@-\n//       -@@%           .:-=++*##%%%@@@@@@@@@@@@*. :@+.@@@%:            .#@@+       =@@@@#:\n//      .@@@*-+*#%%%@@@@@@@@@@@@@@@@%%#**@@%@@@.   *@=*@@#                :#@%=      .#@@@@#-\n//      -%@@@@@@@@@@@@@@@*+==-:-@@@=    *@# .#@*-=*@@@@%=                 -%@@@*       =@@@@@%-\n//         -+%@@@#.   %@%%=   -@@:+@: -@@*    *@@*-::                   -%@@%=.         .*@@@@@#\n//            *@@@*  +@* *@@##@@-  #@*@@+    -@@=          .         :+@@@#:           .-+@@@%+-\n//             +@@@%*@@:..=@@@@*   .@@@*   .#@#.       .=+-       .=%@@@*.         :+#@@@@*=:\n//              =@@@@%@@@@@@@@@@@@@@@@@@@@@@%-      :+#*.       :*@@@%=.       .=#@@@@%+:\n//               .%@@=                 .....    .=#@@+.       .#@@@*:       -*%@@@@%+.\n//                 +@@#+===---:::...         .=%@@*-         +@@@+.      -*@@@@@%+.\n//                  -@@@@@@@@@@@@@@@@@@@@@@%@@@@=          -@@@+      -#@@@@@#=.\n//                    ..:::---===+++***###%%%@@@#-       .#@@+     -*@@@@@#=.\n//                                           @@@@@@+.   +@@*.   .+@@@@@%=.\n//                                          -@@@@@=   =@@%:   -#@@@@%+.\n//                                          +@@@@@. =@@@=  .+@@@@@*:\n//                                          #@@@@#:%@@#. :*@@@@#-\n//                                          @@@@@%@@@= :#@@@@+.\n//                                         :@@@@@@@#.:#@@@%-\n//                                         +@@@@@@-.*@@@*:\n//                                         #@@@@#.=@@@+.\n//                                         @@@@+-%@%=\n//                                        :@@@#%@%=\n//                                        +@@@@%-\n//                                        :#%%=\n//\n/**\n *     NOTICE\n *\n *     The T-REX software is licensed under a proprietary license or the GPL v.3.\n *     If you choose to receive it under the GPL v.3 license, the following applies:\n *     T-REX is a suite of smart contracts implementing the ERC-3643 standard and\n *     developed by Tokeny to manage and transfer financial assets on EVM blockchains\n *\n *     Copyright (C) 2023, Tokeny sàrl.\n *\n *     This program is free software: you can redistribute it and/or modify\n *     it under the terms of the GNU General Public License as published by\n *     the Free Software Foundation, either version 3 of the License, or\n *     (at your option) any later version.\n *\n *     This program is distributed in the hope that it will be useful,\n *     but WITHOUT ANY WARRANTY; without even the implied warranty of\n *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *     GNU General Public License for more details.\n *\n *     You should have received a copy of the GNU General Public License\n *     along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npragma solidity 0.8.17;\n\ninterface IModularCompliance {\n\n    /// events\n\n    /**\n     *  @dev Event emitted for each executed interaction with a module contract.\n     *  For gas efficiency, only the interaction calldata selector (first 4\n     *  bytes) is included in the event. For interactions without calldata or\n     *  whose calldata is shorter than 4 bytes, the selector will be `0`.\n     */\n    event ModuleInteraction(address indexed target, bytes4 selector);\n\n    /**\n     *  this event is emitted when a token has been bound to the compliance contract\n     *  the event is emitted by the bindToken function\n     *  `_token` is the address of the token to bind\n     */\n    event TokenBound(address _token);\n\n    /**\n     *  this event is emitted when a token has been unbound from the compliance contract\n     *  the event is emitted by the unbindToken function\n     *  `_token` is the address of the token to unbind\n     */\n    event TokenUnbound(address _token);\n\n    /**\n     *  this event is emitted when a module has been added to the list of modules bound to the compliance contract\n     *  the event is emitted by the addModule function\n     *  `_module` is the address of the compliance module\n     */\n    event ModuleAdded(address indexed _module);\n\n    /**\n     *  this event is emitted when a module has been removed from the list of modules bound to the compliance contract\n     *  the event is emitted by the removeModule function\n     *  `_module` is the address of the compliance module\n     */\n    event ModuleRemoved(address indexed _module);\n\n    /// functions\n\n    /**\n     *  @dev binds a token to the compliance contract\n     *  @param _token address of the token to bind\n     *  This function can be called ONLY by the owner of the compliance contract\n     *  Emits a TokenBound event\n     */\n    function bindToken(address _token) external;\n\n    /**\n     *  @dev unbinds a token from the compliance contract\n     *  @param _token address of the token to unbind\n     *  This function can be called ONLY by the owner of the compliance contract\n     *  Emits a TokenUnbound event\n     */\n    function unbindToken(address _token) external;\n\n    /**\n     *  @dev adds a module to the list of compliance modules\n     *  @param _module address of the module to add\n     *  there cannot be more than 25 modules bound to the modular compliance for gas cost reasons\n     *  This function can be called ONLY by the owner of the compliance contract\n     *  Emits a ModuleAdded event\n     */\n    function addModule(address _module) external;\n\n    /**\n     *  @dev removes a module from the list of compliance modules\n     *  @param _module address of the module to remove\n     *  This function can be called ONLY by the owner of the compliance contract\n     *  Emits a ModuleRemoved event\n     */\n    function removeModule(address _module) external;\n\n    /**\n     *  @dev calls any function on bound modules\n     *  can be called only on bound modules\n     *  @param callData the bytecode for interaction with the module, abi encoded\n     *  @param _module The address of the module\n     *  This function can be called only by the modular compliance owner\n     *  emits a `ModuleInteraction` event\n     */\n    function callModuleFunction(bytes calldata callData, address _module) external;\n\n    /**\n     *  @dev function called whenever tokens are transferred\n     *  from one wallet to another\n     *  this function can update state variables in the modules bound to the compliance\n     *  these state variables being used by the module checks to decide if a transfer\n     *  is compliant or not depending on the values stored in these state variables and on\n     *  the parameters of the modules\n     *  This function can be called ONLY by the token contract bound to the compliance\n     *  @param _from The address of the sender\n     *  @param _to The address of the receiver\n     *  @param _amount The amount of tokens involved in the transfer\n     *  This function calls moduleTransferAction() on each module bound to the compliance contract\n     */\n    function transferred(\n        address _from,\n        address _to,\n        uint256 _amount\n    ) external;\n\n    /**\n     *  @dev function called whenever tokens are created on a wallet\n     *  this function can update state variables in the modules bound to the compliance\n     *  these state variables being used by the module checks to decide if a transfer\n     *  is compliant or not depending on the values stored in these state variables and on\n     *  the parameters of the modules\n     *  This function can be called ONLY by the token contract bound to the compliance\n     *  @param _to The address of the receiver\n     *  @param _amount The amount of tokens involved in the minting\n     *  This function calls moduleMintAction() on each module bound to the compliance contract\n     */\n    function created(address _to, uint256 _amount) external;\n\n    /**\n     *  @dev function called whenever tokens are destroyed from a wallet\n     *  this function can update state variables in the modules bound to the compliance\n     *  these state variables being used by the module checks to decide if a transfer\n     *  is compliant or not depending on the values stored in these state variables and on\n     *  the parameters of the modules\n     *  This function can be called ONLY by the token contract bound to the compliance\n     *  @param _from The address on which tokens are burnt\n     *  @param _amount The amount of tokens involved in the burn\n     *  This function calls moduleBurnAction() on each module bound to the compliance contract\n     */\n    function destroyed(address _from, uint256 _amount) external;\n\n    /**\n     *  @dev checks that the transfer is compliant.\n     *  default compliance always returns true\n     *  READ ONLY FUNCTION, this function cannot be used to increment\n     *  counters, emit events, ...\n     *  @param _from The address of the sender\n     *  @param _to The address of the receiver\n     *  @param _amount The amount of tokens involved in the transfer\n     *  This function will call moduleCheck() on every module bound to the compliance\n     *  If each of the module checks return TRUE, this function will return TRUE as well\n     *  returns FALSE otherwise\n     */\n    function canTransfer(\n        address _from,\n        address _to,\n        uint256 _amount\n    ) external view returns (bool);\n\n    /**\n     *  @dev getter for the modules bound to the compliance contract\n     *  returns address array of module contracts bound to the compliance\n     */\n    function getModules() external view returns (address[] memory);\n\n    /**\n     *  @dev getter for the address of the token bound\n     *  returns the address of the token\n     */\n    function getTokenBound() external view returns (address);\n\n    /**\n     *  @dev checks if a module is bound to the compliance contract\n     *  returns true if module is bound, false otherwise\n     */\n    function isModuleBound(address _module) external view returns (bool);\n}\n"},{"file_path":"@erc3643org/erc-3643/contracts/factory/ITREXFactory.sol","source_code":"// SPDX-License-Identifier: GPL-3.0\n//\n//                                             :+#####%%%%%%%%%%%%%%+\n//                                         .-*@@@%+.:+%@@@@@%%#***%@@%=\n//                                     :=*%@@@#=.      :#@@%       *@@@%=\n//                       .-+*%@%*-.:+%@@@@@@+.     -*+:  .=#.       :%@@@%-\n//                   :=*@@@@%%@@@@@@@@@%@@@-   .=#@@@%@%=             =@@@@#.\n//             -=+#%@@%#*=:.  :%@@@@%.   -*@@#*@@@@@@@#=:-              *@@@@+\n//            =@@%=:.     :=:   *@@@@@%#-   =%*%@@@@#+-.        =+       :%@@@%-\n//           -@@%.     .+@@@     =+=-.         @@#-           +@@@%-       =@@@@%:\n//          :@@@.    .+@@#%:                   :    .=*=-::.-%@@@+*@@=       +@@@@#.\n//          %@@:    +@%%*                         =%@@@@@@@@@@@#.  .*@%-       +@@@@*.\n//         #@@=                                .+@@@@%:=*@@@@@-      :%@%:      .*@@@@+\n//        *@@*                                +@@@#-@@%-:%@@*          +@@#.      :%@@@@-\n//       -@@%           .:-=++*##%%%@@@@@@@@@@@@*. :@+.@@@%:            .#@@+       =@@@@#:\n//      .@@@*-+*#%%%@@@@@@@@@@@@@@@@%%#**@@%@@@.   *@=*@@#                :#@%=      .#@@@@#-\n//      -%@@@@@@@@@@@@@@@*+==-:-@@@=    *@# .#@*-=*@@@@%=                 -%@@@*       =@@@@@%-\n//         -+%@@@#.   %@%%=   -@@:+@: -@@*    *@@*-::                   -%@@%=.         .*@@@@@#\n//            *@@@*  +@* *@@##@@-  #@*@@+    -@@=          .         :+@@@#:           .-+@@@%+-\n//             +@@@%*@@:..=@@@@*   .@@@*   .#@#.       .=+-       .=%@@@*.         :+#@@@@*=:\n//              =@@@@%@@@@@@@@@@@@@@@@@@@@@@%-      :+#*.       :*@@@%=.       .=#@@@@%+:\n//               .%@@=                 .....    .=#@@+.       .#@@@*:       -*%@@@@%+.\n//                 +@@#+===---:::...         .=%@@*-         +@@@+.      -*@@@@@%+.\n//                  -@@@@@@@@@@@@@@@@@@@@@@%@@@@=          -@@@+      -#@@@@@#=.\n//                    ..:::---===+++***###%%%@@@#-       .#@@+     -*@@@@@#=.\n//                                           @@@@@@+.   +@@*.   .+@@@@@%=.\n//                                          -@@@@@=   =@@%:   -#@@@@%+.\n//                                          +@@@@@. =@@@=  .+@@@@@*:\n//                                          #@@@@#:%@@#. :*@@@@#-\n//                                          @@@@@%@@@= :#@@@@+.\n//                                         :@@@@@@@#.:#@@@%-\n//                                         +@@@@@@-.*@@@*:\n//                                         #@@@@#.=@@@+.\n//                                         @@@@+-%@%=\n//                                        :@@@#%@%=\n//                                        +@@@@%-\n//                                        :#%%=\n//\n/**\n *     NOTICE\n *\n *     The T-REX software is licensed under a proprietary license or the GPL v.3.\n *     If you choose to receive it under the GPL v.3 license, the following applies:\n *     T-REX is a suite of smart contracts implementing the ERC-3643 standard and\n *     developed by Tokeny to manage and transfer financial assets on EVM blockchains\n *\n *     Copyright (C) 2023, Tokeny sàrl.\n *\n *     This program is free software: you can redistribute it and/or modify\n *     it under the terms of the GNU General Public License as published by\n *     the Free Software Foundation, either version 3 of the License, or\n *     (at your option) any later version.\n *\n *     This program is distributed in the hope that it will be useful,\n *     but WITHOUT ANY WARRANTY; without even the implied warranty of\n *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *     GNU General Public License for more details.\n *\n *     You should have received a copy of the GNU General Public License\n *     along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\npragma solidity 0.8.17;\n\ninterface ITREXFactory {\n\n    /// Types\n\n    struct TokenDetails {\n        // address of the owner of all contracts\n        address owner;\n        // name of the token\n        string name;\n        // symbol / ticker of the token\n        string symbol;\n        // decimals of the token (can be between 0 and 18)\n        uint8 decimals;\n        // identity registry storage address\n        // set it to ZERO address if you want to deploy a new storage\n        // if an address is provided, please ensure that the factory is set as owner of the contract\n        address irs;\n        // ONCHAINID of the token\n        // solhint-disable-next-line var-name-mixedcase\n        address ONCHAINID;\n        // list of agents of the identity registry (can be set to an AgentManager contract)\n        address[] irAgents;\n        // list of agents of the token\n        address[] tokenAgents;\n        // modules to bind to the compliance, indexes are corresponding to the settings callData indexes\n        // if a module doesn't require settings, it can be added at the end of the array, at index > settings.length\n        address[] complianceModules;\n        // settings calls for compliance modules\n        bytes[] complianceSettings;\n    }\n\n    struct ClaimDetails {\n        // claim topics required\n        uint256[] claimTopics;\n        // trusted issuers addresses\n        address[] issuers;\n        // claims that issuers are allowed to emit, by index, index corresponds to the `issuers` indexes\n        uint256[][] issuerClaims;\n    }\n\n    /// events\n\n    /// event emitted whenever a single contract is deployed by the factory\n    event Deployed(address indexed _addr);\n\n    /// event emitted when the Identity Factory is set\n    event IdFactorySet(address _idFactory);\n\n    /// event emitted when the implementation authority of the factory contract is set\n    event ImplementationAuthoritySet(address _implementationAuthority);\n\n    /// event emitted by the factory when a full suite of T-REX contracts is deployed\n    event TREXSuiteDeployed(address indexed _token, address _ir, address _irs, address _tir, address _ctr, address\n    _mc, string indexed _salt);\n\n    /// functions\n\n    /**\n     *  @dev setter for implementation authority contract address\n     *  the implementation authority contract contains the addresses of all implementation contracts\n     *  the proxies created by the factory will use the different implementations available\n     *  in the implementation authority contract\n     *  Only owner can call.\n     *  emits `ImplementationAuthoritySet` event\n     *  @param _implementationAuthority The address of the implementation authority smart contract\n     */\n    function setImplementationAuthority(address _implementationAuthority) external;\n\n    /**\n     *  @dev setter for identity factory contract address\n     *  the identity factory contract is used by the TREX Factory to deploy the ONCHAINID\n     *  of the token in case the ONCHAINID is not specified\n     *  Only owner can call.\n     *  emits `IdFactorySet` event\n     *  @param _idFactory The address of the identity factory contract\n     */\n    function setIdFactory(address _idFactory) external;\n\n    /**\n     *  @dev function used to deploy a new TREX token and set all the parameters as required by the issuer paperwork\n     *  this function will deploy and set the contracts as follow :\n     *  Token : deploy the token contract (proxy) and set the name, symbol, ONCHAINID, decimals, owner, agents,\n     *  IR address , Compliance address\n     *  Identity Registry : deploy the IR contract (proxy) and set the owner, agents,\n     *  IRS address, TIR address, CTR address\n     *  IRS : deploy IRS contract (proxy) if required (address set as 0 in the TokenDetails, bind IRS to IR, set owner\n     *  CTR : deploy CTR contract (proxy), set required claims, set owner\n     *  TIR : deploy TIR contract (proxy), set trusted issuers, set owner\n     *  Compliance: deploy modular compliance, bind with token, add modules, set modules parameters, set owner\n     *  All contracts are deployed using CREATE2 opcode, and therefore are deployed at a predetermined address\n     *  The address can be the same on all EVM blockchains as long as the factory address is the same as well\n     *  Only owner can call.\n     *  emits `TREXSuiteDeployed` event\n     *  @param _salt the salt used to make the contracts deployments with CREATE2\n     *  @param _tokenDetails The details of the token to deploy (see struct TokenDetails for more details)\n     *  @param _claimDetails The details of the claims and claim issuers (see struct ClaimDetails for more details)\n     *  cannot add more than 5 agents on IR and 5 agents on Token\n     *  cannot add more than 5 claim topics required and more than 5 trusted issuers\n     *  cannot add more than 30 compliance settings transactions\n     */\n    function deployTREXSuite(\n        string memory _salt,\n        TokenDetails calldata _tokenDetails,\n        ClaimDetails calldata _claimDetails) external;\n\n    /**\n     *  @dev function that can be used to recover the ownership of contracts owned by the factory\n     *  typically used for IRS contracts owned by the factory (ownership of IRS is mandatory to call bind function)\n     *  @param _contract The smart contract address\n     *  @param _newOwner The address to transfer ownership to\n     *  Only owner can call.\n     */\n    function recoverContractOwnership(address _contract, address _newOwner) external;\n\n    /**\n     *  @dev getter for implementation authority address\n     */\n    function getImplementationAuthority() external view returns(address);\n\n    /**\n     *  @dev getter for identity factory address\n     */\n    function getIdFactory() external view returns(address);\n\n    /**\n     *  @dev getter for token address corresponding to salt string\n     *  @param _salt The salt string that was used to deploy the token\n     */\n    function getToken(string calldata _salt) external view returns(address);\n}\n"},{"file_path":"@erc3643org/erc-3643/contracts/proxy/authority/IIAFactory.sol","source_code":"// SPDX-License-Identifier: GPL-3.0\n//\n//                                             :+#####%%%%%%%%%%%%%%+\n//                                         .-*@@@%+.:+%@@@@@%%#***%@@%=\n//                                     :=*%@@@#=.      :#@@%       *@@@%=\n//                       .-+*%@%*-.:+%@@@@@@+.     -*+:  .=#.       :%@@@%-\n//                   :=*@@@@%%@@@@@@@@@%@@@-   .=#@@@%@%=             =@@@@#.\n//             -=+#%@@%#*=:.  :%@@@@%.   -*@@#*@@@@@@@#=:-              *@@@@+\n//            =@@%=:.     :=:   *@@@@@%#-   =%*%@@@@#+-.        =+       :%@@@%-\n//           -@@%.     .+@@@     =+=-.         @@#-           +@@@%-       =@@@@%:\n//          :@@@.    .+@@#%:                   :    .=*=-::.-%@@@+*@@=       +@@@@#.\n//          %@@:    +@%%*                         =%@@@@@@@@@@@#.  .*@%-       +@@@@*.\n//         #@@=                                .+@@@@%:=*@@@@@-      :%@%:      .*@@@@+\n//        *@@*                                +@@@#-@@%-:%@@*          +@@#.      :%@@@@-\n//       -@@%           .:-=++*##%%%@@@@@@@@@@@@*. :@+.@@@%:            .#@@+       =@@@@#:\n//      .@@@*-+*#%%%@@@@@@@@@@@@@@@@%%#**@@%@@@.   *@=*@@#                :#@%=      .#@@@@#-\n//      -%@@@@@@@@@@@@@@@*+==-:-@@@=    *@# .#@*-=*@@@@%=                 -%@@@*       =@@@@@%-\n//         -+%@@@#.   %@%%=   -@@:+@: -@@*    *@@*-::                   -%@@%=.         .*@@@@@#\n//            *@@@*  +@* *@@##@@-  #@*@@+    -@@=          .         :+@@@#:           .-+@@@%+-\n//             +@@@%*@@:..=@@@@*   .@@@*   .#@#.       .=+-       .=%@@@*.         :+#@@@@*=:\n//              =@@@@%@@@@@@@@@@@@@@@@@@@@@@%-      :+#*.       :*@@@%=.       .=#@@@@%+:\n//               .%@@=                 .....    .=#@@+.       .#@@@*:       -*%@@@@%+.\n//                 +@@#+===---:::...         .=%@@*-         +@@@+.      -*@@@@@%+.\n//                  -@@@@@@@@@@@@@@@@@@@@@@%@@@@=          -@@@+      -#@@@@@#=.\n//                    ..:::---===+++***###%%%@@@#-       .#@@+     -*@@@@@#=.\n//                                           @@@@@@+.   +@@*.   .+@@@@@%=.\n//                                          -@@@@@=   =@@%:   -#@@@@%+.\n//                                          +@@@@@. =@@@=  .+@@@@@*:\n//                                          #@@@@#:%@@#. :*@@@@#-\n//                                          @@@@@%@@@= :#@@@@+.\n//                                         :@@@@@@@#.:#@@@%-\n//                                         +@@@@@@-.*@@@*:\n//                                         #@@@@#.=@@@+.\n//                                         @@@@+-%@%=\n//                                        :@@@#%@%=\n//                                        +@@@@%-\n//                                        :#%%=\n//\n/**\n *     NOTICE\n *\n *     The T-REX software is licensed under a proprietary license or the GPL v.3.\n *     If you choose to receive it under the GPL v.3 license, the following applies:\n *     T-REX is a suite of smart contracts implementing the ERC-3643 standard and\n *     developed by Tokeny to manage and transfer financial assets on EVM blockchains\n *\n *     Copyright (C) 2023, Tokeny sàrl.\n *\n *     This program is free software: you can redistribute it and/or modify\n *     it under the terms of the GNU General Public License as published by\n *     the Free Software Foundation, either version 3 of the License, or\n *     (at your option) any later version.\n *\n *     This program is distributed in the hope that it will be useful,\n *     but WITHOUT ANY WARRANTY; without even the implied warranty of\n *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *     GNU General Public License for more details.\n *\n *     You should have received a copy of the GNU General Public License\n *     along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npragma solidity 0.8.17;\ninterface IIAFactory {\n\n    /// events\n\n    /// event emitted when a new TREXImplementationAuthority is deployed\n    event ImplementationAuthorityDeployed(address indexed _ia);\n\n    /// functions\n\n    /**\n     *  @dev deploy a new TREXImplementationAuthority smart contract\n     *  @param _token the token for which the new IA will be used\n     *  function called by the `changeImplementationAuthority` function\n     *  can be called only by the reference TREXImplementationAuthority contract\n     *  the new contract deployed will contain all the versions from reference IA\n     *  the new contract will be set on the same version as the reference IA\n     *  ownership of the new IA is transferred to the Owner of the token\n     *  emits a `ImplementationAuthorityDeployed` event\n     *  returns the address of the IA contract deployed\n     */\n    function deployIA(address _token) external returns (address);\n\n    /**\n     *  @dev function used to know if an IA contract was deployed by the factory or not\n     *  @param _ia the address of TREXImplementationAuthority contract\n     */\n    function deployedByFactory(address _ia) external view returns (bool);\n}\n"},{"file_path":"@erc3643org/erc-3643/contracts/proxy/authority/ITREXImplementationAuthority.sol","source_code":"// SPDX-License-Identifier: GPL-3.0\n//\n//                                             :+#####%%%%%%%%%%%%%%+\n//                                         .-*@@@%+.:+%@@@@@%%#***%@@%=\n//                                     :=*%@@@#=.      :#@@%       *@@@%=\n//                       .-+*%@%*-.:+%@@@@@@+.     -*+:  .=#.       :%@@@%-\n//                   :=*@@@@%%@@@@@@@@@%@@@-   .=#@@@%@%=             =@@@@#.\n//             -=+#%@@%#*=:.  :%@@@@%.   -*@@#*@@@@@@@#=:-              *@@@@+\n//            =@@%=:.     :=:   *@@@@@%#-   =%*%@@@@#+-.        =+       :%@@@%-\n//           -@@%.     .+@@@     =+=-.         @@#-           +@@@%-       =@@@@%:\n//          :@@@.    .+@@#%:                   :    .=*=-::.-%@@@+*@@=       +@@@@#.\n//          %@@:    +@%%*                         =%@@@@@@@@@@@#.  .*@%-       +@@@@*.\n//         #@@=                                .+@@@@%:=*@@@@@-      :%@%:      .*@@@@+\n//        *@@*                                +@@@#-@@%-:%@@*          +@@#.      :%@@@@-\n//       -@@%           .:-=++*##%%%@@@@@@@@@@@@*. :@+.@@@%:            .#@@+       =@@@@#:\n//      .@@@*-+*#%%%@@@@@@@@@@@@@@@@%%#**@@%@@@.   *@=*@@#                :#@%=      .#@@@@#-\n//      -%@@@@@@@@@@@@@@@*+==-:-@@@=    *@# .#@*-=*@@@@%=                 -%@@@*       =@@@@@%-\n//         -+%@@@#.   %@%%=   -@@:+@: -@@*    *@@*-::                   -%@@%=.         .*@@@@@#\n//            *@@@*  +@* *@@##@@-  #@*@@+    -@@=          .         :+@@@#:           .-+@@@%+-\n//             +@@@%*@@:..=@@@@*   .@@@*   .#@#.       .=+-       .=%@@@*.         :+#@@@@*=:\n//              =@@@@%@@@@@@@@@@@@@@@@@@@@@@%-      :+#*.       :*@@@%=.       .=#@@@@%+:\n//               .%@@=                 .....    .=#@@+.       .#@@@*:       -*%@@@@%+.\n//                 +@@#+===---:::...         .=%@@*-         +@@@+.      -*@@@@@%+.\n//                  -@@@@@@@@@@@@@@@@@@@@@@%@@@@=          -@@@+      -#@@@@@#=.\n//                    ..:::---===+++***###%%%@@@#-       .#@@+     -*@@@@@#=.\n//                                           @@@@@@+.   +@@*.   .+@@@@@%=.\n//                                          -@@@@@=   =@@%:   -#@@@@%+.\n//                                          +@@@@@. =@@@=  .+@@@@@*:\n//                                          #@@@@#:%@@#. :*@@@@#-\n//                                          @@@@@%@@@= :#@@@@+.\n//                                         :@@@@@@@#.:#@@@%-\n//                                         +@@@@@@-.*@@@*:\n//                                         #@@@@#.=@@@+.\n//                                         @@@@+-%@%=\n//                                        :@@@#%@%=\n//                                        +@@@@%-\n//                                        :#%%=\n//\n/**\n *     NOTICE\n *\n *     The T-REX software is licensed under a proprietary license or the GPL v.3.\n *     If you choose to receive it under the GPL v.3 license, the following applies:\n *     T-REX is a suite of smart contracts implementing the ERC-3643 standard and\n *     developed by Tokeny to manage and transfer financial assets on EVM blockchains\n *\n *     Copyright (C) 2023, Tokeny sàrl.\n *\n *     This program is free software: you can redistribute it and/or modify\n *     it under the terms of the GNU General Public License as published by\n *     the Free Software Foundation, either version 3 of the License, or\n *     (at your option) any later version.\n *\n *     This program is distributed in the hope that it will be useful,\n *     but WITHOUT ANY WARRANTY; without even the implied warranty of\n *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *     GNU General Public License for more details.\n *\n *     You should have received a copy of the GNU General Public License\n *     along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npragma solidity 0.8.17;\n\ninterface ITREXImplementationAuthority {\n\n    /// types\n\n    struct TREXContracts {\n        // address of token implementation contract\n        address tokenImplementation;\n        // address of ClaimTopicsRegistry implementation contract\n        address ctrImplementation;\n        // address of IdentityRegistry implementation contract\n        address irImplementation;\n        // address of IdentityRegistryStorage implementation contract\n        address irsImplementation;\n        // address of TrustedIssuersRegistry implementation contract\n        address tirImplementation;\n        // address of ModularCompliance implementation contract\n        address mcImplementation;\n    }\n\n    struct Version {\n        // major version\n        uint8 major;\n        // minor version\n        uint8 minor;\n        // patch version\n        uint8 patch;\n    }\n\n    /// events\n\n    /// event emitted when a new TREX version is added to the contract memory\n    event TREXVersionAdded(Version indexed version, TREXContracts indexed trex);\n\n    /// event emitted when a new TREX version is fetched from reference contract by auxiliary contract\n    event TREXVersionFetched(Version indexed version, TREXContracts indexed trex);\n\n    /// event emitted when the current version is updated\n    event VersionUpdated(Version indexed version);\n\n    /// event emitted by the constructor when the IA is deployed\n    event ImplementationAuthoritySet(bool referenceStatus, address trexFactory);\n\n    /// event emitted when the TREX factory address is set\n    event TREXFactorySet(address indexed trexFactory);\n\n    /// event emitted when the IA factory address is set\n    event IAFactorySet(address indexed iaFactory);\n\n    /// event emitted when a token issuer decides to change current IA for a new one\n    event ImplementationAuthorityChanged(address indexed _token, address indexed _newImplementationAuthority);\n\n    /// functions\n\n    /**\n     *  @dev allows to fetch a TREX version available on the reference contract\n     *  can be called only from auxiliary contracts, not on reference (main) contract\n     *  throws if the version was already fetched\n     *  adds the new version on the local storage\n     *  allowing the update of contracts through the `useTREXVersion` afterwards\n     */\n    function fetchVersion(Version calldata _version) external;\n\n    /**\n     *  @dev setter for _trexFactory variable\n     *  _trexFactory is set at deployment for auxiliary contracts\n     *  for main contract it must be set post-deployment as main IA is\n     *  deployed before the TREXFactory.\n     *  @param trexFactory the address of TREXFactory contract\n     *  emits a TREXFactorySet event\n     *  only Owner can call\n     *  can be called only on main contract, auxiliary contracts cannot call\n     */\n    function setTREXFactory(address trexFactory) external;\n\n    /**\n     *  @dev setter for _iaFactory variable\n     *  _iaFactory is set at zero address for auxiliary contracts\n     *  for main contract it can be set post-deployment or at deployment\n     *  in the constructor\n     *  @param iaFactory the address of IAFactory contract\n     *  emits a IAFactorySet event\n     *  only Owner can call\n     *  can be called only on main contract, auxiliary contracts cannot call\n     */\n    function setIAFactory(address iaFactory) external;\n\n    /**\n     *  @dev adds a new Version of TREXContracts to the mapping\n     *  only callable on the reference contract\n     *  only Owner can call this function\n     *  @param _version the new version to add to the mapping\n     *  @param _trex the list of contracts corresponding to the new version\n     *  _trex cannot contain zero addresses\n     *  emits a `TREXVersionAdded` event\n     */\n    function addTREXVersion(Version calldata _version, TREXContracts calldata _trex) external;\n\n    /**\n     *  @dev updates the current version in use by the proxies\n     *  variation of the `useTREXVersion` allowing to use a new version\n     *  this function calls in a single transaction the `addTREXVersion`\n     *  and the `useTREXVersion` using an existing version\n     *  @param _version the version to use\n     *  @param _trex the set of contracts corresponding to the version\n     *  only Owner can call (check performed in addTREXVersion)\n     *  only reference contract can call (check performed in addTREXVersion)\n     *  emits a `TREXVersionAdded`event\n     *  emits a `VersionUpdated` event\n     */\n    function addAndUseTREXVersion(Version calldata _version, TREXContracts calldata _trex) external;\n\n    /**\n     *  @dev updates the current version in use by the proxies\n     *  @param _version the version to use\n     *  reverts if _version is already used or if version does not exist\n     *  only Owner can call\n     *  emits a `VersionUpdated` event\n     */\n    function useTREXVersion(Version calldata _version) external;\n\n    /**\n     *  @dev change the implementationAuthority address of all proxy contracts linked to a given token\n     *  only the owner of all proxy contracts can call this function\n     *  @param _token the address of the token proxy\n     *  @param _newImplementationAuthority the address of the new IA contract\n     *  caller has to be owner of all contracts linked to the token and impacted by the change\n     *  Set _newImplementationAuthority on zero address to deploy a new IA contract\n     *  New IA contracts can only be deployed ONCE per token and only if current IA is the main IA\n     *  if _newImplementationAuthority is not a new contract it must be using the same version\n     *  as the current IA contract.\n     *  calls `setImplementationAuthority` on all proxies linked to the token\n     *  emits a `ImplementationAuthorityChanged` event\n     */\n    function changeImplementationAuthority(address _token, address _newImplementationAuthority) external;\n\n    /**\n     *  @dev getter function returning the current version of contracts used by proxies\n     */\n    function getCurrentVersion() external view returns (Version memory);\n\n    /**\n     *  @dev getter function returning the contracts corresponding to a version\n     *  @param _version the version that contracts are requested for\n     */\n    function getContracts(Version calldata _version) external view returns (TREXContracts memory);\n\n    /**\n     *  @dev getter function returning address of reference TREX factory\n     */\n    function getTREXFactory() external view returns (address);\n\n    /**\n     *  @dev getter function returning address of token contract implementation\n     *  currently used by the proxies using this TREXImplementationAuthority\n     */\n    function getTokenImplementation() external view returns (address);\n\n    /**\n     *  @dev getter function returning address of ClaimTopicsRegistry contract implementation\n     *  currently used by the proxies using this TREXImplementationAuthority\n     */\n    function getCTRImplementation() external view returns (address);\n\n    /**\n     *  @dev getter function returning address of IdentityRegistry contract implementation\n     *  currently used by the proxies using this TREXImplementationAuthority\n     */\n    function getIRImplementation() external view returns (address);\n\n    /**\n     *  @dev getter function returning address of IdentityRegistryStorage contract implementation\n     *  currently used by the proxies using this TREXImplementationAuthority\n     */\n    function getIRSImplementation() external view returns (address);\n\n    /**\n     *  @dev getter function returning address of TrustedIssuersRegistry contract implementation\n     *  currently used by the proxies using this TREXImplementationAuthority\n     */\n    function getTIRImplementation() external view returns (address);\n\n    /**\n     *  @dev getter function returning address of ModularCompliance contract implementation\n     *  currently used by the proxies using this TREXImplementationAuthority\n     */\n    function getMCImplementation() external view returns (address);\n\n    /**\n     *  @dev returns true if the contract is the main contract\n     *  returns false if the contract is an auxiliary contract\n     */\n    function isReferenceContract() external view returns (bool);\n\n    /**\n     *  @dev getter for reference contract address\n     */\n    function getReferenceContract() external view returns (address);\n}"},{"file_path":"@erc3643org/erc-3643/contracts/proxy/interface/IProxy.sol","source_code":"// SPDX-License-Identifier: GPL-3.0\n//\n//                                             :+#####%%%%%%%%%%%%%%+\n//                                         .-*@@@%+.:+%@@@@@%%#***%@@%=\n//                                     :=*%@@@#=.      :#@@%       *@@@%=\n//                       .-+*%@%*-.:+%@@@@@@+.     -*+:  .=#.       :%@@@%-\n//                   :=*@@@@%%@@@@@@@@@%@@@-   .=#@@@%@%=             =@@@@#.\n//             -=+#%@@%#*=:.  :%@@@@%.   -*@@#*@@@@@@@#=:-              *@@@@+\n//            =@@%=:.     :=:   *@@@@@%#-   =%*%@@@@#+-.        =+       :%@@@%-\n//           -@@%.     .+@@@     =+=-.         @@#-           +@@@%-       =@@@@%:\n//          :@@@.    .+@@#%:                   :    .=*=-::.-%@@@+*@@=       +@@@@#.\n//          %@@:    +@%%*                         =%@@@@@@@@@@@#.  .*@%-       +@@@@*.\n//         #@@=                                .+@@@@%:=*@@@@@-      :%@%:      .*@@@@+\n//        *@@*                                +@@@#-@@%-:%@@*          +@@#.      :%@@@@-\n//       -@@%           .:-=++*##%%%@@@@@@@@@@@@*. :@+.@@@%:            .#@@+       =@@@@#:\n//      .@@@*-+*#%%%@@@@@@@@@@@@@@@@%%#**@@%@@@.   *@=*@@#                :#@%=      .#@@@@#-\n//      -%@@@@@@@@@@@@@@@*+==-:-@@@=    *@# .#@*-=*@@@@%=                 -%@@@*       =@@@@@%-\n//         -+%@@@#.   %@%%=   -@@:+@: -@@*    *@@*-::                   -%@@%=.         .*@@@@@#\n//            *@@@*  +@* *@@##@@-  #@*@@+    -@@=          .         :+@@@#:           .-+@@@%+-\n//             +@@@%*@@:..=@@@@*   .@@@*   .#@#.       .=+-       .=%@@@*.         :+#@@@@*=:\n//              =@@@@%@@@@@@@@@@@@@@@@@@@@@@%-      :+#*.       :*@@@%=.       .=#@@@@%+:\n//               .%@@=                 .....    .=#@@+.       .#@@@*:       -*%@@@@%+.\n//                 +@@#+===---:::...         .=%@@*-         +@@@+.      -*@@@@@%+.\n//                  -@@@@@@@@@@@@@@@@@@@@@@%@@@@=          -@@@+      -#@@@@@#=.\n//                    ..:::---===+++***###%%%@@@#-       .#@@+     -*@@@@@#=.\n//                                           @@@@@@+.   +@@*.   .+@@@@@%=.\n//                                          -@@@@@=   =@@%:   -#@@@@%+.\n//                                          +@@@@@. =@@@=  .+@@@@@*:\n//                                          #@@@@#:%@@#. :*@@@@#-\n//                                          @@@@@%@@@= :#@@@@+.\n//                                         :@@@@@@@#.:#@@@%-\n//                                         +@@@@@@-.*@@@*:\n//                                         #@@@@#.=@@@+.\n//                                         @@@@+-%@%=\n//                                        :@@@#%@%=\n//                                        +@@@@%-\n//                                        :#%%=\n//\n/**\n *     NOTICE\n *\n *     The T-REX software is licensed under a proprietary license or the GPL v.3.\n *     If you choose to receive it under the GPL v.3 license, the following applies:\n *     T-REX is a suite of smart contracts implementing the ERC-3643 standard and\n *     developed by Tokeny to manage and transfer financial assets on EVM blockchains\n *\n *     Copyright (C) 2023, Tokeny sàrl.\n *\n *     This program is free software: you can redistribute it and/or modify\n *     it under the terms of the GNU General Public License as published by\n *     the Free Software Foundation, either version 3 of the License, or\n *     (at your option) any later version.\n *\n *     This program is distributed in the hope that it will be useful,\n *     but WITHOUT ANY WARRANTY; without even the implied warranty of\n *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *     GNU General Public License for more details.\n *\n *     You should have received a copy of the GNU General Public License\n *     along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npragma solidity 0.8.17;\n\ninterface IProxy {\n\n    /// events\n\n    event ImplementationAuthoritySet(address indexed _implementationAuthority);\n\n    /// functions\n\n    function setImplementationAuthority(address _newImplementationAuthority) external;\n\n    function getImplementationAuthority() external view returns(address);\n}\n"},{"file_path":"@erc3643org/erc-3643/contracts/registry/interface/IClaimTopicsRegistry.sol","source_code":"// SPDX-License-Identifier: GPL-3.0\n//\n//                                             :+#####%%%%%%%%%%%%%%+\n//                                         .-*@@@%+.:+%@@@@@%%#***%@@%=\n//                                     :=*%@@@#=.      :#@@%       *@@@%=\n//                       .-+*%@%*-.:+%@@@@@@+.     -*+:  .=#.       :%@@@%-\n//                   :=*@@@@%%@@@@@@@@@%@@@-   .=#@@@%@%=             =@@@@#.\n//             -=+#%@@%#*=:.  :%@@@@%.   -*@@#*@@@@@@@#=:-              *@@@@+\n//            =@@%=:.     :=:   *@@@@@%#-   =%*%@@@@#+-.        =+       :%@@@%-\n//           -@@%.     .+@@@     =+=-.         @@#-           +@@@%-       =@@@@%:\n//          :@@@.    .+@@#%:                   :    .=*=-::.-%@@@+*@@=       +@@@@#.\n//          %@@:    +@%%*                         =%@@@@@@@@@@@#.  .*@%-       +@@@@*.\n//         #@@=                                .+@@@@%:=*@@@@@-      :%@%:      .*@@@@+\n//        *@@*                                +@@@#-@@%-:%@@*          +@@#.      :%@@@@-\n//       -@@%           .:-=++*##%%%@@@@@@@@@@@@*. :@+.@@@%:            .#@@+       =@@@@#:\n//      .@@@*-+*#%%%@@@@@@@@@@@@@@@@%%#**@@%@@@.   *@=*@@#                :#@%=      .#@@@@#-\n//      -%@@@@@@@@@@@@@@@*+==-:-@@@=    *@# .#@*-=*@@@@%=                 -%@@@*       =@@@@@%-\n//         -+%@@@#.   %@%%=   -@@:+@: -@@*    *@@*-::                   -%@@%=.         .*@@@@@#\n//            *@@@*  +@* *@@##@@-  #@*@@+    -@@=          .         :+@@@#:           .-+@@@%+-\n//             +@@@%*@@:..=@@@@*   .@@@*   .#@#.       .=+-       .=%@@@*.         :+#@@@@*=:\n//              =@@@@%@@@@@@@@@@@@@@@@@@@@@@%-      :+#*.       :*@@@%=.       .=#@@@@%+:\n//               .%@@=                 .....    .=#@@+.       .#@@@*:       -*%@@@@%+.\n//                 +@@#+===---:::...         .=%@@*-         +@@@+.      -*@@@@@%+.\n//                  -@@@@@@@@@@@@@@@@@@@@@@%@@@@=          -@@@+      -#@@@@@#=.\n//                    ..:::---===+++***###%%%@@@#-       .#@@+     -*@@@@@#=.\n//                                           @@@@@@+.   +@@*.   .+@@@@@%=.\n//                                          -@@@@@=   =@@%:   -#@@@@%+.\n//                                          +@@@@@. =@@@=  .+@@@@@*:\n//                                          #@@@@#:%@@#. :*@@@@#-\n//                                          @@@@@%@@@= :#@@@@+.\n//                                         :@@@@@@@#.:#@@@%-\n//                                         +@@@@@@-.*@@@*:\n//                                         #@@@@#.=@@@+.\n//                                         @@@@+-%@%=\n//                                        :@@@#%@%=\n//                                        +@@@@%-\n//                                        :#%%=\n//\n/**\n *     NOTICE\n *\n *     The T-REX software is licensed under a proprietary license or the GPL v.3.\n *     If you choose to receive it under the GPL v.3 license, the following applies:\n *     T-REX is a suite of smart contracts implementing the ERC-3643 standard and\n *     developed by Tokeny to manage and transfer financial assets on EVM blockchains\n *\n *     Copyright (C) 2023, Tokeny sàrl.\n *\n *     This program is free software: you can redistribute it and/or modify\n *     it under the terms of the GNU General Public License as published by\n *     the Free Software Foundation, either version 3 of the License, or\n *     (at your option) any later version.\n *\n *     This program is distributed in the hope that it will be useful,\n *     but WITHOUT ANY WARRANTY; without even the implied warranty of\n *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *     GNU General Public License for more details.\n *\n *     You should have received a copy of the GNU General Public License\n *     along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npragma solidity 0.8.17;\n\ninterface IClaimTopicsRegistry {\n    /**\n     *  this event is emitted when a claim topic has been added to the ClaimTopicsRegistry\n     *  the event is emitted by the 'addClaimTopic' function\n     *  `claimTopic` is the required claim added to the Claim Topics Registry\n     */\n    event ClaimTopicAdded(uint256 indexed claimTopic);\n\n    /**\n     *  this event is emitted when a claim topic has been removed from the ClaimTopicsRegistry\n     *  the event is emitted by the 'removeClaimTopic' function\n     *  `claimTopic` is the required claim removed from the Claim Topics Registry\n     */\n    event ClaimTopicRemoved(uint256 indexed claimTopic);\n\n    /**\n     * @dev Add a trusted claim topic (For example: KYC=1, AML=2).\n     * Only owner can call.\n     * emits `ClaimTopicAdded` event\n     * cannot add more than 15 topics for 1 token as adding more could create gas issues\n     * @param _claimTopic The claim topic index\n     */\n    function addClaimTopic(uint256 _claimTopic) external;\n\n    /**\n     *  @dev Remove a trusted claim topic (For example: KYC=1, AML=2).\n     *  Only owner can call.\n     *  emits `ClaimTopicRemoved` event\n     *  @param _claimTopic The claim topic index\n     */\n    function removeClaimTopic(uint256 _claimTopic) external;\n\n    /**\n     *  @dev Get the trusted claim topics for the security token\n     *  @return Array of trusted claim topics\n     */\n    function getClaimTopics() external view returns (uint256[] memory);\n}\n"},{"file_path":"@erc3643org/erc-3643/contracts/registry/interface/IIdentityRegistry.sol","source_code":"// SPDX-License-Identifier: GPL-3.0\n//\n//                                             :+#####%%%%%%%%%%%%%%+\n//                                         .-*@@@%+.:+%@@@@@%%#***%@@%=\n//                                     :=*%@@@#=.      :#@@%       *@@@%=\n//                       .-+*%@%*-.:+%@@@@@@+.     -*+:  .=#.       :%@@@%-\n//                   :=*@@@@%%@@@@@@@@@%@@@-   .=#@@@%@%=             =@@@@#.\n//             -=+#%@@%#*=:.  :%@@@@%.   -*@@#*@@@@@@@#=:-              *@@@@+\n//            =@@%=:.     :=:   *@@@@@%#-   =%*%@@@@#+-.        =+       :%@@@%-\n//           -@@%.     .+@@@     =+=-.         @@#-           +@@@%-       =@@@@%:\n//          :@@@.    .+@@#%:                   :    .=*=-::.-%@@@+*@@=       +@@@@#.\n//          %@@:    +@%%*                         =%@@@@@@@@@@@#.  .*@%-       +@@@@*.\n//         #@@=                                .+@@@@%:=*@@@@@-      :%@%:      .*@@@@+\n//        *@@*                                +@@@#-@@%-:%@@*          +@@#.      :%@@@@-\n//       -@@%           .:-=++*##%%%@@@@@@@@@@@@*. :@+.@@@%:            .#@@+       =@@@@#:\n//      .@@@*-+*#%%%@@@@@@@@@@@@@@@@%%#**@@%@@@.   *@=*@@#                :#@%=      .#@@@@#-\n//      -%@@@@@@@@@@@@@@@*+==-:-@@@=    *@# .#@*-=*@@@@%=                 -%@@@*       =@@@@@%-\n//         -+%@@@#.   %@%%=   -@@:+@: -@@*    *@@*-::                   -%@@%=.         .*@@@@@#\n//            *@@@*  +@* *@@##@@-  #@*@@+    -@@=          .         :+@@@#:           .-+@@@%+-\n//             +@@@%*@@:..=@@@@*   .@@@*   .#@#.       .=+-       .=%@@@*.         :+#@@@@*=:\n//              =@@@@%@@@@@@@@@@@@@@@@@@@@@@%-      :+#*.       :*@@@%=.       .=#@@@@%+:\n//               .%@@=                 .....    .=#@@+.       .#@@@*:       -*%@@@@%+.\n//                 +@@#+===---:::...         .=%@@*-         +@@@+.      -*@@@@@%+.\n//                  -@@@@@@@@@@@@@@@@@@@@@@%@@@@=          -@@@+      -#@@@@@#=.\n//                    ..:::---===+++***###%%%@@@#-       .#@@+     -*@@@@@#=.\n//                                           @@@@@@+.   +@@*.   .+@@@@@%=.\n//                                          -@@@@@=   =@@%:   -#@@@@%+.\n//                                          +@@@@@. =@@@=  .+@@@@@*:\n//                                          #@@@@#:%@@#. :*@@@@#-\n//                                          @@@@@%@@@= :#@@@@+.\n//                                         :@@@@@@@#.:#@@@%-\n//                                         +@@@@@@-.*@@@*:\n//                                         #@@@@#.=@@@+.\n//                                         @@@@+-%@%=\n//                                        :@@@#%@%=\n//                                        +@@@@%-\n//                                        :#%%=\n//\n/**\n *     NOTICE\n *\n *     The T-REX software is licensed under a proprietary license or the GPL v.3.\n *     If you choose to receive it under the GPL v.3 license, the following applies:\n *     T-REX is a suite of smart contracts implementing the ERC-3643 standard and\n *     developed by Tokeny to manage and transfer financial assets on EVM blockchains\n *\n *     Copyright (C) 2023, Tokeny sàrl.\n *\n *     This program is free software: you can redistribute it and/or modify\n *     it under the terms of the GNU General Public License as published by\n *     the Free Software Foundation, either version 3 of the License, or\n *     (at your option) any later version.\n *\n *     This program is distributed in the hope that it will be useful,\n *     but WITHOUT ANY WARRANTY; without even the implied warranty of\n *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *     GNU General Public License for more details.\n *\n *     You should have received a copy of the GNU General Public License\n *     along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npragma solidity 0.8.17;\n\nimport \"./ITrustedIssuersRegistry.sol\";\nimport \"./IClaimTopicsRegistry.sol\";\nimport \"./IIdentityRegistryStorage.sol\";\n\nimport \"@onchain-id/solidity/contracts/interface/IClaimIssuer.sol\";\nimport \"@onchain-id/solidity/contracts/interface/IIdentity.sol\";\n\ninterface IIdentityRegistry {\n    /**\n     *  this event is emitted when the ClaimTopicsRegistry has been set for the IdentityRegistry\n     *  the event is emitted by the IdentityRegistry constructor\n     *  `claimTopicsRegistry` is the address of the Claim Topics Registry contract\n     */\n    event ClaimTopicsRegistrySet(address indexed claimTopicsRegistry);\n\n    /**\n     *  this event is emitted when the IdentityRegistryStorage has been set for the IdentityRegistry\n     *  the event is emitted by the IdentityRegistry constructor\n     *  `identityStorage` is the address of the Identity Registry Storage contract\n     */\n    event IdentityStorageSet(address indexed identityStorage);\n\n    /**\n     *  this event is emitted when the TrustedIssuersRegistry has been set for the IdentityRegistry\n     *  the event is emitted by the IdentityRegistry constructor\n     *  `trustedIssuersRegistry` is the address of the Trusted Issuers Registry contract\n     */\n    event TrustedIssuersRegistrySet(address indexed trustedIssuersRegistry);\n\n    /**\n     *  this event is emitted when an Identity is registered into the Identity Registry.\n     *  the event is emitted by the 'registerIdentity' function\n     *  `investorAddress` is the address of the investor's wallet\n     *  `identity` is the address of the Identity smart contract (onchainID)\n     */\n    event IdentityRegistered(address indexed investorAddress, IIdentity indexed identity);\n\n    /**\n     *  this event is emitted when an Identity is removed from the Identity Registry.\n     *  the event is emitted by the 'deleteIdentity' function\n     *  `investorAddress` is the address of the investor's wallet\n     *  `identity` is the address of the Identity smart contract (onchainID)\n     */\n    event IdentityRemoved(address indexed investorAddress, IIdentity indexed identity);\n\n    /**\n     *  this event is emitted when an Identity has been updated\n     *  the event is emitted by the 'updateIdentity' function\n     *  `oldIdentity` is the old Identity contract's address to update\n     *  `newIdentity` is the new Identity contract's\n     */\n    event IdentityUpdated(IIdentity indexed oldIdentity, IIdentity indexed newIdentity);\n\n    /**\n     *  this event is emitted when an Identity's country has been updated\n     *  the event is emitted by the 'updateCountry' function\n     *  `investorAddress` is the address on which the country has been updated\n     *  `country` is the numeric code (ISO 3166-1) of the new country\n     */\n    event CountryUpdated(address indexed investorAddress, uint16 indexed country);\n\n    /**\n     *  @dev Register an identity contract corresponding to a user address.\n     *  Requires that the user doesn't have an identity contract already registered.\n     *  This function can only be called by a wallet set as agent of the smart contract\n     *  @param _userAddress The address of the user\n     *  @param _identity The address of the user's identity contract\n     *  @param _country The country of the investor\n     *  emits `IdentityRegistered` event\n     */\n    function registerIdentity(\n        address _userAddress,\n        IIdentity _identity,\n        uint16 _country\n    ) external;\n\n    /**\n     *  @dev Removes an user from the identity registry.\n     *  Requires that the user have an identity contract already deployed that will be deleted.\n     *  This function can only be called by a wallet set as agent of the smart contract\n     *  @param _userAddress The address of the user to be removed\n     *  emits `IdentityRemoved` event\n     */\n    function deleteIdentity(address _userAddress) external;\n\n    /**\n     *  @dev Replace the actual identityRegistryStorage contract with a new one.\n     *  This function can only be called by the wallet set as owner of the smart contract\n     *  @param _identityRegistryStorage The address of the new Identity Registry Storage\n     *  emits `IdentityStorageSet` event\n     */\n    function setIdentityRegistryStorage(address _identityRegistryStorage) external;\n\n    /**\n     *  @dev Replace the actual claimTopicsRegistry contract with a new one.\n     *  This function can only be called by the wallet set as owner of the smart contract\n     *  @param _claimTopicsRegistry The address of the new claim Topics Registry\n     *  emits `ClaimTopicsRegistrySet` event\n     */\n    function setClaimTopicsRegistry(address _claimTopicsRegistry) external;\n\n    /**\n     *  @dev Replace the actual trustedIssuersRegistry contract with a new one.\n     *  This function can only be called by the wallet set as owner of the smart contract\n     *  @param _trustedIssuersRegistry The address of the new Trusted Issuers Registry\n     *  emits `TrustedIssuersRegistrySet` event\n     */\n    function setTrustedIssuersRegistry(address _trustedIssuersRegistry) external;\n\n    /**\n     *  @dev Updates the country corresponding to a user address.\n     *  Requires that the user should have an identity contract already deployed that will be replaced.\n     *  This function can only be called by a wallet set as agent of the smart contract\n     *  @param _userAddress The address of the user\n     *  @param _country The new country of the user\n     *  emits `CountryUpdated` event\n     */\n    function updateCountry(address _userAddress, uint16 _country) external;\n\n    /**\n     *  @dev Updates an identity contract corresponding to a user address.\n     *  Requires that the user address should be the owner of the identity contract.\n     *  Requires that the user should have an identity contract already deployed that will be replaced.\n     *  This function can only be called by a wallet set as agent of the smart contract\n     *  @param _userAddress The address of the user\n     *  @param _identity The address of the user's new identity contract\n     *  emits `IdentityUpdated` event\n     */\n    function updateIdentity(address _userAddress, IIdentity _identity) external;\n\n    /**\n     *  @dev function allowing to register identities in batch\n     *  This function can only be called by a wallet set as agent of the smart contract\n     *  Requires that none of the users has an identity contract already registered.\n     *  IMPORTANT : THIS TRANSACTION COULD EXCEED GAS LIMIT IF `_userAddresses.length` IS TOO HIGH,\n     *  USE WITH CARE OR YOU COULD LOSE TX FEES WITH AN \"OUT OF GAS\" TRANSACTION\n     *  @param _userAddresses The addresses of the users\n     *  @param _identities The addresses of the corresponding identity contracts\n     *  @param _countries The countries of the corresponding investors\n     *  emits _userAddresses.length `IdentityRegistered` events\n     */\n    function batchRegisterIdentity(\n        address[] calldata _userAddresses,\n        IIdentity[] calldata _identities,\n        uint16[] calldata _countries\n    ) external;\n\n    /**\n     *  @dev This functions checks whether a wallet has its Identity registered or not\n     *  in the Identity Registry.\n     *  @param _userAddress The address of the user to be checked.\n     *  @return 'True' if the address is contained in the Identity Registry, 'false' if not.\n     */\n    function contains(address _userAddress) external view returns (bool);\n\n    /**\n     *  @dev This functions checks whether an identity contract\n     *  corresponding to the provided user address has the required claims or not based\n     *  on the data fetched from trusted issuers registry and from the claim topics registry\n     *  @param _userAddress The address of the user to be verified.\n     *  @return 'True' if the address is verified, 'false' if not.\n     */\n    function isVerified(address _userAddress) external view returns (bool);\n\n    /**\n     *  @dev Returns the onchainID of an investor.\n     *  @param _userAddress The wallet of the investor\n     */\n    function identity(address _userAddress) external view returns (IIdentity);\n\n    /**\n     *  @dev Returns the country code of an investor.\n     *  @param _userAddress The wallet of the investor\n     */\n    function investorCountry(address _userAddress) external view returns (uint16);\n\n    /**\n     *  @dev Returns the IdentityRegistryStorage linked to the current IdentityRegistry.\n     */\n    function identityStorage() external view returns (IIdentityRegistryStorage);\n\n    /**\n     *  @dev Returns the TrustedIssuersRegistry linked to the current IdentityRegistry.\n     */\n    function issuersRegistry() external view returns (ITrustedIssuersRegistry);\n\n    /**\n     *  @dev Returns the ClaimTopicsRegistry linked to the current IdentityRegistry.\n     */\n    function topicsRegistry() external view returns (IClaimTopicsRegistry);\n}\n"},{"file_path":"@erc3643org/erc-3643/contracts/registry/interface/IIdentityRegistryStorage.sol","source_code":"// SPDX-License-Identifier: GPL-3.0\n//\n//                                             :+#####%%%%%%%%%%%%%%+\n//                                         .-*@@@%+.:+%@@@@@%%#***%@@%=\n//                                     :=*%@@@#=.      :#@@%       *@@@%=\n//                       .-+*%@%*-.:+%@@@@@@+.     -*+:  .=#.       :%@@@%-\n//                   :=*@@@@%%@@@@@@@@@%@@@-   .=#@@@%@%=             =@@@@#.\n//             -=+#%@@%#*=:.  :%@@@@%.   -*@@#*@@@@@@@#=:-              *@@@@+\n//            =@@%=:.     :=:   *@@@@@%#-   =%*%@@@@#+-.        =+       :%@@@%-\n//           -@@%.     .+@@@     =+=-.         @@#-           +@@@%-       =@@@@%:\n//          :@@@.    .+@@#%:                   :    .=*=-::.-%@@@+*@@=       +@@@@#.\n//          %@@:    +@%%*                         =%@@@@@@@@@@@#.  .*@%-       +@@@@*.\n//         #@@=                                .+@@@@%:=*@@@@@-      :%@%:      .*@@@@+\n//        *@@*                                +@@@#-@@%-:%@@*          +@@#.      :%@@@@-\n//       -@@%           .:-=++*##%%%@@@@@@@@@@@@*. :@+.@@@%:            .#@@+       =@@@@#:\n//      .@@@*-+*#%%%@@@@@@@@@@@@@@@@%%#**@@%@@@.   *@=*@@#                :#@%=      .#@@@@#-\n//      -%@@@@@@@@@@@@@@@*+==-:-@@@=    *@# .#@*-=*@@@@%=                 -%@@@*       =@@@@@%-\n//         -+%@@@#.   %@%%=   -@@:+@: -@@*    *@@*-::                   -%@@%=.         .*@@@@@#\n//            *@@@*  +@* *@@##@@-  #@*@@+    -@@=          .         :+@@@#:           .-+@@@%+-\n//             +@@@%*@@:..=@@@@*   .@@@*   .#@#.       .=+-       .=%@@@*.         :+#@@@@*=:\n//              =@@@@%@@@@@@@@@@@@@@@@@@@@@@%-      :+#*.       :*@@@%=.       .=#@@@@%+:\n//               .%@@=                 .....    .=#@@+.       .#@@@*:       -*%@@@@%+.\n//                 +@@#+===---:::...         .=%@@*-         +@@@+.      -*@@@@@%+.\n//                  -@@@@@@@@@@@@@@@@@@@@@@%@@@@=          -@@@+      -#@@@@@#=.\n//                    ..:::---===+++***###%%%@@@#-       .#@@+     -*@@@@@#=.\n//                                           @@@@@@+.   +@@*.   .+@@@@@%=.\n//                                          -@@@@@=   =@@%:   -#@@@@%+.\n//                                          +@@@@@. =@@@=  .+@@@@@*:\n//                                          #@@@@#:%@@#. :*@@@@#-\n//                                          @@@@@%@@@= :#@@@@+.\n//                                         :@@@@@@@#.:#@@@%-\n//                                         +@@@@@@-.*@@@*:\n//                                         #@@@@#.=@@@+.\n//                                         @@@@+-%@%=\n//                                        :@@@#%@%=\n//                                        +@@@@%-\n//                                        :#%%=\n//\n/**\n *     NOTICE\n *\n *     The T-REX software is licensed under a proprietary license or the GPL v.3.\n *     If you choose to receive it under the GPL v.3 license, the following applies:\n *     T-REX is a suite of smart contracts implementing the ERC-3643 standard and\n *     developed by Tokeny to manage and transfer financial assets on EVM blockchains\n *\n *     Copyright (C) 2023, Tokeny sàrl.\n *\n *     This program is free software: you can redistribute it and/or modify\n *     it under the terms of the GNU General Public License as published by\n *     the Free Software Foundation, either version 3 of the License, or\n *     (at your option) any later version.\n *\n *     This program is distributed in the hope that it will be useful,\n *     but WITHOUT ANY WARRANTY; without even the implied warranty of\n *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *     GNU General Public License for more details.\n *\n *     You should have received a copy of the GNU General Public License\n *     along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npragma solidity 0.8.17;\n\nimport \"@onchain-id/solidity/contracts/interface/IIdentity.sol\";\n\ninterface IIdentityRegistryStorage {\n\n    /// events\n\n    /**\n     *  this event is emitted when an Identity is registered into the storage contract.\n     *  the event is emitted by the 'registerIdentity' function\n     *  `investorAddress` is the address of the investor's wallet\n     *  `identity` is the address of the Identity smart contract (onchainID)\n     */\n    event IdentityStored(address indexed investorAddress, IIdentity indexed identity);\n\n    /**\n     *  this event is emitted when an Identity is removed from the storage contract.\n     *  the event is emitted by the 'deleteIdentity' function\n     *  `investorAddress` is the address of the investor's wallet\n     *  `identity` is the address of the Identity smart contract (onchainID)\n     */\n    event IdentityUnstored(address indexed investorAddress, IIdentity indexed identity);\n\n    /**\n     *  this event is emitted when an Identity has been updated\n     *  the event is emitted by the 'updateIdentity' function\n     *  `oldIdentity` is the old Identity contract's address to update\n     *  `newIdentity` is the new Identity contract's\n     */\n    event IdentityModified(IIdentity indexed oldIdentity, IIdentity indexed newIdentity);\n\n    /**\n     *  this event is emitted when an Identity's country has been updated\n     *  the event is emitted by the 'updateCountry' function\n     *  `investorAddress` is the address on which the country has been updated\n     *  `country` is the numeric code (ISO 3166-1) of the new country\n     */\n    event CountryModified(address indexed investorAddress, uint16 indexed country);\n\n    /**\n     *  this event is emitted when an Identity Registry is bound to the storage contract\n     *  the event is emitted by the 'addIdentityRegistry' function\n     *  `identityRegistry` is the address of the identity registry added\n     */\n    event IdentityRegistryBound(address indexed identityRegistry);\n\n    /**\n     *  this event is emitted when an Identity Registry is unbound from the storage contract\n     *  the event is emitted by the 'removeIdentityRegistry' function\n     *  `identityRegistry` is the address of the identity registry removed\n     */\n    event IdentityRegistryUnbound(address indexed identityRegistry);\n\n    /// functions\n\n    /**\n     *  @dev adds an identity contract corresponding to a user address in the storage.\n     *  Requires that the user doesn't have an identity contract already registered.\n     *  This function can only be called by an address set as agent of the smart contract\n     *  @param _userAddress The address of the user\n     *  @param _identity The address of the user's identity contract\n     *  @param _country The country of the investor\n     *  emits `IdentityStored` event\n     */\n    function addIdentityToStorage(\n        address _userAddress,\n        IIdentity _identity,\n        uint16 _country\n    ) external;\n\n    /**\n     *  @dev Removes an user from the storage.\n     *  Requires that the user have an identity contract already deployed that will be deleted.\n     *  This function can only be called by an address set as agent of the smart contract\n     *  @param _userAddress The address of the user to be removed\n     *  emits `IdentityUnstored` event\n     */\n    function removeIdentityFromStorage(address _userAddress) external;\n\n    /**\n     *  @dev Updates the country corresponding to a user address.\n     *  Requires that the user should have an identity contract already deployed that will be replaced.\n     *  This function can only be called by an address set as agent of the smart contract\n     *  @param _userAddress The address of the user\n     *  @param _country The new country of the user\n     *  emits `CountryModified` event\n     */\n    function modifyStoredInvestorCountry(address _userAddress, uint16 _country) external;\n\n    /**\n     *  @dev Updates an identity contract corresponding to a user address.\n     *  Requires that the user address should be the owner of the identity contract.\n     *  Requires that the user should have an identity contract already deployed that will be replaced.\n     *  This function can only be called by an address set as agent of the smart contract\n     *  @param _userAddress The address of the user\n     *  @param _identity The address of the user's new identity contract\n     *  emits `IdentityModified` event\n     */\n    function modifyStoredIdentity(address _userAddress, IIdentity _identity) external;\n\n    /**\n     *  @notice Adds an identity registry as agent of the Identity Registry Storage Contract.\n     *  This function can only be called by the wallet set as owner of the smart contract\n     *  This function adds the identity registry to the list of identityRegistries linked to the storage contract\n     *  cannot bind more than 300 IR to 1 IRS\n     *  @param _identityRegistry The identity registry address to add.\n     */\n    function bindIdentityRegistry(address _identityRegistry) external;\n\n    /**\n     *  @notice Removes an identity registry from being agent of the Identity Registry Storage Contract.\n     *  This function can only be called by the wallet set as owner of the smart contract\n     *  This function removes the identity registry from the list of identityRegistries linked to the storage contract\n     *  @param _identityRegistry The identity registry address to remove.\n     */\n    function unbindIdentityRegistry(address _identityRegistry) external;\n\n    /**\n     *  @dev Returns the identity registries linked to the storage contract\n     */\n    function linkedIdentityRegistries() external view returns (address[] memory);\n\n    /**\n     *  @dev Returns the onchainID of an investor.\n     *  @param _userAddress The wallet of the investor\n     */\n    function storedIdentity(address _userAddress) external view returns (IIdentity);\n\n    /**\n     *  @dev Returns the country code of an investor.\n     *  @param _userAddress The wallet of the investor\n     */\n    function storedInvestorCountry(address _userAddress) external view returns (uint16);\n}\n"},{"file_path":"@erc3643org/erc-3643/contracts/registry/interface/ITrustedIssuersRegistry.sol","source_code":"// SPDX-License-Identifier: GPL-3.0\n//\n//                                             :+#####%%%%%%%%%%%%%%+\n//                                         .-*@@@%+.:+%@@@@@%%#***%@@%=\n//                                     :=*%@@@#=.      :#@@%       *@@@%=\n//                       .-+*%@%*-.:+%@@@@@@+.     -*+:  .=#.       :%@@@%-\n//                   :=*@@@@%%@@@@@@@@@%@@@-   .=#@@@%@%=             =@@@@#.\n//             -=+#%@@%#*=:.  :%@@@@%.   -*@@#*@@@@@@@#=:-              *@@@@+\n//            =@@%=:.     :=:   *@@@@@%#-   =%*%@@@@#+-.        =+       :%@@@%-\n//           -@@%.     .+@@@     =+=-.         @@#-           +@@@%-       =@@@@%:\n//          :@@@.    .+@@#%:                   :    .=*=-::.-%@@@+*@@=       +@@@@#.\n//          %@@:    +@%%*                         =%@@@@@@@@@@@#.  .*@%-       +@@@@*.\n//         #@@=                                .+@@@@%:=*@@@@@-      :%@%:      .*@@@@+\n//        *@@*                                +@@@#-@@%-:%@@*          +@@#.      :%@@@@-\n//       -@@%           .:-=++*##%%%@@@@@@@@@@@@*. :@+.@@@%:            .#@@+       =@@@@#:\n//      .@@@*-+*#%%%@@@@@@@@@@@@@@@@%%#**@@%@@@.   *@=*@@#                :#@%=      .#@@@@#-\n//      -%@@@@@@@@@@@@@@@*+==-:-@@@=    *@# .#@*-=*@@@@%=                 -%@@@*       =@@@@@%-\n//         -+%@@@#.   %@%%=   -@@:+@: -@@*    *@@*-::                   -%@@%=.         .*@@@@@#\n//            *@@@*  +@* *@@##@@-  #@*@@+    -@@=          .         :+@@@#:           .-+@@@%+-\n//             +@@@%*@@:..=@@@@*   .@@@*   .#@#.       .=+-       .=%@@@*.         :+#@@@@*=:\n//              =@@@@%@@@@@@@@@@@@@@@@@@@@@@%-      :+#*.       :*@@@%=.       .=#@@@@%+:\n//               .%@@=                 .....    .=#@@+.       .#@@@*:       -*%@@@@%+.\n//                 +@@#+===---:::...         .=%@@*-         +@@@+.      -*@@@@@%+.\n//                  -@@@@@@@@@@@@@@@@@@@@@@%@@@@=          -@@@+      -#@@@@@#=.\n//                    ..:::---===+++***###%%%@@@#-       .#@@+     -*@@@@@#=.\n//                                           @@@@@@+.   +@@*.   .+@@@@@%=.\n//                                          -@@@@@=   =@@%:   -#@@@@%+.\n//                                          +@@@@@. =@@@=  .+@@@@@*:\n//                                          #@@@@#:%@@#. :*@@@@#-\n//                                          @@@@@%@@@= :#@@@@+.\n//                                         :@@@@@@@#.:#@@@%-\n//                                         +@@@@@@-.*@@@*:\n//                                         #@@@@#.=@@@+.\n//                                         @@@@+-%@%=\n//                                        :@@@#%@%=\n//                                        +@@@@%-\n//                                        :#%%=\n//\n\n/**\n *     NOTICE\n *\n *     The T-REX software is licensed under a proprietary license or the GPL v.3.\n *     If you choose to receive it under the GPL v.3 license, the following applies:\n *     T-REX is a suite of smart contracts implementing the ERC-3643 standard and\n *     developed by Tokeny to manage and transfer financial assets on EVM blockchains\n *\n *     Copyright (C) 2023, Tokeny sàrl.\n *\n *     This program is free software: you can redistribute it and/or modify\n *     it under the terms of the GNU General Public License as published by\n *     the Free Software Foundation, either version 3 of the License, or\n *     (at your option) any later version.\n *\n *     This program is distributed in the hope that it will be useful,\n *     but WITHOUT ANY WARRANTY; without even the implied warranty of\n *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *     GNU General Public License for more details.\n *\n *     You should have received a copy of the GNU General Public License\n *     along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npragma solidity 0.8.17;\n\nimport \"@onchain-id/solidity/contracts/interface/IClaimIssuer.sol\";\n\ninterface ITrustedIssuersRegistry {\n    /**\n     *  this event is emitted when a trusted issuer is added in the registry.\n     *  the event is emitted by the addTrustedIssuer function\n     *  `trustedIssuer` is the address of the trusted issuer's ClaimIssuer contract\n     *  `claimTopics` is the set of claims that the trusted issuer is allowed to emit\n     */\n    event TrustedIssuerAdded(IClaimIssuer indexed trustedIssuer, uint256[] claimTopics);\n\n    /**\n     *  this event is emitted when a trusted issuer is removed from the registry.\n     *  the event is emitted by the removeTrustedIssuer function\n     *  `trustedIssuer` is the address of the trusted issuer's ClaimIssuer contract\n     */\n    event TrustedIssuerRemoved(IClaimIssuer indexed trustedIssuer);\n\n    /**\n     *  this event is emitted when the set of claim topics is changed for a given trusted issuer.\n     *  the event is emitted by the updateIssuerClaimTopics function\n     *  `trustedIssuer` is the address of the trusted issuer's ClaimIssuer contract\n     *  `claimTopics` is the set of claims that the trusted issuer is allowed to emit\n     */\n    event ClaimTopicsUpdated(IClaimIssuer indexed trustedIssuer, uint256[] claimTopics);\n\n    /**\n     *  @dev registers a ClaimIssuer contract as trusted claim issuer.\n     *  Requires that a ClaimIssuer contract doesn't already exist\n     *  Requires that the claimTopics set is not empty\n     *  Requires that there is no more than 15 claimTopics\n     *  Requires that there is no more than 50 Trusted issuers\n     *  @param _trustedIssuer The ClaimIssuer contract address of the trusted claim issuer.\n     *  @param _claimTopics the set of claim topics that the trusted issuer is allowed to emit\n     *  This function can only be called by the owner of the Trusted Issuers Registry contract\n     *  emits a `TrustedIssuerAdded` event\n     */\n    function addTrustedIssuer(IClaimIssuer _trustedIssuer, uint256[] calldata _claimTopics) external;\n\n    /**\n     *  @dev Removes the ClaimIssuer contract of a trusted claim issuer.\n     *  Requires that the claim issuer contract to be registered first\n     *  @param _trustedIssuer the claim issuer to remove.\n     *  This function can only be called by the owner of the Trusted Issuers Registry contract\n     *  emits a `TrustedIssuerRemoved` event\n     */\n    function removeTrustedIssuer(IClaimIssuer _trustedIssuer) external;\n\n    /**\n     *  @dev Updates the set of claim topics that a trusted issuer is allowed to emit.\n     *  Requires that this ClaimIssuer contract already exists in the registry\n     *  Requires that the provided claimTopics set is not empty\n     *  Requires that there is no more than 15 claimTopics\n     *  @param _trustedIssuer the claim issuer to update.\n     *  @param _claimTopics the set of claim topics that the trusted issuer is allowed to emit\n     *  This function can only be called by the owner of the Trusted Issuers Registry contract\n     *  emits a `ClaimTopicsUpdated` event\n     */\n    function updateIssuerClaimTopics(IClaimIssuer _trustedIssuer, uint256[] calldata _claimTopics) external;\n\n    /**\n     *  @dev Function for getting all the trusted claim issuers stored.\n     *  @return array of all claim issuers registered.\n     */\n    function getTrustedIssuers() external view returns (IClaimIssuer[] memory);\n\n    /**\n     *  @dev Function for getting all the trusted issuer allowed for a given claim topic.\n     *  @param claimTopic the claim topic to get the trusted issuers for.\n     *  @return array of all claim issuer addresses that are allowed for the given claim topic.\n     */\n    function getTrustedIssuersForClaimTopic(uint256 claimTopic) external view returns (IClaimIssuer[] memory);\n\n    /**\n     *  @dev Checks if the ClaimIssuer contract is trusted\n     *  @param _issuer the address of the ClaimIssuer contract\n     *  @return true if the issuer is trusted, false otherwise.\n     */\n    function isTrustedIssuer(address _issuer) external view returns (bool);\n\n    /**\n     *  @dev Function for getting all the claim topic of trusted claim issuer\n     *  Requires the provided ClaimIssuer contract to be registered in the trusted issuers registry.\n     *  @param _trustedIssuer the trusted issuer concerned.\n     *  @return The set of claim topics that the trusted issuer is allowed to emit\n     */\n    function getTrustedIssuerClaimTopics(IClaimIssuer _trustedIssuer) external view returns (uint256[] memory);\n\n    /**\n     *  @dev Function for checking if the trusted claim issuer is allowed\n     *  to emit a certain claim topic\n     *  @param _issuer the address of the trusted issuer's ClaimIssuer contract\n     *  @param _claimTopic the Claim Topic that has to be checked to know if the `issuer` is allowed to emit it\n     *  @return true if the issuer is trusted for this claim topic.\n     */\n    function hasClaimTopic(address _issuer, uint256 _claimTopic) external view returns (bool);\n}\n"},{"file_path":"@erc3643org/erc-3643/contracts/token/IToken.sol","source_code":"// SPDX-License-Identifier: GPL-3.0\n//\n//                                             :+#####%%%%%%%%%%%%%%+\n//                                         .-*@@@%+.:+%@@@@@%%#***%@@%=\n//                                     :=*%@@@#=.      :#@@%       *@@@%=\n//                       .-+*%@%*-.:+%@@@@@@+.     -*+:  .=#.       :%@@@%-\n//                   :=*@@@@%%@@@@@@@@@%@@@-   .=#@@@%@%=             =@@@@#.\n//             -=+#%@@%#*=:.  :%@@@@%.   -*@@#*@@@@@@@#=:-              *@@@@+\n//            =@@%=:.     :=:   *@@@@@%#-   =%*%@@@@#+-.        =+       :%@@@%-\n//           -@@%.     .+@@@     =+=-.         @@#-           +@@@%-       =@@@@%:\n//          :@@@.    .+@@#%:                   :    .=*=-::.-%@@@+*@@=       +@@@@#.\n//          %@@:    +@%%*                         =%@@@@@@@@@@@#.  .*@%-       +@@@@*.\n//         #@@=                                .+@@@@%:=*@@@@@-      :%@%:      .*@@@@+\n//        *@@*                                +@@@#-@@%-:%@@*          +@@#.      :%@@@@-\n//       -@@%           .:-=++*##%%%@@@@@@@@@@@@*. :@+.@@@%:            .#@@+       =@@@@#:\n//      .@@@*-+*#%%%@@@@@@@@@@@@@@@@%%#**@@%@@@.   *@=*@@#                :#@%=      .#@@@@#-\n//      -%@@@@@@@@@@@@@@@*+==-:-@@@=    *@# .#@*-=*@@@@%=                 -%@@@*       =@@@@@%-\n//         -+%@@@#.   %@%%=   -@@:+@: -@@*    *@@*-::                   -%@@%=.         .*@@@@@#\n//            *@@@*  +@* *@@##@@-  #@*@@+    -@@=          .         :+@@@#:           .-+@@@%+-\n//             +@@@%*@@:..=@@@@*   .@@@*   .#@#.       .=+-       .=%@@@*.         :+#@@@@*=:\n//              =@@@@%@@@@@@@@@@@@@@@@@@@@@@%-      :+#*.       :*@@@%=.       .=#@@@@%+:\n//               .%@@=                 .....    .=#@@+.       .#@@@*:       -*%@@@@%+.\n//                 +@@#+===---:::...         .=%@@*-         +@@@+.      -*@@@@@%+.\n//                  -@@@@@@@@@@@@@@@@@@@@@@%@@@@=          -@@@+      -#@@@@@#=.\n//                    ..:::---===+++***###%%%@@@#-       .#@@+     -*@@@@@#=.\n//                                           @@@@@@+.   +@@*.   .+@@@@@%=.\n//                                          -@@@@@=   =@@%:   -#@@@@%+.\n//                                          +@@@@@. =@@@=  .+@@@@@*:\n//                                          #@@@@#:%@@#. :*@@@@#-\n//                                          @@@@@%@@@= :#@@@@+.\n//                                         :@@@@@@@#.:#@@@%-\n//                                         +@@@@@@-.*@@@*:\n//                                         #@@@@#.=@@@+.\n//                                         @@@@+-%@%=\n//                                        :@@@#%@%=\n//                                        +@@@@%-\n//                                        :#%%=\n//\n\n/**\n *     NOTICE\n *\n *     The T-REX software is licensed under a proprietary license or the GPL v.3.\n *     If you choose to receive it under the GPL v.3 license, the following applies:\n *     T-REX is a suite of smart contracts implementing the ERC-3643 standard and\n *     developed by Tokeny to manage and transfer financial assets on EVM blockchains\n *\n *     Copyright (C) 2023, Tokeny sàrl.\n *\n *     This program is free software: you can redistribute it and/or modify\n *     it under the terms of the GNU General Public License as published by\n *     the Free Software Foundation, either version 3 of the License, or\n *     (at your option) any later version.\n *\n *     This program is distributed in the hope that it will be useful,\n *     but WITHOUT ANY WARRANTY; without even the implied warranty of\n *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *     GNU General Public License for more details.\n *\n *     You should have received a copy of the GNU General Public License\n *     along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npragma solidity 0.8.17;\n\nimport \"../registry/interface/IIdentityRegistry.sol\";\nimport \"../compliance/modular/IModularCompliance.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/// @dev interface\ninterface IToken is IERC20 {\n\n    /// events\n\n    /**\n     *  this event is emitted when the token information is updated.\n     *  the event is emitted by the token init function and by the setTokenInformation function\n     *  `_newName` is the name of the token\n     *  `_newSymbol` is the symbol of the token\n     *  `_newDecimals` is the decimals of the token\n     *  `_newVersion` is the version of the token, current version is 3.0\n     *  `_newOnchainID` is the address of the onchainID of the token\n     */\n    event UpdatedTokenInformation(string indexed _newName, string indexed _newSymbol, uint8 _newDecimals, string\n    _newVersion, address indexed _newOnchainID);\n\n    /**\n     *  this event is emitted when the IdentityRegistry has been set for the token\n     *  the event is emitted by the token constructor and by the setIdentityRegistry function\n     *  `_identityRegistry` is the address of the Identity Registry of the token\n     */\n    event IdentityRegistryAdded(address indexed _identityRegistry);\n\n    /**\n     *  this event is emitted when the Compliance has been set for the token\n     *  the event is emitted by the token constructor and by the setCompliance function\n     *  `_compliance` is the address of the Compliance contract of the token\n     */\n    event ComplianceAdded(address indexed _compliance);\n\n    /**\n     *  this event is emitted when an investor successfully recovers his tokens\n     *  the event is emitted by the recoveryAddress function\n     *  `_lostWallet` is the address of the wallet that the investor lost access to\n     *  `_newWallet` is the address of the wallet that the investor provided for the recovery\n     *  `_investorOnchainID` is the address of the onchainID of the investor who asked for a recovery\n     */\n    event RecoverySuccess(address indexed _lostWallet, address indexed _newWallet, address indexed _investorOnchainID);\n\n    /**\n     *  this event is emitted when the wallet of an investor is frozen or unfrozen\n     *  the event is emitted by setAddressFrozen and batchSetAddressFrozen functions\n     *  `_userAddress` is the wallet of the investor that is concerned by the freezing status\n     *  `_isFrozen` is the freezing status of the wallet\n     *  if `_isFrozen` equals `true` the wallet is frozen after emission of the event\n     *  if `_isFrozen` equals `false` the wallet is unfrozen after emission of the event\n     *  `_owner` is the address of the agent who called the function to freeze the wallet\n     */\n    event AddressFrozen(address indexed _userAddress, bool indexed _isFrozen, address indexed _owner);\n\n    /**\n     *  this event is emitted when a certain amount of tokens is frozen on a wallet\n     *  the event is emitted by freezePartialTokens and batchFreezePartialTokens functions\n     *  `_userAddress` is the wallet of the investor that is concerned by the freezing status\n     *  `_amount` is the amount of tokens that are frozen\n     */\n    event TokensFrozen(address indexed _userAddress, uint256 _amount);\n\n    /**\n     *  this event is emitted when a certain amount of tokens is unfrozen on a wallet\n     *  the event is emitted by unfreezePartialTokens and batchUnfreezePartialTokens functions\n     *  `_userAddress` is the wallet of the investor that is concerned by the freezing status\n     *  `_amount` is the amount of tokens that are unfrozen\n     */\n    event TokensUnfrozen(address indexed _userAddress, uint256 _amount);\n\n    /**\n     *  this event is emitted when the token is paused\n     *  the event is emitted by the pause function\n     *  `_userAddress` is the address of the wallet that called the pause function\n     */\n    event Paused(address _userAddress);\n\n    /**\n     *  this event is emitted when the token is unpaused\n     *  the event is emitted by the unpause function\n     *  `_userAddress` is the address of the wallet that called the unpause function\n     */\n    event Unpaused(address _userAddress);\n\n    /// functions\n\n    /**\n     *  @dev sets the token name\n     *  @param _name the name of token to set\n     *  Only the owner of the token smart contract can call this function\n     *  emits a `UpdatedTokenInformation` event\n     */\n    function setName(string calldata _name) external;\n\n    /**\n     *  @dev sets the token symbol\n     *  @param _symbol the token symbol to set\n     *  Only the owner of the token smart contract can call this function\n     *  emits a `UpdatedTokenInformation` event\n     */\n    function setSymbol(string calldata _symbol) external;\n\n    /**\n     *  @dev sets the onchain ID of the token\n     *  @param _onchainID the address of the onchain ID to set\n     *  Only the owner of the token smart contract can call this function\n     *  emits a `UpdatedTokenInformation` event\n     */\n    function setOnchainID(address _onchainID) external;\n\n    /**\n     *  @dev pauses the token contract, when contract is paused investors cannot transfer tokens anymore\n     *  This function can only be called by a wallet set as agent of the token\n     *  emits a `Paused` event\n     */\n    function pause() external;\n\n    /**\n     *  @dev unpauses the token contract, when contract is unpaused investors can transfer tokens\n     *  if their wallet is not blocked & if the amount to transfer is <= to the amount of free tokens\n     *  This function can only be called by a wallet set as agent of the token\n     *  emits an `Unpaused` event\n     */\n    function unpause() external;\n\n    /**\n     *  @dev sets an address frozen status for this token.\n     *  @param _userAddress The address for which to update frozen status\n     *  @param _freeze Frozen status of the address\n     *  This function can only be called by a wallet set as agent of the token\n     *  emits an `AddressFrozen` event\n     */\n    function setAddressFrozen(address _userAddress, bool _freeze) external;\n\n    /**\n     *  @dev freezes token amount specified for given address.\n     *  @param _userAddress The address for which to update frozen tokens\n     *  @param _amount Amount of Tokens to be frozen\n     *  This function can only be called by a wallet set as agent of the token\n     *  emits a `TokensFrozen` event\n     */\n    function freezePartialTokens(address _userAddress, uint256 _amount) external;\n\n    /**\n     *  @dev unfreezes token amount specified for given address\n     *  @param _userAddress The address for which to update frozen tokens\n     *  @param _amount Amount of Tokens to be unfrozen\n     *  This function can only be called by a wallet set as agent of the token\n     *  emits a `TokensUnfrozen` event\n     */\n    function unfreezePartialTokens(address _userAddress, uint256 _amount) external;\n\n    /**\n     *  @dev sets the Identity Registry for the token\n     *  @param _identityRegistry the address of the Identity Registry to set\n     *  Only the owner of the token smart contract can call this function\n     *  emits an `IdentityRegistryAdded` event\n     */\n    function setIdentityRegistry(address _identityRegistry) external;\n\n    /**\n     *  @dev sets the compliance contract of the token\n     *  @param _compliance the address of the compliance contract to set\n     *  Only the owner of the token smart contract can call this function\n     *  calls bindToken on the compliance contract\n     *  emits a `ComplianceAdded` event\n     */\n    function setCompliance(address _compliance) external;\n\n    /**\n     *  @dev force a transfer of tokens between 2 whitelisted wallets\n     *  In case the `from` address has not enough free tokens (unfrozen tokens)\n     *  but has a total balance higher or equal to the `amount`\n     *  the amount of frozen tokens is reduced in order to have enough free tokens\n     *  to proceed the transfer, in such a case, the remaining balance on the `from`\n     *  account is 100% composed of frozen tokens post-transfer.\n     *  Require that the `to` address is a verified address,\n     *  @param _from The address of the sender\n     *  @param _to The address of the receiver\n     *  @param _amount The number of tokens to transfer\n     *  @return `true` if successful and revert if unsuccessful\n     *  This function can only be called by a wallet set as agent of the token\n     *  emits a `TokensUnfrozen` event if `_amount` is higher than the free balance of `_from`\n     *  emits a `Transfer` event\n     */\n    function forcedTransfer(\n        address _from,\n        address _to,\n        uint256 _amount\n    ) external returns (bool);\n\n    /**\n     *  @dev mint tokens on a wallet\n     *  Improved version of default mint method. Tokens can be minted\n     *  to an address if only it is a verified address as per the security token.\n     *  @param _to Address to mint the tokens to.\n     *  @param _amount Amount of tokens to mint.\n     *  This function can only be called by a wallet set as agent of the token\n     *  emits a `Transfer` event\n     */\n    function mint(address _to, uint256 _amount) external;\n\n    /**\n     *  @dev burn tokens on a wallet\n     *  In case the `account` address has not enough free tokens (unfrozen tokens)\n     *  but has a total balance higher or equal to the `value` amount\n     *  the amount of frozen tokens is reduced in order to have enough free tokens\n     *  to proceed the burn, in such a case, the remaining balance on the `account`\n     *  is 100% composed of frozen tokens post-transaction.\n     *  @param _userAddress Address to burn the tokens from.\n     *  @param _amount Amount of tokens to burn.\n     *  This function can only be called by a wallet set as agent of the token\n     *  emits a `TokensUnfrozen` event if `_amount` is higher than the free balance of `_userAddress`\n     *  emits a `Transfer` event\n     */\n    function burn(address _userAddress, uint256 _amount) external;\n\n    /**\n     *  @dev recovery function used to force transfer tokens from a\n     *  lost wallet to a new wallet for an investor.\n     *  @param _lostWallet the wallet that the investor lost\n     *  @param _newWallet the newly provided wallet on which tokens have to be transferred\n     *  @param _investorOnchainID the onchainID of the investor asking for a recovery\n     *  This function can only be called by a wallet set as agent of the token\n     *  emits a `TokensUnfrozen` event if there is some frozen tokens on the lost wallet if the recovery process is successful\n     *  emits a `Transfer` event if the recovery process is successful\n     *  emits a `RecoverySuccess` event if the recovery process is successful\n     *  emits a `RecoveryFails` event if the recovery process fails\n     */\n    function recoveryAddress(\n        address _lostWallet,\n        address _newWallet,\n        address _investorOnchainID\n    ) external returns (bool);\n\n    /**\n     *  @dev function allowing to issue transfers in batch\n     *  Require that the msg.sender and `to` addresses are not frozen.\n     *  Require that the total value should not exceed available balance.\n     *  Require that the `to` addresses are all verified addresses,\n     *  IMPORTANT : THIS TRANSACTION COULD EXCEED GAS LIMIT IF `_toList.length` IS TOO HIGH,\n     *  USE WITH CARE OR YOU COULD LOSE TX FEES WITH AN \"OUT OF GAS\" TRANSACTION\n     *  @param _toList The addresses of the receivers\n     *  @param _amounts The number of tokens to transfer to the corresponding receiver\n     *  emits _toList.length `Transfer` events\n     */\n    function batchTransfer(address[] calldata _toList, uint256[] calldata _amounts) external;\n\n    /**\n     *  @dev function allowing to issue forced transfers in batch\n     *  Require that `_amounts[i]` should not exceed available balance of `_fromList[i]`.\n     *  Require that the `_toList` addresses are all verified addresses\n     *  IMPORTANT : THIS TRANSACTION COULD EXCEED GAS LIMIT IF `_fromList.length` IS TOO HIGH,\n     *  USE WITH CARE OR YOU COULD LOSE TX FEES WITH AN \"OUT OF GAS\" TRANSACTION\n     *  @param _fromList The addresses of the senders\n     *  @param _toList The addresses of the receivers\n     *  @param _amounts The number of tokens to transfer to the corresponding receiver\n     *  This function can only be called by a wallet set as agent of the token\n     *  emits `TokensUnfrozen` events if `_amounts[i]` is higher than the free balance of `_fromList[i]`\n     *  emits _fromList.length `Transfer` events\n     */\n    function batchForcedTransfer(\n        address[] calldata _fromList,\n        address[] calldata _toList,\n        uint256[] calldata _amounts\n    ) external;\n\n    /**\n     *  @dev function allowing to mint tokens in batch\n     *  Require that the `_toList` addresses are all verified addresses\n     *  IMPORTANT : THIS TRANSACTION COULD EXCEED GAS LIMIT IF `_toList.length` IS TOO HIGH,\n     *  USE WITH CARE OR YOU COULD LOSE TX FEES WITH AN \"OUT OF GAS\" TRANSACTION\n     *  @param _toList The addresses of the receivers\n     *  @param _amounts The number of tokens to mint to the corresponding receiver\n     *  This function can only be called by a wallet set as agent of the token\n     *  emits _toList.length `Transfer` events\n     */\n    function batchMint(address[] calldata _toList, uint256[] calldata _amounts) external;\n\n    /**\n     *  @dev function allowing to burn tokens in batch\n     *  Require that the `_userAddresses` addresses are all verified addresses\n     *  IMPORTANT : THIS TRANSACTION COULD EXCEED GAS LIMIT IF `_userAddresses.length` IS TOO HIGH,\n     *  USE WITH CARE OR YOU COULD LOSE TX FEES WITH AN \"OUT OF GAS\" TRANSACTION\n     *  @param _userAddresses The addresses of the wallets concerned by the burn\n     *  @param _amounts The number of tokens to burn from the corresponding wallets\n     *  This function can only be called by a wallet set as agent of the token\n     *  emits _userAddresses.length `Transfer` events\n     */\n    function batchBurn(address[] calldata _userAddresses, uint256[] calldata _amounts) external;\n\n    /**\n     *  @dev function allowing to set frozen addresses in batch\n     *  IMPORTANT : THIS TRANSACTION COULD EXCEED GAS LIMIT IF `_userAddresses.length` IS TOO HIGH,\n     *  USE WITH CARE OR YOU COULD LOSE TX FEES WITH AN \"OUT OF GAS\" TRANSACTION\n     *  @param _userAddresses The addresses for which to update frozen status\n     *  @param _freeze Frozen status of the corresponding address\n     *  This function can only be called by a wallet set as agent of the token\n     *  emits _userAddresses.length `AddressFrozen` events\n     */\n    function batchSetAddressFrozen(address[] calldata _userAddresses, bool[] calldata _freeze) external;\n\n    /**\n     *  @dev function allowing to freeze tokens partially in batch\n     *  IMPORTANT : THIS TRANSACTION COULD EXCEED GAS LIMIT IF `_userAddresses.length` IS TOO HIGH,\n     *  USE WITH CARE OR YOU COULD LOSE TX FEES WITH AN \"OUT OF GAS\" TRANSACTION\n     *  @param _userAddresses The addresses on which tokens need to be frozen\n     *  @param _amounts the amount of tokens to freeze on the corresponding address\n     *  This function can only be called by a wallet set as agent of the token\n     *  emits _userAddresses.length `TokensFrozen` events\n     */\n    function batchFreezePartialTokens(address[] calldata _userAddresses, uint256[] calldata _amounts) external;\n\n    /**\n     *  @dev function allowing to unfreeze tokens partially in batch\n     *  IMPORTANT : THIS TRANSACTION COULD EXCEED GAS LIMIT IF `_userAddresses.length` IS TOO HIGH,\n     *  USE WITH CARE OR YOU COULD LOSE TX FEES WITH AN \"OUT OF GAS\" TRANSACTION\n     *  @param _userAddresses The addresses on which tokens need to be unfrozen\n     *  @param _amounts the amount of tokens to unfreeze on the corresponding address\n     *  This function can only be called by a wallet set as agent of the token\n     *  emits _userAddresses.length `TokensUnfrozen` events\n     */\n    function batchUnfreezePartialTokens(address[] calldata _userAddresses, uint256[] calldata _amounts) external;\n\n    /**\n     * @dev Returns the number of decimals used to get its user representation.\n     * For example, if `decimals` equals `2`, a balance of `505` tokens should\n     * be displayed to a user as `5,05` (`505 / 1 ** 2`).\n     *\n     * Tokens usually opt for a value of 18, imitating the relationship between\n     * Ether and Wei.\n     *\n     * NOTE: This information is only used for _display_ purposes: it in\n     * no way affects any of the arithmetic of the contract, including\n     * balanceOf() and transfer().\n     */\n    function decimals() external view returns (uint8);\n\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the address of the onchainID of the token.\n     * the onchainID of the token gives all the information available\n     * about the token and is managed by the token issuer or his agent.\n     */\n    function onchainID() external view returns (address);\n\n    /**\n     * @dev Returns the symbol of the token, usually a shorter version of the\n     * name.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the TREX version of the token.\n     * current version is 3.0.0\n     */\n    function version() external view returns (string memory);\n\n    /**\n     *  @dev Returns the Identity Registry linked to the token\n     */\n    function identityRegistry() external view returns (IIdentityRegistry);\n\n    /**\n     *  @dev Returns the Compliance contract linked to the token\n     */\n    function compliance() external view returns (IModularCompliance);\n\n    /**\n     * @dev Returns true if the contract is paused, and false otherwise.\n     */\n    function paused() external view returns (bool);\n\n    /**\n     *  @dev Returns the freezing status of a wallet\n     *  if isFrozen returns `true` the wallet is frozen\n     *  if isFrozen returns `false` the wallet is not frozen\n     *  isFrozen returning `true` doesn't mean that the balance is free, tokens could be blocked by\n     *  a partial freeze or the whole token could be blocked by pause\n     *  @param _userAddress the address of the wallet on which isFrozen is called\n     */\n    function isFrozen(address _userAddress) external view returns (bool);\n\n    /**\n     *  @dev Returns the amount of tokens that are partially frozen on a wallet\n     *  the amount of frozen tokens is always <= to the total balance of the wallet\n     *  @param _userAddress the address of the wallet on which getFrozenTokens is called\n     */\n    function getFrozenTokens(address _userAddress) external view returns (uint256);\n}\n"},{"file_path":"@openzeppelin/contracts/utils/Context.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n\n    function _contextSuffixLength() internal view virtual returns (uint256) {\n        return 0;\n    }\n}\n"},{"file_path":"@onchain-id/solidity/contracts/interface/IClaimIssuer.sol","source_code":"// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.17;\n\nimport \"./IIdentity.sol\";\n\ninterface IClaimIssuer is IIdentity {\n\n    /**\n     * @dev Emitted when a claim is revoked.\n     *\n     * Specification: MUST be triggered when revoking a claim.\n     */\n    event ClaimRevoked(bytes indexed signature);\n\n    /**\n     * @dev Revoke a claim previously issued, the claim is no longer considered as valid after revocation.\n     * @notice will fetch the claim from the identity contract (unsafe).\n     * @param _claimId the id of the claim\n     * @param _identity the address of the identity contract\n     * @return isRevoked true when the claim is revoked\n     */\n    function revokeClaim(bytes32 _claimId, address _identity) external returns(bool);\n\n    /**\n     * @dev Revoke a claim previously issued, the claim is no longer considered as valid after revocation.\n     * @param signature the signature of the claim\n     */\n    function revokeClaimBySignature(bytes calldata signature) external;\n\n    /**\n     * @dev Returns revocation status of a claim.\n     * @param _sig the signature of the claim\n     * @return isRevoked true if the claim is revoked and false otherwise\n     */\n    function isClaimRevoked(bytes calldata _sig) external view returns (bool);\n\n    /**\n     * @dev Checks if a claim is valid.\n     * @param _identity the identity contract related to the claim\n     * @param claimTopic the claim topic of the claim\n     * @param sig the signature of the claim\n     * @param data the data field of the claim\n     * @return claimValid true if the claim is valid, false otherwise\n     */\n    function isClaimValid(\n        IIdentity _identity,\n        uint256 claimTopic,\n        bytes calldata sig,\n        bytes calldata data)\n    external view returns (bool);\n}\n"},{"file_path":"@onchain-id/solidity/contracts/interface/IERC734.sol","source_code":"// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.17;\n\n/**\n * @dev interface of the ERC734 (Key Holder) standard as defined in the EIP.\n */\ninterface IERC734 {\n\n    /**\n     * @dev Emitted when an execution request was approved.\n     *\n     * Specification: MUST be triggered when approve was successfully called.\n     */\n    event Approved(uint256 indexed executionId, bool approved);\n\n    /**\n     * @dev Emitted when an execute operation was approved and successfully performed.\n     *\n     * Specification: MUST be triggered when approve was called and the execution was successfully approved.\n     */\n    event Executed(uint256 indexed executionId, address indexed to, uint256 indexed value, bytes data);\n\n    /**\n     * @dev Emitted when an execution request was performed via `execute`.\n     *\n     * Specification: MUST be triggered when execute was successfully called.\n     */\n    event ExecutionRequested(uint256 indexed executionId, address indexed to, uint256 indexed value, bytes data);\n\n    /**\n     * @dev Emitted when an execute operation was called and failed\n     *\n     * Specification: MUST be triggered when execute call failed\n     */\n    event ExecutionFailed(uint256 indexed executionId, address indexed to, uint256 indexed value, bytes data);\n\n    /**\n     * @dev Emitted when a key was added to the Identity.\n     *\n     * Specification: MUST be triggered when addKey was successfully called.\n     */\n    event KeyAdded(bytes32 indexed key, uint256 indexed purpose, uint256 indexed keyType);\n\n    /**\n     * @dev Emitted when a key was removed from the Identity.\n     *\n     * Specification: MUST be triggered when removeKey was successfully called.\n     */\n    event KeyRemoved(bytes32 indexed key, uint256 indexed purpose, uint256 indexed keyType);\n\n    /**\n     * @dev Adds a _key to the identity. The _purpose specifies the purpose of the key.\n     *\n     * Triggers Event: `KeyAdded`\n     *\n     * Specification: MUST only be done by keys of purpose 1, or the identity\n     * itself. If it's the identity itself, the approval process will determine its approval.\n     */\n    function addKey(bytes32 _key, uint256 _purpose, uint256 _keyType) external returns (bool success);\n\n    /**\n    * @dev Approves an execution.\n    *\n    * Triggers Event: `Approved`\n    * Triggers on execution successful Event: `Executed`\n    * Triggers on execution failure Event: `ExecutionFailed`\n    */\n    function approve(uint256 _id, bool _approve) external returns (bool success);\n\n    /**\n     * @dev Removes _purpose for _key from the identity.\n     *\n     * Triggers Event: `KeyRemoved`\n     *\n     * Specification: MUST only be done by keys of purpose 1, or the identity itself.\n     * If it's the identity itself, the approval process will determine its approval.\n     */\n    function removeKey(bytes32 _key, uint256 _purpose) external returns (bool success);\n\n    /**\n     * @dev Passes an execution instruction to an ERC734 identity.\n     * How the execution is handled is up to the identity implementation:\n     * An execution COULD be requested and require `approve` to be called with one or more keys of purpose 1 or 2 to\n     * approve this execution.\n     * Execute COULD be used as the only accessor for `addKey` and `removeKey`.\n     *\n     * Triggers Event: ExecutionRequested\n     * Triggers on direct execution Event: Executed\n     */\n    function execute(address _to, uint256 _value, bytes calldata _data) external payable returns (uint256 executionId);\n\n    /**\n     * @dev Returns the full key data, if present in the identity.\n     */\n    function getKey(bytes32 _key) external view returns (uint256[] memory purposes, uint256 keyType, bytes32 key);\n\n    /**\n     * @dev Returns the list of purposes associated with a key.\n     */\n    function getKeyPurposes(bytes32 _key) external view returns(uint256[] memory _purposes);\n\n    /**\n     * @dev Returns an array of public key bytes32 held by this identity.\n     */\n    function getKeysByPurpose(uint256 _purpose) external view returns (bytes32[] memory keys);\n\n    /**\n     * @dev Returns TRUE if a key is present and has the given purpose. If the key is not present it returns FALSE.\n     */\n    function keyHasPurpose(bytes32 _key, uint256 _purpose) external view returns (bool exists);\n}\n"},{"file_path":"@onchain-id/solidity/contracts/interface/IERC735.sol","source_code":"// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.17;\n\n/**\n * @dev interface of the ERC735 (Claim Holder) standard as defined in the EIP.\n */\ninterface IERC735 {\n\n    /**\n     * @dev Emitted when a claim was added.\n     *\n     * Specification: MUST be triggered when a claim was successfully added.\n     */\n    event ClaimAdded(\n        bytes32 indexed claimId,\n        uint256 indexed topic,\n        uint256 scheme,\n        address indexed issuer,\n        bytes signature,\n        bytes data,\n        string uri);\n\n    /**\n     * @dev Emitted when a claim was removed.\n     *\n     * Specification: MUST be triggered when removeClaim was successfully called.\n     */\n    event ClaimRemoved(\n        bytes32 indexed claimId,\n        uint256 indexed topic,\n        uint256 scheme,\n        address indexed issuer,\n        bytes signature,\n        bytes data,\n        string uri);\n\n    /**\n     * @dev Emitted when a claim was changed.\n     *\n     * Specification: MUST be triggered when addClaim was successfully called on an existing claimId.\n     */\n    event ClaimChanged(\n        bytes32 indexed claimId,\n        uint256 indexed topic,\n        uint256 scheme,\n        address indexed issuer,\n        bytes signature,\n        bytes data,\n        string uri);\n\n    /**\n     * @dev Add or update a claim.\n     *\n     * Triggers Event: `ClaimAdded`, `ClaimChanged`\n     *\n     * Specification: Add or update a claim from an issuer.\n     *\n     * _signature is a signed message of the following structure:\n     * `keccak256(abi.encode(address identityHolder_address, uint256 topic, bytes data))`.\n     * Claim IDs are generated using `keccak256(abi.encode(address issuer_address + uint256 topic))`.\n     */\n    function addClaim(\n        uint256 _topic,\n        uint256 _scheme,\n        address issuer,\n        bytes calldata _signature,\n        bytes calldata _data,\n        string calldata _uri)\n    external returns (bytes32 claimRequestId);\n\n    /**\n     * @dev Removes a claim.\n     *\n     * Triggers Event: `ClaimRemoved`\n     *\n     * Claim IDs are generated using `keccak256(abi.encode(address issuer_address, uint256 topic))`.\n     */\n    function removeClaim(bytes32 _claimId) external returns (bool success);\n\n    /**\n     * @dev Get a claim by its ID.\n     *\n     * Claim IDs are generated using `keccak256(abi.encode(address issuer_address, uint256 topic))`.\n     */\n    function getClaim(bytes32 _claimId)\n    external view returns(\n        uint256 topic,\n        uint256 scheme,\n        address issuer,\n        bytes memory signature,\n        bytes memory data,\n        string memory uri);\n\n    /**\n     * @dev Returns an array of claim IDs by topic.\n     */\n    function getClaimIdsByTopic(uint256 _topic) external view returns(bytes32[] memory claimIds);\n}\n"},{"file_path":"@onchain-id/solidity/contracts/interface/IIdentity.sol","source_code":"// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.17;\n\nimport \"./IERC734.sol\";\nimport \"./IERC735.sol\";\n\n// solhint-disable-next-line no-empty-blocks\ninterface IIdentity is IERC734, IERC735 {\n    /**\n     * @dev Checks if a claim is valid.\n     * @param _identity the identity contract related to the claim\n     * @param claimTopic the claim topic of the claim\n     * @param sig the signature of the claim\n     * @param data the data field of the claim\n     * @return claimValid true if the claim is valid, false otherwise\n     */\n    function isClaimValid(\n        IIdentity _identity,\n        uint256 claimTopic,\n        bytes calldata sig,\n        bytes calldata data)\n    external view returns (bool);\n}\n"},{"file_path":"@openzeppelin/contracts/access/Ownable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n    address private _owner;\n\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n    /**\n     * @dev Initializes the contract setting the deployer as the initial owner.\n     */\n    constructor() {\n        _transferOwnership(_msgSender());\n    }\n\n    /**\n     * @dev Throws if called by any account other than the owner.\n     */\n    modifier onlyOwner() {\n        _checkOwner();\n        _;\n    }\n\n    /**\n     * @dev Returns the address of the current owner.\n     */\n    function owner() public view virtual returns (address) {\n        return _owner;\n    }\n\n    /**\n     * @dev Throws if the sender is not the owner.\n     */\n    function _checkOwner() internal view virtual {\n        require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n    }\n\n    /**\n     * @dev Leaves the contract without owner. It will not be possible to call\n     * `onlyOwner` functions. Can only be called by the current owner.\n     *\n     * NOTE: Renouncing ownership will leave the contract without an owner,\n     * thereby disabling any functionality that is only available to the owner.\n     */\n    function renounceOwnership() public virtual onlyOwner {\n        _transferOwnership(address(0));\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Can only be called by the current owner.\n     */\n    function transferOwnership(address newOwner) public virtual onlyOwner {\n        require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n        _transferOwnership(newOwner);\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Internal function without access restriction.\n     */\n    function _transferOwnership(address newOwner) internal virtual {\n        address oldOwner = _owner;\n        _owner = newOwner;\n        emit OwnershipTransferred(oldOwner, newOwner);\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/token/ERC20/IERC20.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Moves `amount` tokens from `from` to `to` using the\n     * allowance mechanism. `amount` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n"}],"is_verified_via_sourcify":false,"can_be_visualized_via_sol2uml":true,"evm_version":"default","language":"solidity","is_verified_via_eth_bytecode_db":true,"is_fully_verified":false,"license_type":"none","is_blueprint":false,"name":"TREXImplementationAuthority","creation_bytecode":"0x60806040523480156200001157600080fd5b50604051620024f6380380620024f6833981016040819052620000349162000173565b6200003f3362000106565b600380546001600160a81b031916841515610100600160a81b03198116919091176101006001600160a01b0386811691820292909217909355600480546001600160a01b0319169185169190911790556040805191825260208201929092527f2a6aba4ff896a38777fb29a590abf5d340a4ba64314bcadf68be9c3ee92b485a910160405180910390a16040516001600160a01b038216907f5fb25b36f93b3d8443f7502abdc1157f581f15db724459ffb2800fce6132a00890600090a2505050620001c3565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200016e57600080fd5b919050565b6000806000606084860312156200018957600080fd5b835180151581146200019a57600080fd5b9250620001aa6020850162000156565b9150620001ba6040850162000156565b90509250925092565b61232380620001d36000396000f3fe608060405234801561001057600080fd5b50600436106101375760003560e01c80637f82a5e7116100b8578063cd24be221161007c578063cd24be2214610295578063cf49020e1461029d578063f2fde38b146102b0578063f38d2491146102c3578063fabec44a146102d6578063fedcc0521461035557600080fd5b80637f82a5e7146101e85780638da5cb5b146101fb5780639585548a1461020c5780639e3e7bb91461021f578063afce4bea1461022757600080fd5b80636df23789116100ff5780636df23789146101aa5780636ff6e83f146101bd578063709bc7f3146101c5578063715018a6146101cd57806371673bd0146101d557600080fd5b80630f3ca8ca1461013c5780631320a65a146101515780631ee9ce8b1461016c5780632c5d4f8e1461018c57806361f89825146101a2575b600080fd5b61014f61014a366004611dee565b61035d565b005b60035460ff1660405190151581526020015b60405180910390f35b610174610634565b6040516001600160a01b039091168152602001610163565b60035461010090046001600160a01b0316610174565b610174610696565b61014f6101b8366004611e26565b6106f8565b610174610822565b610174610884565b61014f6108e3565b61014f6101e3366004611e43565b6108f7565b61014f6101f6366004611e84565b61090e565b6000546001600160a01b0316610174565b61014f61021a366004611e43565b61153f565b6101746117cb565b61023a610235366004611dee565b61182d565b604051610163919081516001600160a01b03908116825260208084015182169083015260408084015182169083015260608084015182169083015260808084015182169083015260a092830151169181019190915260c00190565b6101746118e5565b61014f6102ab366004611e26565b611963565b61014f6102be366004611e26565b611a8b565b61014f6102d1366004611dee565b611b04565b6103296040805160608101825260008082526020820181905291810191909152506040805160608101825260015460ff808216835261010082048116602084015262010000909104169181019190915290565b60408051825160ff90811682526020808501518216908301529282015190921690820152606001610163565b610174611c7a565b60035460ff16156103bf5760405162461bcd60e51b815260206004820152602160248201527f63616e6e6f742063616c6c206f6e207265666572656e636520636f6e747261636044820152601d60fa1b60648201526084015b60405180910390fd5b60006002816103db6103d636869003860186611f03565b611cdc565b81526020810191909152604001600020546001600160a01b0316146104425760405162461bcd60e51b815260206004820152601760248201527f76657273696f6e206665746368656420616c726561647900000000000000000060448201526064016103b6565b61044a6118e5565b6001600160a01b031663afce4bea826040518263ffffffff1660e01b81526004016104759190611f57565b60c060405180830381865afa158015610492573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104b69190611f9f565b600260006104cc6103d636869003860186611f03565b815260208082019290925260409081016000908120845181546001600160a01b03199081166001600160a01b039283161783559486015160018301805487169183169190911790559285015160028083018054871692861692909217909155606086015160038301805487169186169190911790556080860151600483018054871691861691909117905560a090950151600590910180549094169216919091179091556105826103d636859003850185611f03565b81526020019081526020016000206040516105eb919081546001600160a01b03908116825260018301548116602083015260028301548116604083015260038301548116606083015260048301548116608083015260059092015490911660a082015260c00190565b6040518091039020816040516106019190612058565b604051908190038120907f5846080f2085e3dfad8cb250efdba145f8982d2e81ba7f74478da7fab659322b90600090a350565b6040805160608101825260015460ff8082168352610100820481166020840152620100009091041691810191909152600090600290829061067490611cdc565b81526020810191909152604001600020600201546001600160a01b0316919050565b6040805160608101825260015460ff808216835261010082048116602084015262010000909104169181019190915260009060029082906106d690611cdc565b81526020810191909152604001600020600501546001600160a01b0316919050565b610700611d2c565b60035460ff1680156107845750306001600160a01b0316816001600160a01b0316632d5f11876040518163ffffffff1660e01b8152600401602060405180830381865afa158015610755573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610779919061209f565b6001600160a01b0316145b6107d05760405162461bcd60e51b815260206004820181905260248201527f6f6e6c79207265666572656e636520636f6e74726163742063616e2063616c6c60448201526064016103b6565b60038054610100600160a81b0319166101006001600160a01b038416908102919091179091556040517ff068c7797c3b666af662a0e2f018804080dc37610a1b82b55006872b06d30ef590600090a250565b6040805160608101825260015460ff8082168352610100820481166020840152620100009091041691810191909152600090600290829061086290611cdc565b81526020810191909152604001600020600101546001600160a01b0316919050565b6040805160608101825260015460ff808216835261010082048116602084015262010000909104169181019190915260009060029082906108c490611cdc565b81526020810191909152604001600020546001600160a01b0316919050565b6108eb611d2c565b6108f56000611d86565b565b610901828261153f565b61090a82611b04565b5050565b6001600160a01b0382166109645760405162461bcd60e51b815260206004820152601f60248201527f696e76616c696420617267756d656e74202d207a65726f20616464726573730060448201526064016103b6565b6001600160a01b03811615801561097e575060035460ff16155b156109de5760405162461bcd60e51b815260206004820152602a60248201527f6f6e6c79207265666572656e636520636f6e74726163742063616e206465706c6044820152696f79206e65772049417360b01b60648201526084016103b6565b6000826001600160a01b031663134e18f46040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a42919061209f565b90506000836001600160a01b0316636290865d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa8919061209f565b90506000826001600160a01b031663f11abfd86040518163ffffffff1660e01b8152600401602060405180830381865afa158015610aea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b0e919061209f565b90506000836001600160a01b0316633b3e12f46040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b74919061209f565b90506000846001600160a01b031663b4f3fcb76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610bb6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bda919061209f565b9050336001600160a01b0316876001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c48919061209f565b6001600160a01b0316141580610cd15750336001600160a01b0316856001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ca1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc5919061209f565b6001600160a01b031614155b80610d4f5750336001600160a01b0316846001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d43919061209f565b6001600160a01b031614155b80610dcd5750336001600160a01b0316836001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d9d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc1919061209f565b6001600160a01b031614155b80610e4b5750336001600160a01b0316826001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e3f919061209f565b6001600160a01b031614155b80610ec95750336001600160a01b0316816001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebd919061209f565b6001600160a01b031614155b15610f295760405162461bcd60e51b815260206004820152602a60248201527f63616c6c6572204e4f54206f776e6572206f6620616c6c20636f6e74726163746044820152691cc81a5b5c1858dd195960b21b60648201526084016103b6565b6001600160a01b038616610fb057600480546040516352f1431b60e01b81526001600160a01b038a8116938201939093529116906352f1431b906024016020604051808303816000875af1158015610f85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fa9919061209f565b9550611259565b6040805160608101825260015460ff8082168352610100820481166020840152620100009091041691810191909152610fe890611cdc565b61104d876001600160a01b031663fabec44a6040518163ffffffff1660e01b8152600401606060405180830381865afa158015611029573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d691906120bc565b146110b55760405162461bcd60e51b815260206004820152603260248201527f76657273696f6e206f66206e65772049412068617320746f206265207468652060448201527173616d652061732063757272656e7420494160701b60648201526084016103b6565b856001600160a01b0316631320a65a6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156110f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111179190612104565b801561113c57506111266118e5565b6001600160a01b0316866001600160a01b031614155b156111895760405162461bcd60e51b815260206004820181905260248201527f6e6577204941206973204e4f54207265666572656e636520636f6e747261637460448201526064016103b6565b6004805460405163de87aeeb60e01b81526001600160a01b038981169382019390935291169063de87aeeb90602401602060405180830381865afa1580156111d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111f99190612104565b15801561121f57506112096118e5565b6001600160a01b0316866001600160a01b031614155b156112595760405162461bcd60e51b815260206004820152600a602482015269696e76616c696420494160b01b60448201526064016103b6565b6040516392dd9d6560e01b81526001600160a01b0387811660048301528816906392dd9d6590602401600060405180830381600087803b15801561129c57600080fd5b505af11580156112b0573d6000803e3d6000fd5b50506040516392dd9d6560e01b81526001600160a01b038981166004830152881692506392dd9d659150602401600060405180830381600087803b1580156112f757600080fd5b505af115801561130b573d6000803e3d6000fd5b50506040516392dd9d6560e01b81526001600160a01b038981166004830152871692506392dd9d659150602401600060405180830381600087803b15801561135257600080fd5b505af1158015611366573d6000803e3d6000fd5b50506040516392dd9d6560e01b81526001600160a01b038981166004830152851692506392dd9d659150602401600060405180830381600087803b1580156113ad57600080fd5b505af11580156113c1573d6000803e3d6000fd5b50506040516392dd9d6560e01b81526001600160a01b038981166004830152841692506392dd9d659150602401600060405180830381600087803b15801561140857600080fd5b505af115801561141c573d6000803e3d6000fd5b50505050306001600160a01b0316836001600160a01b0316632d5f11876040518163ffffffff1660e01b8152600401602060405180830381865afa158015611468573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061148c919061209f565b6001600160a01b0316036114f6576040516392dd9d6560e01b81526001600160a01b0387811660048301528416906392dd9d6590602401600060405180830381600087803b1580156114dd57600080fd5b505af11580156114f1573d6000803e3d6000fd5b505050505b856001600160a01b0316876001600160a01b03167ff79ab4f8584958d3168dac16d1d96119f728316536f50639339b4202837051c860405160405180910390a350505050505050565b611547611d2c565b60035460ff166115aa5760405162461bcd60e51b815260206004820152602860248201527f4f4e4c59207265666572656e636520636f6e74726163742063616e206164642060448201526776657273696f6e7360c01b60648201526084016103b6565b60006002816115c16103d636879003870187611f03565b81526020810191909152604001600020546001600160a01b0316146116215760405162461bcd60e51b815260206004820152601660248201527576657273696f6e20616c72656164792065786973747360501b60448201526064016103b6565b60006116336040830160208401611e26565b6001600160a01b031614158015611663575060006116576060830160408401611e26565b6001600160a01b031614155b80156116885750600061167c6080830160608401611e26565b6001600160a01b031614155b80156116ad575060006116a160c0830160a08401611e26565b6001600160a01b031614155b80156116d2575060006116c660a0830160808401611e26565b6001600160a01b031614155b80156116f4575060006116e86020830183611e26565b6001600160a01b031614155b6117405760405162461bcd60e51b815260206004820152601f60248201527f696e76616c696420617267756d656e74202d207a65726f20616464726573730060448201526064016103b6565b80600260006117576103d636879003870187611f03565b815260200190815260200160002081816117719190612146565b50506040516117819082906121ec565b6040518091039020826040516117979190612058565b604051908190038120907faecad55510e8cbc2b82b73c5c6d78c169403cb719460198f517d41cf7700b71b90600090a35050565b6040805160608101825260015460ff8082168352610100820481166020840152620100009091041691810191909152600090600290829061180b90611cdc565b81526020810191909152604001600020600301546001600160a01b0316919050565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a0810191909152600260006118756103d636869003860186611f03565b81526020808201929092526040908101600020815160c08101835281546001600160a01b039081168252600183015481169482019490945260028201548416928101929092526003810154831660608301526004810154831660808301526005015490911660a082015292915050565b6000600360019054906101000a90046001600160a01b03166001600160a01b0316632d5f11876040518163ffffffff1660e01b8152600401602060405180830381865afa15801561193a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061195e919061209f565b905090565b61196b611d2c565b60035460ff1680156119f5575060035460408051632d5f118760e01b81529051309261010090046001600160a01b031691632d5f11879160048083019260209291908290030181865afa1580156119c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ea919061209f565b6001600160a01b0316145b611a415760405162461bcd60e51b815260206004820181905260248201527f6f6e6c79207265666572656e636520636f6e74726163742063616e2063616c6c60448201526064016103b6565b600480546001600160a01b0319166001600160a01b0383169081179091556040517f5fb25b36f93b3d8443f7502abdc1157f581f15db724459ffb2800fce6132a00890600090a250565b611a93611d2c565b6001600160a01b038116611af85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016103b6565b611b0181611d86565b50565b611b0c611d2c565b6040805160608101825260015460ff8082168352610100820481166020840152620100009091041691810191909152611b4490611cdc565b611b566103d636849003840184611f03565b03611b9c5760405162461bcd60e51b815260206004820152601660248201527576657273696f6e20616c726561647920696e2075736560501b60448201526064016103b6565b6000600281611bb36103d636869003860186611f03565b81526020810191909152604001600020546001600160a01b031603611c2a5760405162461bcd60e51b815260206004820152602760248201527f696e76616c696420617267756d656e74202d206e6f6e206578697374696e67206044820152663b32b939b4b7b760c91b60648201526084016103b6565b806001611c378282612280565b5050604051611c47908290612058565b604051908190038120907f0a46bc1766225d5a82bc50155575dc428902e93470e34ceaf7e0faae128fe0ab90600090a250565b6040805160608101825260015460ff80821683526101008204811660208401526201000090910416918101919091526000906002908290611cba90611cdc565b81526020810191909152604001600020600401546001600160a01b0316919050565b805160208083015160409384015184516001600160f81b031960f895861b81168286015292851b83166021820152931b166022830152825180830360030181526023909201909252805191012090565b6000546001600160a01b031633146108f55760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103b6565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060608284031215611de857600080fd5b50919050565b600060608284031215611e0057600080fd5b611e0a8383611dd6565b9392505050565b6001600160a01b0381168114611b0157600080fd5b600060208284031215611e3857600080fd5b8135611e0a81611e11565b600080828403610120811215611e5857600080fd5b611e628585611dd6565b925060c0605f1982011215611e7657600080fd5b506060830190509250929050565b60008060408385031215611e9757600080fd5b8235611ea281611e11565b91506020830135611eb281611e11565b809150509250929050565b6040516060810167ffffffffffffffff81118282101715611eee57634e487b7160e01b600052604160045260246000fd5b60405290565b60ff81168114611b0157600080fd5b600060608284031215611f1557600080fd5b611f1d611ebd565b8235611f2881611ef4565b81526020830135611f3881611ef4565b60208201526040830135611f4b81611ef4565b60408201529392505050565b606081018235611f6681611ef4565b60ff1682526020830135611f7981611ef4565b60ff1660208301526040830135611f8f81611ef4565b60ff811660408401525092915050565b600060c08284031215611fb157600080fd5b60405160c0810181811067ffffffffffffffff82111715611fe257634e487b7160e01b600052604160045260246000fd5b6040528251611ff081611e11565b8152602083015161200081611e11565b6020820152604083015161201381611e11565b6040820152606083015161202681611e11565b6060820152608083015161203981611e11565b608082015260a083015161204c81611e11565b60a08201529392505050565b6000823561206581611ef4565b60ff168252602083013561207881611ef4565b60ff166020830152604083013561208e81611ef4565b60ff16604083015250606001919050565b6000602082840312156120b157600080fd5b8151611e0a81611e11565b6000606082840312156120ce57600080fd5b6120d6611ebd565b82516120e181611ef4565b815260208301516120f181611ef4565b60208201526040830151611f4b81611ef4565b60006020828403121561211657600080fd5b81518015158114611e0a57600080fd5b80546001600160a01b0319166001600160a01b0392909216919091179055565b813561215181611e11565b61215b8183612126565b50602082013561216a81611e11565b6121778160018401612126565b50604082013561218681611e11565b6121938160028401612126565b5060608201356121a281611e11565b6121af8160038401612126565b5060808201356121be81611e11565b6121cb8160048401612126565b5060a08201356121da81611e11565b6121e78160058401612126565b505050565b600082356121f981611e11565b6001600160a01b03908116835260208401359061221582611e11565b908116602084015260408401359061222c82611e11565b908116604084015260608401359061224382611e11565b908116606084015260808401359061225a82611e11565b908116608084015260a08401359061227182611e11565b1660a08301525060c001919050565b813561228b81611ef4565b60ff8116905081548160ff19821617835560208401356122aa81611ef4565b61ff008160081b169050808361ffff1984161717845560408501356122ce81611ef4565b62ff00008160101b168462ffffff19851617831717855550505050505056fea2646970667358221220e6c817cf82a6356974c36443ce122404fcd6bb3b1ed8987feb95551c87fa59f564736f6c63430008110033000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","external_libraries":[],"proxy_type":null,"implementations":[],"verified_at":"2026-09-28T06:03:27.367046Z","is_verified_via_verifier_alliance":false,"compiler_version":"v0.8.17+commit.8df45f5f","decoded_constructor_args":[["true",{"internalType":"bool","name":"referenceStatus","type":"bool"}],["0x0000000000000000000000000000000000000000",{"internalType":"address","name":"trexFactory","type":"address"}],["0x0000000000000000000000000000000000000000",{"internalType":"address","name":"iaFactory","type":"address"}]],"sourcify_repo_url":null,"optimization_runs":200,"compiler_settings":{"libraries":{},"optimizer":{"enabled":true,"runs":200},"outputSelection":{"*":{"":["*"],"*":["*"]}}},"is_verified":true,"verified_twin_address_hash":null,"optimization_enabled":true,"deployed_bytecode":"0x608060405234801561001057600080fd5b50600436106101375760003560e01c80637f82a5e7116100b8578063cd24be221161007c578063cd24be2214610295578063cf49020e1461029d578063f2fde38b146102b0578063f38d2491146102c3578063fabec44a146102d6578063fedcc0521461035557600080fd5b80637f82a5e7146101e85780638da5cb5b146101fb5780639585548a1461020c5780639e3e7bb91461021f578063afce4bea1461022757600080fd5b80636df23789116100ff5780636df23789146101aa5780636ff6e83f146101bd578063709bc7f3146101c5578063715018a6146101cd57806371673bd0146101d557600080fd5b80630f3ca8ca1461013c5780631320a65a146101515780631ee9ce8b1461016c5780632c5d4f8e1461018c57806361f89825146101a2575b600080fd5b61014f61014a366004611dee565b61035d565b005b60035460ff1660405190151581526020015b60405180910390f35b610174610634565b6040516001600160a01b039091168152602001610163565b60035461010090046001600160a01b0316610174565b610174610696565b61014f6101b8366004611e26565b6106f8565b610174610822565b610174610884565b61014f6108e3565b61014f6101e3366004611e43565b6108f7565b61014f6101f6366004611e84565b61090e565b6000546001600160a01b0316610174565b61014f61021a366004611e43565b61153f565b6101746117cb565b61023a610235366004611dee565b61182d565b604051610163919081516001600160a01b03908116825260208084015182169083015260408084015182169083015260608084015182169083015260808084015182169083015260a092830151169181019190915260c00190565b6101746118e5565b61014f6102ab366004611e26565b611963565b61014f6102be366004611e26565b611a8b565b61014f6102d1366004611dee565b611b04565b6103296040805160608101825260008082526020820181905291810191909152506040805160608101825260015460ff808216835261010082048116602084015262010000909104169181019190915290565b60408051825160ff90811682526020808501518216908301529282015190921690820152606001610163565b610174611c7a565b60035460ff16156103bf5760405162461bcd60e51b815260206004820152602160248201527f63616e6e6f742063616c6c206f6e207265666572656e636520636f6e747261636044820152601d60fa1b60648201526084015b60405180910390fd5b60006002816103db6103d636869003860186611f03565b611cdc565b81526020810191909152604001600020546001600160a01b0316146104425760405162461bcd60e51b815260206004820152601760248201527f76657273696f6e206665746368656420616c726561647900000000000000000060448201526064016103b6565b61044a6118e5565b6001600160a01b031663afce4bea826040518263ffffffff1660e01b81526004016104759190611f57565b60c060405180830381865afa158015610492573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104b69190611f9f565b600260006104cc6103d636869003860186611f03565b815260208082019290925260409081016000908120845181546001600160a01b03199081166001600160a01b039283161783559486015160018301805487169183169190911790559285015160028083018054871692861692909217909155606086015160038301805487169186169190911790556080860151600483018054871691861691909117905560a090950151600590910180549094169216919091179091556105826103d636859003850185611f03565b81526020019081526020016000206040516105eb919081546001600160a01b03908116825260018301548116602083015260028301548116604083015260038301548116606083015260048301548116608083015260059092015490911660a082015260c00190565b6040518091039020816040516106019190612058565b604051908190038120907f5846080f2085e3dfad8cb250efdba145f8982d2e81ba7f74478da7fab659322b90600090a350565b6040805160608101825260015460ff8082168352610100820481166020840152620100009091041691810191909152600090600290829061067490611cdc565b81526020810191909152604001600020600201546001600160a01b0316919050565b6040805160608101825260015460ff808216835261010082048116602084015262010000909104169181019190915260009060029082906106d690611cdc565b81526020810191909152604001600020600501546001600160a01b0316919050565b610700611d2c565b60035460ff1680156107845750306001600160a01b0316816001600160a01b0316632d5f11876040518163ffffffff1660e01b8152600401602060405180830381865afa158015610755573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610779919061209f565b6001600160a01b0316145b6107d05760405162461bcd60e51b815260206004820181905260248201527f6f6e6c79207265666572656e636520636f6e74726163742063616e2063616c6c60448201526064016103b6565b60038054610100600160a81b0319166101006001600160a01b038416908102919091179091556040517ff068c7797c3b666af662a0e2f018804080dc37610a1b82b55006872b06d30ef590600090a250565b6040805160608101825260015460ff8082168352610100820481166020840152620100009091041691810191909152600090600290829061086290611cdc565b81526020810191909152604001600020600101546001600160a01b0316919050565b6040805160608101825260015460ff808216835261010082048116602084015262010000909104169181019190915260009060029082906108c490611cdc565b81526020810191909152604001600020546001600160a01b0316919050565b6108eb611d2c565b6108f56000611d86565b565b610901828261153f565b61090a82611b04565b5050565b6001600160a01b0382166109645760405162461bcd60e51b815260206004820152601f60248201527f696e76616c696420617267756d656e74202d207a65726f20616464726573730060448201526064016103b6565b6001600160a01b03811615801561097e575060035460ff16155b156109de5760405162461bcd60e51b815260206004820152602a60248201527f6f6e6c79207265666572656e636520636f6e74726163742063616e206465706c6044820152696f79206e65772049417360b01b60648201526084016103b6565b6000826001600160a01b031663134e18f46040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a42919061209f565b90506000836001600160a01b0316636290865d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa8919061209f565b90506000826001600160a01b031663f11abfd86040518163ffffffff1660e01b8152600401602060405180830381865afa158015610aea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b0e919061209f565b90506000836001600160a01b0316633b3e12f46040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b74919061209f565b90506000846001600160a01b031663b4f3fcb76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610bb6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bda919061209f565b9050336001600160a01b0316876001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c48919061209f565b6001600160a01b0316141580610cd15750336001600160a01b0316856001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ca1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc5919061209f565b6001600160a01b031614155b80610d4f5750336001600160a01b0316846001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d43919061209f565b6001600160a01b031614155b80610dcd5750336001600160a01b0316836001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d9d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc1919061209f565b6001600160a01b031614155b80610e4b5750336001600160a01b0316826001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e3f919061209f565b6001600160a01b031614155b80610ec95750336001600160a01b0316816001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebd919061209f565b6001600160a01b031614155b15610f295760405162461bcd60e51b815260206004820152602a60248201527f63616c6c6572204e4f54206f776e6572206f6620616c6c20636f6e74726163746044820152691cc81a5b5c1858dd195960b21b60648201526084016103b6565b6001600160a01b038616610fb057600480546040516352f1431b60e01b81526001600160a01b038a8116938201939093529116906352f1431b906024016020604051808303816000875af1158015610f85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fa9919061209f565b9550611259565b6040805160608101825260015460ff8082168352610100820481166020840152620100009091041691810191909152610fe890611cdc565b61104d876001600160a01b031663fabec44a6040518163ffffffff1660e01b8152600401606060405180830381865afa158015611029573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d691906120bc565b146110b55760405162461bcd60e51b815260206004820152603260248201527f76657273696f6e206f66206e65772049412068617320746f206265207468652060448201527173616d652061732063757272656e7420494160701b60648201526084016103b6565b856001600160a01b0316631320a65a6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156110f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111179190612104565b801561113c57506111266118e5565b6001600160a01b0316866001600160a01b031614155b156111895760405162461bcd60e51b815260206004820181905260248201527f6e6577204941206973204e4f54207265666572656e636520636f6e747261637460448201526064016103b6565b6004805460405163de87aeeb60e01b81526001600160a01b038981169382019390935291169063de87aeeb90602401602060405180830381865afa1580156111d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111f99190612104565b15801561121f57506112096118e5565b6001600160a01b0316866001600160a01b031614155b156112595760405162461bcd60e51b815260206004820152600a602482015269696e76616c696420494160b01b60448201526064016103b6565b6040516392dd9d6560e01b81526001600160a01b0387811660048301528816906392dd9d6590602401600060405180830381600087803b15801561129c57600080fd5b505af11580156112b0573d6000803e3d6000fd5b50506040516392dd9d6560e01b81526001600160a01b038981166004830152881692506392dd9d659150602401600060405180830381600087803b1580156112f757600080fd5b505af115801561130b573d6000803e3d6000fd5b50506040516392dd9d6560e01b81526001600160a01b038981166004830152871692506392dd9d659150602401600060405180830381600087803b15801561135257600080fd5b505af1158015611366573d6000803e3d6000fd5b50506040516392dd9d6560e01b81526001600160a01b038981166004830152851692506392dd9d659150602401600060405180830381600087803b1580156113ad57600080fd5b505af11580156113c1573d6000803e3d6000fd5b50506040516392dd9d6560e01b81526001600160a01b038981166004830152841692506392dd9d659150602401600060405180830381600087803b15801561140857600080fd5b505af115801561141c573d6000803e3d6000fd5b50505050306001600160a01b0316836001600160a01b0316632d5f11876040518163ffffffff1660e01b8152600401602060405180830381865afa158015611468573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061148c919061209f565b6001600160a01b0316036114f6576040516392dd9d6560e01b81526001600160a01b0387811660048301528416906392dd9d6590602401600060405180830381600087803b1580156114dd57600080fd5b505af11580156114f1573d6000803e3d6000fd5b505050505b856001600160a01b0316876001600160a01b03167ff79ab4f8584958d3168dac16d1d96119f728316536f50639339b4202837051c860405160405180910390a350505050505050565b611547611d2c565b60035460ff166115aa5760405162461bcd60e51b815260206004820152602860248201527f4f4e4c59207265666572656e636520636f6e74726163742063616e206164642060448201526776657273696f6e7360c01b60648201526084016103b6565b60006002816115c16103d636879003870187611f03565b81526020810191909152604001600020546001600160a01b0316146116215760405162461bcd60e51b815260206004820152601660248201527576657273696f6e20616c72656164792065786973747360501b60448201526064016103b6565b60006116336040830160208401611e26565b6001600160a01b031614158015611663575060006116576060830160408401611e26565b6001600160a01b031614155b80156116885750600061167c6080830160608401611e26565b6001600160a01b031614155b80156116ad575060006116a160c0830160a08401611e26565b6001600160a01b031614155b80156116d2575060006116c660a0830160808401611e26565b6001600160a01b031614155b80156116f4575060006116e86020830183611e26565b6001600160a01b031614155b6117405760405162461bcd60e51b815260206004820152601f60248201527f696e76616c696420617267756d656e74202d207a65726f20616464726573730060448201526064016103b6565b80600260006117576103d636879003870187611f03565b815260200190815260200160002081816117719190612146565b50506040516117819082906121ec565b6040518091039020826040516117979190612058565b604051908190038120907faecad55510e8cbc2b82b73c5c6d78c169403cb719460198f517d41cf7700b71b90600090a35050565b6040805160608101825260015460ff8082168352610100820481166020840152620100009091041691810191909152600090600290829061180b90611cdc565b81526020810191909152604001600020600301546001600160a01b0316919050565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a0810191909152600260006118756103d636869003860186611f03565b81526020808201929092526040908101600020815160c08101835281546001600160a01b039081168252600183015481169482019490945260028201548416928101929092526003810154831660608301526004810154831660808301526005015490911660a082015292915050565b6000600360019054906101000a90046001600160a01b03166001600160a01b0316632d5f11876040518163ffffffff1660e01b8152600401602060405180830381865afa15801561193a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061195e919061209f565b905090565b61196b611d2c565b60035460ff1680156119f5575060035460408051632d5f118760e01b81529051309261010090046001600160a01b031691632d5f11879160048083019260209291908290030181865afa1580156119c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ea919061209f565b6001600160a01b0316145b611a415760405162461bcd60e51b815260206004820181905260248201527f6f6e6c79207265666572656e636520636f6e74726163742063616e2063616c6c60448201526064016103b6565b600480546001600160a01b0319166001600160a01b0383169081179091556040517f5fb25b36f93b3d8443f7502abdc1157f581f15db724459ffb2800fce6132a00890600090a250565b611a93611d2c565b6001600160a01b038116611af85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016103b6565b611b0181611d86565b50565b611b0c611d2c565b6040805160608101825260015460ff8082168352610100820481166020840152620100009091041691810191909152611b4490611cdc565b611b566103d636849003840184611f03565b03611b9c5760405162461bcd60e51b815260206004820152601660248201527576657273696f6e20616c726561647920696e2075736560501b60448201526064016103b6565b6000600281611bb36103d636869003860186611f03565b81526020810191909152604001600020546001600160a01b031603611c2a5760405162461bcd60e51b815260206004820152602760248201527f696e76616c696420617267756d656e74202d206e6f6e206578697374696e67206044820152663b32b939b4b7b760c91b60648201526084016103b6565b806001611c378282612280565b5050604051611c47908290612058565b604051908190038120907f0a46bc1766225d5a82bc50155575dc428902e93470e34ceaf7e0faae128fe0ab90600090a250565b6040805160608101825260015460ff80821683526101008204811660208401526201000090910416918101919091526000906002908290611cba90611cdc565b81526020810191909152604001600020600401546001600160a01b0316919050565b805160208083015160409384015184516001600160f81b031960f895861b81168286015292851b83166021820152931b166022830152825180830360030181526023909201909252805191012090565b6000546001600160a01b031633146108f55760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103b6565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060608284031215611de857600080fd5b50919050565b600060608284031215611e0057600080fd5b611e0a8383611dd6565b9392505050565b6001600160a01b0381168114611b0157600080fd5b600060208284031215611e3857600080fd5b8135611e0a81611e11565b600080828403610120811215611e5857600080fd5b611e628585611dd6565b925060c0605f1982011215611e7657600080fd5b506060830190509250929050565b60008060408385031215611e9757600080fd5b8235611ea281611e11565b91506020830135611eb281611e11565b809150509250929050565b6040516060810167ffffffffffffffff81118282101715611eee57634e487b7160e01b600052604160045260246000fd5b60405290565b60ff81168114611b0157600080fd5b600060608284031215611f1557600080fd5b611f1d611ebd565b8235611f2881611ef4565b81526020830135611f3881611ef4565b60208201526040830135611f4b81611ef4565b60408201529392505050565b606081018235611f6681611ef4565b60ff1682526020830135611f7981611ef4565b60ff1660208301526040830135611f8f81611ef4565b60ff811660408401525092915050565b600060c08284031215611fb157600080fd5b60405160c0810181811067ffffffffffffffff82111715611fe257634e487b7160e01b600052604160045260246000fd5b6040528251611ff081611e11565b8152602083015161200081611e11565b6020820152604083015161201381611e11565b6040820152606083015161202681611e11565b6060820152608083015161203981611e11565b608082015260a083015161204c81611e11565b60a08201529392505050565b6000823561206581611ef4565b60ff168252602083013561207881611ef4565b60ff166020830152604083013561208e81611ef4565b60ff16604083015250606001919050565b6000602082840312156120b157600080fd5b8151611e0a81611e11565b6000606082840312156120ce57600080fd5b6120d6611ebd565b82516120e181611ef4565b815260208301516120f181611ef4565b60208201526040830151611f4b81611ef4565b60006020828403121561211657600080fd5b81518015158114611e0a57600080fd5b80546001600160a01b0319166001600160a01b0392909216919091179055565b813561215181611e11565b61215b8183612126565b50602082013561216a81611e11565b6121778160018401612126565b50604082013561218681611e11565b6121938160028401612126565b5060608201356121a281611e11565b6121af8160038401612126565b5060808201356121be81611e11565b6121cb8160048401612126565b5060a08201356121da81611e11565b6121e78160058401612126565b505050565b600082356121f981611e11565b6001600160a01b03908116835260208401359061221582611e11565b908116602084015260408401359061222c82611e11565b908116604084015260608401359061224382611e11565b908116606084015260808401359061225a82611e11565b908116608084015260a08401359061227182611e11565b1660a08301525060c001919050565b813561228b81611ef4565b60ff8116905081548160ff19821617835560208401356122aa81611ef4565b61ff008160081b169050808361ffff1984161717845560408501356122ce81611ef4565b62ff00008160101b168462ffffff19851617831717855550505050505056fea2646970667358221220e6c817cf82a6356974c36443ce122404fcd6bb3b1ed8987feb95551c87fa59f564736f6c63430008110033","source_code":"// SPDX-License-Identifier: GPL-3.0\n//\n//                                             :+#####%%%%%%%%%%%%%%+\n//                                         .-*@@@%+.:+%@@@@@%%#***%@@%=\n//                                     :=*%@@@#=.      :#@@%       *@@@%=\n//                       .-+*%@%*-.:+%@@@@@@+.     -*+:  .=#.       :%@@@%-\n//                   :=*@@@@%%@@@@@@@@@%@@@-   .=#@@@%@%=             =@@@@#.\n//             -=+#%@@%#*=:.  :%@@@@%.   -*@@#*@@@@@@@#=:-              *@@@@+\n//            =@@%=:.     :=:   *@@@@@%#-   =%*%@@@@#+-.        =+       :%@@@%-\n//           -@@%.     .+@@@     =+=-.         @@#-           +@@@%-       =@@@@%:\n//          :@@@.    .+@@#%:                   :    .=*=-::.-%@@@+*@@=       +@@@@#.\n//          %@@:    +@%%*                         =%@@@@@@@@@@@#.  .*@%-       +@@@@*.\n//         #@@=                                .+@@@@%:=*@@@@@-      :%@%:      .*@@@@+\n//        *@@*                                +@@@#-@@%-:%@@*          +@@#.      :%@@@@-\n//       -@@%           .:-=++*##%%%@@@@@@@@@@@@*. :@+.@@@%:            .#@@+       =@@@@#:\n//      .@@@*-+*#%%%@@@@@@@@@@@@@@@@%%#**@@%@@@.   *@=*@@#                :#@%=      .#@@@@#-\n//      -%@@@@@@@@@@@@@@@*+==-:-@@@=    *@# .#@*-=*@@@@%=                 -%@@@*       =@@@@@%-\n//         -+%@@@#.   %@%%=   -@@:+@: -@@*    *@@*-::                   -%@@%=.         .*@@@@@#\n//            *@@@*  +@* *@@##@@-  #@*@@+    -@@=          .         :+@@@#:           .-+@@@%+-\n//             +@@@%*@@:..=@@@@*   .@@@*   .#@#.       .=+-       .=%@@@*.         :+#@@@@*=:\n//              =@@@@%@@@@@@@@@@@@@@@@@@@@@@%-      :+#*.       :*@@@%=.       .=#@@@@%+:\n//               .%@@=                 .....    .=#@@+.       .#@@@*:       -*%@@@@%+.\n//                 +@@#+===---:::...         .=%@@*-         +@@@+.      -*@@@@@%+.\n//                  -@@@@@@@@@@@@@@@@@@@@@@%@@@@=          -@@@+      -#@@@@@#=.\n//                    ..:::---===+++***###%%%@@@#-       .#@@+     -*@@@@@#=.\n//                                           @@@@@@+.   +@@*.   .+@@@@@%=.\n//                                          -@@@@@=   =@@%:   -#@@@@%+.\n//                                          +@@@@@. =@@@=  .+@@@@@*:\n//                                          #@@@@#:%@@#. :*@@@@#-\n//                                          @@@@@%@@@= :#@@@@+.\n//                                         :@@@@@@@#.:#@@@%-\n//                                         +@@@@@@-.*@@@*:\n//                                         #@@@@#.=@@@+.\n//                                         @@@@+-%@%=\n//                                        :@@@#%@%=\n//                                        +@@@@%-\n//                                        :#%%=\n//\n/**\n *     NOTICE\n *\n *     The T-REX software is licensed under a proprietary license or the GPL v.3.\n *     If you choose to receive it under the GPL v.3 license, the following applies:\n *     T-REX is a suite of smart contracts implementing the ERC-3643 standard and\n *     developed by Tokeny to manage and transfer financial assets on EVM blockchains\n *\n *     Copyright (C) 2023, Tokeny sàrl.\n *\n *     This program is free software: you can redistribute it and/or modify\n *     it under the terms of the GNU General Public License as published by\n *     the Free Software Foundation, either version 3 of the License, or\n *     (at your option) any later version.\n *\n *     This program is distributed in the hope that it will be useful,\n *     but WITHOUT ANY WARRANTY; without even the implied warranty of\n *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *     GNU General Public License for more details.\n *\n *     You should have received a copy of the GNU General Public License\n *     along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npragma solidity 0.8.17;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./ITREXImplementationAuthority.sol\";\nimport \"../../token/IToken.sol\";\nimport \"../interface/IProxy.sol\";\nimport \"../../factory/ITREXFactory.sol\";\nimport \"./IIAFactory.sol\";\n\ncontract TREXImplementationAuthority is ITREXImplementationAuthority, Ownable {\n\n    /// variables\n\n    /// current version\n    Version private _currentVersion;\n\n    /// mapping to get contracts of each version\n    mapping(bytes32 => TREXContracts) private _contracts;\n\n    /// reference ImplementationAuthority used by the TREXFactory\n    bool private _reference;\n\n    /// address of TREXFactory contract\n    address private _trexFactory;\n\n    /// address of factory for TREXImplementationAuthority contracts\n    address private _iaFactory;\n\n    /// functions\n\n    /**\n     *  @dev Constructor of the ImplementationAuthority contract\n     *  @param referenceStatus boolean value determining if the contract\n     *  is the main IA or an auxiliary contract\n     *  @param trexFactory the address of TREXFactory referencing the main IA\n     *  if `referenceStatus` is true then `trexFactory` at deployment is set\n     *  on zero address. In that scenario, call `setTREXFactory` post-deployment\n     *  @param iaFactory the address for the factory of IA contracts\n     *  emits `ImplementationAuthoritySet` event\n     *  emits a `IAFactorySet` event\n     */\n    constructor (bool referenceStatus, address trexFactory, address iaFactory) {\n        _reference = referenceStatus;\n        _trexFactory = trexFactory;\n        _iaFactory = iaFactory;\n        emit ImplementationAuthoritySet(referenceStatus, trexFactory);\n        emit IAFactorySet(iaFactory);\n    }\n\n    /**\n     *  @dev See {ITREXImplementationAuthority-setTREXFactory}.\n     */\n    function setTREXFactory(address trexFactory) external override onlyOwner {\n        require(\n            isReferenceContract() &&\n            ITREXFactory(trexFactory).getImplementationAuthority() == address(this)\n        , \"only reference contract can call\");\n        _trexFactory = trexFactory;\n        emit TREXFactorySet(trexFactory);\n    }\n\n    /**\n     *  @dev See {ITREXImplementationAuthority-setIAFactory}.\n     */\n    function setIAFactory(address iaFactory) external override onlyOwner {\n        require(\n            isReferenceContract() &&\n            ITREXFactory(_trexFactory).getImplementationAuthority() == address(this)\n        , \"only reference contract can call\");\n        _iaFactory = iaFactory;\n        emit IAFactorySet(iaFactory);\n    }\n\n    /**\n     *  @dev See {ITREXImplementationAuthority-useTREXVersion}.\n     */\n    function addAndUseTREXVersion(Version calldata _version, TREXContracts calldata _trex) external override {\n        addTREXVersion(_version, _trex);\n        useTREXVersion(_version);\n    }\n\n    /**\n     *  @dev See {ITREXImplementationAuthority-fetchVersionList}.\n     */\n    function fetchVersion(Version calldata _version) external override {\n        require(!isReferenceContract(), \"cannot call on reference contract\");\n        if (_contracts[_versionToBytes(_version)].tokenImplementation != address(0)) {\n            revert(\"version fetched already\");\n        }\n        _contracts[_versionToBytes(_version)] =\n        ITREXImplementationAuthority(getReferenceContract()).getContracts(_version);\n        emit TREXVersionFetched(_version, _contracts[_versionToBytes(_version)]);\n    }\n\n    /**\n     *  @dev See {ITREXImplementationAuthority-changeImplementationAuthority}.\n     */\n    // solhint-disable-next-line code-complexity, function-max-lines\n    function changeImplementationAuthority(address _token, address _newImplementationAuthority) external override {\n        require(_token != address(0), \"invalid argument - zero address\");\n        if(_newImplementationAuthority == address(0) && !isReferenceContract()){\n            revert(\"only reference contract can deploy new IAs\");}\n\n        address _ir = address(IToken(_token).identityRegistry());\n        address _mc = address(IToken(_token).compliance());\n        address _irs = address(IIdentityRegistry(_ir).identityStorage());\n        address _ctr = address(IIdentityRegistry(_ir).topicsRegistry());\n        address _tir = address(IIdentityRegistry(_ir).issuersRegistry());\n\n        // calling this function requires ownership of ALL contracts of the T-REX suite\n        if(\n            Ownable(_token).owner() != msg.sender\n            || Ownable(_ir).owner() != msg.sender\n            || Ownable(_mc).owner() != msg.sender\n            || Ownable(_irs).owner() != msg.sender\n            || Ownable(_ctr).owner() != msg.sender\n            || Ownable(_tir).owner() != msg.sender) {\n            revert(\"caller NOT owner of all contracts impacted\");\n        }\n\n        if(_newImplementationAuthority == address(0)) {\n            _newImplementationAuthority = IIAFactory(_iaFactory).deployIA(_token);\n        }\n        else {\n            if(\n                _versionToBytes(ITREXImplementationAuthority(_newImplementationAuthority).getCurrentVersion()) !=\n                _versionToBytes(_currentVersion)) {\n                revert(\"version of new IA has to be the same as current IA\");\n            }\n            if(\n                ITREXImplementationAuthority(_newImplementationAuthority).isReferenceContract() &&\n                _newImplementationAuthority != getReferenceContract()) {\n                revert(\"new IA is NOT reference contract\");\n            }\n            if(\n                !IIAFactory(_iaFactory).deployedByFactory(_newImplementationAuthority) &&\n            _newImplementationAuthority != getReferenceContract()) {\n                revert(\"invalid IA\");\n            }\n        }\n\n        IProxy(_token).setImplementationAuthority(_newImplementationAuthority);\n        IProxy(_ir).setImplementationAuthority(_newImplementationAuthority);\n        IProxy(_mc).setImplementationAuthority(_newImplementationAuthority);\n        IProxy(_ctr).setImplementationAuthority(_newImplementationAuthority);\n        IProxy(_tir).setImplementationAuthority(_newImplementationAuthority);\n        // IRS can be shared by multiple tokens, and therefore could have been updated already\n        if (IProxy(_irs).getImplementationAuthority() == address(this)) {\n            IProxy(_irs).setImplementationAuthority(_newImplementationAuthority);\n        }\n        emit ImplementationAuthorityChanged(_token, _newImplementationAuthority);\n    }\n\n    /**\n     *  @dev See {ITREXImplementationAuthority-getCurrentVersion}.\n     */\n    function getCurrentVersion() external view override returns (Version memory) {\n        return _currentVersion;\n    }\n\n    /**\n     *  @dev See {ITREXImplementationAuthority-getContracts}.\n     */\n    function getContracts(Version calldata _version) external view override returns (TREXContracts memory) {\n        return _contracts[_versionToBytes(_version)];\n    }\n\n    /**\n     *  @dev See {ITREXImplementationAuthority-getTREXFactory}.\n     */\n    function getTREXFactory() external view override returns (address) {\n        return _trexFactory;\n    }\n\n    /**\n     *  @dev See {ITREXImplementationAuthority-getTokenImplementation}.\n     */\n    function getTokenImplementation() external view override returns (address) {\n        return _contracts[_versionToBytes(_currentVersion)].tokenImplementation;\n    }\n\n    /**\n     *  @dev See {ITREXImplementationAuthority-getCTRImplementation}.\n     */\n    function getCTRImplementation() external view override returns (address) {\n        return _contracts[_versionToBytes(_currentVersion)].ctrImplementation;\n    }\n\n    /**\n     *  @dev See {ITREXImplementationAuthority-getIRImplementation}.\n     */\n    function getIRImplementation() external view override returns (address) {\n        return _contracts[_versionToBytes(_currentVersion)].irImplementation;\n    }\n\n    /**\n     *  @dev See {ITREXImplementationAuthority-getIRSImplementation}.\n     */\n    function getIRSImplementation() external view override returns (address) {\n        return _contracts[_versionToBytes(_currentVersion)].irsImplementation;\n    }\n\n    /**\n     *  @dev See {ITREXImplementationAuthority-getTIRImplementation}.\n     */\n    function getTIRImplementation() external view override returns (address) {\n        return _contracts[_versionToBytes(_currentVersion)].tirImplementation;\n    }\n\n    /**\n     *  @dev See {ITREXImplementationAuthority-getMCImplementation}.\n     */\n    function getMCImplementation() external view override returns (address) {\n        return _contracts[_versionToBytes(_currentVersion)].mcImplementation;\n    }\n\n    /**\n     *  @dev See {ITREXImplementationAuthority-addTREXVersion}.\n     */\n    function addTREXVersion(Version calldata _version, TREXContracts calldata _trex) public override onlyOwner {\n        require(isReferenceContract(), \"ONLY reference contract can add versions\");\n        if (_contracts[_versionToBytes(_version)].tokenImplementation != address(0)) {\n            revert(\"version already exists\");\n        }\n        require(\n            _trex.ctrImplementation != address(0)\n            && _trex.irImplementation != address(0)\n            && _trex.irsImplementation != address(0)\n            && _trex.mcImplementation != address(0)\n            && _trex.tirImplementation != address(0)\n            && _trex.tokenImplementation != address(0)\n        , \"invalid argument - zero address\");\n        _contracts[_versionToBytes(_version)] = _trex;\n        emit TREXVersionAdded(_version, _trex);\n    }\n\n    /**\n     *  @dev See {ITREXImplementationAuthority-useTREXVersion}.\n     */\n    function useTREXVersion(Version calldata _version) public override onlyOwner {\n        if (_versionToBytes(_version) == _versionToBytes(_currentVersion)) {\n            revert(\"version already in use\");\n        }\n        if (_contracts[_versionToBytes(_version)].tokenImplementation == address(0)) {\n            revert(\"invalid argument - non existing version\");\n        }\n        _currentVersion = _version;\n        emit VersionUpdated(_version);\n    }\n\n    /**\n     *  @dev See {ITREXImplementationAuthority-isReferenceContract}.\n     */\n    function isReferenceContract() public view override returns (bool) {\n        return _reference;\n    }\n\n    /**\n     *  @dev See {ITREXImplementationAuthority-getReferenceContract}.\n     */\n    function getReferenceContract() public view override returns (address) {\n        return ITREXFactory(_trexFactory).getImplementationAuthority();\n    }\n\n    /**\n     *  @dev casting function Version => bytes to allow compare values easier\n     */\n    function _versionToBytes(Version memory _version) private pure returns(bytes32) {\n        return bytes32(keccak256(abi.encodePacked(_version.major, _version.minor, _version.patch)));\n    }\n}","creation_status":"success","file_path":"@erc3643org/erc-3643/contracts/proxy/authority/TREXImplementationAuthority.sol"}