@sherwoodagent/cli 0.41.0 → 0.41.5
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/dist/{abis-TXCLIR2K.js → abis-RGCO5GHC.js} +2 -2
- package/dist/{addresses-JBIU5U3T.js → addresses-RQ7DTIBS.js} +4 -4
- package/dist/{agent-XBYSALOA.js → agent-SXEV65ME.js} +8 -8
- package/dist/{chat-K4LW776Q.js → chat-D5OF4OTL.js} +9 -9
- package/dist/{chunk-IJG4CTOI.js → chunk-2YOXRATG.js} +2 -2
- package/dist/{chunk-WCBG44IQ.js → chunk-4EHI4SKM.js} +25 -1
- package/dist/chunk-4EHI4SKM.js.map +1 -0
- package/dist/{chunk-DSH4G5NY.js → chunk-4QNPS5LI.js} +6 -6
- package/dist/{chunk-DNX3P5YK.js → chunk-D2UYGUV2.js} +2 -2
- package/dist/{chunk-W3GXAODE.js → chunk-D77JGXIV.js} +15 -1
- package/dist/chunk-D77JGXIV.js.map +1 -0
- package/dist/{chunk-5SRJJLHL.js → chunk-DG2K6CPY.js} +5 -5
- package/dist/{chunk-OFR3LCYE.js → chunk-M2NJPATE.js} +3 -3
- package/dist/{chunk-VMNB4ARO.js → chunk-MT3VS3GZ.js} +2 -2
- package/dist/{chunk-XENKMSE4.js → chunk-XZHIZVJ3.js} +7 -15
- package/dist/chunk-XZHIZVJ3.js.map +1 -0
- package/dist/{chunk-3356CHRT.js → chunk-YRCJ3NUX.js} +5 -5
- package/dist/{chunk-ZUAYDBG6.js → chunk-YYB4TF6D.js} +5 -5
- package/dist/{client-HKAG55PQ.js → client-VSBQM2LU.js} +4 -4
- package/dist/{config-LS7FKZL5.js → config-YRERDZSL.js} +2 -2
- package/dist/{eas-MFKUDVXP.js → eas-QNZKCEP7.js} +7 -7
- package/dist/{governor-Q57YKWO2.js → governor-RE6IJMUJ.js} +7 -7
- package/dist/index.js +245 -39
- package/dist/index.js.map +1 -1
- package/dist/{network-KSMKPKNL.js → network-R5NFPIAF.js} +3 -3
- package/dist/{price-B63EDNB2.js → price-GY3JQ2OK.js} +6 -6
- package/dist/research-PB22GPXC.js +14 -0
- package/dist/{research-K62TKFLF.js → research-SVWNPHIN.js} +9 -9
- package/dist/{session-2TBX4UTS.js → session-3Z6I2IM3.js} +11 -11
- package/dist/{trade-S3L2CNV4.js → trade-E5HSZE44.js} +17 -17
- package/dist/{xmtp-2AZ6H7DH.js → xmtp-VPGQE4IP.js} +7 -7
- package/package.json +1 -1
- package/dist/chunk-W3GXAODE.js.map +0 -1
- package/dist/chunk-WCBG44IQ.js.map +0 -1
- package/dist/chunk-XENKMSE4.js.map +0 -1
- package/dist/research-4UA4UB5P.js +0 -14
- /package/dist/{abis-TXCLIR2K.js.map → abis-RGCO5GHC.js.map} +0 -0
- /package/dist/{addresses-JBIU5U3T.js.map → addresses-RQ7DTIBS.js.map} +0 -0
- /package/dist/{agent-XBYSALOA.js.map → agent-SXEV65ME.js.map} +0 -0
- /package/dist/{chat-K4LW776Q.js.map → chat-D5OF4OTL.js.map} +0 -0
- /package/dist/{chunk-IJG4CTOI.js.map → chunk-2YOXRATG.js.map} +0 -0
- /package/dist/{chunk-DSH4G5NY.js.map → chunk-4QNPS5LI.js.map} +0 -0
- /package/dist/{chunk-DNX3P5YK.js.map → chunk-D2UYGUV2.js.map} +0 -0
- /package/dist/{chunk-5SRJJLHL.js.map → chunk-DG2K6CPY.js.map} +0 -0
- /package/dist/{chunk-OFR3LCYE.js.map → chunk-M2NJPATE.js.map} +0 -0
- /package/dist/{chunk-VMNB4ARO.js.map → chunk-MT3VS3GZ.js.map} +0 -0
- /package/dist/{chunk-3356CHRT.js.map → chunk-YRCJ3NUX.js.map} +0 -0
- /package/dist/{chunk-ZUAYDBG6.js.map → chunk-YYB4TF6D.js.map} +0 -0
- /package/dist/{client-HKAG55PQ.js.map → client-VSBQM2LU.js.map} +0 -0
- /package/dist/{config-LS7FKZL5.js.map → config-YRERDZSL.js.map} +0 -0
- /package/dist/{eas-MFKUDVXP.js.map → eas-QNZKCEP7.js.map} +0 -0
- /package/dist/{governor-Q57YKWO2.js.map → governor-RE6IJMUJ.js.map} +0 -0
- /package/dist/{network-KSMKPKNL.js.map → network-R5NFPIAF.js.map} +0 -0
- /package/dist/{price-B63EDNB2.js.map → price-GY3JQ2OK.js.map} +0 -0
- /package/dist/{research-4UA4UB5P.js.map → research-PB22GPXC.js.map} +0 -0
- /package/dist/{research-K62TKFLF.js.map → research-SVWNPHIN.js.map} +0 -0
- /package/dist/{session-2TBX4UTS.js.map → session-3Z6I2IM3.js.map} +0 -0
- /package/dist/{trade-S3L2CNV4.js.map → trade-E5HSZE44.js.map} +0 -0
- /package/dist/{xmtp-2AZ6H7DH.js.map → xmtp-VPGQE4IP.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
getQuote,
|
|
10
10
|
listModels,
|
|
11
11
|
provisionApiKey
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-XZHIZVJ3.js";
|
|
13
13
|
import {
|
|
14
14
|
createApproval,
|
|
15
15
|
createJoinRequest,
|
|
@@ -19,14 +19,14 @@ import {
|
|
|
19
19
|
queryJoinRequests,
|
|
20
20
|
revokeAttestation,
|
|
21
21
|
stripReferrerPrefix
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-DG2K6CPY.js";
|
|
23
23
|
import {
|
|
24
24
|
createSyndicate,
|
|
25
25
|
getActiveSyndicates,
|
|
26
26
|
getSyndicate,
|
|
27
27
|
subdomainExists,
|
|
28
28
|
updateMetadata
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-YRCJ3NUX.js";
|
|
30
30
|
import {
|
|
31
31
|
approveDepositor,
|
|
32
32
|
deposit,
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
resolveVaultSyndicate,
|
|
50
50
|
setTextRecord,
|
|
51
51
|
setVaultAddress
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-4QNPS5LI.js";
|
|
53
53
|
import {
|
|
54
54
|
PROPOSAL_STATE,
|
|
55
55
|
PROPOSAL_STATES,
|
|
@@ -81,7 +81,7 @@ import {
|
|
|
81
81
|
setVotingPeriod,
|
|
82
82
|
settleProposal,
|
|
83
83
|
vote
|
|
84
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-YYB4TF6D.js";
|
|
85
85
|
import {
|
|
86
86
|
AERODROME,
|
|
87
87
|
AGENT_REGISTRY,
|
|
@@ -94,7 +94,7 @@ import {
|
|
|
94
94
|
TOKENS,
|
|
95
95
|
UNISWAP,
|
|
96
96
|
VENICE
|
|
97
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-MT3VS3GZ.js";
|
|
98
98
|
import {
|
|
99
99
|
formatContractError,
|
|
100
100
|
getAccount,
|
|
@@ -103,7 +103,7 @@ import {
|
|
|
103
103
|
sendTxWithRetry,
|
|
104
104
|
waitForReceipt,
|
|
105
105
|
writeContractWithRetry
|
|
106
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-M2NJPATE.js";
|
|
107
107
|
import {
|
|
108
108
|
CHAIN_REGISTRY,
|
|
109
109
|
VALID_NETWORKS,
|
|
@@ -113,7 +113,7 @@ import {
|
|
|
113
113
|
getRpcUrl,
|
|
114
114
|
isTestnet,
|
|
115
115
|
setNetwork
|
|
116
|
-
} from "./chunk-
|
|
116
|
+
} from "./chunk-2YOXRATG.js";
|
|
117
117
|
import {
|
|
118
118
|
addSyndicate,
|
|
119
119
|
cacheGroupId,
|
|
@@ -136,7 +136,7 @@ import {
|
|
|
136
136
|
setPrivateKey,
|
|
137
137
|
setUniswapApiKey,
|
|
138
138
|
setVeniceApiKey
|
|
139
|
-
} from "./chunk-
|
|
139
|
+
} from "./chunk-4EHI4SKM.js";
|
|
140
140
|
import {
|
|
141
141
|
BASE_STRATEGY_ABI,
|
|
142
142
|
ERC20_ABI,
|
|
@@ -145,7 +145,7 @@ import {
|
|
|
145
145
|
SWAP_ROUTER_EXACT_INPUT_SINGLE_ABI,
|
|
146
146
|
SYNDICATE_VAULT_ABI,
|
|
147
147
|
VENICE_STAKING_ABI
|
|
148
|
-
} from "./chunk-
|
|
148
|
+
} from "./chunk-D77JGXIV.js";
|
|
149
149
|
import {
|
|
150
150
|
fetchMetadata,
|
|
151
151
|
uploadMetadata
|
|
@@ -155,7 +155,7 @@ import {
|
|
|
155
155
|
import { config as loadDotenv } from "dotenv";
|
|
156
156
|
import { createRequire } from "module";
|
|
157
157
|
import { Command, Option } from "commander";
|
|
158
|
-
import { parseUnits as
|
|
158
|
+
import { parseUnits as parseUnits6, formatUnits as formatUnits5, isAddress as isAddress6 } from "viem";
|
|
159
159
|
import chalk9 from "chalk";
|
|
160
160
|
import ora8 from "ora";
|
|
161
161
|
import { input, confirm, select } from "@inquirer/prompts";
|
|
@@ -1445,9 +1445,9 @@ function registerStrategyTemplateCommands(strategy2) {
|
|
|
1445
1445
|
console.error(chalk.red("Missing --name, --performance-fee, or --duration. Use --write-calls to skip proposal submission."));
|
|
1446
1446
|
process.exit(1);
|
|
1447
1447
|
}
|
|
1448
|
-
const { propose: propose2 } = await import("./governor-
|
|
1448
|
+
const { propose: propose2 } = await import("./governor-RE6IJMUJ.js");
|
|
1449
1449
|
const { pinJSON } = await import("./ipfs-IGXLLJCF.js");
|
|
1450
|
-
const { parseDuration: parseDuration2 } = await import("./governor-
|
|
1450
|
+
const { parseDuration: parseDuration2 } = await import("./governor-RE6IJMUJ.js");
|
|
1451
1451
|
const performanceFeeBps = BigInt(opts.performanceFee);
|
|
1452
1452
|
if (performanceFeeBps < 0n || performanceFeeBps > 10000n) {
|
|
1453
1453
|
console.error(chalk.red("--performance-fee must be 0-10000 (basis points)"));
|
|
@@ -1554,7 +1554,7 @@ function registerStrategyTemplateCommands(strategy2) {
|
|
|
1554
1554
|
let prices = [];
|
|
1555
1555
|
let priceSource = null;
|
|
1556
1556
|
try {
|
|
1557
|
-
const { getTokenPricesInAsset } = await import("./price-
|
|
1557
|
+
const { getTokenPricesInAsset } = await import("./price-GY3JQ2OK.js");
|
|
1558
1558
|
prices = await getTokenPricesInAsset({
|
|
1559
1559
|
tokens: allocations.map((a, i) => ({
|
|
1560
1560
|
token: a.token,
|
|
@@ -1947,10 +1947,11 @@ async function getActiveSyndicates2(creator) {
|
|
|
1947
1947
|
}
|
|
1948
1948
|
|
|
1949
1949
|
// src/commands/venice.ts
|
|
1950
|
-
import { formatUnits as formatUnits2, isAddress as isAddress2 } from "viem";
|
|
1950
|
+
import { formatUnits as formatUnits2, isAddress as isAddress2, parseUnits as parseUnits2 } from "viem";
|
|
1951
1951
|
import chalk2 from "chalk";
|
|
1952
1952
|
import ora2 from "ora";
|
|
1953
1953
|
import { readFileSync } from "fs";
|
|
1954
|
+
import { createInterface } from "readline/promises";
|
|
1954
1955
|
function registerVeniceCommands(program2) {
|
|
1955
1956
|
const venice = program2.command("venice").description("Venice private inference \u2014 provision API keys, run inference");
|
|
1956
1957
|
venice.command("provision").description("Self-provision a Venice API key (requires sVVV in wallet)").action(async () => {
|
|
@@ -1983,7 +1984,7 @@ function registerVeniceCommands(program2) {
|
|
|
1983
1984
|
console.log(chalk2.dim(` Key: ${apiKey.slice(0, 8)}...${apiKey.slice(-4)}`));
|
|
1984
1985
|
console.log(chalk2.dim(" Saved to ~/.sherwood/config.json"));
|
|
1985
1986
|
try {
|
|
1986
|
-
const { createVeniceProvisionAttestation, getEasScanUrl: getEasScanUrl2 } = await import("./eas-
|
|
1987
|
+
const { createVeniceProvisionAttestation, getEasScanUrl: getEasScanUrl2 } = await import("./eas-QNZKCEP7.js");
|
|
1987
1988
|
const { uid } = await createVeniceProvisionAttestation(account.address);
|
|
1988
1989
|
if (uid !== "0x0000000000000000000000000000000000000000000000000000000000000000") {
|
|
1989
1990
|
console.log(chalk2.dim(` Attested: ${getEasScanUrl2(uid)}`));
|
|
@@ -1996,6 +1997,203 @@ function registerVeniceCommands(program2) {
|
|
|
1996
1997
|
process.exit(1);
|
|
1997
1998
|
}
|
|
1998
1999
|
});
|
|
2000
|
+
venice.command("stake").description("Stake VVV tokens to receive sVVV (required for API key provisioning)").requiredOption("--amount <n>", "Amount of VVV to stake (human-readable, e.g. 13)").action(async (opts) => {
|
|
2001
|
+
const account = getAccount();
|
|
2002
|
+
const client = getPublicClient();
|
|
2003
|
+
const chain = getChain();
|
|
2004
|
+
const veniceAddrs = VENICE();
|
|
2005
|
+
const amount = parseUnits2(opts.amount, 18);
|
|
2006
|
+
const balSpinner = ora2("Checking VVV balance...").start();
|
|
2007
|
+
try {
|
|
2008
|
+
const vvvBalance = await client.readContract({
|
|
2009
|
+
address: veniceAddrs.VVV,
|
|
2010
|
+
abi: ERC20_ABI,
|
|
2011
|
+
functionName: "balanceOf",
|
|
2012
|
+
args: [account.address]
|
|
2013
|
+
});
|
|
2014
|
+
if (vvvBalance < amount) {
|
|
2015
|
+
balSpinner.fail(`Insufficient VVV: have ${formatUnits2(vvvBalance, 18)}, need ${opts.amount}`);
|
|
2016
|
+
process.exit(1);
|
|
2017
|
+
}
|
|
2018
|
+
balSpinner.succeed(`VVV balance: ${formatUnits2(vvvBalance, 18)}`);
|
|
2019
|
+
} catch (err) {
|
|
2020
|
+
balSpinner.fail("Failed to check VVV balance");
|
|
2021
|
+
console.error(chalk2.red(formatContractError(err)));
|
|
2022
|
+
process.exit(1);
|
|
2023
|
+
}
|
|
2024
|
+
const approveSpinner = ora2("Approving VVV for staking contract...").start();
|
|
2025
|
+
try {
|
|
2026
|
+
const approveHash = await writeContractWithRetry({
|
|
2027
|
+
account,
|
|
2028
|
+
chain,
|
|
2029
|
+
address: veniceAddrs.VVV,
|
|
2030
|
+
abi: ERC20_ABI,
|
|
2031
|
+
functionName: "approve",
|
|
2032
|
+
args: [veniceAddrs.STAKING, amount]
|
|
2033
|
+
});
|
|
2034
|
+
await waitForReceipt(approveHash);
|
|
2035
|
+
approveSpinner.succeed("VVV approved");
|
|
2036
|
+
} catch (err) {
|
|
2037
|
+
approveSpinner.fail("Approve failed");
|
|
2038
|
+
console.error(chalk2.red(formatContractError(err)));
|
|
2039
|
+
process.exit(1);
|
|
2040
|
+
}
|
|
2041
|
+
const stakeSpinner = ora2(`Staking ${opts.amount} VVV...`).start();
|
|
2042
|
+
try {
|
|
2043
|
+
const stakeHash = await writeContractWithRetry({
|
|
2044
|
+
account,
|
|
2045
|
+
chain,
|
|
2046
|
+
address: veniceAddrs.STAKING,
|
|
2047
|
+
abi: VENICE_STAKING_ABI,
|
|
2048
|
+
functionName: "stake",
|
|
2049
|
+
args: [account.address, amount]
|
|
2050
|
+
});
|
|
2051
|
+
await waitForReceipt(stakeHash);
|
|
2052
|
+
const sVvvBalance = await client.readContract({
|
|
2053
|
+
address: veniceAddrs.STAKING,
|
|
2054
|
+
abi: VENICE_STAKING_ABI,
|
|
2055
|
+
functionName: "balanceOf",
|
|
2056
|
+
args: [account.address]
|
|
2057
|
+
});
|
|
2058
|
+
stakeSpinner.succeed(`Staked ${opts.amount} VVV \u2192 ${formatUnits2(sVvvBalance, 18)} sVVV`);
|
|
2059
|
+
console.log(chalk2.dim(" You can now run: sherwood venice provision"));
|
|
2060
|
+
} catch (err) {
|
|
2061
|
+
stakeSpinner.fail("Stake failed");
|
|
2062
|
+
console.error(chalk2.red(formatContractError(err)));
|
|
2063
|
+
process.exit(1);
|
|
2064
|
+
}
|
|
2065
|
+
});
|
|
2066
|
+
venice.command("mint-diem").description("Lock sVVV to mint DIEM (Venice inference credits; ~1d cooldown)").requiredOption("--amount <n>", "Amount of sVVV to lock (human-readable, 18 decimals)").option("--slippage <bps>", "Slippage tolerance in bps (default 500 = 5%)", "500").option("--yes", "Skip the cooldown confirmation prompt").action(async (opts) => {
|
|
2067
|
+
const account = getAccount();
|
|
2068
|
+
const client = getPublicClient();
|
|
2069
|
+
const chain = getChain();
|
|
2070
|
+
const { STAKING, DIEM } = VENICE();
|
|
2071
|
+
const amount = parseUnits2(opts.amount, 18);
|
|
2072
|
+
const slippageBps = BigInt(opts.slippage ?? "500");
|
|
2073
|
+
if (slippageBps < 0n || slippageBps > 10000n) {
|
|
2074
|
+
console.error(chalk2.red(`Invalid slippage bps: ${opts.slippage} (must be 0\u201310000)`));
|
|
2075
|
+
process.exit(1);
|
|
2076
|
+
}
|
|
2077
|
+
const balSpinner = ora2("Checking sVVV balance...").start();
|
|
2078
|
+
let sVvvBalance;
|
|
2079
|
+
try {
|
|
2080
|
+
sVvvBalance = await client.readContract({
|
|
2081
|
+
address: STAKING,
|
|
2082
|
+
abi: VENICE_STAKING_ABI,
|
|
2083
|
+
functionName: "balanceOf",
|
|
2084
|
+
args: [account.address]
|
|
2085
|
+
});
|
|
2086
|
+
} catch (err) {
|
|
2087
|
+
balSpinner.fail("Failed to read sVVV balance");
|
|
2088
|
+
console.error(chalk2.red(formatContractError(err)));
|
|
2089
|
+
process.exit(1);
|
|
2090
|
+
}
|
|
2091
|
+
if (sVvvBalance < amount) {
|
|
2092
|
+
balSpinner.fail(
|
|
2093
|
+
`Insufficient sVVV: have ${formatUnits2(sVvvBalance, 18)}, need ${opts.amount}`
|
|
2094
|
+
);
|
|
2095
|
+
console.log(chalk2.yellow(" Stake VVV first (see VeniceInferenceStrategy proposal flow)."));
|
|
2096
|
+
process.exit(1);
|
|
2097
|
+
}
|
|
2098
|
+
balSpinner.succeed(`sVVV balance: ${formatUnits2(sVvvBalance, 18)}`);
|
|
2099
|
+
const quoteSpinner = ora2("Quoting DIEM output...").start();
|
|
2100
|
+
let expected;
|
|
2101
|
+
try {
|
|
2102
|
+
expected = await client.readContract({
|
|
2103
|
+
address: STAKING,
|
|
2104
|
+
abi: VENICE_STAKING_ABI,
|
|
2105
|
+
functionName: "getDiemAmountOut",
|
|
2106
|
+
args: [amount]
|
|
2107
|
+
});
|
|
2108
|
+
} catch (err) {
|
|
2109
|
+
quoteSpinner.fail("Failed to quote DIEM output");
|
|
2110
|
+
console.error(chalk2.red(formatContractError(err)));
|
|
2111
|
+
process.exit(1);
|
|
2112
|
+
}
|
|
2113
|
+
if (expected === 0n) {
|
|
2114
|
+
quoteSpinner.fail("Quote returned 0 DIEM \u2014 refusing to mint");
|
|
2115
|
+
process.exit(1);
|
|
2116
|
+
}
|
|
2117
|
+
const minOut = expected * (10000n - slippageBps) / 10000n;
|
|
2118
|
+
quoteSpinner.succeed(
|
|
2119
|
+
`Expected: ${formatUnits2(expected, 18)} DIEM (minOut @ ${slippageBps}bps: ${formatUnits2(minOut, 18)})`
|
|
2120
|
+
);
|
|
2121
|
+
const MIN_SPENDABLE_DIEM = parseUnits2("0.1", 18);
|
|
2122
|
+
let currentDiem = 0n;
|
|
2123
|
+
try {
|
|
2124
|
+
currentDiem = await client.readContract({
|
|
2125
|
+
address: DIEM,
|
|
2126
|
+
abi: ERC20_ABI,
|
|
2127
|
+
functionName: "balanceOf",
|
|
2128
|
+
args: [account.address]
|
|
2129
|
+
});
|
|
2130
|
+
} catch {
|
|
2131
|
+
}
|
|
2132
|
+
const projectedDiem = currentDiem + expected;
|
|
2133
|
+
if (projectedDiem < MIN_SPENDABLE_DIEM) {
|
|
2134
|
+
const shortfall = MIN_SPENDABLE_DIEM - projectedDiem;
|
|
2135
|
+
const sVvvNeeded = (amount * shortfall + expected - 1n) / expected;
|
|
2136
|
+
console.log();
|
|
2137
|
+
console.log(chalk2.red(" \u26A0 Venice requires \u2265 0.1 DIEM minimum before ANY DIEM credit"));
|
|
2138
|
+
console.log(chalk2.red(" becomes spendable on inference calls."));
|
|
2139
|
+
console.log(chalk2.red(` Projected DIEM after mint: ${formatUnits2(projectedDiem, 18)} (short by ${formatUnits2(shortfall, 18)})`));
|
|
2140
|
+
console.log(chalk2.red(` Approx additional sVVV needed: ${formatUnits2(sVvvNeeded, 18)}`));
|
|
2141
|
+
console.log(chalk2.dim(" Below threshold, this DIEM sits idle \u2014 consider acquiring"));
|
|
2142
|
+
console.log(chalk2.dim(" more sVVV first, or use x402 USDC pay-per-request."));
|
|
2143
|
+
}
|
|
2144
|
+
console.log();
|
|
2145
|
+
console.log(chalk2.yellow(" \u26A0 Locked sVVV cannot be unstaked directly. To recover it you must"));
|
|
2146
|
+
console.log(chalk2.yellow(" first call `staking.burnDiem(amount)` (burns DIEM, unlocks sVVV"));
|
|
2147
|
+
console.log(chalk2.yellow(" at your average mint rate), then `initiateUnstake` + wait the"));
|
|
2148
|
+
console.log(chalk2.yellow(" 7-day staking cooldown, then `finalizeUnstake`."));
|
|
2149
|
+
console.log(chalk2.dim(" x402 alternative (pay-per-request in USDC, no DIEM lock):"));
|
|
2150
|
+
console.log(chalk2.dim(" https://docs.venice.ai/overview/guides/generating-api-key-agent#paying-for-inference"));
|
|
2151
|
+
console.log();
|
|
2152
|
+
if (!opts.yes) {
|
|
2153
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
2154
|
+
try {
|
|
2155
|
+
const answer = (await rl.question(` Lock ${opts.amount} sVVV for DIEM credits? [y/N] `)).trim().toLowerCase();
|
|
2156
|
+
if (answer !== "y" && answer !== "yes") {
|
|
2157
|
+
console.log(chalk2.dim(" Aborted."));
|
|
2158
|
+
process.exit(0);
|
|
2159
|
+
}
|
|
2160
|
+
} finally {
|
|
2161
|
+
rl.close();
|
|
2162
|
+
}
|
|
2163
|
+
}
|
|
2164
|
+
const diemBefore = currentDiem;
|
|
2165
|
+
const mintSpinner = ora2(`Minting DIEM from ${opts.amount} sVVV...`).start();
|
|
2166
|
+
try {
|
|
2167
|
+
const hash = await writeContractWithRetry({
|
|
2168
|
+
account,
|
|
2169
|
+
chain,
|
|
2170
|
+
address: STAKING,
|
|
2171
|
+
abi: VENICE_STAKING_ABI,
|
|
2172
|
+
functionName: "mintDiem",
|
|
2173
|
+
args: [amount, minOut]
|
|
2174
|
+
});
|
|
2175
|
+
await waitForReceipt(hash);
|
|
2176
|
+
const diemAfter = await client.readContract({
|
|
2177
|
+
address: DIEM,
|
|
2178
|
+
abi: ERC20_ABI,
|
|
2179
|
+
functionName: "balanceOf",
|
|
2180
|
+
args: [account.address]
|
|
2181
|
+
});
|
|
2182
|
+
const delta = diemAfter - diemBefore;
|
|
2183
|
+
mintSpinner.succeed(
|
|
2184
|
+
`Minted ${formatUnits2(delta > 0n ? delta : diemAfter, 18)} DIEM` + (delta > 0n ? ` (balance: ${formatUnits2(diemAfter, 18)})` : "")
|
|
2185
|
+
);
|
|
2186
|
+
console.log(chalk2.dim(` Tx: ${hash}`));
|
|
2187
|
+
console.log(chalk2.yellow(" Note: Venice requires \u2265 0.1 DIEM to spend ANY DIEM credit, and"));
|
|
2188
|
+
console.log(chalk2.yellow(" refreshes daily allocation at 00:00 UTC. Below threshold,"));
|
|
2189
|
+
console.log(chalk2.yellow(" inference will continue to 402."));
|
|
2190
|
+
console.log(chalk2.dim(' Once over threshold: sherwood venice infer --model <id> --prompt "..."'));
|
|
2191
|
+
} catch (err) {
|
|
2192
|
+
mintSpinner.fail("mintDiem failed");
|
|
2193
|
+
console.error(chalk2.red(formatContractError(err)));
|
|
2194
|
+
process.exit(1);
|
|
2195
|
+
}
|
|
2196
|
+
});
|
|
1999
2197
|
venice.command("status").description("Show Venice inference status: sVVV balances, DIEM, API key").requiredOption("--vault <address>", "Vault address").action(async (opts) => {
|
|
2000
2198
|
const vaultAddress = opts.vault;
|
|
2001
2199
|
if (!isAddress2(vaultAddress)) {
|
|
@@ -2033,7 +2231,7 @@ function registerVeniceCommands(program2) {
|
|
|
2033
2231
|
return { agent, balance: bal };
|
|
2034
2232
|
})
|
|
2035
2233
|
);
|
|
2036
|
-
const [mySvvv, myPending] = await Promise.all([
|
|
2234
|
+
const [mySvvv, myPending, myDiem] = await Promise.all([
|
|
2037
2235
|
client.readContract({
|
|
2038
2236
|
address: VENICE().STAKING,
|
|
2039
2237
|
abi: VENICE_STAKING_ABI,
|
|
@@ -2045,6 +2243,12 @@ function registerVeniceCommands(program2) {
|
|
|
2045
2243
|
abi: VENICE_STAKING_ABI,
|
|
2046
2244
|
functionName: "pendingRewards",
|
|
2047
2245
|
args: [account.address]
|
|
2246
|
+
}),
|
|
2247
|
+
client.readContract({
|
|
2248
|
+
address: VENICE().DIEM,
|
|
2249
|
+
abi: ERC20_ABI,
|
|
2250
|
+
functionName: "balanceOf",
|
|
2251
|
+
args: [account.address]
|
|
2048
2252
|
})
|
|
2049
2253
|
]);
|
|
2050
2254
|
const apiKeyValid = await checkApiKeyValid();
|
|
@@ -2066,6 +2270,8 @@ function registerVeniceCommands(program2) {
|
|
|
2066
2270
|
console.log(chalk2.bold("\n Your Wallet"));
|
|
2067
2271
|
console.log(` sVVV: ${formatUnits2(mySvvv, 18)}`);
|
|
2068
2272
|
console.log(` Pending rewards: ${formatUnits2(myPending, 18)} VVV`);
|
|
2273
|
+
console.log(` DIEM (credits): ${formatUnits2(myDiem, 18)}`);
|
|
2274
|
+
console.log(chalk2.dim(" (mint via `sherwood venice mint-diem --amount <sVVV>`)"));
|
|
2069
2275
|
console.log(chalk2.bold("\n Venice API"));
|
|
2070
2276
|
console.log(` Key: ${apiKey ? `${apiKey.slice(0, 8)}...${apiKey.slice(-4)}` : chalk2.dim("not provisioned")}`);
|
|
2071
2277
|
console.log(` Status: ${apiKeyValid ? chalk2.green("valid") : chalk2.red("invalid/missing")}`);
|
|
@@ -2134,10 +2340,10 @@ ${opts.prompt}`;
|
|
|
2134
2340
|
console.log(chalk2.dim(`Model: ${result.model} | Tokens: ${result.usage.promptTokens} in, ${result.usage.completionTokens} out, ${result.usage.totalTokens} total`));
|
|
2135
2341
|
}
|
|
2136
2342
|
try {
|
|
2137
|
-
const { createVeniceInferenceAttestation, getEasScanUrl: getEasScanUrl2 } = await import("./eas-
|
|
2343
|
+
const { createVeniceInferenceAttestation, getEasScanUrl: getEasScanUrl2 } = await import("./eas-QNZKCEP7.js");
|
|
2138
2344
|
const { keccak256, toHex, isAddress: isAddr } = await import("viem");
|
|
2139
|
-
const { getChainContracts: getChainContracts2 } = await import("./config-
|
|
2140
|
-
const { getChain: getActiveChain } = await import("./network-
|
|
2345
|
+
const { getChainContracts: getChainContracts2 } = await import("./config-YRERDZSL.js");
|
|
2346
|
+
const { getChain: getActiveChain } = await import("./network-R5NFPIAF.js");
|
|
2141
2347
|
const vaultRecipient = opts.vault && isAddr(opts.vault) ? opts.vault : getChainContracts2(getActiveChain().id).vault;
|
|
2142
2348
|
const promptHash = keccak256(toHex(userContent)).slice(0, 18);
|
|
2143
2349
|
const { uid } = await createVeniceInferenceAttestation(
|
|
@@ -2161,14 +2367,14 @@ ${opts.prompt}`;
|
|
|
2161
2367
|
}
|
|
2162
2368
|
|
|
2163
2369
|
// src/commands/allowance.ts
|
|
2164
|
-
import { parseUnits as
|
|
2370
|
+
import { parseUnits as parseUnits4, formatUnits as formatUnits3, isAddress as isAddress3 } from "viem";
|
|
2165
2371
|
import chalk3 from "chalk";
|
|
2166
2372
|
import ora3 from "ora";
|
|
2167
2373
|
|
|
2168
2374
|
// src/strategies/allowance-disburse.ts
|
|
2169
|
-
import { encodeFunctionData as encodeFunctionData8, parseUnits as
|
|
2375
|
+
import { encodeFunctionData as encodeFunctionData8, parseUnits as parseUnits3 } from "viem";
|
|
2170
2376
|
function buildDisburseBatch(config, vaultAddress, agents, assetAddress, assetDecimals, minUsdc, swapPath) {
|
|
2171
|
-
const assetAmount =
|
|
2377
|
+
const assetAmount = parseUnits3(config.amount, assetDecimals);
|
|
2172
2378
|
const isUsdc = assetAddress.toLowerCase() === TOKENS().USDC.toLowerCase();
|
|
2173
2379
|
const isWeth = assetAddress.toLowerCase() === TOKENS().WETH.toLowerCase();
|
|
2174
2380
|
const calls = [];
|
|
@@ -2281,7 +2487,7 @@ function registerAllowanceCommands(program2) {
|
|
|
2281
2487
|
console.error(chalk3.red("No agents registered in vault. Register agents first."));
|
|
2282
2488
|
process.exit(1);
|
|
2283
2489
|
}
|
|
2284
|
-
const requestedAmount =
|
|
2490
|
+
const requestedAmount = parseUnits4(opts.amount, assetDecimals);
|
|
2285
2491
|
const profit = assetBalance > totalDeposited ? assetBalance - totalDeposited : 0n;
|
|
2286
2492
|
const isUsdc = assetAddress.toLowerCase() === TOKENS().USDC.toLowerCase();
|
|
2287
2493
|
const isWeth = assetAddress.toLowerCase() === TOKENS().WETH.toLowerCase();
|
|
@@ -3266,8 +3472,8 @@ function printSimulationResult(result, callType) {
|
|
|
3266
3472
|
}
|
|
3267
3473
|
async function sendSimulationAlert(subdomain, proposalId, vault, execResult, settleResult) {
|
|
3268
3474
|
try {
|
|
3269
|
-
const xmtp = await import("./xmtp-
|
|
3270
|
-
const { getAccount: getAccount2 } = await import("./client-
|
|
3475
|
+
const xmtp = await import("./xmtp-VPGQE4IP.js");
|
|
3476
|
+
const { getAccount: getAccount2 } = await import("./client-VSBQM2LU.js");
|
|
3271
3477
|
const group = await xmtp.getGroup("", subdomain);
|
|
3272
3478
|
const allRisks = [...execResult.risks, ...settleResult?.risks ?? []];
|
|
3273
3479
|
const criticals = allRisks.filter((r) => r.level === "critical");
|
|
@@ -4078,7 +4284,7 @@ function registerGovernorCommands(program2) {
|
|
|
4078
4284
|
// src/commands/guardian-delegate.ts
|
|
4079
4285
|
import chalk8 from "chalk";
|
|
4080
4286
|
import ora7 from "ora";
|
|
4081
|
-
import { formatUnits as formatUnits4, isAddress as isAddress5, parseUnits as
|
|
4287
|
+
import { formatUnits as formatUnits4, isAddress as isAddress5, parseUnits as parseUnits5 } from "viem";
|
|
4082
4288
|
var G4 = chalk8.green;
|
|
4083
4289
|
var W4 = chalk8.white;
|
|
4084
4290
|
var DIM4 = chalk8.gray;
|
|
@@ -4201,7 +4407,7 @@ function registerGuardianCommands(program2) {
|
|
|
4201
4407
|
}
|
|
4202
4408
|
});
|
|
4203
4409
|
guardian.command("stake <amount>").description("Stake as a guardian. Amount in WOOD (min = registry.minGuardianStake).").option("--agent-id <id>", "ERC-8004 agent ID to associate (first-stake only)", "0").action(async (amountStr, opts) => {
|
|
4204
|
-
const amount =
|
|
4410
|
+
const amount = parseUnits5(amountStr, 18);
|
|
4205
4411
|
const agentId = BigInt(opts.agentId);
|
|
4206
4412
|
await ensureWoodAllowance(amount);
|
|
4207
4413
|
const wallet = getWalletClient();
|
|
@@ -4248,7 +4454,7 @@ function registerGuardianCommands(program2) {
|
|
|
4248
4454
|
console.error(chalk8.red("Invalid delegate address"));
|
|
4249
4455
|
process.exit(1);
|
|
4250
4456
|
}
|
|
4251
|
-
const amount =
|
|
4457
|
+
const amount = parseUnits5(amountStr, 18);
|
|
4252
4458
|
await ensureWoodAllowance(amount);
|
|
4253
4459
|
const wallet = getWalletClient();
|
|
4254
4460
|
const pc = getPublicClient();
|
|
@@ -4366,7 +4572,7 @@ try {
|
|
|
4366
4572
|
var require2 = createRequire(import.meta.url);
|
|
4367
4573
|
var { version: CLI_VERSION } = require2("../package.json");
|
|
4368
4574
|
async function loadXmtp() {
|
|
4369
|
-
return import("./xmtp-
|
|
4575
|
+
return import("./xmtp-VPGQE4IP.js");
|
|
4370
4576
|
}
|
|
4371
4577
|
async function loadCron() {
|
|
4372
4578
|
return import("./cron-EOULYO3R.js");
|
|
@@ -4834,7 +5040,7 @@ syndicate.command("add").description("Register an agent on a syndicate vault (cr
|
|
|
4834
5040
|
if (opts.agentId) {
|
|
4835
5041
|
agentId = BigInt(opts.agentId);
|
|
4836
5042
|
} else {
|
|
4837
|
-
const { AGENT_REGISTRY: AGENT_REGISTRY2 } = await import("./addresses-
|
|
5043
|
+
const { AGENT_REGISTRY: AGENT_REGISTRY2 } = await import("./addresses-RQ7DTIBS.js");
|
|
4838
5044
|
const registry2 = AGENT_REGISTRY2().IDENTITY_REGISTRY;
|
|
4839
5045
|
if (registry2 === "0x0000000000000000000000000000000000000000") {
|
|
4840
5046
|
agentId = 0n;
|
|
@@ -5311,7 +5517,7 @@ var vaultCmd = program.command("vault");
|
|
|
5311
5517
|
vaultCmd.command("deposit").description("Deposit into a vault").option("--vault <address>", "Vault address (default: from config)").requiredOption("--amount <amount>", "Amount to deposit (in asset units)").option("--use-eth", "Auto-wrap ETH \u2192 WETH before depositing (for WETH vaults)").action(async (opts) => {
|
|
5312
5518
|
resolveVault(opts);
|
|
5313
5519
|
const decimals = await getAssetDecimals();
|
|
5314
|
-
const amount =
|
|
5520
|
+
const amount = parseUnits6(opts.amount, decimals);
|
|
5315
5521
|
try {
|
|
5316
5522
|
if (!opts.useEth) {
|
|
5317
5523
|
await preflightDeposit(amount);
|
|
@@ -5386,7 +5592,7 @@ vaultCmd.command("redeem").description("Redeem vault shares for the underlying a
|
|
|
5386
5592
|
let shares;
|
|
5387
5593
|
try {
|
|
5388
5594
|
if (opts.shares) {
|
|
5389
|
-
shares =
|
|
5595
|
+
shares = parseUnits6(opts.shares, shareDecimals);
|
|
5390
5596
|
} else {
|
|
5391
5597
|
shares = await getShareBalance();
|
|
5392
5598
|
if (shares === 0n) {
|
|
@@ -5433,7 +5639,7 @@ vaultCmd.command("redeem").description("Redeem vault shares for the underlying a
|
|
|
5433
5639
|
var strategy = program.command("strategy").description("Strategy templates \u2014 list, clone, propose");
|
|
5434
5640
|
registerStrategyTemplateCommands(strategy);
|
|
5435
5641
|
program.command("providers").description("List available DeFi providers").action(async () => {
|
|
5436
|
-
const { MessariProvider, NansenProvider } = await import("./research-
|
|
5642
|
+
const { MessariProvider, NansenProvider } = await import("./research-PB22GPXC.js");
|
|
5437
5643
|
const providers = [new MoonwellProvider(), new UniswapProvider(), new MessariProvider(), new NansenProvider()];
|
|
5438
5644
|
for (const p of providers) {
|
|
5439
5645
|
const info = p.info();
|
|
@@ -5444,7 +5650,7 @@ ${info.name} (${info.type})`);
|
|
|
5444
5650
|
}
|
|
5445
5651
|
});
|
|
5446
5652
|
try {
|
|
5447
|
-
const { registerChatCommands } = await import("./chat-
|
|
5653
|
+
const { registerChatCommands } = await import("./chat-D5OF4OTL.js");
|
|
5448
5654
|
registerChatCommands(program);
|
|
5449
5655
|
} catch {
|
|
5450
5656
|
program.command("chat <name> [action] [actionArgs...]").description("Syndicate chat (XMTP) \u2014 requires @xmtp/cli").action(() => {
|
|
@@ -5454,7 +5660,7 @@ try {
|
|
|
5454
5660
|
process.exit(1);
|
|
5455
5661
|
});
|
|
5456
5662
|
}
|
|
5457
|
-
var { registerSessionCommands } = await import("./session-
|
|
5663
|
+
var { registerSessionCommands } = await import("./session-3Z6I2IM3.js");
|
|
5458
5664
|
registerSessionCommands(program);
|
|
5459
5665
|
registerVeniceCommands(program);
|
|
5460
5666
|
registerAllowanceCommands(program);
|
|
@@ -5462,11 +5668,11 @@ registerIdentityCommands(program);
|
|
|
5462
5668
|
registerProposalCommands(program);
|
|
5463
5669
|
registerGovernorCommands(program);
|
|
5464
5670
|
registerGuardianCommands(program);
|
|
5465
|
-
var { registerResearchCommands } = await import("./research-
|
|
5671
|
+
var { registerResearchCommands } = await import("./research-SVWNPHIN.js");
|
|
5466
5672
|
registerResearchCommands(program);
|
|
5467
|
-
var { registerAgentCommands } = await import("./agent-
|
|
5673
|
+
var { registerAgentCommands } = await import("./agent-SXEV65ME.js");
|
|
5468
5674
|
registerAgentCommands(program);
|
|
5469
|
-
var { registerTradeCommands } = await import("./trade-
|
|
5675
|
+
var { registerTradeCommands } = await import("./trade-E5HSZE44.js");
|
|
5470
5676
|
registerTradeCommands(program);
|
|
5471
5677
|
var configCmd = program.command("config");
|
|
5472
5678
|
configCmd.command("set").description("Save settings to ~/.sherwood/config.json (persists across sessions)").option("--private-key <key>", "Wallet private key (0x-prefixed)").option("--vault <address>", "Default SyndicateVault address").option("--rpc <url>", "Custom RPC URL for the active --chain network").option("--notify-to <id>", "Destination for cron summaries (Telegram chat ID, phone, etc.)").option("--uniswap-api-key <key>", "Uniswap Trading API key (from developers.uniswap.org)").option("--venice-api-key <key>", "Venice AI inference API key").option("--xmtp-group <subdomain:groupId>", "Cache an XMTP group ID for a syndicate (e.g. my-fund:abc123)").action((opts) => {
|