11from typing import Dict , Optional , Tuple , Any , List
22import pandas as pd
3- from web3 import Web3
43from .base import BribePlatform
54from bal_tools .safe_tx_builder import SafeContract
65import json
76from pathlib import Path
8- from fee_allocator .logger import logger
97
108
119class PaladinPlatform (BribePlatform ):
@@ -60,64 +58,30 @@ def process_bribes(self, bribes_df: pd.DataFrame, builder: Any, usdc: Any) -> No
6058 fee_ratio = platform_fee_ratios [platform ]
6159
6260 total_reward_amount = int (mantissa * 10000 / (10000 + fee_ratio ))
63- fee_amount = mantissa - total_reward_amount
61+ fee_amount = (total_reward_amount * fee_ratio ) // 10000
62+
63+ reward_per_period = total_reward_amount // 2
64+ max_reward_per_vote = max (reward_per_period // 1000 , 50 )
65+ min_reward_per_vote = 50
6466
6567 quest_board .createRangedQuest (
6668 row ["target" ],
6769 self .usdc_address ,
68- True ,
70+ "true" ,
6971 2 ,
70- 1 ,
71- total_reward_amount ,
72+ min_reward_per_vote ,
73+ max_reward_per_vote ,
7274 total_reward_amount ,
7375 fee_amount ,
7476 0 ,
7577 1 ,
76- []
78+ "[]"
7779 )
7880
7981
8082 def validate_gauge_requirements (self , gauge_address : str ) -> Tuple [bool , Optional [str ]]:
81- """Validate gauge has USDC as reward token with correct distributor"""
82- try :
83- base_dir = Path (__file__ ).parent .parent
84- with open (f"{ base_dir } /abi/gauge.json" , "r" ) as f :
85- gauge_abi = json .load (f )
86-
87- w3 = self .run_config .mainnet .web3
88- usdc = Web3 .to_checksum_address (self .usdc_address )
89- gauge = Web3 .to_checksum_address (gauge_address )
90- contract = w3 .eth .contract (address = gauge , abi = gauge_abi )
91-
92- try :
93- usdc_found = usdc in [contract .functions .reward_tokens (i ).call () for i in range (8 )]
94- except Exception :
95- return False , "Gauge has incompatible implementation"
96-
97- if not usdc_found :
98- return False , f"USDC ({ usdc } ) not found in gauge reward tokens"
99-
100- try :
101- distributor = contract .functions .reward_data (usdc ).call ()[1 ]
102- has_correct_distributor = (
103- distributor .lower () == self .bal_quest_board .lower () or
104- distributor .lower () == self .aura_quest_board .lower ()
105- )
106-
107- if not has_correct_distributor :
108- valid_distributors = [
109- f"Balancer: { self .bal_quest_board } " ,
110- f"Aura: { self .aura_quest_board } "
111- ]
112- return False , f"Incorrect distributor. Valid: { ', ' .join (valid_distributors )} "
113-
114- except Exception :
115- return False , "Could not verify distributor"
116-
117- return True , None
118-
119- except Exception as e :
120- return False , f"Validation error: { str (e )} "
83+ """No validation needed for ROLLOVER close type"""
84+ return True , None
12185
12286 @property
12387 def platform_name (self ) -> str :
@@ -129,41 +93,4 @@ def supported_markets(self) -> List[str]:
12993 return ["aura" , "balancer" ]
13094
13195 def get_platform_for_market (self , market : str , voting_pool_override : Optional [str ]) -> str :
132- return "paladin"
133-
134- def check_all_gauge_requirements (self , pools : List [Any ]) -> List [Dict ]:
135- """Check all Paladin gauges for requirements and return issues"""
136- gauges_with_issues = []
137-
138- for pool in pools :
139- if pool .market_override != "paladin" :
140- continue
141-
142- valid , error_msg = self .validate_gauge_requirements (pool .gauge_address )
143- if not valid :
144- action_needed = []
145-
146- # Determine which distributors are needed
147- if pool .to_bal_incentives_usd > 0 :
148- action_needed .append (f"Balancer distributor ({ self .bal_quest_board } )" )
149- if pool .to_aura_incentives_usd > 0 :
150- action_needed .append (f"Aura distributor ({ self .aura_quest_board } )" )
151-
152- if action_needed :
153- if "not found in gauge reward tokens" in error_msg :
154- action_msg = f"Add USDC ({ self .usdc_address } ) as reward token and set { ' and ' .join (action_needed )} "
155- elif "Incorrect distributor" in error_msg :
156- action_msg = f"Set { ' and ' .join (action_needed )} "
157- else :
158- action_msg = error_msg
159-
160- logger .warning (f"Paladin gauge { pool .gauge_address } missing requirements: { action_msg } " )
161- gauges_with_issues .append ({
162- "gauge" : pool .gauge_address ,
163- "pool_id" : pool .pool_id ,
164- "chain" : pool .chain .name ,
165- "action" : action_msg ,
166- "amount" : float (pool .total_to_incentives_usd )
167- })
168-
169- return gauges_with_issues
96+ return "paladin"
0 commit comments