Skip to content

Commit 61cfc5c

Browse files
authored
script: update liquidation simulation (#599)
This PR modifies the existing scripts for simulating a liquidation to support a simple run of the liquidation bot on devnet out-of-the-box.
1 parent b905a56 commit 61cfc5c

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

scripts/simulation/Scarb.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ setup_trove = """
1616
rm open_trove_alpha-sepolia_state.json 2> /dev/null;
1717
sncast --account devnet_user1 --accounts-file ../devnet_accounts.json --url http://localhost:5050 script run open_trove --package simulation"""
1818

19+
setup_liquidation = """
20+
rm open_trove_alpha-sepolia_state.json 2> /dev/null; sncast --profile devnet-user1 script run open_trove --package simulation;
21+
rm open_trove_alpha-sepolia_state.json 2> /dev/null; sncast --profile devnet-user2 script run open_trove --package simulation;
22+
rm open_trove_max_forge_alpha-sepolia_state.json 2> /dev/null; sncast --profile devnet-user3 script run open_trove_max_forge --package simulation;
23+
curl -X POST http://localhost:5050/increase_time -H "Content-Type: application/json" -d '{ "time": 1800 }';
24+
rm crash_prices_alpha-sepolia_state.json 2> /dev/null; sncast --profile devnet-user1 script run crash_prices --package simulation;"""
25+
26+
1927
setup_absorption = """
2028
rm open_trove_alpha-sepolia_state.json 2> /dev/null; sncast --profile devnet-user1 script run open_trove --package simulation;
2129
rm open_trove_alpha-sepolia_state.json 2> /dev/null; sncast --profile devnet-user2 script run open_trove --package simulation;

scripts/simulation/src/crash_prices.cairo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use starknet::ContractAddress;
88
use wadray::Ray;
99

1010
fn main() {
11-
let pct_initial_price: Ray = 750000000000000000000000000_u128.into(); // 75% (Ray)
11+
let pct_initial_price: Ray = 900000000000000000000000000_u128.into(); // 90% (Ray)
1212

1313
let eth_pragma_price: u128 = wad_to_fixed_point(
1414
wadray::rmul_wr(constants::INITIAL_ETH_PRICE.into(), pct_initial_price), PRAGMA_DECIMALS

scripts/simulation/src/open_trove.cairo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fn main() {
1414
2,
1515
// eth
1616
addresses::eth_addr().into(),
17-
// 1 eth (Wad)
17+
// 10 eth (Wad)
1818
10000000000000000000.into(),
1919
// strk
2020
addresses::strk_addr().into(),

scripts/simulation/src/open_trove_max_forge.cairo

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ fn main() {
1414
2,
1515
// eth
1616
addresses::eth_addr().into(),
17-
// 0.5 eth (Wad)
18-
5000000000000000000.into(),
17+
// 5 eth (Wad)
18+
(5 * WAD_ONE).into(),
1919
// strk
2020
addresses::strk_addr().into(),
2121
(50 * WAD_ONE).into(),

0 commit comments

Comments
 (0)