Skip to content

Commit

Permalink
updated deploy script for logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ametel01 committed Jul 4, 2024
1 parent d227ee4 commit 4e62379
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 33 deletions.
30 changes: 14 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
### The repo structure and files organisation will be reviewed once all the components will be implemented

### Testing
1. Start Anvil in a new terminal with the command `anvil`.
Start Anvil in a new terminal with the command `anvil`.

2. Install dependencies:
Install dependencies:
```bash
dojoup -v 0.7.0-alpha.4
```
Expand All @@ -18,39 +18,37 @@
cd ethereum
forge soldeer install forge-std~1.8.2
```
I a New Terminal Start the Katana StarkNet node:
```bash
katana --messaging anvil.messaging.json --disable-fee
```

3. Build the project and set up environment variables:
In a New Terminal Build the project and set up environment variables:
```bash
cd starknet
scarb build
source katana/katana.env
```

4. I a New Terminal Start the Katana StarkNet node:
```bash
katana --messaging anvil.messaging.json --disable-fee
```

5. In a New Terminal Declare the Cairo contracts:
Declare the Cairo contracts:
```bash
cd starknet
katana/declare.sh
```

6. Deploy the Cairo contracts:
Deploy the Cairo contracts:
```bash
katana/deploy.sh
```

7. Set up local Ethereum testing:
In a New Terminal Set up local Ethereum testing:
```bash
cd ../ethereum
cp anvil.env .env
source .env
forge script script/LocalTesting.s.sol:LocalSetup --broadcast --rpc-url ${ETH_RPC_URL}
```

8. Send a message:
```bash
forge script script/SendMessage.s.sol:Value --broadcast --rpc-url ${ETH_RPC_URL}
```
Send a message:
```bash
forge script script/SendMessage.s.sol:Value --broadcast --rpc-url ${ETH_RPC_URL}
```
35 changes: 18 additions & 17 deletions ethereum/script/LocalTesting.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,41 @@
pragma solidity ^0.8.0;

import "@forge-std/src/Script.sol";
import "@forge-std/src/console.sol";

import "src/ContractMsg.sol";

import "src/L1MessageSender.sol";

import "src/StarknetMessagingLocal.sol";

import "src/Mock/MockStorage.sol";

/**
* Deploys the ContractMsg and StarknetMessagingLocal contracts.
* Very handy to quickly setup Anvil to debug.
*/
contract LocalSetup is Script {
function setUp() public {}

function run() public {
uint256 deployerPrivateKey = vm.envUint("ACCOUNT_PRIVATE_KEY");

string memory json = "local_testing";

vm.startBroadcast(deployerPrivateKey);

address snLocalAddress = address(new StarknetMessagingLocal());
vm.serializeString(json, "snMessaging_address", vm.toString(snLocalAddress));
// Deploy StarknetMessagingLocal
StarknetMessagingLocal snLocal = new StarknetMessagingLocal();
console.log("StarknetMessagingLocal deployed at:", address(snLocal));
vm.serializeString(json, "snMessaging_address", vm.toString(address(snLocal)));

address contractMsg = address(new ContractMsg(snLocalAddress));
vm.serializeString(json, "contractMsg_address", vm.toString(contractMsg));
// Deploy ContractMsg
ContractMsg contractMsg = new ContractMsg(address(snLocal));
console.log("ContractMsg deployed at:", address(contractMsg));
vm.serializeString(json, "contractMsg_address", vm.toString(address(contractMsg)));

address l1MessageSender = address(new L1MessagesSender(snLocalAddress, vm.envUint("L2_CONTRACT_ADDRESS")));
vm.serializeString(json, "l1MessageSender_address", vm.toString(l1MessageSender));
// Deploy L1MessagesSender
L1MessagesSender l1MessageSender = new L1MessagesSender(address(snLocal), vm.envUint("L2_CONTRACT_ADDRESS"));
console.log("L1MessagesSender deployed at:", address(l1MessageSender));
vm.serializeString(json, "l1MessageSender_address", vm.toString(address(l1MessageSender)));

address mockStorageAddress = address(new MockStorage());
vm.serializeString(json, "snMessaging_address", vm.toString(mockStorageAddress));
// Deploy MockStorage
MockStorage mockStorage = new MockStorage();
console.log("MockStorage deployed at:", address(mockStorage));
vm.serializeString(json, "mockStorage_address", vm.toString(address(mockStorage)));

vm.stopBroadcast();

Expand All @@ -45,4 +46,4 @@ contract LocalSetup is Script {
vm.createDir(localLogs, true);
vm.writeJson(data, string.concat(localLogs, "local_setup.json"));
}
}
}

0 comments on commit 4e62379

Please sign in to comment.