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
119 changes: 119 additions & 0 deletions .openzeppelin/sepolia.json
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,11 @@
"address": "0x75726da161ef6aE712e941E00705879715b260f6",
"txHash": "0xcb8a84e91a264b44fc00c807ea3736e68d2fa84562889cbd9062d8747963febb",
"kind": "transparent"
},
{
"address": "0x918539ab47a93bA64cdaa2923Ef0Fd07aeb208D5",
"txHash": "0xc243e35f1ccef6c0b694a5d8fadc1d5f835ca095709139b43f33e3de12dde595",
"kind": "transparent"
}
],
"impls": {
Expand Down Expand Up @@ -47511,6 +47516,120 @@
}
}
}
},
"6d838117edf6833c74149c4daf15a65a3ce1d9f7088af7b7c3517a631f80ea95": {
"address": "0xdcf061D9FD1AbC9A12deF64fe5AEe2C961aB2091",
"txHash": "0xb08e368137061b717e9e4988e6d330d048b3645a1f4380930ee449bcf0a78ffe",
"layout": {
"solcVersion": "0.8.22",
"storage": [
{
"label": "_initialized",
"offset": 0,
"slot": "0",
"type": "t_uint8",
"contract": "Initializable",
"src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:63",
"retypedFrom": "bool"
},
{
"label": "_initializing",
"offset": 1,
"slot": "0",
"type": "t_bool",
"contract": "Initializable",
"src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:68"
},
{
"label": "__gap",
"offset": 0,
"slot": "1",
"type": "t_array(t_uint256)50_storage",
"contract": "ContextUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:36"
},
{
"label": "__gap",
"offset": 0,
"slot": "51",
"type": "t_array(t_uint256)50_storage",
"contract": "ERC165Upgradeable",
"src": "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol:41"
},
{
"label": "_roles",
"offset": 0,
"slot": "101",
"type": "t_mapping(t_bytes32,t_struct(RoleData)9957_storage)",
"contract": "AccessControlUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol:62"
},
{
"label": "__gap",
"offset": 0,
"slot": "102",
"type": "t_array(t_uint256)49_storage",
"contract": "AccessControlUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol:260"
}
],
"types": {
"t_address": {
"label": "address",
"numberOfBytes": "20"
},
"t_array(t_uint256)49_storage": {
"label": "uint256[49]",
"numberOfBytes": "1568"
},
"t_array(t_uint256)50_storage": {
"label": "uint256[50]",
"numberOfBytes": "1600"
},
"t_bool": {
"label": "bool",
"numberOfBytes": "1"
},
"t_bytes32": {
"label": "bytes32",
"numberOfBytes": "32"
},
"t_mapping(t_address,t_bool)": {
"label": "mapping(address => bool)",
"numberOfBytes": "32"
},
"t_mapping(t_bytes32,t_struct(RoleData)9957_storage)": {
"label": "mapping(bytes32 => struct AccessControlUpgradeable.RoleData)",
"numberOfBytes": "32"
},
"t_struct(RoleData)9957_storage": {
"label": "struct AccessControlUpgradeable.RoleData",
"members": [
{
"label": "members",
"type": "t_mapping(t_address,t_bool)",
"offset": 0,
"slot": "0"
},
{
"label": "adminRole",
"type": "t_bytes32",
"offset": 0,
"slot": "1"
}
],
"numberOfBytes": "64"
},
"t_uint256": {
"label": "uint256",
"numberOfBytes": "32"
},
"t_uint8": {
"label": "uint8",
"numberOfBytes": "1"
}
}
}
}
}
}
49 changes: 15 additions & 34 deletions helpers/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,40 +66,17 @@ export const getMTokenOrThrow = (hre: HardhatRuntimeEnvironment) => {
return mToken;
};

export const getOriginalNetwork = (hre: HardhatRuntimeEnvironment) => {
const originalNetwork = hre.layerZero?.originalNetwork;
return originalNetwork;
};

export const getOriginalNetworkOrThrow = (hre: HardhatRuntimeEnvironment) => {
const originalNetwork = hre.layerZero?.originalNetwork;
if (!originalNetwork) {
throw new Error('OriginalNetwork parameter not found');
}
return originalNetwork;
};

export const getPaymentTokenOrThrow = (hre: HardhatRuntimeEnvironment) => {
const paymentToken = hre.paymentToken;
if (!paymentToken) {
throw new Error('PaymentToken parameter not found');
}
return paymentToken;
};

export const getActionOrThrow = (hre: HardhatRuntimeEnvironment) => {
const action = hre.action;
if (!action) {
throw new Error('Action parameter not found');
}
return action;
};

export const getMTokenOrPaymentTokenOrThrow = (
hre: HardhatRuntimeEnvironment,
) => {
const mToken = hre.mtoken;
const paymentToken = hre.paymentToken;
export type MTokenOrPaymentToken =
| { mToken: MTokenName; paymentToken?: undefined }
| { mToken?: undefined; paymentToken: PaymentTokenName };

/**
* Validates that exactly one of `mToken` / `paymentToken` is provided.
*/
export const requireOneOfMTokenOrPaymentToken = (
mToken?: MTokenName,
paymentToken?: PaymentTokenName,
): MTokenOrPaymentToken => {
if (mToken && paymentToken) {
throw new Error('Only one of MToken or PaymentToken can be provided');
}
Expand All @@ -115,6 +92,10 @@ export const getMTokenOrPaymentTokenOrThrow = (
throw new Error('MToken or PaymentToken parameter not found');
};

export const getMTokenOrPaymentTokenOrThrow = (
hre: HardhatRuntimeEnvironment,
) => requireOneOfMTokenOrPaymentToken(hre.mtoken, hre.paymentToken);

export const getImplAddressFromProxy = async (
hre: HardhatRuntimeEnvironment,
proxyAddress: string,
Expand Down
59 changes: 0 additions & 59 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,69 +38,10 @@
"codestyle:fix": "run-s \"lint:*:*\" \"format:*:*\"",
"hh:run": "yarn hardhat run",
"hh:run:script": "yarn hardhat runscript",
"deploy:ac": "yarn hh:run:script scripts/deploy/deploy_AccessControl.ts",
"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: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",
"deploy:post:grant:roles": "yarn hh:run:script scripts/deploy/post-deploy/grant_AllProductRoles.ts",
"deploy:post:grant:admin": "yarn hh:run:script scripts/deploy/post-deploy/grant_DefaultAdminRole.ts",
"deploy:post:revoke:roles": "yarn hh:run:script scripts/deploy/post-deploy/revoke_DeployerRoles.ts",
"deploy:post:transfer:proxyadmin": "yarn hh:run:script scripts/deploy/post-deploy/transfer_ProxyAdminToTimelock.ts",
"deploy:post:set:price": "yarn hh:run:script scripts/deploy/post-deploy/set_RoundData.ts",
"deploy:post:set:expected-answers": "yarn hh:run:script scripts/deploy/post-deploy/set_ExpectedAnswers.ts",
"deploy:post:set:waived": "yarn hh:run:script scripts/deploy/post-deploy/add_FeeWaived.ts",
"deploy:post:set:greenlist": "yarn hh:run:script scripts/deploy/post-deploy/set_Greenlist.ts",
"timelock:upgrade:vaults:propose": "yarn hh:run:script scripts/upgrades/proposeUpgrade_Vaults.ts",
"timelock:upgrade:vaults:execute": "yarn hh:run:script scripts/upgrades/executeUpgrade_Vaults.ts",
"timelock:upgrade:vaults:validate": "yarn hh:run:script scripts/upgrades/validateUpgrade_Vaults.ts",
"timelock:admin:transfer:propose": "yarn hh:run:script scripts/upgrades/proposeTransferOwnership_ProxyAdmin.ts",
"timelock:admin:transfer:execute": "yarn hh:run:script scripts/upgrades/executeTransferOwnership_ProxyAdmin.ts",
"deploy:post:pause:functions": "yarn hh:run:script scripts/deploy/post-deploy/pause_Functions.ts",
"deploy:post:add:addressbook": "yarn hh:run:script scripts/deploy/post-deploy/add_ToAddressBook.ts",
"deploy:lz:composer": "yarn hh:run:script scripts/deploy/misc/layerzero/deploy_Composer.ts",
"deploy:lz:oft": "yarn hh:run:script scripts/deploy/misc/layerzero/deploy_OFT.ts",
"deploy:lz:oft:adapter": "yarn hh:run:script scripts/deploy/misc/layerzero/deploy_OFTAdapter.ts",
"deploy:lz:oft:adapter:mintburn": "yarn hh:run:script scripts/deploy/misc/layerzero/deploy_MintBurnOFTAdapter.ts",
"deploy:lz:post:set:ratelimit": "yarn hh:run:script scripts/deploy/misc/layerzero/set_RateLimitConfigs.ts",
"deploy:lz:post:transfer:owner": "yarn hh:run:script scripts/deploy/misc/layerzero/transfer_Owner.ts",
"deploy:lz:post:grant:roles": "yarn hh:run:script scripts/deploy/misc/layerzero/grant_Roles.ts",
"deploy:lz:post:revoke:roles": "yarn hh:run:script scripts/deploy/misc/layerzero/revoke_Roles.ts",
"deploy:lz:post:wire": "yarn hardhat lz:oapp:wire:midas",
"deploy:lz:deprecate": "yarn hh:run:script scripts/deploy/misc/layerzero/deprecate_Ofts.ts",
"deploy:axelar:executable": "yarn hh:run:script scripts/deploy/misc/axelar/deploy_Executable.ts",
"deploy:axelar:post:wire": "yarn hh:run:script scripts/deploy/misc/axelar/wire_Tokens.ts",
"deploy:axelar:post:wire:ptoken": "yarn hh:run:script scripts/deploy/misc/axelar/wire_PaymentTokens.ts",
"deploy:axelar:post:set:flowlimit": "yarn hh:run:script scripts/deploy/misc/axelar/set_FlowLimit.ts",
"deploy:axelar:post:grant:roles": "yarn hh:run:script scripts/deploy/misc/axelar/grant_Roles.ts",
"deploy:axelar:post:revoke:roles": "yarn hh:run:script scripts/deploy/misc/axelar/revoke_Roles.ts",
"deploy:post:set:sanctionsList": "yarn hh:run:script scripts/deploy/post-deploy/set_SanctionsList.ts",
"deploy:post:set:aaveconfig": "yarn hh:run:script scripts/deploy/post-deploy/set_AaveConfig.ts",
"deploy:post:set:morphoconfig": "yarn hh:run:script scripts/deploy/post-deploy/set_MorphoConfig.ts",
"verify:proxy": "yarn hardhat verify-transparent-proxy",
"verify:sourcify": "VERIFY_SOURCIFY=true VERIFY_ETHERSCAN=false yarn hardhat verify",
"dump:roles": "yarn hh:run scripts/dump_roles.ts",
"verify:all:impl": "yarn hh:run:script scripts/verify_contracts.ts",
"oz:merge-manifest": "ts-node scripts/merge-oz-manifests.ts"
},
"devDependencies": {
Expand Down
8 changes: 5 additions & 3 deletions scripts/deploy/codegen/generate_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types';

import { generateDeploymentConfig } from './common';

import { getMTokenOrThrow } from '../../../helpers/utils';
import { MTokenName } from '../../../config';
import { DeployFunction } from '../common/types';

const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const mToken = getMTokenOrThrow(hre);
const func: DeployFunction = async (
hre: HardhatRuntimeEnvironment,
mToken: MTokenName,
) => {
await generateDeploymentConfig(hre, mToken);
};

Expand Down
6 changes: 5 additions & 1 deletion scripts/deploy/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,8 @@ export type NetworkDeploymentConfig = Record<
}
>;

export type DeployFunction = (hre: HardhatRuntimeEnvironment) => Promise<void>;
export type DeployFunction = (
hre: HardhatRuntimeEnvironment,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
...params: any[]
) => Promise<void>;
8 changes: 5 additions & 3 deletions scripts/deploy/deploy_CustomAggregator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types';
import { deployMTokenCustomAggregator } from './common/data-feed';
import { DeployFunction } from './common/types';

import { getMTokenOrThrow } from '../../helpers/utils';
import { MTokenName } from '../../config';

const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const mToken = getMTokenOrThrow(hre);
const func: DeployFunction = async (
hre: HardhatRuntimeEnvironment,
mToken: MTokenName,
) => {
await deployMTokenCustomAggregator(hre, mToken);
};

Expand Down
8 changes: 5 additions & 3 deletions scripts/deploy/deploy_DV.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types';
import { deployDepositVault } from './common';
import { DeployFunction } from './common/types';

import { getMTokenOrThrow } from '../../helpers/utils';
import { MTokenName } from '../../config';

const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const mToken = getMTokenOrThrow(hre);
const func: DeployFunction = async (
hre: HardhatRuntimeEnvironment,
mToken: MTokenName,
) => {
await deployDepositVault(hre, mToken, 'dv');
};

Expand Down
8 changes: 5 additions & 3 deletions scripts/deploy/deploy_DVAave.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types';
import { deployDepositVault } from './common';
import { DeployFunction } from './common/types';

import { getMTokenOrThrow } from '../../helpers/utils';
import { MTokenName } from '../../config';

const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const mToken = getMTokenOrThrow(hre);
const func: DeployFunction = async (
hre: HardhatRuntimeEnvironment,
mToken: MTokenName,
) => {
await deployDepositVault(hre, mToken, 'dvAave');
};

Expand Down
8 changes: 5 additions & 3 deletions scripts/deploy/deploy_DVMToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types';
import { deployDepositVault } from './common';
import { DeployFunction } from './common/types';

import { getMTokenOrThrow } from '../../helpers/utils';
import { MTokenName } from '../../config';

const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const mToken = getMTokenOrThrow(hre);
const func: DeployFunction = async (
hre: HardhatRuntimeEnvironment,
mToken: MTokenName,
) => {
await deployDepositVault(hre, mToken, 'dvMToken');
};

Expand Down
8 changes: 5 additions & 3 deletions scripts/deploy/deploy_DVMorpho.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types';
import { deployDepositVault } from './common';
import { DeployFunction } from './common/types';

import { getMTokenOrThrow } from '../../helpers/utils';
import { MTokenName } from '../../config';

const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const mToken = getMTokenOrThrow(hre);
const func: DeployFunction = async (
hre: HardhatRuntimeEnvironment,
mToken: MTokenName,
) => {
await deployDepositVault(hre, mToken, 'dvMorpho');
};

Expand Down
8 changes: 5 additions & 3 deletions scripts/deploy/deploy_DVUstb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types';
import { deployDepositVault } from './common';
import { DeployFunction } from './common/types';

import { getMTokenOrThrow } from '../../helpers/utils';
import { MTokenName } from '../../config';

const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const mToken = getMTokenOrThrow(hre);
const func: DeployFunction = async (
hre: HardhatRuntimeEnvironment,
mToken: MTokenName,
) => {
await deployDepositVault(hre, mToken, 'dvUstb');
};

Expand Down
Loading
Loading