Skip to content

Commit

Permalink
adds support for SeasonTwo (#229)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeshultz committed Nov 7, 2022
1 parent 13ec98f commit d34c94c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
6 changes: 4 additions & 2 deletions eagleproject/core/blockchain/addresses.py
Expand Up @@ -39,7 +39,8 @@
OGN_STAKING = "0x501804b374ef06fa9c427476147ac09f1551b9a0"
STORY_STAKING_SERIES = "0xcce8e784c777fb9435f89f4e45f8b7fc49f7669f"
STORY_STAKING_SEASON_ONE = "0x7436f9ffd073d9ab7e3904866e03270dc18d4c33"
STORY_STAKING_SEASONS = [STORY_STAKING_SEASON_ONE]
STORY_STAKING_SEASON_TWO = "0x6639cdb3ea7a48b0ad95b47bec78023c6f706160"
STORY_STAKING_SEASONS = [STORY_STAKING_SEASON_ONE, STORY_STAKING_SEASON_TWO]
STORY_STAKING_VAULT = "0xc626f08cf88972332cfcb48b227409658be67a1c"

# OGV
Expand Down Expand Up @@ -133,7 +134,8 @@
CHAINLINK_ORACLE: "ChainlinkOracle",
OGN_STAKING: "OGN Staking",
STORY_STAKING_SERIES: "Story Staking Series",
STORY_STAKING_SEASON_ONE: "Story Staking Season One",
STORY_STAKING_SEASON_ONE: "Season One",
STORY_STAKING_SEASON_TWO: "Season Two",
STRATCOMP1: "Compound Strategy",
STRATCOMP2: "Compound Strategy",
STRATAAVEDAI: "Aave Strategy",
Expand Down
10 changes: 7 additions & 3 deletions eagleproject/notify/triggers/story_stake.py
Expand Up @@ -5,6 +5,7 @@
from core.common import format_ousd_human
from core.models import StoryStake
from core.blockchain.addresses import (
CONTRACT_ADDR_TO_NAME,
STORY_STAKING_SEASONS,
)
from core.blockchain.const import E_18
Expand Down Expand Up @@ -37,15 +38,16 @@ def run_trigger(new_logs):
events = []

for ev in get_stake_unstake_events(new_logs):

if ev.topic_0 == SIG_EVENT_STAKE:
user_address = decode_single("(address)", decode_hex(ev.topic_1))[0]
amount = decode_single("(uint256)", decode_hex(ev.topic_2))[0]
points = decode_single("(uint256)", decode_hex(ev.data))[0]

events.append(
event_normal(
"Staked 🥩",
"{} Stake 🥩".format(
CONTRACT_ADDR_TO_NAME.get(ev.address, "")
),
"{} staked {} OGN for a total of {} points".format(
user_address[:6],
format_ousd_human(Decimal(amount) / Decimal(1e18)),
Expand All @@ -64,7 +66,9 @@ def run_trigger(new_logs):

events.append(
event_normal(
"Unstaked 💔",
"{} Unstake 💔".format(
CONTRACT_ADDR_TO_NAME.get(ev.address, "")
),
f"{user_address[:6]} unstaked {unstake_amount} OGN",
tags=EVENT_TAGS,
log_model=ev,
Expand Down

0 comments on commit d34c94c

Please sign in to comment.