Skip to content

Strategies #328

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
eAvalancheNetwork,
eEthereumNetwork,
eNetwork,
eOpBNB,
ePolygonNetwork,
eXDaiNetwork,
} from './helpers/types';
Expand Down Expand Up @@ -118,6 +119,7 @@ const buidlerConfig: HardhatUserConfig = {
avalanche: getCommonNetworkConfig(eAvalancheNetwork.avalanche, 43114),
fuji: getCommonNetworkConfig(eAvalancheNetwork.fuji, 43113),
goerli: getCommonNetworkConfig(eEthereumNetwork.goerli, 5),
op_bnb: getCommonNetworkConfig(eOpBNB.op_bnb, 204),
hardhat: {
hardfork: 'berlin',
blockGasLimit: DEFAULT_BLOCK_GAS_LIMIT,
Expand Down
1 change: 1 addition & 0 deletions helper-hardhat-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export const NETWORKS_RPC_URL: iParamsPerNetwork<string> = {
[eAvalancheNetwork.avalanche]: 'https://api.avax.network/ext/bc/C/rpc',
[eAvalancheNetwork.fuji]: 'https://api.avax-test.network/ext/bc/C/rpc',
[eEthereumNetwork.goerli]: `https://eth-goerli.g.alchemy.com/v2/${ALCHEMY_KEY}`,

};

export const NETWORKS_DEFAULT_GAS: iParamsPerNetwork<number> = {
Expand Down
31 changes: 30 additions & 1 deletion helpers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ export interface SymbolMap<T> {
[symbol: string]: T;
}

export type eNetwork = eEthereumNetwork | ePolygonNetwork | eXDaiNetwork | eAvalancheNetwork;
export type eNetwork =
| eOpBNBNetwork
| eEthereumNetwork
| ePolygonNetwork
| eXDaiNetwork
| eAvalancheNetwork;

export enum eEthereumNetwork {
buidlerevm = 'buidlerevm',
Expand All @@ -18,6 +23,10 @@ export enum eEthereumNetwork {
goerli = 'goerli',
}

export enum eOpBNBNetwork {
op_bnb = 'op_bnb',
}

export enum ePolygonNetwork {
matic = 'matic',
mumbai = 'mumbai',
Expand Down Expand Up @@ -216,6 +225,9 @@ export interface iAssetCommon<T> {
[key: string]: T;
}
export interface iAssetBase<T> {
BKS: T;
WBNB: T;
ZO_ZO: T;
WETH: T;
DAI: T;
TUSD: T;
Expand Down Expand Up @@ -290,6 +302,9 @@ export type iAavePoolAssets<T> = Pick<

export type iLpPoolAssets<T> = Pick<
iAssetsWithoutUSD<T>,
| 'ZO_ZO'
| 'BKS'
| 'WBNB'
| 'DAI'
| 'USDC'
| 'USDT'
Expand Down Expand Up @@ -328,13 +343,18 @@ export type iAvalanchePoolAssets<T> = Pick<
'WETH' | 'DAI' | 'USDT' | 'AAVE' | 'WBTC' | 'WAVAX' | 'USDC'
>;

export type iOpBNBPoolAssets<T> = Pick<iAssetsWithoutUSD<T>, 'WBNB' | 'BKS' | 'ZO_ZO'>;

export type iMultiPoolsAssets<T> = iAssetCommon<T> | iAavePoolAssets<T>;

export type iAavePoolTokens<T> = Omit<iAavePoolAssets<T>, 'ETH'>;

export type iAssetAggregatorBase<T> = iAssetsWithoutETH<T>;

export enum TokenContractId {
WBNB = 'WBNB',
ZO_ZO = 'ZO_ZO',
BKS = 'BKS',
DAI = 'DAI',
AAVE = 'AAVE',
TUSD = 'TUSD',
Expand Down Expand Up @@ -419,6 +439,7 @@ export type iParamsPerNetwork<T> =
| iEthereumParamsPerNetwork<T>
| iPolygonParamsPerNetwork<T>
| iXDaiParamsPerNetwork<T>
| iOpBNBParamsPerNetwork<T>
| iAvalancheParamsPerNetwork<T>;

export interface iParamsPerNetworkAll<T>
Expand Down Expand Up @@ -451,6 +472,10 @@ export interface iAvalancheParamsPerNetwork<T> {
[eAvalancheNetwork.fuji]: T;
}

export interface iOpBNBParamsPerNetwork<T> {
[eOpBNB.op_bnb]: T;
}

export interface iParamsPerPool<T> {
[AavePools.proto]: T;
[AavePools.matic]: T;
Expand Down Expand Up @@ -555,6 +580,10 @@ export interface IAvalancheConfiguration extends ICommonConfiguration {
ReservesConfig: iAvalanchePoolAssets<IReserveParams>;
}

export interface IOpBNBConfiguration extends ICommonConfiguration {
ReservesConfig: iOpBNBPoolAssets<IReserveParams>;
}

export interface ITokenAddress {
[token: string]: tEthereumAddress;
}
Expand Down
1 change: 0 additions & 1 deletion markets/aave/commons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ export const CommonsConfig: ICommonConfiguration = {
PoolAdmin: {
[eEthereumNetwork.coverage]: undefined,
[eEthereumNetwork.buidlerevm]: undefined,
[eEthereumNetwork.coverage]: undefined,
[eEthereumNetwork.hardhat]: undefined,
[eEthereumNetwork.kovan]: undefined,
[eEthereumNetwork.ropsten]: undefined,
Expand Down
158 changes: 158 additions & 0 deletions markets/op_bnb/commons.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
import {
oneRay,
ZERO_ADDRESS,
MOCK_CHAINLINK_AGGREGATORS_PRICES,
oneEther,
} from '../../helpers/constants';
import { ICommonConfiguration, eOpBNBNetwork ,eEthereumNetwork} from '../../helpers/types';

// ----------------
// PROTOCOL GLOBAL PARAMS
// ----------------

export const CommonsConfig: ICommonConfiguration = {
MarketId: 'Commons',
ATokenNamePrefix: 'Aave interest bearing',
StableDebtTokenNamePrefix: 'Aave stable debt bearing',
VariableDebtTokenNamePrefix: 'Aave variable debt bearing',
SymbolPrefix: 'b',
ProviderId: 0, // Overriden in index.ts
OracleQuoteCurrency: 'BNB',
OracleQuoteUnit: oneEther.toString(),
ProtocolGlobalParams: {
TokenDistributorPercentageBase: '10000',
MockUsdPriceInWei: '5848466240000000',
UsdAddress: '0x10F7Fc1F91Ba351f9C629c5947AD69bD03C05b96',
NilAddress: '0x0000000000000000000000000000000000000000',
OneAddress: '0x0000000000000000000000000000000000000001',
AaveReferral: '0',
},

// ----------------
// COMMON PROTOCOL PARAMS ACROSS POOLS AND NETWORKS
// ----------------

Mocks: {
AllAssetsInitialPrices: {
...MOCK_CHAINLINK_AGGREGATORS_PRICES,
},
},
// TODO: reorg alphabetically, checking the reason of tests failing
LendingRateOracleRatesCommon: {
WBNB: {
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
},

ZO_ZO: {
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
},

BKS : {
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
},

BUSD: {
borrowRate: oneRay.multipliedBy(0.05).toFixed(),
},
},
// ----------------
// COMMON PROTOCOL ADDRESSES ACROSS POOLS
// ----------------

// If PoolAdmin/emergencyAdmin is set, will take priority over PoolAdminIndex/emergencyAdminIndex
PoolAdmin: {
[eOpBNBNetwork.op_bnb]: undefined,
},
PoolAdminIndex: 0,
EmergencyAdmin: {
[eOpBNBNetwork.op_bnb]: undefined,
},
EmergencyAdminIndex: 1,
ProviderRegistry: {
// [eEthereumNetwork.main]: '0x52D306e36E3B6B02c153d0266ff0f85d18BCD413',
[eOpBNBNetwork.op_bnb]: ''
},
ProviderRegistryOwner: {
//[eEthereumNetwork.main]: '0xB9062896ec3A615a4e4444DF183F0531a77218AE',
[eOpBNBNetwork.op_bnb]: ''
},
LendingRateOracle: {
//[eEthereumNetwork.main]: '', //'0x8A32f49FFbA88aba6EFF96F45D8BD1D4b3f35c7D',
[eOpBNBNetwork.op_bnb]: ''
},
LendingPoolCollateralManager: {
//[eEthereumNetwork.main]: '0xbd4765210d4167CE2A5b87280D9E8Ee316D5EC7C',
[eOpBNBNetwork.op_bnb]: ''
},
LendingPoolConfigurator: {
[eOpBNBNetwork.op_bnb]: ''
},
LendingPool: {
[eOpBNBNetwork.op_bnb]: ''
},
WethGateway: {
[eOpBNBNetwork.op_bnb]: ''
},
TokenDistributor: {
//[eEthereumNetwork.main]: '0xe3d9988f676457123c5fd01297605efdd0cba1ae',
[eOpBNBNetwork.op_bnb]: ''
},
AaveOracle: {
[eOpBNBNetwork.op_bnb]: ''
//[eEthereumNetwork.main]: '', //'0xA50ba011c48153De246E5192C8f9258A2ba79Ca9',
},
FallbackOracle: {
[eOpBNBNetwork.op_bnb]: '',
//[eEthereumNetwork.main]: ZERO_ADDRESS,
},
ChainlinkAggregator: {
/*[eEthereumNetwork.main]: {
AAVE: '0x6Df09E975c830ECae5bd4eD9d90f3A95a4f88012',
BAT: '0x0d16d4528239e9ee52fa531af613AcdB23D88c94',
BUSD: '0x614715d2Af89E6EC99A233818275142cE88d1Cfd',
DAI: '0x773616E4d11A78F511299002da57A0a94577F1f4',
ENJ: '0x24D9aB51950F3d62E9144fdC2f3135DAA6Ce8D1B',
KNC: '0x656c0544eF4C98A6a98491833A89204Abb045d6b',
LINK: '0xDC530D9457755926550b59e8ECcdaE7624181557',
MANA: '0x82A44D92D6c329826dc557c5E1Be6ebeC5D5FeB9',
MKR: '0x24551a8Fb2A7211A25a17B1481f043A8a8adC7f2',
REN: '0x3147D7203354Dc06D9fd350c7a2437bcA92387a4',
SNX: '0x79291A9d692Df95334B1a0B3B4AE6bC606782f8c',
SUSD: '0x8e0b7e6062272B5eF4524250bFFF8e5Bd3497757',
TUSD: '0x3886BA987236181D98F2401c507Fb8BeA7871dF2',
UNI: '0xD6aA3D25116d8dA79Ea0246c4826EB951872e02e',
USDC: '0x986b5E1e1755e3C2440e960477f25201B0a8bbD4',
USDT: '0xEe9F2375b4bdF6387aa8265dD4FB8F16512A1d46',
WBTC: '0xdeb288F737066589598e9214E782fa5A8eD689e8',
YFI: '0x7c5d4F8345e66f68099581Db340cd65B078C41f4',
ZRX: '0x2Da4983a622a8498bb1a21FaE9D8F6C664939962',
USD: '0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419',
xSUSHI: '0x9b26214bEC078E68a394AaEbfbffF406Ce14893F',
},*/
[eOpBNBNetwork.op_bnb]: {}
},
ReserveAssets: {
[eOpBNBNetwork.op_bnb]: {}
},
ReservesConfig: {},
ATokenDomainSeparator: {
[eOpBNBNetwork.op_bnb]: '',
//[eEthereumNetwork.main]: '',
},
WETH: {
[eOpBNBNetwork.op_bnb]: '',
//[eEthereumNetwork.main]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
},
WrappedNativeToken: {
[eOpBNBNetwork.op_bnb]: ''
//[eEthereumNetwork.main]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
},
ReserveFactorTreasuryAddress: {
[eOpBNBNetwork.op_bnb]: ''
//[eEthereumNetwork.main]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
},
IncentivesController: {
[eOpBNBNetwork.op_bnb]: '',
//[eEthereumNetwork.main]: ZERO_ADDRESS,
},
};
53 changes: 53 additions & 0 deletions markets/op_bnb/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { oneRay, ZERO_ADDRESS } from '../../helpers/constants';
import { IOpBNBConfiguration, eEthereumNetwork, eOpBNBNetwork } from '../../helpers/types';

import { CommonsConfig } from './commons';
import {
strategyWBNB,
strategyZOZO,
strategyBKS,
} from './reservesConfigs';

// ----------------
// POOL--SPECIFIC PARAMS
// ----------------

export const OpBNBConfig: IOpBNBConfiguration = {
...CommonsConfig,
MarketId: 'Aave genesis market',
ProviderId: 4,
ReservesConfig: {
WBNB: strategyWBNB,
ZO_ZO: strategyZOZO,
BKS: strategyBKS,
},
ReserveAssets: {
[eOpBNBNetwork.op_bnb] : {},
/*[eEthereumNetwork.main]: {
AAVE: '0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9',
BAT: '0x0d8775f648430679a709e98d2b0cb6250d2887ef',
BUSD: '0x4Fabb145d64652a948d72533023f6E7A623C7C53',
DAI: '0x6B175474E89094C44Da98b954EedeAC495271d0F',
ENJ: '0xF629cBd94d3791C9250152BD8dfBDF380E2a3B9c',
KNC: '0xdd974D5C2e2928deA5F71b9825b8b646686BD200',
LINK: '0x514910771AF9Ca656af840dff83E8264EcF986CA',
MANA: '0x0F5D2fB29fb7d3CFeE444a200298f468908cC942',
MKR: '0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2',
REN: '0x408e41876cCCDC0F92210600ef50372656052a38',
SNX: '0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F',
SUSD: '0x57Ab1ec28D129707052df4dF418D58a2D46d5f51',
TUSD: '0x0000000000085d4780B73119b644AE5ecd22b376',
UNI: '0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984',
USDC: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
USDT: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
WBTC: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
WETH: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
YFI: '0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e',
ZRX: '0xE41d2489571d322189246DaFA5ebDe1F4699F498',
xSUSHI: '0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272',
},*/

},
};

export default OpBNBConfig;
Loading