Skip to content

Commit

Permalink
feat: Added new configuration to not use hardcoded addresses. WIP: ch… (
Browse files Browse the repository at this point in the history
#224)

* feat: Added new configuration to not use hardcoded addresses. WIP: changes added only for staking service

* feat: WIP: still missing somme services

* feat: Refactor complete

* fix: updated lendingpool config to be network -> market

* fix: fix linter

* fix: added network check before initializing services

* fix: added check on synthetix

* fix: wip: refactor config object

* fix: refactored so we dont have any blockers on initializing

* fix: removed unused type import

* fix: add comment

* fix: removed comments. Added arbitrum and avalanche networks

* fix: added optional notation to configs

* fix: moved faucet to inside lending pool per market config

* fix: fixed validator for faucet method

* fix: changed order of accessors to faucet config

* fix: added some logs

* fix: removed unnecessary log

* fix: add log

* fix: refactor take enum

* fix: fixed repay validator

Co-authored-by: sakulstra <lukasstrassel@googlemail.com>
  • Loading branch information
sendra and sakulstra authored Aug 25, 2021
1 parent 9971d35 commit 9f6430f
Show file tree
Hide file tree
Showing 20 changed files with 672 additions and 461 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Once the branch is merged to master a npm release will be published automaticall

```bash
# make sure you're on latest master before doing this
git fetch # fetch latest tags
git checkout -b <branch>
yarn release:prod
git push origin <branch>
Expand Down
125 changes: 125 additions & 0 deletions src/tx-builder/config/defaultConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
import { TxBuilderConfig } from '../types';

export const defaultConfig: TxBuilderConfig = {
governance: {
mainnet: {
AAVE_GOVERNANCE_V2: '0xEC568fffba86c094cf06b22134B23074DFE2252c',
AAVE_GOVERNANCE_V2_EXECUTOR_SHORT:
'0x61910EcD7e8e942136CE7Fe7943f956cea1CC2f7',
AAVE_GOVERNANCE_V2_EXECUTOR_LONG:
'0xEE56e2B3D491590B5b31738cC34d5232F378a8D5',
AAVE_GOVERNANCE_V2_HELPER: '0x16ff7583ea21055bf5f929ec4b896d997ff35847',
},
kovan: {
AAVE_GOVERNANCE_V2: '0xc2eBaB3Bac8f2f5028f5C7317027A41EBFCa31D2',
AAVE_GOVERNANCE_V2_EXECUTOR_SHORT:
'0x462eD5dc919BE6C96639D5f31ab919EBA8F31831',
AAVE_GOVERNANCE_V2_EXECUTOR_LONG:
'0x7e5195b0A6a60b371Ba3276032CF6958eADFA652',
AAVE_GOVERNANCE_V2_HELPER: '0xffd5BEb5712952FC9a9DDC7499487422B29Fdda6',
},
},
lendingPool: {
mainnet: {
proto: {
LENDING_POOL: '0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9',
WETH_GATEWAY: '0xcc9a0B7c43DC2a5F023Bb9b738E45B0Ef6B06E04',
FLASH_LIQUIDATION_ADAPTER: '0xE377fB98512D7b04827e56BC84e1838804a8019D',
REPAY_WITH_COLLATERAL_ADAPTER:
'0x498c5431eb517101582988fbb36431ddaac8f4b1',
SWAP_COLLATERAL_ADAPTER: '0x135896DE8421be2ec868E0b811006171D9df802A',
},
amm: {
LENDING_POOL: '0x7937d4799803fbbe595ed57278bc4ca21f3bffcb',
WETH_GATEWAY: '0xcc9a0B7c43DC2a5F023Bb9b738E45B0Ef6B06E04',
FLASH_LIQUIDATION_ADAPTER: '0xE377fB98512D7b04827e56BC84e1838804a8019D',
REPAY_WITH_COLLATERAL_ADAPTER:
'0x498c5431eb517101582988fbb36431ddaac8f4b1',
SWAP_COLLATERAL_ADAPTER: '0x135896DE8421be2ec868E0b811006171D9df802A',
},
},
kovan: {
proto: {
LENDING_POOL: '0xE0fBa4Fc209b4948668006B2bE61711b7f465bAe',
WETH_GATEWAY: '0xA61ca04DF33B72b235a8A28CfB535bb7A5271B70',
FLASH_LIQUIDATION_ADAPTER: '0x9D50F0b23b1805773f607F0B4678d724322B7AC2',
REPAY_WITH_COLLATERAL_ADAPTER:
'0xf86Be05f535EC2d217E4c6116B3fa147ee5C05A1',
SWAP_COLLATERAL_ADAPTER: '0xC18451d36aA370fDACe8d45839bF975F48f7AEa1',
FAUCET: '0x600103d518cC5E8f3319D532eB4e5C268D32e604',
},
amm: {
LENDING_POOL: '0x762E2a3BBe729240ea44D31D5a81EAB44d34ef01',
WETH_GATEWAY: '0xA61ca04DF33B72b235a8A28CfB535bb7A5271B70',
FLASH_LIQUIDATION_ADAPTER: '0x9D50F0b23b1805773f607F0B4678d724322B7AC2',
REPAY_WITH_COLLATERAL_ADAPTER:
'0xf86Be05f535EC2d217E4c6116B3fa147ee5C05A1',
SWAP_COLLATERAL_ADAPTER: '0xC18451d36aA370fDACe8d45839bF975F48f7AEa1',
FAUCET: '0x600103d518cC5E8f3319D532eB4e5C268D32e604',
},
},
polygon: {
proto: {
LENDING_POOL: '0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf',
WETH_GATEWAY: '0xbEadf48d62aCC944a06EEaE0A9054A90E5A7dc97',
SWAP_COLLATERAL_ADAPTER: '0x35784a624D4FfBC3594f4d16fA3801FeF063241c',
},
},
mumbai: {
proto: {
LENDING_POOL: '0x9198F13B08E299d85E096929fA9781A1E3d5d827',
WETH_GATEWAY: '0xee9eE614Ad26963bEc1Bec0D2c92879ae1F209fA',
FAUCET: '0x0b3C23243106A69449e79C14c58BB49E358f9B10',
},
},
},
staking: {
mainnet: {
aave: {
TOKEN_STAKING: '0x4da27a545c0c5b758a6ba100e3a049001de870f5',
STAKING_REWARD_TOKEN: '0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9',
STAKING_HELPER: '0xce0424653fb2fd48ed1b621bdbd60db16b2e388a',
},
balancer: {
TOKEN_STAKING: '0xa1116930326D21fB917d5A27F1E9943A9595fb47',
STAKING_REWARD_TOKEN: '0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9',
},
},
kovan: {
aave: {
TOKEN_STAKING: '0xf2fbf9A6710AfDa1c4AaB2E922DE9D69E0C97fd2',
STAKING_REWARD_TOKEN: '0xb597cd8d3217ea6477232f9217fa70837ff667af',
STAKING_HELPER: '0xf267aCc8BF1D8b41c89b6dc1a0aD8439dfbc890c',
},
balancer: {
TOKEN_STAKING: '0x31ce45Ab6E26C72c47C52c27498D460099545ef2',
STAKING_REWARD_TOKEN: '0xb597cd8d3217ea6477232f9217fa70837ff667af',
},
},
},
incentives: {
mainnet: {
INCENTIVES_CONTROLLER: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5',
INCENTIVES_CONTROLLER_REWARD_TOKEN:
'0x4da27a545c0c5b758a6ba100e3a049001de870f5',
},
polygon: {
INCENTIVES_CONTROLLER: '0x357d51124f59836ded84c8a1730d72b749d8bc23',
INCENTIVES_CONTROLLER_REWARD_TOKEN:
'0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270',
},
mumbai: {
INCENTIVES_CONTROLLER: '0xd41aE58e803Edf4304334acCE4DC4Ec34a63C644',
INCENTIVES_CONTROLLER_REWARD_TOKEN:
'0x9c3c9283d3e44854697cd22d3faa240cfb032889',
},
},
migrator: {
mainnet: {
LEND_TO_AAVE_MIGRATOR: '0x317625234562b1526ea2fac4030ea499c5291de4',
},
kovan: {
LEND_TO_AAVE_MIGRATOR: '0x8cC8965FEf45a448bdbe3C749683b280eF2E17Ea',
},
},
};
107 changes: 4 additions & 103 deletions src/tx-builder/config/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { BigNumber, constants } from 'ethers';
import {
EnabledNetworksType,
ConstantAddressesByNetwork,
GasRecommendationType,
Market,
Network,
ProtocolAction,
Stake,
StakingConfigType,
} from '../types';

export const DEFAULT_NULL_VALUE_ON_TX = BigNumber.from(0).toHexString();
Expand Down Expand Up @@ -63,104 +60,8 @@ export const gasLimitRecommendations: GasRecommendationType = {
},
};

export const distinctStakingAddressesBetweenTokens: StakingConfigType = {
[Stake.Aave]: {
[Network.kovan]: {
canUsePermit: true,
TOKEN_STAKING_ADDRESS: '0xf2fbf9A6710AfDa1c4AaB2E922DE9D69E0C97fd2',
STAKING_REWARD_TOKEN_ADDRESS:
'0xb597cd8d3217ea6477232f9217fa70837ff667af',
STAKING_HELPER_ADDRESS: '0xf267aCc8BF1D8b41c89b6dc1a0aD8439dfbc890c',
},
[Network.ropsten]: {
canUsePermit: false,
TOKEN_STAKING_ADDRESS: '',
STAKING_REWARD_TOKEN_ADDRESS: '',
STAKING_HELPER_ADDRESS: '',
},
[Network.mainnet]: {
canUsePermit: true,
TOKEN_STAKING_ADDRESS: '0x4da27a545c0c5b758a6ba100e3a049001de870f5',
STAKING_REWARD_TOKEN_ADDRESS:
'0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9',
STAKING_HELPER_ADDRESS: '0xce0424653fb2fd48ed1b621bdbd60db16b2e388a',
},
[Network.polygon]: {
canUsePermit: false,
TOKEN_STAKING_ADDRESS: '',
STAKING_REWARD_TOKEN_ADDRESS: '',
STAKING_HELPER_ADDRESS: '',
},
[Network.mumbai]: {
canUsePermit: false,
TOKEN_STAKING_ADDRESS: '',
STAKING_REWARD_TOKEN_ADDRESS: '',
STAKING_HELPER_ADDRESS: '',
},
export const cosntantAddressesByNetwork: ConstantAddressesByNetwork = {
[Network.mainnet]: {
SYNTHETIX_PROXY_ADDRESS: '0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f',
},
[Stake.Balancer]: {
[Network.kovan]: {
canUsePermit: false,
TOKEN_STAKING_ADDRESS: '0x31ce45Ab6E26C72c47C52c27498D460099545ef2',
STAKING_REWARD_TOKEN_ADDRESS:
'0xb597cd8d3217ea6477232f9217fa70837ff667af',
STAKING_HELPER_ADDRESS: '',
},
[Network.ropsten]: {
canUsePermit: false,
TOKEN_STAKING_ADDRESS: '',
STAKING_REWARD_TOKEN_ADDRESS: '',
STAKING_HELPER_ADDRESS: '',
},
[Network.mainnet]: {
canUsePermit: false,
TOKEN_STAKING_ADDRESS: '0xa1116930326D21fB917d5A27F1E9943A9595fb47',
STAKING_REWARD_TOKEN_ADDRESS:
'0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9',
STAKING_HELPER_ADDRESS: '',
},
[Network.polygon]: {
canUsePermit: false,
TOKEN_STAKING_ADDRESS: '',
STAKING_REWARD_TOKEN_ADDRESS: '',
STAKING_HELPER_ADDRESS: '',
},
[Network.mumbai]: {
canUsePermit: false,
TOKEN_STAKING_ADDRESS: '',
STAKING_REWARD_TOKEN_ADDRESS: '',
STAKING_HELPER_ADDRESS: '',
},
},
};

export const enabledNetworksByService: EnabledNetworksType = {
staking: {
[Stake.Balancer]: [Network.kovan, Network.mainnet],
[Stake.Aave]: [Network.kovan, Network.mainnet],
},
lendingPool: {
[Market.Proto]: [
Network.kovan,
Network.mainnet,
Network.polygon,
Network.mumbai,
],
[Market.AMM]: [Network.kovan, Network.mainnet],
},
governance: [Network.kovan, Network.mainnet],
wethGateway: [
Network.kovan,
Network.mainnet,
Network.polygon,
Network.mumbai,
],
faucet: [Network.kovan, Network.mumbai],
liquiditySwapAdapter: [Network.mainnet, Network.polygon],
repayWithCollateralAdapter: [Network.kovan, Network.mainnet],
aaveGovernanceV2: [Network.kovan, Network.mainnet],
ltaMigrator: [Network.kovan, Network.mainnet],
incentivesController: [Network.polygon, Network.mumbai, Network.mainnet],
};

export * from './v2/addresses';
141 changes: 0 additions & 141 deletions src/tx-builder/config/v2/addresses.ts

This file was deleted.

Loading

0 comments on commit 9f6430f

Please sign in to comment.