Skip to content
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

Add WMATIC market to polygon network #906

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
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: 1 addition & 1 deletion .github/workflows/run-scenarios.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
fail-fast: false
matrix:
bases: [ development, mainnet, mainnet-weth, mainnet-usdt, goerli, goerli-weth, sepolia-usdc, sepolia-weth, fuji, mumbai, polygon, polygon-usdt, arbitrum-usdc.e, arbitrum-usdc, arbitrum-weth, arbitrum-usdt, arbitrum-goerli-usdc, arbitrum-goerli-usdc.e, base-usdbc, base-weth, base-usdc, base-goerli, base-goerli-weth, linea-goerli, optimism-usdc, optimism-usdt, optimism-weth, scroll-goerli, scroll-usdc]
bases: [ development, mainnet, mainnet-weth, mainnet-usdt, goerli, goerli-weth, sepolia-usdc, sepolia-weth, fuji, mumbai, polygon, polygon-usdt, polygon-wmatic, arbitrum-usdc.e, arbitrum-usdc, arbitrum-weth, arbitrum-usdt, arbitrum-goerli-usdc, arbitrum-goerli-usdc.e, base-usdbc, base-weth, base-usdc, base-goerli, base-goerli-weth, linea-goerli, optimism-usdc, optimism-usdt, optimism-weth, scroll-goerli, scroll-usdc]
name: Run scenarios
env:
ETHERSCAN_KEY: ${{ secrets.ETHERSCAN_KEY }}
Expand Down
40 changes: 40 additions & 0 deletions deployments/polygon/wmatic/configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "Compound WMATIC",
"symbol": "cWMATICv3",
"baseToken": "WMATIC",
"baseTokenAddress": "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",
"baseTokenPriceFeed": "0xAB594600376Ec9fD91F8e885dADF0CE036862dE0",
"borrowMin": "1e18",
"governor": "0xCC3E7c85Bb0EE4f09380e041fee95a0caeDD4a02",
"pauseGuardian": "0x8Ab717CAC3CbC4934E63825B88442F5810aAF6e5",
"storeFrontPriceFactor": "TBD",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Find this value in recommendation post

"targetReserves": "TBD",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Find this value in recommendation post

"rates": {
"supplyKink": 0.9,
"supplySlopeLow": 0.025,
"supplySlopeHigh": 3,
"supplyBase": 0,
"borrowKink": 0.9,
"borrowSlopeLow": 0.035,
"borrowSlopeHigh": 3.5,
"borrowBase": 0.005
},
"tracking": {
"indexScale": "1e15",
"baseSupplySpeed": "34722222222",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"baseBorrowSpeed": "0",
"baseMinForRewards": "TBD"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

10000e18 - means, that COMP incentivization turns on when supplies/borrowed more than 10000 of Matic

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

},
"rewardTokenAddress": "0x8505b9d2254A7Ae468c0E9dd10Ccea3A837aef5c",
"assets": {
"MaticX": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there only 1 collateral?

"address": "0xfa68FB4628DFF1028CFEc22b4162FCcd0d45efb6",
"priceFeed": "0x5d37E4b374E6907de8Fc7fb33EE3b0af403C7403",
"decimals": "18",
"borrowCF": 0.80,
"liquidateCF": 0.85,
"liquidationFactor": 0.90,
"supplyCap": "0"
}
}
}
39 changes: 39 additions & 0 deletions deployments/polygon/wmatic/deploy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { Deployed, DeploymentManager } from '../../../plugins/deployment_manager';
import { DeploySpec, deployComet } from '../../../src/deploy';

export default async function deploy(deploymentManager: DeploymentManager, deploySpec: DeploySpec): Promise<Deployed> {
const trace = deploymentManager.tracer()
const ethers = deploymentManager.hre.ethers;

// pull in existing assets
const USDT = await deploymentManager.existing('USDT', '0xc2132D05D31c914a87C6611C10748AEb04B58e8F', 'polygon');
const WBTC = await deploymentManager.existing('WBTC', '0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6', 'polygon');
const WETH = await deploymentManager.existing('WETH', '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619', 'polygon');
const WMATIC = await deploymentManager.existing('WMATIC', '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', 'polygon');
const MaticX = await deploymentManager.existing('MaticX', '0xfa68FB4628DFF1028CFEc22b4162FCcd0d45efb6', 'polygon');
const stMATIC = await deploymentManager.existing('stMATIC', '0x3A58a54C066FdC0f2D55FC9C89F0415C92eBf3C4', 'polygon');
const COMP = await deploymentManager.existing('COMP', '0x8505b9d2254A7Ae468c0E9dd10Ccea3A837aef5c', 'polygon');

const fxChild = await deploymentManager.existing('fxChild', '0x8397259c983751DAf40400790063935a11afa28a', 'polygon');

const cometAdmin = await deploymentManager.fromDep('cometAdmin', 'polygon', 'usdc');
const cometFactory = await deploymentManager.fromDep('cometFactory', 'polygon', 'usdc');
const $configuratorImpl = await deploymentManager.fromDep('configurator:implementation', 'polygon', 'usdc');
const configurator = await deploymentManager.fromDep('configurator', 'polygon', 'usdc');
const rewards = await deploymentManager.fromDep('rewards', 'polygon', 'usdc');
const bulker = await deploymentManager.fromDep('bulker', 'polygon', 'usdc');
const localTimelock = await deploymentManager.fromDep('timelock', 'polygon', 'usdc');
const bridgeReceiver = await deploymentManager.fromDep('bridgeReceiver', 'polygon', 'usdc');

// Deploy Comet
const deployed = await deployComet(deploymentManager, deploySpec);

return {
...deployed,
bridgeReceiver,
bulker,
fxChild,
rewards,
COMP
};
}
25 changes: 25 additions & 0 deletions deployments/polygon/wmatic/relations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { RelationConfigMap } from '../../../plugins/deployment_manager/RelationConfig';
import baseRelationConfig from '../../relations';

export default {
...baseRelationConfig,
'governor': {
artifact: 'contracts/bridges/polygon/PolygonBridgeReceiver.sol:PolygonBridgeReceiver',
},
InitializableImmutableAdminUpgradeabilityProxy: {
artifact: 'contracts/ERC20.sol:ERC20',
delegates: {
field: {
slot: '0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc'
}
}
},
UChildERC20Proxy: {
artifact: 'contracts/ERC20.sol:ERC20',
delegates: {
field: {
slot: '0xbaab7dbf64751104133af04abc7d9979f0fda3b059a322a8333f533d3f32bf7f',
}
},
}
};
1 change: 1 addition & 0 deletions deployments/polygon/wmatic/roots.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
10 changes: 9 additions & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import mainnetWethRelationConfigMap from './deployments/mainnet/weth/relations';
import mainnetUsdtRelationConfigMap from './deployments/mainnet/usdt/relations';
import polygonRelationConfigMap from './deployments/polygon/usdc/relations';
import polygonUsdtRelationConfigMap from './deployments/polygon/usdt/relations';
import polygonWmatictRelationConfigMap from './deployments/polygon/wmatic/relations';
import arbitrumBridgedUsdcRelationConfigMap from './deployments/arbitrum/usdc.e/relations';
import arbitrumNativeUsdcRelationConfigMap from './deployments/arbitrum/usdc/relations';
import arbitrumWETHRelationConfigMap from './deployments/arbitrum/weth/relations';
Expand Down Expand Up @@ -357,7 +358,8 @@ const config: HardhatUserConfig = {
},
polygon: {
usdc: polygonRelationConfigMap,
usdt: polygonUsdtRelationConfigMap
usdt: polygonUsdtRelationConfigMap,
wmatic: polygonWmatictRelationConfigMap
},
arbitrum: {
'usdc.e': arbitrumBridgedUsdcRelationConfigMap,
Expand Down Expand Up @@ -461,6 +463,12 @@ const config: HardhatUserConfig = {
deployment: 'usdt',
auxiliaryBase: 'mainnet'
},
{
name: 'polygon-wmatic',
network: 'polygon',
deployment: 'wmatic',
auxiliaryBase: 'mainnet'
},
{
name: 'arbitrum-usdc.e',
network: 'arbitrum',
Expand Down