diff --git a/src/apps/mmfinance/assets/logo.png b/src/apps/mm-finance/assets/logo.png similarity index 100% rename from src/apps/mmfinance/assets/logo.png rename to src/apps/mm-finance/assets/logo.png diff --git a/src/apps/mmfinance/contracts/abis/mmfinance-chef-v-2.json b/src/apps/mm-finance/contracts/abis/mm-finance-chef-v-2.json similarity index 100% rename from src/apps/mmfinance/contracts/abis/mmfinance-chef-v-2.json rename to src/apps/mm-finance/contracts/abis/mm-finance-chef-v-2.json diff --git a/src/apps/mmfinance/contracts/abis/mmfinance-chef.json b/src/apps/mm-finance/contracts/abis/mm-finance-chef.json similarity index 100% rename from src/apps/mmfinance/contracts/abis/mmfinance-chef.json rename to src/apps/mm-finance/contracts/abis/mm-finance-chef.json diff --git a/src/apps/mmfinance/contracts/abis/mmfinance-ifo-chef.json b/src/apps/mm-finance/contracts/abis/mm-finance-ifo-chef.json similarity index 100% rename from src/apps/mmfinance/contracts/abis/mmfinance-ifo-chef.json rename to src/apps/mm-finance/contracts/abis/mm-finance-ifo-chef.json diff --git a/src/apps/mmfinance/contracts/abis/mmfinance-meerkat-chef.json b/src/apps/mm-finance/contracts/abis/mm-finance-meerkat-chef.json similarity index 100% rename from src/apps/mmfinance/contracts/abis/mmfinance-meerkat-chef.json rename to src/apps/mm-finance/contracts/abis/mm-finance-meerkat-chef.json diff --git a/src/apps/mmfinance/contracts/abis/mmfinance-pair.json b/src/apps/mm-finance/contracts/abis/mm-finance-pair.json similarity index 100% rename from src/apps/mmfinance/contracts/abis/mmfinance-pair.json rename to src/apps/mm-finance/contracts/abis/mm-finance-pair.json diff --git a/src/apps/mmfinance/contracts/abis/mmfinance-smart-chef.json b/src/apps/mm-finance/contracts/abis/mm-finance-smart-chef.json similarity index 100% rename from src/apps/mmfinance/contracts/abis/mmfinance-smart-chef.json rename to src/apps/mm-finance/contracts/abis/mm-finance-smart-chef.json diff --git a/src/apps/mmfinance/contracts/abis/mmfinance-syrup-meerkat.json b/src/apps/mm-finance/contracts/abis/mm-finance-syrup-meerkat.json similarity index 100% rename from src/apps/mmfinance/contracts/abis/mmfinance-syrup-meerkat.json rename to src/apps/mm-finance/contracts/abis/mm-finance-syrup-meerkat.json diff --git a/src/apps/mmfinance/contracts/ethers/MmfinanceChef.ts b/src/apps/mm-finance/contracts/ethers/MmFinanceChef.ts similarity index 99% rename from src/apps/mmfinance/contracts/ethers/MmfinanceChef.ts rename to src/apps/mm-finance/contracts/ethers/MmFinanceChef.ts index 66d1941ce..9254c7254 100644 --- a/src/apps/mmfinance/contracts/ethers/MmfinanceChef.ts +++ b/src/apps/mm-finance/contracts/ethers/MmFinanceChef.ts @@ -17,7 +17,7 @@ import type { FunctionFragment, Result, EventFragment } from '@ethersproject/abi import type { Listener, Provider } from '@ethersproject/providers'; import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent } from './common'; -export interface MmfinanceChefInterface extends utils.Interface { +export interface MmFinanceChefInterface extends utils.Interface { functions: { 'BONUS_MULTIPLIER()': FunctionFragment; 'add(uint256,address,bool)': FunctionFragment; @@ -191,12 +191,12 @@ export type WithdrawEvent = TypedEvent<[string, BigNumber, BigNumber], WithdrawE export type WithdrawEventFilter = TypedEventFilter; -export interface MmfinanceChef extends BaseContract { +export interface MmFinanceChef extends BaseContract { connect(signerOrProvider: Signer | Provider | string): this; attach(addressOrName: string): this; deployed(): Promise; - interface: MmfinanceChefInterface; + interface: MmFinanceChefInterface; queryFilter( event: TypedEventFilter, diff --git a/src/apps/mmfinance/contracts/ethers/MmfinanceChefV2.ts b/src/apps/mm-finance/contracts/ethers/MmFinanceChefV2.ts similarity index 99% rename from src/apps/mmfinance/contracts/ethers/MmfinanceChefV2.ts rename to src/apps/mm-finance/contracts/ethers/MmFinanceChefV2.ts index 83d609ead..53e1a81cc 100644 --- a/src/apps/mmfinance/contracts/ethers/MmfinanceChefV2.ts +++ b/src/apps/mm-finance/contracts/ethers/MmFinanceChefV2.ts @@ -35,7 +35,7 @@ export declare namespace MasterChefV2 { }; } -export interface MmfinanceChefV2Interface extends utils.Interface { +export interface MmFinanceChefV2Interface extends utils.Interface { functions: { 'ACC_MEERKAT_PRECISION()': FunctionFragment; 'BOOST_PRECISION()': FunctionFragment; @@ -364,12 +364,12 @@ export type WithdrawEvent = TypedEvent<[string, BigNumber, BigNumber], WithdrawE export type WithdrawEventFilter = TypedEventFilter; -export interface MmfinanceChefV2 extends BaseContract { +export interface MmFinanceChefV2 extends BaseContract { connect(signerOrProvider: Signer | Provider | string): this; attach(addressOrName: string): this; deployed(): Promise; - interface: MmfinanceChefV2Interface; + interface: MmFinanceChefV2Interface; queryFilter( event: TypedEventFilter, diff --git a/src/apps/mmfinance/contracts/ethers/MmfinanceIfoChef.ts b/src/apps/mm-finance/contracts/ethers/MmFinanceIfoChef.ts similarity index 99% rename from src/apps/mmfinance/contracts/ethers/MmfinanceIfoChef.ts rename to src/apps/mm-finance/contracts/ethers/MmFinanceIfoChef.ts index fa7fbab05..78f89ccf2 100644 --- a/src/apps/mmfinance/contracts/ethers/MmfinanceIfoChef.ts +++ b/src/apps/mm-finance/contracts/ethers/MmFinanceIfoChef.ts @@ -17,7 +17,7 @@ import type { FunctionFragment, Result, EventFragment } from '@ethersproject/abi import type { Listener, Provider } from '@ethersproject/providers'; import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent } from './common'; -export interface MmfinanceIfoChefInterface extends utils.Interface { +export interface MmFinanceIfoChefInterface extends utils.Interface { functions: { 'MAX_CALL_FEE()': FunctionFragment; 'MAX_PERFORMANCE_FEE()': FunctionFragment; @@ -338,12 +338,12 @@ export type ZeroFreeIFOEvent = TypedEvent<[string, BigNumber], ZeroFreeIFOEventO export type ZeroFreeIFOEventFilter = TypedEventFilter; -export interface MmfinanceIfoChef extends BaseContract { +export interface MmFinanceIfoChef extends BaseContract { connect(signerOrProvider: Signer | Provider | string): this; attach(addressOrName: string): this; deployed(): Promise; - interface: MmfinanceIfoChefInterface; + interface: MmFinanceIfoChefInterface; queryFilter( event: TypedEventFilter, diff --git a/src/apps/mmfinance/contracts/ethers/MmfinanceMeerkatChef.ts b/src/apps/mm-finance/contracts/ethers/MmFinanceMeerkatChef.ts similarity index 99% rename from src/apps/mmfinance/contracts/ethers/MmfinanceMeerkatChef.ts rename to src/apps/mm-finance/contracts/ethers/MmFinanceMeerkatChef.ts index 2504488ae..642316c07 100644 --- a/src/apps/mmfinance/contracts/ethers/MmfinanceMeerkatChef.ts +++ b/src/apps/mm-finance/contracts/ethers/MmFinanceMeerkatChef.ts @@ -17,7 +17,7 @@ import type { FunctionFragment, Result, EventFragment } from '@ethersproject/abi import type { Listener, Provider } from '@ethersproject/providers'; import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent } from './common'; -export interface MmfinanceMeerkatChefInterface extends utils.Interface { +export interface MmFinanceMeerkatChefInterface extends utils.Interface { functions: { 'MAX_CALL_FEE()': FunctionFragment; 'MAX_PERFORMANCE_FEE()': FunctionFragment; @@ -264,12 +264,12 @@ export type WithdrawEvent = TypedEvent<[string, BigNumber, BigNumber], WithdrawE export type WithdrawEventFilter = TypedEventFilter; -export interface MmfinanceMeerkatChef extends BaseContract { +export interface MmFinanceMeerkatChef extends BaseContract { connect(signerOrProvider: Signer | Provider | string): this; attach(addressOrName: string): this; deployed(): Promise; - interface: MmfinanceMeerkatChefInterface; + interface: MmFinanceMeerkatChefInterface; queryFilter( event: TypedEventFilter, diff --git a/src/apps/mmfinance/contracts/ethers/MmfinancePair.ts b/src/apps/mm-finance/contracts/ethers/MmFinancePair.ts similarity index 99% rename from src/apps/mmfinance/contracts/ethers/MmfinancePair.ts rename to src/apps/mm-finance/contracts/ethers/MmFinancePair.ts index 9161eac53..8a1f80f7f 100644 --- a/src/apps/mmfinance/contracts/ethers/MmfinancePair.ts +++ b/src/apps/mm-finance/contracts/ethers/MmFinancePair.ts @@ -17,7 +17,7 @@ import type { FunctionFragment, Result, EventFragment } from '@ethersproject/abi import type { Listener, Provider } from '@ethersproject/providers'; import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent } from './common'; -export interface MmfinancePairInterface extends utils.Interface { +export interface MmFinancePairInterface extends utils.Interface { functions: { 'DOMAIN_SEPARATOR()': FunctionFragment; 'MINIMUM_LIQUIDITY()': FunctionFragment; @@ -212,12 +212,12 @@ export type TransferEvent = TypedEvent<[string, string, BigNumber], TransferEven export type TransferEventFilter = TypedEventFilter; -export interface MmfinancePair extends BaseContract { +export interface MmFinancePair extends BaseContract { connect(signerOrProvider: Signer | Provider | string): this; attach(addressOrName: string): this; deployed(): Promise; - interface: MmfinancePairInterface; + interface: MmFinancePairInterface; queryFilter( event: TypedEventFilter, diff --git a/src/apps/mmfinance/contracts/ethers/MmfinanceSmartChef.ts b/src/apps/mm-finance/contracts/ethers/MmFinanceSmartChef.ts similarity index 99% rename from src/apps/mmfinance/contracts/ethers/MmfinanceSmartChef.ts rename to src/apps/mm-finance/contracts/ethers/MmFinanceSmartChef.ts index 4fe8f6260..ba74329fd 100644 --- a/src/apps/mmfinance/contracts/ethers/MmfinanceSmartChef.ts +++ b/src/apps/mm-finance/contracts/ethers/MmFinanceSmartChef.ts @@ -17,7 +17,7 @@ import type { FunctionFragment, Result, EventFragment } from '@ethersproject/abi import type { Listener, Provider } from '@ethersproject/providers'; import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent } from './common'; -export interface MmfinanceSmartChefInterface extends utils.Interface { +export interface MmFinanceSmartChefInterface extends utils.Interface { functions: { 'PRECISION_FACTOR()': FunctionFragment; 'SMART_CHEF_FACTORY()': FunctionFragment; @@ -230,12 +230,12 @@ export type WithdrawEvent = TypedEvent<[string, BigNumber], WithdrawEventObject> export type WithdrawEventFilter = TypedEventFilter; -export interface MmfinanceSmartChef extends BaseContract { +export interface MmFinanceSmartChef extends BaseContract { connect(signerOrProvider: Signer | Provider | string): this; attach(addressOrName: string): this; deployed(): Promise; - interface: MmfinanceSmartChefInterface; + interface: MmFinanceSmartChefInterface; queryFilter( event: TypedEventFilter, diff --git a/src/apps/mmfinance/contracts/ethers/MmfinanceSyrupMeerkat.ts b/src/apps/mm-finance/contracts/ethers/MmFinanceSyrupMeerkat.ts similarity index 99% rename from src/apps/mmfinance/contracts/ethers/MmfinanceSyrupMeerkat.ts rename to src/apps/mm-finance/contracts/ethers/MmFinanceSyrupMeerkat.ts index 51102a157..14a9021e8 100644 --- a/src/apps/mmfinance/contracts/ethers/MmfinanceSyrupMeerkat.ts +++ b/src/apps/mm-finance/contracts/ethers/MmFinanceSyrupMeerkat.ts @@ -17,7 +17,7 @@ import type { FunctionFragment, Result, EventFragment } from '@ethersproject/abi import type { Listener, Provider } from '@ethersproject/providers'; import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent } from './common'; -export interface MmfinanceSyrupMeerkatInterface extends utils.Interface { +export interface MmFinanceSyrupMeerkatInterface extends utils.Interface { functions: { 'BOOST_WEIGHT()': FunctionFragment; 'BOOST_WEIGHT_LIMIT()': FunctionFragment; @@ -597,12 +597,12 @@ export type WithdrawEvent = TypedEvent<[string, BigNumber, BigNumber], WithdrawE export type WithdrawEventFilter = TypedEventFilter; -export interface MmfinanceSyrupMeerkat extends BaseContract { +export interface MmFinanceSyrupMeerkat extends BaseContract { connect(signerOrProvider: Signer | Provider | string): this; attach(addressOrName: string): this; deployed(): Promise; - interface: MmfinanceSyrupMeerkatInterface; + interface: MmFinanceSyrupMeerkatInterface; queryFilter( event: TypedEventFilter, diff --git a/src/apps/mmfinance/contracts/ethers/common.ts b/src/apps/mm-finance/contracts/ethers/common.ts similarity index 100% rename from src/apps/mmfinance/contracts/ethers/common.ts rename to src/apps/mm-finance/contracts/ethers/common.ts diff --git a/src/apps/mmfinance/contracts/ethers/factories/MmfinanceChefV2__factory.ts b/src/apps/mm-finance/contracts/ethers/factories/MmFinanceChefV2__factory.ts similarity index 98% rename from src/apps/mmfinance/contracts/ethers/factories/MmfinanceChefV2__factory.ts rename to src/apps/mm-finance/contracts/ethers/factories/MmFinanceChefV2__factory.ts index ec1d0a41a..af0395b3e 100644 --- a/src/apps/mmfinance/contracts/ethers/factories/MmfinanceChefV2__factory.ts +++ b/src/apps/mm-finance/contracts/ethers/factories/MmFinanceChefV2__factory.ts @@ -4,7 +4,7 @@ import { Contract, Signer, utils } from 'ethers'; import type { Provider } from '@ethersproject/providers'; -import type { MmfinanceChefV2, MmfinanceChefV2Interface } from '../MmfinanceChefV2'; +import type { MmFinanceChefV2, MmFinanceChefV2Interface } from '../MmFinanceChefV2'; const _abi = [ { @@ -1049,12 +1049,12 @@ const _abi = [ }, ]; -export class MmfinanceChefV2__factory { +export class MmFinanceChefV2__factory { static readonly abi = _abi; - static createInterface(): MmfinanceChefV2Interface { - return new utils.Interface(_abi) as MmfinanceChefV2Interface; + static createInterface(): MmFinanceChefV2Interface { + return new utils.Interface(_abi) as MmFinanceChefV2Interface; } - static connect(address: string, signerOrProvider: Signer | Provider): MmfinanceChefV2 { - return new Contract(address, _abi, signerOrProvider) as MmfinanceChefV2; + static connect(address: string, signerOrProvider: Signer | Provider): MmFinanceChefV2 { + return new Contract(address, _abi, signerOrProvider) as MmFinanceChefV2; } } diff --git a/src/apps/mmfinance/contracts/ethers/factories/MmfinanceChef__factory.ts b/src/apps/mm-finance/contracts/ethers/factories/MmFinanceChef__factory.ts similarity index 97% rename from src/apps/mmfinance/contracts/ethers/factories/MmfinanceChef__factory.ts rename to src/apps/mm-finance/contracts/ethers/factories/MmFinanceChef__factory.ts index 434490134..09c1727b0 100644 --- a/src/apps/mmfinance/contracts/ethers/factories/MmfinanceChef__factory.ts +++ b/src/apps/mm-finance/contracts/ethers/factories/MmFinanceChef__factory.ts @@ -4,7 +4,7 @@ import { Contract, Signer, utils } from 'ethers'; import type { Provider } from '@ethersproject/providers'; -import type { MmfinanceChef, MmfinanceChefInterface } from '../MmfinanceChef'; +import type { MmFinanceChef, MmFinanceChefInterface } from '../MmFinanceChef'; const _abi = [ { @@ -588,12 +588,12 @@ const _abi = [ }, ]; -export class MmfinanceChef__factory { +export class MmFinanceChef__factory { static readonly abi = _abi; - static createInterface(): MmfinanceChefInterface { - return new utils.Interface(_abi) as MmfinanceChefInterface; + static createInterface(): MmFinanceChefInterface { + return new utils.Interface(_abi) as MmFinanceChefInterface; } - static connect(address: string, signerOrProvider: Signer | Provider): MmfinanceChef { - return new Contract(address, _abi, signerOrProvider) as MmfinanceChef; + static connect(address: string, signerOrProvider: Signer | Provider): MmFinanceChef { + return new Contract(address, _abi, signerOrProvider) as MmFinanceChef; } } diff --git a/src/apps/mmfinance/contracts/ethers/factories/MmfinanceIfoChef__factory.ts b/src/apps/mm-finance/contracts/ethers/factories/MmFinanceIfoChef__factory.ts similarity index 97% rename from src/apps/mmfinance/contracts/ethers/factories/MmfinanceIfoChef__factory.ts rename to src/apps/mm-finance/contracts/ethers/factories/MmFinanceIfoChef__factory.ts index 940f49a8f..7cc087967 100644 --- a/src/apps/mmfinance/contracts/ethers/factories/MmfinanceIfoChef__factory.ts +++ b/src/apps/mm-finance/contracts/ethers/factories/MmFinanceIfoChef__factory.ts @@ -4,7 +4,7 @@ import { Contract, Signer, utils } from 'ethers'; import type { Provider } from '@ethersproject/providers'; -import type { MmfinanceIfoChef, MmfinanceIfoChefInterface } from '../MmfinanceIfoChef'; +import type { MmFinanceIfoChef, MmFinanceIfoChefInterface } from '../MmFinanceIfoChef'; const _abi = [ { @@ -896,12 +896,12 @@ const _abi = [ }, ]; -export class MmfinanceIfoChef__factory { +export class MmFinanceIfoChef__factory { static readonly abi = _abi; - static createInterface(): MmfinanceIfoChefInterface { - return new utils.Interface(_abi) as MmfinanceIfoChefInterface; + static createInterface(): MmFinanceIfoChefInterface { + return new utils.Interface(_abi) as MmFinanceIfoChefInterface; } - static connect(address: string, signerOrProvider: Signer | Provider): MmfinanceIfoChef { - return new Contract(address, _abi, signerOrProvider) as MmfinanceIfoChef; + static connect(address: string, signerOrProvider: Signer | Provider): MmFinanceIfoChef { + return new Contract(address, _abi, signerOrProvider) as MmFinanceIfoChef; } } diff --git a/src/apps/mmfinance/contracts/ethers/factories/MmfinanceMeerkatChef__factory.ts b/src/apps/mm-finance/contracts/ethers/factories/MmFinanceMeerkatChef__factory.ts similarity index 97% rename from src/apps/mmfinance/contracts/ethers/factories/MmfinanceMeerkatChef__factory.ts rename to src/apps/mm-finance/contracts/ethers/factories/MmFinanceMeerkatChef__factory.ts index 7083a36a5..24a155ed7 100644 --- a/src/apps/mmfinance/contracts/ethers/factories/MmfinanceMeerkatChef__factory.ts +++ b/src/apps/mm-finance/contracts/ethers/factories/MmFinanceMeerkatChef__factory.ts @@ -4,7 +4,7 @@ import { Contract, Signer, utils } from 'ethers'; import type { Provider } from '@ethersproject/providers'; -import type { MmfinanceMeerkatChef, MmfinanceMeerkatChefInterface } from '../MmfinanceMeerkatChef'; +import type { MmFinanceMeerkatChef, MmFinanceMeerkatChefInterface } from '../MmFinanceMeerkatChef'; const _abi = [ { @@ -670,12 +670,12 @@ const _abi = [ }, ]; -export class MmfinanceMeerkatChef__factory { +export class MmFinanceMeerkatChef__factory { static readonly abi = _abi; - static createInterface(): MmfinanceMeerkatChefInterface { - return new utils.Interface(_abi) as MmfinanceMeerkatChefInterface; + static createInterface(): MmFinanceMeerkatChefInterface { + return new utils.Interface(_abi) as MmFinanceMeerkatChefInterface; } - static connect(address: string, signerOrProvider: Signer | Provider): MmfinanceMeerkatChef { - return new Contract(address, _abi, signerOrProvider) as MmfinanceMeerkatChef; + static connect(address: string, signerOrProvider: Signer | Provider): MmFinanceMeerkatChef { + return new Contract(address, _abi, signerOrProvider) as MmFinanceMeerkatChef; } } diff --git a/src/apps/mmfinance/contracts/ethers/factories/MmfinancePair__factory.ts b/src/apps/mm-finance/contracts/ethers/factories/MmFinancePair__factory.ts similarity index 97% rename from src/apps/mmfinance/contracts/ethers/factories/MmfinancePair__factory.ts rename to src/apps/mm-finance/contracts/ethers/factories/MmFinancePair__factory.ts index 33a4fe68c..bb3e65934 100644 --- a/src/apps/mmfinance/contracts/ethers/factories/MmfinancePair__factory.ts +++ b/src/apps/mm-finance/contracts/ethers/factories/MmFinancePair__factory.ts @@ -4,7 +4,7 @@ import { Contract, Signer, utils } from 'ethers'; import type { Provider } from '@ethersproject/providers'; -import type { MmfinancePair, MmfinancePairInterface } from '../MmfinancePair'; +import type { MmFinancePair, MmFinancePairInterface } from '../MmFinancePair'; const _abi = [ { @@ -720,12 +720,12 @@ const _abi = [ }, ]; -export class MmfinancePair__factory { +export class MmFinancePair__factory { static readonly abi = _abi; - static createInterface(): MmfinancePairInterface { - return new utils.Interface(_abi) as MmfinancePairInterface; + static createInterface(): MmFinancePairInterface { + return new utils.Interface(_abi) as MmFinancePairInterface; } - static connect(address: string, signerOrProvider: Signer | Provider): MmfinancePair { - return new Contract(address, _abi, signerOrProvider) as MmfinancePair; + static connect(address: string, signerOrProvider: Signer | Provider): MmFinancePair { + return new Contract(address, _abi, signerOrProvider) as MmFinancePair; } } diff --git a/src/apps/mmfinance/contracts/ethers/factories/MmfinanceSmartChef__factory.ts b/src/apps/mm-finance/contracts/ethers/factories/MmFinanceSmartChef__factory.ts similarity index 96% rename from src/apps/mmfinance/contracts/ethers/factories/MmfinanceSmartChef__factory.ts rename to src/apps/mm-finance/contracts/ethers/factories/MmFinanceSmartChef__factory.ts index 424b12593..be9c34a85 100644 --- a/src/apps/mmfinance/contracts/ethers/factories/MmfinanceSmartChef__factory.ts +++ b/src/apps/mm-finance/contracts/ethers/factories/MmFinanceSmartChef__factory.ts @@ -4,7 +4,7 @@ import { Contract, Signer, utils } from 'ethers'; import type { Provider } from '@ethersproject/providers'; -import type { MmfinanceSmartChef, MmfinanceSmartChefInterface } from '../MmfinanceSmartChef'; +import type { MmFinanceSmartChef, MmFinanceSmartChefInterface } from '../MmFinanceSmartChef'; const _abi = [ { @@ -562,12 +562,12 @@ const _abi = [ }, ]; -export class MmfinanceSmartChef__factory { +export class MmFinanceSmartChef__factory { static readonly abi = _abi; - static createInterface(): MmfinanceSmartChefInterface { - return new utils.Interface(_abi) as MmfinanceSmartChefInterface; + static createInterface(): MmFinanceSmartChefInterface { + return new utils.Interface(_abi) as MmFinanceSmartChefInterface; } - static connect(address: string, signerOrProvider: Signer | Provider): MmfinanceSmartChef { - return new Contract(address, _abi, signerOrProvider) as MmfinanceSmartChef; + static connect(address: string, signerOrProvider: Signer | Provider): MmFinanceSmartChef { + return new Contract(address, _abi, signerOrProvider) as MmFinanceSmartChef; } } diff --git a/src/apps/mmfinance/contracts/ethers/factories/MmfinanceSyrupMeerkat__factory.ts b/src/apps/mm-finance/contracts/ethers/factories/MmFinanceSyrupMeerkat__factory.ts similarity index 98% rename from src/apps/mmfinance/contracts/ethers/factories/MmfinanceSyrupMeerkat__factory.ts rename to src/apps/mm-finance/contracts/ethers/factories/MmFinanceSyrupMeerkat__factory.ts index 77a0dd275..21be1211e 100644 --- a/src/apps/mmfinance/contracts/ethers/factories/MmfinanceSyrupMeerkat__factory.ts +++ b/src/apps/mm-finance/contracts/ethers/factories/MmFinanceSyrupMeerkat__factory.ts @@ -4,7 +4,7 @@ import { Contract, Signer, utils } from 'ethers'; import type { Provider } from '@ethersproject/providers'; -import type { MmfinanceSyrupMeerkat, MmfinanceSyrupMeerkatInterface } from '../MmfinanceSyrupMeerkat'; +import type { MmFinanceSyrupMeerkat, MmFinanceSyrupMeerkatInterface } from '../MmFinanceSyrupMeerkat'; const _abi = [ { @@ -1549,12 +1549,12 @@ const _abi = [ }, ]; -export class MmfinanceSyrupMeerkat__factory { +export class MmFinanceSyrupMeerkat__factory { static readonly abi = _abi; - static createInterface(): MmfinanceSyrupMeerkatInterface { - return new utils.Interface(_abi) as MmfinanceSyrupMeerkatInterface; + static createInterface(): MmFinanceSyrupMeerkatInterface { + return new utils.Interface(_abi) as MmFinanceSyrupMeerkatInterface; } - static connect(address: string, signerOrProvider: Signer | Provider): MmfinanceSyrupMeerkat { - return new Contract(address, _abi, signerOrProvider) as MmfinanceSyrupMeerkat; + static connect(address: string, signerOrProvider: Signer | Provider): MmFinanceSyrupMeerkat { + return new Contract(address, _abi, signerOrProvider) as MmFinanceSyrupMeerkat; } } diff --git a/src/apps/mm-finance/contracts/ethers/factories/index.ts b/src/apps/mm-finance/contracts/ethers/factories/index.ts new file mode 100644 index 000000000..08130cafb --- /dev/null +++ b/src/apps/mm-finance/contracts/ethers/factories/index.ts @@ -0,0 +1,10 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +export { MmFinanceChef__factory } from './MmFinanceChef__factory'; +export { MmFinanceChefV2__factory } from './MmFinanceChefV2__factory'; +export { MmFinanceIfoChef__factory } from './MmFinanceIfoChef__factory'; +export { MmFinanceMeerkatChef__factory } from './MmFinanceMeerkatChef__factory'; +export { MmFinancePair__factory } from './MmFinancePair__factory'; +export { MmFinanceSmartChef__factory } from './MmFinanceSmartChef__factory'; +export { MmFinanceSyrupMeerkat__factory } from './MmFinanceSyrupMeerkat__factory'; diff --git a/src/apps/mm-finance/contracts/ethers/index.ts b/src/apps/mm-finance/contracts/ethers/index.ts new file mode 100644 index 000000000..88535a295 --- /dev/null +++ b/src/apps/mm-finance/contracts/ethers/index.ts @@ -0,0 +1,18 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +export type { MmFinanceChef } from './MmFinanceChef'; +export type { MmFinanceChefV2 } from './MmFinanceChefV2'; +export type { MmFinanceIfoChef } from './MmFinanceIfoChef'; +export type { MmFinanceMeerkatChef } from './MmFinanceMeerkatChef'; +export type { MmFinancePair } from './MmFinancePair'; +export type { MmFinanceSmartChef } from './MmFinanceSmartChef'; +export type { MmFinanceSyrupMeerkat } from './MmFinanceSyrupMeerkat'; +export * as factories from './factories'; +export { MmFinanceChefV2__factory } from './factories/MmFinanceChefV2__factory'; +export { MmFinanceChef__factory } from './factories/MmFinanceChef__factory'; +export { MmFinanceIfoChef__factory } from './factories/MmFinanceIfoChef__factory'; +export { MmFinanceMeerkatChef__factory } from './factories/MmFinanceMeerkatChef__factory'; +export { MmFinancePair__factory } from './factories/MmFinancePair__factory'; +export { MmFinanceSmartChef__factory } from './factories/MmFinanceSmartChef__factory'; +export { MmFinanceSyrupMeerkat__factory } from './factories/MmFinanceSyrupMeerkat__factory'; diff --git a/src/apps/mm-finance/contracts/index.ts b/src/apps/mm-finance/contracts/index.ts new file mode 100644 index 000000000..21c38bc0e --- /dev/null +++ b/src/apps/mm-finance/contracts/index.ts @@ -0,0 +1,53 @@ +import { Injectable, Inject } from '@nestjs/common'; + +import { IAppToolkit, APP_TOOLKIT } from '~app-toolkit/app-toolkit.interface'; +import { ContractFactory } from '~contract/contracts'; +import { Network } from '~types/network.interface'; + +import { MmFinanceChef__factory } from './ethers'; +import { MmFinanceChefV2__factory } from './ethers'; +import { MmFinanceIfoChef__factory } from './ethers'; +import { MmFinanceMeerkatChef__factory } from './ethers'; +import { MmFinancePair__factory } from './ethers'; +import { MmFinanceSmartChef__factory } from './ethers'; +import { MmFinanceSyrupMeerkat__factory } from './ethers'; + +// eslint-disable-next-line +type ContractOpts = { address: string; network: Network }; + +@Injectable() +export class MmFinanceContractFactory extends ContractFactory { + constructor(@Inject(APP_TOOLKIT) protected readonly appToolkit: IAppToolkit) { + super((network: Network) => appToolkit.getNetworkProvider(network)); + } + + mmFinanceChef({ address, network }: ContractOpts) { + return MmFinanceChef__factory.connect(address, this.appToolkit.getNetworkProvider(network)); + } + mmFinanceChefV2({ address, network }: ContractOpts) { + return MmFinanceChefV2__factory.connect(address, this.appToolkit.getNetworkProvider(network)); + } + mmFinanceIfoChef({ address, network }: ContractOpts) { + return MmFinanceIfoChef__factory.connect(address, this.appToolkit.getNetworkProvider(network)); + } + mmFinanceMeerkatChef({ address, network }: ContractOpts) { + return MmFinanceMeerkatChef__factory.connect(address, this.appToolkit.getNetworkProvider(network)); + } + mmFinancePair({ address, network }: ContractOpts) { + return MmFinancePair__factory.connect(address, this.appToolkit.getNetworkProvider(network)); + } + mmFinanceSmartChef({ address, network }: ContractOpts) { + return MmFinanceSmartChef__factory.connect(address, this.appToolkit.getNetworkProvider(network)); + } + mmFinanceSyrupMeerkat({ address, network }: ContractOpts) { + return MmFinanceSyrupMeerkat__factory.connect(address, this.appToolkit.getNetworkProvider(network)); + } +} + +export type { MmFinanceChef } from './ethers'; +export type { MmFinanceChefV2 } from './ethers'; +export type { MmFinanceIfoChef } from './ethers'; +export type { MmFinanceMeerkatChef } from './ethers'; +export type { MmFinancePair } from './ethers'; +export type { MmFinanceSmartChef } from './ethers'; +export type { MmFinanceSyrupMeerkat } from './ethers'; diff --git a/src/apps/mmfinance/cronos/mmfinance.auto-mmf.contract-position-fetcher.ts b/src/apps/mm-finance/cronos/mm-finance.auto-mmf.contract-position-fetcher.ts similarity index 73% rename from src/apps/mmfinance/cronos/mmfinance.auto-mmf.contract-position-fetcher.ts rename to src/apps/mm-finance/cronos/mm-finance.auto-mmf.contract-position-fetcher.ts index ded799e6d..b9b0942da 100644 --- a/src/apps/mmfinance/cronos/mmfinance.auto-mmf.contract-position-fetcher.ts +++ b/src/apps/mm-finance/cronos/mm-finance.auto-mmf.contract-position-fetcher.ts @@ -8,33 +8,34 @@ import { PositionFetcher } from '~position/position-fetcher.interface'; import { ContractPosition } from '~position/position.interface'; import { Network } from '~types/network.interface'; -import { MmfinanceContractFactory, MmfinanceMeerkatChef } from '../contracts'; -import { MMFINANCE_DEFINITION } from '../mmfinance.definition'; +import { MmFinanceContractFactory, MmFinanceMeerkatChef } from '../contracts'; +import { MM_FINANCE_DEFINITION } from '../mm-finance.definition'; -const appId = MMFINANCE_DEFINITION.id; -const groupId = MMFINANCE_DEFINITION.groups.autoMmf.id; +const appId = MM_FINANCE_DEFINITION.id; +const groupId = MM_FINANCE_DEFINITION.groups.autoMmf.id; const network = Network.CRONOS_MAINNET; @Register.ContractPositionFetcher({ appId, groupId, network }) -export class CronosChainMmfinanceAutoMMFContractPositionFetcher implements PositionFetcher { +export class CronosMmFinanceAutoMmfContractPositionFetcher implements PositionFetcher { constructor( @Inject(APP_TOOLKIT) private readonly appToolkit: IAppToolkit, - @Inject(MmfinanceContractFactory) - private readonly contractFactory: MmfinanceContractFactory, + @Inject(MmFinanceContractFactory) + private readonly contractFactory: MmFinanceContractFactory, ) {} getPositions() { - const chefContract = this.contractFactory.mmfinanceChef({ + const chefContract = this.contractFactory.mmFinanceChef({ network, - address: '0x6bE34986Fdd1A91e4634eb6b9F8017439b7b5EDc', + address: '0x6be34986fdd1a91e4634eb6b9f8017439b7b5edc', }); - return this.appToolkit.helpers.masterChefContractPositionHelper.getContractPositions({ + + return this.appToolkit.helpers.masterChefContractPositionHelper.getContractPositions({ network, groupId, appId, minimumTvl: 10000, address: '0xa80240eb5d7e05d3f250cf000eec0891d00b51cc', - resolveContract: opts => this.contractFactory.mmfinanceMeerkatChef(opts), + resolveContract: opts => this.contractFactory.mmFinanceMeerkatChef(opts), resolvePoolLength: async () => BigNumber.from(1), resolveDepositTokenAddress: ({ multicall, contract }) => multicall.wrap(contract).token(), resolveLiquidity: ({ multicall, contract }) => multicall.wrap(contract).balanceOf(), diff --git a/src/apps/mmfinance/cronos/mmfinance.balance-fetcher.ts b/src/apps/mm-finance/cronos/mm-finance.balance-fetcher.ts similarity index 84% rename from src/apps/mmfinance/cronos/mmfinance.balance-fetcher.ts rename to src/apps/mm-finance/cronos/mm-finance.balance-fetcher.ts index da83aa75b..0964a96fb 100644 --- a/src/apps/mmfinance/cronos/mmfinance.balance-fetcher.ts +++ b/src/apps/mm-finance/cronos/mm-finance.balance-fetcher.ts @@ -8,24 +8,24 @@ import { BalanceFetcher } from '~balance/balance-fetcher.interface'; import { Network } from '~types/network.interface'; import { - MmfinanceMeerkatChef, - MmfinanceChef, - MmfinanceChefV2, - MmfinanceContractFactory, - MmfinanceIfoChef, - MmfinanceSmartChef, - MmfinanceSyrupMeerkat, + MmFinanceMeerkatChef, + MmFinanceChef, + MmFinanceChefV2, + MmFinanceContractFactory, + MmFinanceIfoChef, + MmFinanceSmartChef, + MmFinanceSyrupMeerkat, } from '../contracts'; -import { MMFINANCE_DEFINITION } from '../mmfinance.definition'; +import { MM_FINANCE_DEFINITION } from '../mm-finance.definition'; -const appId = MMFINANCE_DEFINITION.id; +const appId = MM_FINANCE_DEFINITION.id; const network = Network.CRONOS_MAINNET; @Register.BalanceFetcher(appId, network) -export class CronosChainMmfinanceBalanceFetcher implements BalanceFetcher { +export class CronosMmFinanceBalanceFetcher implements BalanceFetcher { constructor( @Inject(APP_TOOLKIT) private readonly appToolkit: IAppToolkit, - @Inject(MmfinanceContractFactory) private readonly contractFactory: MmfinanceContractFactory, + @Inject(MmFinanceContractFactory) private readonly contractFactory: MmFinanceContractFactory, ) {} private async getPoolBalances(address: string) { @@ -33,19 +33,19 @@ export class CronosChainMmfinanceBalanceFetcher implements BalanceFetcher { address, appId, network, - groupId: MMFINANCE_DEFINITION.groups.pool.id, + groupId: MM_FINANCE_DEFINITION.groups.pool.id, }); } private async getLegacyFarmBalances(address: string) { // LP and Manual Mmf Farms - return this.appToolkit.helpers.masterChefContractPositionBalanceHelper.getBalances({ + return this.appToolkit.helpers.masterChefContractPositionBalanceHelper.getBalances({ address, appId, network, - groupId: MMFINANCE_DEFINITION.groups.farm.id, + groupId: MM_FINANCE_DEFINITION.groups.farm.id, resolveChefContract: ({ contractAddress }) => - this.contractFactory.mmfinanceChef({ network, address: contractAddress }), + this.contractFactory.mmFinanceChef({ network, address: contractAddress }), resolveStakedTokenBalance: this.appToolkit.helpers.masterChefDefaultStakedBalanceStrategy.build({ resolveStakedBalance: ({ multicall, contract, contractPosition }) => multicall @@ -62,13 +62,13 @@ export class CronosChainMmfinanceBalanceFetcher implements BalanceFetcher { private async getFarmBalances(address: string) { // LP and Manual Mmf Farms - return this.appToolkit.helpers.masterChefContractPositionBalanceHelper.getBalances({ + return this.appToolkit.helpers.masterChefContractPositionBalanceHelper.getBalances({ address, appId, network, - groupId: MMFINANCE_DEFINITION.groups.farmV2.id, + groupId: MM_FINANCE_DEFINITION.groups.farmV2.id, resolveChefContract: ({ contractAddress }) => - this.contractFactory.mmfinanceChefV2({ network, address: contractAddress }), + this.contractFactory.mmFinanceChefV2({ network, address: contractAddress }), resolveStakedTokenBalance: this.appToolkit.helpers.masterChefDefaultStakedBalanceStrategy.build({ resolveStakedBalance: ({ multicall, contract, contractPosition }) => multicall @@ -85,13 +85,13 @@ export class CronosChainMmfinanceBalanceFetcher implements BalanceFetcher { private async getIfoMmfBalances(address: string) { // IFO Mmf Farm - return this.appToolkit.helpers.masterChefContractPositionBalanceHelper.getBalances({ + return this.appToolkit.helpers.masterChefContractPositionBalanceHelper.getBalances({ address, appId, network, - groupId: MMFINANCE_DEFINITION.groups.ifoMmf.id, + groupId: MM_FINANCE_DEFINITION.groups.ifoMmf.id, resolveChefContract: ({ contractAddress }) => - this.contractFactory.mmfinanceIfoChef({ network, address: contractAddress }), + this.contractFactory.mmFinanceIfoChef({ network, address: contractAddress }), resolveStakedTokenBalance: this.appToolkit.helpers.masterChefDefaultStakedBalanceStrategy.build({ resolveStakedBalance: async ({ multicall, contract }) => { const [userInfo, pricePerShareRaw] = await Promise.all([ @@ -112,13 +112,13 @@ export class CronosChainMmfinanceBalanceFetcher implements BalanceFetcher { private async getAutoMmfBalances(address: string) { // Autocompounding Mmf Farm - return this.appToolkit.helpers.masterChefContractPositionBalanceHelper.getBalances({ + return this.appToolkit.helpers.masterChefContractPositionBalanceHelper.getBalances({ address, appId, network, - groupId: MMFINANCE_DEFINITION.groups.autoMmf.id, + groupId: MM_FINANCE_DEFINITION.groups.autoMmf.id, resolveChefContract: ({ contractAddress }) => - this.contractFactory.mmfinanceMeerkatChef({ network, address: contractAddress }), + this.contractFactory.mmFinanceMeerkatChef({ network, address: contractAddress }), resolveStakedTokenBalance: this.appToolkit.helpers.masterChefDefaultStakedBalanceStrategy.build({ resolveStakedBalance: async ({ multicall, contract, address }) => { const [userInfo, pricePerShareRaw] = await Promise.all([ @@ -139,13 +139,13 @@ export class CronosChainMmfinanceBalanceFetcher implements BalanceFetcher { private async getSyrupMeerkatBalances(address: string) { // Autocompounding Mmf Farm - return this.appToolkit.helpers.masterChefContractPositionBalanceHelper.getBalances({ + return this.appToolkit.helpers.masterChefContractPositionBalanceHelper.getBalances({ address, appId, network, - groupId: MMFINANCE_DEFINITION.groups.syrupMmf.id, + groupId: MM_FINANCE_DEFINITION.groups.syrupMmf.id, resolveChefContract: ({ contractAddress }) => - this.contractFactory.mmfinanceSyrupMeerkat({ network, address: contractAddress }), + this.contractFactory.mmFinanceSyrupMeerkat({ network, address: contractAddress }), resolveStakedTokenBalance: this.appToolkit.helpers.masterChefDefaultStakedBalanceStrategy.build({ resolveStakedBalance: async ({ multicall, contract, address }) => { const [userInfo, pricePerShareRaw] = await Promise.all([ @@ -167,13 +167,13 @@ export class CronosChainMmfinanceBalanceFetcher implements BalanceFetcher { private async getSyrupPoolBalances(address: string) { // Syrup Pools (single-staking) - return this.appToolkit.helpers.masterChefContractPositionBalanceHelper.getBalances({ + return this.appToolkit.helpers.masterChefContractPositionBalanceHelper.getBalances({ address, appId, network, - groupId: MMFINANCE_DEFINITION.groups.syrupStaking.id, + groupId: MM_FINANCE_DEFINITION.groups.syrupStaking.id, resolveChefContract: ({ contractAddress }) => - this.contractFactory.mmfinanceSmartChef({ network, address: contractAddress }), + this.contractFactory.mmFinanceSmartChef({ network, address: contractAddress }), resolveStakedTokenBalance: this.appToolkit.helpers.masterChefDefaultStakedBalanceStrategy.build({ resolveStakedBalance: ({ multicall, contract, address }) => multicall diff --git a/src/apps/mmfinance/cronos/mmfinance.farm-v2.cotract-position-fetcher.ts b/src/apps/mm-finance/cronos/mm-finance.farm-v2.cotract-position-fetcher.ts similarity index 77% rename from src/apps/mmfinance/cronos/mmfinance.farm-v2.cotract-position-fetcher.ts rename to src/apps/mm-finance/cronos/mm-finance.farm-v2.cotract-position-fetcher.ts index e8f15abf2..f3a5fa20a 100644 --- a/src/apps/mmfinance/cronos/mmfinance.farm-v2.cotract-position-fetcher.ts +++ b/src/apps/mm-finance/cronos/mm-finance.farm-v2.cotract-position-fetcher.ts @@ -7,29 +7,29 @@ import { PositionFetcher } from '~position/position-fetcher.interface'; import { ContractPosition } from '~position/position.interface'; import { Network } from '~types/network.interface'; -import { MmfinanceChefV2, MmfinanceContractFactory } from '../contracts'; -import { MMFINANCE_DEFINITION } from '../mmfinance.definition'; +import { MmFinanceChefV2, MmFinanceContractFactory } from '../contracts'; +import { MM_FINANCE_DEFINITION } from '../mm-finance.definition'; -const appId = MMFINANCE_DEFINITION.id; -const groupId = MMFINANCE_DEFINITION.groups.farmV2.id; +const appId = MM_FINANCE_DEFINITION.id; +const groupId = MM_FINANCE_DEFINITION.groups.farmV2.id; const network = Network.CRONOS_MAINNET; @Register.ContractPositionFetcher({ appId, groupId, network }) -export class CronosChainMmfinanceFarmV2ContractPositionFetcher implements PositionFetcher { +export class CronosMmFinanceFarmV2ContractPositionFetcher implements PositionFetcher { constructor( @Inject(APP_TOOLKIT) private readonly appToolkit: IAppToolkit, - @Inject(MmfinanceContractFactory) private readonly contractFactory: MmfinanceContractFactory, + @Inject(MmFinanceContractFactory) private readonly contractFactory: MmFinanceContractFactory, ) {} getPositions() { - return this.appToolkit.helpers.masterChefContractPositionHelper.getContractPositions({ + return this.appToolkit.helpers.masterChefContractPositionHelper.getContractPositions({ network, groupId, appId, minimumTvl: 10000, address: '0xa5f8c5dbd5f286960b9d90548680ae5ebff07652', - dependencies: [{ appId, groupIds: [MMFINANCE_DEFINITION.groups.pool.id], network }], - resolveContract: opts => this.contractFactory.mmfinanceChefV2(opts), + dependencies: [{ appId, groupIds: [MM_FINANCE_DEFINITION.groups.pool.id], network }], + resolveContract: opts => this.contractFactory.mmFinanceChefV2(opts), resolvePoolLength: async ({ multicall, contract }) => multicall.wrap(contract).poolLength(), resolveDepositTokenAddress: ({ multicall, contract, poolIndex }) => multicall.wrap(contract).lpToken(poolIndex), resolveRewardTokenAddresses: ({ multicall, contract }) => multicall.wrap(contract).MEERKAT(), diff --git a/src/apps/mmfinance/cronos/mmfinance.farm.contract-position-fetcher.ts b/src/apps/mm-finance/cronos/mm-finance.farm.contract-position-fetcher.ts similarity index 76% rename from src/apps/mmfinance/cronos/mmfinance.farm.contract-position-fetcher.ts rename to src/apps/mm-finance/cronos/mm-finance.farm.contract-position-fetcher.ts index e07672938..b92133c16 100644 --- a/src/apps/mmfinance/cronos/mmfinance.farm.contract-position-fetcher.ts +++ b/src/apps/mm-finance/cronos/mm-finance.farm.contract-position-fetcher.ts @@ -7,29 +7,29 @@ import { PositionFetcher } from '~position/position-fetcher.interface'; import { ContractPosition } from '~position/position.interface'; import { Network } from '~types/network.interface'; -import { MmfinanceChef, MmfinanceContractFactory } from '../contracts'; -import { MMFINANCE_DEFINITION } from '../mmfinance.definition'; +import { MmFinanceChef, MmFinanceContractFactory } from '../contracts'; +import { MM_FINANCE_DEFINITION } from '../mm-finance.definition'; -const appId = MMFINANCE_DEFINITION.id; -const groupId = MMFINANCE_DEFINITION.groups.farm.id; +const appId = MM_FINANCE_DEFINITION.id; +const groupId = MM_FINANCE_DEFINITION.groups.farm.id; const network = Network.CRONOS_MAINNET; @Register.ContractPositionFetcher({ appId, groupId, network }) -export class CronosChainMmfinanceFarmContractPositionFetcher implements PositionFetcher { +export class CronosMmFinanceFarmContractPositionFetcher implements PositionFetcher { constructor( @Inject(APP_TOOLKIT) private readonly appToolkit: IAppToolkit, - @Inject(MmfinanceContractFactory) private readonly contractFactory: MmfinanceContractFactory, + @Inject(MmFinanceContractFactory) private readonly contractFactory: MmFinanceContractFactory, ) {} getPositions() { - return this.appToolkit.helpers.masterChefContractPositionHelper.getContractPositions({ + return this.appToolkit.helpers.masterChefContractPositionHelper.getContractPositions({ network, groupId, appId, minimumTvl: 10000, - address: '0x6bE34986Fdd1A91e4634eb6b9F8017439b7b5EDc', - dependencies: [{ appId, groupIds: [MMFINANCE_DEFINITION.groups.pool.id], network }], - resolveContract: opts => this.contractFactory.mmfinanceChef(opts), + address: '0x6be34986fdd1a91e4634eb6b9f8017439b7b5edc', + dependencies: [{ appId, groupIds: [MM_FINANCE_DEFINITION.groups.pool.id], network }], + resolveContract: opts => this.contractFactory.mmFinanceChef(opts), resolvePoolLength: async ({ multicall, contract }) => multicall.wrap(contract).poolLength(), resolveDepositTokenAddress: ({ multicall, contract, poolIndex }) => multicall @@ -41,7 +41,7 @@ export class CronosChainMmfinanceFarmContractPositionFetcher implements Position const balanceRaw = await multicall.wrap(tokenContract).balanceOf(address); if (poolIndex !== 0) return balanceRaw; - const autoMeerkatChefContract = this.contractFactory.mmfinanceMeerkatChef({ + const autoMeerkatChefContract = this.contractFactory.mmFinanceMeerkatChef({ network, address: '0xa80240eb5d7e05d3f250cf000eec0891d00b51cc', }); diff --git a/src/apps/mmfinance/cronos/mmfinance.ifo-mmf.contract-position-fetcher.ts b/src/apps/mm-finance/cronos/mm-finance.ifo-mmf.contract-position-fetcher.ts similarity index 72% rename from src/apps/mmfinance/cronos/mmfinance.ifo-mmf.contract-position-fetcher.ts rename to src/apps/mm-finance/cronos/mm-finance.ifo-mmf.contract-position-fetcher.ts index 5a3d92c4e..73dda3126 100644 --- a/src/apps/mmfinance/cronos/mmfinance.ifo-mmf.contract-position-fetcher.ts +++ b/src/apps/mm-finance/cronos/mm-finance.ifo-mmf.contract-position-fetcher.ts @@ -8,37 +8,38 @@ import { PositionFetcher } from '~position/position-fetcher.interface'; import { ContractPosition } from '~position/position.interface'; import { Network } from '~types/network.interface'; -import { MmfinanceContractFactory, MmfinanceIfoChef } from '../contracts'; -import { MMFINANCE_DEFINITION } from '../mmfinance.definition'; +import { MmFinanceContractFactory, MmFinanceIfoChef } from '../contracts'; +import { MM_FINANCE_DEFINITION } from '../mm-finance.definition'; -const appId = MMFINANCE_DEFINITION.id; -const groupId = MMFINANCE_DEFINITION.groups.ifoMmf.id; +const appId = MM_FINANCE_DEFINITION.id; +const groupId = MM_FINANCE_DEFINITION.groups.ifoMmf.id; const network = Network.CRONOS_MAINNET; @Register.ContractPositionFetcher({ appId, groupId, network }) -export class CronosChainMmfinanceIfoCakeContractPositionFetcher implements PositionFetcher { +export class CronosMmFinanceIfoCakeContractPositionFetcher implements PositionFetcher { constructor( @Inject(APP_TOOLKIT) private readonly appToolkit: IAppToolkit, - @Inject(MmfinanceContractFactory) private readonly contractFactory: MmfinanceContractFactory, + @Inject(MmFinanceContractFactory) private readonly contractFactory: MmFinanceContractFactory, ) {} getPositions() { - const mmfChefContract = this.contractFactory.mmfinanceMeerkatChef({ + const mmfChefContract = this.contractFactory.mmFinanceMeerkatChef({ network, address: '0xa80240eb5d7e05d3f250cf000eec0891d00b51cc', }); - const chefContract = this.contractFactory.mmfinanceChef({ + const chefContract = this.contractFactory.mmFinanceChef({ network, - address: '0x6bE34986Fdd1A91e4634eb6b9F8017439b7b5EDc', + address: '0x6be34986fdd1a91e4634eb6b9f8017439b7b5edc', }); - return this.appToolkit.helpers.masterChefContractPositionHelper.getContractPositions({ + + return this.appToolkit.helpers.masterChefContractPositionHelper.getContractPositions({ network, groupId, appId, minimumTvl: 10000, address: '0x1b2a2f6ed4a1401e8c73b4c2b6172455ce2f78e8', - resolveContract: opts => this.contractFactory.mmfinanceIfoChef(opts), + resolveContract: opts => this.contractFactory.mmFinanceIfoChef(opts), resolvePoolLength: async () => BigNumber.from(1), resolveDepositTokenAddress: ({ multicall, contract }) => multicall.wrap(contract).token(), resolveLiquidity: ({ multicall }) => multicall.wrap(mmfChefContract).balanceOf(), diff --git a/src/apps/mm-finance/cronos/mm-finance.pool.cache-manager.ts b/src/apps/mm-finance/cronos/mm-finance.pool.cache-manager.ts new file mode 100644 index 000000000..b3b97a6a0 --- /dev/null +++ b/src/apps/mm-finance/cronos/mm-finance.pool.cache-manager.ts @@ -0,0 +1,62 @@ +import { Inject, Injectable } from '@nestjs/common'; +import { compact, range, uniq } from 'lodash'; + +import { APP_TOOLKIT, IAppToolkit } from '~app-toolkit/app-toolkit.interface'; +import { CacheOnInterval } from '~cache/cache-on-interval.decorator'; +import { Network } from '~types/network.interface'; + +import { MmFinanceContractFactory } from '../contracts'; +import { MM_FINANCE_DEFINITION } from '../mm-finance.definition'; + +@Injectable() +export class CronosMmFinancePoolAddressCacheManager { + constructor( + @Inject(APP_TOOLKIT) private readonly appToolkit: IAppToolkit, + @Inject(MmFinanceContractFactory) protected readonly contractFactory: MmFinanceContractFactory, + ) {} + + @CacheOnInterval({ + key: `apps-v3:${MM_FINANCE_DEFINITION.id}:chef-pool-addresses`, + timeout: 15 * 60 * 1000, + }) + private async getChefPoolAddresses() { + const network = Network.CRONOS_MAINNET; + const chefAddress = '0x6bE34986Fdd1A91e4634eb6b9F8017439b7b5EDc'; + const chefContract = this.contractFactory.mmFinanceChef({ address: chefAddress, network }); + + const provider = this.appToolkit.getNetworkProvider(network); + const multicall = this.appToolkit.getMulticall(network); + const numPools = await multicall.wrap(chefContract).poolLength(); + + const allAddresses = await Promise.all( + range(0, Number(numPools)).map(async v => { + const poolInfo = await multicall.wrap(chefContract).poolInfo(v); + const lpTokenAddress = poolInfo.lpToken.toLowerCase(); + const lpTokenContract = this.contractFactory.mmFinancePair({ address: lpTokenAddress, network }); + + // Some EOAs exist on the MasterChef contract; calling these breaks multicall + const code = await provider.getCode(lpTokenAddress); + if (code === '0x') return false; + + const [symbol] = await Promise.all([ + multicall + .wrap(lpTokenContract) + .symbol() + .catch(_err => ''), + ]); + + const isMeerkatLP = symbol === 'MEERKAT-LP'; + if (!isMeerkatLP) return null; + + return lpTokenAddress; + }), + ); + + return compact(allAddresses); + } + + async getPoolAddresses(): Promise { + const [chefPoolAddresses] = await Promise.all([this.getChefPoolAddresses()]); + return uniq([...chefPoolAddresses]); + } +} diff --git a/src/apps/mmfinance/cronos/mmfinance.pool.token-fetcher.ts b/src/apps/mm-finance/cronos/mm-finance.pool.token-fetcher.ts similarity index 56% rename from src/apps/mmfinance/cronos/mmfinance.pool.token-fetcher.ts rename to src/apps/mm-finance/cronos/mm-finance.pool.token-fetcher.ts index dc97c07c1..f438a5a31 100644 --- a/src/apps/mmfinance/cronos/mmfinance.pool.token-fetcher.ts +++ b/src/apps/mm-finance/cronos/mm-finance.pool.token-fetcher.ts @@ -1,40 +1,40 @@ import { Inject } from '@nestjs/common'; import { Register } from '~app-toolkit/decorators'; -import { UniswapPair, UniswapV2PoolTokenHelper } from '~apps/uniswap-v2'; +import { UniswapV2PoolTokenHelper } from '~apps/uniswap-v2'; import { PositionFetcher } from '~position/position-fetcher.interface'; import { AppTokenPosition } from '~position/position.interface'; import { Network } from '~types/network.interface'; -import { MmfinanceContractFactory, MmfinanceChef } from '../contracts'; -import { MMFINANCE_DEFINITION } from '../mmfinance.definition'; +import { MmFinanceChef, MmFinanceContractFactory, MmFinancePair } from '../contracts'; +import { MM_FINANCE_DEFINITION } from '../mm-finance.definition'; -import { CronosChainMmfinancePoolAddressCacheManager } from './mmfinance.pool.cache-manager'; +import { CronosMmFinancePoolAddressCacheManager } from './mm-finance.pool.cache-manager'; -const appId = MMFINANCE_DEFINITION.id; -const groupId = MMFINANCE_DEFINITION.groups.pool.id; +const appId = MM_FINANCE_DEFINITION.id; +const groupId = MM_FINANCE_DEFINITION.groups.pool.id; const network = Network.CRONOS_MAINNET; -@Register.TokenPositionFetcher({ appId, groupId, network, options: { includeInTvl: true } }) -export class CronosChainMmfinancePoolTokenFetcher implements PositionFetcher { +@Register.TokenPositionFetcher({ appId, groupId, network }) +export class CronosMmFinancePoolTokenFetcher implements PositionFetcher { constructor( @Inject(UniswapV2PoolTokenHelper) private readonly poolTokenHelper: UniswapV2PoolTokenHelper, - @Inject(CronosChainMmfinancePoolAddressCacheManager) - private readonly MmfinancePoolAddressCacheManager: CronosChainMmfinancePoolAddressCacheManager, - @Inject(MmfinanceContractFactory) private readonly contractFactory: MmfinanceContractFactory, // @Inject(UniswapV2ContractFactory) private readonly uniswapV2ContractFactory: UniswapV2ContractFactory, + @Inject(CronosMmFinancePoolAddressCacheManager) + private readonly MmfinancePoolAddressCacheManager: CronosMmFinancePoolAddressCacheManager, + @Inject(MmFinanceContractFactory) private readonly contractFactory: MmFinanceContractFactory, // @Inject(UniswapV2ContractFactory) private readonly uniswapV2ContractFactory: UniswapV2ContractFactory, ) {} getPositions() { - return this.poolTokenHelper.getTokens({ + return this.poolTokenHelper.getTokens({ network, appId, groupId, minLiquidity: 10000, fee: 0.003, - factoryAddress: '0xd590cC180601AEcD6eeADD9B7f2B7611519544f4', - resolveFactoryContract: opts => this.contractFactory.mmfinanceChef(opts), - resolvePoolContract: opts => this.contractFactory.mmfinancePair(opts), + factoryAddress: '0xd590cc180601aecd6eeadd9b7f2b7611519544f4', + resolveFactoryContract: opts => this.contractFactory.mmFinanceChef(opts), + resolvePoolContract: opts => this.contractFactory.mmFinancePair(opts), resolvePoolTokenAddresses: () => this.MmfinancePoolAddressCacheManager.getPoolAddresses(), resolvePoolTokenSymbol: ({ multicall, poolContract }) => { // console.log(poolContract.address) diff --git a/src/apps/mmfinance/cronos/mmfinance.syrup-cake.contract-position-fetcher.ts b/src/apps/mm-finance/cronos/mm-finance.syrup-cake.contract-position-fetcher.ts similarity index 75% rename from src/apps/mmfinance/cronos/mmfinance.syrup-cake.contract-position-fetcher.ts rename to src/apps/mm-finance/cronos/mm-finance.syrup-cake.contract-position-fetcher.ts index 02e93e185..f9d989f95 100644 --- a/src/apps/mmfinance/cronos/mmfinance.syrup-cake.contract-position-fetcher.ts +++ b/src/apps/mm-finance/cronos/mm-finance.syrup-cake.contract-position-fetcher.ts @@ -10,29 +10,29 @@ import { PositionFetcher } from '~position/position-fetcher.interface'; import { ContractPosition } from '~position/position.interface'; import { Network } from '~types/network.interface'; -import { MmfinanceContractFactory, MmfinanceSyrupMeerkat } from '../contracts'; -import { MMFINANCE_DEFINITION } from '../mmfinance.definition'; +import { MmFinanceContractFactory, MmFinanceSyrupMeerkat } from '../contracts'; +import { MM_FINANCE_DEFINITION } from '../mm-finance.definition'; -const appId = MMFINANCE_DEFINITION.id; -const groupId = MMFINANCE_DEFINITION.groups.syrupMmf.id; +const appId = MM_FINANCE_DEFINITION.id; +const groupId = MM_FINANCE_DEFINITION.groups.syrupMmf.id; const network = Network.CRONOS_MAINNET; -@Register.ContractPositionFetcher({ appId, groupId, network, options: { includeInTvl: true } }) -export class CronosChainMmfinanceSyrupMeerkatContractPositionFetcher implements PositionFetcher { +@Register.ContractPositionFetcher({ appId, groupId, network }) +export class CronosMmFinanceSyrupMeerkatContractPositionFetcher implements PositionFetcher { constructor( @Inject(APP_TOOLKIT) private readonly appToolkit: IAppToolkit, - @Inject(MmfinanceContractFactory) - private readonly contractFactory: MmfinanceContractFactory, + @Inject(MmFinanceContractFactory) + private readonly contractFactory: MmFinanceContractFactory, ) {} getPositions() { - return this.appToolkit.helpers.masterChefContractPositionHelper.getContractPositions({ + return this.appToolkit.helpers.masterChefContractPositionHelper.getContractPositions({ network, groupId, appId, address: '0x45c54210128a065de780c4b0df3d16664f7f859e', rewardRateUnit: RewardRateUnit.BLOCK, - resolveContract: opts => this.contractFactory.mmfinanceSyrupMeerkat(opts), + resolveContract: opts => this.contractFactory.mmFinanceSyrupMeerkat(opts), resolvePoolLength: async () => BigNumber.from(1), resolveDepositTokenAddress: ({ multicall, contract }) => multicall.wrap(contract).token(), resolveRewardTokenAddresses: ({ multicall, contract }) => multicall.wrap(contract).token(), @@ -40,7 +40,7 @@ export class CronosChainMmfinanceSyrupMeerkatContractPositionFetcher implements resolveRewardRate: async ({ multicall, network }) => { // The auto-compounding MEERKAT rewards are harvested from the main MasterChef V2 contract on PID 0 const masterChefV2Address = '0xa5f8c5dbd5f286960b9d90548680ae5ebff07652'; - const masterChefV2Contract = this.contractFactory.mmfinanceChefV2({ address: masterChefV2Address, network }); + const masterChefV2Contract = this.contractFactory.mmFinanceChefV2({ address: masterChefV2Address, network }); const poolInfo = await multicall.wrap(masterChefV2Contract).poolInfo(0); const meerkatPerBlock = await multicall.wrap(masterChefV2Contract).meerkatPerBlock(poolInfo.isRegular); const poolAllocPoints = poolInfo.allocPoint; diff --git a/src/apps/mmfinance/cronos/mmfinance.syrup-staking.contract-position-fetcher.ts b/src/apps/mm-finance/cronos/mm-finance.syrup-staking.contract-position-fetcher.ts similarity index 95% rename from src/apps/mmfinance/cronos/mmfinance.syrup-staking.contract-position-fetcher.ts rename to src/apps/mm-finance/cronos/mm-finance.syrup-staking.contract-position-fetcher.ts index 196b729eb..b96d1a27a 100644 --- a/src/apps/mmfinance/cronos/mmfinance.syrup-staking.contract-position-fetcher.ts +++ b/src/apps/mm-finance/cronos/mm-finance.syrup-staking.contract-position-fetcher.ts @@ -8,8 +8,8 @@ import { PositionFetcher } from '~position/position-fetcher.interface'; import { ContractPosition } from '~position/position.interface'; import { Network } from '~types/network.interface'; -import { MmfinanceContractFactory } from '../contracts'; -import { MMFINANCE_DEFINITION } from '../mmfinance.definition'; +import { MmFinanceContractFactory } from '../contracts'; +import { MM_FINANCE_DEFINITION } from '../mm-finance.definition'; // @TODO: Should be indexed from BQ events or logs //github.com/mmfinance/-frontend/blob/develop/src/config/constants/pools.tsx @@ -290,15 +290,15 @@ const FARMS = [ '0xa79d37ce9df9443ef4b6dec2e38a8ecd35303adc', ]; -const appId = MMFINANCE_DEFINITION.id; -const groupId = MMFINANCE_DEFINITION.groups.syrupStaking.id; +const appId = MM_FINANCE_DEFINITION.id; +const groupId = MM_FINANCE_DEFINITION.groups.syrupStaking.id; const network = Network.CRONOS_MAINNET; -@Register.ContractPositionFetcher({ appId, groupId, network, options: { includeInTvl: true } }) -export class CronosChainMmfinanceSyrupStakingContractPositionFetcher implements PositionFetcher { +@Register.ContractPositionFetcher({ appId, groupId, network }) +export class CronosChainMmFinanceSyrupStakingContractPositionFetcher implements PositionFetcher { constructor( @Inject(APP_TOOLKIT) private readonly appToolkit: IAppToolkit, - @Inject(MmfinanceContractFactory) private readonly contractFactory: MmfinanceContractFactory, + @Inject(MmFinanceContractFactory) private readonly contractFactory: MmFinanceContractFactory, ) {} async getPositions() { @@ -313,7 +313,7 @@ export class CronosChainMmfinanceSyrupStakingContractPositionFetcher implements resolvePoolIndexIsValid: async ({ poolIndex, multicall }) => { // Filter out any legacy SmartChef addresses that weren't deployed by the SmartChef contract const smartChefAddress = FARMS[poolIndex]; - const contract = this.contractFactory.mmfinanceSmartChef({ network, address: smartChefAddress }); + const contract = this.contractFactory.mmFinanceSmartChef({ network, address: smartChefAddress }); const wrapped = multicall.wrap(contract); const factoryAddress = await wrapped.SMART_CHEF_FACTORY().catch(() => null); return !!factoryAddress; @@ -322,17 +322,17 @@ export class CronosChainMmfinanceSyrupStakingContractPositionFetcher implements resolvePoolLength: async () => BigNumber.from(FARMS.length), resolveRewardTokenAddresses: ({ multicall, poolIndex }) => { const smartChefAddress = FARMS[poolIndex]; - const contract = this.contractFactory.mmfinanceSmartChef({ network, address: smartChefAddress }); + const contract = this.contractFactory.mmFinanceSmartChef({ network, address: smartChefAddress }); return multicall.wrap(contract).rewardToken(); }, resolveDepositTokenAddress: ({ multicall, poolIndex }) => { const smartChefAddress = FARMS[poolIndex]; - const contract = this.contractFactory.mmfinanceSmartChef({ network, address: smartChefAddress }); + const contract = this.contractFactory.mmFinanceSmartChef({ network, address: smartChefAddress }); return multicall.wrap(contract).stakedToken(); }, resolveEndBlock: async ({ multicall, poolIndex }) => { const smartChefAddress = FARMS[poolIndex]; - const contract = this.contractFactory.mmfinanceSmartChef({ network, address: smartChefAddress }); + const contract = this.contractFactory.mmFinanceSmartChef({ network, address: smartChefAddress }); return multicall .wrap(contract) .bonusEndBlock() @@ -344,7 +344,7 @@ export class CronosChainMmfinanceSyrupStakingContractPositionFetcher implements resolveTotalAllocPoints: async () => '1', resolveTotalRewardRate: ({ multicall, poolIndex }) => { const smartChefAddress = FARMS[poolIndex]; - const contract = this.contractFactory.mmfinanceSmartChef({ network, address: smartChefAddress }); + const contract = this.contractFactory.mmFinanceSmartChef({ network, address: smartChefAddress }); return multicall.wrap(contract).rewardPerBlock(); }, }), diff --git a/src/apps/mm-finance/index.ts b/src/apps/mm-finance/index.ts new file mode 100644 index 000000000..f69a99c8a --- /dev/null +++ b/src/apps/mm-finance/index.ts @@ -0,0 +1 @@ +export { MM_FINANCE_DEFINITION as MMFINANCE_DEFINITION, MmFinanceAppDefinition } from './mm-finance.definition'; diff --git a/src/apps/mmfinance/mmfinance.definition.ts b/src/apps/mm-finance/mm-finance.definition.ts similarity index 88% rename from src/apps/mmfinance/mmfinance.definition.ts rename to src/apps/mm-finance/mm-finance.definition.ts index 3f57453af..de2f608a0 100644 --- a/src/apps/mmfinance/mmfinance.definition.ts +++ b/src/apps/mm-finance/mm-finance.definition.ts @@ -3,8 +3,8 @@ import { appDefinition, AppDefinition } from '~app/app.definition'; import { GroupType, AppAction, AppTag } from '~app/app.interface'; import { Network } from '~types/network.interface'; -export const MMFINANCE_DEFINITION = appDefinition({ - id: 'mmfinance', +export const MM_FINANCE_DEFINITION = appDefinition({ + id: 'mm-finance', name: 'MMFinance', description: `MM.Finance - The largest ecosystem on Cronos with its DEX, Yield Optimizer, NFT, Algo Stablecoin & DTF`, url: 'https://mm.finance/', @@ -32,9 +32,9 @@ export const MMFINANCE_DEFINITION = appDefinition({ }, }); -@Register.AppDefinition(MMFINANCE_DEFINITION.id) -export class MmfinanceAppDefinition extends AppDefinition { +@Register.AppDefinition(MM_FINANCE_DEFINITION.id) +export class MmFinanceAppDefinition extends AppDefinition { constructor() { - super(MMFINANCE_DEFINITION); + super(MM_FINANCE_DEFINITION); } } diff --git a/src/apps/mm-finance/mm-finance.module.ts b/src/apps/mm-finance/mm-finance.module.ts new file mode 100644 index 000000000..6d40d37a8 --- /dev/null +++ b/src/apps/mm-finance/mm-finance.module.ts @@ -0,0 +1,21 @@ +import { Register } from '~app-toolkit/decorators'; +import { AbstractApp } from '~app/app.dynamic-module'; +import { UniswapV2AppModule } from '~apps/uniswap-v2'; + +import { MmFinanceContractFactory } from './contracts'; +import { CronosMmFinancePoolAddressCacheManager } from './cronos/mm-finance.pool.cache-manager'; +import { CronosMmFinancePoolTokenFetcher } from './cronos/mm-finance.pool.token-fetcher'; +import { MmFinanceAppDefinition, MM_FINANCE_DEFINITION } from './mm-finance.definition'; + +@Register.AppModule({ + appId: MM_FINANCE_DEFINITION.id, + imports: [UniswapV2AppModule], + providers: [ + MmFinanceAppDefinition, + MmFinanceContractFactory, + CronosMmFinancePoolTokenFetcher, + CronosMmFinancePoolAddressCacheManager, + ], + exports: [MmFinanceContractFactory], +}) +export class MmFinanceAppModule extends AbstractApp() {} diff --git a/src/apps/mmfinance/contracts/ethers/factories/index.ts b/src/apps/mmfinance/contracts/ethers/factories/index.ts deleted file mode 100644 index bfd4b132e..000000000 --- a/src/apps/mmfinance/contracts/ethers/factories/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -export { MmfinanceChef__factory } from './MmfinanceChef__factory'; -export { MmfinanceChefV2__factory } from './MmfinanceChefV2__factory'; -export { MmfinanceIfoChef__factory } from './MmfinanceIfoChef__factory'; -export { MmfinanceMeerkatChef__factory } from './MmfinanceMeerkatChef__factory'; -export { MmfinancePair__factory } from './MmfinancePair__factory'; -export { MmfinanceSmartChef__factory } from './MmfinanceSmartChef__factory'; -export { MmfinanceSyrupMeerkat__factory } from './MmfinanceSyrupMeerkat__factory'; diff --git a/src/apps/mmfinance/contracts/ethers/index.ts b/src/apps/mmfinance/contracts/ethers/index.ts deleted file mode 100644 index f6240bcf6..000000000 --- a/src/apps/mmfinance/contracts/ethers/index.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -export type { MmfinanceChef } from './MmfinanceChef'; -export type { MmfinanceChefV2 } from './MmfinanceChefV2'; -export type { MmfinanceIfoChef } from './MmfinanceIfoChef'; -export type { MmfinanceMeerkatChef } from './MmfinanceMeerkatChef'; -export type { MmfinancePair } from './MmfinancePair'; -export type { MmfinanceSmartChef } from './MmfinanceSmartChef'; -export type { MmfinanceSyrupMeerkat } from './MmfinanceSyrupMeerkat'; -export * as factories from './factories'; -export { MmfinanceChefV2__factory } from './factories/MmfinanceChefV2__factory'; -export { MmfinanceChef__factory } from './factories/MmfinanceChef__factory'; -export { MmfinanceIfoChef__factory } from './factories/MmfinanceIfoChef__factory'; -export { MmfinanceMeerkatChef__factory } from './factories/MmfinanceMeerkatChef__factory'; -export { MmfinancePair__factory } from './factories/MmfinancePair__factory'; -export { MmfinanceSmartChef__factory } from './factories/MmfinanceSmartChef__factory'; -export { MmfinanceSyrupMeerkat__factory } from './factories/MmfinanceSyrupMeerkat__factory'; diff --git a/src/apps/mmfinance/contracts/index.ts b/src/apps/mmfinance/contracts/index.ts deleted file mode 100644 index 566923fe7..000000000 --- a/src/apps/mmfinance/contracts/index.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { Injectable, Inject } from '@nestjs/common'; - -import { IAppToolkit, APP_TOOLKIT } from '~app-toolkit/app-toolkit.interface'; -import { ContractFactory } from '~contract/contracts'; -import { Network } from '~types/network.interface'; - -import { MmfinanceChef__factory } from './ethers'; -import { MmfinanceChefV2__factory } from './ethers'; -import { MmfinanceIfoChef__factory } from './ethers'; -import { MmfinanceMeerkatChef__factory } from './ethers'; -import { MmfinancePair__factory } from './ethers'; -import { MmfinanceSmartChef__factory } from './ethers'; -import { MmfinanceSyrupMeerkat__factory } from './ethers'; - -// eslint-disable-next-line -type ContractOpts = { address: string; network: Network }; - -@Injectable() -export class MmfinanceContractFactory extends ContractFactory { - constructor(@Inject(APP_TOOLKIT) protected readonly appToolkit: IAppToolkit) { - super((network: Network) => appToolkit.getNetworkProvider(network)); - } - - mmfinanceChef({ address, network }: ContractOpts) { - return MmfinanceChef__factory.connect(address, this.appToolkit.getNetworkProvider(network)); - } - mmfinanceChefV2({ address, network }: ContractOpts) { - return MmfinanceChefV2__factory.connect(address, this.appToolkit.getNetworkProvider(network)); - } - mmfinanceIfoChef({ address, network }: ContractOpts) { - return MmfinanceIfoChef__factory.connect(address, this.appToolkit.getNetworkProvider(network)); - } - mmfinanceMeerkatChef({ address, network }: ContractOpts) { - return MmfinanceMeerkatChef__factory.connect(address, this.appToolkit.getNetworkProvider(network)); - } - mmfinancePair({ address, network }: ContractOpts) { - return MmfinancePair__factory.connect(address, this.appToolkit.getNetworkProvider(network)); - } - mmfinanceSmartChef({ address, network }: ContractOpts) { - return MmfinanceSmartChef__factory.connect(address, this.appToolkit.getNetworkProvider(network)); - } - mmfinanceSyrupMeerkat({ address, network }: ContractOpts) { - return MmfinanceSyrupMeerkat__factory.connect(address, this.appToolkit.getNetworkProvider(network)); - } -} - -export type { MmfinanceChef } from './ethers'; -export type { MmfinanceChefV2 } from './ethers'; -export type { MmfinanceIfoChef } from './ethers'; -export type { MmfinanceMeerkatChef } from './ethers'; -export type { MmfinancePair } from './ethers'; -export type { MmfinanceSmartChef } from './ethers'; -export type { MmfinanceSyrupMeerkat } from './ethers'; diff --git a/src/apps/mmfinance/cronos/mmfinance.pool.cache-manager.ts b/src/apps/mmfinance/cronos/mmfinance.pool.cache-manager.ts deleted file mode 100644 index a2ddfa903..000000000 --- a/src/apps/mmfinance/cronos/mmfinance.pool.cache-manager.ts +++ /dev/null @@ -1,136 +0,0 @@ -import { Inject, Injectable } from '@nestjs/common'; -import { compact, range, uniq } from 'lodash'; - -import { APP_TOOLKIT, IAppToolkit } from '~app-toolkit/app-toolkit.interface'; -import { CacheOnInterval } from '~cache/cache-on-interval.decorator'; -import { Network } from '~types/network.interface'; - -import { MmfinanceContractFactory } from '../contracts'; -import { MMFINANCE_DEFINITION } from '../mmfinance.definition'; - -@Injectable() -export class CronosChainMmfinancePoolAddressCacheManager { - constructor( - @Inject(APP_TOOLKIT) private readonly appToolkit: IAppToolkit, - @Inject(MmfinanceContractFactory) protected readonly contractFactory: MmfinanceContractFactory, - ) {} - - // @CacheOnInterval({ - // key: `apps-v3:${MMFINANCE_DEFINITION.id}:graph-top-pool-addresses`, - // timeout: 15 * 60 * 1000, - // }) - // private async getTopPoolAddresses() { - // // @TODO Pull top 1000 pairs from https://bsc.streamingfast.io/subgraphs/name/mmfinance/exchange-v2 - // // Use sortBy trackedReserveBNB - // return []; - // } - - @CacheOnInterval({ - key: `apps-v3:${MMFINANCE_DEFINITION.id}:chef-pool-addresses`, - timeout: 15 * 60 * 1000, - }) - private async getChefPoolAddresses() { - const network = Network.CRONOS_MAINNET; - const chefAddress = '0x6bE34986Fdd1A91e4634eb6b9F8017439b7b5EDc'; - const chefContract = this.contractFactory.mmfinanceChef({ address: chefAddress, network }); - - const provider = this.appToolkit.getNetworkProvider(network); - const multicall = this.appToolkit.getMulticall(network); - const numPools = await multicall.wrap(chefContract).poolLength(); - - const allAddresses = await Promise.all( - range(0, Number(numPools)).map(async v => { - const poolInfo = await multicall.wrap(chefContract).poolInfo(v); - const lpTokenAddress = poolInfo.lpToken.toLowerCase(); - const lpTokenContract = this.contractFactory.mmfinancePair({ address: lpTokenAddress, network }); - - // Some EOAs exist on the MasterChef contract; calling these breaks multicall - const code = await provider.getCode(lpTokenAddress); - if (code === '0x') return false; - - const [symbol] = await Promise.all([ - multicall - .wrap(lpTokenContract) - .symbol() - .catch(_err => ''), - ]); - // console.log(symbol, factoryAddressRaw); - - // We've deprecated V1 support since the liquidities are low now (also our zap does not support V1) - // const V2_FACTORY_ADDRESS = '0xd590cC180601AEcD6eeADD9B7f2B7611519544f4'; - // const isV2Pair = factoryAddressRaw.toLowerCase() === V2_FACTORY_ADDRESS; - const isMeerkatLP = symbol === 'MEERKAT-LP'; - if (!isMeerkatLP) return null; - // console.log(lpTokenAddress); - return lpTokenAddress; - }), - ); - - // console.log(allAddresses); - return compact(allAddresses); - } - - // @CacheOnInterval({ - // key: `apps-v3:${MMFINANCE_DEFINITION.id}:chef-v2-pool-addresses`, - // timeout: 15 * 60 * 1000, - // }) - // private async getChefV2PoolAddresses() { - // const network = Network.CRONOS_MAINNET; - // const chefAddress = '0x6bE34986Fdd1A91e4634eb6b9F8017439b7b5EDc'; - // const chefContract = this.contractFactory.mmfinanceChefV2({ address: chefAddress, network }); - - // const provider = this.appToolkit.getNetworkProvider(network); - // const multicall = this.appToolkit.getMulticall(network); - // const numPools = await multicall.wrap(chefContract).poolLength(); - - // const allAddresses = await Promise.all( - // range(0, Number(numPools)).map(async v => { - // const lpTokenAddressRaw = await multicall.wrap(chefContract).lpToken(v); - // const lpTokenAddress = lpTokenAddressRaw.toLowerCase(); - // const lpTokenContract = this.contractFactory.mmfinancePair({ address: lpTokenAddress, network }); - - // // Some EOAs exist on the MasterChef contract; calling these breaks multicall - // const code = await provider.getCode(lpTokenAddress); - // if (code === '0x') return false; - - // const [symbol, factoryAddressRaw] = await Promise.all([ - // multicall - // .wrap(lpTokenContract) - // .symbol() - // .catch(_err => ''), - // multicall - // .wrap(lpTokenContract) - // .factory() - // .catch(_err => ''), - // ]); - - // // We've deprecated V1 support since the liquidities are low now (also our zap does not support V1) - // const V2_FACTORY_ADDRESS = '0xd590cC180601AEcD6eeADD9B7f2B7611519544f4'; - // const isV2Pair = factoryAddressRaw.toLowerCase() === V2_FACTORY_ADDRESS; - // const mme = symbol === 'Meerkat-LP'; - // if (!isV2Pair || !mme) return null; - - // return lpTokenAddress; - // }), - // ); - - // return compact(allAddresses); - // } - - // @CacheOnInterval({ - // key: `apps-v3:${MMFINANCE_DEFINITION.id}:static-pool-addresses`, - // timeout: 15 * 60 * 1000, - // }) - // private async getStaticPoolAddresses() { - // return ['']; - // } - async getPoolAddresses(): Promise { - const [chefPoolAddresses] = await Promise.all([ - this.getChefPoolAddresses(), - // this.getChefV2PoolAddresses(), - ]); - - const a = uniq([...chefPoolAddresses]); - return a; - } -} diff --git a/src/apps/mmfinance/index.ts b/src/apps/mmfinance/index.ts deleted file mode 100644 index 825a5bcea..000000000 --- a/src/apps/mmfinance/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { MMFINANCE_DEFINITION, MmfinanceAppDefinition } from './mmfinance.definition'; diff --git a/src/apps/mmfinance/mmfinance.module.ts b/src/apps/mmfinance/mmfinance.module.ts deleted file mode 100644 index 447685c5e..000000000 --- a/src/apps/mmfinance/mmfinance.module.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { Register } from '~app-toolkit/decorators'; -import { AbstractApp } from '~app/app.dynamic-module'; -import { UniswapV2AppModule } from '~apps/uniswap-v2'; - -// import { CronosChainMmfinanceAutoMeerkatContractPositionFetcher } from './cronos/mmfinance.auto-Meerkat.contract-position-fetcher'; -// import { CronosChainMmfinanceBalanceFetcher } from './cronos/mmfinance.balance-fetcher'; -// import { CronosChainMmfinanceFarmV2ContractPositionFetcher } from './cronos/mmfinance.farm-v2.cotract-position-fetcher'; -import { MmfinanceContractFactory } from './contracts'; -// import { CronosChainMmfinanceIfoMeerkatContractPositionFetcher } from './cronos/mmfinance.ifo-Meerkat.contract-position-fetcher'; -import { CronosChainMmfinancePoolAddressCacheManager } from './cronos/mmfinance.pool.cache-manager'; -import { CronosChainMmfinancePoolTokenFetcher } from './cronos/mmfinance.pool.token-fetcher'; -// import { CronosChainMmfinanceSyrupMeerkatContractPositionFetcher } from './cronos/mmfinance.syrup-Meerkat.contract-position-fetcher'; -// import { CronosChainMmfinanceSyrupStakingContractPositionFetcher } from './cronos/mmfinance.syrup-staking.contract-position-fetcher'; -import { MmfinanceAppDefinition, MMFINANCE_DEFINITION } from './mmfinance.definition'; - -@Register.AppModule({ - appId: MMFINANCE_DEFINITION.id, - imports: [UniswapV2AppModule], - providers: [ - MmfinanceAppDefinition, - MmfinanceContractFactory, - // CronosChainMmfinanceBalanceFetcher, - // CronosChainMmfinanceAutoMeerkatContractPositionFetcher, - // CronosChainMmfinanceIfoMeerkatContractPositionFetcher, - // CronosChainMmfinanceFarmContractPositionFetcher, - // CronosChainMmfinanceFarmV2ContractPositionFetcher, - // CronosChainMmfinanceSyrupMeerkatContractPositionFetcher, - // CronosChainMmfinanceSyrupStakingContractPositionFetcher, - CronosChainMmfinancePoolTokenFetcher, - CronosChainMmfinancePoolAddressCacheManager, - ], - exports: [MmfinanceContractFactory], -}) -export class MmfinanceAppModule extends AbstractApp() {}