Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(owned-multicaller): implement remove-kill-fn #273

Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 6 additions & 22 deletions src/utils/OwnedMulticaller.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,22 @@ contract OwnedMulticaller is Ownable {
using ErrorHandler for bool;

constructor(address owner_) {
require(owner_ != address(0), "owner_ == address(0x0)");
require(owner_ != address(0), "OwnedMulticaller: owner_ is null");
_transferOwnership(owner_);
}

function kill() external onlyOwner {
selfdestruct(payable(_msgSender()));
}

function multiMint(
INSUnified rns,
uint256 parentId,
address resolver,
uint64 duration,
address[] calldata tos,
string[] calldata labels
) external onlyOwner {
for (uint256 i; i < labels.length; ++i) {
rns.mint(parentId, labels[i], resolver, tos[i], duration);
}
}

function multicall(address[] calldata tos, bytes[] calldata callDatas, uint256[] calldata values)
external
payable
onlyOwner
returns (bool[] memory results, bytes[] memory returnDatas)
{
require(tos.length == callDatas.length && tos.length == values.length, "invalid length");
results = new bool[](tos.length);
returnDatas = new bytes[](tos.length);
uint256 length = tos.length;
require(length == callDatas.length && length == values.length, "OwnedMulticaller: mismatch length");
results = new bool[](length);
returnDatas = new bytes[](length);

for (uint256 i; i < tos.length; ++i) {
for (uint256 i; i < length; ++i) {
(results[i], returnDatas[i]) = tos[i].call{ value: values[i] }(callDatas[i]);
results[i].handleRevert(returnDatas[i]);
}
Expand Down
Loading