Перейти к содержимому
Проверенный контрактТочноеMIT

ModelRegistry

Адрес0x2b8aa4bc2d2697320eaea52d0cb5e10d64b4092b
Баланс

0 ETH

 

Транзакций

10

 

Компилятор

solc 0.8.20

 

Тот же код

Только этот контракт

 

Подробности

Компилятор
solc 0.8.20+commit.a1b79de6
Язык
solidity
Оптимизация
Да, 200 прогонов
Версия EVM
paris
Через IR
да
Лицензия
MIT
Совпадение
Точноекод создания: да, код в сети: да
Проверен на Sourcify
Создан в блоке
26 298 878
Транзакция создания
0xd566c6ebfc…eea4261b54

contracts/ModelRegistry.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/Ownable.sol";
import "./interfaces/IModelRegistry.sol";

interface IStringModelTokenManager {
    function getTokenAddress(string memory modelId) external view returns (address);
    function hasToken(string memory modelId) external view returns (bool);
}

/**
 * @title ModelRegistry
 * @dev Registry contract to map model IDs to their corresponding token addresses and performance metrics.
 * IModelRegistry is the canonical API; the deprecated aliases below delegate to it
 * so the two can never diverge.
 */
contract ModelRegistry is Ownable, IModelRegistry {
    struct ModelInfo {
        address tokenAddress;
        string performanceMetric;
        bool active;
    }

    mapping(uint256 => ModelInfo) public models;
    mapping(uint256 => bool) public isModelRegistered;
    mapping(address => uint256) public tokenToModel;
    mapping(address => bool) public isTokenRegistered;
    uint256 public nextModelId = 1;

    mapping(string => address) public modelPools;
    mapping(address => string) public poolToStringModel;
    address public stringModelTokenManager;
    mapping(address => bool) public poolRegistrars;

    // --- Model token re-pointing gate (HOK-2... / security review H-2) ---
    // `updateModel`/`updateStringModel` repoint a model's token via `_updateModel` WITHOUT
    // migrating the dependent state (`modelPools`/`poolToStringModel`, `weightGenesis`, and the
    // external TokenManager/FundingVault token mappings). That silently desyncs the registry: the
    // AMM pool keeps trading the old token while reward minting moves to the new one. Until an
    // atomic-migration replacement exists, both update paths are gated by this flag, which defaults
    // to FALSE so mainnet is protected without relying on a post-deploy step. Re-enabling is a
    // deliberate governance action (owner == timelock post-handoff). The rework path: either flip
    // this on alongside a migration that clears pool/genesis mappings, or replace the gate with a
    // "no pool registered yet" precondition in `_updateModel`.
    bool public modelUpdatesEnabled;

    // --- Model-weight lineage genesis (HOK-2133) ---
    // The genesis weight commitment per model: the root of the model's hash-linked weight lineage that
    // DeltaVerifier reads to initialize its per-model head. Set by the same authority that registers the
    // model (today the owner), so when registration becomes permissionless the genesis seeding does too —
    // no separate admin chokepoint. Write-once at the registry; corrections happen via DeltaVerifier's
    // governed head-reset, not by rewriting the root.
    mapping(uint256 => bytes32) public weightGenesis;

    event ModelRegistered(uint256 indexed modelId, address indexed tokenAddress, string performanceMetric);
    event ModelUpdated(uint256 indexed modelId, address indexed newTokenAddress);
    event MetricUpdated(uint256 indexed modelId, string newMetric);
    event ModelDeactivated(uint256 indexed modelId);
    event ModelReactivated(uint256 indexed modelId);
    event StringModelRegistered(string indexed modelId, address indexed tokenAddress, string performanceMetric);
    event StringModelUpdated(string indexed modelId, address indexed newTokenAddress);
    event StringMetricUpdated(string indexed modelId, string newMetric);
    event StringModelDeactivated(string indexed modelId);
    event StringModelReactivated(string indexed modelId);
    event PoolRegistered(string indexed modelId, address indexed poolAddress);
    event StringModelTokenManagerUpdated(address indexed tokenManager);
    event PoolRegistrarUpdated(address indexed registrar, bool authorized);
    event WeightGenesisSet(uint256 indexed modelId, bytes32 genesis);
    event ModelUpdatesEnabledSet(bool enabled);

    constructor() Ownable() {}

    modifier onlyPoolRegistrarOrOwner() {
        require(
            owner() == msg.sender || poolRegistrars[msg.sender],
            "Caller is not authorized to register pools"
        );
        _;
    }

    /// @dev Gates the model token re-pointing paths. See `modelUpdatesEnabled`.
    modifier whenModelUpdatesEnabled() {
        require(modelUpdatesEnabled, "Model updates disabled");
        _;
    }

    /**
     * @dev Enable or disable the `updateModel`/`updateStringModel` token re-pointing paths.
     * Disabled by default (mainnet-safe). Only re-enable once a migration that also updates
     * pool/weight-genesis/external mappings exists, or after replacing the desync-prone logic.
     * @param enabled New state for the gate.
     */
    function setModelUpdatesEnabled(bool enabled) external onlyOwner {
        modelUpdatesEnabled = enabled;
        emit ModelUpdatesEnabledSet(enabled);
    }

    /**
     * @dev Sets the TokenManager used to validate string-based model registrations
     * @param tokenManager Address of the TokenManager contract
     */
    function setStringModelTokenManager(address tokenManager) external onlyOwner {
        require(tokenManager != address(0), "TokenManager cannot be zero");
        stringModelTokenManager = tokenManager;
        emit StringModelTokenManagerUpdated(tokenManager);
    }

    /**
     * @dev Registers a new model with its corresponding token address and performance metric
     * @param modelId The unique identifier for the model
     * @param token The address of the token contract for this model
     * @param performanceMetric The performance metric used for this model
     */
    function registerModel(uint256 modelId, address token, string memory performanceMetric) external onlyOwner {
        _registerModel(modelId, token, performanceMetric);
        emit ModelRegistered(modelId, token, performanceMetric);
    }

    /**
     * @dev Sets the genesis weight commitment (lineage root) for a registered model. Write-once: it seeds
     * DeltaVerifier's per-model lineage head so the first mint must parent off a deliberately-set genesis
     * rather than letting the first accepted mint define history. Authorized by the model-registration
     * authority (owner today) so genesis seeding tracks registration permissions. (HOK-2133)
     * @param modelId The model whose lineage root is being set
     * @param genesis The genesis weight commitment (e.g. 0x + sha256 of the baseline model artifact)
     */
    function setWeightGenesis(uint256 modelId, bytes32 genesis) external onlyOwner {
        require(isModelRegistered[modelId], "Model not registered");
        require(genesis != bytes32(0), "Genesis cannot be empty");
        require(weightGenesis[modelId] == bytes32(0), "Genesis already set");
        weightGenesis[modelId] = genesis;
        emit WeightGenesisSet(modelId, genesis);
    }

    /**
     * @dev Registers a new model with auto-incremented ID
     * @param token The address of the token contract for this model
     * @param performanceMetric The performance metric used for this model
     * @return The assigned model ID
     */
    function registerModelAutoId(address token, string memory performanceMetric) external onlyOwner returns (uint256) {
        uint256 modelId = nextModelId;
        nextModelId++;

        _registerModel(modelId, token, performanceMetric);
        emit ModelRegistered(modelId, token, performanceMetric);
        return modelId;
    }

    /**
     * @dev Updates the token address for an existing model
     * @param modelId The model identifier to update
     * @param newToken The new token address
     */
    function updateModel(uint256 modelId, address newToken) external onlyOwner whenModelUpdatesEnabled {
        _updateModel(modelId, newToken);
        emit ModelUpdated(modelId, newToken);
    }

    /**
     * @dev Updates the performance metric for an existing model
     * @param modelId The model identifier to update
     * @param newMetric The new performance metric
     */
    function updateMetric(uint256 modelId, string memory newMetric) external onlyOwner {
        require(isModelRegistered[modelId], "Model not registered");
        require(bytes(newMetric).length > 0, "Performance metric cannot be empty");
        
        models[modelId].performanceMetric = newMetric;
        
        emit MetricUpdated(modelId, newMetric);
    }

    /**
     * @dev Deactivates a model
     * @param modelId The model identifier to deactivate
     */
    function deactivateModel(uint256 modelId) external onlyOwner {
        require(isModelRegistered[modelId], "Model not registered");
        require(models[modelId].active, "Model already deactivated");

        models[modelId].active = false;

        emit ModelDeactivated(modelId);
    }

    /**
     * @dev Reactivates a model
     * @param modelId The model identifier to reactivate
     */
    function reactivateModel(uint256 modelId) external onlyOwner {
        require(isModelRegistered[modelId], "Model not registered");
        require(!models[modelId].active, "Model already active");

        models[modelId].active = true;

        emit ModelReactivated(modelId);
    }

    /**
     * @dev Deprecated alias of getTokenAddress, kept for older integrations.
     */
    function getToken(uint256 modelId) external view returns (address) {
        return getTokenAddress(modelId);
    }

    /**
     * @dev Gets the token address for a given model ID
     * @param modelId The model identifier
     * @return The token address for the model
     */
    function getTokenAddress(uint256 modelId) public view returns (address) {
        require(isModelRegistered[modelId], "Model not registered");
        return models[modelId].tokenAddress;
    }

    /**
     * @dev Gets the performance metric for a given model ID
     * @param modelId The model identifier
     * @return The performance metric for the model
     */
    function getMetric(uint256 modelId) external view returns (string memory) {
        require(isModelRegistered[modelId], "Model not registered");
        return models[modelId].performanceMetric;
    }

    /**
     * @dev Gets the complete model information
     * @param modelId The model identifier
     * @return The complete ModelInfo struct
     */
    function getModel(uint256 modelId) external view returns (ModelInfo memory) {
        require(isModelRegistered[modelId], "Model not registered");
        return models[modelId];
    }

    /**
     * @dev Gets the model ID for a given token address (reverse lookup)
     * @param tokenAddress The token address
     * @return The model ID for the token
     */
    function getModelId(address tokenAddress) external view returns (uint256) {
        require(isTokenRegistered[tokenAddress], "Token not registered");
        return tokenToModel[tokenAddress];
    }

    /**
     * @dev Checks if a model is registered
     * @param modelId The model identifier to check
     * @return True if the model is registered, false otherwise
     */
    function isRegistered(uint256 modelId) public view returns (bool) {
        return isModelRegistered[modelId];
    }

    /**
     * @dev Deprecated alias of isRegistered, kept for older integrations.
     */
    function exists(uint256 modelId) external view returns (bool) {
        return isRegistered(modelId);
    }

    /**
     * @dev Checks if a numeric model is active
     * @param modelId The model identifier to check
     * @return True if the model is registered and active
     */
    function isActive(uint256 modelId) public view returns (bool) {
        return isModelRegistered[modelId] && models[modelId].active;
    }

    /**
     * @dev Deprecated alias of isActive, kept for older integrations.
     */
    function isModelActive(uint256 modelId) external view returns (bool) {
        return isActive(modelId);
    }

    // ============================================================
    // STRING-BASED MODEL REGISTRY (canonicalized to numeric IDs)
    // ============================================================

    /**
     * @dev Registers a new model with string ID
     * @param modelId The unique string identifier for the model
     * @param token The address of the token contract for this model
     * @param performanceMetric The performance metric used for this model
     */
    function registerStringModel(string memory modelId, address token, string memory performanceMetric) external onlyOwner {
        require(bytes(modelId).length > 0, "Model ID cannot be empty");
        require(token != address(0), "Token address cannot be zero");
        require(bytes(performanceMetric).length > 0, "Performance metric cannot be empty");

        uint256 numericModelId = _parseModelId(modelId);
        require(!isModelRegistered[numericModelId], "Model already registered");
        require(!isTokenRegistered[token], "Token already registered");
        if (stringModelTokenManager != address(0)) {
            IStringModelTokenManager tokenManager = IStringModelTokenManager(stringModelTokenManager);
            require(tokenManager.hasToken(modelId), "Token not registered in TokenManager");
            require(
                tokenManager.getTokenAddress(modelId) == token,
                "Token address mismatch with TokenManager"
            );
        }

        _registerModel(numericModelId, token, performanceMetric);
        emit ModelRegistered(numericModelId, token, performanceMetric);
        emit StringModelRegistered(modelId, token, performanceMetric);
    }

    /**
     * @dev Updates the token address for an existing string-based model
     * @param modelId The model identifier to update
     * @param newToken The new token address
     */
    function updateStringModel(string memory modelId, address newToken) external onlyOwner whenModelUpdatesEnabled {
        uint256 numericModelId = _parseModelId(modelId);
        _updateModel(numericModelId, newToken);
        emit ModelUpdated(numericModelId, newToken);
        emit StringModelUpdated(modelId, newToken);
    }

    /**
     * @dev Updates the performance metric for an existing string-based model
     * @param modelId The model identifier to update
     * @param newMetric The new performance metric
     */
    function updateStringMetric(string memory modelId, string memory newMetric) external onlyOwner {
        uint256 numericModelId = _parseModelId(modelId);
        require(isModelRegistered[numericModelId], "Model not registered");
        require(bytes(newMetric).length > 0, "Performance metric cannot be empty");

        models[numericModelId].performanceMetric = newMetric;
        emit MetricUpdated(numericModelId, newMetric);
        emit StringMetricUpdated(modelId, newMetric);
    }

    /**
     * @dev Gets the token address for a given string model ID
     * @param modelId The model identifier
     * @return The token address for the model
     */
    function getStringToken(string memory modelId) external view returns (address) {
        uint256 numericModelId = _parseModelId(modelId);
        require(isModelRegistered[numericModelId], "Model not registered");
        return models[numericModelId].tokenAddress;
    }

    /**
     * @dev Gets the string model ID for a given token address (reverse lookup)
     * @param tokenAddress The token address
     * @return The model ID for the token
     */
    function getStringModelId(address tokenAddress) external view returns (string memory) {
        require(isTokenRegistered[tokenAddress], "Token not registered");
        return _uintToString(tokenToModel[tokenAddress]);
    }

    /**
     * @dev Compatibility getter retained for older integrations that read the
     * former public `modelsByString` mapping directly.
     */
    function modelsByString(string memory modelId) external view returns (
        address tokenAddress,
        string memory performanceMetric,
        bool active
    ) {
        if (!_isCanonicalStringModelId(modelId)) {
            return (address(0), "", false);
        }

        uint256 numericModelId = _parseModelId(modelId);
        if (!isModelRegistered[numericModelId]) {
            return (address(0), "", false);
        }

        ModelInfo storage model = models[numericModelId];
        return (model.tokenAddress, model.performanceMetric, model.active);
    }

    /**
     * @dev Deprecated alias of isStringRegistered, retained for older
     * integrations that read the former public `isStringModelRegistered` mapping.
     */
    function isStringModelRegistered(string memory modelId) external view returns (bool) {
        return isStringRegistered(modelId);
    }

    /**
     * @dev Checks if a string model is registered
     * @param modelId The model identifier to check
     * @return True if the model is registered, false otherwise
     */
    function isStringRegistered(string memory modelId) public view returns (bool) {
        if (!_isCanonicalStringModelId(modelId)) {
            return false;
        }

        return isModelRegistered[_parseModelId(modelId)];
    }

    /**
     * @dev Deactivates a string-based model
     * @param modelId The model identifier to deactivate
     */
    function deactivateStringModel(string memory modelId) external onlyOwner {
        uint256 numericModelId = _parseModelId(modelId);
        require(isModelRegistered[numericModelId], "Model not registered");
        require(models[numericModelId].active, "Model already deactivated");

        models[numericModelId].active = false;
        emit ModelDeactivated(numericModelId);
        emit StringModelDeactivated(modelId);
    }

    /**
     * @dev Reactivates a string-based model
     * @param modelId The model identifier to reactivate
     */
    function reactivateStringModel(string memory modelId) external onlyOwner {
        uint256 numericModelId = _parseModelId(modelId);
        require(isModelRegistered[numericModelId], "Model not registered");
        require(!models[numericModelId].active, "Model already active");

        models[numericModelId].active = true;
        emit ModelReactivated(numericModelId);
        emit StringModelReactivated(modelId);
    }

    /**
     * @dev Checks if a string model is active
     * @param modelId The model identifier to check
     * @return True if the model is registered and active
     */
    function isStringActive(string memory modelId) public view returns (bool) {
        if (!_isCanonicalStringModelId(modelId)) {
            return false;
        }

        uint256 numericModelId = _parseModelId(modelId);
        return isModelRegistered[numericModelId] && models[numericModelId].active;
    }

    /**
     * @dev Deprecated alias of isStringActive, kept for older integrations.
     */
    function isModelActive(string memory modelId) external view returns (bool) {
        return isStringActive(modelId);
    }

    // ============================================================
    // AMM POOL REGISTRY
    // ============================================================

    /**
     * @dev Grants or revokes permission to register pools
     * @param registrar The account allowed to register pools
     * @param authorized Whether the account is authorized
     */
    function setPoolRegistrar(address registrar, bool authorized) external onlyOwner {
        require(registrar != address(0), "Registrar cannot be zero");

        poolRegistrars[registrar] = authorized;
        emit PoolRegistrarUpdated(registrar, authorized);
    }

    /**
     * @dev Registers an AMM pool for a model
     * @param modelId The string model identifier
     * @param pool The AMM pool address
     */
    function registerPool(string memory modelId, address pool) external onlyPoolRegistrarOrOwner {
        require(bytes(modelId).length > 0, "Model ID cannot be empty");
        require(pool != address(0), "Pool address cannot be zero");
        uint256 numericModelId = _parseModelId(modelId);
        require(isModelRegistered[numericModelId], "Model not registered");
        require(models[numericModelId].active, "Model is deactivated");
        require(modelPools[modelId] == address(0), "Pool already exists");
        require(bytes(poolToStringModel[pool]).length == 0, "Pool already registered to another model");

        modelPools[modelId] = pool;
        poolToStringModel[pool] = modelId;
        emit PoolRegistered(modelId, pool);
    }

    /**
     * @dev Gets the AMM pool address for a model
     * @param modelId The string model identifier
     * @return The pool address, or address(0) if no pool exists
     */
    function getPool(string memory modelId) external view returns (address) {
        return modelPools[modelId];
    }

    /**
     * @dev Checks if a model has an AMM pool
     * @param modelId The string model identifier
     * @return True if the model has a pool, false otherwise
     */
    function hasPool(string memory modelId) external view returns (bool) {
        return modelPools[modelId] != address(0);
    }

    function _registerModel(uint256 modelId, address token, string memory performanceMetric) private {
        require(token != address(0), "Token address cannot be zero");
        require(bytes(performanceMetric).length > 0, "Performance metric cannot be empty");
        require(!isModelRegistered[modelId], "Model already registered");
        require(!isTokenRegistered[token], "Token already registered");

        models[modelId] = ModelInfo({
            tokenAddress: token,
            performanceMetric: performanceMetric,
            active: true
        });
        isModelRegistered[modelId] = true;
        tokenToModel[token] = modelId;
        isTokenRegistered[token] = true;
    }

    function _updateModel(uint256 modelId, address newToken) private {
        require(newToken != address(0), "Token address cannot be zero");
        require(isModelRegistered[modelId], "Model not registered");
        require(!isTokenRegistered[newToken], "Token already registered");

        address oldToken = models[modelId].tokenAddress;
        models[modelId].tokenAddress = newToken;
        tokenToModel[oldToken] = 0;
        isTokenRegistered[oldToken] = false;
        tokenToModel[newToken] = modelId;
        isTokenRegistered[newToken] = true;
    }

    function _isCanonicalStringModelId(string memory modelId) private pure returns (bool) {
        bytes memory buffer = bytes(modelId);
        if (buffer.length == 0) {
            return false;
        }
        // One spelling per number: "01" would alias "1" for registered/active
        // checks while keying a separate pool and TokenManager entry.
        if (buffer.length > 1 && buffer[0] == 0x30) {
            return false;
        }

        for (uint256 i = 0; i < buffer.length; i++) {
            if (buffer[i] < 0x30 || buffer[i] > 0x39) {
                return false;
            }
        }

        return true;
    }

    function _parseModelId(string memory modelId) private pure returns (uint256 parsed) {
        bytes memory buffer = bytes(modelId);
        require(buffer.length > 0, "Model ID cannot be empty");
        require(buffer.length == 1 || buffer[0] != 0x30, "Model ID has leading zero");

        for (uint256 i = 0; i < buffer.length; i++) {
            uint8 charCode = uint8(buffer[i]);
            require(charCode >= 48 && charCode <= 57, "Model ID must be decimal string");
            parsed = (parsed * 10) + (charCode - 48);
        }
    }

    function _uintToString(uint256 value) private pure returns (string memory) {
        if (value == 0) {
            return "0";
        }

        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }

        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }

        return string(buffer);
    }
}

@openzeppelin/contracts/access/Ownable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

@openzeppelin/contracts/utils/Context.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

contracts/interfaces/IModelRegistry.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/**
 * @title IModelRegistry
 * @dev Canonical ModelRegistry API for on-chain consumers. ModelRegistry keeps
 * older alias names (exists, isModelActive, isStringModelRegistered) for
 * off-chain compatibility; they delegate to these functions and are deprecated.
 *
 * "Registered" means the model exists; "active" means registered AND not
 * deactivated. The two are intentionally distinct.
 */
interface IModelRegistry {
    // Numeric model IDs
    function isRegistered(uint256 modelId) external view returns (bool);
    function isActive(uint256 modelId) external view returns (bool);
    function getTokenAddress(uint256 modelId) external view returns (address);
    function weightGenesis(uint256 modelId) external view returns (bytes32);

    // Canonical string model IDs ("1846" etc.)
    function isStringRegistered(string memory modelId) external view returns (bool);
    function isStringActive(string memory modelId) external view returns (bool);
    function getStringToken(string memory modelId) external view returns (address);

    // AMM pools
    function registerPool(string memory modelId, address pool) external;
    function getPool(string memory modelId) external view returns (address);
    function hasPool(string memory modelId) external view returns (bool);
}
Настройки компилятораПоказать
{
  "viaIR": true,
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "paris"
}

Исходный код и метаданные: Sourcify.

Исходный код принадлежит авторам контракта.