Skip to content

Commit 21c272c

Browse files
Merge pull request #149 from midas-apps/feat/mportofino
feat: mPortofino on ethereum
2 parents 72171c3 + 11339b4 commit 21c272c

17 files changed

Lines changed: 2466 additions & 603 deletions

.openzeppelin/mainnet.json

Lines changed: 2147 additions & 600 deletions
Large diffs are not rendered by default.

ROLES.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,4 +643,15 @@ All the roles for the Midas protocol smart contracts are listed below.
643643
| ***pauser*** | `0xd9f964186f74a0c3bab0e0f6ad0af930fdd8718680193f6b1b8f53e85b33ab5c` |
644644
| ***customFeedAdmin*** | `0xa8a5d84b506c7f678f2cc98f457f4eac3c3d6663b76db30e8cbb4b7665a4de35` |
645645
| ***depositVaultAdmin*** | `0x2e55e4462941cb91f5ff782032797a0cbda0aa6618f1558ba5b912d781b45be1` |
646-
| ***redemptionVaultAdmin*** | `0xaed1dfcb561f850481cdb3d35a3076d203b3bf6785bb0e8b8a52f608d0f82984` |
646+
| ***redemptionVaultAdmin*** | `0xaed1dfcb561f850481cdb3d35a3076d203b3bf6785bb0e8b8a52f608d0f82984` |
647+
648+
### mPortofino Roles
649+
650+
| Role Name | Role |
651+
| --- | --- |
652+
| ***minter*** | `0x9f1f09854f1145e8e9ff271cd28fd4619b134d2f6bc6e071abfab997a7dc1c44` |
653+
| ***burner*** | `0x4c9449f414f4183d1b70ff591423f08d38a9f5a271b077d858c04f0c1a2195e3` |
654+
| ***pauser*** | `0xb779fb501ea539ec125a430cef27a9ca12ed3fbf5af53975ca334caf8855cf16` |
655+
| ***customFeedAdmin*** | `0xbe67daee6b1b2282b6f74b3c92463b0fefc9c8eb37782a1758bc46200602e323` |
656+
| ***depositVaultAdmin*** | `0x3275e112edcda83fa1a983c6b503dda520825e0e93d86d92cdd9eaada8062115` |
657+
| ***redemptionVaultAdmin*** | `0xdc5a9c620266100042e71ec8a53cdcb4c0e3088ef200160c6cebac9aa2f625cb` |

config/constants/addresses.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,13 @@ export const midasAddressesPerNetwork: ConfigPerNetwork<
449449
depositVault: '0xeD22A9861C6eDd4f1292aeAb1E44661D5f3FE65e',
450450
redemptionVaultSwapper: '0x16d4f955B0aA1b1570Fe3e9bB2f8c19C407cdb67',
451451
},
452+
mPortofino: {
453+
token: '0x9004B9890D6B901A17F734efe028b1Be5bd6CD22',
454+
customFeed: '0x88956C00A5Fa046c823eAED747F21A95D2264403',
455+
dataFeed: '0x21f3BCfa912F674c2af3bED5BF8E47A3f40EA749',
456+
depositVault: '0x9a5cf6c0a1CEe5226E31e3D0a81F2ca2462d8387',
457+
redemptionVaultSwapper: '0xb02cc77ee137436D71b9dE46958A3bB5d7346CcA',
458+
},
452459
},
453460
arbitrum: {
454461
accessControl: '0x0312A9D1Ff2372DDEdCBB21e4B6389aFc919aC4B',

config/types/tokens.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export enum MTokenNameEnum {
5656
cUSDO = 'cUSDO',
5757
mHyperETH = 'mHyperETH',
5858
mHyperBTC = 'mHyperBTC',
59+
mPortofino = 'mPortofino',
5960
}
6061

6162
export type MTokenName = keyof typeof MTokenNameEnum;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity 0.8.9;
3+
4+
import "../../feeds/CustomAggregatorV3CompatibleFeed.sol";
5+
import "./MPortofinoMidasAccessControlRoles.sol";
6+
7+
/**
8+
* @title MPortofinoCustomAggregatorFeed
9+
* @notice AggregatorV3 compatible feed for mPortofino,
10+
* where price is submitted manually by feed admins
11+
* @author RedDuck Software
12+
*/
13+
contract MPortofinoCustomAggregatorFeed is
14+
CustomAggregatorV3CompatibleFeed,
15+
MPortofinoMidasAccessControlRoles
16+
{
17+
/**
18+
* @dev leaving a storage gap for futures updates
19+
*/
20+
uint256[50] private __gap;
21+
22+
/**
23+
* @inheritdoc CustomAggregatorV3CompatibleFeed
24+
*/
25+
function feedAdminRole() public pure override returns (bytes32) {
26+
return M_PORTOFINO_CUSTOM_AGGREGATOR_FEED_ADMIN_ROLE;
27+
}
28+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity 0.8.9;
3+
4+
import "../../feeds/DataFeed.sol";
5+
import "./MPortofinoMidasAccessControlRoles.sol";
6+
7+
/**
8+
* @title MPortofinoDataFeed
9+
* @notice DataFeed for mPortofino product
10+
* @author RedDuck Software
11+
*/
12+
contract MPortofinoDataFeed is DataFeed, MPortofinoMidasAccessControlRoles {
13+
/**
14+
* @dev leaving a storage gap for futures updates
15+
*/
16+
uint256[50] private __gap;
17+
18+
/**
19+
* @inheritdoc DataFeed
20+
*/
21+
function feedAdminRole() public pure override returns (bytes32) {
22+
return M_PORTOFINO_CUSTOM_AGGREGATOR_FEED_ADMIN_ROLE;
23+
}
24+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity 0.8.9;
3+
4+
import "../../DepositVault.sol";
5+
import "./MPortofinoMidasAccessControlRoles.sol";
6+
7+
/**
8+
* @title MPortofinoDepositVault
9+
* @notice Smart contract that handles mPortofino minting
10+
* @author RedDuck Software
11+
*/
12+
contract MPortofinoDepositVault is
13+
DepositVault,
14+
MPortofinoMidasAccessControlRoles
15+
{
16+
/**
17+
* @dev leaving a storage gap for futures updates
18+
*/
19+
uint256[50] private __gap;
20+
21+
/**
22+
* @inheritdoc ManageableVault
23+
*/
24+
function vaultRole() public pure override returns (bytes32) {
25+
return M_PORTOFINO_DEPOSIT_VAULT_ADMIN_ROLE;
26+
}
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity 0.8.9;
3+
4+
/**
5+
* @title MPortofinoMidasAccessControlRoles
6+
* @notice Base contract that stores all roles descriptors for mPortofino contracts
7+
* @author RedDuck Software
8+
*/
9+
abstract contract MPortofinoMidasAccessControlRoles {
10+
/**
11+
* @notice actor that can manage MPortofinoDepositVault
12+
*/
13+
bytes32 public constant M_PORTOFINO_DEPOSIT_VAULT_ADMIN_ROLE =
14+
keccak256("M_PORTOFINO_DEPOSIT_VAULT_ADMIN_ROLE");
15+
16+
/**
17+
* @notice actor that can manage MPortofinoRedemptionVault
18+
*/
19+
bytes32 public constant M_PORTOFINO_REDEMPTION_VAULT_ADMIN_ROLE =
20+
keccak256("M_PORTOFINO_REDEMPTION_VAULT_ADMIN_ROLE");
21+
22+
/**
23+
* @notice actor that can manage MPortofinoCustomAggregatorFeed and MPortofinoDataFeed
24+
*/
25+
bytes32 public constant M_PORTOFINO_CUSTOM_AGGREGATOR_FEED_ADMIN_ROLE =
26+
keccak256("M_PORTOFINO_CUSTOM_AGGREGATOR_FEED_ADMIN_ROLE");
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity 0.8.9;
3+
4+
import "../../RedemptionVaultWithSwapper.sol";
5+
import "./MPortofinoMidasAccessControlRoles.sol";
6+
7+
/**
8+
* @title MPortofinoRedemptionVaultWithSwapper
9+
* @notice Smart contract that handles mPortofino redemptions
10+
* @author RedDuck Software
11+
*/
12+
contract MPortofinoRedemptionVaultWithSwapper is
13+
RedemptionVaultWithSwapper,
14+
MPortofinoMidasAccessControlRoles
15+
{
16+
/**
17+
* @dev leaving a storage gap for futures updates
18+
*/
19+
uint256[50] private __gap;
20+
21+
/**
22+
* @inheritdoc ManageableVault
23+
*/
24+
function vaultRole() public pure override returns (bytes32) {
25+
return M_PORTOFINO_REDEMPTION_VAULT_ADMIN_ROLE;
26+
}
27+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity 0.8.9;
3+
4+
import "../../mToken.sol";
5+
6+
/**
7+
* @title mPortofino
8+
* @author RedDuck Software
9+
*/
10+
//solhint-disable contract-name-camelcase
11+
contract mPortofino is mToken {
12+
/**
13+
* @notice actor that can mint mPortofino
14+
*/
15+
bytes32 public constant M_PORTOFINO_MINT_OPERATOR_ROLE =
16+
keccak256("M_PORTOFINO_MINT_OPERATOR_ROLE");
17+
18+
/**
19+
* @notice actor that can burn mPortofino
20+
*/
21+
bytes32 public constant M_PORTOFINO_BURN_OPERATOR_ROLE =
22+
keccak256("M_PORTOFINO_BURN_OPERATOR_ROLE");
23+
24+
/**
25+
* @notice actor that can pause mPortofino
26+
*/
27+
bytes32 public constant M_PORTOFINO_PAUSE_OPERATOR_ROLE =
28+
keccak256("M_PORTOFINO_PAUSE_OPERATOR_ROLE");
29+
30+
/**
31+
* @dev leaving a storage gap for futures updates
32+
*/
33+
uint256[50] private __gap;
34+
35+
/**
36+
* @inheritdoc mToken
37+
*/
38+
function _getNameSymbol()
39+
internal
40+
pure
41+
override
42+
returns (string memory, string memory)
43+
{
44+
return ("Midas Portofino", "mPortofino");
45+
}
46+
47+
/**
48+
* @dev AC role, owner of which can mint mPortofino token
49+
*/
50+
function _minterRole() internal pure override returns (bytes32) {
51+
return M_PORTOFINO_MINT_OPERATOR_ROLE;
52+
}
53+
54+
/**
55+
* @dev AC role, owner of which can burn mPortofino token
56+
*/
57+
function _burnerRole() internal pure override returns (bytes32) {
58+
return M_PORTOFINO_BURN_OPERATOR_ROLE;
59+
}
60+
61+
/**
62+
* @dev AC role, owner of which can pause mPortofino token
63+
*/
64+
function _pauserRole() internal pure override returns (bytes32) {
65+
return M_PORTOFINO_PAUSE_OPERATOR_ROLE;
66+
}
67+
}

0 commit comments

Comments
 (0)