@@ -56,6 +56,7 @@ export enum MeritAction {
5656 CELO_SUPPLY_USDT = 'celo-supply-usdt' ,
5757 CELO_SUPPLY_USDC = 'celo-supply-usdc' ,
5858 CELO_SUPPLY_WETH = 'celo-supply-weth' ,
59+ CELO_SUPPLY_MULTIPLE_BORROW_USDT = 'celo-supply-multiple-borrow-usdt' ,
5960 CELO_BORROW_CELO = 'celo-borrow-celo' ,
6061 CELO_BORROW_USDT = 'celo-borrow-usdt' ,
6162 CELO_BORROW_USDC = 'celo-borrow-usdc' ,
@@ -111,6 +112,9 @@ const baseIncentivesWstETHCampaignsMessage =
111112const baseIncentivesETHCampaignsMessage =
112113 'Supplying ETH alone earns 1.25%, supplying ETH and borrowing USDC or EURC earns 1.50%, supplying ETH and borrowing GHO earns 1.75%. Some assets holding or positions on other protocols may impact the amount of rewards you are eligible for. Please check the forum post for the full eligibility criteria.' ;
113114
115+ const celoSupplyMultipleBorrowUsdtMessage =
116+ 'You must supply (CELO or ETH) and borrow USDT, in order to receive merit rewards. Please check the forum post for the full eligibility criteria.' ;
117+
114118const joinedEthCorrelatedIncentiveForumLink =
115119 'https://governance.aave.com/t/arfc-set-aci-as-emission-manager-for-liquidity-mining-programs/17898/56' ;
116120
@@ -582,6 +586,13 @@ const MERIT_DATA_MAP: Record<string, Record<string, MeritReserveIncentiveData[]>
582586 protocolAction : ProtocolAction . supply ,
583587 customMessage : antiLoopMessage ,
584588 } ,
589+ {
590+ action : MeritAction . CELO_SUPPLY_MULTIPLE_BORROW_USDT ,
591+ rewardTokenAddress : AaveV3Celo . ASSETS . CELO . A_TOKEN ,
592+ rewardTokenSymbol : 'aCelCELO' ,
593+ protocolAction : ProtocolAction . supply ,
594+ customMessage : celoSupplyMultipleBorrowUsdtMessage ,
595+ } ,
585596 {
586597 action : MeritAction . CELO_BORROW_CELO ,
587598 rewardTokenAddress : AaveV3Celo . ASSETS . CELO . A_TOKEN ,
@@ -605,6 +616,13 @@ const MERIT_DATA_MAP: Record<string, Record<string, MeritReserveIncentiveData[]>
605616 protocolAction : ProtocolAction . borrow ,
606617 customMessage : antiLoopBorrowMessage ,
607618 } ,
619+ {
620+ action : MeritAction . CELO_SUPPLY_MULTIPLE_BORROW_USDT ,
621+ rewardTokenAddress : AaveV3Celo . ASSETS . CELO . A_TOKEN ,
622+ rewardTokenSymbol : 'aCelCELO' ,
623+ protocolAction : ProtocolAction . borrow ,
624+ customMessage : celoSupplyMultipleBorrowUsdtMessage ,
625+ } ,
608626 ] ,
609627 USDC : [
610628 {
@@ -630,6 +648,13 @@ const MERIT_DATA_MAP: Record<string, Record<string, MeritReserveIncentiveData[]>
630648 protocolAction : ProtocolAction . supply ,
631649 customMessage : antiLoopMessage ,
632650 } ,
651+ {
652+ action : MeritAction . CELO_SUPPLY_MULTIPLE_BORROW_USDT ,
653+ rewardTokenAddress : AaveV3Celo . ASSETS . CELO . A_TOKEN ,
654+ rewardTokenSymbol : 'aCelCELO' ,
655+ protocolAction : ProtocolAction . supply ,
656+ customMessage : celoSupplyMultipleBorrowUsdtMessage ,
657+ } ,
633658 {
634659 action : MeritAction . CELO_BORROW_WETH ,
635660 rewardTokenAddress : AaveV3Celo . ASSETS . CELO . A_TOKEN ,
@@ -654,6 +679,7 @@ export const useMeritIncentives = ({
654679 queryFn : async ( ) => {
655680 const response = await fetch ( url ) ;
656681 const data = await response . json ( ) ;
682+
657683 const meritIncentives = data . currentAPR as MeritIncentives ;
658684
659685 return meritIncentives ;
@@ -665,27 +691,37 @@ export const useMeritIncentives = ({
665691 if ( ! meritReserveIncentiveData ) {
666692 return null ;
667693 }
668- const incentive = meritReserveIncentiveData . find (
694+
695+ const incentives = meritReserveIncentiveData . filter (
669696 ( item ) => item . protocolAction === protocolAction
670697 ) ;
671698
672- if ( ! incentive ) {
699+ if ( incentives . length === 0 ) {
673700 return null ;
674701 }
675702
676- const APR = data . actionsAPR [ incentive . action ] ;
703+ let maxAPR = null ;
704+ let selectedIncentive = null ;
705+
706+ for ( const incentive of incentives ) {
707+ const APR = data . actionsAPR [ incentive . action ] ;
708+ if ( APR && ( maxAPR === null || APR > maxAPR ) ) {
709+ maxAPR = APR ;
710+ selectedIncentive = incentive ;
711+ }
712+ }
677713
678- if ( ! APR ) {
714+ if ( ! selectedIncentive || maxAPR === null ) {
679715 return null ;
680716 }
681717
682718 return {
683- incentiveAPR : ( APR / 100 ) . toString ( ) ,
684- rewardTokenAddress : incentive . rewardTokenAddress ,
685- rewardTokenSymbol : incentive . rewardTokenSymbol ,
686- action : incentive . action ,
687- customMessage : incentive . customMessage ,
688- customForumLink : incentive . customForumLink ,
719+ incentiveAPR : ( maxAPR / 100 ) . toString ( ) ,
720+ rewardTokenAddress : selectedIncentive . rewardTokenAddress ,
721+ rewardTokenSymbol : selectedIncentive . rewardTokenSymbol ,
722+ action : selectedIncentive . action ,
723+ customMessage : selectedIncentive . customMessage ,
724+ customForumLink : selectedIncentive . customForumLink ,
689725 } as ExtendedReserveIncentiveResponse ;
690726 } ,
691727 } ) ;
0 commit comments