|
| 1 | +from rich.console import Console |
| 2 | + |
| 3 | +from constants.silo_finance import SILO_FINANCE_INTEGRATION_ID_TO_START_BLOCK |
| 4 | +from constants.summary_columns import SummaryColumn |
| 5 | +from integrations.integration_ids import IntegrationID as IntID |
| 6 | +from constants.chains import Chain |
| 7 | +from utils.silo_finance import SiloFinance |
| 8 | + |
| 9 | +if __name__ == "__main__": |
| 10 | + console = Console() |
| 11 | + integration_id = IntID.SILO_FINANCE_LP_EUSDE_AUG_14_EXPIRY |
| 12 | + integration = SiloFinance( |
| 13 | + integration_id=integration_id, |
| 14 | + start_block=SILO_FINANCE_INTEGRATION_ID_TO_START_BLOCK[integration_id], |
| 15 | + chain=Chain.ETHEREUM, |
| 16 | + summary_cols=[SummaryColumn.SILO_FINANCE_LP_EUSDE_AUG_14_PTS], |
| 17 | + reward_multiplier=30, |
| 18 | + balance_multiplier=1, |
| 19 | + ) |
| 20 | + |
| 21 | + # Without cached data |
| 22 | + without_cached_data_output = integration.get_block_balances( |
| 23 | + cached_data={}, blocks=[22726278] |
| 24 | + ) |
| 25 | + console.print("Run without cached data", without_cached_data_output) |
| 26 | + # Check that the output is correct~ish |
| 27 | + assert without_cached_data_output[22726278] == { |
| 28 | + "0xdEDcF5806c4968C6397eeE97e68047bdA339d0c1": 4.0 |
| 29 | + } |
| 30 | + |
| 31 | + # Use cache data to get the next blocks |
| 32 | + with_cached_data_output = integration.get_block_balances( |
| 33 | + cached_data=without_cached_data_output, |
| 34 | + blocks=[22740147], |
| 35 | + ) |
| 36 | + console.print("Run with cached data", with_cached_data_output) |
| 37 | + assert with_cached_data_output[22740147] == { |
| 38 | + "0xdEDcF5806c4968C6397eeE97e68047bdA339d0c1": 5.0, |
| 39 | + "0x62a4A8f9f5F3AaE9Ee9CEE780285A0D501C12d09": 25.447709, |
| 40 | + } |
0 commit comments