Secure Your .ETH Forever: Automate Your ENS Renewal with Alchemix & Gelato

Gelato Team

Jul 6, 2023

Every Ethereum user knows the value of an Ethereum Name Service (ENS) domain. These human-readable addresses (like "yourname.eth") replace cumbersome hexadecimal addresses, making transactions easier. However, ENS domains require regular renewals. Forgetting to renew could result in losing your name — leading to confusion or misdirected transactions.

The Self-Repaying ENS (SRENS) solves this problem. Built by wary during a hackathon, it automates ENS renewals, ensuring your .eth name never expires. The service combines Alchemix and Gelato — Alchemix creates self-repaying loans (ETH → alETH), while Gelato automates renewals.

How Does Self-Repaying ENS Work?

SRENS leverages four protocols: Gelato Automation, Alchemix, Curve, and ENS.

Alchemix

Alchemix lets users take advances on future yield using self-repaying loans. For SRENS, users deposit ETH to mint alETH, which covers ENS renewal fees.

Curve

SRENS uses Curve to swap alETH back into ETH for paying ENS fees efficiently.

ENS

ENS domains must be renewed annually. SRENS automates this requirement so users never lose their names.

Gelato Automation

Gelato bots monitor renewal deadlines and trigger automated ENS renewals without manual intervention.

How to Use SRENS

  1. Deposit funds: Add ETH to the Alchemix vault to mint alETH covering your ENS fees.

  2. Enable auto-renewal: Visit the SRENS website, search your ENS name, approve contract access, then toggle auto-renew.

  3. Subscribe: After approval, click "Subscribe" to activate auto-renewal. From now on, SRENS keeps your ENS name renewed.

The Role of Gelato in SRENS

Gelato automates ENS renewals via its automation network:

  • Approve minting: Users allow SRENS to mint enough alETH for multiple renewals (alchemistV2.approveMint()).

  • Subscribe: Users subscribe to a name (srens.subscribe(name)), which creates a Gelato task tied to srens.checker().

Example subscribe() logic:

if (_taskIds[msg.sender] == 0) {
  _taskIds[msg.sender] = gelatoOps.createTask(
    address(this),
    abi.encode(this.renew.selector),
    _getModuleData(msg.sender),
    ETH
  );
}

Gelato checks renewals via checker():

function checker(address subscriber) external view returns (bool canExec, bytes memory execPayload) {
  return highestLimit == 0
    ? (false, bytes("no names to renew"))
    : (true, abi.encodeCall(this.renew, (mostExpensiveNameToRenew, subscriber)));
}

If conditions are met, Gelato executes srens.renew(), which borrows alETH, swaps it into ETH, and calls ENSRegistrarController.renew() to extend the domain.

function renew(string calldata name, address subscriber) external payable {
  _borrowSelfRepayingETHFrom(subscriber, neededETH);
  controller.renew{value: namePrice}(name, renewalDuration);

  (bool success,) = gelato.call{value: address(this).balance}("");
  if (!success) revert FailedTransfer();
}

Users can unsubscribe anytime:

function unsubscribe(string memory name) external {
  bool removed = _subscribedNames[msg.sender].remove(name);
  if (!removed) revert IllegalArgument();
  emit Unsubscribe(msg.sender, name, name);
}

Further Reading

Conclusion

SRENS leverages Alchemix, Gelato, Curve, and ENS to fully automate ENS renewals. By using self-repaying loans and automated execution, users never worry about losing their ENS names again.

About Gelato

Gelato is Web3’s decentralized backend powering automated, gasless, and off-chain aware smart contracts on Ethereum, Arbitrum, Polygon, Optimism, zkSync, and more. 400+ projects rely on Gelato for millions of transactions across DeFi, NFTs, and gaming.

Core services include:

  • Web3 Functions: Connect contracts to off-chain data & computation.

  • Automate: Automate contracts with decentralized, reliable execution.

  • Relay: Provide gasless transactions via API.

  • Gasless Wallet: SDK combining Gelato Relay with Safe smart contract wallets to enable account abstraction.

Witness Gelato’s journey toward a decentralized future. Subscribe to our newsletter and follow Twitter for updates.

Ready to build?

Start with a testnet, launch your mainnet in days, and scale with industry-leading UX.

Ready to build?

Start with a testnet, launch your mainnet in days, and scale with industry-leading UX.

Ready to build?

Start with a testnet, launch your mainnet in days, and scale with industry-leading UX.

Ready to build?

Start with a testnet, launch your mainnet in days, and scale with industry-leading UX.