Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update curve registry to include convex pids and badger setts #174

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion assistant/rewards/classes/RewardsList.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,12 @@ def printState(self):
shareSeconds = self.metadata[user].shareSeconds
shareSecondsInRange = self.metadata[user].shareSecondsInRange
table.append(
[user, data[BADGER], shareSeconds, shareSecondsInRange,]
[
user,
data[BADGER],
shareSeconds,
shareSecondsInRange,
]
)
print("REWARDS LIST")
print(
Expand Down
10 changes: 8 additions & 2 deletions assistant/rewards/classes/User.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@

class User:
def __init__(
self, address, currentDeposited, lastUpdated,
self,
address,
currentDeposited,
lastUpdated,
):
self.address = address
self.currentDeposited = currentDeposited
Expand All @@ -14,7 +17,10 @@ def __init__(

def __repr__(self):
return "User({},{},{},{})".format(
self.address, self.currentDeposited, self.lastUpdated, self.shareSeconds,
self.address,
self.currentDeposited,
self.lastUpdated,
self.shareSeconds,
)

def process_transfer(self, transfer):
Expand Down
8 changes: 7 additions & 1 deletion assistant/rewards/meta_rewards/sushi.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,11 @@ def calc_all_sushi_rewards(badger, startBlock, endBlock, nextCycle):

def calc_sushi_rewards(badger, startBlock, endBlock, nextCycle, events, name):
return calc_rewards(
badger, startBlock, endBlock, nextCycle, events, name, xSushiTokenAddress,
badger,
startBlock,
endBlock,
nextCycle,
events,
name,
xSushiTokenAddress,
)
39 changes: 33 additions & 6 deletions assistant/rewards/rewards_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ def sum_digg_claims(claims):


def diff_rewards(
badger: BadgerSystem, before_file, after_file,
badger: BadgerSystem,
before_file,
after_file,
):
a = before_file["claims"]
b = after_file["claims"]
Expand All @@ -102,9 +104,20 @@ def diff_rewards(
assert proportionGained < 1.25

table.append(
[user, val(beforeClaim), val(afterClaim), val(diff), proportionGained,]
[
user,
val(beforeClaim),
val(afterClaim),
val(diff),
proportionGained,
]
)
print(tabulate(table, headers=["user", "a", "b", "diff", "% gained"],))
print(
tabulate(
table,
headers=["user", "a", "b", "diff", "% gained"],
)
)


def get_expected_total_rewards(periodEndTime):
Expand Down Expand Up @@ -245,10 +258,18 @@ def compare_rewards(
]
)
table.append(
["From last period", sum_after - sum_before, val(sum_after - sum_before),]
[
"From last period",
sum_after - sum_before,
val(sum_after - sum_before),
]
)
table.append(
["Sanity Sum", sanitySum, "-",]
[
"Sanity Sum",
sanitySum,
"-",
]
)
print(tabulate(table, headers=["key", "value", "scaled"]))

Expand Down Expand Up @@ -287,7 +308,13 @@ def compare_rewards(
# proportionInRange = 0

table.append(
[user, val(beforeClaim), val(afterClaim), val(diff), proportionGained,]
[
user,
val(beforeClaim),
val(afterClaim),
val(diff),
proportionGained,
]
)
assert afterClaim >= beforeClaim
# print(
Expand Down
6 changes: 4 additions & 2 deletions assistant/subgraph/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ def negate_withdrawals(withdrawal):

deposits = map(convert_amount, results["vaults"][0]["deposits"])
withdrawals = map(
negate_withdrawals, map(convert_amount, results["vaults"][0]["withdrawals"]),
negate_withdrawals,
map(convert_amount, results["vaults"][0]["withdrawals"]),
)

deposits = list(filter(filter_by_startBlock, list(deposits)))
Expand All @@ -226,7 +227,8 @@ def negate_withdrawals(withdrawal):
console.log("Processing {} withdrawals".format(len((withdrawals))))

return sorted(
[*deposits, *withdrawals], key=lambda t: t["transaction"]["timestamp"],
[*deposits, *withdrawals],
key=lambda t: t["transaction"]["timestamp"],
)


Expand Down
20 changes: 14 additions & 6 deletions config/active_emissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,11 @@
"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"),
Expand All @@ -56,9 +53,8 @@
"badger": Wei("4600 ether"),
"digg": to_digg_shares(0),
},

# Digg Setts
"native.digg": {"badger": Wei("0 ether"), "digg": to_digg_shares(4.990)},
"native.digg": {"badger": Wei("0 ether"), "digg": to_digg_shares(4.990)},
"native.uniDiggWbtc": {
"badger": Wei("0 ether"),
"digg": to_digg_shares(9.990),
Expand All @@ -69,13 +65,15 @@
},
}


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 = []
Expand All @@ -86,10 +84,20 @@ def build_weekly_schedules(badger: BadgerSystem, start, duration):
if amount == 0:
continue
schedules.append(
LoggerUnlockSchedule([sett.address, asset_to_address(asset), amount, start, end, duration])
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)))
Expand Down
9 changes: 6 additions & 3 deletions helpers/gnosis_safe.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,24 @@
- Leveraging approved hash voting
"""


class ApeSafeHelper:
def __init__(self, badger, safe: ApeSafe):
self.badger = badger
self.safe = safe

def getSett(self, key):
abi = Sett.abi
return self.safe.contract_from_abi(self.badger.getSett(key).address, "Sett", abi)
return self.safe.contract_from_abi(
self.badger.getSett(key).address, "Sett", abi
)

def getStrategy(self, key):
# Get strategy name
# abi = contract_name_to_artifact()
# return self.safe.contract_from_abi(self.badger.getSett(key).address, "Strategy", abi)
return True

def publish(self):
safe_tx = self.safe.multisend_from_receipts()
# self.safe.preview(safe_tx)
Expand Down
2 changes: 1 addition & 1 deletion helpers/registry/ChainRegistry.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __init__(
compound=None,
chainlink=None,
defidollar=None,
digg=None
digg=None,
):
self.curve = curve
self.convex = convex
Expand Down
89 changes: 47 additions & 42 deletions helpers/registry/bsc_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,53 @@
from helpers.registry.WhaleRegistryAction import WhaleRegistryAction


gnosis_safe_registry=DotMap(
addresses=DotMap(
proxyFactory="0x76E2cFc1F5Fa8F6a5b3fC4c8F4788F0116861F9B",
masterCopy="0x34CfAC646f301356fAa8B21e94227e3583Fe3F5F",
),
)
pancake_registry=DotMap(
cake="0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82",
symbol="Cake",
syrup="0x009cF7bC57584b7998236eff51b98A168DceA9B0",
masterChef="0x73feaa1eE314F8c655E354234017bE2193C9E24E",
factoryV2="0xBCfCcbde45cE874adCB698cC183deBcF17952812",
routerV2="0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F",
smartChefs="0xe4dD0C50fb314A8B2e84D211546F5B57eDd7c2b9",
chefPairs=DotMap(
bnbBtcb="0x7561EEe90e24F3b348E1087A005F78B4c8453524",
bBadgerBtcb="0x10f461ceac7a17f59e249954db0784d42eff5db5",
bDiggBtcb="0xE1E33459505bB3763843a426F7Fd9933418184ae",
),
chefPids=DotMap(
bnbBtcb=15,
bBadgerBtcb=0,
bDiggBtcb=104,
),
)
multicall_registry=DotMap(multicall="0xE1dDc30f691CA671518090931e3bFC1184BFa4Aa",)
sushi_registry=DotMap(
sushiToken="",
xsushiToken="",
sushiChef="",
router="",
factory="",
lpTokens=DotMap(sushiBadgerWBtc="", sushiWbtcWeth="",),
pids=DotMap(sushiBadgerWBtc=0, sushiEthWBtc=0),
)
token_registry=DotMap(
bnb="0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
btcb="0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c",
usdc="0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
bBadger="0x1F7216fdB338247512Ec99715587bb97BBf96eae",
bDigg="0x5986D5c77c65e5801a5cAa4fAE80089f870A71dA",
)
gnosis_safe_registry = DotMap(
addresses=DotMap(
proxyFactory="0x76E2cFc1F5Fa8F6a5b3fC4c8F4788F0116861F9B",
masterCopy="0x34CfAC646f301356fAa8B21e94227e3583Fe3F5F",
),
)
pancake_registry = DotMap(
cake="0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82",
symbol="Cake",
syrup="0x009cF7bC57584b7998236eff51b98A168DceA9B0",
masterChef="0x73feaa1eE314F8c655E354234017bE2193C9E24E",
factoryV2="0xBCfCcbde45cE874adCB698cC183deBcF17952812",
routerV2="0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F",
smartChefs="0xe4dD0C50fb314A8B2e84D211546F5B57eDd7c2b9",
chefPairs=DotMap(
bnbBtcb="0x7561EEe90e24F3b348E1087A005F78B4c8453524",
bBadgerBtcb="0x10f461ceac7a17f59e249954db0784d42eff5db5",
bDiggBtcb="0xE1E33459505bB3763843a426F7Fd9933418184ae",
),
chefPids=DotMap(
bnbBtcb=15,
bBadgerBtcb=0,
bDiggBtcb=104,
),
)
multicall_registry = DotMap(
multicall="0xE1dDc30f691CA671518090931e3bFC1184BFa4Aa",
)
sushi_registry = DotMap(
sushiToken="",
xsushiToken="",
sushiChef="",
router="",
factory="",
lpTokens=DotMap(
sushiBadgerWBtc="",
sushiWbtcWeth="",
),
pids=DotMap(sushiBadgerWBtc=0, sushiEthWBtc=0),
)
token_registry = DotMap(
bnb="0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
btcb="0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c",
usdc="0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
bBadger="0x1F7216fdB338247512Ec99715587bb97BBf96eae",
bDigg="0x5986D5c77c65e5801a5cAa4fAE80089f870A71dA",
)

bsc_registry = ChainRegistry(
sushiswap=sushi_registry,
Expand Down
Loading