ERC6551Registry
0x28c154cbdeaecbf5f72b6ae48535ab9a431a4161
Verification
Verified
v0.8.26+commit.8a97fa7a
Type
Contract
808 bytes
ABI entries
5
1 read · 1 write
License
none
Contract information
- Address
- 0x28c154cbdeaecbf5f72b6ae48535ab9a431a4161
- Chain
- Robinhood Chain (4663)
- Compiler
- v0.8.26+commit.8a97fa7a
- Optimization
- Enabled
- Creator
- 0xb668382cF4…A809787CDa
- Creation tx
- 0xfdb56da079…5272d27bce
Token
Not a token
This contract does not expose ERC-20 metadata.
Read contract (1)
account(address, bytes32, uint256, address, uint256) → address
Events (1)
AccountCreated
ABI
[
{
"inputs": [],
"name": "FailedDeployment",
"type": "error"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "balance",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "needed",
"type": "uint256"
}
],
"name": "InsufficientBalance",
"type": "error"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "implementation",
"type": "address"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "salt",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "uint256",
"name": "chainId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "address",
"name": "tokenContract",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "AccountCreated",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "implementation",
"type": "address"
},
{
"internalType": "bytes32",
"name": "salt",
"type": "bytes32"
},
{
"internalType": "uint256",
"name": "chainId",
"type": "uint256"
},
{
"internalType": "address",
"name": "tokenContract",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "account",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "implementation",
"type": "address"
},
{
"internalType": "bytes32",
"name": "salt",
"type": "bytes32"
},
{
"internalType": "uint256",
"name": "chainId",
"type": "uint256"
},
{
"internalType": "address",
"name": "tokenContract",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "createAccount",
"outputs": [
{
"internalType": "address",
"name": "createdAccount",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "function"
}
]Source code
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import "@openzeppelin/contracts/proxy/Clones.sol";
interface IERC6551InitializableAccount {
function initialize(uint256 chainId, address tokenContract, uint256 tokenId) external;
}
contract ERC6551Registry {
event AccountCreated(
address indexed account,
address indexed implementation,
bytes32 indexed salt,
uint256 chainId,
address tokenContract,
uint256 tokenId
);
function createAccount(
address implementation,
bytes32 salt,
uint256 chainId,
address tokenContract,
uint256 tokenId
) external returns (address createdAccount) {
bytes32 finalSalt = _accountSalt(salt, chainId, tokenContract, tokenId);
createdAccount = Clones.predictDeterministicAddress(implementation, finalSalt, address(this));
if (createdAccount.code.length == 0) {
createdAccount = Clones.cloneDeterministic(implementation, finalSalt);
IERC6551InitializableAccount(createdAccount).initialize(chainId, tokenContract, tokenId);
emit AccountCreated(createdAccount, implementation, finalSalt, chainId, tokenContract, tokenId);
}
}
function account(
address implementation,
bytes32 salt,
uint256 chainId,
address tokenContract,
uint256 tokenId
) external view returns (address) {
bytes32 finalSalt = _accountSalt(salt, chainId, tokenContract, tokenId);
return Clones.predictDeterministicAddress(implementation, finalSalt, address(this));
}
function _accountSalt(
bytes32 salt,
uint256 chainId,
address tokenContract,
uint256 tokenId
) internal pure returns (bytes32) {
return keccak256(abi.encode(salt, chainId, tokenContract, tokenId));
}
}
Chain explorer5210msChain node76ms