This repository was archived by the owner on Jul 3, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +79
-0
lines changed
Expand file tree Collapse file tree 4 files changed +79
-0
lines changed Original file line number Diff line number Diff line change 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" ] }
Original file line number Diff line number Diff line change 1+ build :
2+ cargo build
3+ cp ../../target/debug/foundry-server ../../../extension/dist
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments