Skip to content
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,162 changes: 2,162 additions & 0 deletions .openzeppelin/mainnet.json

Large diffs are not rendered by default.

80 changes: 79 additions & 1 deletion ROLES.md

Large diffs are not rendered by default.

28 changes: 26 additions & 2 deletions config/constants/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,20 @@ type AxelarTokenAddresses = {
executables?: Partial<Record<PaymentTokenName, string>>;
};

export type TokenAddresses = {
type TokenFeedAddresses = {
customFeed?: string;
customFeedGrowth?: string;

customFeedAdjusted?: string;
customFeedDv?: string;
customFeedRv?: string;

dataFeed?: string;
dataFeedDv?: string;
dataFeedRv?: string;
};

export type TokenAddresses = TokenFeedAddresses & {
token?: string;
layerZero?: LayerZeroTokenAddresses;
axelar?: AxelarTokenAddresses;
Expand Down Expand Up @@ -505,6 +516,19 @@ export const midasAddressesPerNetwork: ConfigPerNetwork<
depositVault: '0x0f7e323103b29E1B18d521DE957Ed0c4c0A8189E',
redemptionVaultSwapper: '0x70Ba3211f2584Bf1C8a2aCdF0a00dba559CE1Ffa',
},
mGLOBAL: {
token: '0x7433806912Eae67919e66aea853d46Fa0aef98A8',
customFeedGrowth: '0x66Aa9fcD63DF74e1f67A9452E6E59Fbc67f75E38',
// Adjusted growth feed: +7%
customFeedDv: '0x494F142c35167cFbDD3887E8D7897822e63c9618',
// Adjusted growth feed: -7%
customFeedRv: '0x4c825154d02eaFAB7F3c779D96c279BCDB9fCf6F',
dataFeedDv: '0x58476f452df10E6Bf17dc1fee418E98dE9e14868',
dataFeedRv: '0xb468A6F63868cB6C6D99105EDfbe73d6B21f139E',
depositVaultAave: '0xCe29c36c6D4556f2d01d79414C1354B968dDDEf1',
redemptionVaultAave: '0xA0Fc8BDFb1E6a705C1375810989B1d70a982b01B',
redemptionVaultSwapper: '0x1e0fd66753198c7b8bA64edEe8d41D8628Bf20D7',
},
},
arbitrum: {
accessControl: '0x0312A9D1Ff2372DDEdCBB21e4B6389aFc919aC4B',
Expand Down Expand Up @@ -895,7 +919,7 @@ export const midasAddressesPerNetwork: ConfigPerNetwork<
},
dnTEST: {
token: '0x80cAE1bb1B90980148C5bC9c5701b69fAfE7d6B2',
customFeed: '0x0c459A098EB325fD7ea602Cd7664EE43f1D4Bd08',
customFeedGrowth: '0x0c459A098EB325fD7ea602Cd7664EE43f1D4Bd08',
dataFeed: '0xA7A8F3414e02AEcb50E206aF31001CC4990b4D0a',
depositVault: '0xed51fEb552d596F3014B127D21ECcE5a7D8e8b19',
redemptionVaultSwapper: '0x35D44B87D6c786e9434DA337eb59D373e8b84941',
Expand Down
1 change: 1 addition & 0 deletions config/types/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export enum MTokenNameEnum {
mTU = 'mTU',
mM1USD = 'mM1USD',
mRe7ETH = 'mRe7ETH',
mGLOBAL = 'mGLOBAL',
}

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

import "../../feeds/CustomAggregatorV3CompatibleFeedGrowth.sol";
import "./MGlobalMidasAccessControlRoles.sol";

/**
* @title MGlobalCustomAggregatorFeedGrowth
* @notice AggregatorV3 compatible feed for mGLOBAL,
* where price is submitted manually by feed admins,
* and growth apr applies to the answer.
* @author RedDuck Software
*/
contract MGlobalCustomAggregatorFeedGrowth is
CustomAggregatorV3CompatibleFeedGrowth,
MGlobalMidasAccessControlRoles
{
/**
* @dev leaving a storage gap for futures updates
*/
uint256[50] private __gap;

/**
* @inheritdoc CustomAggregatorV3CompatibleFeedGrowth
*/
function feedAdminRole() public pure override returns (bytes32) {
return M_GLOBAL_CUSTOM_AGGREGATOR_FEED_ADMIN_ROLE;
}
}
24 changes: 24 additions & 0 deletions contracts/products/mGLOBAL/MGlobalDataFeed.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 "./MGlobalMidasAccessControlRoles.sol";

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

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

import "../../DepositVaultWithAave.sol";
import "./MGlobalMidasAccessControlRoles.sol";

/**
* @title MGlobalDepositVaultWithAave
* @notice Smart contract that handles mGLOBAL minting with Aave V3 auto-invest
* @author RedDuck Software
*/
contract MGlobalDepositVaultWithAave is
DepositVaultWithAave,
MGlobalMidasAccessControlRoles
{
/**
* @dev leaving a storage gap for futures updates
*/
uint256[50] private __gap;

/**
* @inheritdoc ManageableVault
*/
function vaultRole() public pure override returns (bytes32) {
return M_GLOBAL_DEPOSIT_VAULT_ADMIN_ROLE;
}

/**
* @inheritdoc Greenlistable
*/
function greenlistedRole() public pure override returns (bytes32) {
return M_GLOBAL_GREENLISTED_ROLE;
}
}
33 changes: 33 additions & 0 deletions contracts/products/mGLOBAL/MGlobalMidasAccessControlRoles.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

/**
* @title MGlobalMidasAccessControlRoles
* @notice Base contract that stores all roles descriptors for mGLOBAL contracts
* @author RedDuck Software
*/
abstract contract MGlobalMidasAccessControlRoles {
/**
* @notice actor that can manage MGlobalDepositVault
*/
bytes32 public constant M_GLOBAL_DEPOSIT_VAULT_ADMIN_ROLE =
keccak256("M_GLOBAL_DEPOSIT_VAULT_ADMIN_ROLE");

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

/**
* @notice actor that can manage MGlobalCustomAggregatorFeed and MGlobalDataFeed
*/
bytes32 public constant M_GLOBAL_CUSTOM_AGGREGATOR_FEED_ADMIN_ROLE =
keccak256("M_GLOBAL_CUSTOM_AGGREGATOR_FEED_ADMIN_ROLE");

/**
* @notice greenlist role for mGLOBAL
*/
bytes32 public constant M_GLOBAL_GREENLISTED_ROLE =
keccak256("M_GLOBAL_GREENLISTED_ROLE");
}
34 changes: 34 additions & 0 deletions contracts/products/mGLOBAL/MGlobalRedemptionVaultWithAave.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

import "../../RedemptionVaultWithAave.sol";
import "./MGlobalMidasAccessControlRoles.sol";

/**
* @title MGlobalRedemptionVaultWithAave
* @notice Smart contract that handles mGLOBAL redemptions via Aave V3
* @author RedDuck Software
*/
contract MGlobalRedemptionVaultWithAave is
RedemptionVaultWithAave,
MGlobalMidasAccessControlRoles
{
/**
* @dev leaving a storage gap for futures updates
*/
uint256[50] private __gap;

/**
* @inheritdoc ManageableVault
*/
function vaultRole() public pure override returns (bytes32) {
return M_GLOBAL_REDEMPTION_VAULT_ADMIN_ROLE;
}

/**
* @inheritdoc Greenlistable
*/
function greenlistedRole() public pure override returns (bytes32) {
return M_GLOBAL_GREENLISTED_ROLE;
}
}
34 changes: 34 additions & 0 deletions contracts/products/mGLOBAL/MGlobalRedemptionVaultWithSwapper.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

import "../../RedemptionVaultWithSwapper.sol";
import "./MGlobalMidasAccessControlRoles.sol";

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

/**
* @inheritdoc ManageableVault
*/
function vaultRole() public pure override returns (bytes32) {
return M_GLOBAL_REDEMPTION_VAULT_ADMIN_ROLE;
}

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

import "../../mTokenPermissioned.sol";
import "./MGlobalMidasAccessControlRoles.sol";

/**
* @title mGLOBAL
* @author RedDuck Software
*/
//solhint-disable contract-name-camelcase
contract mGLOBAL is mTokenPermissioned, MGlobalMidasAccessControlRoles {
/**
* @notice actor that can mint mGLOBAL
*/
bytes32 public constant M_GLOBAL_MINT_OPERATOR_ROLE =
keccak256("M_GLOBAL_MINT_OPERATOR_ROLE");

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

/**
* @notice actor that can pause mGLOBAL
*/
bytes32 public constant M_GLOBAL_PAUSE_OPERATOR_ROLE =
keccak256("M_GLOBAL_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 Fasanara Global", "mGLOBAL");
}

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

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

/**
* @dev AC role, owner of which can pause mGLOBAL token
*/
function _pauserRole() internal pure override returns (bytes32) {
return M_GLOBAL_PAUSE_OPERATOR_ROLE;
}

/**
* @inheritdoc mTokenPermissioned
*/
function _greenlistedRole() internal pure override returns (bytes32) {
return M_GLOBAL_GREENLISTED_ROLE;
}
}
1 change: 1 addition & 0 deletions helpers/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ export const contractNamesPrefixes: Record<MTokenName, string> = {
mTU: 'MTu',
mM1USD: 'MM1Usd',
mRe7ETH: 'MRe7Eth',
mGLOBAL: 'MGlobal',
};

export const getCommonContractNames = (): CommonContractNames => {
Expand Down
5 changes: 5 additions & 0 deletions helpers/mtokens-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,4 +268,9 @@ export const mTokensMetadata: Record<
name: 'Midas Re7 Ethereum',
symbol: 'mRe7ETH',
},
mGLOBAL: {
name: 'Midas Fasanara Global',
symbol: 'mGLOBAL',
isPermissioned: true,
},
};
1 change: 1 addition & 0 deletions helpers/roles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const prefixes: Record<MTokenName, string> = {
mTU: 'M_TU',
mM1USD: 'M_M1_USD',
mRe7ETH: 'M_RE7ETH',
mGLOBAL: 'M_GLOBAL',
};

const mappedTokenNames: Partial<Record<MTokenName, string>> = {
Expand Down
12 changes: 11 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,24 @@
"deploy:timelock": "yarn hh:run:script scripts/deploy/deploy_TimeLock.ts",
"deploy:token": "yarn hh:run:script scripts/deploy/deploy_Token.ts",
"deploy:aggregator": "yarn hh:run:script scripts/deploy/deploy_CustomAggregator.ts",
"deploy:aggregator:adjusted": "yarn hh:run:script scripts/deploy/misc/deploy_CustomAggregatorAdjusted.ts",
"deploy:aggregator:adjusted:dv": "yarn hh:run:script scripts/deploy/misc/deploy_CustomAggregatorAdjustedDv.ts",
"deploy:aggregator:adjusted:rv": "yarn hh:run:script scripts/deploy/misc/deploy_CustomAggregatorAdjustedRv.ts",
"deploy:aggregator:ptoken": "yarn hh:run:script scripts/deploy/deploy_PaymentToken_CustomAggregator.ts",
"deploy:feed": "yarn hh:run:script scripts/deploy/deploy_DataFeed.ts",
"deploy:feed:dv": "yarn hh:run:script scripts/deploy/deploy_DataFeedDv.ts",
"deploy:feed:rv": "yarn hh:run:script scripts/deploy/deploy_DataFeedRv.ts",
"deploy:feed:ptoken": "yarn hh:run:script scripts/deploy/deploy_PaymentToken_DataFeed.ts",
"deploy:dv": "yarn hh:run:script scripts/deploy/deploy_DV.ts",
"deploy:dv:ustb": "yarn hh:run:script scripts/deploy/deploy_DVUstb.ts",
"deploy:dv:aave": "yarn hh:run:script scripts/deploy/deploy_DVAave.ts",
"deploy:dv:morpho": "yarn hh:run:script scripts/deploy/deploy_DVMorpho.ts",
"deploy:dv:mtoken": "yarn hh:run:script scripts/deploy/deploy_DVMToken.ts",
"deploy:rv": "yarn hh:run:script scripts/deploy/deploy_RV.ts",
"deploy:rv:swapper": "yarn hh:run:script scripts/deploy/deploy_RVSwapper.ts",
"deploy:rv:buidl": "yarn hh:run:script scripts/deploy/deploy_RVSwapper.ts",
"deploy:rv:aave": "yarn hh:run:script scripts/deploy/deploy_RVAave.ts",
"deploy:rv:morpho": "yarn hh:run:script scripts/deploy/deploy_RVMorpho.ts",
"deploy:rv:mtoken": "yarn hh:run:script scripts/deploy/deploy_RVMToken.ts",
"deploy:generate:contracts": "yarn hh:run:script scripts/deploy/codegen/generate_contracts.ts",
"deploy:generate:config": "yarn hh:run:script scripts/deploy/codegen/generate_config.ts",
"deploy:post:add:ptokens": "yarn hh:run:script scripts/deploy/post-deploy/add_PaymentTokens.ts",
Expand Down
Loading
Loading