-
Notifications
You must be signed in to change notification settings - Fork 51
/
active_emissions.py
110 lines (98 loc) · 3.47 KB
/
active_emissions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
from helpers.rewards.LoggerUnlockSchedule import LoggerUnlockSchedule
from scripts.actions.helpers.RewardsSchedule import RewardsSchedule, asset_to_address
from scripts.systems.badger_system import BadgerSystem
from brownie import *
from helpers.utils import shares_to_fragments, to_digg_shares
from helpers.console_utils import console
import datetime
from helpers.time_utils import days, to_timestamp
weekly_schedule = {
# CRV LP
"native.renCrv": {
"badger": Wei("6900 ether"),
"digg": to_digg_shares(0),
},
"native.sbtcCrv": {
"badger": Wei("3450 ether"),
"digg": to_digg_shares(0),
},
"native.tbtcCrv": {
"badger": Wei("3450 ether"),
"digg": to_digg_shares(0),
},
"native.hbtcCrv": {"badger": Wei("6900 ether"), "digg": to_digg_shares(0)},
"native.bbtcCrv": {"badger": Wei("6900 ether"), "digg": to_digg_shares(0)},
"native.obtcCrv": {"badger": Wei("3450 ether"), "digg": to_digg_shares(0)},
"native.pbtcCrv": {"badger": Wei("3450 ether"), "digg": to_digg_shares(0)},
"native.tricrypto": {"badger": Wei("6900 ether"), "digg": to_digg_shares(0)},
# Sushi LP
"native.sushiWbtcEth": {
"badger": Wei("2300 ether"),
"digg": to_digg_shares(0),
},
"experimental.sushiIBbtcWbtc": {
"badger": Wei("4600 ether"),
"digg": to_digg_shares(0),
},
# Yearn Partner
"yearn.wbtc": {"badger": Wei("2300 ether"), "digg": to_digg_shares(0)},
# Convex Helper
"native.cvx": {"badger": Wei("230 ether"), "digg": to_digg_shares(0)},
"native.cvxCrv": {"badger": Wei("230 ether"), "digg": to_digg_shares(0)},
# Native Setts
"native.badger": {
"badger": Wei("2300 ether"),
"digg": to_digg_shares(0),
},
"native.uniBadgerWbtc": {
"badger": Wei("4600 ether"),
"digg": to_digg_shares(0),
},
"native.sushiBadgerWbtc": {
"badger": Wei("4600 ether"),
"digg": to_digg_shares(0),
},
# Digg Setts
"native.digg": {"badger": Wei("0 ether"), "digg": to_digg_shares(4.990)},
"native.uniDiggWbtc": {
"badger": Wei("0 ether"),
"digg": to_digg_shares(9.990),
},
"native.sushiDiggWbtc": {
"badger": Wei("0 ether"),
"digg": to_digg_shares(9.990),
},
}
class Emissions:
def __init__(self, active_emissions):
self.active = active_emissions
emissions = Emissions(active_emissions=weekly_schedule)
def build_weekly_schedules(badger: BadgerSystem, start, duration):
end = start + duration
schedules = []
for key, value in weekly_schedule.items():
sett = badger.getSett(key)
for asset, amount in value.items():
if amount == 0:
continue
schedules.append(
LoggerUnlockSchedule(
[
sett.address,
asset_to_address(asset),
amount,
start,
end,
duration,
]
)
)
return schedules
def get_active_rewards_schedule(badger: BadgerSystem):
rest = RewardsSchedule(badger)
rest.setStart(to_timestamp(datetime.datetime(2021, 7, 8, 1, 00)))
rest.setDuration(days(7))
# TODO: Set to read from config emissions. Emit auto-compounding events & on-chain readable data in Unified Rewards Logger.
rest.setAmounts(emissions.active)
rest.setTotals(emissions.active)
return rest