-
Notifications
You must be signed in to change notification settings - Fork 0
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
paulelisha
authored and
paulelisha
committed
Oct 14, 2024
1 parent
993da30
commit da2cdb4
Showing
5 changed files
with
115 additions
and
55 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
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,44 @@ | ||
// SPDX-License-Identifier: SEE LICENSE IN LICENSE | ||
pragma solidity ^0.8.0; | ||
|
||
import "forge-std/Script.sol"; | ||
import "forge-std/StdJson.sol"; | ||
import "../src/CreateJsonStruct.sol"; | ||
|
||
contract CreateJsonStructScript is Script { | ||
CreateJsonStruct createJsonStruct = new CreateJsonStruct(); | ||
string private constant INPUT_PATH = "script/target/input.json"; | ||
|
||
function run() public { | ||
string memory jsonObject = getJson(); | ||
vm.writeFile(INPUT_PATH, jsonObject); | ||
} | ||
|
||
function getJson() public returns (string memory jsonObject) { | ||
createJsonStruct.startMainObject(); | ||
|
||
createJsonStruct.startObject("kaia"); | ||
|
||
createJsonStruct.addKeyValuePairWithString("network", "testnet"); | ||
createJsonStruct.addKeyValuePairWithString("chainid", "1001"); | ||
|
||
createJsonStruct.startArray("developers"); | ||
createJsonStruct.addArrayElementWithString("xx"); | ||
createJsonStruct.addArrayElementWithString("oo"); | ||
createJsonStruct.addArrayElementWithString("ppp"); | ||
createJsonStruct.closeArray(); | ||
|
||
createJsonStruct.closeObject(); | ||
|
||
createJsonStruct.startObject("base"); | ||
createJsonStruct.addKeyValuePairWithString("network", "testnet"); | ||
createJsonStruct.addKeyValuePairWithString("chainid", "8354"); | ||
createJsonStruct.closeObject(); | ||
createJsonStruct.closeMainObject(); | ||
|
||
jsonObject = createJsonStruct.getJson(); | ||
|
||
console.log(jsonObject, "has been written to script/target/input.json"); | ||
// assertEq(jsonObject, "{}"); | ||
} | ||
} |
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,15 @@ | ||
{ | ||
"kaia": { | ||
"network": "testnet", | ||
"chainid": "1001", | ||
"developers": [ | ||
"xx", | ||
"oo", | ||
"ppp" | ||
] | ||
}, | ||
"base": { | ||
"network": "testnet", | ||
"chainid": "8354" | ||
} | ||
} |
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