From a6571bc84c439ed3e4d2393209ca93a96623d9e1 Mon Sep 17 00:00:00 2001 From: Alex Metelli Date: Tue, 11 Jun 2024 08:17:38 +0800 Subject: [PATCH] sol cleanup --- ethereum/script/ConsumeMessage.s.sol | 67 ---------------------------- ethereum/script/ContractMsg.s.sol | 33 -------------- 2 files changed, 100 deletions(-) delete mode 100644 ethereum/script/ConsumeMessage.s.sol delete mode 100644 ethereum/script/ContractMsg.s.sol diff --git a/ethereum/script/ConsumeMessage.s.sol b/ethereum/script/ConsumeMessage.s.sol deleted file mode 100644 index d706e93..0000000 --- a/ethereum/script/ConsumeMessage.s.sol +++ /dev/null @@ -1,67 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.0; - -import "forge-std/Script.sol"; - -import "src/ContractMsg.sol"; - -/** - * @notice A simple script to consume a message from Starknet. - */ -contract Value is Script { - uint256 _privateKey; - address _contractMsgAddress; - uint256 _l2Contract; - - function setUp() public { - _privateKey = vm.envUint("ACCOUNT_PRIVATE_KEY"); - _contractMsgAddress = vm.envAddress("CONTRACT_MSG_ADDRESS"); - _l2Contract = vm.envUint("L2_CONTRACT_ADDRESS"); - } - - function run() public{ - vm.startBroadcast(_privateKey); - - // This value must match what was sent from starknet. - // In our example, we have sent the value 1 with starkli. - uint256[] memory payload = new uint256[](1); - payload[0] = 1; - - // The address must be the contract's address that has sent the message. - ContractMsg(_contractMsgAddress).consumeMessageValue( - _l2Contract, - payload); - - vm.stopBroadcast(); - } -} - -/** - * @notice A simple script to consume a message from Starknet. - */ -contract Struct is Script { - uint256 _privateKey; - address _contractMsgAddress; - uint256 _l2Contract; - - function setUp() public { - _privateKey = vm.envUint("ACCOUNT_PRIVATE_KEY"); - _contractMsgAddress = vm.envAddress("CONTRACT_MSG_ADDRESS"); - _l2Contract = vm.envUint("L2_CONTRACT_ADDRESS"); - } - - function run() public{ - vm.startBroadcast(_privateKey); - - // In the example, we've sent a message with serialize MyData. - uint256[] memory payload = new uint256[](2); - payload[0] = 1; - payload[1] = 2; - - ContractMsg(_contractMsgAddress).consumeMessageStruct( - _l2Contract, - payload); - - vm.stopBroadcast(); - } -} diff --git a/ethereum/script/ContractMsg.s.sol b/ethereum/script/ContractMsg.s.sol deleted file mode 100644 index 1971856..0000000 --- a/ethereum/script/ContractMsg.s.sol +++ /dev/null @@ -1,33 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.0; - -import "forge-std/Script.sol"; - -import "src/ContractMsg.sol"; - -/** - Deploys only the ContractMsg. -*/ -contract Deploy is Script { - function setUp() public {} - - function run() public{ - uint256 deployerPrivateKey = vm.envUint("ACCOUNT_PRIVATE_KEY"); - address snMessagingAddress = vm.envAddress("SN_MESSAGING_ADDRESS"); - - string memory json = "contract_msg_deploy"; - - vm.startBroadcast(deployerPrivateKey); - - address contractMsg = address(new ContractMsg(snMessagingAddress)); - vm.serializeString(json, "contractMsg_address", vm.toString(contractMsg)); - - vm.stopBroadcast(); - - string memory data = vm.serializeBool(json, "success", true); - - string memory localLogs = "./logs/"; - vm.createDir(localLogs, true); - vm.writeJson(data, string.concat(localLogs, "contract_msg_deploy.json")); - } -}