Skip to content
Merged
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
1,977 changes: 1,977 additions & 0 deletions .openzeppelin/optimism.json

Large diffs are not rendered by default.

13 changes: 12 additions & 1 deletion ROLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -731,4 +731,15 @@ All the roles for the Midas protocol smart contracts are listed below.
| ***pauser*** | `0x252be2e845ef0860578d2406c8043a0196e4eb5321e0ab3b625b259add8b5213` |
| ***customFeedAdmin*** | `0x611014d106fde488a6777e4edcdf617a5efa1d338bd69a08a39fcc2fc5a0e157` |
| ***depositVaultAdmin*** | `0x0e1940e672eb264dbd85c24c06c804fabf4f2b2581deda529a1d87e5587959cb` |
| ***redemptionVaultAdmin*** | `0x46c34f93bd31e702e9aee98b0dc288a6404a0cdbb567f2e1592bb7ccad8bacbc` |
| ***redemptionVaultAdmin*** | `0x46c34f93bd31e702e9aee98b0dc288a6404a0cdbb567f2e1592bb7ccad8bacbc` |

### mRe7ETH Roles

| Role Name | Role |
| --- | --- |
| ***minter*** | `0x27299e0a77222f4852a2f0c31e6280cf68ff1b6325ddd69542a3c92e1f2e9b18` |
| ***burner*** | `0x17bb22a480938428fa8e772c0680a12b4a0f16537133a4af6350ed764795ef1a` |
| ***pauser*** | `0x8f4b7dfb05ebffc760b8d398af5b0d327b890a22f9030321740d68be514e8f60` |
| ***customFeedAdmin*** | `0xc9f03f672dadad915001ad6a5393aba8482f9c28ea275c4b5480f7b994778ed5` |
| ***depositVaultAdmin*** | `0x798de9824ed446b72c97afa7b28844dbbfbde8830d58977e9462289a757aafb7` |
| ***redemptionVaultAdmin*** | `0x37c36a61c043b91d5ec6d117c64ef865031d25c49609bb25d6530b1fcb8e2e1c` |
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

This file is missing a final newline. Please add one to adhere to standard file formatting conventions.

29 changes: 29 additions & 0 deletions config/constants/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1328,6 +1328,34 @@ export const midasAddressesPerNetwork: ConfigPerNetwork<
redemptionVaultSwapper: '0xc5a2ADeacc1cf8424630c0C6B09E1DF6e871c65A',
},
},
optimism: {
accessControl: '0x08D0016Ac2Cf7027D460b2816eA3D0e74617beF8',
timelock: '0x50382fe9Dab9feACabe1b93aB310131cEd8a9b68',
paymentTokens: {
weth: {
token: '0x4200000000000000000000000000000000000006',
aggregator: '0xc79ab9Af2d3E87e91Ec1572C8C1Bc8D2EEBB4c24',
dataFeed: '0x4C13A495D7A1eA5Fb9Afda5Faa7218666Ad794e3',
},
wsteth: {
token: '0x1f32b1c2345538c0c6f582fcb022739c4a194ebb',
aggregator: '0x524299Ab0987a7c4B3c8022a35669DdcdC715a10',
dataFeed: '0x7f711A1E6EF2Cc6De1A5580a634050286Ef27125',
},
weeth: {
token: '0x346e03F8Cce9fE01dCB3d0Da3e9D00dC2c0E08f0',
aggregator: '0xb4479d436DDa5c1A79bD88D282725615202406E3',
dataFeed: '0x72E7303C4BFf823444098748B12eAd1EBc80768C',
},
},
mRe7ETH: {
token: '0xE7Ba07519dFA06e60059563F484d6090dedF21B3',
customFeed: '0xcFfe26979e96B9E0454cC83aa03FC973C9Eb0E5E',
dataFeed: '0x46129d0863667b1159C55F0B43b898bc3352130a',
depositVault: '0xC562F73ADD198ce47E9Af5B0752dE3D7c991225D',
redemptionVaultSwapper: '0x2c8AEe33a6B1eBDd047903B5FDe01D71B8854e6D',
},
},
sepolia: {
paymentTokens: {
usdc: {
Expand Down Expand Up @@ -1562,6 +1590,7 @@ export const sanctionListContracts: Partial<Record<number, string>> = {
[chainIds.arbitrum]: '0x40C57923924B5c5c5455c48D93317139ADDaC8fb',
[chainIds.base]: '0x3A91A31cB3dC49b4db9Ce721F50a9D076c8D739B',
[chainIds.bsc]: '0x40C57923924B5c5c5455c48D93317139ADDaC8fb',
[chainIds.optimism]: '0x40C57923924B5c5c5455c48D93317139ADDaC8fb',
};

export const ustbContracts: Partial<Record<number, string>> = {
Expand Down
10 changes: 10 additions & 0 deletions config/networks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ export const rpcUrls: ConfigPerNetwork<RpcUrl> = {
scroll: 'https://rpc.scroll.io',
monad: 'https://rpc.monad.xyz',
injective: `https://${QUICK_NODE_PROJECT}.injective-mainnet.quiknode.pro/${QUICK_NODE_KEY}/`,
optimism: ALCHEMY_KEY
? `https://opt-mainnet.g.alchemy.com/v2/${ALCHEMY_KEY}`
: `https://optimism-mainnet.infura.io/v3/${INFURA_KEY}`,
};

export const gasPrices: ConfigPerNetwork<number | 'auto' | undefined> = {
Expand All @@ -76,6 +79,7 @@ export const gasPrices: ConfigPerNetwork<number | 'auto' | undefined> = {
scroll: undefined,
monad: undefined,
injective: undefined,
optimism: undefined,
};

export const chainIds: ConfigPerNetwork<number> = {
Expand All @@ -101,6 +105,7 @@ export const chainIds: ConfigPerNetwork<number> = {
scroll: 534352,
monad: 143,
injective: 1776,
optimism: 10,
};

export const mnemonics: ConfigPerNetwork<string | undefined> = {
Expand All @@ -126,6 +131,7 @@ export const mnemonics: ConfigPerNetwork<string | undefined> = {
scroll: MNEMONIC_PROD,
monad: MNEMONIC_PROD,
injective: MNEMONIC_PROD,
optimism: MNEMONIC_PROD,
};

export const gases: ConfigPerNetwork<number | undefined> = {
Expand All @@ -151,6 +157,7 @@ export const gases: ConfigPerNetwork<number | undefined> = {
scroll: undefined,
monad: undefined,
injective: undefined,
optimism: undefined,
};

export const timeouts: ConfigPerNetwork<number | undefined> = {
Expand All @@ -176,6 +183,7 @@ export const timeouts: ConfigPerNetwork<number | undefined> = {
scroll: undefined,
monad: undefined,
injective: undefined,
optimism: undefined,
};

export const blockGasLimits: ConfigPerNetwork<number | undefined> = {
Expand All @@ -201,6 +209,7 @@ export const blockGasLimits: ConfigPerNetwork<number | undefined> = {
scroll: undefined,
monad: undefined,
injective: undefined,
optimism: undefined,
};

export const initialBasesFeePerGas: ConfigPerNetwork<number | undefined> = {
Expand All @@ -226,6 +235,7 @@ export const initialBasesFeePerGas: ConfigPerNetwork<number | undefined> = {
scroll: undefined,
monad: undefined,
injective: undefined,
optimism: undefined,
};

export const blockFinality: PartialConfigPerNetwork<number> = {
Expand Down
4 changes: 4 additions & 0 deletions config/networks/verify.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,8 @@ export const verifyConfig: VerifyConfigPerNetwork = {
apiUrl: 'https://custom-api.injective.network/api',
browserUrl: 'https://custom.injective.network',
},
optimism: {
type: 'etherscan',
browserUrl: 'https://optimistic.etherscan.io',
},
};
3 changes: 2 additions & 1 deletion config/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export type Network =
| 'tacTestnet'
| 'xrplevm'
| 'zerog'
| 'injective';
| 'injective'
| 'optimism';
export type RpcUrl =
| `https://eth-${RpcNetwork}.g.alchemy.com/v2/${string}`
| `https://${RpcNetwork}.infura.io/v3/${string}`
Expand Down
1 change: 1 addition & 0 deletions config/types/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export enum MTokenNameEnum {
weEUR = 'weEUR',
mTU = 'mTU',
mM1USD = 'mM1USD',
mRe7ETH = 'mRe7ETH',
}

export type MTokenName = keyof typeof MTokenNameEnum;
Expand Down
28 changes: 28 additions & 0 deletions contracts/products/mRe7ETH/MRe7EthCustomAggregatorFeed.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

import "../../feeds/CustomAggregatorV3CompatibleFeed.sol";
import "./MRe7EthMidasAccessControlRoles.sol";

/**
* @title MRe7EthCustomAggregatorFeed
* @notice AggregatorV3 compatible feed for mRe7ETH,
* where price is submitted manually by feed admins
* @author RedDuck Software
*/
contract MRe7EthCustomAggregatorFeed is
CustomAggregatorV3CompatibleFeed,
MRe7EthMidasAccessControlRoles
{
/**
* @dev leaving a storage gap for futures updates
*/
uint256[50] private __gap;

/**
* @inheritdoc CustomAggregatorV3CompatibleFeed
*/
function feedAdminRole() public pure override returns (bytes32) {
return M_RE7ETH_CUSTOM_AGGREGATOR_FEED_ADMIN_ROLE;
}
}
24 changes: 24 additions & 0 deletions contracts/products/mRe7ETH/MRe7EthDataFeed.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

import "../../feeds/DataFeed.sol";
import "./MRe7EthMidasAccessControlRoles.sol";

/**
* @title MRe7EthDataFeed
* @notice DataFeed for mRe7ETH product
* @author RedDuck Software
*/
contract MRe7EthDataFeed is DataFeed, MRe7EthMidasAccessControlRoles {
/**
* @dev leaving a storage gap for futures updates
*/
uint256[50] private __gap;

/**
* @inheritdoc DataFeed
*/
function feedAdminRole() public pure override returns (bytes32) {
return M_RE7ETH_CUSTOM_AGGREGATOR_FEED_ADMIN_ROLE;
}
}
24 changes: 24 additions & 0 deletions contracts/products/mRe7ETH/MRe7EthDepositVault.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

import "../../DepositVault.sol";
import "./MRe7EthMidasAccessControlRoles.sol";

/**
* @title MRe7EthDepositVault
* @notice Smart contract that handles mRe7ETH minting
* @author RedDuck Software
*/
contract MRe7EthDepositVault is DepositVault, MRe7EthMidasAccessControlRoles {
/**
* @dev leaving a storage gap for futures updates
*/
uint256[50] private __gap;

/**
* @inheritdoc ManageableVault
*/
function vaultRole() public pure override returns (bytes32) {
return M_RE7ETH_DEPOSIT_VAULT_ADMIN_ROLE;
}
}
27 changes: 27 additions & 0 deletions contracts/products/mRe7ETH/MRe7EthMidasAccessControlRoles.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

/**
* @title MRe7EthMidasAccessControlRoles
* @notice Base contract that stores all roles descriptors for mRe7ETH contracts
* @author RedDuck Software
*/
abstract contract MRe7EthMidasAccessControlRoles {
/**
* @notice actor that can manage MRe7EthDepositVault
*/
bytes32 public constant M_RE7ETH_DEPOSIT_VAULT_ADMIN_ROLE =
keccak256("M_RE7ETH_DEPOSIT_VAULT_ADMIN_ROLE");

/**
* @notice actor that can manage MRe7EthRedemptionVault
*/
bytes32 public constant M_RE7ETH_REDEMPTION_VAULT_ADMIN_ROLE =
keccak256("M_RE7ETH_REDEMPTION_VAULT_ADMIN_ROLE");

/**
* @notice actor that can manage MRe7EthCustomAggregatorFeed and MRe7EthDataFeed
*/
bytes32 public constant M_RE7ETH_CUSTOM_AGGREGATOR_FEED_ADMIN_ROLE =
keccak256("M_RE7ETH_CUSTOM_AGGREGATOR_FEED_ADMIN_ROLE");
}
27 changes: 27 additions & 0 deletions contracts/products/mRe7ETH/MRe7EthRedemptionVaultWithSwapper.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

import "../../RedemptionVaultWithSwapper.sol";
import "./MRe7EthMidasAccessControlRoles.sol";

/**
* @title MRe7EthRedemptionVaultWithSwapper
* @notice Smart contract that handles mRe7ETH redemptions
* @author RedDuck Software
*/
contract MRe7EthRedemptionVaultWithSwapper is
RedemptionVaultWithSwapper,
MRe7EthMidasAccessControlRoles
{
/**
* @dev leaving a storage gap for futures updates
*/
uint256[50] private __gap;

/**
* @inheritdoc ManageableVault
*/
function vaultRole() public pure override returns (bytes32) {
return M_RE7ETH_REDEMPTION_VAULT_ADMIN_ROLE;
}
}
67 changes: 67 additions & 0 deletions contracts/products/mRe7ETH/mRe7ETH.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

import "../../mToken.sol";

/**
* @title mRe7ETH
* @author RedDuck Software
*/
//solhint-disable contract-name-camelcase
contract mRe7ETH is mToken {
/**
* @notice actor that can mint mRe7ETH
*/
bytes32 public constant M_RE7ETH_MINT_OPERATOR_ROLE =
keccak256("M_RE7ETH_MINT_OPERATOR_ROLE");

/**
* @notice actor that can burn mRe7ETH
*/
bytes32 public constant M_RE7ETH_BURN_OPERATOR_ROLE =
keccak256("M_RE7ETH_BURN_OPERATOR_ROLE");

/**
* @notice actor that can pause mRe7ETH
*/
bytes32 public constant M_RE7ETH_PAUSE_OPERATOR_ROLE =
keccak256("M_RE7ETH_PAUSE_OPERATOR_ROLE");

/**
* @dev leaving a storage gap for futures updates
*/
uint256[50] private __gap;

/**
* @inheritdoc mToken
*/
function _getNameSymbol()
internal
pure
override
returns (string memory, string memory)
{
return ("Midas Re7 Ethereum", "mRe7ETH");
}

/**
* @dev AC role, owner of which can mint mRe7ETH token
*/
function _minterRole() internal pure override returns (bytes32) {
return M_RE7ETH_MINT_OPERATOR_ROLE;
}

/**
* @dev AC role, owner of which can burn mRe7ETH token
*/
function _burnerRole() internal pure override returns (bytes32) {
return M_RE7ETH_BURN_OPERATOR_ROLE;
}

/**
* @dev AC role, owner of which can pause mRe7ETH token
*/
function _pauserRole() internal pure override returns (bytes32) {
return M_RE7ETH_PAUSE_OPERATOR_ROLE;
}
}
1 change: 1 addition & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ const config: HardhatUserConfig = {
scroll: getNetworkConfig('scroll'),
monad: getNetworkConfig('monad'),
injective: getNetworkConfig('injective'),
optimism: getNetworkConfig('optimism'),
},
gasReporter: {
enabled: REPORT_GAS,
Expand Down
1 change: 1 addition & 0 deletions helpers/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export const contractNamesPrefixes: Record<MTokenName, string> = {
weEUR: 'WeEur',
mTU: 'MTu',
mM1USD: 'MM1Usd',
mRe7ETH: 'MRe7Eth',
};

export const getCommonContractNames = (): CommonContractNames => {
Expand Down
4 changes: 4 additions & 0 deletions helpers/mtokens-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,4 +264,8 @@ export const mTokensMetadata: Record<
name: 'Midas M1 USD Market Neutral',
symbol: 'mM1-USD',
},
mRe7ETH: {
name: 'Midas Re7 Ethereum',
symbol: 'mRe7ETH',
},
};
1 change: 1 addition & 0 deletions helpers/roles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const prefixes: Record<MTokenName, string> = {
weEUR: 'WE_EUR',
mTU: 'M_TU',
mM1USD: 'M_M1_USD',
mRe7ETH: 'M_RE7ETH',
};

const mappedTokenNames: Partial<Record<MTokenName, string>> = {
Expand Down
Loading
Loading