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

feat: include hh liquis support #1449

Merged
merged 1 commit into from
Nov 9, 2023
Merged
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
1 change: 1 addition & 0 deletions helpers/addresses.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@
"aura_briber": "0xcBf242F20D183B4116C22Dd5e441b9aE15b0d35A",
"frax_briber": "0x2694214a4EA6A2C9A9427AA12251705B67e86960",
"bunni_briber": "0x175b01eF7CEa8615B1D9485BC827378EA5D50C86",
"liquis_briber": "0xA44C4c85eB01f02d8cEa9BC416174Bb13d13Aa72",
"_deprecated": {
"bribe_vault_v1": "0x9DDb2da7Dd76612e0df237B89AF2CF4413733212",
"balancer_briber_v1": "0x7Cdf753b45AB0729bcFe33DC12401E55d28308A9",
Expand Down
66 changes: 42 additions & 24 deletions scripts/badger/bribe_ecosystems.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def main(
badger_bribe_in_liquis=0, # NOTE: dollar denominated. Badger calculation is done internaly, the incentive gets process via Paladin
duration_paladin_quest=1, # Duration (in number of periods) of the Quest
reward_per_vote_liquis=0, # Amount of reward per vlLIQ
liquis_incentive_in_paladin=False, # Indicates if the incentive is going to be post in paladin or HH
aura_proposal_id=None,
convex_proposal_id=None,
):
Expand Down Expand Up @@ -96,6 +97,7 @@ def main(
votium_briber = safe.contract(r.votium.bribe, interface.IVotiumBribe)
frax_briber = safe.contract(r.hidden_hand.frax_briber, interface.IBribeMarket)
bunni_briber = safe.contract(r.hidden_hand.bunni_briber, interface.IBribeMarket)
liquis_briber = safe.contract(r.hidden_hand.liquis_briber, interface.IBribeMarket)

palading_quest_board_veliq = safe.contract(
r.paladin.quest_board_veliq, interface.IQuestBoard
Expand Down Expand Up @@ -220,32 +222,48 @@ def bribe_balancer(gauge, mantissa):

mantissa = int(bribes["liquis"] / badger_rate * Decimal(1e18))

platform_fee = int(
(Decimal(mantissa) * palading_quest_board_veliq.platformFee()) / MAX_BPS
)
if liquis_incentive_in_paladin:
platform_fee = int(
(Decimal(mantissa) * palading_quest_board_veliq.platformFee()) / MAX_BPS
)

min_reward_per_vote = palading_quest_board_veliq.minRewardPerVotePerToken(
badger
)
min_reward_per_vote = palading_quest_board_veliq.minRewardPerVotePerToken(
badger
)

reward_per_vote_liquis = reward_per_vote_liquis * 1e18
objective = (Decimal(mantissa) * Decimal(1e18)) / Decimal(
reward_per_vote_liquis
)
reward_per_vote_liquis = reward_per_vote_liquis * 1e18
objective = (Decimal(mantissa) * Decimal(1e18)) / Decimal(
reward_per_vote_liquis
)

assert reward_per_vote_liquis > min_reward_per_vote
assert objective > palading_quest_board_veliq.minObjective()
assert duration_paladin_quest >= 1

badger.approve(palading_quest_board_veliq, mantissa + platform_fee)
palading_quest_board_veliq.createQuest(
r.bunni.badger_wbtc_bunni_gauge_309720_332580, # address gauge
badger.address, # address rewardToken
duration_paladin_quest, # uint48 duration
objective, # uint256 objective
reward_per_vote_liquis, # uint256 rewardPerVote
mantissa, # uint256 totalRewardAmount
platform_fee, # uint256 feeAmount
)
assert reward_per_vote_liquis > min_reward_per_vote
assert objective > palading_quest_board_veliq.minObjective()
assert duration_paladin_quest >= 1

badger.approve(palading_quest_board_veliq, mantissa + platform_fee)
palading_quest_board_veliq.createQuest(
r.bunni.badger_wbtc_bunni_gauge_309720_332580, # address gauge
badger.address, # address rewardToken
duration_paladin_quest, # uint48 duration
objective, # uint256 objective
reward_per_vote_liquis, # uint256 rewardPerVote
mantissa, # uint256 totalRewardAmount
platform_fee, # uint256 feeAmount
)
else:
# api for prop check: https://api.hiddenhand.finance/proposal/liquis
prop = web3.solidityKeccak(
["address"], [r.bunni.badger_wbtc_bunni_gauge_309720_332580]
)
print("prop", prop.hex())

badger.approve(bribe_vault, mantissa)
liquis_briber.depositBribe(
prop, # bytes32 proposal
badger, # address token
mantissa, # uint256 amount
max_tokens_per_vote, # uint256 _maxTokensPerVote,
periods, # uint256 _periods
)

safe.post_safe_tx()
Loading