@@ -45,14 +45,18 @@ abstract contract BaseMigration is ScriptExtended {
45
45
46
46
function loadContractOrDeploy (TContract contractType ) public virtual returns (address payable contractAddr ) {
47
47
string memory contractName = CONFIG.getContractName (contractType);
48
- try CONFIG. getAddressFromCurrentNetwork (contractType) returns (address payable addr ) {
48
+ try this . loadContract (contractType) returns (address payable addr ) {
49
49
contractAddr = addr;
50
50
} catch {
51
51
console.log (string .concat ("Deployment for " , contractName, " not found, try fresh deploy ... " ).yellow ());
52
52
contractAddr = _deployScript[contractType].run ();
53
53
}
54
54
}
55
55
56
+ function loadContract (TContract contractType ) public view virtual returns (address payable contractAddr ) {
57
+ return CONFIG.getAddressFromCurrentNetwork (contractType);
58
+ }
59
+
56
60
function overrideArgs (bytes memory args ) public virtual returns (IMigrationScript) {
57
61
_overriddenArgs = args;
58
62
return IMigrationScript (address (this ));
@@ -62,6 +66,10 @@ abstract contract BaseMigration is ScriptExtended {
62
66
args = _overriddenArgs.length == 0 ? _defaultArguments () : _overriddenArgs;
63
67
}
64
68
69
+ function _getProxyAdmin () internal view virtual returns (address payable proxyAdmin ) {
70
+ proxyAdmin = loadContract (DefaultContract.ProxyAdmin.key ());
71
+ }
72
+
65
73
function _deployImmutable (TContract contractType ) internal virtual returns (address payable deployed ) {
66
74
deployed = _deployImmutable (contractType, arguments ());
67
75
}
@@ -112,7 +120,7 @@ abstract contract BaseMigration is ScriptExtended {
112
120
address logic = _deployLogic (contractType);
113
121
string memory proxyAbsolutePath = "TransparentUpgradeableProxy.sol:TransparentUpgradeableProxy " ;
114
122
uint256 proxyNonce;
115
- address proxyAdmin = CONFIG. getAddressFromCurrentNetwork (DefaultContract.ProxyAdmin. key () );
123
+ address proxyAdmin = _getProxyAdmin ( );
116
124
assertTrue (proxyAdmin != address (0x0 ), "BaseMigration: Null ProxyAdmin " );
117
125
118
126
(deployed, proxyNonce) = _deployRaw (proxyAbsolutePath, abi.encode (logic, proxyAdmin, args));
0 commit comments