Skip to content

Commit

Permalink
Aave swapper (#225)
Browse files Browse the repository at this point in the history
* feat: add aave swapper on ethereum

* feat: add space

* fix: remove comment
  • Loading branch information
sakulstra authored Aug 31, 2023
1 parent 8385484 commit bde6802
Show file tree
Hide file tree
Showing 69 changed files with 3,273 additions and 8 deletions.
2 changes: 1 addition & 1 deletion scripts/generator/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export enum ChainId {
polygon = 137,
mumbai = 80001,
avalanche = 43114,
fuji = 43113, // avalanche test network
fuji = 43113,
arbitrum_one = 42161,
arbitrum_goerli = 421613,
fantom = 250,
Expand Down
1 change: 1 addition & 0 deletions scripts/generator/miscGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ const miscAddresses: Addresses = {
type: 'address',
value: '0xc85b1E333aecc99340b2320493Fe2d22b8734795',
},
AAVE_SWAPPER_ETHEREUM: '0x3ea64b1C0194524b48F9118462C8E9cd61a243c7',
};

export function generateMisc() {
Expand Down
16 changes: 9 additions & 7 deletions scripts/generator/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,21 @@ export function addressInfoToSolidityLibraryConstant(
) {
if (typeof entry === 'object') {
if (entry.type === 'uint256') {
return `${entry.type} internal constant ${key} = ${entry.value};`;
return `${entry.type} internal constant ${key} = ${entry.value};\n`;
}
const blockExplorerLinkComment = getExplorerLink(entry.chainId || chainId, entry.value);
if (entry.type === 'address')
return `// ${blockExplorerLinkComment}\naddress internal constant ${key} = ${getAddress(
entry.value,
)};`;
)};\n`;
return `// ${blockExplorerLinkComment}\n${entry.type} internal constant ${key} = ${
entry.type
}(${getAddress(entry.value)});`;
}(${getAddress(entry.value)});\n`;
}
const blockExplorerLinkComment = getExplorerLink(chainId, entry);
return `// ${blockExplorerLinkComment}\naddress internal constant ${key} = ${getAddress(entry)};`;
return `// ${blockExplorerLinkComment}\naddress internal constant ${key} = ${getAddress(
entry,
)};\n`;
}

export function generateSolidityConstants({
Expand All @@ -62,16 +64,16 @@ export function generateSolidityConstants({
export function addressToJsConstant(chainId: ChainId, key: string, entry: AddressInfo) {
if (typeof entry === 'object') {
if (entry.type === 'uint256') {
return `export const ${key} = ${entry.value};`;
return `export const ${key} = ${entry.value};\n`;
}
const blockExplorerLinkComment = getExplorerLink(entry.chainId || chainId, entry.value);
return `// ${entry.type} ${blockExplorerLinkComment}\n export const ${key} = '${getAddress(
entry.value,
)}';`;
)}';\n`;
}

const blockExplorerLinkComment = getExplorerLink(chainId, entry);
return `// ${blockExplorerLinkComment}\nexport const ${key} = '${getAddress(entry)}';`;
return `// ${blockExplorerLinkComment}\nexport const ${key} = '${getAddress(entry)}';\n`;
}

export function generateJsConstants({
Expand Down
14 changes: 14 additions & 0 deletions src/AaveGovernanceV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,49 @@ import {IAaveGovernanceV2, IExecutorWithTimelock} from './common/IAaveGovernance
library AaveGovernanceV2 {
// https://etherscan.io/address/0xEC568fffba86c094cf06b22134B23074DFE2252c
address internal constant GOV = 0xEC568fffba86c094cf06b22134B23074DFE2252c;

// https://etherscan.io/address/0xb7e383ef9B1E9189Fc0F71fb30af8aa14377429e
address internal constant GOV_STRATEGY = 0xb7e383ef9B1E9189Fc0F71fb30af8aa14377429e;

// https://etherscan.io/address/0xEE56e2B3D491590B5b31738cC34d5232F378a8D5
address internal constant SHORT_EXECUTOR = 0xEE56e2B3D491590B5b31738cC34d5232F378a8D5;

// https://etherscan.io/address/0x79426A1c24B2978D90d7A5070a46C65B07bC4299
address internal constant LONG_EXECUTOR = 0x79426A1c24B2978D90d7A5070a46C65B07bC4299;

// https://etherscan.io/address/0xAce1d11d836cb3F51Ef658FD4D353fFb3c301218
address internal constant ARC_TIMELOCK = 0xAce1d11d836cb3F51Ef658FD4D353fFb3c301218;

// https://etherscan.io/address/0xdc9A35B16DB4e126cFeDC41322b3a36454B1F772
address internal constant POLYGON_BRIDGE_EXECUTOR = 0xdc9A35B16DB4e126cFeDC41322b3a36454B1F772;

// https://etherscan.io/address/0x7d9103572bE58FfE99dc390E8246f02dcAe6f611
address internal constant OPTIMISM_BRIDGE_EXECUTOR = 0x7d9103572bE58FfE99dc390E8246f02dcAe6f611;

// https://etherscan.io/address/0x7d9103572bE58FfE99dc390E8246f02dcAe6f611
address internal constant ARBITRUM_BRIDGE_EXECUTOR = 0x7d9103572bE58FfE99dc390E8246f02dcAe6f611;

// https://etherscan.io/address/0x8EC77963068474a45016938Deb95E603Ca82a029
address internal constant METIS_BRIDGE_EXECUTOR = 0x8EC77963068474a45016938Deb95E603Ca82a029;

// https://etherscan.io/address/0xA9F30e6ED4098e9439B2ac8aEA2d3fc26BcEbb45
address internal constant BASE_BRIDGE_EXECUTOR = 0xA9F30e6ED4098e9439B2ac8aEA2d3fc26BcEbb45;

// https://polygonscan.com/address/0x158a6bC04F0828318821baE797f50B0A1299d45b
address internal constant CROSSCHAIN_FORWARDER_POLYGON =
0x158a6bC04F0828318821baE797f50B0A1299d45b;

// https://explorer.optimism.io/address/0x5f5C02875a8e9B5A26fbd09040ABCfDeb2AA6711
address internal constant CROSSCHAIN_FORWARDER_OPTIMISM =
0x5f5C02875a8e9B5A26fbd09040ABCfDeb2AA6711;

// https://arbiscan.io/address/0xd1B3E25fD7C8AE7CADDC6F71b461b79CD4ddcFa3
address internal constant CROSSCHAIN_FORWARDER_ARBITRUM =
0xd1B3E25fD7C8AE7CADDC6F71b461b79CD4ddcFa3;

// https://andromeda-explorer.metis.io/address/0x2fE52eF191F0BE1D98459BdaD2F1d3160336C08f
address internal constant CROSSCHAIN_FORWARDER_METIS = 0x2fE52eF191F0BE1D98459BdaD2F1d3160336C08f;

// https://basescan.org/address/0x3215225538da1546FE0DA88ee13019f402078942
address internal constant CROSSCHAIN_FORWARDER_BASE = 0x3215225538da1546FE0DA88ee13019f402078942;
}
19 changes: 19 additions & 0 deletions src/AaveMisc.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,44 +8,63 @@ import {IStreamable} from './common/IStreamable.sol';
library AaveMisc {
// https://etherscan.io/address/0x25F2226B597E8F9514B3F68F00f494cF4f286491
address internal constant ECOSYSTEM_RESERVE = 0x25F2226B597E8F9514B3F68F00f494cF4f286491;

// https://etherscan.io/address/0x3d569673dAa0575c936c7c67c4E6AedA69CC630C
IAaveEcosystemReserveController internal constant AAVE_ECOSYSTEM_RESERVE_CONTROLLER =
IAaveEcosystemReserveController(0x3d569673dAa0575c936c7c67c4E6AedA69CC630C);

// https://etherscan.io/address/0xB4e496f70602fE2AC6Ae511D028BA4D194773B29
address internal constant TRANSPARENT_PROXY_FACTORY_ETHEREUM =
0xB4e496f70602fE2AC6Ae511D028BA4D194773B29;

// https://etherscan.io/address/0xD3cF979e676265e4f6379749DECe4708B9A22476
address internal constant PROXY_ADMIN_ETHEREUM = 0xD3cF979e676265e4f6379749DECe4708B9A22476;

// https://etherscan.io/address/0x86C3FfeE349A7cFf7cA88C449717B1b133bfb517
address internal constant PROXY_ADMIN_ETHEREUM_LONG = 0x86C3FfeE349A7cFf7cA88C449717B1b133bfb517;

// https://polygonscan.com/address/0xB4e496f70602fE2AC6Ae511D028BA4D194773B29
address internal constant TRANSPARENT_PROXY_FACTORY_POLYGON =
0xB4e496f70602fE2AC6Ae511D028BA4D194773B29;

// https://polygonscan.com/address/0xD3cF979e676265e4f6379749DECe4708B9A22476
address internal constant PROXY_ADMIN_POLYGON = 0xD3cF979e676265e4f6379749DECe4708B9A22476;

// https://snowtrace.io/address/0xB4e496f70602fE2AC6Ae511D028BA4D194773B29
address internal constant TRANSPARENT_PROXY_FACTORY_AVALANCHE =
0xB4e496f70602fE2AC6Ae511D028BA4D194773B29;

// https://snowtrace.io/address/0xD3cF979e676265e4f6379749DECe4708B9A22476
address internal constant PROXY_ADMIN_AVALANCHE = 0xD3cF979e676265e4f6379749DECe4708B9A22476;

// https://explorer.optimism.io/address/0xB4e496f70602fE2AC6Ae511D028BA4D194773B29
address internal constant TRANSPARENT_PROXY_FACTORY_OPTIMISM =
0xB4e496f70602fE2AC6Ae511D028BA4D194773B29;

// https://explorer.optimism.io/address/0xD3cF979e676265e4f6379749DECe4708B9A22476
address internal constant PROXY_ADMIN_OPTIMISM = 0xD3cF979e676265e4f6379749DECe4708B9A22476;

// https://arbiscan.io/address/0xB4e496f70602fE2AC6Ae511D028BA4D194773B29
address internal constant TRANSPARENT_PROXY_FACTORY_ARBITRUM =
0xB4e496f70602fE2AC6Ae511D028BA4D194773B29;

// https://arbiscan.io/address/0xD3cF979e676265e4f6379749DECe4708B9A22476
address internal constant PROXY_ADMIN_ARBITRUM = 0xD3cF979e676265e4f6379749DECe4708B9A22476;

// https://andromeda-explorer.metis.io/address/0x1dad86dC5990BCE5bFe3A150A4E0ece990d6EBcB
address internal constant TRANSPARENT_PROXY_FACTORY_METIS =
0x1dad86dC5990BCE5bFe3A150A4E0ece990d6EBcB;

// https://andromeda-explorer.metis.io/address/0x1CabD986cBAbDf12E00128DFf03C80ee62C4fd97
address internal constant PROXY_ADMIN_METIS = 0x1CabD986cBAbDf12E00128DFf03C80ee62C4fd97;

// https://basescan.org/address/0x05225Cd708bCa9253789C1374e4337a019e99D56
address internal constant TRANSPARENT_PROXY_FACTORY_BASE =
0x05225Cd708bCa9253789C1374e4337a019e99D56;

// https://basescan.org/address/0xc85b1E333aecc99340b2320493Fe2d22b8734795
address internal constant PROXY_ADMIN_BASE = 0xc85b1E333aecc99340b2320493Fe2d22b8734795;

// https://etherscan.io/address/0x3ea64b1C0194524b48F9118462C8E9cd61a243c7
address internal constant AAVE_SWAPPER_ETHEREUM = 0x3ea64b1C0194524b48F9118462C8E9cd61a243c7;
}
1 change: 1 addition & 0 deletions src/AaveSafetyModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ pragma solidity >=0.6.0;
library AaveSafetyModule {
// https://etherscan.io/address/0x4da27a545c0c5B758a6BA100e3a049001de870f5
address internal constant STK_AAVE = 0x4da27a545c0c5B758a6BA100e3a049001de870f5;

// https://etherscan.io/address/0xa1116930326D21fB917d5A27F1E9943A9595fb47
address internal constant STK_ABPT = 0xa1116930326D21fB917d5A27F1E9943A9595fb47;
}
Loading

0 comments on commit bde6802

Please sign in to comment.