Contract Functions Reference
Below is a clear overview of each major CryptoLegacy contract function: purpose, inputs, outputs, key logic, events, and external interactions.
Table of Contents
BeneficiaryRegistry (BR1)
constructor (BR1)
Contract/Library: BeneficiaryRegistry
Description: Initializes the registry and transfers ownership to _owner.
Detailed Description: Executed once at deployment. The BuildManagerOwnable constructor (via Ownable()) sets owner to msg.sender and emits OwnershipTransferred(address(0), msg.sender). Then Ownable._transferOwnership(_owner) updates the owner and emits OwnershipTransferred(msg.sender, _owner).
Parameters:
_owner (address): Initial owner of the registry
Returns: None
Modifiers / Visibility / Mutability:
constructor nonpayable
Access Control:
Unrestricted (deployment only)
Side Effects:
Sets
owner(first tomsg.sender, then to_owner)
Emits:
OwnershipTransferred β
OwnershipTransferred(address indexed previousOwner, address indexed newOwner)(viaOwnable()constructor)OwnershipTransferred β
OwnershipTransferred(address indexed previousOwner, address indexed newOwner)(viaOwnable._transferOwnership)
Reverts if: None
Overrides: None
Function Calls:
constructor() β BuildManagerOwnable, internal
Ownable._transferOwnership(address)β OpenZeppelin Ownable, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Deploy with new BeneficiaryRegistry(msg.sender).
_setBlockNumberChange (BR1)
Contract/Library: BeneficiaryRegistry
Description: Records the current L1/L2 block number for the given CryptoLegacy contract.
Detailed Description: Loads the change history array for _cryptoLegacy. Computes the current block number using Arbitrumβs ArbSys.arbBlockNumber() when block.chainid == 42161, otherwise uses block.number. Appends the block number only if the list is empty or the last recorded value differs, avoiding duplicates for multiple changes in the same block.
Parameters:
_cryptoLegacy (address): CryptoLegacy contract whose change is being recorded
Returns: None
Modifiers / Visibility / Mutability:
internal nonpayable
Access Control: Unrestricted (internal)
Side Effects:
Updates
blockNumberChangesByCryptoLegacy[_cryptoLegacy]
Emits: None
Reverts if: None
Overrides: None
Function Calls:
ArbSys.arbBlockNumber()βArbSys(atArbSys(address(100))), external (staticcall)
Called by:
setCryptoLegacyBeneficiary(bytes32,bool) β BeneficiaryRegistry
setCryptoLegacyGuardian(bytes32,bool) β BeneficiaryRegistry
setCryptoLegacyOwner(bytes32,bool) β BeneficiaryRegistry
setCryptoLegacyRecoveryAddresses(bytes32[],bytes32[]) β BeneficiaryRegistry
Gas / Complexity note: O(1)
Example: Not applicable
setCryptoLegacyBeneficiary (BR1)
Contract/Library: BeneficiaryRegistry
Description: Adds or removes the calling CryptoLegacy from a beneficiary hash index.
Detailed Description: Treats msg.sender as the CryptoLegacy contract and validates it via _checkBuildManagerValid(...). If _isAdd == true, inserts the contract into cryptoLegacyByBeneficiary[_beneficiary] (idempotent set semantics) and emits AddCryptoLegacyForBeneficiary. Otherwise removes it and emits RemoveCryptoLegacyForBeneficiary. Finally, records the block number via _setBlockNumberChange.
Parameters:
_beneficiary (bytes32): Beneficiary identifier hash
_isAdd (bool): true to add, false to remove
Returns: None
Modifiers / Visibility / Mutability:
external nonpayable
Access Control:
Restricted: only a CryptoLegacy built by an added build manager (
_checkBuildManagerValid(msg.sender, address(0)))
Side Effects:
Updates
cryptoLegacyByBeneficiary[_beneficiary]Updates
blockNumberChangesByCryptoLegacy[msg.sender]
Emits:
AddCryptoLegacyForBeneficiary β
AddCryptoLegacyForBeneficiary(bytes32 indexed beneficiary, address indexed cryptoLegacy)RemoveCryptoLegacyForBeneficiary β
RemoveCryptoLegacyForBeneficiary(bytes32 indexed beneficiary, address indexed cryptoLegacy)
Reverts if:
ICryptoLegacy(msg.sender).buildManager()β may revert per CryptoLegacy implementation (bubbled)ICryptoLegacyBuildManager(buildManager).isCryptoLegacyBuilt(address)β may revert per build manager implementation (bubbled)CryptoLegacyis not registered by its build manager βCryptoLegacyNotRegistered()The build manager of
CryptoLegacyis not added βBuildManagerNotAdded()
Overrides: None
Function Calls:
_checkBuildManagerValid(address,address) β BuildManagerOwnable, internal
EnumerableSet.AddressSet.add(address)β OpenZeppelin EnumerableSet, internalEnumerableSet.AddressSet.remove(address)β OpenZeppelin EnumerableSet, internal_setBlockNumberChange(address) β BeneficiaryRegistry, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: A verified CryptoLegacy calls setCryptoLegacyBeneficiary(keccak256("alice@email"), true) to register itself under Aliceβs beneficiary hash.
setCryptoLegacyGuardian (BR1)
Contract/Library: BeneficiaryRegistry
Description: Adds or removes the calling CryptoLegacy from a guardian hash index.
Detailed Description: Validates msg.sender via _checkBuildManagerValid. If _isAdd, adds to cryptoLegacyByGuardian[_guardian] and emits AddCryptoLegacyForGuardian; otherwise removes and emits RemoveCryptoLegacyForGuardian. Finally records the block number via _setBlockNumberChange.
Parameters:
_guardian (bytes32): Guardian identifier hash
_isAdd (bool): true to add, false to remove
Returns: None
Modifiers / Visibility / Mutability:
external nonpayable
Access Control:
Restricted: only a CryptoLegacy built by an added build manager
Side Effects:
Updates
cryptoLegacyByGuardian[_guardian]Updates
blockNumberChangesByCryptoLegacy[msg.sender]
Emits:
AddCryptoLegacyForGuardian β
AddCryptoLegacyForGuardian(bytes32 indexed guardian, address indexed cryptoLegacy)RemoveCryptoLegacyForGuardian β
RemoveCryptoLegacyForGuardian(bytes32 indexed guardian, address indexed cryptoLegacy)
Reverts if:
ICryptoLegacy(msg.sender).buildManager()β may revert per CryptoLegacy implementation (bubbled)ICryptoLegacyBuildManager(buildManager).isCryptoLegacyBuilt(address)β may revert per build manager implementation (bubbled)CryptoLegacyis not registered by its build manager βCryptoLegacyNotRegistered()The build manager of
CryptoLegacyis not added βBuildManagerNotAdded()
Overrides: None
Function Calls:
_checkBuildManagerValid(address,address) β BuildManagerOwnable, internal
EnumerableSet.AddressSet.add(address)β OpenZeppelin EnumerableSet, internalEnumerableSet.AddressSet.remove(address)β OpenZeppelin EnumerableSet, internal_setBlockNumberChange(address) β BeneficiaryRegistry, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: A verified CryptoLegacy calls setCryptoLegacyGuardian(guardianHash, true) to register its guardian linkage.
setCryptoLegacyOwner (BR1)
Contract/Library: BeneficiaryRegistry
Description: Adds or removes the calling CryptoLegacy from an owner hash index.
Detailed Description: Validates msg.sender via _checkBuildManagerValid. If _isAdd, adds to cryptoLegacyByOwner[_owner] and emits AddCryptoLegacyForOwner; otherwise removes and emits RemoveCryptoLegacyForOwner. Always records the block change via _setBlockNumberChange.
Parameters:
_owner (bytes32): Owner identifier hash
_isAdd (bool): true to add, false to remove
Returns: None
Modifiers / Visibility / Mutability:
external nonpayable
Access Control:
Restricted: only a CryptoLegacy built by an added build manager
Side Effects:
Updates
cryptoLegacyByOwner[_owner]Updates
blockNumberChangesByCryptoLegacy[msg.sender]
Emits:
AddCryptoLegacyForOwner β
AddCryptoLegacyForOwner(bytes32 indexed owner, address indexed cryptoLegacy)RemoveCryptoLegacyForOwner β
RemoveCryptoLegacyForOwner(bytes32 indexed owner, address indexed cryptoLegacy)
Reverts if:
ICryptoLegacy(msg.sender).buildManager()β may revert per CryptoLegacy implementation (bubbled)ICryptoLegacyBuildManager(buildManager).isCryptoLegacyBuilt(address)β may revert per build manager implementation (bubbled)CryptoLegacyis not registered by its build manager βCryptoLegacyNotRegistered()The build manager of
CryptoLegacyis not added βBuildManagerNotAdded()
Overrides: None
Function Calls:
_checkBuildManagerValid(address,address) β BuildManagerOwnable, internal
EnumerableSet.AddressSet.add(address)β OpenZeppelin EnumerableSet, internalEnumerableSet.AddressSet.remove(address)β OpenZeppelin EnumerableSet, internal_setBlockNumberChange(address) β BeneficiaryRegistry, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: A verified CryptoLegacy calls setCryptoLegacyOwner(ownerHash, true) to index itself by the ownerβs hash.
setCryptoLegacyRecoveryAddresses (BR1)
Contract/Library: BeneficiaryRegistry
Description: Updates recovery-hash indexes for the calling CryptoLegacy by removing old and adding new hashes.
Detailed Description: Validates msg.sender via _checkBuildManagerValid. Iterates _oldRecoveryHashes removing msg.sender from each related set and emits RemoveCryptoLegacyForRecovery per removal. Iterates _newRecoveryHashes adding msg.sender to each set and emits AddCryptoLegacyForRecovery per addition. Finally records the block change via _setBlockNumberChange.
Parameters:
_oldRecoveryHashes (bytes32[], memory): Recovery hashes to remove
_newRecoveryHashes (bytes32[], memory): Recovery hashes to add
Returns: None
Modifiers / Visibility / Mutability:
external nonpayable
Access Control:
Restricted: only a CryptoLegacy built by an added build manager
Side Effects:
Updates
cryptoLegacyByRecovery[_oldRecoveryHashes[i]]Updates
cryptoLegacyByRecovery[_newRecoveryHashes[i]]Updates
blockNumberChangesByCryptoLegacy[msg.sender]
Emits:
RemoveCryptoLegacyForRecovery β
RemoveCryptoLegacyForRecovery(bytes32 indexed recovery, address indexed cryptoLegacy)AddCryptoLegacyForRecovery β
AddCryptoLegacyForRecovery(bytes32 indexed recovery, address indexed cryptoLegacy)
Reverts if:
ICryptoLegacy(msg.sender).buildManager()β may revert per CryptoLegacy implementation (bubbled)ICryptoLegacyBuildManager(buildManager).isCryptoLegacyBuilt(address)β may revert per build manager implementation (bubbled)CryptoLegacyis not registered by its build manager βCryptoLegacyNotRegistered()The build manager of
CryptoLegacyis not added βBuildManagerNotAdded()
Overrides: None
Function Calls:
_checkBuildManagerValid(address,address) β BuildManagerOwnable, internal
EnumerableSet.AddressSet.remove(address)β OpenZeppelin EnumerableSet, internalEnumerableSet.AddressSet.add(address)β OpenZeppelin EnumerableSet, internal_setBlockNumberChange(address) β BeneficiaryRegistry, internal
Called by: None (entry point)
Gas / Complexity note: O(n_old + n_new)
Example: A verified CryptoLegacy calls setCryptoLegacyRecoveryAddresses(oldList, newList) to refresh all recovery hashes atomically.
getCryptoLegacyListByBeneficiary (BR1)
Contract/Library: BeneficiaryRegistry
Description: Returns CryptoLegacy addresses indexed by a beneficiary hash.
Detailed Description: Reads the EnumerableSet for _hash and returns a copy of its values.
Parameters:
_hash (bytes32): Beneficiary identifier hash
Returns:
result (address[], memory): Array of CryptoLegacy addresses
Modifiers / Visibility / Mutability:
public view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if: None
Overrides: None
Function Calls:
EnumerableSet.AddressSet.values()β OpenZeppelin EnumerableSet, internal
Called by: None (entry point)
Gas / Complexity note: O(n) by number of indexed contracts for _hash
Example: getCryptoLegacyListByBeneficiary(beneficiaryHash).
getCryptoLegacyListByOwner (BR1)
Contract/Library: BeneficiaryRegistry
Description: Returns CryptoLegacy addresses indexed by an owner hash.
Detailed Description: Reads the EnumerableSet for _hash and returns a copy of its values.
Parameters:
_hash (bytes32): Owner identifier hash
Returns:
result (address[], memory): Array of CryptoLegacy addresses
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if: None
Overrides: None
Function Calls:
EnumerableSet.AddressSet.values()β OpenZeppelin EnumerableSet, internal
Called by: None (entry point)
Gas / Complexity note: O(n) by number of indexed contracts for _hash
Example: getCryptoLegacyListByOwner(ownerHash).
getCryptoLegacyListByGuardian (BR1)
Contract/Library: BeneficiaryRegistry
Description: Returns CryptoLegacy addresses indexed by a guardian hash.
Detailed Description: Reads the EnumerableSet for _hash and returns a copy of its values.
Parameters:
_hash (bytes32): Guardian identifier hash
Returns:
result (address[], memory): Array of CryptoLegacy addresses
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if: None
Overrides: None
Function Calls:
EnumerableSet.AddressSet.values()β OpenZeppelin EnumerableSet, internal
Called by: None (entry point)
Gas / Complexity note: O(n) by number of indexed contracts for _hash
Example: getCryptoLegacyListByGuardian(guardianHash).
getCryptoLegacyListByRecovery (BR1)
Contract/Library: BeneficiaryRegistry
Description: Returns CryptoLegacy addresses indexed by a recovery hash.
Detailed Description: Reads the EnumerableSet for _hash and returns a copy of its values.
Parameters:
_hash (bytes32): Recovery identifier hash
Returns:
result (address[], memory): Array of CryptoLegacy addresses
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if: None
Overrides: None
Function Calls:
EnumerableSet.AddressSet.values()β OpenZeppelin EnumerableSet, internal
Called by: None (entry point)
Gas / Complexity note: O(n) by number of indexed contracts for _hash
Example: getCryptoLegacyListByRecovery(recoveryHash).
getCryptoLegacyBlockNumberChanges (BR1)
Contract/Library: BeneficiaryRegistry
Description: Returns recorded block numbers when the given CryptoLegacy triggered registry update calls.
Detailed Description: Reads and returns the array of recorded block numbers for _cryptoLegacy captured by _setBlockNumberChange. Records are appended when registry update functions are called, with same-block duplicates skipped.
Parameters:
_cryptoLegacy (address): CryptoLegacy address to query
Returns:
result (uint256[], memory): Array of block numbers
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if: None
Overrides: None
Function Calls: None
Called by: None (entry point)
Gas / Complexity note: O(n) by number of recorded changes for _cryptoLegacy
Example: getCryptoLegacyBlockNumberChanges(clAddress).
getAllCryptoLegacyListByRoles (BR1)
Contract/Library: BeneficiaryRegistry
Description: Returns all CryptoLegacy lists for a given hash across beneficiary, owner, guardian, and recovery roles.
Detailed Description: Aggregates four role-based lists by reading each corresponding EnumerableSet for _hash and returning all four arrays.
Parameters:
_hash (bytes32): Identifier hash to query across all roles
Returns:
listByBeneficiary (address[], memory): CryptoLegacy addresses under beneficiary role
listByOwner (address[], memory): CryptoLegacy addresses under owner role
listByGuardian (address[], memory): CryptoLegacy addresses under guardian role
listByRecovery (address[], memory): CryptoLegacy addresses under recovery role
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if: None
Overrides:
getAllCryptoLegacyListByRoles(bytes32)(#getallcryptolegacylistbyroles-ibr1) β IBeneficiaryRegistry
Function Calls:
EnumerableSet.AddressSet.values()β OpenZeppelin EnumerableSet, internalEnumerableSet.AddressSet.values()β OpenZeppelin EnumerableSet, internalEnumerableSet.AddressSet.values()β OpenZeppelin EnumerableSet, internalEnumerableSet.AddressSet.values()β OpenZeppelin EnumerableSet, internal
Called by: None (entry point)
Gas / Complexity note: O(nb + no + ng + nr), where each n* is the set size for the corresponding role
Example: getAllCryptoLegacyListByRoles(userHash) to fetch all role associations at once.
BuildManagerOwnable (BMO1)
constructor (BMO1)
Contract/Library: BuildManagerOwnable
Description: Initializes ownership state via OpenZeppelinβs Ownable base.
Detailed Description: Executed once at deployment. Calls the Ownable constructor which sets the initial owner to msg.sender and emits OwnershipTransferred(address(0), owner). No additional state is initialized here beyond the inherited behavior.
Parameters: None
Returns: None
Modifiers / Visibility / Mutability:
constructor nonpayable
Access Control:
Unrestricted (deployment only)
Side Effects:
Sets
owner(inherited fromOwnable)
Emits:
OwnershipTransferred β
OwnershipTransferred(address indexed previousOwner, address indexed newOwner)
Reverts if: None
Overrides: None
Function Calls:
Ownable()β OpenZeppelin Ownable, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Deploy with new BuildManagerOwnable().
setBuildManager (BMO1)
Contract/Library: BuildManagerOwnable
Description: Adds or removes a build manager address from the allowed set.
Detailed Description: Restricted to the contract owner. If _isAdd is true, the address _buildManager is inserted into the buildManagerAdded set (idempotently). Otherwise, the address is removed from the set if present. Emits a corresponding event after the mutation.
Parameters:
_buildManager (address): The build manager address to add or remove
_isAdd (bool): true to add _buildManager, false to remove
Returns: None
Modifiers / Visibility / Mutability:
external nonpayable onlyOwner
Access Control:
onlyOwner
Side Effects:
Updates
buildManagerAdded
Emits:
AddBuildManager β
AddBuildManager(address indexed buildManager)RemoveBuildManager β
RemoveBuildManager(address indexed buildManager)
Reverts if:
Caller is not the owner β "Ownable: caller is not the owner"
Overrides: None
Function Calls:
EnumerableSet.AddressSet.add(address)β OpenZeppelin EnumerableSet, internalEnumerableSet.AddressSet.remove(address)β OpenZeppelin EnumerableSet, internal
Called by: None (entry point)
Gas / Complexity note: O(1) average (set add/remove).
Example: Owner calls setBuildManager(0xB...eF, true) to allow a new build manager, later setBuildManager(0xB...eF, false) to remove it.
_checkBuildManagerValid (BMO1)
Contract/Library: BuildManagerOwnable
Description: Verifies that a given CryptoLegacy contract was built by an added build manager and (optionally) that it has a specific owner.
Detailed Description: Reads the buildManager from the provided _cryptoLegacy by calling ICryptoLegacy(_cryptoLegacy).buildManager(). If _clOwner is non-zero, checks that ICryptoLegacy(_cryptoLegacy).owner() matches _clOwner. Then verifies that the buildManager marks _cryptoLegacy as built via isCryptoLegacyBuilt(_cryptoLegacy). Finally ensures the retrieved buildManager address exists in buildManagerAdded. Reverts if any check fails.
Parameters:
_cryptoLegacy (address): Address of the CryptoLegacy contract to validate
_clOwner (address): Expected owner address (pass address(0) to skip owner check)
Returns: None
Modifiers / Visibility / Mutability:
internal view
Access Control:
Unrestricted (internal)
Side Effects: None
Emits: None
Reverts if:
ICryptoLegacy(_cryptoLegacy).buildManager()β may revert per target implementation (bubbled)ICryptoLegacy(_cryptoLegacy).owner()β may revert per target implementation (bubbled)_clOwner != address(0)and owner mismatch βNotTheOwnerOfCryptoLegacy()ICryptoLegacyBuildManager(buildManager).isCryptoLegacyBuilt(address)β may revert per build manager implementation (bubbled)Not built by its build manager β
CryptoLegacyNotRegistered()Build manager not added β
BuildManagerNotAdded()
Overrides: None
Function Calls:
ICryptoLegacy(_cryptoLegacy).buildManager()β ICryptoLegacy (at_cryptoLegacy), external (staticcall)ICryptoLegacy(_cryptoLegacy).owner()β ICryptoLegacy (at_cryptoLegacy), external (staticcall)ICryptoLegacyBuildManager(buildManager).isCryptoLegacyBuilt(address)β ICryptoLegacyBuildManager (atbuildManager), external (staticcall)EnumerableSet.AddressSet.contains(address)β OpenZeppelin EnumerableSet, internal
Called by:
setCryptoLegacyBeneficiary(bytes32,bool) β BeneficiaryRegistry
setCryptoLegacyGuardian(bytes32,bool) β BeneficiaryRegistry
setCryptoLegacyOwner(bytes32,bool) β BeneficiaryRegistry
setCryptoLegacyRecoveryAddresses(bytes32[],bytes32[]) β BeneficiaryRegistry
sendMessagesTo(address,bytes32[],bytes32[],bytes[],bytes[],uint256) β LegacyMessenger
Gas / Complexity note: O(1)
Example: Not applicable
getBuildManagerAdded (BMO1)
Contract/Library: BuildManagerOwnable
Description: Returns the list of all added build manager addresses.
Detailed Description: Reads the buildManagerAdded set and returns a newly allocated array of its values. This is a read-only view that enumerates the set at call time.
Parameters: None
Returns:
result (address[], memory): Array of build manager addresses currently added
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if: None
Overrides: None
Function Calls:
EnumerableSet.AddressSet.values()β OpenZeppelin EnumerableSet, internal
Called by: None (entry point)
Gas / Complexity note: O(n) by number of build managers in the set
Example: getBuildManagerAdded() β returns 0x12..., 0x34..., ....
Create3Factory (C3F1)
constructor (C3F1)
Contract/Library: Create3Factory
Description: Initializes the factory and assigns ownership to the provided _owner.
Detailed Description: Runs once at deployment. The Ownable() constructor sets owner to msg.sender and emits OwnershipTransferred(address(0), msg.sender), then _transferOwnership(_owner) updates the owner and emits OwnershipTransferred(msg.sender, _owner). No CREATE3 address is computed or deployed during construction.
Parameters:
_owner (address): Address that will become the contract owner
Returns: None
Modifiers / Visibility / Mutability:
constructor nonpayable
Access Control:
Unrestricted (deployment only)
Side Effects:
Sets
owner(inherited from Ownable)
Emits:
OwnershipTransferred β
OwnershipTransferred(address indexed previousOwner, address indexed newOwner)(viaOwnable()constructor)OwnershipTransferred β
OwnershipTransferred(address indexed previousOwner, address indexed newOwner)(viaOwnable._transferOwnership)
Reverts if: None
Overrides: None
Function Calls:
Ownable()β OpenZeppelin Ownable, internalOwnable._transferOwnership(address)β OpenZeppelin Ownable, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Deploy with new Create3Factory(msg.sender) to set the deployer as the owner.
build (C3F1)
Contract/Library: Create3Factory
Description: Deploys a contract deterministically via CREATE3 using a salt and raw bytecode.
Detailed Description: Restricted to the owner. Computes and deploys a new contract using LibCreate3 create3(_create3Salt, _contractBytecode), which determines the address following the CREATE3 scheme and performs the deployment. On success, the deployed address is returned and the factory emits Create3Contract(result). Callers control the raw _contractBytecode; ensure it is the correct creation code for the intended contract.
Parameters:
_create3Salt (bytes32): Salt used to derive the deterministic CREATE3 address
_contractBytecode (bytes, calldata): Full creation bytecode (constructor args ABI-encoded if required)
Returns:
result (address): Address of the newly deployed contract
Modifiers / Visibility / Mutability:
external nonpayable onlyOwner
Access Control:
onlyOwner
Side Effects:
Deploys a new contract at the CREATE3 address derived from _create3Salt
Emits:
Create3Contract β
Create3Contract(address contractAddress)
Reverts if:
caller is not the owner β "Ownable: caller is not the owner"
target address for _create3Salt already has code β
TargetAlreadyExists()CREATE2 proxy deployment fails β
ErrorCreatingProxy()proxy call fails or target bytecode absent β
ErrorCreatingContract()
Overrides: None
Function Calls:
create3(bytes32,bytes) β LibCreate3, internal
Called by: None (entry point)
Gas / Complexity note: O(n) by _contractBytecode.length (deployment cost scales with bytecode size)
Example:
computeAddress (C3F1)
Contract/Library: Create3Factory
Description: Predicts the deterministic CREATE3 address for a given salt without deploying.
Detailed Description: Returns the address computed by LibCreate3.addressOf(_create3Salt) with no state changes. Useful for precomputing addresses before calling build.
Parameters:
_create3Salt (bytes32): Salt to derive the predicted CREATE3 address
Returns:
result (address): Predicted address where a deployment with this salt would be created
Modifiers / Visibility / Mutability:
public view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if: None
Overrides: None
Function Calls:
addressOf(bytes32) β LibCreate3, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example:
CryptoLegacy (CL1)
constructor (CL1)
Contract/Library: CryptoLegacy
Description: Initializes core Diamond storage, sets the build manager and owner, timestamps the deployment, and installs initial plugins.
Detailed Description: Retrieves the Diamond storage struct via LibCryptoLegacy.getCryptoLegacyStorage(). Sets cls.buildManager to the provided _buildManager, and cls.lastUpdateAt to the current block timestamp. Transfers Diamond ownership to _owner using LibDiamond.setContractOwner. Finally, installs the initial plugins by invoking LibCryptoLegacyPlugins._addPluginList with the storage struct and _plugins. Ensures the contract starts with a known owner and requested plugin set.
Parameters:
_buildManager (address): Address of the ICryptoLegacyBuildManager to bind into storage
_owner (address): Address that will become the Diamond owner
_plugins (address[], memory): Initial plugin addresses to add
Returns: None
Modifiers / Visibility / Mutability:
constructor nonpayable
Access Control:
Unrestricted (deployment only)
Side Effects:
Sets
LibCryptoLegacy.CryptoLegacyStorage.buildManagerSets
LibCryptoLegacy.CryptoLegacyStorage.lastUpdateAtUpdates Diamond owner via
LibDiamondMutates plugin-related Diamond storage via
LibCryptoLegacyPlugins
Emits:
OwnershipTransferred β
OwnershipTransferred(address indexed previousOwner, address indexed newOwner)AddFunctions β
AddFunctions(address _facetAddress, bytes4[] _functionSelectors, uint16 selectorPosition)
Reverts if:
_pluginsinot registered with build manager βPluginNotRegistered()ICryptoLegacyPlugin(_pluginsi).getSetupSigs()β may revert per plugin implementation_pluginsi == address(0)βFacetCantBeZero()_pluginsilacks contract code β "NO_CODE"Selector already registered β
CantAddFunctionThatAlreadyExists()
Overrides: None
Function Calls:
getCryptoLegacyStorage() β
LibCryptoLegacy, internalsetContractOwner(address) β
LibDiamond, internal_addPluginList(ICryptoLegacy.CryptoLegacyStorage,address[]) β
LibCryptoLegacyPlugins, internal
Called by: None (entry point)
Gas / Complexity note: O(n) by _plugins.length
Example: Deploy with:
replacePlugin (CL1)
Contract/Library: CryptoLegacy
Description: Replaces an existing set of plugins with a new set.
Detailed Description: Iterates through _oldPlugins and removes each plugin via LibCryptoLegacyPlugins._removePlugin. Then fetches Diamond storage and adds all _newPlugins in a single call to _addPluginList. Ensures the plugin set transitions atomically within a transaction.
Parameters:
_oldPlugins (address[], memory): Plugins to remove
_newPlugins (address[], memory): Plugins to add
Returns: None
Modifiers / Visibility / Mutability:
external nonpayable onlyOwner
Access Control:
onlyOwner
Side Effects:
Mutates plugin-related Diamond storage (removes
_oldPlugins, adds_newPlugins)
Emits:
RemoveFunctions β
RemoveFunctions(address _facetAddress, bytes4[] _functionSelectors)AddFunctions β
AddFunctions(address _facetAddress, bytes4[] _functionSelectors, uint16 selectorPosition)
Reverts if:
Distribution already started β
DistributionStarted()Initial fee not paid β
InitialFeeNotPaid()Caller is not the owner β
NotTheOwner()ICryptoLegacyPlugin(_oldPluginsi).getSigs()β may revert per plugin implementation_oldPluginsi == address(0)βFacetCantBeZero()_oldPluginsiis the immutable facet βCantRemoveImmutableFunctions()_oldPluginsinot installed βFacetNotFound()_newPluginsinot registered with build manager βPluginNotRegistered()ICryptoLegacyPlugin(_newPluginsi).getSetupSigs()β may revert per plugin implementation_newPluginsi == address(0)βFacetCantBeZero()_newPluginsilacks contract code β "NO_CODE"Selector already registered β
CantAddFunctionThatAlreadyExists()
Overrides: None
Function Calls:
_removePlugin(ICryptoLegacyPlugin) β
LibCryptoLegacyPlugins, internalgetCryptoLegacyStorage() β
LibCryptoLegacy, internal_addPluginList(ICryptoLegacy.CryptoLegacyStorage,address[]) β
LibCryptoLegacyPlugins, internal
Called by: None (entry point)
Gas / Complexity note: O(n_old + n_new)
Example: Owner replaces legacy plugins with improved implementations:
addPluginList (CL1)
Contract/Library: CryptoLegacy
Description: Adds a list of plugins to the contract.
Detailed Description: Retrieves Diamond storage and forwards _plugins to LibCryptoLegacyPlugins._addPluginList, which records and activates the plugins.
Parameters:
_plugins (address[], memory): Plugins to add
Returns: None
Modifiers / Visibility / Mutability:
external nonpayable onlyOwner
Access Control:
onlyOwner
Side Effects:
Mutates plugin-related Diamond storage (adds
_plugins)
Emits:
AddFunctions β
AddFunctions(address _facetAddress, bytes4[] _functionSelectors, uint16 selectorPosition)
Reverts if:
Distribution already started β
DistributionStarted()Initial fee not paid β
InitialFeeNotPaid()Caller is not the owner β
NotTheOwner()_pluginsinot registered with build manager βPluginNotRegistered()ICryptoLegacyPlugin(_pluginsi).getSetupSigs()β may revert per plugin implementation_pluginsi == address(0)βFacetCantBeZero()_pluginsilacks contract code β "NO_CODE"Selector already registered β
CantAddFunctionThatAlreadyExists()
Overrides: None
Function Calls:
getCryptoLegacyStorage() β
LibCryptoLegacy, internal_addPluginList(ICryptoLegacy.CryptoLegacyStorage,address[]) β
LibCryptoLegacyPlugins, internal
Called by: None (entry point)
Gas / Complexity note: O(n) by _plugins.length
Example:
removePluginList (CL1)
Contract/Library: CryptoLegacy
Description: Removes a list of plugins from the contract.
Detailed Description: Loops over _plugins and calls LibCryptoLegacyPlugins._removePlugin for each entry, deactivating and removing them from Diamond storage.
Parameters:
_plugins (address[], memory): Plugins to remove
Returns: None
Modifiers / Visibility / Mutability:
external nonpayable onlyOwner
Access Control:
onlyOwner
Side Effects:
Removes facet address entries and selector mappings from Diamond storage
Emits:
RemoveFunctions β
RemoveFunctions(address _facetAddress, bytes4[] _functionSelectors)
Reverts if:
Distribution already started β
DistributionStarted()Initial fee not paid β
InitialFeeNotPaid()Caller is not the owner β
NotTheOwner()ICryptoLegacyPlugin(_pluginsi).getSigs()β may revert per plugin implementation_pluginsi == address(0)βFacetCantBeZero()_pluginsiis the immutable facet βCantRemoveImmutableFunctions()_pluginsinot installed βFacetNotFound()
Overrides: None
Function Calls:
_removePlugin(ICryptoLegacyPlugin) β
LibCryptoLegacyPlugins, internal
Called by: None (entry point)
Gas / Complexity note: O(n) by _plugins.length
Example:
externalLens (CL1)
Contract/Library: CryptoLegacy
Description: Returns the address of the external lens configured in the build manager.
Detailed Description: Reads Diamond storage, then queries the bound buildManager for its externalLens address. This is a read-only external call to the build manager.
Parameters: None
Returns:
addr (address): External lens address exposed by the build manager
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
ICryptoLegacyBuildManager.externalLens()β may revert per build manager implementation
Overrides: None
Function Calls:
getCryptoLegacyStorage() β
LibCryptoLegacy, internalICryptoLegacyBuildManager.externalLens()βICryptoLegacyBuildManager(atcls.buildManager), external (staticcall)
Called by: None (entry point)
Gas / Complexity note: O(1) (plus minimal external read cost)
Example:
CryptoLegacyBuildManager (CLBM1)
receive (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: Accepts plain ETH transfers to the build manager.
Detailed Description: Allows the contract to receive ETH when called with empty calldata. This function contains no logic beyond accepting the transfer.
Parameters: None
Returns: None
Modifiers / Visibility / Mutability:
receive external payable
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if: None
Overrides: None
Function Calls: None
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Send ETH directly to the CryptoLegacyBuildManager address.
constructor (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: Initializes registries and factory, stores the Lifetime NFT contract, and transfers ownership.
Detailed Description: Runs once at deployment. The Ownable() constructor sets owner to msg.sender and emits OwnershipTransferred. It then calls _setRegistries to persist feeRegistry, pluginsRegistry, and beneficiaryRegistry (emitting SetRegistries), calls _setFactory to persist factory (emitting SetFactory), stores lifetimeNft, and finally calls Ownable._transferOwnership(_owner) to update the owner (emitting OwnershipTransferred).
Parameters:
_owner (address): Address to be set as the owner
_feeRegistry (IFeeRegistry): Fee registry contract
_pluginsRegistry (IPluginsRegistry): Plugins registry contract
_beneficiaryRegistry (IBeneficiaryRegistry): Beneficiary registry contract
_lifetimeNft (ILifetimeNft): Lifetime NFT contract
_factory (ICryptoLegacyFactory): Factory used to deploy CryptoLegacy contracts
Returns: None
Modifiers / Visibility / Mutability:
constructor nonpayable
Access Control:
Unrestricted (deployment only)
Side Effects:
Sets
factorySets
lifetimeNftSets
owner(first tomsg.sender, then to_owner)
Emits:
OwnershipTransferred β
OwnershipTransferred(address indexed previousOwner, address indexed newOwner)(viaOwnable()constructor)SetRegistries β
SetRegistries(address indexed feeRegistry, address indexed pluginsRegistry, address indexed beneficiaryRegistry)SetFactory β
SetFactory(address indexed factory)OwnershipTransferred β
OwnershipTransferred(address indexed previousOwner, address indexed newOwner)(viaOwnable._transferOwnership)
Reverts if: None
Overrides: None
Function Calls:
Ownable()β Ownable, internal_setRegistries(IFeeRegistry,IPluginsRegistry,IBeneficiaryRegistry) β CryptoLegacyBuildManager, internal
_setFactory(ICryptoLegacyFactory) β CryptoLegacyBuildManager, internal
Ownable._transferOwnership(address)β Ownable, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Deploy with the required addresses:
setRegistries (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: Owner setter that updates Fee/Plugins/Beneficiary registries.
Detailed Description: Delegates to the internal helper _setRegistries which writes the new registry addresses and emits SetRegistries.
Parameters:
_feeRegistry (IFeeRegistry): New fee registry
_pluginsRegistry (IPluginsRegistry): New plugins registry
_beneficiaryRegistry (IBeneficiaryRegistry): New beneficiary registry
Returns: None
Modifiers / Visibility / Mutability:
external nonpayable onlyOwner
Access Control:
onlyOwner
Side Effects:
Updates
feeRegistry,pluginsRegistry,beneficiaryRegistry
Emits:
SetRegistries β
SetRegistries(address indexed feeRegistry, address indexed pluginsRegistry, address indexed beneficiaryRegistry)
Reverts if:
caller is not the owner β "Ownable: caller is not the owner"
Overrides: None
Function Calls:
_setRegistries(IFeeRegistry,IPluginsRegistry,IBeneficiaryRegistry) β CryptoLegacyBuildManager, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Owner rotates registries during an upgrade:
_setRegistries (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: Internal storage setter for main registries.
Detailed Description: Writes _feeRegistry, _pluginsRegistry, _beneficiaryRegistry to storage and emits SetRegistries with their addresses. Used by the constructor and the public setter to keep logic DRY.
Parameters:
_feeRegistry (IFeeRegistry): Fee registry
_pluginsRegistry (IPluginsRegistry): Plugins registry
_beneficiaryRegistry (IBeneficiaryRegistry): Beneficiary registry
Returns: None
Modifiers / Visibility / Mutability:
internal nonpayable
Access Control:
Unrestricted (internal)
Side Effects:
Updates
feeRegistry,pluginsRegistry,beneficiaryRegistry
Emits:
SetRegistries β
SetRegistries(address indexed feeRegistry, address indexed pluginsRegistry, address indexed beneficiaryRegistry)
Reverts if:
None
Overrides: None
Function Calls: None
Called by:
constructor β CryptoLegacyBuildManager
setRegistries β CryptoLegacyBuildManager
Gas / Complexity note: O(1)
Example: Not applicable
setFactory (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: Owner setter that updates the deployment factory.
Detailed Description: Delegates to internal _setFactory which writes and emits SetFactory.
Parameters:
_factory (ICryptoLegacyFactory): New factory contract
Returns: None
Modifiers / Visibility / Mutability:
external nonpayable onlyOwner
Access Control:
onlyOwner
Side Effects:
Updates
factory
Emits:
SetFactory β
SetFactory(address indexed factory)
Reverts if:
Caller is not the owner β "Ownable: caller is not the owner"
Overrides: None
Function Calls:
_setFactory(ICryptoLegacyFactory) β CryptoLegacyBuildManager, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example:
_setFactory (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: Internal storage setter for the factory contract.
Detailed Description: Assigns the _factory to storage and emits SetFactory.
Parameters:
_factory (ICryptoLegacyFactory): Factory to store
Returns: None
Modifiers / Visibility / Mutability:
internal nonpayable
Access Control:
Unrestricted (internal)
Side Effects:
Updates
factory
Emits:
SetFactory β
SetFactory(address indexed factory)
Reverts if:
None
Overrides: None
Function Calls: None
Called by:
constructor β CryptoLegacyBuildManager
setFactory β CryptoLegacyBuildManager
Gas / Complexity note: O(1)
Example: Not applicable
setSupplyLimit (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: Owner setter for the minimum Lifetime NFT supply required to allow mass minting.
Detailed Description: Updates minMassMintSupply to _newVal and emits SetSupplyLimit. Used by the owner to gate the payForMultipleLifetimeNft path.
Parameters:
_newVal (uint256): New minimum totalSupply threshold
Returns: None
Modifiers / Visibility / Mutability:
external nonpayable onlyOwner
Access Control:
onlyOwner
Side Effects:
Updates
minMassMintSupply
Emits:
SetSupplyLimit β
SetSupplyLimit(uint256 supplyLimit)
Reverts if:
Caller is not the owner β "Ownable: caller is not the owner"
Overrides: None
Function Calls: None
Called by: None (entry point)
Gas / Complexity note: O(1)
Example:
setExternalLens (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: Owner setter for a helper "lens" address.
Detailed Description: Stores an external externalLens address used by other components (e.g., UIs or contracts) and emits SetExternalLens.
Parameters:
_externalLens (address): New lens address
Returns: None
Modifiers / Visibility / Mutability:
external nonpayable onlyOwner
Access Control:
onlyOwner
Side Effects:
Updates
externalLens
Emits:
SetExternalLens β
SetExternalLens(address indexed externalLens)
Reverts if:
Caller is not the owner β "Ownable: caller is not the owner"
Overrides: None
Function Calls: None
Called by: None (entry point)
Gas / Complexity note: O(1)
Example:
withdrawFee (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: Owner can withdraw ETH from the contract to a recipient.
Detailed Description: Performs a low-level .call{value: _amount}("") to _recipient. If the call fails, it reverts with WithdrawFeeFailed(bytes). Emits WithdrawFee on success.
Parameters:
_recipient (address payable): Receiver of the ETH
_amount (uint256): Amount in wei to withdraw
Returns: None
Modifiers / Visibility / Mutability:
external nonpayable onlyOwner
Access Control:
onlyOwner
Side Effects:
Transfers ETH to
_recipient
Emits:
WithdrawFee β
WithdrawFee(address indexed recipient, uint256 indexed amount)
Reverts if:
Caller is not the owner β "Ownable: caller is not the owner"
Low-level ETH transfer to
_recipientfails βWithdrawFeeFailed(bytes)
Overrides: None
Function Calls:
call(bytes)β address (at_recipient), external
Called by: None (entry point)
Gas / Complexity note: O(1) (plus external call cost)
Example:
payFee (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: Pays an update fee or, if sufficient, auto-switches to lifetime fee and mints/locks an NFT.
Detailed Description: Delegates to _payFee with REGISTRY_UPDATE_CASE. _payFee computes the applicable fee (update vs lifetime), verifies sufficiency, forwards funds to feeRegistry, optionally mints/locks a Lifetime NFT, and refunds any remainder.
Parameters:
_code (bytes8): Referral code (may affect fee)
_toHolder (address): Recipient of benefits or NFT holder (lifetime case)
_mul (uint256): Multiplier for repeated fee payments
_lockToChainIds (uint256[], memory): Destination chain IDs to lock the Lifetime NFT
_crossChainFees (uint256[], memory): Native fees per chain, or zeros to auto-quote
Returns:
returnValue (uint256): Refunded remainder (in wei)
Modifiers / Visibility / Mutability:
external payable
Access Control:
Unrestricted
Side Effects:
Forwards ETH to
feeRegistryMay mint and lock a Lifetime NFT
Approves
feeRegistryto transfer the minted Lifetime NFTMay refund unused ETH
Emits: None
Reverts if:
Insufficient
msg.valuefor computed fee βIncorrectFee(uint256)feeRegistry.getContractCaseFeeForCode(...)β may revert withTooBigPct()(bubbled)feeRegistry.takeFee(...)β may revert per FeeRegistry implementation (bubbled)lifetimeNft.mint(...)β may revert per token implementation (bubbled)lifetimeNft.approve(...)β may revert per token implementation (bubbled)ILockChainGate.lockLifetimeNft(...)β may revert per LockChainGate implementation (bubbled)Refund to
msg.senderfails βTransferFeeFailed(bytes)
Overrides: None
Function Calls:
_payFee(bytes8,address,uint8,uint256,uint256,uint256[],uint256[]) β CryptoLegacyBuildManager, internal
Called by: None (entry point)
Gas / Complexity note: O(1); lifetime path is O(n) by _lockToChainIds.length.
Example: User pays an update fee with referral:
_payFee (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: Internal fee engine for build/update/lifetime fees, handling payment and optional NFT mint/lock.
Detailed Description: Computes curValue = msg.value - _subValue. Reads feeToTake for _feeCase and lifetimeFee. If lifetimeFee > 0 and curValue >= lifetimeFee, switches _feeCase to lifetime and sets _mul = 1. Verifies sufficiency via _checkFee. Forwards feeToTake to feeRegistry.takeFee. Computes restValue = curValue - feeToTake. If lifetime case, calls _mintAndLockLifetimeNft and updates restValue. Finally refunds any remainder via _returnFee and returns restValue.
Parameters:
_code (bytes8): Referral code
_toHolder (address): Recipient/holder for lifetime NFT case
_feeCase (uint8): REGISTRY_BUILD_CASE | REGISTRY_UPDATE_CASE | REGISTRY_LIFETIME_CASE
_mul (uint256): Multiplier
_subValue (uint256): Value to subtract from msg.value before fee logic
_chainIds (uint256[], memory): Chain IDs for locking
_crossChainFees (uint256[], memory): Native fees per chain (or zeros)
Returns:
restValue (uint256): Final remainder in wei (after fee and optional locking)
Modifiers / Visibility / Mutability:
internal nonpayable
Access Control:
Unrestricted
Side Effects:
Forwards ETH to
feeRegistryMay mint and lock a Lifetime NFT
Approves
feeRegistryto transfer the minted Lifetime NFTMay refund unused ETH
Emits: None
Reverts if:
feeRegistry.getContractCaseFeeForCode(...)β may revert withTooBigPct()(bubbled)msg.value - _subValue < feeToTakeβIncorrectFee(uint256)feeRegistry.takeFee(...)β may revert withIncorrectFee(uint256)orTooBigPct()(bubbled)lifetimeNft.mint(...)β may revert per token implementation (bubbled)lifetimeNft.approve(...)β may revert per token implementation (bubbled)ILockChainGate.lockLifetimeNft(...)β may revert with"ERC721: transfer from incorrect owner"or per ERC721 implementation,AlreadyLocked(),ArrayLengthMismatch(),CrossChainLock(),DestinationChainNotSpecified(),AlreadyLockedToChain(),IncorrectFee(uint256), orTransferFeeFailed(bytes)(bubbled)Refund to
msg.senderfails βTransferFeeFailed(bytes)
Overrides: None
Function Calls:
getContractCaseFeeForCode(address,uint8,bytes8) β IFeeRegistry (at
feeRegistry), external (staticcall)getContractCaseFeeForCode(address,uint8,bytes8) β IFeeRegistry (at
feeRegistry), external (staticcall)_checkFee(uint256,uint256) β CryptoLegacyBuildManager, internal
takeFee(address,uint8,bytes8,uint256) β IFeeRegistry (at
feeRegistry), external_mintAndLockLifetimeNft(address,uint256[],uint256[],uint256) β CryptoLegacyBuildManager, internal
_returnFee(uint256) β CryptoLegacyBuildManager, internal
Called by:
payFee β CryptoLegacyBuildManager
payInitialFee β CryptoLegacyBuildManager
_getAndPayBuildFee(bytes8,uint256,uint256[],uint256[]) β CryptoLegacyBuildManager
Gas / Complexity note: O(1); lifetime path is O(n) by _chainIds.length.
Example: Not applicable
_returnFee (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: Refund helper to return surplus ETH to the caller.
Detailed Description: If _returnValue > 0, performs a low-level call to msg.sender transferring _returnValue. Reverts with TransferFeeFailed(data) if the refund fails.
Parameters:
_returnValue (uint256): Amount to refund in wei
Returns: None
Modifiers / Visibility / Mutability:
internal nonpayable
Access Control:
Unrestricted
Side Effects:
Transfers ETH to
msg.sender
Emits: None
Reverts if:
Low-level refund to
msg.senderfails βTransferFeeFailed(bytes)
Overrides: None
Function Calls:
payable(msg.sender).call(bytes)β address (atmsg.sender), external
Called by:
_payFee β CryptoLegacyBuildManager
createCustomRef β CryptoLegacyBuildManager
createRef β CryptoLegacyBuildManager
updateCrossChainsRef(uint256[],uint256[]) β CryptoLegacyBuildManager
Gas / Complexity note: O(1)
Example: Not applicable
_checkFee (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: Validates that _value covers _fee.
Detailed Description: Pure check that reverts with IncorrectFee(_fee) if _value < _fee.
Parameters:
_value (uint256): Provided value
_fee (uint256): Required fee
Returns: None
Modifiers / Visibility / Mutability:
internal pure
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
_value < _fee β
IncorrectFee(uint256)
Overrides: None
Function Calls: None
Called by:
_payFee β CryptoLegacyBuildManager
payForMultipleLifetimeNft β CryptoLegacyBuildManager
_createCustomRef β CryptoLegacyBuildManager
_createRef β CryptoLegacyBuildManager
updateCrossChainsRef(uint256[],uint256[]) β CryptoLegacyBuildManager
Gas / Complexity note: O(1)
Example: Not applicable
_mintAndLockLifetimeNft (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: Mints a Lifetime NFT to this contract, approves the registry, and locks it cross-chain.
Detailed Description: Mints a new NFT via lifetimeNft.mint(address(this)), approves feeRegistry for the token, then calls the lock-gate to lock the token to _tokenOwner across _chainIds using _crossChainFees, forwarding _valueToSend. Returns the remainder from the lock call.
Parameters:
_tokenOwner (address): Final owner to which the locked NFT is attributed
_chainIds (uint256[], memory): Destination chain IDs
_crossChainFees (uint256[], memory): Per-chain native fees
_valueToSend (uint256): ETH to forward with the lock call
Returns:
returnValue (uint256): Unused ETH returned from the lock call
Modifiers / Visibility / Mutability:
internal nonpayable
Access Control:
Unrestricted
Side Effects:
Mints ERC-721 to this contract
Approves
feeRegistryfortokenIdTransfers ERC-721 from this contract to
feeRegistry(LockChainGate)Forwards ETH to lock-gate (external state change)
Emits: None
Reverts if:
lifetimeNft.mint(address)β may revert per token implementation (bubbled)lifetimeNft.approve(address,uint256)β may revert per token implementation (bubbled)ILockChainGate.lockLifetimeNft(...)β may revert with"ERC721: transfer from incorrect owner"or per ERC721 implementation,AlreadyLocked(),ArrayLengthMismatch(),CrossChainLock(),DestinationChainNotSpecified(),AlreadyLockedToChain(),IncorrectFee(uint256), orTransferFeeFailed(bytes)(bubbled)
Overrides: None
Function Calls:
mint(address) β ILifetimeNft (at
lifetimeNft), externalapprove(address,uint256)β ILifetimeNft (atlifetimeNft), externallockLifetimeNft(uint256,address,uint256[],uint256[]) β ILockChainGate (at
feeRegistry), external
Called by:
_payFee β CryptoLegacyBuildManager
Gas / Complexity note: O(1); lock call is O(n) by _chainIds.length.
Example: Not applicable
payInitialFee (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: Pays the initial build fee (or lifetime) and optionally locks a Lifetime NFT.
Detailed Description: Delegates to _payFee with REGISTRY_BUILD_CASE. _payFee determines the applicable fee, forwards it to feeRegistry, optionally mints/locks a Lifetime NFT, and refunds any remainder.
Parameters:
_code (bytes8): Referral code (build case)
_toHolder (address): Recipient of NFT if lifetime case is chosen
_lockToChainIds (uint256[], memory): Chains to lock to
_crossChainFees (uint256[], memory): Native fees per chain
Returns:
returnValue (uint256): Refunded remainder (in wei)
Modifiers / Visibility / Mutability:
public payable
Access Control:
Unrestricted
Side Effects:
Forwards ETH to
feeRegistryMay mint & lock Lifetime NFT
May refund unused ETH
Emits: None
Reverts if:
Insufficient
msg.valuefor required build/lifetime fee βIncorrectFee(uint256)feeRegistry.getContractCaseFeeForCode(...)β may revert withTooBigPct()(bubbled)feeRegistry.takeFee(...)β may revert withIncorrectFee(uint256)orTooBigPct()(bubbled)lifetimeNft.mint(...)β may revert per token implementation (bubbled)lifetimeNft.approve(...)β may revert per token implementation (bubbled)ILockChainGate.lockLifetimeNft(...)β may revert with"ERC721: transfer from incorrect owner"or per ERC721 implementation,AlreadyLocked(),ArrayLengthMismatch(),CrossChainLock(),DestinationChainNotSpecified(),AlreadyLockedToChain(),IncorrectFee(uint256), orTransferFeeFailed(bytes)(bubbled)Refund to
msg.senderfails βTransferFeeFailed(bytes)
Overrides: ICryptoLegacyBuildManager
Function Calls:
_payFee(bytes8,address,uint8,uint256,uint256,uint256[],uint256[]) β CryptoLegacyBuildManager, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example:
payForMultipleLifetimeNft (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: Mass mints Lifetime NFTs when supply threshold is met.
Detailed Description: Requires lifetimeNft.totalSupply() >= minMassMintSupply. Fetches lifetimeFee, checks msg.value >= lifetimeFee. Computes totalAmount = msg.value / lifetimeFee and forwards the full value to feeRegistry.takeFee. Iterates _lifetimeNftMints; for each entry, mints amount NFTs to toHolder, emitting PaidForMint per mint. Ensures mintAmount == totalAmount, otherwise reverts IncorrectFee(uint256). Emits PaidForMultipleNft at end.
Parameters:
_code (bytes8): Referral code influencing lifetime fee
_lifetimeNftMints (LifetimeNftMint[], memory): Recipients and per-recipient mint counts
Returns: None
Modifiers / Visibility / Mutability:
public payable
Access Control:
Unrestricted
Side Effects:
Forwards
msg.valuetofeeRegistry.takeFeeMints multiple ERC-721 tokens to recipients
Emits:
PaidForMint β
PaidForMint(address indexed sender, uint256 indexed tokenId, address indexed toHolder)PaidForMultipleNft β
PaidForMultipleNft(address indexed sender, bytes8 indexed code, uint256 value, uint256 totalAmount)
Reverts if:
feeRegistry.getContractCaseFeeForCode(...)β may revert withTooBigPct()(bubbled)msg.value < lifetimeFeeβIncorrectFee(uint256)feeRegistry.takeFee(...)β may revert withIncorrectFee(uint256)orTooBigPct()(bubbled)lifetimeNft.mint(...)β may revert per token implementation (bubbled)mintAmount != totalAmountβIncorrectFee(uint256)
Overrides: None
Function Calls:
lifetimeNft.totalSupply()β ILifetimeNft, external (staticcall)getContractCaseFeeForCode(address,uint8,bytes8) β IFeeRegistry, external (staticcall)
_checkFee(uint256,uint256) β CryptoLegacyBuildManager, internal
takeFee(address,uint8,bytes8,uint256) β IFeeRegistry, external
mint(address) β ILifetimeNft (at
lifetimeNft), external
Called by: None (entry point)
Gas / Complexity note: O(T) where T = sum(_lifetimeNftMintsi.amount)
Example:
createCustomRef (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: Creates a custom referral code and optionally locks it cross-chain; refunds any surplus.
Detailed Description: Delegates to internal _createCustomRef that validates and pays cross-chain fees, then refunds any remainder via _returnFee.
Parameters:
_customRefCode (bytes8): Desired custom referral code
_recipient (address): Address receiving referral benefits
_chainIds (uint256[], memory): Destination chains (optional)
_crossChainFees (uint256[], memory): Per-chain native fees (or zeros)
Returns:
refCode (bytes8): Created/assigned code
crossChainFee (uint256): Total native fee used
returnValue (uint256): Refunded remainder
Modifiers / Visibility / Mutability:
public payable
Access Control:
Unrestricted
Side Effects:
Forwards ETH to
feeRegistry(via_createCustomRef)May refund unused ETH to
msg.sender
Emits:
CreateCustomRef β
CreateCustomRef(address indexed sender, bytes8 indexed refCode, address indexed recipient, uint256[] chainIds)
Reverts if:
msg.value < valueToSendβIncorrectFee(uint256)feeRegistry.createCustomCode(...)β may revert withNotOperator(),RefAlreadyCreated(),ZeroCode(),AlreadyReferrer(),ArrayLengthMismatch(),DestinationChainNotSpecified(), orTransferFeeFailed(bytes)(bubbled)Refund to
msg.senderfails βTransferFeeFailed(bytes)
Overrides: None
Function Calls:
_createCustomRef(bytes8,address,uint256[],uint256[]) β CryptoLegacyBuildManager, internal
_returnFee(uint256) β CryptoLegacyBuildManager, internal
Called by: None (entry point)
Gas / Complexity note: O(n) by _crossChainFees.length
Example:
_createCustomRef (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: Internal custom-ref creation with cross-chain fee handling.
Detailed Description: Computes valueToSend via calculateCrossChainCreateRefFee. Ensures sufficiency using _checkFee. Calls feeRegistry.createCustomCode{value: valueToSend} and emits CreateCustomRef. Returns (refCode, crossChainFee, returnValue) where returnValue combines unused local ETH and any refund from the registry.
Parameters:
_customRefCode (bytes8): Desired code
_recipient (address): Referral recipient
_chainIds (uint256[], memory): Chains to enable
_crossChainFees (uint256[], memory): Per-chain fees (or zeros to auto-quote)
Returns:
refCode (bytes8): Resulting code
crossChainFee (uint256): Total fee used
returnValue (uint256): Surplus (local + registry refund)
Modifiers / Visibility / Mutability:
internal nonpayable
Access Control:
Unrestricted (internal)
Side Effects:
Forwards ETH to
feeRegistry.createCustomCodeReceives any refund from
feeRegistry(if returned)
Emits:
CreateCustomRef β
CreateCustomRef(address indexed sender, bytes8 indexed refCode, address indexed recipient, uint256[] chainIds)
Reverts if:
msg.value < valueToSendβIncorrectFee(uint256)feeRegistry.createCustomCode(...)β may revert withNotOperator(),RefAlreadyCreated(),ZeroCode(),AlreadyReferrer(),ArrayLengthMismatch(),DestinationChainNotSpecified(), orTransferFeeFailed(bytes)(bubbled)
Overrides: None
Function Calls:
calculateCrossChainCreateRefFee(uint256[],uint256[]) β CryptoLegacyBuildManager, internal
_checkFee(uint256,uint256) β CryptoLegacyBuildManager, internal
createCustomCode(address,address,bytes8,uint256[],uint256[]) β IFeeRegistry, external
Called by:
createCustomRef β CryptoLegacyBuildManager
_createRefAndPayForBuild β CryptoLegacyBuildManager
Gas / Complexity note: O(n) by _crossChainFees.length
Example: Not applicable
createRef (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: Creates a short referral code and optionally locks it cross-chain; refunds surplus.
Detailed Description: Delegates to internal _createRef that validates/forwards cross-chain fees and returns surplus, which is refunded via _returnFee.
Parameters:
_recipient (address): Referral recipient
_chainIds (uint256[], memory): Destination chains
_crossChainFees (uint256[], memory): Per-chain native fees (or zeros)
Returns:
refCode (bytes8): New short code
crossChainFee (uint256): Total fee used
returnValue (uint256): Refunded remainder
Modifiers / Visibility / Mutability:
public payable
Access Control:
Unrestricted
Side Effects:
Forwards ETH to
feeRegistryUpdates referral state in
feeRegistry(external)May refund ETH to
msg.sendervia_returnFee
Emits:
CreateRef β
CreateRef(address indexed sender, bytes8 indexed refCode, address indexed recipient, uint256[] chainIds)
Reverts if:
_crossChainFeesempty or contains zeros βILockChainGate(feeRegistry).calculateCrossChainCreateRefNativeFee(...)may revert per implementation (bubbled)msg.value < valueToSendβIncorrectFee(uint256)feeRegistry.createCode(...)β may revert withNotOperator(),RefAlreadyCreated(),ZeroCode(),AlreadyReferrer(),ArrayLengthMismatch(),DestinationChainNotSpecified(),IncorrectFee(uint256), orTransferFeeFailed(bytes)(bubbled)refund to caller fails β
TransferFeeFailed(bytes)
Overrides: None
Function Calls:
_createRef(address,uint256[],uint256[]) β CryptoLegacyBuildManager, internal
_returnFee(uint256) β CryptoLegacyBuildManager, internal
Called by: None (entry point)
Gas / Complexity note: O(n) by _crossChainFees.length
Example:
_createRef (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: Internal short-ref creation with cross-chain fee handling.
Detailed Description: Computes valueToSend via calculateCrossChainCreateRefFee. Ensures sufficiency via _checkFee. Calls feeRegistry.createCode{value: valueToSend} and emits CreateRef. Returns (refCode, crossChainFee, returnValue) combining local surplus and any registry refund.
Parameters:
_recipient (address): Referral recipient
_chainIds (uint256[], memory): Chains to enable
_crossChainFees (uint256[], memory): Per-chain fees or zeros
Returns:
refCode (bytes8): Resulting short code
crossChainFee (uint256): Total fee used
returnValue (uint256): Surplus (local + registry refund)
Modifiers / Visibility / Mutability:
internal nonpayable
Access Control:
Unrestricted (internal)
Side Effects:
Forwards ETH to
feeRegistryUpdates referral state in
feeRegistry(external)
Emits:
CreateRef β
CreateRef(address indexed sender, bytes8 indexed refCode, address indexed recipient, uint256[] chainIds)
Reverts if:
_crossChainFeesempty or contains zeros βILockChainGate(feeRegistry).calculateCrossChainCreateRefNativeFee(...)may revert per implementation (bubbled)msg.value < valueToSendβIncorrectFee(uint256)feeRegistry.createCode(...)β may revert withNotOperator(),RefAlreadyCreated(),ZeroCode(),AlreadyReferrer(),ArrayLengthMismatch(),DestinationChainNotSpecified(),IncorrectFee(uint256), orTransferFeeFailed(bytes)(bubbled)
Overrides: None
Function Calls:
calculateCrossChainCreateRefFee(uint256[],uint256[]) β CryptoLegacyBuildManager, internal
_checkFee(uint256,uint256) β CryptoLegacyBuildManager, internal
createCode(address,address,uint256[],uint256[]) β IFeeRegistry (at
feeRegistry), external
Called by:
createRef β CryptoLegacyBuildManager
_createRefAndPayForBuild β CryptoLegacyBuildManager
Gas / Complexity note: O(n) by _crossChainFees.length
Example: Not applicable
updateCrossChainsRef (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: Updates chain coverage for the callerβs referral code.
Detailed Description: Computes cross-chain fee via calculateCrossChainCreateRefFee, ensures sufficiency via _checkFee, updates chains via feeRegistry.updateCrossChainsRef{value: valueToSend}, emits SetCrossChainsRef, then refunds any returnValue.
Parameters:
_chainIds (uint256[], memory): Destination chain IDs to set/update
_crossChainFees (uint256[], memory): Per-chain native fees or zeros
Returns:
crossChainFee (uint256): Total fee used
returnValue (uint256): Refunded remainder
Modifiers / Visibility / Mutability:
external payable
Access Control:
Unrestricted
Side Effects:
Forwards ETH to
feeRegistrySends cross-chain update messages via
feeRegistryMay refund ETH to
msg.sendervia_returnFee
Emits:
SetCrossChainsRef β
SetCrossChainsRef(address indexed sender, uint256[] chainIds)
Reverts if:
_crossChainFeesempty or contains zeros βILockChainGate(feeRegistry).calculateCrossChainCreateRefNativeFee(...)may revert per implementation (bubbled)msg.value < valueToSendβIncorrectFee(uint256)feeRegistry.updateCrossChainsRef(...)β may revert withNotOperator(),CodeNotCreated(),ArrayLengthMismatch(),DestinationChainNotSpecified(),IncorrectFee(uint256), orTransferFeeFailed(bytes)(bubbled)refund to caller fails β
TransferFeeFailed(bytes)
Overrides: None
Function Calls:
calculateCrossChainCreateRefFee(uint256[],uint256[]) β CryptoLegacyBuildManager, internal
_checkFee(uint256,uint256) β CryptoLegacyBuildManager, internal
updateCrossChainsRef(uint256[],uint256[]) β IFeeRegistry (at
feeRegistry), external_returnFee(uint256) β CryptoLegacyBuildManager, internal
Called by: None (entry point)
Gas / Complexity note: O(n) by _crossChainFees.length
Example:
_createRefAndPayForBuild (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: Internal helper to optionally create a referral and then obtain/pay the build fee.
Detailed Description: If _refArgs.createRefRecipient != address(0), creates a referral:
If
_refArgs.createRefCustomCode == 0, calls_createRef; otherwise calls_createCustomRef.Stores the spent cross-chain fee as
subValue, then calls_getAndPayBuildFeewith_buildArgs.invitedByRefCodeandsubValue. ReturnsinitialFeeToPayandupdateFee.
Parameters:
_buildArgs (BuildArgs, memory): Build parameters (includes invitedByRefCode)
_refArgs (RefArgs, memory): Referral creation parameters
Returns:
initialFeeToPay (uint256): Initial build fee owed (0 if lifetime/locked)
updateFee (uint256): Subsequent update fee
Modifiers / Visibility / Mutability:
internal nonpayable
Access Control:
Unrestricted (internal)
Side Effects:
May forward ETH to
feeRegistryvia referral creation and build-fee paymentMay mint and lock a lifetime NFT via
lifetimeNftandILockChainGate(address(feeRegistry))(in_getAndPayBuildFee)May refund ETH to
msg.sendervia_returnFee
Emits:
CreateRef β
CreateRef(address indexed sender, bytes8 indexed refCode, address indexed recipient, uint256[] chainIds)(conditional)CreateCustomRef β
CreateCustomRef(address indexed sender, bytes8 indexed refCode, address indexed recipient, uint256[] chainIds)(conditional)
Reverts if:
_createRef(...)or_createCustomRef(...)checks fail βIncorrectFee(uint256)feeRegistry.createCode(...)β may revert withNotOperator(),RefAlreadyCreated(),ZeroCode(),AlreadyReferrer(),ArrayLengthMismatch(),DestinationChainNotSpecified(),IncorrectFee(uint256), orTransferFeeFailed(bytes)(bubbled)feeRegistry.createCustomCode(...)β may revert withNotOperator(),RefAlreadyCreated(),ZeroCode(),AlreadyReferrer(),ArrayLengthMismatch(),DestinationChainNotSpecified(),IncorrectFee(uint256), orTransferFeeFailed(bytes)(bubbled)feeRegistry.getContractCaseFeeForCode(...)β may revert withTooBigPct()(bubbled)feeRegistry.takeFee(...)β may revert withIncorrectFee(uint256)orTooBigPct()(bubbled)lifetimeNft.mint(...)β may revert per token implementation (bubbled)lifetimeNft.approve(...)β may revert per token implementation (bubbled)ILockChainGate.lockLifetimeNft(...)β may revert with"ERC721: transfer from incorrect owner",AlreadyLocked(),ArrayLengthMismatch(),CrossChainLock(),DestinationChainNotSpecified(),AlreadyLockedToChain(),IncorrectFee(uint256), orTransferFeeFailed(bytes)(bubbled)ILockChainGate.isNftLockedAndUpdate(...)β may revert withNotAllowed()(bubbled)refund to caller fails β
TransferFeeFailed(bytes)
Overrides: None
Function Calls:
_createRef(address,uint256[],uint256[]) β CryptoLegacyBuildManager, internal
_createCustomRef(bytes8,address,uint256[],uint256[]) β CryptoLegacyBuildManager, internal
_getAndPayBuildFee(bytes8,uint256,uint256[],uint256[]) β CryptoLegacyBuildManager, internal
Called by:
buildCryptoLegacy β CryptoLegacyBuildManager
Gas / Complexity note: O(n) by _refArgs.crossChainFees.length (when creating refs)
Example: Not applicable
buildCryptoLegacy (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: Deploys and initializes a new CryptoLegacy instance after handling referral creation and fees.
Detailed Description: Calls _createRefAndPayForBuild to optionally create refs and compute/pay the build fee, then validates timeouts via _checkBuildArgs. Deploys a new contract using factory.createCryptoLegacy, marks it as built in cryptoLegacyBuilt, and calls CryptoLegacyBasePlugin.initializeByBuildManager with fees, beneficiaries, and timing parameters. Emits Build and returns the deployed address.
Parameters:
_buildArgs (BuildArgs, memory): Build arguments containing inviter ref code, beneficiaries, plugins, update interval, and challenge timeout
_refArgs (RefArgs, memory): Referral-creation arguments
_create2Args (ICryptoLegacyFactory.Create2Args, memory): Deterministic deployment args
Returns:
cl (address payable): Newly deployed CryptoLegacy address
Modifiers / Visibility / Mutability:
public payable
Access Control:
Unrestricted
Side Effects:
Updates
cryptoLegacyBuilt[cl]Deploys a new CryptoLegacy via
factory.createCryptoLegacy(external)Initializes the deployed contract via
CryptoLegacyBasePlugin.initializeByBuildManager(external state changes)May forward ETH to
feeRegistryvia referral creation and/or build-fee paymentMay mint and lock a lifetime NFT via
lifetimeNftandILockChainGate(address(feeRegistry))(conditional)May refund ETH to
msg.sender(conditional)May update referral state in
feeRegistry(conditional, via ref creation)May update lifetime lock timestamp via
ILockChainGate.isNftLockedAndUpdate(conditional)
Emits:
Build β
Build(address indexed sender, address indexed cryptoLegacy, address[] plugins, bytes32[] beneficiaryHashes, ICryptoLegacy.BeneficiaryConfig[] beneficiaryConfig, bool isPaid, uint64 updateInterval, uint64 challengeTimeout)
Reverts if:
_buildArgs.updateInterval != 180 days β
NotValidTimeout()_buildArgs.challengeTimeout != 90 days β
NotValidTimeout()msg.value minus spent referral fee is below required build fee β
IncorrectFee(uint256)(via_getAndPayBuildFee)msg.value < required referral fee (when creating a ref) β
IncorrectFee(uint256)(via_createRefor_createCustomRef)ILockChainGate(feeRegistry).calculateCrossChainCreateRefNativeFee(...)β may revert per implementation (bubbled)feeRegistry.createCode(...)β may revert withNotOperator(),RefAlreadyCreated(),ZeroCode(),AlreadyReferrer(),ArrayLengthMismatch(),DestinationChainNotSpecified(),IncorrectFee(uint256), orTransferFeeFailed(bytes)(bubbled)feeRegistry.createCustomCode(...)β may revert withNotOperator(),RefAlreadyCreated(),ZeroCode(),AlreadyReferrer(),ArrayLengthMismatch(),DestinationChainNotSpecified(),IncorrectFee(uint256), orTransferFeeFailed(bytes)(bubbled)feeRegistry.getContractCaseFeeForCode(...)β may revert withTooBigPct()(bubbled)feeRegistry.takeFee(...)β may revert withIncorrectFee(uint256)orTooBigPct()(bubbled)lifetimeNft.mint(...)β may revert per token implementation (bubbled)lifetimeNft.approve(...)β may revert per token implementation (bubbled)ILockChainGate.lockLifetimeNft(...)β may revert with"ERC721: transfer from incorrect owner",AlreadyLocked(),ArrayLengthMismatch(),CrossChainLock(),DestinationChainNotSpecified(),AlreadyLockedToChain(),IncorrectFee(uint256), orTransferFeeFailed(bytes)(bubbled)ILockChainGate.isNftLockedAndUpdate(...)β may revert withNotAllowed()(bubbled)Refund to msg.sender fails β
TransferFeeFailed(bytes)(via_returnFee)factory.createCryptoLegacy(...)β may revert withNotBuildOperator(),BytecodeEmpty(),panic(0x11),AddressMismatch(),TargetAlreadyExists(),ErrorCreatingProxy(), orErrorCreatingContract()(bubbled)initializeByBuildManager(...)β may revert withNotBuildManager(),LengthMismatch(),OriginalHashDuplicate(),ShareSumDoesntMatchBase(),ChallengePeriodStarted(), or "Initializable: contract is already initialized" (bubbled)
Overrides: None
Function Calls:
_createRefAndPayForBuild(BuildArgs,RefArgs) β CryptoLegacyBuildManager, internal
_checkBuildArgs(BuildArgs) β CryptoLegacyBuildManager, internal
createCryptoLegacy(address,address[],Create2Args) β ICryptoLegacyFactory (at
factory), externalinitializeByBuildManager(uint256,uint256,bytes32[],BeneficiaryConfig[],bytes8,uint64,uint64) β CryptoLegacyBasePlugin (at
cl), external
Called by: None (entry point)
Gas / Complexity note: O(p + b), where p is the number of plugins and b is the number of beneficiary entries (runtime is dominated by initialization inside initializeByBuildManager).
Example:
_checkBuildArgs (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: Validates required default timeouts in build arguments.
Detailed Description: Ensures _buildArgs.updateInterval == 180 days and _buildArgs.challengeTimeout == 90 days. Otherwise reverts NotValidTimeout().
Parameters:
_buildArgs (BuildArgs, memory): Build arguments containing timing fields
Returns: None
Modifiers / Visibility / Mutability:
internal nonpayable
Access Control:
Unrestricted (internal)
Side Effects: None
Emits: None
Reverts if:
_buildArgs.updateInterval != 180 days β
NotValidTimeout()_buildArgs.challengeTimeout != 90 days β
NotValidTimeout()
Overrides: None
Function Calls: None
Called by:
buildCryptoLegacy β CryptoLegacyBuildManager
Gas / Complexity note: O(1)
Example: Not applicable
_getAndPayBuildFee (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: Retrieves (and optionally pays) the initial build fee and always returns the update fee.
Detailed Description: If msg.value - _subValue > 0, calls _payFee with REGISTRY_BUILD_CASE; otherwise reads initialFeeToPay from feeRegistry.getContractCaseFeeForCode. If the caller has a locked lifetime NFT (checked via ILockChainGate.isNftLockedAndUpdate), sets initialFeeToPay = 0. Finally reads the updateFee for the supplied referral code.
Parameters:
_invitedByRefCode (bytes8): Referral code
_subValue (uint256): Amount already spent (deducted from msg.value)
_chainIds (uint256[], memory): Chains for potential locking (if paying now)
_crossChainFees (uint256[], memory): Per-chain fees (if paying now)
Returns:
initialFeeToPay (uint256): Initial fee owed (0 if lifetime locked)
updateFee (uint256): Update fee for future operations
Modifiers / Visibility / Mutability:
internal nonpayable
Access Control:
Unrestricted (internal)
Side Effects:
May forward ETH to
feeRegistry(via_payFee, conditional)May mint and lock a lifetime NFT via
lifetimeNftandILockChainGate(address(feeRegistry))(via_payFee, conditional)May refund ETH to
msg.sender(via_payFee)May update lifetime lock timestamp in
ILockChainGate(viaisNftLockedAndUpdate)
Emits: None
Reverts if:
Paying path: msg.value - _subValue < feeToTake β
IncorrectFee(uint256)(via_payFee)feeRegistry.getContractCaseFeeForCode(...)β may revert withTooBigPct()(bubbled)feeRegistry.takeFee(...)β may revert withIncorrectFee(uint256)orTooBigPct()(bubbled, via_payFee)lifetimeNft.mint(...)β may revert per token implementation (bubbled, via_payFee)lifetimeNft.approve(...)β may revert per token implementation (bubbled, via_payFee)ILockChainGate.lockLifetimeNft(...)β may revert with"ERC721: transfer from incorrect owner",AlreadyLocked(),ArrayLengthMismatch(),CrossChainLock(),DestinationChainNotSpecified(),AlreadyLockedToChain(),IncorrectFee(uint256), orTransferFeeFailed(bytes)(bubbled, via_payFee)ILockChainGate.isNftLockedAndUpdate(...)β may revert withNotAllowed()(bubbled)Refund to msg.sender fails β
TransferFeeFailed(bytes)(via_payFee)
Overrides: None
Function Calls:
_payFee(bytes8,address,uint8,uint256,uint256,uint256[],uint256[]) β CryptoLegacyBuildManager, internal
getContractCaseFeeForCode(address,uint8,bytes8) β IFeeRegistry (at
feeRegistry), external (staticcall)isNftLockedAndUpdate(address) β ILockChainGate (at
feeRegistry), externalgetContractCaseFeeForCode(address,uint8,bytes8) β IFeeRegistry (at
feeRegistry), external (staticcall)
Called by:
_createRefAndPayForBuild β CryptoLegacyBuildManager
getAndPayBuildFee β CryptoLegacyBuildManager
Gas / Complexity note: O(1)
Example: Not applicable
getUpdateFee (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: Returns the configured update fee for a referral code.
Detailed Description: Thin view wrapper over the fee registry.
Parameters:
_refCode (bytes8): Referral code
Returns:
updateFee (uint256): Update fee in wei
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
feeRegistry.getContractCaseFeeForCode(...)β may revert withTooBigPct()(bubbled)
Overrides: None
Function Calls:
getContractCaseFeeForCode(address,uint8,bytes8) β IFeeRegistry (at
feeRegistry), external (staticcall)
Called by: None (entry point)
Gas / Complexity note: O(1)
Example:
getAndPayBuildFee (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: Convenience entry point to fetch build/update fees and optionally pay if ETH is sent.
Detailed Description: Allocates empty arrays and delegates to _getAndPayBuildFee. If msg.value > 0, the internal call pays immediately; otherwise it reads the current fee quotes. In both paths it calls ILockChainGate.isNftLockedAndUpdate, which may zero initialFeeToPay for a locked lifetime NFT.
Parameters:
_invitedByRefCode (bytes8): Referral code
Returns:
initialFeeToPay (uint256): Initial build fee (zero if lifetime locked)
updateFee (uint256): Update fee for future operations
Modifiers / Visibility / Mutability:
external payable
Access Control:
Unrestricted
Side Effects:
May forward ETH to
feeRegistry(via_payFee, conditional)May mint and lock a lifetime NFT via
lifetimeNftandILockChainGate(address(feeRegistry))(via_payFee, conditional)May refund ETH to
msg.sender(via_payFee, conditional)May update lifetime lock timestamp in
ILockChainGate(viaisNftLockedAndUpdate)
Emits: None
Reverts if:
feeRegistry.getContractCaseFeeForCode(...)β may revert withTooBigPct()(bubbled, build fee quote)feeRegistry.getContractCaseFeeForCode(...)β may revert withTooBigPct()(bubbled, via_payFee, lifetime fee quote)msg.valueis insufficient for the required build/lifetime fee (paying path) βIncorrectFee(uint256)(via_payFee)feeRegistry.takeFee(...)β may revert withIncorrectFee(uint256)orTooBigPct()(bubbled, via_payFee)lifetimeNft.mint(...)β may revert per token implementation (bubbled, via_payFee)lifetimeNft.approve(...)β may revert per token implementation (bubbled, via_payFee)ILockChainGate.lockLifetimeNft(...)β may revert with"ERC721: transfer from incorrect owner",AlreadyLocked(),ArrayLengthMismatch(),CrossChainLock(),DestinationChainNotSpecified(),AlreadyLockedToChain(),IncorrectFee(uint256), orTransferFeeFailed(bytes)(bubbled, via_payFee)Refund to
msg.senderfails βTransferFeeFailed(bytes)(via_payFee)ILockChainGate.isNftLockedAndUpdate(...)β may revert withNotAllowed()(bubbled)feeRegistry.getContractCaseFeeForCode(...)β may revert withTooBigPct()(bubbled, update fee quote)
Overrides: None
Function Calls:
_getAndPayBuildFee(bytes8,uint256,uint256[],uint256[]) β CryptoLegacyBuildManager, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example:
transferStuckNft (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: Owner rescue function to transfer out an ERC721 token held by this contract.
Detailed Description: Transfers tokenId of lifetimeNft from this contract to to via safeTransferFrom. Useful to recover erroneously sent NFTs.
Parameters:
to (address): Recipient address
tokenId (uint256): ERC721 token ID
Returns: None
Modifiers / Visibility / Mutability:
external nonpayable onlyOwner
Access Control:
onlyOwner
Side Effects:
Transfers
tokenIdoflifetimeNftfrom this contract toto
Emits: None
Reverts if:
caller is not owner β "Ownable: caller is not the owner"
IERC721(lifetimeNft).safeTransferFrom(...)β may revert per ERC721 implementation (bubbled)
Overrides: None
Function Calls:
IERC721(lifetimeNft).safeTransferFrom(address,address,uint256)β IERC721 (atlifetimeNft), external
Called by: None (entry point)
Gas / Complexity note: O(1)
Example:
onERC721Received (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: ERC721 safe-transfer hook confirming receipt.
Detailed Description: Returns this.onERC721Received.selector if the sender is the configured lifetimeNft; otherwise returns bytes4(0) to reject. Read-only.
Parameters:
_operator (address): Caller (token contract uses this field)
_from (address): Previous token owner
_tokenId (uint256): Token ID received
_data (bytes, calldata): Extra call data
Returns:
selector (bytes4): Acceptance magic value or zero
Modifiers / Visibility / Mutability:
external view override
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
None
Overrides:
IERC721Receiver.onERC721Received
Function Calls: None
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Not applicable
calculateCrossChainCreateRefFee (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: Computes the total native fee needed to create/lock a referral across chains.
Detailed Description: If _crossChainFees is non-empty and all entries are non-zero, returns their sum. Otherwise, queries the lock-gate via calculateCrossChainCreateRefNativeFee for an up-to-date quote.
Parameters:
_chainIds (uint256[], memory): Destination chains
_crossChainFees (uint256[], memory): Per-chain fees or zeros to auto-quote
Returns:
totalFee (uint256): Total native fee required
Modifiers / Visibility / Mutability:
public view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
_crossChainFeesis empty or contains zeros βILockChainGate(feeRegistry).calculateCrossChainCreateRefNativeFee(...)may revert per implementation (bubbled)
Overrides: None
Function Calls:
calculateCrossChainCreateRefNativeFee(uint256[],uint256[]) β ILockChainGate (at
feeRegistry), external (staticcall)
Called by:
_createCustomRef β CryptoLegacyBuildManager
_createRef β CryptoLegacyBuildManager
updateCrossChainsRef(uint256[],uint256[]) β CryptoLegacyBuildManager
Gas / Complexity note: O(n) by _crossChainFees.length; if it calls the lock-gate, O(n) by _chainIds.length
Example:
getFactoryAddress (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: Returns the currently configured factory address.
Detailed Description: Simple view returning address(factory).
Parameters: None
Returns:
factoryAddr (address): Address of the deployment factory
Modifiers / Visibility / Mutability:
external view override
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
None
Overrides:
ICryptoLegacyBuildManager.getFactoryAddress
Function Calls: None
Called by: None (entry point)
Gas / Complexity note: O(1)
Example:
isLifetimeNftLocked (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: Checks whether a Lifetime NFT is locked for _owner.
Detailed Description: Proxies to the lock-gate via isNftLocked(_owner) without updating any state.
Parameters:
_owner (address): Owner to query
Returns:
locked (bool): True if locked, false otherwise
Modifiers / Visibility / Mutability:
public view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
None
Overrides:
ICryptoLegacyBuildManager.isLifetimeNftLocked
Function Calls:
isNftLocked(address) β ILockChainGate (at
feeRegistry), external (staticcall)
Called by:
isLifetimeActive() β CryptoLegacyBasePlugin
Gas / Complexity note: O(1)
Example:
isLifetimeNftLockedAndUpdate (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: For a calling CryptoLegacy, verifies ownership and then checks/updates the Lifetime NFT lock status.
Detailed Description: Requires cryptoLegacyBuilt[msg.sender] to be true, else reverts NotRegisteredCryptoLegacy(). Validates that ICryptoLegacy(msg.sender).owner() == _owner, else reverts NotOwnerOfCryptoLegacy(). Calls the lock-gate isNftLockedAndUpdate(_owner) to update and return lock status.
Parameters:
_owner (address): Expected owner of the calling CryptoLegacy
Returns:
locked (bool): Updated lock status
Modifiers / Visibility / Mutability:
public nonpayable
Access Control:
Restricted: only built CryptoLegacy contracts;
ICryptoLegacy(msg.sender).owner()must equal_owner
Side Effects:
May update lock timestamp in LockChainGate for
_ownerviaisNftLockedAndUpdate
Emits: None
Reverts if:
cryptoLegacyBuilt[msg.sender] == false βNotRegisteredCryptoLegacy()ICryptoLegacy(msg.sender).owner() != _ownerβNotOwnerOfCryptoLegacy()ILockChainGate(feeRegistry).isNftLockedAndUpdate(...)β may revert withNotAllowed()(bubbled)
Overrides:
ICryptoLegacyBuildManager.isLifetimeNftLockedAndUpdate
Function Calls:
ICryptoLegacy(msg.sender).owner()β ICryptoLegacy, external (staticcall)isNftLockedAndUpdate(address) β ILockChainGate (at
feeRegistry), external
Called by:
_isLifetimeActiveAndUpdate(ICryptoLegacy.CryptoLegacyStorage,address) β LibCryptoLegacy
Gas / Complexity note: O(1)
Example: Not applicable
isPluginRegistered (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: Checks if a plugin is registered in the plugin registry.
Detailed Description: Simple view method returning pluginsRegistry.isPluginRegistered(_plugin).
Parameters:
_plugin (address): Plugin address to query
Returns:
registered (bool): True if registered
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
None
Overrides:
ICryptoLegacyBuildManager.isPluginRegistered
Function Calls:
isPluginRegistered(address) β IPluginsRegistry (at
pluginsRegistry), external (staticcall)
Called by:
_validatePlugin(ICryptoLegacy.CryptoLegacyStorage,address) β LibCryptoLegacyPlugins
Gas / Complexity note: O(1)
Example:
isCryptoLegacyBuilt (CLBM1)
Contract/Library: CryptoLegacyBuildManager
Description: Returns whether a given CryptoLegacy address was deployed by this manager.
Detailed Description: Reads the cryptoLegacyBuilt mapping.
Parameters:
_cryptoLegacy (address): CryptoLegacy contract address
Returns:
built (bool): True if marked built
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
None
Overrides:
ICryptoLegacyBuildManager.isCryptoLegacyBuilt
Function Calls: None
Called by:
_checkBuildManagerValid(address,address) β BuildManagerOwnable
Gas / Complexity note: O(1)
Example:
CryptoLegacyDiamondBase (CLDB1)
staticCallChecker (CLDB1)
Contract/Library: CryptoLegacyDiamondBase
Description: Self-call probe used by the fallback to detect whether the current context is a static call.
Detailed Description: This function must be invoked via an external call from the contract to itself (this.staticCallChecker()). It verifies msg.sender == address(this) to ensure it is indeed a self-call; otherwise it reverts. When successfully invoked in a non-static context, it emits StaticCallCheck(). If it is invoked from within a static call (e.g., during eth_call), the attempt to execute this non-view function and emit an event causes a revert, which is caught by the caller (fallback) to infer static context.
Parameters: None
Returns: None
Modifiers / Visibility / Mutability:
external nonpayable
Access Control:
Only self-call (enforced at runtime)
Side Effects: None
Emits:
StaticCallCheck β
StaticCallCheck()
Reverts if:
msg.sender != address(this)βNotSelfCall()Executed under static context β EVM static-call violation (revert without data)
Overrides: None
Function Calls: None
Called by:
fallback β CryptoLegacyDiamondBase
Gas / Complexity note: O(1)
Example: Not applicable
fallback (CLDB1)
Contract/Library: CryptoLegacyDiamondBase
Description: Diamond fallback that routes unknown selectors to the correct facet via delegatecall, caching the facet address on non-static calls.
Detailed Description:
Loads Diamond storage (
LibDiamond.diamondStorage()) and looks up the facet address formsg.sig.If no cached facet is found:
Reads CryptoLegacy storage (
LibCryptoLegacy.getCryptoLegacyStorage()) to fetch an optionalgasLimitMultiplier.Performs a gas-limited external self-call to
staticCallChecker.If this self-call reverts, the context is interpreted as static (
isStaticCall = true).
Uses
LibCryptoLegacyPlugins._findFacetBySelectorto resolve the facet dynamically.If a facet is found and the call is not static, caches it in
selectorToFacetAndPositionmsg.sig.facetAddress.
If after lookup the facet address is still zero, reverts
FunctionNotExists(msg.sig).Otherwise, forwards the calldata and gas to the facet using
delegatecall. Return data or revert reason is bubbled to the caller.
Parameters: None
Returns: None
Modifiers / Visibility / Mutability:
fallback external payable
Access Control:
Unrestricted
Side Effects:
Updates
LibDiamond.DiamondStorage.selectorToFacetAndPositionmsg.sig.facetAddress(selector β facet cache on non-static calls)
Emits:
StaticCallCheck β
StaticCallCheck()
Reverts if:
ICryptoLegacyPlugin.getSigs()β may revert per plugin implementation (bubbled)No facet exists for
msg.sigafter lookup βFunctionNotExists(bytes4)delegatecallto facet β may revert per facet implementation (bubbled)
Overrides: None
Function Calls:
LibDiamond.diamondStorage() β LibDiamond, internal
LibCryptoLegacy.getCryptoLegacyStorage() β LibCryptoLegacy, internal
staticCallChecker() β CryptoLegacyDiamondBase, external
LibCryptoLegacyPlugins._findFacetBySelector(LibDiamond.DiamondStorage, bytes4) β LibCryptoLegacyPlugins, internal
delegatecall(gas(), facet, ...)β EVM assembly, delegatecall
Called by: None (entry point)
Gas / Complexity note: Amortized O(1) per selector (cached); worst-case O(p) on cold path, where p is the number of plugin facets scanned by _findFacetBySelector.
Example: Not applicable
CryptoLegacyExternalLens (CLEXL1)
isLifetimeActive (CLEXL1)
Contract/Library: CryptoLegacyExternalLens
Description: Forwarder that reports whether lifetime mode is active on a target CryptoLegacy.
Detailed Description: Calls isLifetimeActive() on the target contractβs base plugin and returns the result; no state changes.
Parameters:
_cryptoLegacy (address): Target CryptoLegacy diamond address
Returns:
isActive (bool): True if lifetime mode is active
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
CryptoLegacyBasePlugin(_cryptoLegacy).isLifetimeActive()β bubbled revert
Overrides: None
Function Calls:
isLifetimeActive()βCryptoLegacyBasePlugin(at_cryptoLegacy), external (staticcall)
Called by: None (entry point)
Gas / Complexity note: O(1) for the forwarder.
Example: Call isLifetimeActive(cl) to decide whether to show lifetime-NFT UI.
isPaused (CLEXL1)
Contract/Library: CryptoLegacyExternalLens
Description: Forwarder that reports whether the target CryptoLegacy is paused.
Detailed Description: Calls isPaused() on the target contractβs base plugin and returns the pause flag.
Parameters:
_cryptoLegacy (address): Target CryptoLegacy diamond address
Returns:
paused (bool): True if paused
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
CryptoLegacyBasePlugin(_cryptoLegacy).isPaused()β bubbled revert
Overrides: None
Function Calls:
isPaused()βCryptoLegacyBasePlugin(at_cryptoLegacy), external (staticcall)
Called by: None (entry point)
Gas / Complexity note: O(1) for the forwarder.
Example: Call isPaused(cl) before enabling actions.
buildManager (CLEXL1)
Contract/Library: CryptoLegacyExternalLens
Description: Returns the build manager address of the target CryptoLegacy.
Detailed Description: Calls buildManager() on the target and returns the address.
Parameters:
_cryptoLegacy (address): Target CryptoLegacy diamond address
Returns:
manager (address): Build manager address
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
ICryptoLegacy(_cryptoLegacy).buildManager()β bubbled revert
Overrides: None
Function Calls:
buildManager()βICryptoLegacy(at_cryptoLegacy), external (staticcall)
Called by: None (entry point)
Gas / Complexity note: O(1) for the forwarder.
Example: Call buildManager(cl).
owner (CLEXL1)
Contract/Library: CryptoLegacyExternalLens
Description: Returns the owner of the target CryptoLegacy.
Detailed Description: Calls owner() on the target and returns the address.
Parameters:
_cryptoLegacy (address): Target CryptoLegacy diamond address
Returns:
owner_ (address): Current owner address
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
ICryptoLegacy(_cryptoLegacy).owner()β bubbled revert
Overrides: None
Function Calls:
owner()βICryptoLegacy(at_cryptoLegacy), external (staticcall)
Called by: None (entry point)
Gas / Complexity note: O(1) for the forwarder.
Example: Call owner(cl).
_baseData (CLEXL1)
Contract/Library: CryptoLegacyExternalLens
Description: Internal helper that fetches base lens data from the target.
Detailed Description: Calls getCryptoLegacyBaseData() on the target lens interface and returns the struct.
Parameters:
_cryptoLegacy (address): Target CryptoLegacy diamond address
Returns:
data (ICryptoLegacyLens.CryptoLegacyBaseData, memory): Base data snapshot
Modifiers / Visibility / Mutability:
internal view
Access Control:
Internal only
Side Effects: None
Emits: None
Reverts if:
ICryptoLegacyLens(_cryptoLegacy).getCryptoLegacyBaseData()β may revert withFunctionNotExists(bytes4)(bubbled via diamond)
Overrides: None
Function Calls:
getCryptoLegacyBaseData() β
ICryptoLegacyLens(at_cryptoLegacy), external (staticcall)
Called by:
getCryptoLegacyBaseData(address) β CryptoLegacyExternalLens
Gas / Complexity note: O(1) for the helper.
Example: Not applicable
_listTokensData (CLEXL1)
Contract/Library: CryptoLegacyExternalLens
Description: Internal helper that fetches list data for specified tokens.
Detailed Description: Calls getCryptoLegacyListData(address[]) on the target lens interface with the provided tokens.
Parameters:
_cryptoLegacy (address): Target CryptoLegacy diamond address
_tokens (address[], memory): ERC-20 token addresses to include
Returns:
data (ICryptoLegacyLens.CryptoLegacyListData, memory): Aggregated list data
Modifiers / Visibility / Mutability:
internal view
Access Control:
Unrestricted (internal)
Side Effects: None
Emits: None
Reverts if:
ICryptoLegacyLens(_cryptoLegacy).getCryptoLegacyListData(address[])β may revert withFunctionNotExists(bytes4)(bubbled via diamond)ICryptoLegacyPlugin(facet).getPluginName()β may revert per plugin implementation (bubbled via target lens)ICryptoLegacyPlugin(facet).getPluginVer()β may revert per plugin implementation (bubbled via target lens)cls.buildManager.pluginsRegistry().getPluginDescriptionBlockNumbers(facet)β may revert per registry implementation (bubbled via target lens)
Overrides: None
Function Calls:
getCryptoLegacyListData(address[]) β
ICryptoLegacyLens(at_cryptoLegacy), external (staticcall)
Called by:
getCryptoLegacyListData(address,address[]) β CryptoLegacyExternalLens
Gas / Complexity note: O(1) for the helper; target cost scales with _tokens.length plus full beneficiary and plugin counts on the target lens.
Example: Not applicable
updateInterval (CLEXL1)
Contract/Library: CryptoLegacyExternalLens
Description: Returns the update interval of the target.
Detailed Description: Calls updateInterval() on the Lens plugin at the target address.
Parameters:
_cryptoLegacy (address): Target CryptoLegacy diamond address
Returns:
interval (uint64): Update interval in seconds
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
LensPlugin(_cryptoLegacy).updateInterval()β may revert withFunctionNotExists(bytes4)(bubbled via diamond)
Overrides: None
Function Calls:
updateInterval() β
LensPlugin(at_cryptoLegacy), external (staticcall)
Called by: None (entry point)
Gas / Complexity note: O(1) for the forwarder; target cost is O(1).
Example: Call updateInterval(cl).
challengeTimeout (CLEXL1)
Contract/Library: CryptoLegacyExternalLens
Description: Returns the challenge timeout of the target.
Detailed Description: Calls challengeTimeout() on the Lens plugin at the target address.
Parameters:
_cryptoLegacy (address): Target CryptoLegacy diamond address
Returns:
timeout (uint64): Challenge timeout in seconds
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
LensPlugin(_cryptoLegacy).challengeTimeout()β may revert withFunctionNotExists(bytes4)(bubbled via diamond)
Overrides: None
Function Calls:
challengeTimeout() β
LensPlugin(at_cryptoLegacy), external (staticcall)
Called by: None (entry point)
Gas / Complexity note: O(1) for the forwarder; target cost is O(1).
Example: Call challengeTimeout(cl).
distributionStartAt (CLEXL1)
Contract/Library: CryptoLegacyExternalLens
Description: Returns the distribution start timestamp.
Detailed Description: Calls distributionStartAt() on the Lens plugin at the target address.
Parameters:
_cryptoLegacy (address): Target CryptoLegacy diamond address
Returns:
start (uint64): Start timestamp (UNIX)
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
LensPlugin(_cryptoLegacy).distributionStartAt()β may revert withFunctionNotExists(bytes4)(bubbled via diamond)
Overrides: None
Function Calls:
distributionStartAt() β
LensPlugin(at_cryptoLegacy), external (staticcall)
Called by: None (entry point)
Gas / Complexity note: O(1) for the forwarder; target cost is O(1).
Example: Call distributionStartAt(cl).
lastFeePaidAt (CLEXL1)
Contract/Library: CryptoLegacyExternalLens
Description: Returns the timestamp of the last fee payment.
Detailed Description: Calls lastFeePaidAt() on the Lens plugin at the target address.
Parameters:
_cryptoLegacy (address): Target CryptoLegacy diamond address
Returns:
paidAt (uint64): Timestamp of the last fee payment
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
LensPlugin(_cryptoLegacy).lastFeePaidAt()β may revert withFunctionNotExists(bytes4)(bubbled via diamond)
Overrides: None
Function Calls:
lastFeePaidAt() β
LensPlugin(at_cryptoLegacy), external (staticcall)
Called by: None (entry point)
Gas / Complexity note: O(1) for the forwarder; target cost is O(1).
Example: Call lastFeePaidAt(cl).
lastUpdateAt (CLEXL1)
Contract/Library: CryptoLegacyExternalLens
Description: Returns the timestamp of the last update.
Detailed Description: Calls lastUpdateAt() on the Lens plugin at the target address.
Parameters:
_cryptoLegacy (address): Target CryptoLegacy diamond address
Returns:
updatedAt (uint64): Timestamp of the last update
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
LensPlugin(_cryptoLegacy).lastUpdateAt()β may revert withFunctionNotExists(bytes4)(bubbled via diamond)
Overrides: None
Function Calls:
lastUpdateAt() β
LensPlugin(at_cryptoLegacy), external (staticcall)
Called by: None (entry point)
Gas / Complexity note: O(1) for the forwarder; target cost is O(1).
Example: Call lastUpdateAt(cl).
initialFeeToPay (CLEXL1)
Contract/Library: CryptoLegacyExternalLens
Description: Returns the initial fee required by the target.
Detailed Description: Calls initialFeeToPay() on the Lens plugin at the target address.
Parameters:
_cryptoLegacy (address): Target CryptoLegacy diamond address
Returns:
fee (uint128): Initial fee in wei
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
LensPlugin(_cryptoLegacy).initialFeeToPay()β may revert withFunctionNotExists(bytes4)(bubbled via diamond)
Overrides: None
Function Calls:
initialFeeToPay() β
LensPlugin(at_cryptoLegacy), external (staticcall)
Called by: None (entry point)
Gas / Complexity note: O(1) for the forwarder; target cost is O(1).
Example: Call initialFeeToPay(cl).
updateFee (CLEXL1)
Contract/Library: CryptoLegacyExternalLens
Description: Returns the update fee required by the target.
Detailed Description: Calls updateFee() on the Lens plugin at the target address.
Parameters:
_cryptoLegacy (address): Target CryptoLegacy diamond address
Returns:
fee (uint128): Update fee in wei
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
LensPlugin(_cryptoLegacy).updateFee()β may revert withFunctionNotExists(bytes4)(bubbled)
Overrides: None
Function Calls:
updateFee() β
LensPlugin(at_cryptoLegacy), external (staticcall)
Called by: None (entry point)
Gas / Complexity note: O(1) for the forwarder; target cost is O(1).
Example: Call updateFee(cl).
invitedByRefCode (CLEXL1)
Contract/Library: CryptoLegacyExternalLens
Description: Returns the referral code associated with the target.
Detailed Description: Calls invitedByRefCode() on the Lens plugin at the target address.
Parameters:
_cryptoLegacy (address): Target CryptoLegacy diamond address
Returns:
refCode (bytes8): Referral code
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
LensPlugin(_cryptoLegacy).invitedByRefCode()β may revert withFunctionNotExists(bytes4)(bubbled)
Overrides: None
Function Calls:
invitedByRefCode() β
LensPlugin(at_cryptoLegacy), external (staticcall)
Called by: None (entry point)
Gas / Complexity note: O(1) for the forwarder; target cost is O(1).
Example: Call invitedByRefCode(cl).
getBeneficiaries (CLEXL1)
Contract/Library: CryptoLegacyExternalLens
Description: Returns beneficiaries and their configs from the target.
Detailed Description: Calls getBeneficiaries() on the Lens plugin and returns hashes, original hashes, and configs.
Parameters:
_cryptoLegacy (address): Target CryptoLegacy diamond address
Returns:
hashes (bytes32[], memory): Beneficiary hashes (keccak256 of beneficiary addresses)
originalHashes (bytes32[], memory): Original beneficiary hashes
configs (ICryptoLegacy.BeneficiaryConfig[], memory): Config objects per beneficiary
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
LensPlugin(_cryptoLegacy).getBeneficiaries()β may revert withFunctionNotExists(bytes4)(bubbled)
Overrides: None
Function Calls:
getBeneficiaries() β
LensPlugin(at_cryptoLegacy), external (staticcall)
Called by: None (entry point)
Gas / Complexity note: O(1) for the forwarder; target cost is O(n) by beneficiaries count.
Example: Call getBeneficiaries(cl).
getTokensDistribution (CLEXL1)
Contract/Library: CryptoLegacyExternalLens
Description: Returns token distribution info for a token list.
Detailed Description: Calls getTokensDistribution(address[]) on the Lens plugin for the provided tokens.
Parameters:
_cryptoLegacy (address): Target CryptoLegacy diamond address
_tokens (address[], calldata): Token addresses to query
Returns:
list (ICryptoLegacyLens.LensTokenDistribution[], memory): Distribution data per token
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
LensPlugin(_cryptoLegacy).getTokensDistribution(_tokens)β may revert withFunctionNotExists(bytes4)(bubbled)
Overrides: None
Function Calls:
getTokensDistribution(address[]) β
LensPlugin(at_cryptoLegacy), external (staticcall)
Called by: None (entry point)
Gas / Complexity note: O(1) for the forwarder; target cost is O(n) by _tokens.length.
Example: Call getTokensDistribution(cl, tokens).
getCryptoLegacyBaseData (CLEXL1)
Contract/Library: CryptoLegacyExternalLens
Description: Returns consolidated base data for the target.
Detailed Description: Takes _cryptoLegacy, forwards to _baseData, and returns the struct it receives from the target lens interface unchanged. The function performs no validation or state changes; any failure from the target call bubbles up to the caller.
Parameters:
_cryptoLegacy (address): Target CryptoLegacy diamond address
Returns:
data (ICryptoLegacyLens.CryptoLegacyBaseData, memory): Base data snapshot
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
ICryptoLegacyLens(_cryptoLegacy).getCryptoLegacyBaseData()β may revert withFunctionNotExists(bytes4)(bubbled via diamond)
Overrides: None
Function Calls:
_baseData(address) β CryptoLegacyExternalLens, internal
Called by: None (entry point)
Gas / Complexity note: O(1) for the forwarder; target cost is O(1).
Example: Call getCryptoLegacyBaseData(cl).
getCryptoLegacyListData (CLEXL1)
Contract/Library: CryptoLegacyExternalLens
Description: Returns aggregated list data for specified tokens.
Detailed Description: Takes _cryptoLegacy and _tokens, forwards them to _listTokensData, and returns the targetβs CryptoLegacyListData struct unchanged. The forwarder itself does no filtering or verification; all aggregation and any plugin lookups happen inside the target lens call, and its errors bubble up.
Parameters:
_cryptoLegacy (address): Target CryptoLegacy diamond address
_tokens (address[], memory): Token addresses to include
Returns:
data (ICryptoLegacyLens.CryptoLegacyListData, memory): Aggregated token and plugin data
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
ICryptoLegacyLens(_cryptoLegacy).getCryptoLegacyListData(_tokens)β may revert withFunctionNotExists(bytes4)(bubbled via diamond)ICryptoLegacyPlugin(facet).getPluginName()β may revert per plugin implementation (bubbled via target lens)ICryptoLegacyPlugin(facet).getPluginVer()β may revert per plugin implementation (bubbled via target lens)cls.buildManager.pluginsRegistry().getPluginDescriptionBlockNumbers(facet)β may revert per registry implementation (bubbled via target lens)
Overrides: None
Function Calls:
_listTokensData(address,address[]) β CryptoLegacyExternalLens, internal
Called by: None (entry point)
Gas / Complexity note: O(1) for the forwarder; helperβs target cost is O(b + p + tΒ·b) where b = beneficiaries, p = plugins, t = _tokens.length.
Example: Call getCryptoLegacyListData(cl, tokens).
getMessagesBlockNumbersByRecipient (CLEXL1)
Contract/Library: CryptoLegacyExternalLens
Description: Returns message block numbers for a recipient hash.
Detailed Description: Passes _recipient to the target lens interfaceβs getMessagesBlockNumbersByRecipient(bytes32) and returns the resulting list unchanged. The forwarder does no recipient validation and does not mutate state; if the target has no records for the hash, it returns an empty array.
Parameters:
_cryptoLegacy (address): Target CryptoLegacy diamond address
_recipient (bytes32): Recipient identifier hash
Returns:
blockNumbers (uint64[], memory): Block numbers for recipient messages
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
ICryptoLegacyLens(_cryptoLegacy).getMessagesBlockNumbersByRecipient(_recipient)β may revert withFunctionNotExists(bytes4)(bubbled via diamond)
Overrides: None
Function Calls:
getMessagesBlockNumbersByRecipient(bytes32) β
ICryptoLegacyLens(at_cryptoLegacy), external (staticcall)
Called by: None (entry point)
Gas / Complexity note: O(1) for the forwarder; target cost is O(m) by number of stored message checkpoints.
Example: Call getMessagesBlockNumbersByRecipient(cl, recipientHash).
getTransferBlockNumbers (CLEXL1)
Contract/Library: CryptoLegacyExternalLens
Description: Returns block numbers where transfers occurred.
Detailed Description: Calls the targetβs Lens plugin getTransferBlockNumbers() and returns the list unchanged. The function is a read-only forwarder; if the lens facet is not installed on the target, the diamond fallback reverts.
Parameters:
_cryptoLegacy (address): Target CryptoLegacy diamond address
Returns:
blockNumbers (uint64[], memory): Transfer block numbers
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
LensPlugin(_cryptoLegacy).getTransferBlockNumbers()β may revert withFunctionNotExists(bytes4)(bubbled via diamond)
Overrides: None
Function Calls:
getTransferBlockNumbers() β
LensPlugin(at_cryptoLegacy), external (staticcall)
Called by: None (entry point)
Gas / Complexity note: O(1) for the forwarder; target cost is O(t) by number of stored transfer checkpoints.
Example: Call getTransferBlockNumbers(cl).
getVestedAndClaimedData (CLEXL1)
Contract/Library: CryptoLegacyExternalLens
Description: Returns vesting/claimed data for a beneficiary across tokens.
Detailed Description: Calls getVestedAndClaimedData(bytes32,address[]) on the target lens interface and returns per-token results plus start/end dates.
Parameters:
_cryptoLegacy (address): Target CryptoLegacy diamond address
_beneficiary (bytes32): Beneficiary identifier hash
_tokens (address[], calldata): Token addresses to query
Returns:
result (ICryptoLegacyLens.BeneficiaryTokenData[], memory): Per-token data
startDate (uint64): Vesting start timestamp
endDate (uint64): Vesting end timestamp
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
ICryptoLegacyLens(_cryptoLegacy).getVestedAndClaimedData(_beneficiary, _tokens)β may revert withFunctionNotExists(bytes4)(bubbled via diamond)ICryptoLegacyLens(_cryptoLegacy).getVestedAndClaimedData(_beneficiary, _tokens)β may revert withICryptoLegacy.BeneficiaryNotExist()(bubbled)IERC20(_tokensi).balanceOf(address(this))β may revert per token implementation (bubbled via lens)
Overrides: None
Function Calls:
getVestedAndClaimedData(bytes32,address[]) β
ICryptoLegacyLens(at_cryptoLegacy), external (staticcall)
Called by: None (entry point)
Gas / Complexity note: O(1) for the forwarder; target cost is O(n) by _tokens.length.
Example: Call getVestedAndClaimedData(cl, beneficiaryHash, tokens).
getPluginInfoList (CLEXL1)
Contract/Library: CryptoLegacyExternalLens
Description: Returns plugin metadata installed on the target.
Detailed Description: Calls getPluginInfoList() on the Lens plugin to fetch plugin list and metadata.
Parameters:
_cryptoLegacy (address): Target CryptoLegacy diamond address
Returns:
plugins (ICryptoLegacyLens.PluginInfo[], memory): Plugin info array
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
LensPlugin(_cryptoLegacy).getPluginInfoList()β may revert withFunctionNotExists(bytes4)(bubbled via diamond)ICryptoLegacyPlugin(facet).getPluginName()β may revert per plugin implementation (bubbled via LensPlugin)ICryptoLegacyPlugin(facet).getPluginVer()β may revert per plugin implementation (bubbled via LensPlugin)cls.buildManager.pluginsRegistry().getPluginDescriptionBlockNumbers(facet)β may revert per registry implementation (bubbled via LensPlugin)
Overrides: None
Function Calls:
getPluginInfoList() β
LensPlugin(at_cryptoLegacy), external (staticcall)
Called by: None (entry point)
Gas / Complexity note: O(1) for the forwarder; target cost is O(n) by plugins count.
Example: Call getPluginInfoList(cl).
getCryptoLegacyListWithStatuses (CLEXL1)
Contract/Library: CryptoLegacyExternalLens
Description: Returns CryptoLegacy addresses for all roles tied to a hash plus default-guardian status per beneficiary entry.
Detailed Description: Fetches role-based lists from the Beneficiary Registry; then for each beneficiary-list address, attempts isGuardiansInitialized(). Sets beneficiaryDefaultGuardiani = !isInitialized; failures are ignored via try/catch.
Parameters:
_beneficiaryRegistry (IBeneficiaryRegistry): Beneficiary registry contract
_hash (bytes32): Identifier hash reused across roles
Returns:
listByBeneficiary (address[], memory): Contracts where
_hashis a beneficiarybeneficiaryDefaultGuardian (bool[], memory): True if default guardians are used (not initialized)
listByOwner (address[], memory): Contracts where
_hashis an ownerlistByGuardian (address[], memory): Contracts where
_hashis a guardianlistByRecovery (address[], memory): Contracts where
_hashis a recovery address
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
_beneficiaryRegistry.getAllCryptoLegacyListByRoles(_hash)β may revert per implementation (bubbled)
Overrides: None
Function Calls:
getAllCryptoLegacyListByRoles(bytes32) β
IBeneficiaryRegistry(at_beneficiaryRegistry), external (staticcall)isGuardiansInitialized() β
ITrustedGuardiansPlugin(atlistByBeneficiaryi), external (staticcall)
Called by: None (entry point)
Gas / Complexity note: O(n_b + n_o + n_g + n_r) for fetching role-based lists from the registry, plus O(n_beneficiary) for the per-beneficiary isGuardiansInitialized() checks.
Example: Call getCryptoLegacyListWithStatuses(registry, userHash).
CryptoLegacyFactory (CLF1)
constructor (CLF1)
Contract/Library: CryptoLegacyFactory
Description: Initializes the factory and sets the initial owner.
Detailed Description: Transfers ownership to _owner by calling OpenZeppelin Ownable's internal _transferOwnership. Executed once at deployment.
Parameters:
_owner (address): Address to be set as the initial owner
Returns: None
Modifiers / Visibility / Mutability:
constructor nonpayable
Access Control:
Unrestricted (deployment only)
Side Effects:
Sets
owner(Ownable storage)
Emits:
OwnershipTransferred β
OwnershipTransferred(address indexed previousOwner, address indexed newOwner)
Reverts if: None
Overrides: None
Function Calls:
Ownable._transferOwnership(address)βOwnable, internal
Called by:
None (entry point)
Gas / Complexity note: O(1)
Example: Deploy with new CryptoLegacyFactory(admin).
setBuildOperator (CLF1)
Contract/Library: CryptoLegacyFactory
Description: Adds or removes an authorized build operator.
Detailed Description: If _isAdd is true, inserts _operator into buildOperators; otherwise removes it. Emits the corresponding event.
Parameters:
_operator (address): Address to add or remove as a build operator
_isAdd (bool): True to add, false to remove
Returns: None
Modifiers / Visibility / Mutability:
public nonpayable onlyOwner
Access Control:
onlyOwner
Side Effects:
Mutates
buildOperatorsset (add/remove)
Emits:
AddBuildOperator β
AddBuildOperator(address indexed buildOperator)RemoveBuildOperator β
RemoveBuildOperator(address indexed buildOperator)
Reverts if:
Caller is not the owner β "Ownable: caller is not the owner"
Overrides: None
Function Calls:
add(address)βEnumerableSet.AddressSet, internalremove(address)βEnumerableSet.AddressSet, internal
Called by: None (entry point)
Gas / Complexity note: O(1) average (EnumerableSet operations)
Example: Owner calls setBuildOperator(op, true) to authorize op to deploy contracts.
createCryptoLegacy (CLF1)
Contract/Library: CryptoLegacyFactory
Description: Deploys a new CryptoLegacy contract at a deterministic address using CREATE3.
Detailed Description: Requires msg.sender to be a registered build operator. Assembles the constructor bytecode with cryptoLegacyBytecode, using msg.sender as _buildManager, and deploys via LibCryptoLegacyDeploy._deployByCreate3, passing _create2Args.create2Salt and _create2Args.create2Address. If _create2Args.create2Salt is zero, _deployByCreate3 substitutes it with blockhash(block.number - 1), so any precomputed _create2Args.create2Address must use that effective salt or it will mismatch. Returns the deployed address as payable.
Parameters:
_owner (address): Owner of the newly deployed CryptoLegacy
_plugins (address[], memory): Plugins to initialize with the new CryptoLegacy
_create2Args (Create2Args, memory): Deployment parameters:
create2Address(expected address) andcreate2Salt(salt)
Returns:
deployed (address payable): Address of the newly deployed CryptoLegacy
Modifiers / Visibility / Mutability:
external nonpayable
Access Control:
Build operators only (address must be present in
buildOperators)
Side Effects:
Creates a new contract via
CREATE3throughLibCryptoLegacyDeployNo factory storage mutated
Emits:
CryptoLegacyCreation β
CryptoLegacyCreation(address addr, bytes32 salt, bytes32 userSalt)
Reverts if:
Constructor bytecode length == 0 β
BytecodeEmpty()(bubbled viaLibCryptoLegacyDeploy._deployByCreate3)_create2Args.create2Salt == 0andblock.number == 0βpanic(0x11)(bubbled viaLibCryptoLegacyDeploy._deployByCreate3)_create2Args.create2Addressprovided but mismatched (e.g., when_create2Args.create2Salt == 0and the address was computed without theblockhash(block.number - 1)substitution) βAddressMismatch()(bubbled viaLibCryptoLegacyDeploy._deployByCreate3)LibCreate3.create3(...)β may revert withTargetAlreadyExists(),ErrorCreatingProxy(), orErrorCreatingContract()(bubbled viaLibCryptoLegacyDeploy._deployByCreate3)
Overrides: None
Function Calls:
contains(address)βEnumerableSet.AddressSet, internalcryptoLegacyBytecode(address,address,address[]) β CryptoLegacyFactory, internal
_deployByCreate3(address,bytes32,address,bytes) β
LibCryptoLegacyDeploy, internal
Called by:
buildCryptoLegacy(BuildArgs,RefArgs,ICryptoLegacyFactory.Create2Args) β CryptoLegacyBuildManager
Gas / Complexity note: O(1) in factory; external deployment cost dominates
Example: Authorized operator calls createCryptoLegacy(user, plugins, args) to deploy a user's CryptoLegacy contract.
cryptoLegacyBytecode (CLF1)
Contract/Library: CryptoLegacyFactory
Description: Returns the full constructor bytecode for a CryptoLegacy deployment.
Detailed Description: Concatenates type(CryptoLegacy).creationCode with ABIβencoded constructor arguments _buildManager, _owner, _plugins.
Parameters:
_buildManager (address): Build manager address to pass to the constructor
_owner (address): Owner address to pass to the constructor
_plugins (address[], memory): Plugin list to pass to the constructor
Returns:
bytecode (bytes, memory): Complete deployment bytecode
Modifiers / Visibility / Mutability:
public virtual pure
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
None
Overrides:
None
Function Calls: None
Called by:
createCryptoLegacy(address,address[],Create2Args) β CryptoLegacyFactory
Gas / Complexity note: O(n) by _plugins.length (ABI encode cost); everything else is O(1)
Example: Call cryptoLegacyBytecode(buildManager, owner, plugins) to get deployment bytecode.
computeAddress (CLF1)
Contract/Library: CryptoLegacyFactory
Description: Computes the deterministic address for a future CryptoLegacy deployment.
Detailed Description: Computes and returns the deterministic address where a CryptoLegacy contract would be deployed, given _salt and _contractOwner. This does not apply the zero-salt substitution used by createCryptoLegacy (it uses the salt as provided), so callers must pass the effective salt they intend to use. Does not perform deployment.
Parameters:
_salt (bytes32): Deployment salt
_contractOwner (address): Future owner used in address derivation
Returns:
result (address): Predicted deployment address
Modifiers / Visibility / Mutability:
public view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
None
Overrides: None
Function Calls:
_computeAddress(bytes32,address) β
LibCryptoLegacyDeploy, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Call computeAddress(salt, owner) to pre-compute where the contract will be deployed.
CryptoLegacyOwnable (CLO1)
modifier onlyOwner (CLO1)
Contract/Library: CryptoLegacyOwnable
Description: Restricts execution to the current contract owner.
Detailed Description: Invokes an ownership check before the function body executes; reverts if msg.sender is not the owner or initial fee/distribution checks fail.
Parameters: None
Returns: None
Modifiers / Visibility / Mutability:
modifier nonpayable
Access Control:
Owner only (enforced by
LibCryptoLegacy._checkOwner)
Side Effects: None
Emits: None
Reverts if:
Distribution has already started β
DistributionStarted()Initial fee not paid β
InitialFeeNotPaid()Caller is not the owner β
NotTheOwner()
Overrides: None
Function Calls:
_checkOwner() β
LibCryptoLegacy, internal
Called by:
setPause(bool) β CryptoLegacyOwnable
replacePlugin(address[],address[]) β CryptoLegacy
addPluginList(address[]) β CryptoLegacy
removePluginList(address[]) β CryptoLegacy
transferOwnership(address) β CryptoLegacyBasePlugin
setBeneficiaries(bytes32[],BeneficiaryConfig[]) β CryptoLegacyBasePlugin
update(uint256[],uint256[]) β CryptoLegacyBasePlugin
setGasLimitMultiplier(uint8) β CryptoLegacyBasePlugin
sendMessagesToBeneficiary(bytes32[],bytes32[],bytes[],bytes[],uint256) β CryptoLegacyBasePlugin
Gas / Complexity note: O(1)
Example: Not applicable
_transferOwnership (CLO1)
Contract/Library: CryptoLegacyOwnable
Description: Starts a two-step ownership transfer by setting pendingOwner and emitting the start event.
Detailed Description: Validates the new owner is non-zero, writes pendingOwner in storage, and emits OwnershipTransferStarted(previousOwner, newOwner). Finalization is performed by acceptOwnership().
Parameters:
cls (ICryptoLegacy.CryptoLegacyStorage, storage): Contract storage reference
_owner (address): Address proposed as the new owner
Returns: None
Modifiers / Visibility / Mutability:
internal virtual nonpayable
Access Control:
Intended for internal use by inheriting contracts
Side Effects:
Updates
cls.pendingOwner
Emits:
OwnershipTransferStarted β OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner)
Reverts if:
_owner == address(0) β
ZeroAddress()
Overrides: None
Function Calls:
contractOwner() β
LibDiamond, internal
Called by:
transferOwnership(address) β CryptoLegacyBasePlugin
Gas / Complexity note: O(1)
Example: Not applicable
acceptOwnership (CLO1)
Contract/Library: CryptoLegacyOwnable
Description: Completes the two-step ownership transfer by moving ownership to msg.sender.
Detailed Description: Loads storage, checks msg.sender equals pendingOwner, updates the beneficiary registry about the new owner, sets the diamond owner, and clears pendingOwner.
Parameters: None
Returns: None
Modifiers / Visibility / Mutability:
public virtual nonpayable
Access Control:
Only
pendingOwner(enforced viapendingOwnerequality check)
Side Effects:
Updates owner entry in Beneficiary Registry
Updates diamond owner in
LibDiamondstorageResets
pendingOwnertoaddress(0)
Emits:
BeneficiaryRegistryCatch β BeneficiaryRegistryCatch(bytes reason) (only if buildManager.beneficiaryRegistry() reverts)
BeneficiaryRegistryNotDefined β BeneficiaryRegistryNotDefined() (only if BeneficiaryRegistry address is not set)
SetCryptoLegacyOwnerCatch β SetCryptoLegacyOwnerCatch(bytes reason) (only if updating BeneficiaryRegistry fails)
OwnershipTransferred β OwnershipTransferred(address indexed previousOwner, address indexed newOwner)
Reverts if:
LibCryptoLegacy.getCryptoLegacyStorage().pendingOwner != msg.sender β
OwnableUnauthorizedAccount(address)
Overrides: None
Function Calls:
getCryptoLegacyStorage() β
LibCryptoLegacy, internal_updateOwnerInBeneficiaryRegistry(ICryptoLegacy.CryptoLegacyStorage,address) β
LibCryptoLegacy, internalsetContractOwner(address) β
LibDiamond, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Pending owner calls acceptOwnership() to finalize ownership transfer.
setPause (CLO1)
Contract/Library: CryptoLegacyOwnable
Description: Sets the pause flag for the CryptoLegacy contract.
Detailed Description: Owner-only setter that writes the pause state via library logic to the diamondβs storage.
Parameters:
_isPaused (bool): True to pause, false to unpause
Returns: None
Modifiers / Visibility / Mutability:
public virtual nonpayable onlyOwner
Access Control:
onlyOwner
Side Effects:
Updates
CryptoLegacyStorage.isPaused
Emits:
PauseSet β PauseSet(bool indexed isPaused)
Reverts if:
Distribution already started β
DistributionStarted()Initial fee not paid β
InitialFeeNotPaid()Caller is not the owner β
NotTheOwner()Challenge period already started β
ChallengePeriodStarted()
Overrides: None
Function Calls:
getCryptoLegacyStorage() β
LibCryptoLegacy, internal_setPause(ICryptoLegacy.CryptoLegacyStorage,bool) β
LibCryptoLegacy, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Owner calls setPause(true) to pause the contract.
pendingOwner (CLO1)
Contract/Library: CryptoLegacyOwnable
Description: Returns the current pendingOwner.
Detailed Description: Reads and returns the pendingOwner field from diamond storage via library accessor.
Parameters: None
Returns:
pending (address): Address set to accept ownership, or zero address if none
Modifiers / Visibility / Mutability:
public virtual view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if: None
Overrides: None
Function Calls:
getCryptoLegacyStorage() β
LibCryptoLegacy, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: External caller queries pendingOwner() to see who can accept ownership.
FeeRegistry (FR1)
constructor (FR1)
Contract/Library: FeeRegistry
Description: Deploy-time constructor that disables initializers and sets the initial owner.
Detailed Description: Runs LockChainGate's constructor to call _disableInitializers() and relies on Ownable's constructor to set the deployer as owner; runtime setup is performed by initialize.
Parameters: None
Returns: None
Modifiers / Visibility / Mutability:
constructor nonpayable
Access Control:
Unrestricted (deployment only)
Side Effects:
Locks the
_initializedflags withinInitializableSets
owner(Ownable)
Emits:
OwnershipTransferred β
OwnershipTransferred(address indexed previousOwner, address indexed newOwner)
Reverts if: None
Overrides: None
Function Calls:
constructor() β LockChainGate, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Not applicable
lockFeeRegistryStorage (FR1)
Contract/Library: FeeRegistry
Description: Returns a namespaced storage pointer for FeeRegistry state.
Detailed Description: Uses a fixed storage slot (FR_STORAGE_POSITION) and inline assembly to bind and return the FRStorage pointer used across the contract.
Parameters: None
Returns:
fs (FRStorage, storage): Storage pointer to the FeeRegistry storage layout
Modifiers / Visibility / Mutability:
internal pure
Access Control:
Internal only
Side Effects: None
Emits: None
Reverts if: None
Overrides: None
Function Calls:
None
Called by:
initialize(address,uint32,uint32,ILifetimeNft,uint64,uint64) β FeeRegistry
setCodeOperator(address,bool) β FeeRegistry
setSupportedRefCodeInChains(uint256[],bool) β FeeRegistry
setFeeBeneficiaries(FeeBeneficiary[]) β FeeRegistry
setDefaultPct(uint32,uint32) β FeeRegistry
setRefererSpecificPct(address,uint32,uint32) β FeeRegistry
setContractCaseFee(address,uint8,uint128) β FeeRegistry
takeFee(address,uint8,bytes8,uint256) β FeeRegistry
withdrawAccumulatedFee() β FeeRegistry
withdrawReferralAccumulatedFee(bytes8) β FeeRegistry
createCustomCode(address,address,bytes8,uint256[],uint256[]) β FeeRegistry
createCode(address,address,uint256[],uint256[]) β FeeRegistry
updateCrossChainsRef(uint256[],uint256[]) β FeeRegistry
changeCodeReferrer(bytes8,address,address,uint256[],uint256[]) β FeeRegistry
changeRecipientReferrer(bytes8,address,uint256[],uint256[]) β FeeRegistry
getCodeOperatorsList() β FeeRegistry
isCodeOperator(address) β FeeRegistry
getSupportedRefInChainsList() β FeeRegistry
isSupportedRefInChain(uint256) β FeeRegistry
getFeeBeneficiaries() β FeeRegistry
getCodePct(bytes8) β FeeRegistry
calculateFee(bytes8,uint256) β FeeRegistry
getContractCaseFee(address,uint8) β FeeRegistry
getContractCaseFeeForCode(address,uint8,bytes8) β FeeRegistry
getReferrerByAddress(address) β FeeRegistry
getReferrerByCode(bytes8) β FeeRegistry
defaultSharePct() β FeeRegistry
defaultDiscountPct() β FeeRegistry
refererByCode(bytes8) β FeeRegistry
codeByReferrer(address) β FeeRegistry
accumulatedFee() β FeeRegistry
Gas / Complexity note: O(1)
Example: Not applicable
initialize (FR1)
Contract/Library: FeeRegistry
Description: Initializes default percentages and the cross-chain gate configuration.
Detailed Description: Sets default discount/share percentages in storage, then initializes Lifetime NFT and cross-chain parameters through the base gate initializer.
Parameters:
_owner (address): Target owner for LockChainGate init
_defaultDiscountPct (uint32): Default discount basis points (denominator 10,000)
_defaultSharePct (uint32): Default referrer share basis points (denominator 10,000)
_lifetimeNft (ILifetimeNft): Lifetime NFT contract
_lockPeriod (uint64): Lock duration for NFTs
_transferTimeout (uint64): Required delay between lock and transfer
Returns: None
Modifiers / Visibility / Mutability:
external initializer nonpayable
Access Control:
Unrestricted (can be called once due to
initializer)
Side Effects:
Updates
defaultDiscountPctUpdates
defaultSharePctSets LockChainGate
lifetimeNft,lockPeriod, andtransferTimeoutTransfers ownership to
_ownerInitializes reentrancy guard state via
__ReentrancyGuard_init()
Emits:
SetDefaultPct β
SetDefaultPct(uint32 defaultDiscountPct, uint32 defaultSharePct)SetLockPeriodConfig β
SetLockPeriodConfig(uint256 lockPeriod, uint256 transferTimeout)OwnershipTransferred β
OwnershipTransferred(address indexed previousOwner, address indexed newOwner)OpenZeppelin base-type event (not mirrored in
events-reference.md):Initialized(uint8 version)
Reverts if:
Called more than once β "Initializable: contract is already initialized"
Overrides: None
Function Calls:
lockFeeRegistryStorage() β FeeRegistry, internal
_setDefaultPct(FRStorage,uint32,uint32) β FeeRegistry, internal
_initializeLockChainGate(ILifetimeNft,uint64,uint64,address) β LockChainGate, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Proxy admin calls initialize(admin, 500, 1000, lifetimeNft, 180 days, 1 days).
setCodeOperator (FR1)
Contract/Library: FeeRegistry
Description: Adds or removes an authorized referral-code operator.
Detailed Description: Fetches storage, toggles membership of _operator in codeOperators, and emits the corresponding event.
Parameters:
_operator (address): Address to add or remove
_isAdd (bool): True to add, false to remove
Returns: None
Modifiers / Visibility / Mutability:
external onlyOwner nonpayable
Access Control:
onlyOwner (contract owner via LockChainGate/Ownable base)
Side Effects:
Updates
codeOperatorsset
Emits:
AddCodeOperator β
AddCodeOperator(address indexed codeOperator)RemoveCodeOperator β
RemoveCodeOperator(address indexed codeOperator)
Reverts if:
caller is not owner β "Ownable: caller is not the owner"
Overrides: None
Function Calls:
lockFeeRegistryStorage() β FeeRegistry, internal
add(address)βEnumerableSet(library), internalremove(address)βEnumerableSet(library), internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Owner calls setCodeOperator(0xOP...ER, true) to authorize code management.
setSupportedRefCodeInChains (FR1)
Contract/Library: FeeRegistry
Description: Adds or removes supported chain IDs for referral codes.
Detailed Description: Loops through _chains, updating supportedRefInChains and emitting per-chain add/remove events.
Parameters:
_chains (uint256[], memory): Chain IDs to add/remove
_isAdd (bool): True to add, false to remove
Returns: None
Modifiers / Visibility / Mutability:
external onlyOwner nonpayable
Access Control:
onlyOwner
Side Effects:
Updates
supportedRefInChainsset
Emits:
AddSupportedRefCodeInChain β
AddSupportedRefCodeInChain(uint256 indexed chainId)RemoveSupportedRefCodeInChain β
RemoveSupportedRefCodeInChain(uint256 indexed chainId)
Reverts if:
caller is not owner β "Ownable: caller is not the owner"
Overrides: None
Function Calls:
lockFeeRegistryStorage() β FeeRegistry, internal
add(uint256)βEnumerableSet(library), internalremove(uint256)βEnumerableSet(library), internal
Called by: None (entry point)
Gas / Complexity note: O(n) by _chains.length
Example: Owner calls setSupportedRefCodeInChains(1,137,42161, true).
setFeeBeneficiaries (FR1)
Contract/Library: FeeRegistry
Description: Sets protocol fee beneficiaries and their shares.
Detailed Description: Replaces feeBeneficiaries with _beneficiaries, checks that the sum of sharePct equals PCT_BASE (10,000), and emits the configuration event.
Parameters:
_beneficiaries (FeeBeneficiary[], memory): New beneficiaries and their share percentages
Returns: None
Modifiers / Visibility / Mutability:
external onlyOwner nonpayable
Access Control:
onlyOwner
Side Effects:
Deletes and repopulates
feeBeneficiariesarray
Emits:
SetFeeBeneficiaries β
SetFeeBeneficiaries(FeeBeneficiary[] beneficiaries)
Reverts if:
caller is not owner β "Ownable: caller is not the owner"
Sum of
_beneficiariesi.sharePctβPCT_BASEβPctSumDoesntMatchBase()
Overrides: None
Function Calls:
lockFeeRegistryStorage() β FeeRegistry, internal
Called by: None (entry point)
Gas / Complexity note: O(n) by _beneficiaries.length
Example: Owner configures revenue split across treasury addresses.
setDefaultPct (FR1)
Contract/Library: FeeRegistry
Description: Updates global default discount/share percentages.
Detailed Description: Loads storage and forwards to _setDefaultPct to store new values and emit the event. Does not validate that _defaultDiscountPct + _defaultSharePct β€ PCT_BASE (see PCT_BASE); invalid values will later make calculateFee(bytes8,uint256) revert with TooBigPct().
Parameters:
_defaultDiscountPct (uint32): New default discount bps
_defaultSharePct (uint32): New default referrer share bps
Returns: None
Modifiers / Visibility / Mutability:
external onlyOwner nonpayable
Access Control:
onlyOwner
Side Effects:
Updates
defaultDiscountPctUpdates
defaultSharePct
Emits:
SetDefaultPct β
SetDefaultPct(uint32 defaultDiscountPct, uint32 defaultSharePct)
Reverts if:
caller is not owner β "Ownable: caller is not the owner"
Overrides: None
Function Calls:
lockFeeRegistryStorage() β FeeRegistry, internal
_setDefaultPct(FRStorage,uint32,uint32) β FeeRegistry, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Owner calls setDefaultPct(500, 1000).
_setDefaultPct (FR1)
Contract/Library: FeeRegistry
Description: Internal setter for default discount/share percentages.
Detailed Description: Writes the provided values into storage and emits the update event. Does not validate that _defaultDiscountPct + _defaultSharePct β€ PCT_BASE (see PCT_BASE); invalid values will later make calculateFee(bytes8,uint256) revert with TooBigPct().
Parameters:
fs (FRStorage, storage): FeeRegistry storage pointer
_defaultDiscountPct (uint32): New default discount bps
_defaultSharePct (uint32): New default referrer share bps
Returns: None
Modifiers / Visibility / Mutability:
internal nonpayable
Access Control:
Internal only
Side Effects:
Updates
defaultDiscountPctUpdates
defaultSharePct
Emits:
SetDefaultPct β
SetDefaultPct(uint32 defaultDiscountPct, uint32 defaultSharePct)
Reverts if: None
Overrides: None
Function Calls: None
Called by:
initialize(address,uint32,uint32,ILifetimeNft,uint64,uint64) β FeeRegistry
setDefaultPct(uint32,uint32) β FeeRegistry
Gas / Complexity note: O(1)
Example: Not applicable
setRefererSpecificPct (FR1)
Contract/Library: FeeRegistry
Description: Sets custom discount/share percentages for a referrerβs code.
Detailed Description: Ensures discountPct + sharePct β€ PCT_BASE (see PCT_BASE). Looks up the referrerβs code and updates its discount/share.
Parameters:
_referrer (address): Referrer owner address
_discountPct (uint32): Custom discount bps
_sharePct (uint32): Custom referrer share bps
Returns: None
Modifiers / Visibility / Mutability:
external onlyOwner nonpayable
Access Control:
onlyOwner
Side Effects:
Updates
refererByCodecode.discountPctUpdates
refererByCodecode.sharePct
Emits:
SetRefererSpecificPct β
SetRefererSpecificPct(address indexed referrer, bytes8 indexed code, uint32 discountPct, uint32 sharePct)
Reverts if:
caller is not owner β "Ownable: caller is not the owner"
_discountPct + _sharePct > PCT_BASE(seePCT_BASE) βTooBigPct()
Overrides: None
Function Calls:
lockFeeRegistryStorage() β FeeRegistry, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Owner assigns a premium referrer a higher share.
setContractCaseFee (FR1)
Contract/Library: FeeRegistry
Description: Sets the fee amount for a (contract, case) pair.
Detailed Description: Writes _fee into feeByContractCase_contract_case and emits the change.
Parameters:
_contract (address): Source contract address
_case (uint8): Case identifier
_fee (uint128): Fee in wei
Returns: None
Modifiers / Visibility / Mutability:
external onlyOwner nonpayable
Access Control:
onlyOwner
Side Effects:
Updates
feeByContractCase_contract_case
Emits:
SetContractCaseFee β
SetContractCaseFee(address indexed sourceContract, uint8 indexed contractCase, uint256 fee)
Reverts if:
caller is not owner β "Ownable: caller is not the owner"
Overrides: None
Function Calls:
lockFeeRegistryStorage() β FeeRegistry, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Owner updates build/update/lifetime fee schedules.
takeFee (FR1)
Contract/Library: FeeRegistry
Description: Charges a fee for a contract case and distributes referrer share.
Detailed Description: Computes the case fee, applies referral discount/share, enforces sufficient value, accumulates protocol fee, and attempts to transfer the referrerβs share. On transfer failure, the share is accumulated for later withdrawal. Emits detailed accounting events.
Parameters:
_contract (address): Source contract
_case (uint8): Case identifier
_code (bytes8): Referral code
_mul (uint256): Multiplier for fee amount
Returns: None
Modifiers / Visibility / Mutability:
external payable nonReentrant
Access Control:
Unrestricted
Side Effects:
Increases
accumulatedFeebyfee - shareMay increase
refererByCode_code.accumulatedFeeif payout failsSends ETH to
shareRecipienton success
Emits:
SentFee β
SentFee(address indexed referrer, bytes8 indexed code, address indexed recipient, uint256 value)AccumulateFee β
AccumulateFee(address indexed referrer, bytes8 indexed code, address indexed recipient, uint256 value, bytes transferResponse)TakeFee β
TakeFee(address indexed sourceContract, uint8 indexed contractCase, bytes8 indexed code, uint256 discount, uint256 share, uint256 fee, uint256 value)
Reverts if:
Reentrant call β "ReentrancyGuard: reentrant call"
discountPct + sharePct > PCT_BASE(seePCT_BASE; via_calculateFee) βTooBigPct()msg.value < feeormsg.value - fee > 0.00001 ether(via_checkFee) βIncorrectFee(uint256)
Overrides:
IFeeRegistry (function implementation).
Function Calls:
lockFeeRegistryStorage() β FeeRegistry, internal
_calculateFee(FRStorage,bytes8,uint256) β FeeRegistry, internal
_checkFee(uint256) β LockChainGate, internal
call{value: share, gas: 10000}(bytes)βaddress(atshareRecipient), external
Called by: None (entry point)
Gas / Complexity note: O(1); includes one bounded external call for referrer payout
Example: A build manager pays update fee with a referral code; referrer gets instant payout or accrues balance.
withdrawAccumulatedFee (FR1)
Contract/Library: FeeRegistry
Description: Distributes accumulated protocol fees to configured beneficiaries.
Detailed Description: Reads and zeroes accumulatedFee, iterates beneficiaries, and pays each proportional share; reverts on any failed transfer.
Parameters: None
Returns: None
Modifiers / Visibility / Mutability:
external nonReentrant nonpayable
Access Control:
Unrestricted
Side Effects:
Sets
accumulatedFeeto0Sends ETH to each
feeBeneficiariesi.recipient
Emits:
WithdrawFee β
WithdrawFee(address indexed beneficiary, uint256 value)
Reverts if:
Reentrant call β "ReentrancyGuard: reentrant call"
Any beneficiary transfer fails β
WithdrawAccumulatedFeeFailed(bytes)
Overrides: None
Function Calls:
lockFeeRegistryStorage() β FeeRegistry, internal
call{value: feeShare}(bytes)βaddress(atfs.feeBeneficiariesi.recipient), external
Called by: None (entry point)
Gas / Complexity note: O(n) by number of beneficiaries
Example: Treasury agent calls withdrawAccumulatedFee() to split collected fees.
withdrawReferralAccumulatedFee (FR1)
Contract/Library: FeeRegistry
Description: Pays out a referrerβs accumulated unpaid share.
Detailed Description: Loads the referrer record for _code, zeroes accumulatedFee, and transfers it to recipient; reverts on failure.
Parameters:
_code (bytes8): Referral code whose unpaid balance is withdrawn
Returns: None
Modifiers / Visibility / Mutability:
external nonReentrant nonpayable
Access Control:
Unrestricted
Side Effects:
Sets
refererByCode_code.accumulatedFeeto0Sends ETH to
refererByCode_code.recipient
Emits:
WithdrawRefFee β
WithdrawRefFee(address indexed recipient, uint256 value)
Reverts if:
Reentrant call β "ReentrancyGuard: reentrant call"
Transfer to recipient fails β
WithdrawAccumulatedFeeFailed(bytes)
Overrides: None
Function Calls:
lockFeeRegistryStorage() β FeeRegistry, internal
call{value: feeToSend}(bytes)βaddress(atref.recipient), external
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Referrer collects unpaid shares accumulated from earlier failed payouts.
_setCustomCode (FR1)
Contract/Library: FeeRegistry
Description: Internal writer for a custom referral codeβs ownership, recipient, and percentages.
Detailed Description: Validates non-zero code, re-assigns owner if different (clearing previous mapping), updates recipient and effective percentages in refererByCode, and ensures the new owner is not already a referrer.
Parameters:
fs (FRStorage, storage): FeeRegistry storage pointer
_referrer (address): New owner of the code
_recipient (address): Payout recipient
_shortCode (bytes8): Custom code
_discountPct (uint32): Discount bps
_sharePct (uint32): Share bps
Returns:
shortCode (bytes8): The code stored
Modifiers / Visibility / Mutability:
internal nonpayable
Access Control:
Internal only
Side Effects:
Updates
codeByReferrerprevOwner(delete if needed)Updates
codeByReferrer_referrerUpdates
refererByCode_shortCode.ownerUpdates
refererByCode_shortCode.recipientUpdates
refererByCode_shortCode.discountPctUpdates
refererByCode_shortCode.sharePct
Emits: None
Reverts if:
_shortCode == bytes8(0)βZeroCode()_referreralready owns a code βAlreadyReferrer()
Overrides: None
Function Calls:
_checkCodeNotZero(bytes8) β FeeRegistry, internal
_checkNewOwnerIsNotReferrer(FRStorage,address) β FeeRegistry, internal
Called by:
Gas / Complexity note: O(1)
Example: Not applicable
_createCustomCode (FR1)
Contract/Library: FeeRegistry
Description: Internal creator for a new custom referral code.
Detailed Description: Ensures code does not exist, emits creation event, and persists the new mapping via _setCustomCode.
Parameters:
fs (FRStorage, storage): FeeRegistry storage pointer
_referrer (address): Owner of the new code
_recipient (address): Payout recipient
_shortCode (bytes8): Desired code
_fromChain (uint256): Origin chain ID (0 for local creation)
_discountPct (uint32): Discount bps
_sharePct (uint32): Share bps
Returns:
shortCode (bytes8): The created code
Modifiers / Visibility / Mutability:
internal nonpayable
Access Control:
Internal only
Side Effects:
Updates
codeByReferrer_referrerUpdates
refererByCode_shortCode(owner, recipient, pcts)
Emits:
CreateCode β
CreateCode(address indexed codeOperator, address indexed referrer, bytes8 indexed code, address recipient, uint256 fromChain, uint32 discountPct, uint32 sharePct)
Reverts if:
Code already exists β
RefAlreadyCreated()_shortCode == bytes8(0)βZeroCode()_referreralready owns a code βAlreadyReferrer()
Overrides: None
Function Calls:
_setCustomCode(FRStorage,address,address,bytes8,uint32,uint32) β FeeRegistry, internal
Called by:
createCustomCode(address,address,bytes8,uint256[],uint256[]) β FeeRegistry
createCode(address,address,uint256[],uint256[]) β FeeRegistry
Gas / Complexity note: O(1)
Example: Not applicable
_checkCodeNotZero (FR1)
Contract/Library: FeeRegistry
Description: Validates that a referral code is non-zero.
Detailed Description: Reverts when _shortCode equals bytes8(0).
Parameters:
_shortCode (bytes8): Code to validate
Returns: None
Modifiers / Visibility / Mutability:
internal pure
Access Control:
Internal only
Side Effects: None
Emits: None
Reverts if:
_shortCode == bytes8(0)βZeroCode()
Overrides: None
Function Calls: None
Called by:
_setCustomCode(FRStorage,address,address,bytes8,uint32,uint32) β FeeRegistry
Gas / Complexity note: O(1)
Example: Not applicable
_checkSenderIsOperator (FR1)
Contract/Library: FeeRegistry
Description: Ensures caller is an authorized code operator.
Detailed Description: Checks membership in codeOperators; reverts otherwise.
Parameters:
fs (FRStorage, storage): FeeRegistry storage pointer
Returns: None
Modifiers / Visibility / Mutability:
internal view
Access Control:
Internal only
Side Effects: None
Emits: None
Reverts if:
Caller not in
codeOperatorsβNotOperator()
Overrides: None
Function Calls:
contains(address)βEnumerableSet.AddressSet, internal
Called by:
createCustomCode(address,address,bytes8,uint256[],uint256[]) β FeeRegistry
createCode(address,address,uint256[],uint256[]) β FeeRegistry
updateCrossChainsRef(uint256[],uint256[]) β FeeRegistry
Gas / Complexity note: O(1)
Example: Not applicable
createCustomCode (FR1)
Contract/Library: FeeRegistry
Description: Creates a custom referral code and optionally propagates it crossβchain.
Detailed Description: Requires operator role, creates the code locally, sets crossβchain refs (sending messages/fees per chain), computes total native fee spent, and returns any surplus.
Parameters:
_referrer (address): Owner of the new code
_recipient (address): Payout recipient
_shortCode (bytes8): Desired code
_chainIds (uint256[], memory): Destination chain IDs
_crossChainFees (uint256[], memory): Native fee per chain (0 to auto-calc)
Returns:
shortCode (bytes8): Created code
totalFee (uint256): Total native fee spent for cross-chain ops
returnValue (uint256): Refunded surplus (if any)
Modifiers / Visibility / Mutability:
external nonReentrant payable
Access Control:
only operator (enforced internally)
Side Effects:
Updates
codeByReferrer_referrerandrefererByCode_shortCode(via internal call)Transfers native fee to
deBridgeGateper chain via_sendwhen_chainIdsnot emptyRefunds surplus ETH to
msg.sender
Emits:
CreateCode β
CreateCode(address indexed codeOperator, address indexed referrer, bytes8 indexed code, address recipient, uint256 fromChain, uint32 discountPct, uint32 sharePct)SendToChain β
SendToChain(uint256 indexed toChainId, bytes32 indexed submissionId, uint256 value, bytes dstTransactionCall)SetCrossChainsRef β
SetCrossChainsRef(bytes8 indexed shortCode, bool indexed isCreate, uint256[] toChainIDs, uint256[] crossChainFees)
Reverts if:
Reentrant call β "ReentrancyGuard: reentrant call"
Caller is not operator β
NotOperator()Code already exists β
RefAlreadyCreated()_shortCode == bytes8(0)βZeroCode()_referreralready owns a code βAlreadyReferrer()_chainIds.length != _crossChainFees.lengthβArrayLengthMismatch()Destination chain not configured β
DestinationChainNotSpecified()deBridgeGate.globalFixedNativeFee()β may revert per deBridgeGate implementation (bubbled)deBridgeGate.sendMessage(...)β may revert per deBridgeGate implementation (bubbled)fee check fails (
msg.value < totalFeeor overpayment > 0.00001 ether) βIncorrectFee(uint256)refund transfer fails β
TransferFeeFailed(bytes)
Overrides:
IFeeRegistry (function implementation).
Function Calls:
lockFeeRegistryStorage() β FeeRegistry, internal
_checkSenderIsOperator(FRStorage) β FeeRegistry, internal
_createCustomCode(FRStorage,address,address,bytes8,uint256,uint32,uint32) β FeeRegistry, internal
_setCrossChainsRef(FRStorage,bool,bytes8,uint256[],uint256[]) β FeeRegistry, internal
_calcAndReturnFee(uint256) β LockChainGate, internal
Called by: None (entry point)
Gas / Complexity note: O(1) local + O(n) by _chainIds.length for cross-chain work
Example: Operator mints a vanity code and broadcasts it to additional chains.
createCode (FR1)
Contract/Library: FeeRegistry
Description: Creates a generated referral code and optionally propagates it crossβchain.
Detailed Description: Requires operator role, generates a short code from entropy, stores it, performs crossβchain propagation, and refunds any surplus value.
Parameters:
_referrer (address): New code owner
_recipient (address): Payout recipient
_chainIds (uint256[], memory): Destination chain IDs
_crossChainFees (uint256[], memory): Native fee per chain (0 to auto-calc)
Returns:
shortCode (bytes8): Generated code
totalFee (uint256): Total native fee spent for cross-chain ops
returnValue (uint256): Refunded surplus (if any)
Modifiers / Visibility / Mutability:
external nonReentrant payable
Access Control:
only operator (enforced internally)
Side Effects:
Updates
codeByReferrer_referrerandrefererByCodeshortCode(via internal call)Transfers native fee to
deBridgeGateper chain via_sendwhen_chainIdsnot emptyRefunds surplus ETH to
msg.sender
Emits:
CreateCode β
CreateCode(address indexed codeOperator, address indexed referrer, bytes8 indexed code, address recipient, uint256 fromChain, uint32 discountPct, uint32 sharePct)SendToChain β
SendToChain(uint256 indexed toChainId, bytes32 indexed submissionId, uint256 value, bytes dstTransactionCall)SetCrossChainsRef β
SetCrossChainsRef(bytes8 indexed shortCode, bool indexed isCreate, uint256[] toChainIDs, uint256[] crossChainFees)
Reverts if:
Reentrant call β "ReentrancyGuard: reentrant call"
Caller is not operator β
NotOperator()Code already exists β
RefAlreadyCreated()generated shortCode == bytes8(0) β
ZeroCode()_referreralready owns a code βAlreadyReferrer()_chainIds.length != _crossChainFees.lengthβArrayLengthMismatch()Destination chain not configured β
DestinationChainNotSpecified()deBridgeGate.globalFixedNativeFee()β may revert per deBridgeGate implementation (bubbled)deBridgeGate.sendMessage(...)β may revert per deBridgeGate implementation (bubbled)fee check fails (
msg.value < totalFeeor overpayment > 0.00001 ether) βIncorrectFee(uint256)refund transfer fails β
TransferFeeFailed(bytes)
Overrides:
IFeeRegistry (function implementation).
Function Calls:
lockFeeRegistryStorage() β FeeRegistry, internal
_checkSenderIsOperator(FRStorage) β FeeRegistry, internal
_createCustomCode(FRStorage,address,address,bytes8,uint256,uint32,uint32) β FeeRegistry, internal
_setCrossChainsRef(FRStorage,bool,bytes8,uint256[],uint256[]) β FeeRegistry, internal
_calcAndReturnFee(uint256) β LockChainGate, internal
Called by: None (entry point)
Gas / Complexity note: O(1) local + O(n) by _chainIds.length
Example: Operator creates a random short code without choosing a specific value.
_setCrossChainsRef (FR1)
Contract/Library: FeeRegistry
Description: Internal helper to (create/update) code data across chains.
Detailed Description: Validates arrays length, ensures destination chains are enabled, gets deBridge native fees, encodes crossβchain call (create or update), sends messages to each chain, checks total fee, and emits a summary event.
Parameters:
fs (FRStorage, storage): FeeRegistry storage pointer
_isCreate (bool): True for create, false for update
_shortCode (bytes8): Code to propagate
_toChainIDs (uint256[], memory): Destination chain IDs
_crossChainFees (uint256[], memory): Provided native fees (0 to auto-calc)
Returns:
totalFee (uint256): Total native fee used
Modifiers / Visibility / Mutability:
internal nonpayable
Access Control:
Internal only
Side Effects:
Transfers native fee to
deBridgeGateper chain via_send
Emits:
SendToChain β
SendToChain(uint256 indexed toChainId, bytes32 indexed submissionId, uint256 value, bytes dstTransactionCall)SetCrossChainsRef β
SetCrossChainsRef(bytes8 indexed shortCode, bool indexed isCreate, uint256[] toChainIDs, uint256[] crossChainFees)
Reverts if:
_toChainIDs.length != _crossChainFees.lengthβArrayLengthMismatch()Destination chain contract not specified β
DestinationChainNotSpecified()deBridgeGate.globalFixedNativeFee()β may revert per deBridgeGate implementation (bubbled)deBridgeGate.sendMessage(...)β may revert per deBridgeGate implementation (bubbled)fee check fails (
msg.value < totalFeeor overpayment > 0.00001 ether) βIncorrectFee(uint256)
Overrides: None
Function Calls:
lockChainGateStorage() β LockChainGate, internal
_checkDestinationLockedChain(LCGStorage,uint256) β LockChainGate, internal
_getDeBridgeChainNativeFee(LCGStorage,uint256,uint256) β LockChainGate, internal
_encodeCrossCreateCustomCodeCommand(LCGStorage,address,address,bytes8,uint32,uint32) β FeeRegistry, internal
_encodeCrossUpdateCustomCodeCommand(LCGStorage,address,address,bytes8,uint32,uint32) β FeeRegistry, internal
_send(LCGStorage,bytes,uint256,uint256) β LockChainGate, internal
_checkFee(uint256) β LockChainGate, internal
Called by:
createCustomCode(address,address,bytes8,uint256[],uint256[]) β FeeRegistry
createCode(address,address,uint256[],uint256[]) β FeeRegistry
updateCrossChainsRef(uint256[],uint256[]) β FeeRegistry
changeCodeReferrer(bytes8,address,address,uint256[],uint256[]) β FeeRegistry
changeRecipientReferrer(bytes8,address,uint256[],uint256[]) β FeeRegistry
Gas / Complexity note: O(n) by _toChainIDs.length
Example: Not applicable
updateCrossChainsRef (FR1)
Contract/Library: FeeRegistry
Description: Updates cross-chain parameters for an existing referrer's code.
Detailed Description: Requires operator role, ensures _referrer has a code, runs cross-chain propagation as an update, and refunds any surplus native fee.
Parameters:
_referrer (address): Existing referrer
_chainIds (uint256[], memory): Destination chain IDs
_crossChainFees (uint256[], memory): Native fees per chain
Returns:
totalFee (uint256): Total native fee used
returnValue (uint256): Refunded surplus (if any)
Modifiers / Visibility / Mutability:
external payable nonReentrant
Access Control:
only operator (enforced internally)
Side Effects:
Sends cross-chain messages via deBridgeGate for each chain ID
Transfers ETH refund to msg.sender (if any)
Emits:
SendToChain β
SendToChain(uint256 indexed toChainId, bytes32 indexed submissionId, uint256 value, bytes dstTransactionCall)SetCrossChainsRef β
SetCrossChainsRef(bytes8 indexed shortCode, bool indexed isCreate, uint256[] toChainIDs, uint256[] crossChainFees)
Reverts if:
Reentrant call β "ReentrancyGuard: reentrant call"
Caller is not operator β
NotOperator()_referrerhas no code βCodeNotCreated()_chainIds.length != _crossChainFees.lengthβArrayLengthMismatch()Destination chain contract not specified β
DestinationChainNotSpecified()deBridgeGate.globalFixedNativeFee()β may revert per implementation (bubbled)deBridgeGate.sendMessage(...)β may revert per implementation (bubbled)msg.value < totalFeeormsg.value - totalFee > 0.00001 etherβIncorrectFee(uint256)Refund transfer fails β
TransferFeeFailed(bytes)
Overrides:
IFeeRegistry (function implementation).
Function Calls:
lockFeeRegistryStorage() β FeeRegistry, internal
_checkSenderIsOperator(FRStorage) β FeeRegistry, internal
_setCrossChainsRef(FRStorage,bool,bytes8,uint256[],uint256[]) β FeeRegistry, internal
_calcAndReturnFee(uint256) β LockChainGate, internal
Called by: None (entry point)
Gas / Complexity note: O(n) by _chainIds.length
Example: Operator updates remote chain visibility of an existing code.
crossCreateCustomCode (FR1)
Contract/Library: FeeRegistry
Description: Cross-chain entry to create a custom code.
Detailed Description: Validates source chain and cross-chain caller, then creates the code with the provided configuration.
Parameters:
_fromChainId (uint256): Origin chain id
_referrer (address): Owner of the code
_recipient (address): Payout recipient
_shortCode (bytes8): Code to create
_discountPct (uint32): Discount bps
_sharePct (uint32): Share bps
Returns: None
Modifiers / Visibility / Mutability:
external nonReentrant nonpayable
Access Control:
Restricted to authorized cross-chain messages via deBridge CallProxy
Side Effects:
Writes
refererByCodeandcodeByReferrervia _createCustomCode
Emits:
CreateCode β
CreateCode(address indexed codeOperator, address indexed referrer, bytes8 indexed code, address recipient, uint256 fromChain, uint32 discountPct, uint32 sharePct)
Reverts if:
Reentrant call β "ReentrancyGuard: reentrant call"
Source chain not configured β
SourceNotSpecified()deBridgeGate.callProxy()β may revert per implementation (bubbled)Caller is not deBridge CallProxy β
NotCallProxy()ICallProxy.submissionChainIdFrom()β may revert per implementation (bubbled)Source chain mismatch β
ChainIdMismatch()ICallProxy.submissionNativeSender()β may revert per implementation (bubbled)Sender validation failed β
NotValidSender()Code already exists β
RefAlreadyCreated()_shortCode == bytes8(0)βZeroCode()_referreralready owns a code βAlreadyReferrer()
Overrides:
IFeeRegistry (function implementation).
Function Calls:
lockFeeRegistryStorage() β FeeRegistry, internal
lockChainGateStorage() β LockChainGate, internal
_checkSource(LCGStorage,uint256) β LockChainGate, internal
_onlyCrossChain(LCGStorage,uint256) β LockChainGate, internal
_createCustomCode(FRStorage,address,address,bytes8,uint256,uint32,uint32) β FeeRegistry, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Not applicable
crossUpdateCustomCode (FR1)
Contract/Library: FeeRegistry
Description: Cross-chain entry to update code data.
Detailed Description: Validates source chain/caller, updates code owner/recipient/percentages locally, and emits the update event.
Parameters:
_fromChainId (uint256): Origin chain id
_referrer (address): Referrer (owner)
_recipient (address): Recipient
_shortCode (bytes8): Code to update
_discountPct (uint32): Discount bps
_sharePct (uint32): Share bps
Returns: None
Modifiers / Visibility / Mutability:
external nonReentrant nonpayable
Access Control:
Restricted to authorized cross-chain messages via deBridge CallProxy
Side Effects:
Writes
refererByCodeandcodeByReferrervia _setCustomCode
Emits:
UpdateCode β
UpdateCode(address indexed codeOperator, address indexed referrer, bytes8 indexed code, address recipient, uint256 fromChain, uint32 discountPct, uint32 sharePct)
Reverts if:
Reentrant call β "ReentrancyGuard: reentrant call"
Source chain not configured β
SourceNotSpecified()deBridgeGate.callProxy()β may revert per implementation (bubbled)Caller is not deBridge CallProxy β
NotCallProxy()ICallProxy.submissionChainIdFrom()β may revert per implementation (bubbled)Source chain mismatch β
ChainIdMismatch()ICallProxy.submissionNativeSender()β may revert per implementation (bubbled)Sender validation failed β
NotValidSender()_shortCode == bytes8(0)βZeroCode()_referreralready owns a code βAlreadyReferrer()
Overrides: None
Function Calls:
lockFeeRegistryStorage() β FeeRegistry, internal
lockChainGateStorage() β LockChainGate, internal
_checkSource(LCGStorage,uint256) β LockChainGate, internal
_onlyCrossChain(LCGStorage,uint256) β LockChainGate, internal
_setCustomCode(FRStorage,address,address,bytes8,uint32,uint32) β FeeRegistry, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Not applicable
_encodeCrossCreateCustomCodeCommand (FR1)
Contract/Library: FeeRegistry
Description: Encodes the cross-chain create code command payload.
Detailed Description: Constructs abi-encoded calldata for crossCreateCustomCode including the current chain id and parameters.
Parameters:
ls (LCGStorage, storage): LockChainGate storage pointer
_referrer (address): Owner
_recipient (address): Recipient
_shortCode (bytes8): Code
_discountPct (uint32): Discount bps
_sharePct (uint32): Share bps
Returns:
data (bytes, memory): Encoded payload
Modifiers / Visibility / Mutability:
internal view
Access Control:
Internal only
Side Effects: None
Emits: None
Reverts if: None
Overrides: None
Function Calls:
_getChainId(LCGStorage) β LockChainGate, internal
Called by:
_setCrossChainsRef(FRStorage,bool,bytes8,uint256[],uint256[]) β FeeRegistry
Gas / Complexity note: O(1)
Example: Not applicable
_encodeCrossUpdateCustomCodeCommand (FR1)
Contract/Library: FeeRegistry
Description: Encodes the cross-chain update code command payload.
Detailed Description: Constructs abi-encoded calldata for crossUpdateCustomCode including the current chain id and parameters.
Parameters:
ls (LCGStorage, storage): LockChainGate storage pointer
_referrer (address): Referrer address
_recipient (address): Recipient address
_shortCode (bytes8): Code
_discountPct (uint32): Discount bps
_sharePct (uint32): Share bps
Returns:
data (bytes, memory): Encoded payload
Modifiers / Visibility / Mutability:
internal view
Access Control:
Internal only
Side Effects: None
Emits: None
Reverts if: None
Overrides: None
Function Calls:
_getChainId(LCGStorage) β LockChainGate, internal
Called by:
_setCrossChainsRef(FRStorage,bool,bytes8,uint256[],uint256[]) β FeeRegistry
Gas / Complexity note: O(1)
Example: Not applicable
_checkSenderIsReferrer (FR1)
Contract/Library: FeeRegistry
Description: Ensures the caller owns the specified referral code.
Detailed Description: Checks codeByReferrermsg.sender == _code and that _code != bytes8(0); reverts otherwise.
Parameters:
fs (FRStorage, storage): FeeRegistry storage pointer
_code (bytes8): Code to check ownership of
Returns: None
Modifiers / Visibility / Mutability:
internal view
Access Control:
Internal only
Side Effects: None
Emits: None
Reverts if:
codeByReferrermsg.sender != _codeβNotReferrer()_code == bytes8(0)βNotReferrer()
Overrides: None
Function Calls: None
Called by:
changeCodeReferrer(bytes8,address,address,uint256[],uint256[]) β FeeRegistry
changeRecipientReferrer(bytes8,address,uint256[],uint256[]) β FeeRegistry
Gas / Complexity note: O(1)
Example: Not applicable
_checkNewOwnerIsNotReferrer (FR1)
Contract/Library: FeeRegistry
Description: Prevents assigning a code to an address that already has one.
Detailed Description: Ensures codeByReferrer_newReferer == bytes8(0).
Parameters:
fs (FRStorage, storage): FeeRegistry storage pointer
_newReferer (address): Candidate referrer
Returns: None
Modifiers / Visibility / Mutability:
internal view
Access Control:
Internal only
Side Effects: None
Emits: None
Reverts if:
codeByReferrer_newReferer != bytes8(0)βAlreadyReferrer()
Overrides: None
Function Calls: None
Called by:
_setCustomCode(FRStorage,address,address,bytes8,uint32,uint32) β FeeRegistry
changeCodeReferrer(bytes8,address,address,uint256[],uint256[]) β FeeRegistry
Gas / Complexity note: O(1)
Example: Not applicable
changeCodeReferrer (FR1)
Contract/Library: FeeRegistry
Description: Transfers code ownership to a new referrer and optionally updates crossβchain.
Detailed Description: Checks caller is current referrer and target is not already one, updates owner/recipient mappings, optionally propagates cross-chain updates, refunds surplus, and emits ownership change.
Parameters:
_code (bytes8): Code to transfer
_newReferer (address): New owner
_newRecipient (address): New payout recipient
_chainIds (uint256[], memory): Destination chain IDs
_crossChainFees (uint256[], memory): Native fees per chain
Returns:
totalFee (uint256): Total native fee used
returnValue (uint256): Refunded surplus (if any)
Modifiers / Visibility / Mutability:
external nonReentrant payable
Access Control:
Caller must be current referrer (enforced internally)
Side Effects:
Clears
codeByReferrermsg.senderUpdates
refererByCode_code.ownerand.recipientUpdates
codeByReferrer_newRefererSends native fee to
deBridgeGateper destination chain via_sendMay transfer surplus ETH back to
msg.sendervia_calcAndReturnFee
Emits:
SendToChain β
SendToChain(uint256 indexed toChainId, bytes32 indexed submissionId, uint256 value, bytes dstTransactionCall)SetCrossChainsRef β
SetCrossChainsRef(bytes8 indexed shortCode, bool indexed isCreate, uint256[] toChainIDs, uint256[] crossChainFees)ChangeCode β
ChangeCode(address indexed oldReferrer, address indexed newReferrer, bytes8 indexed code)
Reverts if:
Reentrant call β "ReentrancyGuard: reentrant call"
codeByReferrermsg.sender != _codeβNotReferrer()_code == bytes8(0)βNotReferrer()codeByReferrer_newReferer != bytes8(0)βAlreadyReferrer()_chainIds.length != _crossChainFees.lengthβArrayLengthMismatch()Destination chain contract not specified β
DestinationChainNotSpecified()deBridgeGate.globalFixedNativeFee()β may revert per implementation (bubbled)deBridgeGate.sendMessage(...)β may revert per deBridgeGate implementation (bubbled)msg.value < totalFeeormsg.value - totalFee > 0.00001 etherβIncorrectFee(uint256)Refund transfer to
msg.senderfails βTransferFeeFailed(bytes)
Overrides: None
Function Calls:
lockFeeRegistryStorage() β FeeRegistry, internal
_checkSenderIsReferrer(FRStorage,bytes8) β FeeRegistry, internal
_checkNewOwnerIsNotReferrer(FRStorage,address) β FeeRegistry, internal
_setCrossChainsRef(FRStorage,bool,bytes8,uint256[],uint256[]) β FeeRegistry, internal
_calcAndReturnFee(uint256) β LockChainGate, internal
Called by: None (entry point)
Gas / Complexity note: O(1) local + O(n) by _chainIds.length
Example: Referrer moves code ownership to a new address and updates remote chains.
changeRecipientReferrer (FR1)
Contract/Library: FeeRegistry
Description: Updates the payout recipient for a referral code and optionally propagates cross-chain.
Detailed Description: Checks caller is the referrer for _code, updates refererByCode_code.recipient, propagates cross-chain update, and refunds any surplus fee.
Parameters:
_code (bytes8): Code to update
_newRecipient (address): New payout recipient
_chainIds (uint256[], memory): Destination chain IDs
_crossChainFees (uint256[], memory): Native fees per chain
Returns:
totalFee (uint256): Total native fee used
returnValue (uint256): Refunded surplus (if any)
Modifiers / Visibility / Mutability:
external nonReentrant payable
Access Control:
Caller must be current referrer (enforced internally)
Side Effects:
Updates
refererByCode_code.recipientSends native fee to
deBridgeGateper destination chain via_sendMay transfer surplus ETH back to
msg.sendervia_calcAndReturnFee
Emits:
SendToChain β
SendToChain(uint256 indexed toChainId, bytes32 indexed submissionId, uint256 value, bytes dstTransactionCall)SetCrossChainsRef β
SetCrossChainsRef(bytes8 indexed shortCode, bool indexed isCreate, uint256[] toChainIDs, uint256[] crossChainFees)ChangeRecipient β
ChangeRecipient(address indexed referrer, address indexed newRecipient, bytes8 indexed code)
Reverts if:
Reentrant call β "ReentrancyGuard: reentrant call"
codeByReferrermsg.sender != _codeβNotReferrer()_code == bytes8(0)βNotReferrer()_chainIds.length != _crossChainFees.lengthβArrayLengthMismatch()Destination chain contract not specified β
DestinationChainNotSpecified()deBridgeGate.globalFixedNativeFee()β may revert per implementation (bubbled)deBridgeGate.sendMessage(...)β may revert per deBridgeGate implementation (bubbled)msg.value < totalFeeormsg.value - totalFee > 0.00001 etherβIncorrectFee(uint256)Refund transfer to
msg.senderfails βTransferFeeFailed(bytes)
Overrides: None
Function Calls:
lockFeeRegistryStorage() β FeeRegistry, internal
_checkSenderIsReferrer(FRStorage,bytes8) β FeeRegistry, internal
_setCrossChainsRef(FRStorage,bool,bytes8,uint256[],uint256[]) β FeeRegistry, internal
_calcAndReturnFee(uint256) β LockChainGate, internal
Called by: None (entry point)
Gas / Complexity note: O(1) local + O(n) by _chainIds.length
Example: Referrer updates their payout address and syncs it to other chains.
getCodeOperatorsList (FR1)
Contract/Library: FeeRegistry
Description: Returns the list of authorized code operators.
Detailed Description: Reads the enumerable set and materializes it into an array.
Parameters: None
Returns:
operators (address[], memory): Current code operators
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if: None
Overrides: None
Function Calls:
lockFeeRegistryStorage() β FeeRegistry, internal
values()βEnumerableSet.AddressSet, internal
Called by: None (entry point)
Gas / Complexity note: O(n) by number of operators
Example: Front-end queries to display operator addresses.
isCodeOperator (FR1)
Contract/Library: FeeRegistry
Description: Checks whether an address is an authorized code operator.
Detailed Description: Queries membership in the codeOperators set for _addr.
Parameters:
_addr (address): Address to check
Returns:
isOperator (bool): True if address is an operator
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if: None
Overrides: None
Function Calls:
lockFeeRegistryStorage() β FeeRegistry, internal
contains(address)βEnumerableSet.AddressSet, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Not applicable
getSupportedRefInChainsList (FR1)
Contract/Library: FeeRegistry
Description: Lists chain IDs where referral codes are supported.
Detailed Description: Returns the contents of supportedRefInChains set.
Parameters: None
Returns:
chains (uint256[], memory): Supported chain IDs
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if: None
Overrides:
IFeeRegistry (function implementation).
Function Calls:
lockFeeRegistryStorage() β FeeRegistry, internal
values()βEnumerableSet.UintSet, internal
Called by: None (entry point)
Gas / Complexity note: O(n) by set size
Example: Not applicable
isSupportedRefInChain (FR1)
Contract/Library: FeeRegistry
Description: Checks whether a chain ID supports referral codes.
Detailed Description: Queries membership in the supportedRefInChains set.
Parameters:
_chainId (uint256): Chain id to check
Returns:
supported (bool): True if supported
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if: None
Overrides: None
Function Calls:
lockFeeRegistryStorage() β FeeRegistry, internal
contains(uint256)βEnumerableSet.UintSet, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Not applicable
getFeeBeneficiaries (FR1)
Contract/Library: FeeRegistry
Description: Returns protocol fee beneficiaries.
Detailed Description: Reads and returns the stored array of (recipient, sharePct).
Parameters: None
Returns:
beneficiaries (FeeBeneficiary[], memory): Current fee beneficiaries
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if: None
Overrides: None
Function Calls:
lockFeeRegistryStorage() β FeeRegistry, internal
Called by: None (entry point)
Gas / Complexity note: O(n) by beneficiaries length
Example: Not applicable
getCodePct (FR1)
Contract/Library: FeeRegistry
Description: Returns effective discount/share percentages for a code.
Detailed Description: Returns (0, 0) if the code is unset; otherwise returns code-specific values when set, or defaults.
Parameters:
_code (bytes8): Code whose percentages are requested
Returns:
discountPct (uint32): Effective discount bps
sharePct (uint32): Effective share bps
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if: None
Overrides: None
Function Calls:
lockFeeRegistryStorage() β FeeRegistry, internal
_getCodePct(FRStorage,bytes8) β FeeRegistry, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Not applicable
_getCodePct (FR1)
Contract/Library: FeeRegistry
Description: Internal resolver for a codeβs effective percentages.
Detailed Description: Returns (0,0) if code unset; else returns specific values if present, or fallbacks to defaults.
Parameters:
fs (FRStorage, storage): FeeRegistry storage pointer
_code (bytes8): Code to resolve
Returns:
discountPct (uint32): Effective discount bps
sharePct (uint32): Effective share bps
Modifiers / Visibility / Mutability:
internal view
Access Control:
Internal only
Side Effects: None
Emits: None
Reverts if: None
Overrides: None
Function Calls: None
Called by:
getCodePct(bytes8) β FeeRegistry
_calculateFee(FRStorage,bytes8,uint256) β FeeRegistry
_getReferrerByCode(FRStorage,bytes8) β FeeRegistry
Gas / Complexity note: O(1)
Example: Not applicable
calculateFee (FR1)
Contract/Library: FeeRegistry
Description: Computes discount, share, and final fee for a code and base fee.
Detailed Description: Fetches effective percentages and applies them: discount = base*discountPct/PCT_BASE, share = base*sharePct/PCT_BASE, fee = base - discount (see PCT_BASE).
Parameters:
_code (bytes8): Code to apply
_fee (uint256): Base fee before discount
Returns:
discount (uint256): Discount amount
share (uint256): Referrer share amount
fee (uint256): Fee after discount
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
discountPct + sharePct >
PCT_BASEβTooBigPct()
Overrides: None
Function Calls:
lockFeeRegistryStorage() β FeeRegistry, internal
_calculateFee(FRStorage,bytes8,uint256) β FeeRegistry, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Not applicable
_calculateFee (FR1)
Contract/Library: FeeRegistry
Description: Internal computation of discount/share/fee for a code and base amount.
Detailed Description: Reads effective percentages via _getCodePct, verifies sum β€ PCT_BASE, then computes amounts.
Parameters:
fs (FRStorage, storage): FeeRegistry storage pointer
_code (bytes8): Code to apply
_fee (uint256): Base fee
Returns:
discount (uint256): Discount amount
share (uint256): Share amount
fee (uint256): Final fee after discount
Modifiers / Visibility / Mutability:
internal view
Access Control:
Internal only
Side Effects: None
Emits: None
Reverts if:
discountPct + sharePct >
PCT_BASEβTooBigPct()
Overrides: None
Function Calls:
_getCodePct(FRStorage,bytes8) β FeeRegistry, internal
Called by:
takeFee(address,uint8,bytes8,uint256) β FeeRegistry
calculateFee(bytes8,uint256) β FeeRegistry
getContractCaseFeeForCode(address,uint8,bytes8) β FeeRegistry
Gas / Complexity note: O(1)
Example: Not applicable
getContractCaseFee (FR1)
Contract/Library: FeeRegistry
Description: Retrieves the stored fee for a (contract, case) pair.
Detailed Description: Returns feeByContractCase_contract_case.
Parameters:
_contract (address): Source contract
_case (uint8): Case id
Returns:
fee (uint256): Stored fee amount
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if: None
Overrides:
IFeeRegistry (function implementation).
Function Calls:
lockFeeRegistryStorage() β FeeRegistry, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Not applicable
getContractCaseFeeForCode (FR1)
Contract/Library: FeeRegistry
Description: Retrieves the effective fee for a (contract, case) after applying a codeβs discount.
Detailed Description: Computes discount/fee using stored base and codeβs percentages; returns the effective fee.
Parameters:
_contract (address): Source contract
_case (uint8): Case id
_code (bytes8): Referral code
Returns:
fee (uint256): Effective fee after discount
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
discountPct + sharePct >
PCT_BASEβTooBigPct()
Overrides:
IFeeRegistry (function implementation).
Function Calls:
lockFeeRegistryStorage() β FeeRegistry, internal
_calculateFee(FRStorage,bytes8,uint256) β FeeRegistry, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Not applicable
getReferrerByAddress (FR1)
Contract/Library: FeeRegistry
Description: Returns referrer metadata by referrer address.
Detailed Description: Looks up the short code via codeByReferrer and returns the Referrer struct (with effective percentages applied).
Parameters:
_referrer (address): Referrer owner address
Returns:
ref (Referrer, memory): Referrer data (owner, recipient, pcts, accumulated)
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if: None
Overrides: None
Function Calls:
lockFeeRegistryStorage() β FeeRegistry, internal
_getReferrerByAddress(FRStorage,address) β FeeRegistry, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Call getReferrerByAddress(alice) to read the referrer data for an address.
_getReferrerByAddress (FR1)
Contract/Library: FeeRegistry
Description: Internal resolver for referrer by address.
Detailed Description: Finds a code via codeByReferrer and returns the corresponding referrer struct.
Parameters:
fs (FRStorage, storage): FeeRegistry storage pointer
_referrer (address): Referrer owner
Returns:
ref (Referrer, memory): Referrer data
Modifiers / Visibility / Mutability:
internal view
Access Control:
Internal only
Side Effects: None
Emits: None
Reverts if: None
Overrides: None
Function Calls:
getReferrerByCode(bytes8) β FeeRegistry, internal
Called by:
getReferrerByAddress(address) β FeeRegistry
Gas / Complexity note: O(1)
Example: Not applicable
getReferrerByCode (FR1)
Contract/Library: FeeRegistry
Description: Returns referrer metadata by code.
Detailed Description: Calls _getReferrerByCode, which fetches the stored referrer struct and applies effective percentages from _getCodePct; if the code is registered, defaults are used when specific pcts are zero, and if not registered, _getCodePct returns 0/0.
Parameters:
_code (bytes8): Short referral code
Returns:
ref (Referrer, memory): Referrer data with effective pcts
Modifiers / Visibility / Mutability:
public view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if: None
Overrides: None
Function Calls:
lockFeeRegistryStorage() β FeeRegistry, internal
_getReferrerByCode(FRStorage,bytes8) β FeeRegistry, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Call getReferrerByCode(refCode) after code creation to read the referrer data.
_getReferrerByCode (FR1)
Contract/Library: FeeRegistry
Description: Internal resolver for referrer by code.
Detailed Description: Reads refererByCode_code and replaces its discount/share with effective values from _getCodePct.
Parameters:
fs (FRStorage, storage): FeeRegistry storage pointer
_code (bytes8): Short code
Returns:
ref (Referrer, memory): Referrer data with effective pcts
Modifiers / Visibility / Mutability:
internal view
Access Control:
Internal only
Side Effects: None
Emits: None
Reverts if: None
Overrides: None
Function Calls:
_getCodePct(FRStorage,bytes8) β FeeRegistry, internal
Called by:
getReferrerByCode(bytes8) β FeeRegistry
Gas / Complexity note: O(1)
Example: Not applicable
defaultSharePct (FR1)
Contract/Library: FeeRegistry
Description: Returns the default share percentage.
Detailed Description: Reads defaultSharePct from storage.
Parameters: None
Returns:
pct (uint32): Default share bps
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if: None
Overrides: None
Function Calls:
lockFeeRegistryStorage() β FeeRegistry, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Not applicable
defaultDiscountPct (FR1)
Contract/Library: FeeRegistry
Description: Returns the default discount percentage.
Detailed Description: Reads defaultDiscountPct from storage.
Parameters: None
Returns:
pct (uint32): Default discount bps
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if: None
Overrides: None
Function Calls:
lockFeeRegistryStorage() β FeeRegistry, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Not applicable
refererByCode (FR1)
Contract/Library: FeeRegistry
Description: Returns raw referrer record for a code (without effective pcts).
Detailed Description: Directly returns refererByCode_code from storage.
Parameters:
_code (bytes8): Short code
Returns:
ref (Referrer, memory): Raw referrer struct
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if: None
Overrides: None
Function Calls:
lockFeeRegistryStorage() β FeeRegistry, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Not applicable
codeByReferrer (FR1)
Contract/Library: FeeRegistry
Description: Returns the code associated with a referrer address.
Detailed Description: Directly returns codeByReferrer_referrer from storage.
Parameters:
_referrer (address): Referrer owner address
Returns:
code (bytes8): Assigned short code (or zero)
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if: None
Overrides: None
Function Calls:
lockFeeRegistryStorage() β FeeRegistry, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Not applicable
accumulatedFee (FR1)
Contract/Library: FeeRegistry
Description: Returns the accumulated protocol fee balance.
Detailed Description: Reads accumulatedFee from storage.
Parameters: None
Returns:
amount (uint128): Accumulated protocol fee
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if: None
Overrides:
IFeeRegistry (function implementation).
Function Calls:
lockFeeRegistryStorage() β FeeRegistry, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Not applicable
LegacyMessenger (LM1)
constructor (LM1)
Contract/Library: LegacyMessenger
Description: Initializes the messenger and sets the contract owner.
Detailed Description: Transfers ownership to _owner during deployment using the inherited _transferOwnership helper.
Parameters:
_owner (address): Address to be set as the initial owner
Returns: None
Modifiers / Visibility / Mutability:
constructor nonpayable
Access Control:
Unrestricted (deployment only)
Side Effects:
Sets
owner(inherited fromOwnable)
Emits:
OwnershipTransferred β
OwnershipTransferred(address indexed previousOwner, address indexed newOwner)
Reverts if: None
Overrides: None
Function Calls:
_transferOwnership(address)βOwnable, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Deploy with new LegacyMessenger(msg.sender) to set the deployer as the owner.
sendMessagesTo (LM1)
Contract/Library: LegacyMessenger
Description: Emits perβrecipient message events and records the block number for each recipient.
Detailed Description: Verifies the caller and target CryptoLegacy instance via _checkBuildManagerValid(_cryptoLegacy, msg.sender). Iterates over _recipientList, and for each index i emits LegacyMessage and LegacyMessageCheck with the corresponding payloads, then appends the current block number to messagesGotByBlockNumber[_recipientList[i]]. Uses L2 Arbitrum block number via ArbSys(address(100)).arbBlockNumber() when block.chainid == 42161, otherwise block.number. Arrays are treated as parallel and must align by index.
Parameters:
_cryptoLegacy (address): Target CryptoLegacy contract whose owner is authorized to send
_recipientList (bytes32[], memory): Recipient identifiers (hashes) aligned by index
_messageHashList (bytes32[], memory): Message hashes aligned by index
_messageList (bytes[], memory): Raw message payloads aligned by index
_messageCheckList (bytes[], memory): Companion/check payloads aligned by index
_messageType (uint256): Applicationβspecific message type/category
Returns: None
Modifiers / Visibility / Mutability:
public nonpayable
Access Control:
Caller must pass
_checkBuildManagerValid(_cryptoLegacy, msg.sender)(owner of_cryptoLegacyand_cryptoLegacybuilt by an allowβlisted build manager).
Side Effects:
Appends to
messagesGotByBlockNumber[_recipientList[i]] for each recipient.
Emits:
LegacyMessage β
LegacyMessage(address indexed legacy, bytes32 indexed toRecipient, bytes32 messageHash, bytes message, uint256 indexed messageType)LegacyMessageCheck β
LegacyMessageCheck(address indexed legacy, bytes32 indexed toBeneficiary, bytes32 messageHash, bytes message, uint256 indexed messageType)
Reverts if:
Caller is not the owner of
_cryptoLegacyβNotTheOwnerOfCryptoLegacy()_cryptoLegacynot registered by its build manager βCryptoLegacyNotRegistered()Build manager not allow-listed β
BuildManagerNotAdded()Array length mismatch β Panic(0x32)
Overrides: None
Function Calls:
_checkBuildManagerValid(address,address)βBuildManagerOwnable, internalarbBlockNumber()βArbSys(ataddress(100)), external (staticcall)
Called by: None (entry point)
Gas / Complexity note: O(n) by _recipientList.length β each recipient costs two event emissions and one storage append.
Example: Owner of a CryptoLegacy instance calls sendMessagesTo(cl, recipients, msgHashes, msgs, checks, 1) to broadcast messages and log the corresponding block numbers.
getMessagesBlockNumbersByRecipient (LM1)
Contract/Library: LegacyMessenger
Description: Returns the list of block numbers when a given recipient received messages.
Detailed Description: Reads and returns the dynamic array stored at messagesGotByBlockNumber[_recipient].
Parameters:
_recipient (bytes32): Recipient identifier (hash)
Returns:
blockNumbers (uint64[], memory): Array of recorded block numbers for
_recipient
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if: None
Overrides: None
Function Calls: None
Called by: None (entry point)
Gas / Complexity note: O(n) by blockNumbers.length.
Example: Call getMessagesBlockNumbersByRecipient(recipientHash) to obtain all blocks when messages were observed for that recipient.
LifetimeNft (LN1)
constructor (LN1)
Contract/Library: LifetimeNft
Description: Initializes the ERC721 token with name, symbol, base URI, and owner.
Detailed Description: Sets the metadata base URI via internal _setBaseUri, initializes ERC721 name and symbol, then lets Ownable() set the initial owner to msg.sender before _transferOwnership(_owner) transfers control to the final owner. Emits SetBaseURI (via _setBaseUri) and two OwnershipTransferred events for the inherited Ownable handoff.
Parameters:
name_ (string, memory): Token name
symbol_ (string, memory): Token symbol
baseURI_ (string, memory): Initial base URI for metadata
_owner (address): Initial contract owner
Returns: None
Modifiers / Visibility / Mutability:
constructor nonpayable
Access Control:
Unrestricted (deployment only)
Side Effects:
Sets
baseURISets ERC721 name and symbol
Sets
owner
Emits:
SetBaseURI β
SetBaseURI(string baseURI)OwnershipTransferred β
OwnershipTransferred(address indexed previousOwner, address indexed newOwner)(viaOwnable()constructor)OwnershipTransferred β
OwnershipTransferred(address indexed previousOwner, address indexed newOwner)(viaOwnable._transferOwnership)
Reverts if: None
Overrides: None
Function Calls:
_setBaseUri(string) β LifetimeNft, internal
_transferOwnership(address) β OpenZeppelin Ownable, internal
ERC721(name_,symbol_)β ERC721, internal
Called by:
None (entry point)
Gas / Complexity note: O(1)
Example: Deploy with new LifetimeNft("Lifetime", "LIFE", "https://api.example.com/metadata/", msg.sender).
setBaseUri (LN1)
Contract/Library: LifetimeNft
Description: Updates the collection-wide base URI.
Detailed Description: Owner-only setter that forwards to _setBaseUri to update storage and emit SetBaseURI.
Parameters:
baseURI_ (string, memory): New base URI string
Returns: None
Modifiers / Visibility / Mutability:
external onlyOwner nonpayable
Access Control:
Owner only
Side Effects:
Updates
baseURI
Emits:
SetBaseURI β
SetBaseURI(string baseURI)
Reverts if:
Caller is not the owner β "Ownable: caller is not the owner"
Overrides: None
Function Calls:
_setBaseUri(string) β LifetimeNft, internal
Called by:
None (entry point)
Gas / Complexity note: O(1)
Example: Owner calls setBaseUri("https://cdn.example.com/nft/") to change metadata base.
_setBaseUri (LN1)
Contract/Library: LifetimeNft
Description: Internal helper to set the base URI and emit an event.
Detailed Description: Writes baseURI to storage and emits SetBaseURI. Used by the constructor and setBaseUri.
Parameters:
baseURI_ (string, memory): New base URI string
Returns: None
Modifiers / Visibility / Mutability:
internal nonpayable
Access Control:
Unrestricted (internal)
Side Effects:
Updates
baseURI
Emits:
SetBaseURI β
SetBaseURI(string baseURI)(new base URI)
Reverts if: None
Overrides: None
Function Calls: None
Called by:
constructor β LifetimeNft
setBaseUri(string) β LifetimeNft
Gas / Complexity note: O(1)
Example: Not applicable
setMinterOperator (LN1)
Contract/Library: LifetimeNft
Description: Grants or revokes minting permission for an address.
Detailed Description: Owner-only setter for minterOperator[_minter]. Updates the permission flag and emits SetMinterOperator.
Parameters:
_minter (address): Address to update
_isActive (bool): Whether the address is authorized to mint
Returns: None
Modifiers / Visibility / Mutability:
external onlyOwner nonpayable
Access Control:
Owner only
Side Effects:
Updates
minterOperator[_minter]
Emits:
SetMinterOperator β
SetMinterOperator(address indexed minter, bool indexed isActive)
Reverts if:
Caller is not the owner β "Ownable: caller is not the owner"
Overrides: None
Function Calls: None
Called by:
None (entry point)
Gas / Complexity note: O(1)
Example: Owner calls setMinterOperator(minterAddr, true) to allow minterAddr to mint.
mint (LN1)
Contract/Library: LifetimeNft
Description: Mints a new token to the specified owner.
Detailed Description: Requires minterOperator[msg.sender] to be true. Computes tokenId = totalSupply() + 1, then _safeMint to _tokenOwner. Returns the new tokenId.
Parameters:
_tokenOwner (address): Recipient of the newly minted NFT
Returns:
tokenId (uint256): Newly minted token ID
Modifiers / Visibility / Mutability:
external nonpayable
Access Control:
Active minter operator only (
minterOperator[msg.sender] == true)
Side Effects:
Mints a new ERC721 token to
_tokenOwnerUpdates ERC721 ownership/enumeration state
May invoke
onERC721Receivedon_tokenOwnerif it is a contract
Emits:
OpenZeppelin base-type event (not mirrored in
events-reference.md):Transfer(address indexed from, address indexed to, uint256 indexed tokenId)
Reverts if:
Caller not authorized β
NotTheMinter()_tokenOwneris the zero address β "ERC721: mint to the zero address"_tokenOwnercannot receive ERC721 tokens β "ERC721: transfer to non ERC721Receiver implementer"
Overrides: None
Function Calls:
totalSupply()β ERC721Enumerable, internal_safeMint(address,uint256)β ERC721, internal
Called by:
_mintAndLockLifetimeNft β CryptoLegacyBuildManager
payForMultipleLifetimeNft β CryptoLegacyBuildManager
Gas / Complexity note: O(1) for bookkeeping; _safeMint incurs standard ERC721 mint costs
Example: An authorized minter calls mint(user) to issue a new lifetime NFT to user.
_baseURI (LN1)
Contract/Library: LifetimeNft
Description: Returns the stored base URI for metadata composition.
Detailed Description: Internal view override that exposes the baseURI storage variable to ERC721 URI logic.
Parameters: None
Returns:
uri (string, memory): Current base URI
Modifiers / Visibility / Mutability:
internal view override
Access Control:
Internal only
Side Effects: None
Emits: None
Reverts if: None
Overrides:
ERC721._baseURI()
Function Calls: None
Called by:
tokenURI(uint256)β ERC721
Gas / Complexity note: O(1)
Example: Not applicable
tokensOfOwner (LN1)
Contract/Library: LifetimeNft
Description: Enumerates all token IDs owned by the given address.
Detailed Description: Allocates an array of length balanceOf(_owner) and fills it by iterating tokenOfOwnerByIndex(_owner, i) for i in 0, balance-1.
Parameters:
_owner (address): Address to query
Returns:
tokens (uint256[], memory): Array of token IDs owned by
_owner
Modifiers / Visibility / Mutability:
external view
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if:
_owner== address(0) β "ERC721: address zero is not a valid owner"
Overrides: None
Function Calls:
balanceOf(address)β ERC721, internaltokenOfOwnerByIndex(address,uint256)β ERC721Enumerable, internal
Called by:
None (entry point)
Gas / Complexity note: O(n) by balanceOf(_owner)
Example: Client calls tokensOfOwner(user) to list all owned token IDs.
getTier (LN1)
Contract/Library: LifetimeNft
Description: Computes the tier for a given token ID.
Detailed Description: Pure function using fixed thresholds:
1β100β Silicon101β300β Gallium301β700β Indium701β1500β Tantalum1501+β Based
Parameters:
_tokenId (uint256): Token ID to classify
Returns:
tier (Tier): Tier enumeration value for
_tokenId
Modifiers / Visibility / Mutability:
external pure
Access Control:
Unrestricted
Side Effects: None
Emits: None
Reverts if: None
Overrides: None
Function Calls: None
Called by:
None (entry point)
Gas / Complexity note: O(1)
Example: Call getTier(275) to receive the corresponding tier.
LockChainGate (LCG1)
constructor (LCG1)
Contract/Library: LockChainGate
Description: Deploy-time constructor that disables initializers and sets the Ownable owner.
Detailed Description: Calls _disableInitializers() to lock upgradeable initialization and relies on the inherited Ownable constructor to assign the deployer as owner.
Parameters: None
Returns: None
Modifiers / Visibility / Mutability:
constructor nonpayable
Access Control:
Unrestricted (deployment only)
Side Effects:
Locks the
_initializedflags withinInitializableSets
owner(Ownable)
Emits: None
Reverts if: None
Overrides: None
Function Calls:
_disableInitializers() β Initializable, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Not applicable
lockChainGateStorage (LCG1)
Contract/Library: LockChainGate
Description: Returns the storage pointer for the LockChainGate storage struct.
Detailed Description: Uses inline assembly to assign the storage slot at a fixed keccak-256 position to a LCGStorage reference.
Parameters: None
Returns:
ls (LCGStorage, storage): Storage pointer to LockChainGate layout
Modifiers / Visibility / Mutability:
internal pure
Access Control:
Internal only
Side Effects: None
Emits: None
Reverts if: None
Overrides: None
Function Calls: None
Called by:
_setCrossChainsRef(FRStorage,bool,bytes8,uint256[],uint256[]) β FeeRegistry
_initializeLockChainGate(ILifetimeNft,uint64,uint64,address) β LockChainGate
setLockOperator(address,bool) β LockChainGate
setDebridgeGate(address) β LockChainGate
setDebridgeNativeFee(uint256,uint256) β LockChainGate
_setDestinationChainContract(uint256,address) β LockChainGate
_setSourceChainContract(uint256,address) β LockChainGate
setLockPeriod(uint64,uint64) β LockChainGate
setReferralCode(uint32) β LockChainGate
setCustomChainId(uint256) β LockChainGate
_writeLockLifetimeNft(address,uint256) β LockChainGate
lockLifetimeNft(uint256,address,uint256[],uint256[]) β LockChainGate
crossLockLifetimeNft(uint256,uint256,address) β LockChainGate
lockLifetimeNftToChains(uint256[],uint256[]) β LockChainGate
unlockLifetimeNft(uint256) β LockChainGate
unlockLifetimeNftFromChain(uint256) β LockChainGate
crossUnlockLifetimeNft(uint256,uint256,address) β LockChainGate
crossUpdateNftOwner(uint256,uint256,address) β LockChainGate
_deleteTokenData(address,uint256) β LockChainGate
approveLifetimeNftTo(uint256,address) β LockChainGate
transferLifetimeNftTo(uint256,address,uint256[],uint256[]) β LockChainGate
updateNftOwnerOnChainList(uint256,uint256[],uint256[]) β LockChainGate
_checkTooEarly(address) β LockChainGate
getLockedToChainsIdsOfAccount(address) β LockChainGate
getLockedUntil(address) β LockChainGate
getLockedToChainsIds(uint256) β LockChainGate
lockPeriod() β LockChainGate
transferTimeout() β LockChainGate
referralCode() β LockChainGate
ownerOfTokenId(uint256) β LockChainGate
lockedNftFromChainId(uint256) β LockChainGate
lockedNftApprovedTo(uint256) β LockChainGate
lockedNft(address) β LockChainGate
getDeBridgeChainNativeFeeAndCheck(uint256,uint256) β LockChainGate
getDeBridgeChainNativeFee(uint256,uint256) β LockChainGate
deBridgeGate() β LockChainGate
lifetimeNft() β LockChainGate
deBridgeChainConfig(uint256) β LockChainGate
getLockOperatorsList() β LockChainGate
isLockOperator(address) β LockChainGate
calculateCrossChainCreateRefNativeFee(uint256[],uint256[]) β LockChainGate
isNftLocked(address) β LockChainGate
isNftLockedAndUpdate(address) β LockChainGate
getChainId() β LockChainGate
Gas / Complexity note: O(1)
Example: Not applicable
_initializeLockChainGate (LCG1)
Contract/Library: LockChainGate
Description: Internal initializer to set Lifetime NFT address, lock config, owner, and reentrancy guard.
Detailed Description: Fetches storage, sets lifetimeNft, lockPeriod, and transferTimeout, emits config event, transfers ownership to _owner, and initializes ReentrancyGuardUpgradeable.
Parameters:
_lifetimeNft (ILifetimeNft): Lifetime NFT contract
_lockPeriod (uint64): Lock period in seconds
_transferTimeout (uint64): Timeout between lock and transfer in seconds
_owner (address): New owner
Returns: None
Modifiers / Visibility / Mutability:
internal nonpayable initializer
Access Control:
Internal only
Side Effects:
Updates
lifetimeNft,lockPeriod,transferTimeoutTransfers ownership via
_transferOwnership(_owner)Initializes reentrancy guard counters via
__ReentrancyGuard_init()
Emits:
SetLockPeriodConfig β
SetLockPeriodConfig(uint256 lockPeriod, uint256 transferTimeout)
Reverts if:
Called more than once β "Initializable: contract is already initialized"
Overrides: None
Function Calls:
lockChainGateStorage() β LockChainGate, internal
_transferOwnership(address) β Ownable, internal
__ReentrancyGuard_init()β ReentrancyGuardUpgradeable, internal
Called by:
initialize(address,uint32,uint32,ILifetimeNft,uint64,uint64) β FeeRegistry
Gas / Complexity note: O(1)
Example: Not applicable
setLockOperator (LCG1)
Contract/Library: LockChainGate
Description: Adds or removes an address from the lock operators set.
Detailed Description: Loads storage; if _isAdd is true, adds _operator to lockOperators, else removes it. Emits the corresponding event.
Parameters:
_operator (address): Address to add or remove
_isAdd (bool): True to add; false to remove
Returns: None
Modifiers / Visibility / Mutability:
external nonpayable onlyOwner
Access Control:
onlyOwner
Side Effects:
Updates
lockOperatorsset
Emits:
AddLockOperator β
AddLockOperator(address indexed lockOperator)RemoveLockOperator β
RemoveLockOperator(address indexed lockOperator)
Reverts if:
caller is not owner β "Ownable: caller is not the owner"
Overrides: None
Function Calls:
lockChainGateStorage() β LockChainGate, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Owner calls to authorize a service account as lock operator.
setDebridgeGate (LCG1)
Contract/Library: LockChainGate
Description: Sets the deBridgeGate contract used for cross-chain messages.
Detailed Description: Stores _deBridgeGate into deBridgeGate in storage and emits an event.
Parameters:
_deBridgeGate (address): deBridgeGate contract address
Returns: None
Modifiers / Visibility / Mutability:
external nonpayable onlyOwner
Access Control:
onlyOwner
Side Effects:
Updates
deBridgeGate
Emits:
SetDeBridgeGate β
SetDeBridgeGate(address indexed deBridgeGate)
Reverts if:
caller is not owner β "Ownable: caller is not the owner"
Overrides: None
Function Calls:
lockChainGateStorage() β LockChainGate, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Owner configures deBridgeGate after deployment.
setDebridgeNativeFee (LCG1)
Contract/Library: LockChainGate
Description: Sets the per-chain native fee used when sending cross-chain messages.
Detailed Description: Writes _nativeFee to deBridgeNativeFee_chainId in storage; emits an event.
Parameters:
_chainId (uint256): Destination chain ID
_nativeFee (uint256): Fee amount in wei
Returns: None
Modifiers / Visibility / Mutability:
external nonpayable onlyOwner
Access Control:
onlyOwner
Side Effects:
Updates
deBridgeNativeFee_chainId
Emits:
SetDeBridgeNativeFee β
SetDeBridgeNativeFee(uint256 indexed chainId, uint256 nativeFee)
Reverts if:
caller is not owner β "Ownable: caller is not the owner"
Overrides: None
Function Calls:
lockChainGateStorage() β LockChainGate, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Owner adjusts fixed fee per remote chain.
_setDestinationChainContract (LCG1)
Contract/Library: LockChainGate
Description: Internal setter for the destination chain contract mapping.
Detailed Description: Updates destinationChainContracts_chainId and emits an event.
Parameters:
_chainId (uint256): Destination chain ID
_chainContract (address): Contract address on destination chain
Returns: None
Modifiers / Visibility / Mutability:
internal nonpayable
Access Control:
Internal only
Side Effects:
Updates
destinationChainContracts_chainId
Emits:
SetDestinationChainContract β
SetDestinationChainContract(uint256 indexed chainId, address indexed chainContract)
Reverts if: None
Overrides: None
Function Calls:
lockChainGateStorage() β LockChainGate, internal
Called by:
setDestinationChainContract(uint256,address) β LockChainGate
setSourceAndDestinationChainContract(uint256,address) β LockChainGate
Gas / Complexity note: O(1)
Example: Not applicable
setDestinationChainContract (LCG1)
Contract/Library: LockChainGate
Description: Public setter for the destination chain contract mapping.
Detailed Description: Calls internal _setDestinationChainContract.
Parameters:
_chainId (uint256): Destination chain ID
_chainContract (address): Contract address on destination chain
Returns: None
Modifiers / Visibility / Mutability:
external nonpayable onlyOwner
Access Control:
onlyOwner
Side Effects:
Updates
destinationChainContracts_chainIdvia internal call
Emits:
SetDestinationChainContract β
SetDestinationChainContract(uint256 indexed chainId, address indexed chainContract)
Reverts if:
caller is not owner β "Ownable: caller is not the owner"
Overrides: None
Function Calls:
_setDestinationChainContract(uint256,address) β LockChainGate, internal
Called by: None (entry point)
Gas / Complexity note: O(1)
Example: Owner configures remote recipient contract for a new chain.
_setSourceChainContract (LCG1)
Contract/Library: LockChainGate
Description: Internal setter for source chain contract mapping.
Detailed Description: Updates sourceChainsContracts_chainId and emits an event.
Parameters:
_chainId (uint256): Source chain ID
_chainContract (address): Contract address on source chain
Returns: None
Modifiers / Visibility / Mutability:
internal nonpayable
Access Control:
Internal only
Side Effects:
Updates
sourceChainsContracts_chainId
Emits:
SetSourceChainContract β
SetSourceChainContract(uint256 indexed chainId, address indexed chainContract)
Reverts if: None
Overrides: None
Function Calls:
lockChainGateStorage() β LockChainGate, internal
Called by:
setSourceChainContract(uint256,address) β LockChainGate
setSourceAndDestinationChainContract(uint256,address) β LockChainGate
Gas / Complexity note: O(1)
Example: Not applicable

