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

Create a deploy script in foundry script. #417

Merged
merged 215 commits into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
215 commits
Select commit Hold shift + click to select a range
e6cea0b
Create slither.yml
0xcodercrane Oct 25, 2022
294b747
move abdk to lib
0xcodercrane Oct 25, 2022
e187a79
upgrade solidity version
0xcodercrane Oct 25, 2022
acff758
update slither config
0xcodercrane Oct 25, 2022
c5259b1
add detectors to exclude list
0xcodercrane Oct 25, 2022
07139ae
Fix filter_path
0xcodercrane Oct 25, 2022
e95b4a8
wrong path
0xcodercrane Oct 25, 2022
29300d8
finalize
0xcodercrane Oct 25, 2022
ba490aa
delete out directory
0xcodercrane Oct 31, 2022
cac403e
Merge branch 'development' into integrate-slither
0xcodercrane Oct 31, 2022
1572a97
Merge branch 'development' into integrate-slither
0xcodercrane Nov 1, 2022
47a80d3
Remove unnecessary files
0xcodercrane Nov 7, 2022
9cbac83
remove dependencies for non-existing contracts
0xcodercrane Nov 8, 2022
5bca191
Revert due to dapp changes
0xcodercrane Nov 8, 2022
946a3ff
update slither config
0xcodercrane Nov 8, 2022
3d97e7c
fix unchecked-transfer issue
0xcodercrane Nov 8, 2022
1c23700
performs a multiplication on the result of division
0xcodercrane Nov 9, 2022
3e80a1a
fix too many digits and constant
0xcodercrane Nov 9, 2022
2863521
Update slither.config.json
0xcodercrane Nov 9, 2022
3578638
missing inheritance
0xcodercrane Nov 9, 2022
4bc145b
slither issues
hashedMae Dec 6, 2022
fe1631f
up to slither 204
hashedMae Dec 7, 2022
5883631
recheck slither
hashedMae Dec 7, 2022
91d5ebc
Merge branch 'development' into integrate-slither
0xcodercrane Dec 7, 2022
8a73a35
Merge branch 'Issue-284' of into integrate-slither
hashedMae Dec 7, 2022
5b26aca
Cleanup Slither Flags
hashedMae Dec 9, 2022
9645f0b
complilation errors
hashedMae Dec 9, 2022
c635e28
rentrancy, unitialized variables, return values
hashedMae Dec 9, 2022
28dbc7f
rentrancy in addLiquidity()
hashedMae Dec 9, 2022
fadfc84
gas savings in MCV2, reentrancy in CollectableDust
hashedMae Dec 10, 2022
d31f21e
gas optimization MCV2
hashedMae Dec 10, 2022
bc2a9e5
_updatePool outside loop
hashedMae Dec 10, 2022
22c0d85
Revert "_updatePool outside loop"
hashedMae Dec 10, 2022
5d004fa
fix tests
hashedMae Dec 10, 2022
a5e8435
Change Contract names to reflect Refactor
hashedMae Dec 13, 2022
5d4813f
Revert "Change Contract names to reflect Refactor"
hashedMae Dec 13, 2022
c3a1eb7
Revert "Revert "Change Contract names to reflect Refactor""
hashedMae Dec 13, 2022
536358c
Renamings
hashedMae Dec 13, 2022
a8a1248
renaming
hashedMae Dec 13, 2022
9aa94bd
Create slither.yml
0xcodercrane Oct 25, 2022
38fd06c
move abdk to lib
0xcodercrane Oct 25, 2022
96557c5
upgrade solidity version
0xcodercrane Oct 25, 2022
a356e3a
update slither config
0xcodercrane Oct 25, 2022
b57a421
add detectors to exclude list
0xcodercrane Oct 25, 2022
63bfc2a
Fix filter_path
0xcodercrane Oct 25, 2022
1ddc2ca
wrong path
0xcodercrane Oct 25, 2022
5274157
finalize
0xcodercrane Oct 25, 2022
583d094
Remove unnecessary files
0xcodercrane Nov 7, 2022
242f281
remove dependencies for non-existing contracts
0xcodercrane Nov 8, 2022
16f827a
Revert due to dapp changes
0xcodercrane Nov 8, 2022
5591034
update slither config
0xcodercrane Nov 8, 2022
70e5280
fix unchecked-transfer issue
0xcodercrane Nov 8, 2022
e01d5d8
performs a multiplication on the result of division
0xcodercrane Nov 9, 2022
c8f031b
Update slither.config.json
0xcodercrane Nov 9, 2022
c2cadd8
missing inheritance
0xcodercrane Nov 9, 2022
74de025
slither issues
hashedMae Dec 6, 2022
c8b41c4
up to slither 204
hashedMae Dec 7, 2022
54124d2
recheck slither
hashedMae Dec 7, 2022
6afff4d
Cleanup Slither Flags
hashedMae Dec 9, 2022
d763bd1
complilation errors
hashedMae Dec 9, 2022
518bcf4
rentrancy, unitialized variables, return values
hashedMae Dec 9, 2022
465df7b
gas savings in MCV2, reentrancy in CollectableDust
hashedMae Dec 10, 2022
d645dce
fix tests
hashedMae Dec 10, 2022
8fe382e
Change Contract names to reflect Refactor
hashedMae Dec 13, 2022
60a1e44
Revert "Change Contract names to reflect Refactor"
hashedMae Dec 13, 2022
f391de7
Revert "Revert "Change Contract names to reflect Refactor""
hashedMae Dec 13, 2022
851fdac
Renamings
hashedMae Dec 13, 2022
53a64db
renaming
hashedMae Dec 13, 2022
9212ca2
Merge branch 'integrate-slither' of https://github.com/ubiquity/ubiqu…
hashedMae Dec 13, 2022
7c2770f
rename refactor in progress
hashedMae Dec 13, 2022
00b0c65
finish name refactor
hashedMae Dec 15, 2022
d3137a9
json error
hashedMae Dec 15, 2022
1ce81bc
gas optimization contstructor
hashedMae Dec 15, 2022
3e235e9
bug fix
hashedMae Dec 15, 2022
683dabd
Slither ignore payable.call in CollectableDust
hashedMae Dec 15, 2022
8cdec03
slither-disable-next-line low-level-calls
hashedMae Dec 15, 2022
c02a7f5
solidity version, remove empty file
hashedMae Dec 15, 2022
e9ff916
fixed bug deploy scripts
hashedMae Dec 15, 2022
fba6bf1
same
hashedMae Dec 15, 2022
f859d04
again
hashedMae Dec 15, 2022
9fee120
build-test flow bugs
hashedMae Dec 15, 2022
90475df
build-test scripts bug
hashedMae Dec 15, 2022
68a5cdf
testFixes
hashedMae Dec 15, 2022
83557ae
Merge branch 'feat/406-protocol-deploy-script' into integrate-slither
0xcodercrane Dec 21, 2022
7251532
fix: resolve conflicts
0xcodercrane Dec 21, 2022
a317586
fix: slither issues
0xcodercrane Dec 21, 2022
2945297
fix: remove unused return
0xcodercrane Dec 21, 2022
3eb4ea3
fix: loop
0xcodercrane Dec 21, 2022
244f1aa
fix: uninitialized local
0xcodercrane Dec 21, 2022
030a7a3
fix: MUST revert
0xcodercrane Dec 21, 2022
87ad72f
Merge pull request #302 from ubiquity/integrate-slither
0xcodercrane Dec 21, 2022
0d6e022
fix: pr review easy adjustments
0x4007 Dec 22, 2022
5275c55
fix: "smart contract" is two words!
0x4007 Dec 22, 2022
9cfb1b1
fix(contracts): spelling
hashedMae Dec 22, 2022
b7e9a60
fix(dapp): deploy scripts contract name
hashedMae Dec 22, 2022
a7abdb7
fix(contracts): error capitalization
hashedMae Dec 22, 2022
93efb44
Merge pull request #424 from ubiquity/pr-302-follow-up
0x4007 Dec 22, 2022
6c22ab7
feat: solidity deployment script
hashedMae Jan 5, 2023
a54d804
feat: solidity scripting devlopment deploy
hashedMae Jan 6, 2023
584ff3f
feat: devlopment deploy twap fix
hashedMae Jan 9, 2023
53b4010
feat: deploy script
hashedMae Jan 9, 2023
a025238
Create slither.yml
0xcodercrane Oct 25, 2022
199a04d
move abdk to lib
0xcodercrane Oct 25, 2022
f1ecfce
upgrade solidity version
0xcodercrane Oct 25, 2022
a000f7f
update slither config
0xcodercrane Oct 25, 2022
152b80f
add detectors to exclude list
0xcodercrane Oct 25, 2022
b670d4a
Fix filter_path
0xcodercrane Oct 25, 2022
4c32cd8
wrong path
0xcodercrane Oct 25, 2022
ce9e3ad
finalize
0xcodercrane Oct 25, 2022
fafeb6f
Remove unnecessary files
0xcodercrane Nov 7, 2022
d429770
remove dependencies for non-existing contracts
0xcodercrane Nov 8, 2022
99075b9
Revert due to dapp changes
0xcodercrane Nov 8, 2022
ecaa922
update slither config
0xcodercrane Nov 8, 2022
e71aa79
fix unchecked-transfer issue
0xcodercrane Nov 8, 2022
182aafa
performs a multiplication on the result of division
0xcodercrane Nov 9, 2022
41cf8c8
Update slither.config.json
0xcodercrane Nov 9, 2022
3512536
missing inheritance
0xcodercrane Nov 9, 2022
ebf25bc
slither issues
hashedMae Dec 6, 2022
3787dcc
up to slither 204
hashedMae Dec 7, 2022
8886272
recheck slither
hashedMae Dec 7, 2022
c765817
Cleanup Slither Flags
hashedMae Dec 9, 2022
06dc9f8
complilation errors
hashedMae Dec 9, 2022
30ec3fd
rentrancy, unitialized variables, return values
hashedMae Dec 9, 2022
020981b
gas savings in MCV2, reentrancy in CollectableDust
hashedMae Dec 10, 2022
bf2551a
fix tests
hashedMae Dec 10, 2022
1831fb4
Change Contract names to reflect Refactor
hashedMae Dec 13, 2022
075871c
Renamings
hashedMae Dec 13, 2022
1c09d8c
renaming
hashedMae Dec 13, 2022
cb0f0f4
move abdk to lib
0xcodercrane Oct 25, 2022
2fb7eb1
upgrade solidity version
0xcodercrane Oct 25, 2022
1c23e87
update slither config
0xcodercrane Oct 25, 2022
a76d050
add detectors to exclude list
0xcodercrane Oct 25, 2022
696cc6f
Fix filter_path
0xcodercrane Oct 25, 2022
3584e8d
wrong path
0xcodercrane Oct 25, 2022
d64301c
finalize
0xcodercrane Oct 25, 2022
67198ab
delete out directory
0xcodercrane Oct 31, 2022
79739c5
Remove unnecessary files
0xcodercrane Nov 7, 2022
b9f456e
remove dependencies for non-existing contracts
0xcodercrane Nov 8, 2022
63026ad
Revert due to dapp changes
0xcodercrane Nov 8, 2022
f41a3c9
update slither config
0xcodercrane Nov 8, 2022
bd43429
fix unchecked-transfer issue
0xcodercrane Nov 8, 2022
2735174
Update slither.config.json
0xcodercrane Nov 9, 2022
24e6f4c
missing inheritance
0xcodercrane Nov 9, 2022
8af4e30
slither issues
hashedMae Dec 6, 2022
81d26da
fix tests
hashedMae Dec 10, 2022
2effa32
Change Contract names to reflect Refactor
hashedMae Dec 13, 2022
c6d24a6
Renamings
hashedMae Dec 13, 2022
f751a13
renaming
hashedMae Dec 13, 2022
71bb410
rename refactor in progress
hashedMae Dec 13, 2022
8f7b89f
finish name refactor
hashedMae Dec 15, 2022
29035c5
gas optimization contstructor
hashedMae Dec 15, 2022
13f4a93
bug fix
hashedMae Dec 15, 2022
17708f5
Slither ignore payable.call in CollectableDust
hashedMae Dec 15, 2022
774da10
slither-disable-next-line low-level-calls
hashedMae Dec 15, 2022
bfda33e
solidity version, remove empty file
hashedMae Dec 15, 2022
18bc02d
fixed bug deploy scripts
hashedMae Dec 15, 2022
466200c
same
hashedMae Dec 15, 2022
8ad5bdf
again
hashedMae Dec 15, 2022
4efce14
build-test flow bugs
hashedMae Dec 15, 2022
5d2b4ee
build-test scripts bug
hashedMae Dec 15, 2022
2a8ca19
testFixes
hashedMae Dec 15, 2022
236af92
fix: resolve conflicts
0xcodercrane Dec 21, 2022
a69f6e0
fix: slither issues
0xcodercrane Dec 21, 2022
b957217
fix: remove unused return
0xcodercrane Dec 21, 2022
65b6c1a
fix: loop
0xcodercrane Dec 21, 2022
8f6d541
fix: uninitialized local
0xcodercrane Dec 21, 2022
1c472ac
fix: MUST revert
0xcodercrane Dec 21, 2022
a78ec9f
fix: pr review easy adjustments
0x4007 Dec 22, 2022
95fe05c
fix: "smart contract" is two words!
0x4007 Dec 22, 2022
91a2dc5
fix(contracts): spelling
hashedMae Dec 22, 2022
035347f
fix(dapp): deploy scripts contract name
hashedMae Dec 22, 2022
1f9c525
fix(contracts): error capitalization
hashedMae Dec 22, 2022
86fb7b2
feat: solidity deployment script
hashedMae Jan 5, 2023
49f792f
feat: solidity scripting devlopment deploy
hashedMae Jan 6, 2023
986b3a1
feat: devlopment deploy twap fix
hashedMae Jan 9, 2023
25f7f40
feat: deploy script
hashedMae Jan 9, 2023
95d3e58
Merge branch 'feat/406-protocol-deploy-script' of https://github.com/…
hashedMae Jan 11, 2023
39d0e62
fix: rebase
hashedMae Jan 11, 2023
60af560
fix(UbiquityChef): slither
hashedMae Jan 11, 2023
a375900
fix(slither): constructors
hashedMae Jan 11, 2023
8d0ac5b
Update packages/contracts/src/dollar/core/CreditNFTManager.sol
hashedMae Jan 12, 2023
6d4d2bc
fix: variable name
hashedMae Jan 12, 2023
7a94780
fix(slither): immutable values
hashedMae Jan 12, 2023
dbddb32
Merge branch 'feat/406-protocol-deploy-script' of https://github.com/…
hashedMae Jan 12, 2023
6fc145f
fix: PR review changes
hashedMae Jan 12, 2023
bca8894
fix: bash and solidity script bugs
hashedMae Jan 12, 2023
767151f
feat: yarn workspace commands
hashedMae Jan 12, 2023
39e2d04
Update packages/contracts/src/dollar/core/TWAPOracleDollar3pool.sol
hashedMae Jan 16, 2023
65b03dd
feat: PR comments
hashedMae Jan 16, 2023
9fcec89
Merge branch 'feat/406-protocol-deploy-script' of https://github.com/…
hashedMae Jan 16, 2023
5285033
fix: natSpec comment typo
hashedMae Jan 16, 2023
df7f1b6
feat: remove bash script from package.json
hashedMae Jan 19, 2023
45e1701
Update package.json
hashedMae Jan 23, 2023
5215f31
Update packages/contracts/src/dollar/utils/SafeAddArray.sol
hashedMae Jan 23, 2023
66b6033
feat(deploy script): PR reccomendations
hashedMae Jan 23, 2023
03467be
Merge branch 'feat/406-protocol-deploy-script' of https://github.com/…
hashedMae Jan 23, 2023
7300928
feat(deployment script): change readme and anvil.ts
hashedMae Jan 23, 2023
754a657
fix(slither): error in SafeAddArrray.sol
hashedMae Jan 23, 2023
1e64040
fix(slither): error in SafeAddArrray.sol
hashedMae Jan 23, 2023
4569b88
fix(solidity scripts): review comments
hashedMae Jan 24, 2023
09cef80
fix(solidity scripting): pr comments
hashedMae Jan 24, 2023
2eb2153
fix(solidity scripting): pr comments
hashedMae Jan 24, 2023
c8f9b38
Merge https://github.com/ubiquity/ubiquity-dollar into feat/406-proto…
hashedMae Jan 24, 2023
fae018d
merge development into 406
hashedMae Jan 24, 2023
1b59552
Merge branch 'feat/406-protocol-deploy-script' of https://github.com/…
hashedMae Jan 24, 2023
7beb1a9
fix: contract dependency conflict
hashedMae Jan 25, 2023
9093296
fix: contract dependency conflict
hashedMae Jan 25, 2023
e46b26c
fix:broken tests
hashedMae Jan 25, 2023
cdffbf2
fix: failing tests
hashedMae Jan 25, 2023
4acace3
feat(solidity scripting): anvil use rpc list
hashedMae Jan 26, 2023
16ebb36
fix(slither): unchecked transfer
hashedMae Jan 27, 2023
4bc71b0
fix(slither): multiplication on result of division
hashedMae Jan 27, 2023
e351bab
fix(slither): multiplication on result of division
hashedMae Jan 27, 2023
3174952
fix: redundant code
hashedMae Jan 27, 2023
5291674
fix: staking
hashedMae Jan 31, 2023
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
38 changes: 38 additions & 0 deletions .github/workflows/slither.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Static Anaysis with Slither

on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Install solc-select
run: pip3 install solc-select

- name: Install solc 0.8.16
run: |
solc-select install 0.8.16
solc-select use 0.8.16

- name: Install Slither
run: pip3 install slither-analyzer

- name: Install dependencies
run: |
yarn install
yarn workspace @ubiquity/contracts forge install

- name: Test with Slither
run: yarn workspace @ubiquity/contracts run slither:run
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ contracts/dollar/tasks/library/distributor/fixtures/operators.json
fixtures/abi/types/
dist/
fixtures/contracts-addresses/*
packages/contracts/broadcast/*/*/*


.yarn
Expand All @@ -60,3 +61,4 @@ fixtures/contracts-addresses/*
cache
build
out
packages/contracts/broadcast/*
5 changes: 4 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
[submodule "packages/contracts/lib/forge-std"]
path = packages/contracts/lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "packages/contracts/lib/abdk-libraries-solidity"]
hashedMae marked this conversation as resolved.
Show resolved Hide resolved
path = packages/contracts/lib/abdk-libraries-solidity
url = https://github.com/abdk-consulting/abdk-libraries-solidity
[submodule "packages/contracts/lib/operator-filter-registry"]
path = packages/contracts/lib/operator-filter-registry
url = https://github.com/ProjectOpenSea/operator-filter-registry
url = https://github.com/ProjectOpenSea/operator-filter-registry
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,25 @@ Make sure you are using the following network configuration:
| m/44'/60'/0'/0/9 | 0x71454ff148c22f6D2Fc50C13aF0B702Aaa134189 | 0x3c82c68b4df60547a5fb926bf8d9513f4a6cf07604cb6429778ef6dce4eb48fb |
| m/44'/60'/0'/0/10 | 0x53e93feD0C06D78ec86cEfC58b619BD6B5F93Ade | 0x79c924066175ae04a3ef3cd88d293e1c2f7fd7a860c5ddb8f09077bd4225c757 |

---
### Ubiquity Dollar Contracts Setup

This section is for the Ubiquity Dollar core protocol smart contracts (not the UbiquiStick NFT or UI related code.)

You need to create `.env` file inside the contracts folder with 'RPC_URL', 'PRIVATE_KEY', 'ADMIN_ADDRESS', 'MNEMONIC', and 'CURVE_WHALE' all filled. 'PRIVATE_KEY' will be used to deploy locally and the matching 'ADMIN_ADDRESS' will be the admin on all the smart contracts. 'RPC_URL' and 'MNEMONIC' are used when launching Anvil and will ensure your `ADMIN_ADDRESS` account is funded.

The .env.example is prepopulated with the recommend test 'MNEMONIC', test 'PRIVATE_KEY', and test 'ADMIN_ADRESS'.

To start your local chain run

``` yarn workspace @ubiquity/contracts anvil ```
hashedMae marked this conversation as resolved.
Show resolved Hide resolved

If successful it will show a readout of accounts generated from `MNEMONIC` and the port it's listening on.

To deploy the contracts run

``` yarn workspace @ubiquity/contracts deploy:development ```

This will first impersonate the `CURVE_WHALE` and transfer some tokens so we can create a UbiquityDollar/3CRV pool, and then it will deploy the Ubiquity Dollar core protocol via a series of Solidity scripts via Forge.

Sine stabilitate nihil habemus.

16 changes: 14 additions & 2 deletions packages/contracts/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,19 @@
RPC_URL=

# Private key for deployer account
PRIVATE_KEY=
PRIVATE_KEY= "0x4454691749f69f1224e443731757b75005d0335d38cd3900d7f74e64625c6091"

# Public key for deployer account
PUBLIC_KEY= "0xa18E35a6E821AaDC80AFD132FFa72879f999F2fc"

# Used to verify contracts on etherscan. This is optional
ETHERSCAN_API_KEY=
ETHERSCAN_API_KEY=

# Mnemonic for deployer account
MNEMONIC = "upset concert service toy elephant spoil gun yellow girl provide click beauty"

# Holder of 3CRV tokens
CURVE_WHALE = "0x4486083589A063ddEF47EE2E4467B5236C508fDe"

# 3CRV Token address
USD3CRV_TOKEN = "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490"
5 changes: 4 additions & 1 deletion packages/contracts/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ tab_width = 2
line_length = 80
tab_width = 4
bracket_spacing = false
quote_style = 'double'
quote_style = 'double'

[rpc_endpoints]
mainnet = "${RPC_URL}"
1 change: 1 addition & 0 deletions packages/contracts/lib/abdk-libraries-solidity
1 change: 1 addition & 0 deletions packages/contracts/lib/v3-periphery
Submodule v3-periphery added at 80f26c
9 changes: 7 additions & 2 deletions packages/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
"dependencies": {
"@types/command-line-args": "5.2.0",
"command-line-args": "5.2.1",
"dotenv": "^16.0.0",
"dotenv": "^16.0.3",
"ethers": "^5.6.9",
"react-transition-group": "^4.4.5",
"tsx": "^3.12.2"
},
"scripts": {
Expand All @@ -31,7 +32,9 @@
"deploy:diamond": "tsx ./scripts/deploy/manager/DiamondInAll.ts",
"task": "tsx ./scripts/task/task.ts",
"clean": "forge clean",
"purge": "yarn clean"
"purge": "yarn clean",
"anvil": "tsx ./scripts/anvil/anvil.ts",
"deploy:development": "tsx ./scripts/deploy/dollar/DevelopmentDeploy.ts"
},
"keywords": [
"stablecoin",
Expand Down Expand Up @@ -60,6 +63,8 @@
},
"devDependencies": {
"@types/node": "^18.11.18",
"@types/react-transition-group": "^4",
"cspell": "latest",
"typescript": "^4.9.4"
}
}
1 change: 1 addition & 0 deletions packages/contracts/remappings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ ds-test/=lib/forge-std/lib/ds-test/src/
solidity-linked-list/=lib/solidity-linked-list
@uniswap/v2-core/contracts/=lib/Uniswap/v2-core/contracts
@uniswap/v2-periphery/contracts/=lib/Uniswap/v2-periphery/contracts
abdk/=lib/abdk-libraries-solidity/
28 changes: 28 additions & 0 deletions packages/contracts/scripts/anvil/anvil.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { spawn } from "child_process";
import { loadEnv } from "../shared";
import { RETRY_COUNT, RETRY_DELAY, TEST_PATTERN } from "../runner/conf";
import { getRPC } from "../runner/rpcutil";
import fs from "fs";
import path from "path";

let optimalRPC;

const getUrl = async () => {
const envPath = path.join(__dirname, "/../../.env");

const env = loadEnv(envPath);

return env.rpcUrl;
};

(async () => {
optimalRPC = await getUrl();
if (optimalRPC == "http://localhost:8545") {
optimalRPC = (await getRPC()).toString();
}
console.log(`using ${optimalRPC} for anvil...`);
const command = spawn("anvil", ["-f", optimalRPC as string, "-m", "test test test test test test test test test test test junk", "--chain-id", "31337"]);
command.stdout.on("data", (output: any) => {
console.log(output.toString());
});
})();
76 changes: 76 additions & 0 deletions packages/contracts/scripts/deploy/dollar/DevelopmentDeploy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import { spawnSync } from "child_process";
import { loadEnv } from "../../shared";
import fs from "fs";
import path from "path";
import axios from "axios";

const envPath = path.join(__dirname, "../../../.env");
if (!fs.existsSync(envPath)) {
throw new Error("Env file not found");
}
const env = loadEnv(envPath);

const curveWhale = env.curveWhale as string;
const adminAddress = env.adminAddress as string;
const _3CRV = env._3CRV as string;

const impersonateAccount = async () => {
console.log("----------------------------------------------------------------");
console.log("Impersonating 'CURVE_WHALE' account");
console.log("----------------------------------------------------------------");
spawnSync("cast", ["rpc", "anvil_impersonateAccount", curveWhale, "-r", "http://localhost:8545"], {
stdio: "inherit",
});
};

const sendTokens = async () => {
console.log("----------------------------------------------------------------");
console.log("Sending 10,000 3CRV LP tokens to 'ADMIN_ADDRESS'");
console.log("----------------------------------------------------------------");
spawnSync(
"cast",
[
"send",
_3CRV,
"transfer(address, uint256)",
adminAddress,
"10000000000000000000000", //10,000e18
"--from",
curveWhale,
],
{
stdio: "inherit",
}
);
};

const stopImpersonatingAccount = async () => {
console.log("----------------------------------------------------------------");
console.log("Ending account impersonation");
console.log("----------------------------------------------------------------");
spawnSync("cast", ["rpc", "anvil_stopImpersonatingAccount", curveWhale, "-r", "http://localhost:8545"], {
stdio: "inherit",
});
};

const forgeScript = async () => {
console.log("----------------------------------------------------------------");
console.log("Running Solidity script");
console.log("----------------------------------------------------------------");
spawnSync(
"forge",
["script", "scripts/deploy/dollar/solidityScripting/08_DevelopmentDeploy.s.sol:DevelopmentDeploy", "--fork-url", "http://localhost:8545", "--broadcast"],
{
stdio: "inherit",
}
);
hashedMae marked this conversation as resolved.
Show resolved Hide resolved
};

const main = async () => {
await impersonateAccount();
await sendTokens();
await stopImpersonatingAccount();
await forgeScript();
};

main();
Loading