chore: format files

This commit is contained in:
Zitao Xiong
2024-12-19 20:11:55 +08:00
parent 69415e087d
commit a4825f55f5
7 changed files with 104 additions and 145 deletions

9
.editorconfig Normal file
View File

@@ -0,0 +1,9 @@
root = true
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
trim_trailing_whitespace = true
indent_style = space
indent_size = 2

View File

@@ -17,13 +17,7 @@ contract ERC6551Registry is IERC6551Registry {
uint256 salt,
bytes calldata initData
) external returns (address) {
bytes memory code = ERC6551BytecodeLib.getCreationCode(
implementation,
chainId,
tokenContract,
tokenId,
salt
);
bytes memory code = ERC6551BytecodeLib.getCreationCode(implementation, chainId, tokenContract, tokenId, salt);
address _account = Create2.computeAddress(bytes32(salt), keccak256(code));
@@ -41,22 +35,13 @@ contract ERC6551Registry is IERC6551Registry {
return _account;
}
function account(
address implementation,
uint256 chainId,
address tokenContract,
uint256 tokenId,
uint256 salt
) external view returns (address) {
bytes32 bytecodeHash = keccak256(
ERC6551BytecodeLib.getCreationCode(
implementation,
chainId,
tokenContract,
tokenId,
salt
)
);
function account(address implementation, uint256 chainId, address tokenContract, uint256 tokenId, uint256 salt)
external
view
returns (address)
{
bytes32 bytecodeHash =
keccak256(ERC6551BytecodeLib.getCreationCode(implementation, chainId, tokenContract, tokenId, salt));
return Create2.computeAddress(bytes32(salt), bytecodeHash);
}

View File

@@ -13,28 +13,13 @@ library ERC6551AccountLib {
uint256 tokenId,
uint256 _salt
) internal pure returns (address) {
bytes32 bytecodeHash = keccak256(
ERC6551BytecodeLib.getCreationCode(
implementation,
chainId,
tokenContract,
tokenId,
_salt
)
);
bytes32 bytecodeHash =
keccak256(ERC6551BytecodeLib.getCreationCode(implementation, chainId, tokenContract, tokenId, _salt));
return Create2.computeAddress(bytes32(_salt), bytecodeHash, registry);
}
function token()
internal
view
returns (
uint256,
address,
uint256
)
{
function token() internal view returns (uint256, address, uint256) {
bytes memory footer = new bytes(0x60);
assembly {

View File

@@ -9,8 +9,7 @@ library ERC6551BytecodeLib {
uint256 tokenId_,
uint256 salt_
) internal pure returns (bytes memory) {
return
abi.encodePacked(
return abi.encodePacked(
hex"3d60ad80600a3d3981f3363d3d373d3d3d363d73",
implementation_,
hex"5af43d82803e903d91602b57fd5bf3",

View File

@@ -11,20 +11,9 @@ interface IERC6551Account {
receive() external payable;
function executeCall(
address to,
uint256 value,
bytes calldata data
) external payable returns (bytes memory);
function executeCall(address to, uint256 value, bytes calldata data) external payable returns (bytes memory);
function token()
external
view
returns (
uint256 chainId,
address tokenContract,
uint256 tokenId
);
function token() external view returns (uint256 chainId, address tokenContract, uint256 tokenId);
function owner() external view returns (address);

View File

@@ -3,12 +3,7 @@ pragma solidity ^0.8.0;
interface IERC6551Registry {
event AccountCreated(
address account,
address implementation,
uint256 chainId,
address tokenContract,
uint256 tokenId,
uint256 salt
address account, address implementation, uint256 chainId, address tokenContract, uint256 tokenId, uint256 salt
);
function createAccount(
@@ -20,11 +15,8 @@ interface IERC6551Registry {
bytes calldata initData
) external returns (address);
function account(
address implementation,
uint256 chainId,
address tokenContract,
uint256 tokenId,
uint256 salt
) external view returns (address);
function account(address implementation, uint256 chainId, address tokenContract, uint256 tokenId, uint256 salt)
external
view
returns (address);
}