Skip to content
This repository was archived by the owner on Jul 3, 2024. It is now read-only.

Commit 2d77455

Browse files
committed
wip : deploy a contract, poc
1 parent 623364f commit 2d77455

File tree

4 files changed

+79
-0
lines changed

4 files changed

+79
-0
lines changed

toolchains/solidity/core/Cargo.lock

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[package]
2+
name = "foundry-deploy"
3+
version.workspace = true
4+
edition.workspace = true
5+
authors.workspace = true
6+
license.workspace = true
7+
exclude.workspace = true
8+
9+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
10+
11+
[dependencies]
12+
osmium-libs-foundry-wrapper = { path = "../../../../../libs/foundry-wrapper" }
13+
tower-lsp = "0.20.0"
14+
tokio = { version = "1.34.0", features = ["full"] }
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
build:
2+
cargo build
3+
cp ../../target/debug/foundry-server ../../../extension/dist
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
use std::process::Command;
2+
use tower_lsp::{Client, LanguageServer};
3+
4+
#[derive(Debug)]
5+
struct Backend {
6+
client: Client,
7+
}
8+
9+
impl<InitializeResult> LanguageServer for Backend {
10+
fn initialize(&self, params: InitializeParams) -> Result<InitializeResult> {}
11+
12+
fn deploy_contract() {
13+
//get infos thanks to the client
14+
let contractName = "Test";
15+
let rpc_url = "rpc_urlTest";
16+
let key = "keyTest";
17+
18+
// Create a new instance of the command
19+
let mut cmd = Command::new("forge");
20+
// Add arguments to the command
21+
cmd.arg("create");
22+
cmd.arg("--rpc-url");
23+
cmd.arg(rpc_url);
24+
cmd.arg("--private-key");
25+
cmd.arg(key);
26+
cmd.arg("--verify");
27+
cmd.arg(contractName);
28+
29+
// Execute the command and capture the result
30+
let result = cmd.status();
31+
32+
// Handle the result
33+
match result {
34+
Ok(status) => {
35+
if status.success() {
36+
println!("Command executed successfully!");
37+
} else {
38+
println!("Command failed with exit code: {:?}", status.code());
39+
}
40+
}
41+
Err(e) => {
42+
println!("Error executing the command: {:?}", e);
43+
}
44+
}
45+
}
46+
47+
fn shutdown(&self) -> Result<()> {
48+
Ok(())
49+
}
50+
}
51+
52+
async fn main() {
53+
}

0 commit comments

Comments
 (0)