Skip to content

Commit 6bcb8d6

Browse files
authored
feat: update deployment scripts for v2 protocol (#77)
1 parent 63e9e6f commit 6bcb8d6

46 files changed

Lines changed: 1188 additions & 257 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@ Example:
4545
```bash
4646
anvil
4747
source .env.development # for a local anvil server # $ source .env for prod
48-
LOCK_STATE=$LOCK_STATE forge script script/Deployment.s.sol:Deployment --fork-url $RPC_URL --private-key $PRIVATE_KEY --broadcast -vvvvv
48+
yarn deploy:sepolia
4949
```

deployments/.gitkeep

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# This file ensures the deployments directory is tracked by git
2+
# Deployment JSON files will be saved here

deployments/README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Deployments Directory
2+
3+
This directory contains JSON files with deployment information for each network deployment.
4+
5+
## File Structure
6+
7+
### Timestamped Deployments
8+
9+
- `sepolia-1703123456.json` - Deployment on Sepolia at timestamp 1703123456
10+
- `mainnet-1703234567.json` - Deployment on Mainnet at timestamp 1703234567
11+
12+
### Latest Deployments
13+
14+
- `sepolia-latest.json` - Most recent Sepolia deployment
15+
- `mainnet-latest.json` - Most recent Mainnet deployment
16+
17+
## JSON Structure
18+
19+
Each deployment file contains:
20+
21+
```json
22+
{
23+
"deployer": "0x1234...",
24+
"chainId": 11155111,
25+
"blockNumber": 4567890,
26+
"timestamp": 1703123456,
27+
"network": "sepolia",
28+
"lockState": 0,
29+
"coreProtocolFee": 0,
30+
"invoiceProtocolFeeBPS": 0,
31+
"frendLendProtocolFeeBPS": 0,
32+
"adminAddress": "0x1234...",
33+
"bullaClaim": "0xabc123...",
34+
"bullaInvoice": "0xdef456...",
35+
"bullaFrendLend": "0x789ghi...",
36+
"controllerRegistry": "0xjkl012...",
37+
"whitelistPermissions": "0xmno345...",
38+
"approvalRegistry": "0xpqr678..."
39+
}
40+
```
41+
42+
## Usage
43+
44+
### Reading Latest Deployment
45+
46+
```bash
47+
# Get latest Sepolia deployment addresses
48+
cat deployments/sepolia-latest.json | jq '.bullaClaim'
49+
```
50+
51+
### Integration with Scripts
52+
53+
The deployment addresses can be easily imported into other scripts:
54+
55+
```javascript
56+
const deployment = require("./deployments/sepolia-latest.json");
57+
console.log("BullaClaim address:", deployment.bullaClaim);
58+
```
59+
60+
### Environment Variable Generation
61+
62+
```bash
63+
# Generate .env file from deployment
64+
node -e "
65+
const d = require('./deployments/sepolia-latest.json');
66+
console.log(\`BULLA_CLAIM_ADDRESS=\${d.bullaClaim}\`);
67+
console.log(\`BULLA_INVOICE_ADDRESS=\${d.bullaInvoice}\`);
68+
console.log(\`BULLA_FRENDLEND_ADDRESS=\${d.bullaFrendLend}\`);
69+
"
70+
```

lib/forge-std

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,11 @@
4949
"coverage": "forge coverage --report lcov && node -e \"const fs=require('fs'); const data=fs.readFileSync('lcov.info','utf8'); fs.writeFileSync('lcov.info', data.split('\\n').filter(line => !line.includes('SF:src/mocks/')).join('\\n'));\"",
5050
"prepare": "husky install",
5151
"prepublishOnly": "yarn build && yarn test",
52-
"semantic-release": "semantic-release"
52+
"semantic-release": "semantic-release",
53+
"deploy:sepolia": "cross-env NETWORK=sepolia forge script script/DeployContracts.s.sol:DeployContracts --rpc-url $SEPOLIA_RPC_URL --broadcast --private-key $PRIVATE_KEY --ffi"
5354
},
5455
"devDependencies": {
56+
"cross-env": "^7.0.3",
5557
"husky": "^7.0.0",
5658
"solidity-coverage": "^0.8.2",
5759
"toml": "^3.0.0",

0 commit comments

Comments
 (0)