This repository has been archived by the owner on Jul 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
5783387
commit 2d5e13d
Showing
4 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,14 @@ | ||
[package] | ||
name = "foundry-deploy" | ||
version.workspace = true | ||
edition.workspace = true | ||
authors.workspace = true | ||
license.workspace = true | ||
exclude.workspace = true | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
osmium-libs-foundry-wrapper = { path = "../../../../../libs/foundry-wrapper" } | ||
tower-lsp = "0.20.0" | ||
tokio = { version = "1.34.0", features = ["full"] } |
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,3 @@ | ||
build: | ||
cargo build | ||
cp ../../target/debug/foundry-server ../../../extension/dist |
53 changes: 53 additions & 0 deletions
53
toolchains/solidity/core/crates/foundry-deploy/src/main.rs
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,53 @@ | ||
use std::process::Command; | ||
use tower_lsp::{Client, LanguageServer}; | ||
|
||
#[derive(Debug)] | ||
struct Backend { | ||
client: Client, | ||
} | ||
|
||
impl<InitializeResult> LanguageServer for Backend { | ||
fn initialize(&self, params: InitializeParams) -> Result<InitializeResult> {} | ||
|
||
fn deploy_contract() { | ||
//get infos thanks to the client | ||
let contractName = "Test"; | ||
let rpc_url = "rpc_urlTest"; | ||
let key = "keyTest"; | ||
|
||
// Create a new instance of the command | ||
let mut cmd = Command::new("forge"); | ||
// Add arguments to the command | ||
cmd.arg("create"); | ||
cmd.arg("--rpc-url"); | ||
cmd.arg(rpc_url); | ||
cmd.arg("--private-key"); | ||
cmd.arg(key); | ||
cmd.arg("--verify"); | ||
cmd.arg(contractName); | ||
|
||
// Execute the command and capture the result | ||
let result = cmd.status(); | ||
|
||
// Handle the result | ||
match result { | ||
Ok(status) => { | ||
if status.success() { | ||
println!("Command executed successfully!"); | ||
} else { | ||
println!("Command failed with exit code: {:?}", status.code()); | ||
} | ||
} | ||
Err(e) => { | ||
println!("Error executing the command: {:?}", e); | ||
} | ||
} | ||
} | ||
|
||
fn shutdown(&self) -> Result<()> { | ||
Ok(()) | ||
} | ||
} | ||
|
||
async fn main() { | ||
} |