Skip to content

Commit

Permalink
Merge pull request #84 from bgd-labs/fix/base-script
Browse files Browse the repository at this point in the history
fix: moved salt and deploy to base script
  • Loading branch information
kyzia551 authored Jun 13, 2024
2 parents f07f7a6 + 42095b3 commit 566e3fb
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
4 changes: 2 additions & 2 deletions scripts/Adapters/BaseAdapterScript.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ abstract contract BaseAdapterScript is BaseScript {
return 0;
}

function SALT() internal view virtual returns (string memory) {
function SALT() internal view override returns (string memory) {
return 'a.DI Adapter';
}

Expand Down Expand Up @@ -59,7 +59,7 @@ abstract contract BaseAdapterScript is BaseScript {

bytes memory adapterCode = _getAdapterByteCode(currentNetworkCCC);

return Create2Utils.create2Deploy(keccak256(abi.encode(SALT())), adapterCode);
return _deployByteCode(adapterCode);
}

function _getTrustedRemotes() internal view returns (IBaseAdapter.TrustedRemotesConfig[] memory) {
Expand Down
8 changes: 8 additions & 0 deletions scripts/BaseScript.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,12 @@ import {Create2Utils} from 'aave-helpers/ScriptUtils.sol';

abstract contract BaseScript {
function TRANSACTION_NETWORK() internal view virtual returns (uint256);

function SALT() internal view virtual returns (string memory) {
return 'Aave Deliviery Infrastructure';
}

function _deployByteCode(bytes memory byteCode) internal virtual returns (address) {
return Create2Utils.create2Deploy(keccak256(abi.encode(SALT())), byteCode);
}
}
4 changes: 2 additions & 2 deletions scripts/CCC/DeployCrossChainController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ abstract contract BaseCCCDeploy is BaseScript {
return address(0);
}

function SALT() internal view virtual returns (string memory) {
function SALT() internal pure override returns (string memory) {
return 'a.DI CrossChainController';
}

function _deployCCCImpl() internal returns (address) {
bytes memory cccCode = CCCImplDeploymentHelper.getCCCImplCode(CL_EMERGENCY_ORACLE());

return Create2Utils.create2Deploy(keccak256(abi.encode(SALT())), cccCode);
return _deployByteCode(cccCode);
}
}
4 changes: 2 additions & 2 deletions scripts/access_control/Deploy_Granular_CCC_Guardian.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ abstract contract BaseDeployGranularGuardian is BaseScript {

function SOLVE_EMERGENCY_GUARDIAN() internal view virtual returns (address);

function SALT() internal view virtual returns (string memory) {
function SALT() internal pure override returns (string memory) {
return 'a.DI GranularGuardian';
}

Expand All @@ -41,6 +41,6 @@ abstract contract BaseDeployGranularGuardian is BaseScript {
crossChainController
);

return Create2Utils.create2Deploy(keccak256(abi.encode(SALT())), ggCode);
return _deployByteCode(ggCode);
}
}
5 changes: 2 additions & 3 deletions scripts/emergency/Deploy_EmergencyRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ abstract contract BaseDeployEmergencyMode is BaseScript {
return address(msg.sender);
}

function SALT() internal view virtual returns (string memory) {
function SALT() internal pure override returns (string memory) {
return 'a.DI EmergencyRegistry';
}

function _deployEmergencyRegistry() internal returns (address) {
bytes memory erCode = EmergencyRegistryDeploymentHelper.getEmergencyRegistryCode();

return Create2Utils.create2Deploy(keccak256(abi.encode(SALT())), erCode);
return _deployByteCode(erCode);
}
}

0 comments on commit 566e3fb

Please sign in to comment.