diff --git a/.github/actions/setup-repo/action.yml b/.github/actions/setup-repo/action.yml index 1932a677..f4cadc0a 100644 --- a/.github/actions/setup-repo/action.yml +++ b/.github/actions/setup-repo/action.yml @@ -30,6 +30,6 @@ runs: - name: Install dependencies shell: bash - run: echo "//npm.pkg.github.com/:_authToken=$GH_REGISTRY_ACCESS_TOKEN" >> .npmrc && yarn install --frozen-lockfile --verbose && rm -f .npmrc + run: echo "//npm.pkg.github.com/:_authToken=$SDK_READ_ACCESS_TOKEN" >> .npmrc && yarn install --frozen-lockfile --verbose && rm -f .npmrc env: - GH_REGISTRY_ACCESS_TOKEN: ${{ inputs.registry-token }} + SDK_READ_ACCESS_TOKEN: ${{ inputs.registry-token }} diff --git a/.github/workflows/ci-deep.yml b/.github/workflows/ci-deep.yml index b6c37195..808ddba5 100644 --- a/.github/workflows/ci-deep.yml +++ b/.github/workflows/ci-deep.yml @@ -24,7 +24,7 @@ jobs: - name: Setup repo uses: ./.github/actions/setup-repo with: - registry-token: ${{ secrets.GH_REGISTRY_ACCESS_TOKEN }} + registry-token: ${{ secrets.SDK_READ_ACCESS_TOKEN }} - name: Install dependencies run: yarn install @@ -52,7 +52,7 @@ jobs: - name: Setup repo uses: ./.github/actions/setup-repo with: - registry-token: ${{ secrets.GH_REGISTRY_ACCESS_TOKEN }} + registry-token: ${{ secrets.SDK_READ_ACCESS_TOKEN }} - name: Install dependencies run: yarn install --frozen-lockfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aab03c80..934f25a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: - name: Setup repo uses: ./.github/actions/setup-repo with: - registry-token: ${{ secrets.GH_REGISTRY_ACCESS_TOKEN }} + registry-token: ${{ secrets.SDK_READ_ACCESS_TOKEN }} - name: Install dependencies run: yarn install @@ -48,7 +48,7 @@ jobs: - name: Setup repo uses: ./.github/actions/setup-repo with: - registry-token: ${{ secrets.GH_REGISTRY_ACCESS_TOKEN }} + registry-token: ${{ secrets.SDK_READ_ACCESS_TOKEN }} - name: Install dependencies run: yarn install --frozen-lockfile diff --git a/lib/utils b/lib/utils index 68f85f57..d4a8da34 160000 --- a/lib/utils +++ b/lib/utils @@ -1 +1 @@ -Subproject commit 68f85f572e730690e9ed0bd056eafcc6f85641f0 +Subproject commit d4a8da343cd8de28885ec5a2352d3be1cbd3b0ec diff --git a/package.json b/package.json index 8ec43360..27b6712f 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/scripts/foundry/mainnet/angle/FlashAngle.s.sol b/scripts/foundry/mainnet/angle/FlashAngle.s.sol new file mode 100644 index 00000000..64310daa --- /dev/null +++ b/scripts/foundry/mainnet/angle/FlashAngle.s.sol @@ -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(); + } +} \ No newline at end of file diff --git a/utils/forwardUtils.js b/utils/forwardUtils.js index 60e7e28a..971c4117 100755 --- a/utils/forwardUtils.js +++ b/utils/forwardUtils.js @@ -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); }); diff --git a/yarn.lock b/yarn.lock index 51bb7c24..7ff60462 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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" @@ -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" @@ -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" @@ -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" + bytes@3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6" @@ -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" @@ -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" @@ -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" @@ -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" @@ -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"