Skip to content

Commit b0257a3

Browse files
committed
chore: add initial BatchTransferFraction contract and corresponding tests
1 parent b40593f commit b0257a3

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

Diff for: src/BatchTransferFraction.sol

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity ^0.8.28;
3+
4+
import "./interfaces/IHypercertToken.sol";
5+
6+
contract BatchTransferFraction {
7+
IHypercertToken public hypercertToken;
8+
9+
error INVALID_LENGTHS();
10+
error INVALID_RECIPIENT(address recipient);
11+
error INVALID_TOKEN_ID(uint256 tokenID);
12+
error INVALID_CALLER(address caller);
13+
error INVALID_HYPERCERT_ADDRESS(address hypercertAddress);
14+
15+
constructor(address _hypercertToken) {
16+
require(_hypercertToken != address(0), INVALID_HYPERCERT_ADDRESS(_hypercertToken));
17+
hypercertToken = IHypercertToken(_hypercertToken);
18+
}
19+
}

Diff for: test/BatchTransferFraction.t.sol

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity ^0.8.28;
3+
4+
import "forge-std/Test.sol";
5+
import "forge-std/console.sol";
6+
7+
import { BatchTransferFraction } from "../src/BatchTransferFraction.sol";
8+
import { IHypercertToken } from "../src/interfaces/IHypercertToken.sol";
9+
10+
contract BatchTransferFractionTest is Test {
11+
BatchTransferFraction public batchTransferFraction;
12+
IHypercertToken public hypercertToken;
13+
address public currentPrankee;
14+
15+
function setUp() public {
16+
configureChain();
17+
batchTransferFraction = new BatchTransferFraction(address(hypercertToken));
18+
}
19+
20+
function testDeployment() public view {
21+
assertNotEq(address(batchTransferFraction), address(0));
22+
}
23+
24+
function configureChain() public {
25+
if (block.chainid == 10) {
26+
// Optimism mainnet
27+
hypercertToken = IHypercertToken(0x822F17A9A5EeCFd66dBAFf7946a8071C265D1d07);
28+
} else if (block.chainid == 11_155_111) {
29+
// Sepolia
30+
hypercertToken = IHypercertToken(0xa16DFb32Eb140a6f3F2AC68f41dAd8c7e83C4941);
31+
} else {
32+
revert("Unsupported chain");
33+
}
34+
}
35+
36+
modifier prankception(address prankee) {
37+
address prankBefore = currentPrankee;
38+
vm.stopPrank();
39+
vm.startPrank(prankee);
40+
_;
41+
vm.stopPrank();
42+
if (prankBefore != address(0)) {
43+
vm.startPrank(prankBefore);
44+
}
45+
}
46+
}

0 commit comments

Comments
 (0)