-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Filipp Makarov
authored and
Filipp Makarov
committed
Dec 18, 2024
1 parent
709dbe0
commit b2b5cd3
Showing
5 changed files
with
80 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,5 +53,6 @@ | |
], | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
}, | ||
"packageManager": "[email protected]+sha512.7f1de9cffea40ff4594c48a94776112a0db325e81fb18a9400362ff7b7247f4fbd76c3011611c9f8ac58743c3dc526017894e07948de9b72052f874ee2edfdcd" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.27; | ||
|
||
import { MockERC7779 } from "../mocks/MockERC7779.sol"; | ||
import "forge-std/Test.sol"; | ||
|
||
/// @title TestFuzz_ERC7779Adapter | ||
/// @notice Tests the ERC7779Adapter contract | ||
contract TestFuzz_ERC7779Adapter is Test { | ||
MockERC7779 private mockERC7779; | ||
|
||
function setUp() public { | ||
mockERC7779 = new MockERC7779(); | ||
//bytes32 erc7779StorageBase = keccak256(abi.encode(uint256(keccak256(bytes("InteroperableDelegatedAccount.ERC.Storage"))) - 1)) & ~bytes32(uint256(0xff)); | ||
//console.logBytes32(erc7779StorageBase); | ||
} | ||
|
||
function test_Fuzz_ERC7779Adapter_AddStorageBases(uint256 amountOfBases) public { | ||
vm.assume(amountOfBases > 0 && amountOfBases < 100); | ||
bytes32[] memory expectedStorageBases = new bytes32[](amountOfBases); | ||
|
||
for (uint256 i = 0; i < amountOfBases; i++) { | ||
bytes32 storageBase = bytes32(uint256(i)); | ||
expectedStorageBases[i] = storageBase; | ||
mockERC7779.addStorageBase(storageBase); | ||
} | ||
|
||
bytes32[] memory retrievedStorageBases = mockERC7779.accountStorageBases(); | ||
assertEq(retrievedStorageBases.length, amountOfBases); | ||
for (uint256 i = 0; i < amountOfBases; i++) { | ||
assertEq(retrievedStorageBases[i], expectedStorageBases[i]); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.27; | ||
|
||
import { ERC7779Adapter } from "src/core/ERC7779Adapter.sol"; | ||
|
||
contract MockERC7779 is ERC7779Adapter { | ||
|
||
function addStorageBase(bytes32 storageBase) external { | ||
_addStorageBase(storageBase); | ||
} | ||
|
||
} |