File tree Expand file tree Collapse file tree 3 files changed +40
-4
lines changed
Expand file tree Collapse file tree 3 files changed +40
-4
lines changed Original file line number Diff line number Diff line change @@ -125,7 +125,8 @@ export const ALIASES_FRAXTAL = lowerCaseValues({
125125 "crv" : "0x331B9182088e2A7d6D3Fe4742AbA1fB231aEcc56" ,
126126 "one_way_factory" : "0xf3c9bdAB17B7016fBE3B77D17b1602A7db93ac66" ,
127127 "gauge_controller" : "0x0000000000000000000000000000000000000000" , // <--- TODO CHANGE
128- "gauge_factory" : "0xeF672bD94913CB6f1d2812a6e18c1fFdEd8eFf5c" ,
128+ "gauge_factory_old" : "0xeF672bD94913CB6f1d2812a6e18c1fFdEd8eFf5c" ,
129+ "gauge_factory" : "0x0b8d6b6cefc7aa1c2852442e518443b1b22e1c52" ,
129130 "leverage_zap" : "0x37c5ab57AF7100Bdc9B668d766e193CCbF6614FD" , // odos
130131 "leverage_markets_start_id" : "0" ,
131132} ) ;
Original file line number Diff line number Diff line change @@ -313,8 +313,18 @@ class Lending implements ILending {
313313 this . setContract ( this . constants . ALIASES . minter , MinterABI ) ;
314314 this . setContract ( this . constants . ALIASES . gauge_factory , GaugeFactoryMainnetABI ) ;
315315 } else {
316- this . constants . ALIASES . minter = this . constants . ALIASES . gauge_factory ;
317- this . setContract ( this . constants . ALIASES . gauge_factory , GaugeFactorySidechainABI ) ;
316+ if ( this . constants . ALIASES . gauge_factory_old && this . constants . ALIASES . gauge_factory_old !== this . constants . ZERO_ADDRESS ) {
317+ // set old gauge factory
318+ this . constants . ALIASES . minter_old = this . constants . ALIASES . gauge_factory_old ;
319+ this . setContract ( this . constants . ALIASES . gauge_factory_old , GaugeFactorySidechainABI ) ;
320+
321+ // set new gauge factory
322+ this . constants . ALIASES . minter = this . constants . ALIASES . gauge_factory ;
323+ this . setContract ( this . constants . ALIASES . gauge_factory , GaugeFactorySidechainABI ) ;
324+ } else {
325+ this . constants . ALIASES . minter = this . constants . ALIASES . gauge_factory ;
326+ this . setContract ( this . constants . ALIASES . gauge_factory , GaugeFactorySidechainABI ) ;
327+ }
318328 }
319329
320330 if ( L2Networks . includes ( this . chainId ) ) {
Original file line number Diff line number Diff line change @@ -723,7 +723,32 @@ export class OneWayMarketTemplate {
723723
724724 private async _vaultClaimCrv ( estimateGas : boolean ) : Promise < string | TGas > {
725725 if ( this . vaultRewardsOnly ( ) ) throw Error ( `${ this . name } has Rewards-Only Gauge. Use claimRewards instead` ) ;
726- const contract = lending . contracts [ lending . constants . ALIASES . minter ] . contract ;
726+
727+ let isOldFactory = false ;
728+ let contract ;
729+
730+ if ( lending . chainId !== 1 ) {
731+ if ( lending . constants . ALIASES . gauge_factory_old && lending . constants . ALIASES . gauge_factory_old !== lending . constants . ZERO_ADDRESS ) {
732+ const oldFactoryContract = lending . contracts [ lending . constants . ALIASES . gauge_factory_old ] . contract ;
733+ const lpToken = await lending . contracts [ this . addresses . gauge ] . contract . lp_token ( ) ;
734+ const gaugeAddress = await oldFactoryContract . get_gauge_from_lp_token ( lpToken ) ;
735+
736+ isOldFactory = gaugeAddress . toLowerCase ( ) === this . addresses . gauge . toLowerCase ( ) ;
737+
738+ if ( isOldFactory ) {
739+ contract = oldFactoryContract ;
740+ }
741+ }
742+ }
743+
744+ if ( ! isOldFactory ) {
745+ contract = lending . contracts [ lending . constants . ALIASES . minter ] . contract
746+ }
747+
748+ if ( ! contract ) {
749+ throw Error ( `${ this . name } couldn't match gauge factory` ) ;
750+ }
751+
727752 const gas = await contract . mint . estimateGas ( this . addresses . gauge , lending . constantOptions ) ;
728753 if ( estimateGas ) return smartNumber ( gas ) ;
729754
You can’t perform that action at this time.
0 commit comments