|
| 1 | +# ------------------------------------- |
| 2 | +# October 14, 2025 - Rebalance SwapX AMO pool by burning OS. |
| 3 | +# wS and OS is removed from the pool, |
| 4 | +# the received wS is swapped for OS and the left over OS in the strategy is burnt. |
| 5 | +# ------------------------------------- |
| 6 | +from world_sonic import * |
| 7 | + |
| 8 | +def main(): |
| 9 | + with TemporaryForkForReallocations() as txs: |
| 10 | + |
| 11 | + # Before |
| 12 | + txs.append(vault_core.rebase({'from': SONIC_STRATEGIST})) |
| 13 | + txs.append(vault_value_checker.takeSnapshot({'from': SONIC_STRATEGIST})) |
| 14 | + |
| 15 | + ws_swap_in_amount = 110000 * 10**18 |
| 16 | + print("Amount wS to swap into the pool ", "{:.2f}".format(ws_swap_in_amount / 10**18)) |
| 17 | + |
| 18 | + # AMO pool before |
| 19 | + print_amo_pool_status("Before") |
| 20 | + |
| 21 | + # Claim withdrawal from the Validator |
| 22 | + txs.append( |
| 23 | + swapx_amo_strat.swapAssetsToPool( |
| 24 | + ws_swap_in_amount, |
| 25 | + {'from': SONIC_STRATEGIST} |
| 26 | + ) |
| 27 | + ) |
| 28 | + |
| 29 | + # AMO pool after |
| 30 | + print_amo_pool_status("After") |
| 31 | + |
| 32 | + # After |
| 33 | + vault_change = vault_core.totalValue() - vault_value_checker.snapshots(SONIC_STRATEGIST)[0] |
| 34 | + supply_change = os.totalSupply() - vault_value_checker.snapshots(SONIC_STRATEGIST)[1] |
| 35 | + profit = vault_change - supply_change |
| 36 | + |
| 37 | + txs.append(vault_value_checker.checkDelta(profit, (10 * 10**18), vault_change, (100 * 10**18), {'from': SONIC_STRATEGIST})) |
| 38 | + |
| 39 | + print("-----") |
| 40 | + print("Profit in wS", "{:.2f}".format(profit / 10**18), profit) |
| 41 | + print("OS supply change", "{:.2f}".format(supply_change / 10**18), supply_change) |
| 42 | + print("OS Vault change ", "{:.2f}".format(vault_change / 10**18), vault_change) |
| 43 | + print("-----") |
0 commit comments