Skip to content

Commit

Permalink
cancel_intent
Browse files Browse the repository at this point in the history
  • Loading branch information
doradelta committed Oct 29, 2024
1 parent 9cd49bd commit 278b71c
Show file tree
Hide file tree
Showing 6 changed files with 182 additions and 40 deletions.
65 changes: 28 additions & 37 deletions user/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion user/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ anyhow = "1.0.32"
rand = "0.8.5"
solana-client = "1.8.3"
serde = { version = "1.0", features = ["derive"] }
clap = "4.5.20"
spl-associated-token-account = { version = "3.0.2", default-features = false, features = ["no-entrypoint"] }
bridge-escrow = { git = "https://github.com/ComposableFi/emulated-light-client.git", branch = "upgrade" }
solana-ibc = { git = "https://github.com/ComposableFi/emulated-light-client.git", branch = "fast-bridge", features = ["cpi"] }
lib = { git = "https://github.com/ComposableFi/emulated-light-client.git", branch = "fast-bridge", features = ["solana-program"] }
clap = "4.5.20"

[patch.crates-io]
# aes-gcm-siv 0.10.3 and curve25519-dalek 3.x pin zeroize to <1.4
Expand Down
36 changes: 36 additions & 0 deletions user/mantis_ethereum.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import subprocess
import schedule
import time

# List of commands to execute
commands = [
"cargo run -- ethereum 0x4d224452801aced8b2f0aebe155379bb5d594381 6000000000000000000 0x6b175474e89094c44da98b954eedeac495271d0f 1 3600",
"cargo run -- ethereum 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 3000000000000000 0x853d955acef822db058eb8505911ed77f175b99e 1 3600",
"cargo run -- ethereum 0x6985884c4392d348587b19cb9eaaf157f13271cd 2000000000000000000 0xcf0c122c6b73ff809c693db761e7baebe62b6a2e 1 3600",
"cargo run -- ethereum 0x2260fac5e5542a773aa44fbcfedf7c193bc2c599 11000 0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2 1 3600",
"cargo run -- ethereum 0x6b175474e89094c44da98b954eedeac495271d0f 8000000000000000000 0x5a98fcbea516cf06857215779fd812ca3bef1b32 1 3600",
"cargo run -- ethereum 0x467719aD09025FcC6cF6F8311755809d45a5E5f3 9000000 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 1 3600",
]

# Function to run the next command in the list
def run_commands_in_sequence():
for command in commands:
try:
print(f"Running command: {command}")
result = subprocess.run(command, shell=True, check=True, capture_output=True, text=True)
print(f"Command Output: {result.stdout}")
except subprocess.CalledProcessError as e:
print(f"Error executing command: {e.stderr}")
# Wait 1 hour (3600 seconds) before running the next command
time.sleep(7200)

# Schedule the task to run in sequence every hour
schedule.every().hour.do(run_commands_in_sequence)

if __name__ == "__main__":
print("Scheduler started. Running commands in sequence every hour.")
run_commands_in_sequence() # Start the sequence immediately
while True:
schedule.run_pending()
time.sleep(1)

36 changes: 36 additions & 0 deletions user/mantis_solana.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import subprocess
import schedule
import time

# List of commands to execute
commands = [
"cargo run -- solana 150000000 rndrizKT3MK1iimdxRdWabcF7Zg7AR5T4nud4EkHBof Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB 1 3600",
"cargo run -- solana 3000000 EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v 1 3600",
"cargo run -- solana 7000000 JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN jtojtomepa8beP8AuQc6eXt5FriJwfFMwQx2v2f9mCL 1 3600",
"cargo run -- solana 25000000 HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3 Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB 1 3600",
"cargo run -- solana 35000000000 DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263 5z3EqYQo9HiCEs3R84RCDMu2n7anpDMxRhdK8PSWmrRC 1 3600",
"cargo run -- solana 3000000 4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R A8C3xuqscfmyLrte3VmTqrAq8kgMASius9AFNANwpump 1 3600"
]

# Function to run the next command in the list
def run_commands_in_sequence():
for command in commands:
try:
print(f"Running command: {command}")
result = subprocess.run(command, shell=True, check=True, capture_output=True, text=True)
print(f"Command Output: {result.stdout}")
except subprocess.CalledProcessError as e:
print(f"Error executing command: {e.stderr}")
# Wait 1 hour (3600 seconds) before running the next command
time.sleep(3600)

# Schedule the task to run in sequence every hour
schedule.every().hour.do(run_commands_in_sequence)

if __name__ == "__main__":
print("Scheduler started. Running commands in sequence every hour.")
run_commands_in_sequence() # Start the sequence immediately
while True:
schedule.run_pending()
time.sleep(1)

4 changes: 2 additions & 2 deletions user/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async fn handle_ethereum_single_domain_intent(matches: &ArgMatches) -> Result<()
timeout,
).await {
Ok(receipt) => {
println!("Transaction successful, receipt: {:?}", receipt);
println!("Transaction successful, receipt: {:?}", receipt.transaction_hash);
}
Err(e) => {
println!("Transaction failed ** Remember you need to approve <TOKEN_IN> to Escrow SC 0x59880a68fafcE2E282866bdb741Cf0b20E95c1B7 **: {:?}", e);
Expand Down Expand Up @@ -106,7 +106,7 @@ async fn handle_ethereum_solana_cross_domain_intent(matches: &ArgMatches) -> Res
timeout,
).await {
Ok(receipt) => {
println!("Transaction successful, receipt: {:?}", receipt);
println!("Transaction successful, receipt: {:?}", receipt.transaction_hash);
}
Err(e) => {
println!("Transaction failed ** Remember you need to approve <TOKEN_IN> to Escrow SC 0x59880a68fafcE2E282866bdb741Cf0b20E95c1B7 **: {:?}", e);
Expand Down
Loading

0 comments on commit 278b71c

Please sign in to comment.