Skip to content

Commit

Permalink
feat: allow possibility of using #liq as incentive in liquis marketpl…
Browse files Browse the repository at this point in the history
…ace paladin
  • Loading branch information
petrovska-petro committed Dec 20, 2023
1 parent 027ac60 commit 3e68d6c
Showing 1 changed file with 30 additions and 10 deletions.
40 changes: 30 additions & 10 deletions scripts/badger/bribe_ecosystems.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def main(
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
is_governance_incentive_token=True, # Indicates if the incentive is going to be governance token ($badger) or different. Applicable only in Paladin.
aura_proposal_id=None,
convex_proposal_id=None,
):
Expand All @@ -86,8 +87,12 @@ def main(

safe = GreatApeSafe(r.badger_wallets.treasury_ops_multisig)
badger = safe.contract(r.treasury_tokens.BADGER)
liquis = safe.contract(r.treasury_tokens.LIQ)

safe.take_snapshot([badger])
# tokens with consensus within the dao to be used for incentives in marketplaces
# badger: across all platforms and markets
# liquis: uniquely for liquis marketplace in either HH or Paladin
safe.take_snapshot([badger, liquis])

bribe_vault = safe.contract(r.hidden_hand.bribe_vault, interface.IBribeVault)
aura_briber = safe.contract(r.hidden_hand.aura_briber, interface.IBribeMarket)
Expand Down Expand Up @@ -216,41 +221,56 @@ def bribe_balancer(gauge, mantissa):
# NOTE: Treasury decision is expressed in dollars
# ref: https://forum.badger.finance/t/34-liquis-partner-engagement/6029
cg = CoinGeckoAPI(os.getenv("COINGECKO_API_KEY"))
badger_rate = Decimal(
cg.get_price(ids="badger-dao", vs_currencies="usd")["badger-dao"]["usd"]
)

mantissa = int(bribes["liquis"] / badger_rate * Decimal(1e18))
if is_governance_incentive_token:
badger_rate = Decimal(
cg.get_price(ids="badger-dao", vs_currencies="usd")["badger-dao"]["usd"]
)
else:
liquis_rate = Decimal(
cg.get_price(ids="liquis", vs_currencies="usd")["liquis"]["usd"]
)

if liquis_incentive_in_paladin:
rate = badger_rate if is_governance_incentive_token else liquis_rate
mantissa = int(bribes["liquis"] / rate * Decimal(1e18))
platform_fee = int(
(Decimal(mantissa) * palading_quest_board_veliq.platformFee()) / MAX_BPS
)

min_reward_per_vote = palading_quest_board_veliq.minRewardPerVotePerToken(
badger
badger if is_governance_incentive_token else 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 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)
# approve incentive token conditional based on flag
if is_governance_incentive_token:
badger.approve(palading_quest_board_veliq, mantissa + platform_fee)
else:
liquis.approve(palading_quest_board_veliq, mantissa + platform_fee)

# create incentive quest
palading_quest_board_veliq.createQuest(
r.bunni.badger_wbtc_bunni_gauge_309720_332580, # address gauge
badger.address, # address rewardToken
badger.address
if is_governance_incentive_token
else liquis.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:
mantissa = int(bribes["liquis"] / badger_rate * Decimal(1e18))

# api for prop check: https://api.hiddenhand.finance/proposal/liquis
prop = web3.solidityKeccak(
["address"], [r.bunni.badger_wbtc_bunni_gauge_309720_332580]
Expand Down

0 comments on commit 3e68d6c

Please sign in to comment.