Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Added initial structure to deploy shuffle payload #23

Merged
merged 24 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "lib/aave-delivery-infrastructure"]
path = lib/aave-delivery-infrastructure
url = https://github.com/bgd-labs/aave-delivery-infrastructure
branch = feat/bridge-shuffle
branch = fix/aave-helpers-deploy-ccc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Raw diff

```json
{
"crossChainControllerImpl": {
"from": "0x28559c2F4B038b1E836fA419DCcDe7454d8Fe215",
"to": "0x92F4736b72D131D836B3e4d4C3C23fE53150Ce4d"
}
}
```
1 change: 1 addition & 0 deletions remappings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ aave-helpers/=lib/aave-delivery-infrastructure/lib/aave-helpers/src/
aave-address-book/=lib/aave-delivery-infrastructure/lib/aave-helpers/lib/aave-address-book/src/
adi/=lib/aave-delivery-infrastructure/src/contracts/
adi-scripts/=lib/aave-delivery-infrastructure/scripts/
adi-tests/=lib/aave-delivery-infrastructure/tests/


68 changes: 68 additions & 0 deletions reports/adi_add_shuffle_to_ccc_after.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"chainId": 1,
"crossChainControllerImpl": "0x92F4736b72D131D836B3e4d4C3C23fE53150Ce4d",
"forwarderAdaptersByChain": {
"1": {
"0x6cfbd2aA4691fc18B9C209bDd43DC3943C228FCf": "0x6cfbd2aA4691fc18B9C209bDd43DC3943C228FCf"
},
"10": {
"0x0e24524778fdc67f53eEf144b8cbf50261E930B3": "0xAE93BEa44dcbE52B625169588574d31e36fb3A67"
},
"100": {
"0x01dcb90Cf13b82Cde4A0BAcC655585a83Af3cCC1": "0xA806DA549FcB2B4912a7dFFE4c1aA7A1ed0Bd5C9",
"0x7238d75fD75bb936E83b75854c653F104Ce9c9d8": "0x3C06dce358add17aAf230f2234bCCC4afd50d090",
"0x8410d9BD353b420ebA8C48ff1B0518426C280FCC": "0x9b6f5ef589A3DD08670Dd146C11C4Fb33E04494F"
},
"1088": {
"0x6B3Dc800E7c813Db3fe8D0F30fDCaE636935dC14": "0xf41193E25408F652AF878c47E4401A01B5E4B682"
},
"137": {
"0x01dcb90Cf13b82Cde4A0BAcC655585a83Af3cCC1": "0x3e72665008dC237bdd91C04C10782Ed1987a4019",
"0x1562F1b2487F892BBA8Ef325aF054Fd157510a71": "0x853649f897383f89d8441346Cf26a9ed02720B02",
"0x8410d9BD353b420ebA8C48ff1B0518426C280FCC": "0x7FAE7765abB4c8f778d57337bB720d0BC53057e3",
"0xB7a6618df58626C3a122ABAFD6Ee63Af63f3Ef29": "0xe79757D55a1600eF28D816a893E78E9FCDE2019E"
},
"42161": {
"0x88d6D01e08d3e64513b15fD46528dBbA7d755883": "0xc8a2ADC4261c6b669CdFf69E717E77C9cFeB420d"
},
"43114": {
"0x01dcb90Cf13b82Cde4A0BAcC655585a83Af3cCC1": "0x617332a777780F546261247F621051d0b98975Eb",
"0x8410d9BD353b420ebA8C48ff1B0518426C280FCC": "0x10f02995a399C0dC0FaF29914220E9C1bCdE8640",
"0xB7a6618df58626C3a122ABAFD6Ee63Af63f3Ef29": "0x2b88C83727B0E290B76EB3F6133994fF81B7f355"
},
"534352": {
"0xA4dC3F123e1c601A19B3DC8382BB9311F678cafA": "0x3C06dce358add17aAf230f2234bCCC4afd50d090"
},
"56": {
"0x01dcb90Cf13b82Cde4A0BAcC655585a83Af3cCC1": "0x3F006299eC88985c18E6e885EeA29A49eC579882",
"0x8410d9BD353b420ebA8C48ff1B0518426C280FCC": "0xa5cc218513305221201f196760E9e64e9D49d98A",
"0xB7a6618df58626C3a122ABAFD6Ee63Af63f3Ef29": "0xAE93BEa44dcbE52B625169588574d31e36fb3A67"
},
"8453": {
"0xa5948b0ac79f72966dFFC5C13E44f6dfDD3D58A0": "0x7120b1f8e5b73c0C0DC99C6e52Fe4937E7EA11e0"
}
},
"receiverAdaptersByChain": {
"137": {
"0x01dcb90Cf13b82Cde4A0BAcC655585a83Af3cCC1": true,
"0x1562F1b2487F892BBA8Ef325aF054Fd157510a71": true,
"0x8410d9BD353b420ebA8C48ff1B0518426C280FCC": true,
"0xB7a6618df58626C3a122ABAFD6Ee63Af63f3Ef29": true
},
"43114": {
"0x01dcb90Cf13b82Cde4A0BAcC655585a83Af3cCC1": true,
"0x8410d9BD353b420ebA8C48ff1B0518426C280FCC": true,
"0xB7a6618df58626C3a122ABAFD6Ee63Af63f3Ef29": true
}
},
"receiverConfigs": {
"137": {
"requiredConfirmations": 3,
"validityTimestamp": 0
},
"43114": {
"requiredConfirmations": 2,
"validityTimestamp": 0
}
}
}
68 changes: 68 additions & 0 deletions reports/adi_add_shuffle_to_ccc_before.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"chainId": 1,
"crossChainControllerImpl": "0x28559c2F4B038b1E836fA419DCcDe7454d8Fe215",
"forwarderAdaptersByChain": {
"1": {
"0x6cfbd2aA4691fc18B9C209bDd43DC3943C228FCf": "0x6cfbd2aA4691fc18B9C209bDd43DC3943C228FCf"
},
"10": {
"0x0e24524778fdc67f53eEf144b8cbf50261E930B3": "0xAE93BEa44dcbE52B625169588574d31e36fb3A67"
},
"100": {
"0x01dcb90Cf13b82Cde4A0BAcC655585a83Af3cCC1": "0xA806DA549FcB2B4912a7dFFE4c1aA7A1ed0Bd5C9",
"0x7238d75fD75bb936E83b75854c653F104Ce9c9d8": "0x3C06dce358add17aAf230f2234bCCC4afd50d090",
"0x8410d9BD353b420ebA8C48ff1B0518426C280FCC": "0x9b6f5ef589A3DD08670Dd146C11C4Fb33E04494F"
},
"1088": {
"0x6B3Dc800E7c813Db3fe8D0F30fDCaE636935dC14": "0xf41193E25408F652AF878c47E4401A01B5E4B682"
},
"137": {
"0x01dcb90Cf13b82Cde4A0BAcC655585a83Af3cCC1": "0x3e72665008dC237bdd91C04C10782Ed1987a4019",
"0x1562F1b2487F892BBA8Ef325aF054Fd157510a71": "0x853649f897383f89d8441346Cf26a9ed02720B02",
"0x8410d9BD353b420ebA8C48ff1B0518426C280FCC": "0x7FAE7765abB4c8f778d57337bB720d0BC53057e3",
"0xB7a6618df58626C3a122ABAFD6Ee63Af63f3Ef29": "0xe79757D55a1600eF28D816a893E78E9FCDE2019E"
},
"42161": {
"0x88d6D01e08d3e64513b15fD46528dBbA7d755883": "0xc8a2ADC4261c6b669CdFf69E717E77C9cFeB420d"
},
"43114": {
"0x01dcb90Cf13b82Cde4A0BAcC655585a83Af3cCC1": "0x617332a777780F546261247F621051d0b98975Eb",
"0x8410d9BD353b420ebA8C48ff1B0518426C280FCC": "0x10f02995a399C0dC0FaF29914220E9C1bCdE8640",
"0xB7a6618df58626C3a122ABAFD6Ee63Af63f3Ef29": "0x2b88C83727B0E290B76EB3F6133994fF81B7f355"
},
"534352": {
"0xA4dC3F123e1c601A19B3DC8382BB9311F678cafA": "0x3C06dce358add17aAf230f2234bCCC4afd50d090"
},
"56": {
"0x01dcb90Cf13b82Cde4A0BAcC655585a83Af3cCC1": "0x3F006299eC88985c18E6e885EeA29A49eC579882",
"0x8410d9BD353b420ebA8C48ff1B0518426C280FCC": "0xa5cc218513305221201f196760E9e64e9D49d98A",
"0xB7a6618df58626C3a122ABAFD6Ee63Af63f3Ef29": "0xAE93BEa44dcbE52B625169588574d31e36fb3A67"
},
"8453": {
"0xa5948b0ac79f72966dFFC5C13E44f6dfDD3D58A0": "0x7120b1f8e5b73c0C0DC99C6e52Fe4937E7EA11e0"
}
},
"receiverAdaptersByChain": {
"137": {
"0x01dcb90Cf13b82Cde4A0BAcC655585a83Af3cCC1": true,
"0x1562F1b2487F892BBA8Ef325aF054Fd157510a71": true,
"0x8410d9BD353b420ebA8C48ff1B0518426C280FCC": true,
"0xB7a6618df58626C3a122ABAFD6Ee63Af63f3Ef29": true
},
"43114": {
"0x01dcb90Cf13b82Cde4A0BAcC655585a83Af3cCC1": true,
"0x8410d9BD353b420ebA8C48ff1B0518426C280FCC": true,
"0xB7a6618df58626C3a122ABAFD6Ee63Af63f3Ef29": true
}
},
"receiverConfigs": {
"137": {
"requiredConfirmations": 3,
"validityTimestamp": 0
},
"43114": {
"requiredConfirmations": 2,
"validityTimestamp": 0
}
}
}
2 changes: 1 addition & 1 deletion scripts/ccc/DeployCCC.s.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

import {BaseDeployerScript, Addresses} from '../BaseDeployerScript.sol';
import '../BaseDeployerScript.sol';
kyzia551 marked this conversation as resolved.
Show resolved Hide resolved
import {TransparentUpgradeableProxy} from 'solidity-utils/contracts/transparent-proxy/TransparentUpgradeableProxy.sol';
import {TransparentProxyFactory} from 'solidity-utils/contracts/transparent-proxy/TransparentProxyFactory.sol';
import 'adi-scripts/CCC/DeployCrossChainController.sol';
Expand Down
77 changes: 77 additions & 0 deletions scripts/payloads/ccc/shuffle/Base_Deploy_Shuffle_Update.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import '../../../BaseDeployerScript.sol';
import {CrossChainControllerUpgradeRev3} from 'adi/revisions/update_to_rev_3/CrossChainController.sol';
import {CrossChainControllerWithEmergencyModeUpgradeRev3} from 'adi/revisions/update_to_rev_3/CrossChainControllerWithEmergencyMode.sol';
import {CCCUpdateArgs} from 'aave-helpers/adi/BaseCCCUpdate.sol';

// Library to get the code of ccc revision 3 (shuffle)
sendra marked this conversation as resolved.
Show resolved Hide resolved
library CCCUpdateDeploymentHelper {
function getCCCImplCode(address emergencyOracle) internal pure returns (bytes memory) {
bytes memory cccImplCode = emergencyOracle == address(0)
? abi.encodePacked(type(CrossChainControllerUpgradeRev3).creationCode, abi.encode())
: abi.encodePacked(
type(CrossChainControllerWithEmergencyModeUpgradeRev3).creationCode,
abi.encode(emergencyOracle)
);

return cccImplCode;
}
}

/**
* @title Ethereum payload to update ccc with new shuffle mechanism
* @author BGD Labs @bgdlabs
* - Discussion:
* - Snapshot:
*/
abstract contract Base_Deploy_Shuffle_Update_Payload is BaseDeployerScript {
function _getShufflePayloadByteCode() internal virtual returns (bytes memory);

function CL_EMERGENCY_ORACLE() internal view virtual returns (address) {
return address(0);
}

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

function PAYLOAD_SALT() internal pure virtual returns (string memory) {
return 'CrossChainController Shuffle Update Payload';
}

function _deployPayload(
address crossChainController,
address proxyAdmin,
address crossChainControllerImpl
) internal returns (address) {
bytes memory payloadCode = abi.encodePacked(
_getShufflePayloadByteCode(),
abi.encode(
CCCUpdateArgs({
crossChainController: crossChainController,
proxyAdmin: proxyAdmin,
crossChainControllerImpl: crossChainControllerImpl
})
)
);

return _deployByteCode(payloadCode, PAYLOAD_SALT());
}

function _deployCrossChainControllerImpl() internal returns (address) {
bytes memory cccImplCode = CCCUpdateDeploymentHelper.getCCCImplCode(CL_EMERGENCY_ORACLE());

return _deployByteCode(cccImplCode, SALT());
}

function _execute(Addresses memory addresses) internal virtual override {
addresses.crossChainControllerImpl = _deployCrossChainControllerImpl();
_deployPayload(
addresses.crossChainController,
addresses.proxyAdmin,
addresses.crossChainControllerImpl
);
}
}
135 changes: 135 additions & 0 deletions scripts/payloads/ccc/shuffle/Network_Deployments.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import './Base_Deploy_Shuffle_Update.s.sol';
import '../../../../src/ccc_payloads/shuffle/ShuffleCCCUpdatePayload.sol';

contract Ethereum is Base_Deploy_Shuffle_Update_Payload {
function TRANSACTION_NETWORK() internal pure override returns (uint256) {
return ChainIds.ETHEREUM;
}

function _getShufflePayloadByteCode() internal pure override returns (bytes memory) {
return type(Ethereum_Add_Shuffle_to_CCC_Payload).creationCode;
}
}

contract Polygon is Base_Deploy_Shuffle_Update_Payload {
function CL_EMERGENCY_ORACLE() internal pure override returns (address) {
return 0xDAFA1989A504c48Ee20a582f2891eeB25E2fA23F;
}

function TRANSACTION_NETWORK() internal pure override returns (uint256) {
return ChainIds.POLYGON;
}

function _getShufflePayloadByteCode() internal pure override returns (bytes memory) {
return type(Polygon_Add_Shuffle_to_CCC_Payload).creationCode;
}
}

contract Avalanche is Base_Deploy_Shuffle_Update_Payload {
function CL_EMERGENCY_ORACLE() internal pure override returns (address) {
return 0x41185495Bc8297a65DC46f94001DC7233775EbEe;
}

function TRANSACTION_NETWORK() internal pure override returns (uint256) {
return ChainIds.AVALANCHE;
}

function _getShufflePayloadByteCode() internal pure override returns (bytes memory) {
return type(Avalanche_Add_Shuffle_to_CCC_Payload).creationCode;
}
}

contract Arbitrum is Base_Deploy_Shuffle_Update_Payload {
function TRANSACTION_NETWORK() internal pure override returns (uint256) {
return ChainIds.ARBITRUM;
}

function _getShufflePayloadByteCode() internal pure override returns (bytes memory) {
return type(Arbitrum_Add_Shuffle_to_CCC_Payload).creationCode;
}
}

contract Optimism is Base_Deploy_Shuffle_Update_Payload {
function TRANSACTION_NETWORK() internal pure override returns (uint256) {
return ChainIds.OPTIMISM;
}

function _getShufflePayloadByteCode() internal pure override returns (bytes memory) {
return type(Optimism_Add_Shuffle_to_CCC_Payload).creationCode;
}
}

contract Metis is Base_Deploy_Shuffle_Update_Payload {
function TRANSACTION_NETWORK() internal pure override returns (uint256) {
return ChainIds.METIS;
}

function _getShufflePayloadByteCode() internal pure override returns (bytes memory) {
return type(Metis_Add_Shuffle_to_CCC_Payload).creationCode;
}
}

contract Binance is Base_Deploy_Shuffle_Update_Payload {
function CL_EMERGENCY_ORACLE() internal pure override returns (address) {
return 0xcabb46FfB38c93348Df16558DF156e9f68F9F7F1;
}

function TRANSACTION_NETWORK() internal pure override returns (uint256) {
return ChainIds.BNB;
}

function _getShufflePayloadByteCode() internal pure override returns (bytes memory) {
return type(Binance_Add_Shuffle_to_CCC_Payload).creationCode;
}
}

contract Base is Base_Deploy_Shuffle_Update_Payload {
function TRANSACTION_NETWORK() internal pure override returns (uint256) {
return ChainIds.BASE;
}

function _getShufflePayloadByteCode() internal pure override returns (bytes memory) {
return type(Base_Add_Shuffle_to_CCC_Payload).creationCode;
}
}

contract Gnosis is Base_Deploy_Shuffle_Update_Payload {
function CL_EMERGENCY_ORACLE() internal pure override returns (address) {
return 0xF937ffAeA1363e4Fa260760bDFA2aA8Fc911F84D;
}

function TRANSACTION_NETWORK() internal pure override returns (uint256) {
return ChainIds.GNOSIS;
}

function _getShufflePayloadByteCode() internal pure override returns (bytes memory) {
return type(Gnosis_Add_Shuffle_to_CCC_Payload).creationCode;
}
}

contract Scroll is Base_Deploy_Shuffle_Update_Payload {
function TRANSACTION_NETWORK() internal pure override returns (uint256) {
return ChainIds.SCROLL;
}

function _getShufflePayloadByteCode() internal pure override returns (bytes memory) {
return type(Scroll_Add_Shuffle_to_CCC_Payload).creationCode;
}
}

contract Celo is Base_Deploy_Shuffle_Update_Payload {
function CL_EMERGENCY_ORACLE() internal pure override returns (address) {
return 0x91b21900E91CD302EBeD05E45D8f270ddAED944d;
}

function TRANSACTION_NETWORK() internal pure override returns (uint256) {
return ChainIds.CELO;
}

function _getShufflePayloadByteCode() internal pure override returns (bytes memory) {
return type(Celo_Add_Shuffle_to_CCC_Payload).creationCode;
}
}
Loading