From 018e297c837c0b31cb63a158de8cab5609e3cb23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20S=C3=A1nchez?= Date: Thu, 14 Mar 2024 11:37:57 +0000 Subject: [PATCH] ENS set name --- packages/hardhat/contracts/BGGrants.sol | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/hardhat/contracts/BGGrants.sol b/packages/hardhat/contracts/BGGrants.sol index c79bf23..414dede 100644 --- a/packages/hardhat/contracts/BGGrants.sol +++ b/packages/hardhat/contracts/BGGrants.sol @@ -5,6 +5,10 @@ import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; +interface ENSContract { + function setName(string memory newName) external; +} + /** * @title BGGrants * @notice A smart contract to split ETH or ERC20 tokens between multiple recipients. @@ -15,6 +19,8 @@ import "@openzeppelin/contracts/access/AccessControl.sol"; contract BGGrants is ReentrancyGuard, AccessControl { using SafeERC20 for IERC20; + // Mainnet ENS contract + ENSContract public immutable ensContract = ENSContract(0xa58E81fe9b61B5c3fE2AFD33CF304c454AbFc7Cb); bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE"); @@ -227,5 +233,14 @@ contract BGGrants is ReentrancyGuard, AccessControl { } } + /** + * Set the reverse ENS name for the contract + * @param _newName The new ENS name for the contract + * @dev only meant to be call on mainnet + */ + function setName(string memory _newName) onlyAdmin public { + ensContract.setName(_newName); + } + receive() external payable {} }