@boostxyz/cli 1.1.0-alpha.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -0
- package/README.md +162 -0
- package/dist/cli.cjs +27 -0
- package/dist/cli.js +99 -0
- package/dist/commands/deploy.cjs +1 -0
- package/dist/commands/deploy.js +10141 -0
- package/dist/commands/seed.cjs +2 -0
- package/dist/commands/seed.js +947 -0
- package/dist/index.cjs +1 -0
- package/dist/index.js +9 -0
- package/dist/utils-D0bdHF2y.js +64 -0
- package/dist/utils-DX4pZJ98.cjs +3 -0
- package/package.json +56 -0
package/README.md
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# `@boostxyz/cli`
|
|
2
|
+
|
|
3
|
+
A command line interface simplifying Boost protocol deployment, and Boost creation.
|
|
4
|
+
|
|
5
|
+
- [Features](#features)
|
|
6
|
+
- [Installation](#installation)
|
|
7
|
+
- [Via Package Manager](#via-package-manager)
|
|
8
|
+
- [Manual Installation](#manual-installation)
|
|
9
|
+
- [Usage](#usage)
|
|
10
|
+
- [Options](#options)
|
|
11
|
+
- [Contributing](#contributing)
|
|
12
|
+
- [Development Setup](#development-setup)
|
|
13
|
+
|
|
14
|
+
## Features
|
|
15
|
+
|
|
16
|
+
- Deploy Boost Protocol and register all valid base implementations
|
|
17
|
+
- Deploy and fund basic ERC20's to use with Boost budgets and incentives
|
|
18
|
+
- Generate Boost creation templates
|
|
19
|
+
- Create Boosts given JSON templates, with option to automatically mint and allocate funds to new or existing budgets
|
|
20
|
+
- Configurable, supports any Viem chain
|
|
21
|
+
- Secure, keys do not leave your machine
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
### Via Package Manager
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# npm
|
|
29
|
+
npm install -g @boostxyz/cli
|
|
30
|
+
npx boost --help
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Manual Installation
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
git clone https://github.com/boostxyz/boost-protocol.git
|
|
37
|
+
cd boost-protocol
|
|
38
|
+
pnpm install
|
|
39
|
+
turbo build --filter="./packages/cli"
|
|
40
|
+
npx boost seed generate
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Usage
|
|
44
|
+
|
|
45
|
+
Basic usage pattern:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# see the detailed help documentation
|
|
49
|
+
boost --help
|
|
50
|
+
|
|
51
|
+
# deploy the Boost Protocol to a local hardhat instance
|
|
52
|
+
boost deploy --privateKey="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" --chain="hardhat"
|
|
53
|
+
|
|
54
|
+
# generate a json template that can be used with `boost seed`
|
|
55
|
+
# if privateKey or mnemonic is supplied, your 0 address will be slotted into the requisite owner locations
|
|
56
|
+
boost seed generate --privateKey="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" --chain="hardhat"
|
|
57
|
+
|
|
58
|
+
# create boosts
|
|
59
|
+
boost seed PATH/TO/seed.json PATH/TO/another.json --privateKey="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" --chain="hardhat"
|
|
60
|
+
|
|
61
|
+
# deploy new erc20's that can be used with boosts and budgets
|
|
62
|
+
boost seed erc20 --privateKey="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" --chain="hardhat"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Options
|
|
66
|
+
|
|
67
|
+
| Option | Alias | Description | Default |
|
|
68
|
+
|--------|-------|-------------|---------|
|
|
69
|
+
| `--help` | `-h` | Show documentation | - |
|
|
70
|
+
| `--version` | `-v` | Show the current version number | - |
|
|
71
|
+
| `--chain` | - | Target a specific viem chain, ie hardhat, anvil, sepolia, base, etc. See https://github.com/wevm/viem/tree/main/src/chains/definitions for a list of valid names | - |
|
|
72
|
+
| `--privateKey` | - | Private key to derive account from to use for contract operations, see https://viem.sh/docs/accounts/local/privateKeyToAccount#generating-private-keys for more information | - |
|
|
73
|
+
| `--mnemonic` | - | Mnemonic to derive account from to use for contract operations, see https://viem.sh/docs/accounts/local/mnemonicToAccount#generating-private-keys for more information | - |
|
|
74
|
+
| `--rpcUrl` | - | Optional URL to provide to Viem http transport, will typically be specific to targeted chain | - |
|
|
75
|
+
| `--out` | - | Filepath to write result of command. Can be useful if used with `--format="env"` to write to a .env file | - |
|
|
76
|
+
| `--format` | - | Specify command output format, either env or json | env |
|
|
77
|
+
|
|
78
|
+
## Seeding
|
|
79
|
+
|
|
80
|
+
Here is an example seed template.
|
|
81
|
+
|
|
82
|
+
### Tips
|
|
83
|
+
- By default the owner, will be `test...junk`'s 0 account unless `--privateKey` or `--mnemonic` is provided.
|
|
84
|
+
- For `action` `signatures`, While you generally need to manually supply the byte selector, you have the option of supplying a plain english signature, which will be converted into the bytes selector for you when passed into the `seed` command.
|
|
85
|
+
- If you supply a `"shouldMintAndAllocate": true` to an ERC20 incentive, the seed command will automatically call `mint` on the referenced asset with the total amount required to allocate and fund the Boosts's budget, so make sure the `privateKey` or `mnemonic` option is correctly supplied to make this call.
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"protocolFee": 0,
|
|
90
|
+
"maxParticipants": 10,
|
|
91
|
+
"budget": {
|
|
92
|
+
"type": "ManagedBudget",
|
|
93
|
+
"owner": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
|
|
94
|
+
"authorized": [
|
|
95
|
+
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
|
|
96
|
+
],
|
|
97
|
+
"roles": [
|
|
98
|
+
1
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
"action": {
|
|
102
|
+
"type": "EventAction",
|
|
103
|
+
"actionClaimant": {
|
|
104
|
+
"signatureType": 1,
|
|
105
|
+
"signature": "function mint(address to, uint256 amount)", // This will be converted into a bytes selector for you
|
|
106
|
+
"fieldIndex": 0,
|
|
107
|
+
"targetContract": "0x0000000000000000000000000000000000000000",
|
|
108
|
+
"chainid": 31337
|
|
109
|
+
},
|
|
110
|
+
"actionSteps": [
|
|
111
|
+
{
|
|
112
|
+
"signature": "event Minted(address to, uint256 amount)",
|
|
113
|
+
"signatureType": 1,
|
|
114
|
+
"actionType": 0,
|
|
115
|
+
"targetContract": "0x0000000000000000000000000000000000000000",
|
|
116
|
+
"chainid": 31337,
|
|
117
|
+
"actionParameter": {
|
|
118
|
+
"filterType": 0,
|
|
119
|
+
"fieldType": 1,
|
|
120
|
+
"fieldIndex": 0,
|
|
121
|
+
"filterData": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
},
|
|
126
|
+
"validator": {
|
|
127
|
+
"type": "SignerValidator",
|
|
128
|
+
"signers": [
|
|
129
|
+
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
|
|
130
|
+
],
|
|
131
|
+
"validatorCaller": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
|
|
132
|
+
},
|
|
133
|
+
"allowList": {
|
|
134
|
+
"type": "SimpleDenyList",
|
|
135
|
+
"owner": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
|
|
136
|
+
"denied": []
|
|
137
|
+
},
|
|
138
|
+
"incentives": [
|
|
139
|
+
{
|
|
140
|
+
"type": "ERC20Incentive",
|
|
141
|
+
"asset": "0xf3B2d0E4f2d8F453DBCc278b10e88b20d7f19f8D", // By default, this is STAGING https://sepolia.etherscan.io/token/0xf3B2d0E4f2d8F453DBCc278b10e88b20d7f19f8D
|
|
142
|
+
"shouldMintAndAllocate": true, // if set to true, will call `mint` on the referenced asset with the total amount required to fund this Boosts's budget.
|
|
143
|
+
"strategy": 0,
|
|
144
|
+
"reward": 1,
|
|
145
|
+
"limit": 1,
|
|
146
|
+
"manager": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
|
|
147
|
+
}
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Contributing
|
|
153
|
+
|
|
154
|
+
Contributions are welcome! Please read our [Contributing Guide](../../.github/CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.
|
|
155
|
+
|
|
156
|
+
### Development Setup
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
git clone https://github.com/boostxyz/boost-protocol.git
|
|
160
|
+
cd boost-protocol
|
|
161
|
+
pnpm install
|
|
162
|
+
```
|
package/dist/cli.cjs
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";const c=require("node:fs/promises"),s=require("node:path"),w=require("/home/runner/work/boost-protocol/boost-protocol/node_modules/.pnpm/arg@5.0.2/node_modules/arg/index.js"),d=require("./index.cjs"),a=require("./utils-DX4pZJ98.cjs"),b="2.0.0-alpha.33",S="1.1.0-alpha.34",h=`
|
|
3
|
+
Deploy Boost Protocol V2, and retrieve base implementation addresses.
|
|
4
|
+
|
|
5
|
+
Usage: boost <COMMAND>
|
|
6
|
+
|
|
7
|
+
Commands:
|
|
8
|
+
deploy Deploy a new version of the protocol
|
|
9
|
+
seed generate Generate a new basic Boost seed
|
|
10
|
+
seed erc20 Deploys a new ERC20
|
|
11
|
+
seed seed.json [...] Create Boosts using JSON configuration files generable by \`seed generate\`.
|
|
12
|
+
You can pass as many file paths as needed, and each will be validated before any operations occur.
|
|
13
|
+
Budgets can be automatically funded based on the incentives configuration, using accounts derived from a configured private key or mnemonic.
|
|
14
|
+
|
|
15
|
+
Options:
|
|
16
|
+
-h, --help Print help
|
|
17
|
+
-v, --version Print version
|
|
18
|
+
|
|
19
|
+
--chain Viem chain name, see https://github.com/wevm/viem/tree/main/src/chains/definitions for a list of valid names
|
|
20
|
+
--privateKey Private key to derive account from to use for contract operations, see https://viem.sh/docs/accounts/local/privateKeyToAccount#generating-private-keys for more information
|
|
21
|
+
--mnemonic Mnemonic to derive account from to use for contract operations, see https://viem.sh/docs/accounts/local/mnemonicToAccount#generating-private-keys for more information
|
|
22
|
+
--rpcUrl Optional URL to provide to Viem http transport
|
|
23
|
+
--out Path to file to output command results
|
|
24
|
+
--cacheDir Path to artifact cache directory
|
|
25
|
+
--force Bypass cache for given command and configuration, re-running any tasks and re-generating cache artifacts
|
|
26
|
+
--format Specify command output format, either env or json
|
|
27
|
+
`;BigInt.prototype.toJSON=function(){return Number(this)};const l=w({"--help":Boolean,"--version":Boolean,"--chain":String,"--privateKey":String,"--mnemonic":String,"--rpcUrl":String,"--out":String,"--cacheDir":String,"--force":Boolean,"--format":String,"--from":String,"-h":"--help","-v":"--version"});async function D(){var u,f,p;const{_:r,...o}=l,i=r.at(0);if(l["--version"])return console.log(S),0;if(l["--help"])return console.log(h),0;if(!i||!d.commands[i])return console.log(h),127;const e={help:o["--help"],version:o["--version"],chain:o["--chain"],privateKey:o["--privateKey"],mnemonic:o["--mnemonic"],rpcUrl:o["--rpcUrl"],out:o["--out"],cacheDir:o["--cacheDir"],force:o["--force"],format:o["--format"]};e.format||(e.format="env");const v=(u=e.cacheDir)!=null&&u.startsWith("./")?s.resolve(process.cwd(),e.cacheDir):e.cacheDir||s.resolve(process.cwd(),"./.boost"),g=`${r.join("-")}-v${b.split(".").slice(0,2).join("-")}-${e.chain}-${e!=null&&e.privateKey?(f=e.privateKey)==null?void 0:f.slice(e.privateKey.length-5):((p=e.mnemonic)==null?void 0:p.split(" ").at(-1))||""}`,y=s.resolve(v,g);async function m(){const n=await d.commands[i](r.slice(1),e);return i==="seed"&&r.includes("generate")&&(e.format="json"),e.format==="env"?a.objectToEnv(n):JSON.stringify(n,null,2)}let t;if(e.force)t=await m();else try{t=await c.readFile(y,{encoding:"utf-8"});const n=a.validateJson(t);e.format==="json"&&n===!1&&(t=JSON.stringify(a.envToObject(t),null,2)),e.format==="env"&&n!==!1&&(t=a.objectToEnv(n))}catch(n){if(n instanceof Error&&n.message.includes("ENOENT"))t=await m();else throw n}if(typeof t==null)throw new Error("No result found after cache and command operations. This shouldn't happen.");e.out?(await c.mkdir(e.out,{recursive:!0}),await c.writeFile(e.out,t,{encoding:"utf8"}),console.log(`Succesfully wrote result to ${e.out}`)):console.log(t)}D().then((r=0)=>process.exit(r)).catch(r=>{console.error(r),process.exit(1)});
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import i from "node:fs/promises";
|
|
3
|
+
import s from "node:path";
|
|
4
|
+
import w from "/home/runner/work/boost-protocol/boost-protocol/node_modules/.pnpm/arg@5.0.2/node_modules/arg/index.js";
|
|
5
|
+
import { commands as u } from "./index.js";
|
|
6
|
+
import { v as b, e as S, o as h } from "./utils-D0bdHF2y.js";
|
|
7
|
+
const D = "2.0.0-alpha.33", B = "1.1.0-alpha.34", d = `
|
|
8
|
+
Deploy Boost Protocol V2, and retrieve base implementation addresses.
|
|
9
|
+
|
|
10
|
+
Usage: boost <COMMAND>
|
|
11
|
+
|
|
12
|
+
Commands:
|
|
13
|
+
deploy Deploy a new version of the protocol
|
|
14
|
+
seed generate Generate a new basic Boost seed
|
|
15
|
+
seed erc20 Deploys a new ERC20
|
|
16
|
+
seed seed.json [...] Create Boosts using JSON configuration files generable by \`seed generate\`.
|
|
17
|
+
You can pass as many file paths as needed, and each will be validated before any operations occur.
|
|
18
|
+
Budgets can be automatically funded based on the incentives configuration, using accounts derived from a configured private key or mnemonic.
|
|
19
|
+
|
|
20
|
+
Options:
|
|
21
|
+
-h, --help Print help
|
|
22
|
+
-v, --version Print version
|
|
23
|
+
|
|
24
|
+
--chain Viem chain name, see https://github.com/wevm/viem/tree/main/src/chains/definitions for a list of valid names
|
|
25
|
+
--privateKey Private key to derive account from to use for contract operations, see https://viem.sh/docs/accounts/local/privateKeyToAccount#generating-private-keys for more information
|
|
26
|
+
--mnemonic Mnemonic to derive account from to use for contract operations, see https://viem.sh/docs/accounts/local/mnemonicToAccount#generating-private-keys for more information
|
|
27
|
+
--rpcUrl Optional URL to provide to Viem http transport
|
|
28
|
+
--out Path to file to output command results
|
|
29
|
+
--cacheDir Path to artifact cache directory
|
|
30
|
+
--force Bypass cache for given command and configuration, re-running any tasks and re-generating cache artifacts
|
|
31
|
+
--format Specify command output format, either env or json
|
|
32
|
+
`;
|
|
33
|
+
BigInt.prototype.toJSON = function() {
|
|
34
|
+
return Number(this);
|
|
35
|
+
};
|
|
36
|
+
const c = w({
|
|
37
|
+
"--help": Boolean,
|
|
38
|
+
"--version": Boolean,
|
|
39
|
+
"--chain": String,
|
|
40
|
+
"--privateKey": String,
|
|
41
|
+
"--mnemonic": String,
|
|
42
|
+
"--rpcUrl": String,
|
|
43
|
+
"--out": String,
|
|
44
|
+
"--cacheDir": String,
|
|
45
|
+
"--force": Boolean,
|
|
46
|
+
"--format": String,
|
|
47
|
+
"--from": String,
|
|
48
|
+
"-h": "--help",
|
|
49
|
+
"-v": "--version"
|
|
50
|
+
});
|
|
51
|
+
async function K() {
|
|
52
|
+
var m, f, p;
|
|
53
|
+
const { _: r, ...o } = c, a = r.at(0);
|
|
54
|
+
if (c["--version"])
|
|
55
|
+
return console.log(B), 0;
|
|
56
|
+
if (c["--help"])
|
|
57
|
+
return console.log(d), 0;
|
|
58
|
+
if (!a || !u[a])
|
|
59
|
+
return console.log(d), 127;
|
|
60
|
+
const e = {
|
|
61
|
+
help: o["--help"],
|
|
62
|
+
version: o["--version"],
|
|
63
|
+
chain: o["--chain"],
|
|
64
|
+
privateKey: o["--privateKey"],
|
|
65
|
+
mnemonic: o["--mnemonic"],
|
|
66
|
+
rpcUrl: o["--rpcUrl"],
|
|
67
|
+
out: o["--out"],
|
|
68
|
+
cacheDir: o["--cacheDir"],
|
|
69
|
+
force: o["--force"],
|
|
70
|
+
format: o["--format"]
|
|
71
|
+
};
|
|
72
|
+
e.format || (e.format = "env");
|
|
73
|
+
const v = (m = e.cacheDir) != null && m.startsWith("./") ? s.resolve(process.cwd(), e.cacheDir) : e.cacheDir || s.resolve(process.cwd(), "./.boost"), g = `${r.join("-")}-v${D.split(".").slice(0, 2).join("-")}-${e.chain}-${e != null && e.privateKey ? (f = e.privateKey) == null ? void 0 : f.slice(e.privateKey.length - 5) : ((p = e.mnemonic) == null ? void 0 : p.split(" ").at(-1)) || ""}`, y = s.resolve(v, g);
|
|
74
|
+
async function l() {
|
|
75
|
+
const n = await u[a](r.slice(1), e);
|
|
76
|
+
return a === "seed" && r.includes("generate") && (e.format = "json"), e.format === "env" ? h(n) : JSON.stringify(n, null, 2);
|
|
77
|
+
}
|
|
78
|
+
let t;
|
|
79
|
+
if (e.force)
|
|
80
|
+
t = await l();
|
|
81
|
+
else
|
|
82
|
+
try {
|
|
83
|
+
t = await i.readFile(y, { encoding: "utf-8" });
|
|
84
|
+
const n = b(t);
|
|
85
|
+
e.format === "json" && n === !1 && (t = JSON.stringify(S(t), null, 2)), e.format === "env" && n !== !1 && (t = h(n));
|
|
86
|
+
} catch (n) {
|
|
87
|
+
if (n instanceof Error && n.message.includes("ENOENT"))
|
|
88
|
+
t = await l();
|
|
89
|
+
else throw n;
|
|
90
|
+
}
|
|
91
|
+
if (typeof t == null)
|
|
92
|
+
throw new Error(
|
|
93
|
+
"No result found after cache and command operations. This shouldn't happen."
|
|
94
|
+
);
|
|
95
|
+
e.out ? (await i.mkdir(e.out, { recursive: !0 }), await i.writeFile(e.out, t, { encoding: "utf8" }), console.log(`Succesfully wrote result to ${e.out}`)) : console.log(t);
|
|
96
|
+
}
|
|
97
|
+
K().then((r = 0) => process.exit(r)).catch((r) => {
|
|
98
|
+
console.error(r), process.exit(1);
|
|
99
|
+
});
|