Contract Source Code:
File 1 of 5 : RegistryModuleOwnerCustom.sol
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.24; import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; import {IGetCCIPAdmin} from "../interfaces/IGetCCIPAdmin.sol"; import {IOwner} from "../interfaces/IOwner.sol"; import {ITokenAdminRegistry} from "../interfaces/ITokenAdminRegistry.sol"; contract RegistryModuleOwnerCustom is ITypeAndVersion { error CanOnlySelfRegister(address admin, address token); error AddressZero(); event AdministratorRegistered(address indexed token, address indexed administrator); string public constant override typeAndVersion = "RegistryModuleOwnerCustom 1.5.0"; // The TokenAdminRegistry contract ITokenAdminRegistry internal immutable i_tokenAdminRegistry; constructor(address tokenAdminRegistry) { if (tokenAdminRegistry == address(0)) { revert AddressZero(); } i_tokenAdminRegistry = ITokenAdminRegistry(tokenAdminRegistry); } /// @notice Registers the admin of the token using the `getCCIPAdmin` method. /// @param token The token to register the admin for. /// @dev The caller must be the admin returned by the `getCCIPAdmin` method. function registerAdminViaGetCCIPAdmin(address token) external { _registerAdmin(token, IGetCCIPAdmin(token).getCCIPAdmin()); } /// @notice Registers the admin of the token using the `owner` method. /// @param token The token to register the admin for. /// @dev The caller must be the admin returned by the `owner` method. function registerAdminViaOwner(address token) external { _registerAdmin(token, IOwner(token).owner()); } /// @notice Registers the admin of the token to msg.sender given that the /// admin is equal to msg.sender. /// @param token The token to register the admin for. /// @param admin The caller must be the admin. function _registerAdmin(address token, address admin) internal { if (admin != msg.sender) { revert CanOnlySelfRegister(admin, token); } i_tokenAdminRegistry.proposeAdministrator(token, admin); emit AdministratorRegistered(token, admin); } }
File 2 of 5 : ITypeAndVersion.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface ITypeAndVersion { function typeAndVersion() external pure returns (string memory); }
File 3 of 5 : IGetCCIPAdmin.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IGetCCIPAdmin { /// @notice Returns the admin of the token. /// @dev This method is named to never conflict with existing methods. function getCCIPAdmin() external view returns (address); }
File 4 of 5 : IOwner.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IOwner { /// @notice Returns the owner of the contract. /// @dev This method is named to match with the OpenZeppelin Ownable contract. function owner() external view returns (address); }
File 5 of 5 : ITokenAdminRegistry.sol
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; interface ITokenAdminRegistry { /// @notice Returns the pool for the given token. function getPool(address token) external view returns (address); /// @notice Proposes an administrator for the given token as pending administrator. /// @param localToken The token to register the administrator for. /// @param administrator The administrator to register. function proposeAdministrator(address localToken, address administrator) external; }
Please enter a contract address above to load the contract details and source code.
Please DO NOT store any passwords or private keys here. A private note (up to 100 characters) can be saved and is useful for transaction tracking.
This website uses cookies to improve your experience. By continuing to use this website, you agree to its Terms and Privacy Policy.