Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Has been cancelled
CI/CD Pipeline / Security Scanning (push) Has been cancelled
CI/CD Pipeline / Lint and Format (push) Has been cancelled
CI/CD Pipeline / Terraform Validation (push) Has been cancelled
CI/CD Pipeline / Kubernetes Validation (push) Has been cancelled
Validation / validate-genesis (push) Has started running
Validation / validate-terraform (push) Has been cancelled
Validation / validate-kubernetes (push) Has been cancelled
Validation / validate-smart-contracts (push) Has been cancelled
Validation / validate-security (push) Has been cancelled
Validation / validate-documentation (push) Has been cancelled
Prevent post-init registry pointer swaps; add test_setRegistry_oneTimeOnly (8/8 GRUCompliantTokensRegistryTest). Co-authored-by: Cursor <cursoragent@cursor.com>
40 lines
1.5 KiB
Solidity
40 lines
1.5 KiB
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity ^0.8.20;
|
|
|
|
import "./UniversalAssetRegistry.sol";
|
|
|
|
/**
|
|
* @title GRUAssetRegistryFacet
|
|
* @notice ERC-2535 Diamond facet adapter: delegates to UniversalAssetRegistry so M00 Diamond exposes GRU/c* asset registry.
|
|
* @dev Attach to M00 Diamond; set registry via setRegistry. All c* registered via registerGRUCompliantAsset are then queryable via this facet.
|
|
*/
|
|
contract GRUAssetRegistryFacet {
|
|
UniversalAssetRegistry public registry;
|
|
|
|
event RegistrySet(address indexed registry);
|
|
|
|
/// @notice One-time set of UniversalAssetRegistry delegate. Callable once (diamond cut init or standalone deploy).
|
|
function setRegistry(address _registry) external {
|
|
require(address(registry) == address(0), "RegistryAlreadySet");
|
|
require(_registry != address(0), "Zero registry");
|
|
registry = UniversalAssetRegistry(_registry);
|
|
emit RegistrySet(_registry);
|
|
}
|
|
|
|
function getAsset(address token) external view returns (UniversalAssetRegistry.UniversalAsset memory) {
|
|
return registry.getAsset(token);
|
|
}
|
|
|
|
function getAssetType(address token) external view returns (UniversalAssetRegistry.AssetType) {
|
|
return registry.getAssetType(token);
|
|
}
|
|
|
|
function getAssetsByType(UniversalAssetRegistry.AssetType assetType) external view returns (address[] memory) {
|
|
return registry.getAssetsByType(assetType);
|
|
}
|
|
|
|
function isAssetActive(address token) external view returns (bool) {
|
|
return registry.isAssetActive(token);
|
|
}
|
|
}
|