From c9444a397017d961972cbbff400b67d973ffe956 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87a=C4=9Fla=20=C3=87elik?= Date: Mon, 16 Dec 2024 15:48:42 +0300 Subject: [PATCH] update readme --- README.md | 2 +- script/Deploy.s.sol | 7 ++++--- script/HelperConfig.s.sol | 10 ++++++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a6394ed..87ccba3 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ forge clean && forge script ./script/Deploy.s.sol:Deploy --rpc-ur or for instant verification use: ```sh -forge clean && forge script ./script/Deploy.s.sol:Deploy --rpc-url --account --sender --broadcast --verify --verifier --verifier-url +forge clean && forge script ./script/Deploy.s.sol:Deploy --rpc-url --account --sender --broadcast --verify --verifier --verifier-url ``` > [!NOTE] diff --git a/script/Deploy.s.sol b/script/Deploy.s.sol index 311b925..0fd2e3d 100644 --- a/script/Deploy.s.sol +++ b/script/Deploy.s.sol @@ -1,9 +1,12 @@ // SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.20; +import {Upgrades} from "@openzeppelin/foundry-upgrades/Upgrades.sol"; +import {Strings} from "@openzeppelin/contracts/utils/Strings.sol"; import {Script} from "forge-std/Script.sol"; +import {Vm} from "forge-std/Vm.sol"; import {HelperConfig} from "./HelperConfig.s.sol"; -import {Upgrades} from "@openzeppelin/foundry-upgrades/Upgrades.sol"; + import {LLMOracleRegistry} from "@firstbatch/dria-oracle-contracts/LLMOracleRegistry.sol"; import { LLMOracleCoordinator, LLMOracleTaskParameters @@ -11,8 +14,6 @@ import { import {AIAgentFactory} from "../src/AIAgent.sol"; import {ArtifactFactory} from "../src/Artifact.sol"; import {Swan, SwanMarketParameters} from "../src/Swan.sol"; -import {Vm} from "forge-std/Vm.sol"; -import {Strings} from "@openzeppelin/contracts/utils/Strings.sol"; contract DeployLLMOracleRegistry is Script { HelperConfig public config; diff --git a/script/HelperConfig.s.sol b/script/HelperConfig.s.sol index 478d837..5caec7b 100644 --- a/script/HelperConfig.s.sol +++ b/script/HelperConfig.s.sol @@ -206,6 +206,11 @@ contract HelperConfig is Script { // create dir if it doesn't exist vm.createDir(dir, true); + // create file if it doesn't exist + if (!vm.isFile(path)) { + vm.writeFile(path, ""); + } + // check if the key exists string memory contractAddresses = vm.readFile(path); @@ -247,6 +252,11 @@ contract HelperConfig is Script { // create dir if it doesn't exist vm.createDir(dir, true); + // create file if it doesn't exist + if (!vm.isFile(path)) { + vm.writeFile(path, ""); + } + // create a new JSON object string memory newContract = string.concat('"', name, '": {', ' "proxyAddr": "', proxyAddr, '",', ' "implAddr": "', implAddr, '"', "}");