This contract's source code is verified! Compiler
0.8.20+commit.a1b79de6
File 1 of 4: ENSUltraBulk.sol
pragma solidity ~0.8.17;
import "./IETHRegistrarController.sol";
import "./IUltraBulkRenewal.sol";
import "solmate/auth/Owned.sol";
contract UltraBulk is IUltraBulkRenewal, Owned {
IETHRegistrarController public controller;
constructor(IETHRegistrarController _controller) Owned(msg.sender) {
controller = _controller;
}
function renewAll(
string[] calldata names,
uint256 duration,
uint256 price
) external payable override {
uint256 length = names.length;
uint256 i = 0;
uint256 total = price * length;
require(msg.value > total, "insufficient balance");
while (i < length) {
controller.renew{value: price}(names[i], duration);
unchecked {
++i;
}
}
}
function multiCommit(
bytes32[] calldata commitments
) external payable {
uint256 length = commitments.length;
uint256 i = 0;
while (i < length) {
controller.commit(commitments[i]);
unchecked {
++i;
}
}
}
function multiRegisterWithAddress(
string[] calldata names,
address[] calldata owners,
uint256 duration,
bytes32 secret,
address resolver,
address addr
) external payable {
multiRegisterInternal(names, owners, duration, secret, resolver, addr);
}
function multiRegister(
string[] calldata names,
address[] calldata owners,
uint256 duration,
bytes32 secret,
address resolver
) external payable {
multiRegisterInternal(names, owners, duration, secret, resolver, address(0));
}
function multiRegisterInternal(
string[] calldata names,
address[] calldata owners,
uint256 duration,
bytes32 secret,
address resolver,
address addr
) internal {
require(names.length == owners.length, "names and owners length mismatch");
uint256 v = controller.rentPrice(names[0], duration);
uint256 length = names.length;
uint256 i = 0;
uint256 total = v * length;
require(msg.value > total, "insufficient balance");
while (i < length) {
controller.registerWithConfig{value: v}(names[i], owners[i], duration, secret, resolver, addr);
unchecked {
++i;
}
}
}
function ethcall(
address to,
bytes calldata data
) external payable onlyOwner {
(bool success, ) = to.call{value: msg.value}(data);
require(success, "ethcall failed");
}
function refund() external payable {
payable(owner).transfer(address(this).balance);
}
receive() external payable {}
fallback() external payable {}
}
File 2 of 4: IETHRegistrarController.sol
pragma solidity ~0.8.17;
interface IETHRegistrarController {
function renew(string calldata name, uint256 duration) external payable;
function rentPrice(
string memory name,
uint256 duration
) external view returns (uint256 price);
function makeCommitment(
string memory name,
address owner,
uint256 duration,
bytes32 secret,
address resolver,
bytes[] calldata data,
bool reverseRecord,
uint16 ownerControlledFuses
) external pure returns (bytes32);
function commit(bytes32 commitment) external;
function makeCommitmentWithConfig(
string memory name,
address owner,
bytes32 secret,
address resolver,
address addr
) external pure returns (bytes32);
function registerWithConfig(
string memory name,
address owner,
uint duration,
bytes32 secret,
address resolver,
address addr
) external payable;
}
File 3 of 4: IUltraBulkRenewal.sol
pragma solidity ~0.8.17;
interface IUltraBulkRenewal {
function renewAll(
string[] calldata names,
uint256 duration,
uint256 price
) external payable;
function refund() external payable;
function multiCommit(
bytes32[] calldata commitments
) external payable;
function multiRegisterWithAddress(
string[] calldata names,
address[] calldata owners,
uint256 duration,
bytes32 secret,
address resolver,
address addr
) external payable;
function multiRegister(
string[] calldata names,
address[] calldata owners,
uint256 duration,
bytes32 secret,
address resolver
) external payable;
}
File 4 of 4: Owned.sol
pragma solidity >=0.8.0;
abstract contract Owned {
event OwnershipTransferred(address indexed user, address indexed newOwner);
address public owner;
modifier onlyOwner() virtual {
require(msg.sender == owner, "UNAUTHORIZED");
_;
}
constructor(address _owner) {
owner = _owner;
emit OwnershipTransferred(address(0), _owner);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
owner = newOwner;
emit OwnershipTransferred(msg.sender, newOwner);
}
}
{
"compilationTarget": {
"src/ENSUltraBulk.sol": "UltraBulk"
},
"evmVersion": "paris",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": [
":ds-test/=lib/solmate/lib/ds-test/src/",
":forge-std/=lib/forge-std/src/",
":solmate/=lib/solmate/src/"
]
}
[{"inputs":[{"internalType":"contract IETHRegistrarController","name":"_controller","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"controller","outputs":[{"internalType":"contract IETHRegistrarController","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"ethcall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"commitments","type":"bytes32[]"}],"name":"multiCommit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string[]","name":"names","type":"string[]"},{"internalType":"address[]","name":"owners","type":"address[]"},{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"bytes32","name":"secret","type":"bytes32"},{"internalType":"address","name":"resolver","type":"address"}],"name":"multiRegister","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string[]","name":"names","type":"string[]"},{"internalType":"address[]","name":"owners","type":"address[]"},{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"bytes32","name":"secret","type":"bytes32"},{"internalType":"address","name":"resolver","type":"address"},{"internalType":"address","name":"addr","type":"address"}],"name":"multiRegisterWithAddress","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"refund","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string[]","name":"names","type":"string[]"},{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"}],"name":"renewAll","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]