Skip to content

Commit

Permalink
feat: add FlashAngle deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
0xtekgrinder committed Nov 26, 2024
1 parent f88d770 commit 640959a
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/utils
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
},
"homepage": "https://github.com/AngleProtocol/angle-borrow#readme",
"devDependencies": {
"@angleprotocol/sdk": "1.0.4",
"@angleprotocol/sdk": "^2.31.10",
"@chainlink/contracts": "0.2.1",
"@nomicfoundation/hardhat-foundry": "^1.1.1",
"@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers",
Expand Down
30 changes: 30 additions & 0 deletions scripts/foundry/mainnet/angle/FlashAngle.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.12;

import "forge-std/Script.sol";
import { FlashAngle } from "../../../../contracts/flashloan/FlashAngle.sol";
import "lib/utils/src/CommonUtils.sol";

contract FlashAngleScript is Script, CommonUtils {
function run() external {
uint256 chainId = CHAIN_BASE;

uint256 deployerPrivateKey = vm.deriveKey(vm.envString("MNEMONIC_MAINNET"), 0);
vm.startBroadcast(deployerPrivateKey);

FlashAngle flashloanImpl = new FlashAngle();
console.log("FlashAngle implementation address: ", address(flashloanImpl));

address proxyAdmin = _chainToContract(chainId, ContractType.ProxyAdmin);
address coreBorrow = _chainToContract(chainId, ContractType.CoreBorrow);

console.log("ProxyAdmin address: ", proxyAdmin);
console.log("CoreBorrow address: ", coreBorrow);

bytes memory data = abi.encodeWithSelector(FlashAngle.initialize.selector, coreBorrow);
address proxy = address(new TransparentUpgradeableProxy(address(flashloanImpl), address(proxyAdmin), data));
console.log("FlashAngle proxy address: ", proxy);

vm.stopBroadcast();
}
}
5 changes: 2 additions & 3 deletions utils/forwardUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ if (process.argv.length < 3) {
const command = process.argv[2];
const extraArgs = process.argv.slice(3).join(' ');


exec(`node lib/utils/utils/${command}.js ${extraArgs}`, (error, stdout, stderr) => {
if (error) {
console.log(error);
return;
process.exit(1);
}
if (stderr) {
console.log(stderr);
return;
process.exit(1);
}
console.log(stdout);
});
67 changes: 63 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
# yarn lockfile v1


"@angleprotocol/sdk@1.0.4":
version "1.0.4"
resolved "https://npm.pkg.github.com/download/@angleprotocol/sdk/1.0.4/4e0c2a5c014fa9b4495276a5a0bdd7d0260e5404#4e0c2a5c014fa9b4495276a5a0bdd7d0260e5404"
integrity sha512-BgvdHqFj4rLonFBKPDQI8vZXDn0SPcR8Q967MfA2iTaxsQGrObTxe3rrwrPQhw1beKg/gR+B0TSvAo1XW/vFeQ==
"@angleprotocol/sdk@^2.31.10":
version "2.31.10"
resolved "https://npm.pkg.github.com/download/@angleprotocol/sdk/2.31.10/1d2bbb0b141367add9ffd4496e42bb826a9ebee3#1d2bbb0b141367add9ffd4496e42bb826a9ebee3"
integrity sha512-3YupcRiHJSrPb1HlFEv3aqgHla/rNxDeKmXB2pwWcNGdo6NzsUkZQCPcAHyPSKIpx26FNnmnq97ASbufv700CQ==
dependencies:
"@apollo/client" "^3.7.17"
"@typechain/ethers-v5" "^10.0.0"
"@types/lodash" "^4.14.180"
bun-types "^1.1.27"
class-transformer "^0.5.1"
class-validator "^0.14.1"
ethers "^5.6.4"
graphql "^15.7.1"
graphql-request "^3.6.1"
Expand Down Expand Up @@ -2124,6 +2127,13 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.66.tgz#dd035d409df322acc83dff62a602f12a5783bbb3"
integrity sha512-tktOkFUA4kXx2hhhrB8bIFb5TbwzS4uOhKEmwiD+NoiL0qtP2OQ9mFldbgD4dV1djrlBYP6eBuQZiWjuHUpqFw==

"@types/node@~20.12.8":
version "20.12.14"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.14.tgz#0c5cf7ef26aedfd64b0539bba9380ed1f57dcc77"
integrity sha512-scnD59RpYD91xngrQQLGkE+6UrHUPzeKZWhhjBSa3HSkwjbQc38+q3RoIVEwxQGRw3M+j5hpNAM+lgV3cVormg==
dependencies:
undici-types "~5.26.4"

"@types/pbkdf2@^3.0.0":
version "3.1.0"
resolved "https://registry.yarnpkg.com/@types/pbkdf2/-/pbkdf2-3.1.0.tgz#039a0e9b67da0cdc4ee5dab865caa6b267bb66b1"
Expand Down Expand Up @@ -2163,6 +2173,18 @@
dependencies:
"@types/node" "*"

"@types/validator@^13.11.8":
version "13.12.2"
resolved "https://registry.yarnpkg.com/@types/validator/-/validator-13.12.2.tgz#760329e756e18a4aab82fc502b51ebdfebbe49f5"
integrity sha512-6SlHBzUW8Jhf3liqrGGXyTJSIFe4nqlJ5A5KaMZ2l/vbM3Wh3KSybots/wfWVzNLK4D1NZluDlSQIbIEPx6oyA==

"@types/ws@~8.5.10":
version "8.5.13"
resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.13.tgz#6414c280875e2691d0d1e080b05addbf5cb91e20"
integrity sha512-osM/gWBTPKgHV8XkTunnegTRIsvF6owmf5w+JtAfOw472dptdm0dlGv4xCt6GwQRcC2XVOvvRE/0bAoQcL2QkA==
dependencies:
"@types/node" "*"

"@types/yargs-parser@*":
version "20.2.1"
resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-20.2.1.tgz#3b9ce2489919d9e4fea439b76916abc34b2df129"
Expand Down Expand Up @@ -3978,6 +4000,14 @@ buildcheck@~0.0.6:
resolved "https://registry.yarnpkg.com/buildcheck/-/buildcheck-0.0.6.tgz#89aa6e417cfd1e2196e3f8fe915eb709d2fe4238"
integrity sha512-8f9ZJCUXyT1M35Jx7MkBgmBMo3oHTTBIPLiY9xyL0pl3T5RwcPEY8cUHr5LBNfu/fk6c2T4DJZuVM/8ZZT2D2A==

bun-types@^1.1.27:
version "1.1.37"
resolved "https://registry.yarnpkg.com/bun-types/-/bun-types-1.1.37.tgz#8caab7fa0dd1490a368c5e4dd0614d500e15e7e9"
integrity sha512-C65lv6eBr3LPJWFZ2gswyrGZ82ljnH8flVE03xeXxKhi2ZGtFiO4isRKTKnitbSqtRAcaqYSR6djt1whI66AbA==
dependencies:
"@types/node" "~20.12.8"
"@types/ws" "~8.5.10"

[email protected]:
version "3.1.0"
resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6"
Expand Down Expand Up @@ -4344,6 +4374,11 @@ class-is@^1.1.0:
resolved "https://registry.yarnpkg.com/class-is/-/class-is-1.1.0.tgz#9d3c0fba0440d211d843cec3dedfa48055005825"
integrity sha512-rhjH9AG1fvabIDoGRVH587413LPjTZgmDF9fOFCbFJQV4yuocX1mHxxvXI4g3cGwbVY9wAYIoKlg1N79frJKQw==

class-transformer@^0.5.1:
version "0.5.1"
resolved "https://registry.yarnpkg.com/class-transformer/-/class-transformer-0.5.1.tgz#24147d5dffd2a6cea930a3250a677addf96ab336"
integrity sha512-SQa1Ws6hUbfC98vKGxZH3KFY0Y1lm5Zm0SY8XX9zbK7FJCyVEac3ATW0RIpwzW+oOfmHE5PMPufDG9hCfoEOMw==

class-utils@^0.3.5:
version "0.3.6"
resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463"
Expand All @@ -4354,6 +4389,15 @@ class-utils@^0.3.5:
isobject "^3.0.0"
static-extend "^0.1.1"

class-validator@^0.14.1:
version "0.14.1"
resolved "https://registry.yarnpkg.com/class-validator/-/class-validator-0.14.1.tgz#ff2411ed8134e9d76acfeb14872884448be98110"
integrity sha512-2VEG9JICxIqTpoK1eMzZqaV+u/EiwEJkMGzTrZf6sU/fwsnOITVgYJ8yojSy6CaXtO9V0Cc6ZQZ8h8m4UBuLwQ==
dependencies:
"@types/validator" "^13.11.8"
libphonenumber-js "^1.10.53"
validator "^13.9.0"

classic-level@^1.2.0:
version "1.4.1"
resolved "https://registry.yarnpkg.com/classic-level/-/classic-level-1.4.1.tgz#169ecf9f9c6200ad42a98c8576af449c1badbaee"
Expand Down Expand Up @@ -9089,6 +9133,11 @@ levn@^0.4.1:
prelude-ls "^1.2.1"
type-check "~0.4.0"

libphonenumber-js@^1.10.53:
version "1.11.15"
resolved "https://registry.yarnpkg.com/libphonenumber-js/-/libphonenumber-js-1.11.15.tgz#0947ba02208cf6c44fdf3b07e097a98b3ec945f4"
integrity sha512-M7+rtYi9l5RvMmHyjyoF3BHHUpXTYdJ0PezZGHNs0GyW1lO+K7jxlXpbdIb7a56h0nqLYdjIw+E+z0ciGaJP7g==

lines-and-columns@^1.1.6:
version "1.2.4"
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632"
Expand Down Expand Up @@ -13273,6 +13322,11 @@ underscore@^1.8.3:
resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.13.2.tgz#276cea1e8b9722a8dbed0100a407dda572125881"
integrity sha512-ekY1NhRzq0B08g4bGuX4wd2jZx5GnKz6mKSqFL4nqBlfyMGiG10gDFhDTMEfYmDL6Jy0FUIZp7wiRB+0BP7J2g==

undici-types@~5.26.4:
version "5.26.5"
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617"
integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==

undici@^5.14.0:
version "5.28.2"
resolved "https://registry.yarnpkg.com/undici/-/undici-5.28.2.tgz#fea200eac65fc7ecaff80a023d1a0543423b4c91"
Expand Down Expand Up @@ -13477,6 +13531,11 @@ validate-npm-package-license@^3.0.1:
spdx-correct "^3.0.0"
spdx-expression-parse "^3.0.0"

validator@^13.9.0:
version "13.12.0"
resolved "https://registry.yarnpkg.com/validator/-/validator-13.12.0.tgz#7d78e76ba85504da3fee4fd1922b385914d4b35f"
integrity sha512-c1Q0mCiPlgdTVVVIJIrBuxNicYE+t/7oKeI9MWLj3fh/uq2Pxh/3eeWbVZ4OcGW1TUf53At0njHw5SMdA3tmMg==

varint@^5.0.0:
version "5.0.2"
resolved "https://registry.yarnpkg.com/varint/-/varint-5.0.2.tgz#5b47f8a947eb668b848e034dcfa87d0ff8a7f7a4"
Expand Down

0 comments on commit 640959a

Please sign in to comment.