Skip to content

Commit 71aa844

Browse files
Small update
Publishing on blast now works Added a few more scripts Fixed the chain id bug
1 parent 9eeb04c commit 71aa844

9 files changed

+184
-12
lines changed

foundry.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ gas_reports = ["Echo"]
2121
# Config
2222
[rpc_endpoints]
2323
sepolia = "${SEPOLIA_RPC_URL}"
24+
blast_sepolia = "${BLAST_SEPOLIA_RPC_URL}"
2425

2526
[etherscan]
26-
sepolia = { key = "${ETHERSCAN_API_KEY}" }
27+
sepolia = { key = "${ETHERSCAN_API_KEY}" }
28+
blast_sepolia = { key = "${BLASTSCAN_API_KEY}", url="https://api-sepolia.blastscan.io/api" }

script/DeployERC721.s.sol

Lines changed: 68 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,76 @@ contract DeployNFT is Script {
99
function test() public {}
1010

1111
function run() external {
12-
vm.startBroadcast();
12+
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
13+
vm.startBroadcast(deployerPrivateKey);
1314

14-
Mocked721 YKPS = new Mocked721({name: "Kanpai Panda", symbol: "YKPS"});
15-
YKPS.setBaseURI("https://prod.kanpaidev.com/api/token/");
15+
address gab = address(0x213bE2f484Ab480db4f18b0Fe4C38e1C25877f09);
16+
address jf = address(0x1E3918dD44F427F056be6C8E132cF1b5F42de59E);
1617

17-
Mocked721WithSuffix MAD = new Mocked721WithSuffix({name: "Mad Lads", symbol: "MAD"});
18-
MAD.setBaseURI("https://madlads.s3.us-west-2.amazonaws.com/json/");
18+
Mocked721WithSuffix CBC = new Mocked721WithSuffix({name: "Creepz by OVERLORD", symbol: "CBC"});
19+
CBC.setBaseURI("ipfs://QmVRsXpYYp3qALoxjYUfNZAA6A28P86REKkoqadoXM5tLn/");
20+
21+
Mocked721 BAYC = new Mocked721({name: "BoredApeYachtClub", symbol: "BAYC"});
22+
BAYC.setBaseURI("ipfs://QmeSjSinHpPnmXmspMjwiXyN6zS4E9zccariGR3jxcaWtq/");
23+
24+
Mocked721 SORA = new Mocked721({name: "Sora's Dreamworld", symbol: "Sora"});
25+
SORA.setBaseURI("https://sorasdreamworld.io/tokens/");
26+
27+
Mocked721 MAYC = new Mocked721({name: "MutantApeYachtClub", symbol: "MAYC"});
28+
MAYC.setBaseURI("https://boredapeyachtclub.com/api/mutants/");
29+
30+
// Mint NFTs
31+
//CBC
32+
CBC.safeMint(gab, 0);
33+
CBC.safeMint(gab, 1);
34+
CBC.safeMint(gab, 2);
35+
CBC.safeMint(gab, 3);
36+
CBC.safeMint(gab, 4);
37+
38+
CBC.safeMint(jf, 5);
39+
CBC.safeMint(jf, 6);
40+
CBC.safeMint(jf, 7);
41+
CBC.safeMint(jf, 8);
42+
CBC.safeMint(jf, 9);
43+
44+
// BAYC
45+
BAYC.safeMint(gab, 0);
46+
BAYC.safeMint(gab, 1);
47+
BAYC.safeMint(gab, 2);
48+
BAYC.safeMint(gab, 3);
49+
BAYC.safeMint(gab, 4);
50+
51+
BAYC.safeMint(jf, 5);
52+
BAYC.safeMint(jf, 6);
53+
BAYC.safeMint(jf, 7);
54+
BAYC.safeMint(jf, 8);
55+
BAYC.safeMint(jf, 9);
56+
57+
// SORA
58+
SORA.safeMint(gab, 0);
59+
SORA.safeMint(gab, 1);
60+
SORA.safeMint(gab, 2);
61+
SORA.safeMint(gab, 3);
62+
SORA.safeMint(gab, 4);
63+
64+
SORA.safeMint(jf, 5);
65+
SORA.safeMint(jf, 6);
66+
SORA.safeMint(jf, 7);
67+
SORA.safeMint(jf, 8);
68+
SORA.safeMint(jf, 9);
69+
70+
// MAYC
71+
MAYC.safeMint(gab, 0);
72+
MAYC.safeMint(gab, 1);
73+
MAYC.safeMint(gab, 2);
74+
MAYC.safeMint(gab, 3);
75+
MAYC.safeMint(gab, 4);
76+
77+
MAYC.safeMint(jf, 5);
78+
MAYC.safeMint(jf, 6);
79+
MAYC.safeMint(jf, 7);
80+
MAYC.safeMint(jf, 8);
81+
MAYC.safeMint(jf, 9);
1982

2083
vm.stopBroadcast();
2184
}

script/DeployEchoBlast.s.sol

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// SPDX-License-Identifier: UNLICENSED
2+
pragma solidity ^0.8.18;
3+
4+
import "forge-std/Script.sol";
5+
import "../src/EchoBlast.sol";
6+
import "../test/mock/YieldMock.sol";
7+
8+
contract DeployEchoBlast is Script {
9+
// Exclude from coverage report
10+
function test() public {}
11+
12+
function run() external {
13+
vm.createSelectFork(vm.envString("BLAST_SEPOLIA_RPC_URL"));
14+
// Deploy mock of the precompile
15+
YieldMock yieldMock = new YieldMock();
16+
// Set mock bytecode to the expected precompile address
17+
vm.etch(0x0000000000000000000000000000000000000100, address(yieldMock).code);
18+
19+
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
20+
vm.startBroadcast(deployerPrivateKey);
21+
new EchoBlast({
22+
owner: address(0x213bE2f484Ab480db4f18b0Fe4C38e1C25877f09),
23+
blastPointsAddress: address(0x2fc95838c71e76ec69ff817983BFf17c710F34E0)
24+
});
25+
26+
vm.stopBroadcast();
27+
}
28+
}

script/TestPacking.s.sol

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// SPDX-License-Identifier: UNLICENSED
2+
pragma solidity ^0.8.18;
3+
4+
import "forge-std/Script.sol";
5+
import "../src/Echo.sol";
6+
7+
contract TestPacking is Script {
8+
// Exclude from coverage report
9+
function test() public {}
10+
11+
function run() external {
12+
OfferItem[] memory offerItems = new OfferItem[](1);
13+
offerItems[0] = OfferItem({tokenAddress: 0x7DA16cd402106Adaf39092215DbB54092b80B6E6, tokenId: 2});
14+
15+
Offer memory offer = Offer({
16+
sender: 0x7DA16cd402106Adaf39092215DbB54092b80B6E6,
17+
receiver: 0x7DA16cd402106Adaf39092215DbB54092b80B6E6,
18+
senderItems: OfferItems({chainId: 1, items: offerItems}),
19+
receiverItems: OfferItems({chainId: 1, items: offerItems}),
20+
expiration: 1,
21+
state: OfferState.OPEN
22+
});
23+
24+
bytes memory offerIdHash = abi.encode(
25+
offer.sender,
26+
offer.receiver,
27+
offer.senderItems.chainId,
28+
keccak256(abi.encode(offer.senderItems.items)), // OfferItem[]
29+
offer.receiverItems.chainId,
30+
keccak256(abi.encode(offer.receiverItems.items)), // OfferItem[]
31+
offer.expiration
32+
);
33+
bytes32 offerId = keccak256(offerIdHash);
34+
35+
console.logBytes(offerIdHash);
36+
console.logBytes32(offerId);
37+
}
38+
}

script/UpdateEchoFees.s.sol

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// SPDX-License-Identifier: UNLICENSED
2+
pragma solidity ^0.8.18;
3+
4+
import "forge-std/Script.sol";
5+
import "../src/Echo.sol";
6+
7+
contract UpdateEchoFees is Script {
8+
// Exclude from coverage report
9+
function test() public {}
10+
11+
function run() external {
12+
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
13+
vm.startBroadcast(deployerPrivateKey);
14+
Echo echo = Echo(0xB0904D81440EFCA27Ec61948c95f21D7d546F8C3);
15+
echo.setFees(0.005 ether);
16+
vm.stopBroadcast();
17+
}
18+
}

src/Echo.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ contract Echo is ReentrancyGuard, Admin, Banker, Escrow, EchoState {
1515
event OfferAccepted(bytes32 indexed offerId);
1616
event OfferCanceled(bytes32 indexed offerId);
1717
event OfferExecuted(bytes32 indexed offerId);
18-
// @dev For future use...
1918

20-
uint16 private immutable CHAIN_ID;
19+
// @dev For future use...
20+
uint256 private immutable CHAIN_ID;
2121

2222
constructor(address owner) Admin(owner) {
23-
CHAIN_ID = uint16(block.chainid);
23+
CHAIN_ID = block.chainid;
2424
}
2525

2626
/**

src/EchoBlast.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
pragma solidity ^0.8.18;
33

44
import "./Echo.sol";
5-
import "blast/IBlast.sol";
6-
import "blast/IBlastPoints.sol";
5+
import "../lib/blast/IBlast.sol";
6+
import "../lib/blast/IBlastPoints.sol";
77

88
contract EchoBlast is Echo {
99
IBlast public constant BLAST = IBlast(0x4300000000000000000000000000000000000002);

src/EchoState.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ abstract contract EchoState {
4848
* Same chain offers
4949
*/
5050
// @dev Internal function to create a same chain offer
51-
function _createOffer(Offer calldata offer, uint16 chainId) internal returns (bytes32 offerId) {
51+
function _createOffer(Offer calldata offer, uint256 chainId) internal returns (bytes32 offerId) {
5252
offerId = _generateOfferId(offer);
5353

5454
_validateOffer(offer);

test/mock/YieldMock.sol

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// SPDX-License-Identifier: UNLICENSED
2+
pragma solidity ^0.8.18;
3+
4+
contract YieldMock {
5+
address private constant blastContract = 0x4300000000000000000000000000000000000002;
6+
7+
mapping(address => uint8) public getConfiguration;
8+
9+
function configure(address contractAddress, uint8 flags) external returns (uint256) {
10+
require(msg.sender == blastContract);
11+
12+
getConfiguration[contractAddress] = flags;
13+
return 0;
14+
}
15+
16+
function claim(address, address, uint256) external pure returns (uint256) {
17+
return 0;
18+
}
19+
20+
function getClaimableAmount(address) external pure returns (uint256) {
21+
return 0;
22+
}
23+
}

0 commit comments

Comments
 (0)