@centrifuge/sdk 1.10.0 → 1.12.0
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/Centrifuge.d.ts +38 -0
- package/dist/Centrifuge.d.ts.map +1 -1
- package/dist/Centrifuge.js +163 -0
- package/dist/Centrifuge.js.map +1 -1
- package/dist/Centrifuge.test.js +219 -0
- package/dist/Centrifuge.test.js.map +1 -1
- package/dist/abi/MultiAdapter.abi.d.ts +1 -1
- package/dist/abi/MultiAdapter.abi.js +1 -1
- package/dist/abi/MultiAdapter.abi.js.map +1 -1
- package/dist/abi/OnchainPM.abi.d.ts +3 -0
- package/dist/abi/OnchainPM.abi.d.ts.map +1 -0
- package/dist/abi/OnchainPM.abi.js +14 -0
- package/dist/abi/OnchainPM.abi.js.map +1 -0
- package/dist/abi/OnchainPMFactory.abi.d.ts +3 -0
- package/dist/abi/OnchainPMFactory.abi.d.ts.map +1 -0
- package/dist/abi/OnchainPMFactory.abi.js +6 -0
- package/dist/abi/OnchainPMFactory.abi.js.map +1 -0
- package/dist/abi/OracleValuation.abi.d.ts +3 -0
- package/dist/abi/OracleValuation.abi.d.ts.map +1 -0
- package/dist/abi/OracleValuation.abi.js +9 -0
- package/dist/abi/OracleValuation.abi.js.map +1 -0
- package/dist/abi/ScriptHelpers.abi.d.ts +3 -0
- package/dist/abi/ScriptHelpers.abi.d.ts.map +1 -0
- package/dist/abi/ScriptHelpers.abi.js +5 -0
- package/dist/abi/ScriptHelpers.abi.js.map +1 -0
- package/dist/abi/index.d.ts +281 -0
- package/dist/abi/index.d.ts.map +1 -1
- package/dist/abi/index.js +8 -0
- package/dist/abi/index.js.map +1 -1
- package/dist/entities/OnchainPM.d.ts +203 -0
- package/dist/entities/OnchainPM.d.ts.map +1 -0
- package/dist/entities/OnchainPM.js +315 -0
- package/dist/entities/OnchainPM.js.map +1 -0
- package/dist/entities/OnchainPM.test.d.ts +2 -0
- package/dist/entities/OnchainPM.test.d.ts.map +1 -0
- package/dist/entities/OnchainPM.test.js +155 -0
- package/dist/entities/OnchainPM.test.js.map +1 -0
- package/dist/entities/Pool.d.ts +81 -3
- package/dist/entities/Pool.d.ts.map +1 -1
- package/dist/entities/Pool.js +207 -18
- package/dist/entities/Pool.js.map +1 -1
- package/dist/entities/PoolNetwork.d.ts +37 -0
- package/dist/entities/PoolNetwork.d.ts.map +1 -1
- package/dist/entities/PoolNetwork.js +136 -12
- package/dist/entities/PoolNetwork.js.map +1 -1
- package/dist/entities/PoolNetwork.test.js +134 -1
- package/dist/entities/PoolNetwork.test.js.map +1 -1
- package/dist/entities/ShareClass.d.ts.map +1 -1
- package/dist/entities/ShareClass.js +68 -74
- package/dist/entities/ShareClass.js.map +1 -1
- package/dist/entities/crosschainMessages.d.ts +127 -0
- package/dist/entities/crosschainMessages.d.ts.map +1 -0
- package/dist/entities/crosschainMessages.js +204 -0
- package/dist/entities/crosschainMessages.js.map +1 -0
- package/dist/index.d.ts +16 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/poolMetadata.d.ts +28 -0
- package/dist/types/poolMetadata.d.ts.map +1 -1
- package/dist/types/transaction.d.ts +5 -1
- package/dist/types/transaction.d.ts.map +1 -1
- package/dist/types/transaction.js.map +1 -1
- package/dist/types/workflow.d.ts +151 -0
- package/dist/types/workflow.d.ts.map +1 -0
- package/dist/types/workflow.js +5 -0
- package/dist/types/workflow.js.map +1 -0
- package/dist/utils/catalog.d.ts +29 -0
- package/dist/utils/catalog.d.ts.map +1 -0
- package/dist/utils/catalog.js +396 -0
- package/dist/utils/catalog.js.map +1 -0
- package/dist/utils/catalog.test.d.ts +2 -0
- package/dist/utils/catalog.test.d.ts.map +1 -0
- package/dist/utils/catalog.test.js +291 -0
- package/dist/utils/catalog.test.js.map +1 -0
- package/dist/utils/scriptHash.d.ts +32 -0
- package/dist/utils/scriptHash.d.ts.map +1 -0
- package/dist/utils/scriptHash.js +67 -0
- package/dist/utils/scriptHash.js.map +1 -0
- package/dist/utils/scriptHash.test.d.ts +2 -0
- package/dist/utils/scriptHash.test.d.ts.map +1 -0
- package/dist/utils/scriptHash.test.js +97 -0
- package/dist/utils/scriptHash.test.js.map +1 -0
- package/dist/utils/variables.d.ts +78 -0
- package/dist/utils/variables.d.ts.map +1 -0
- package/dist/utils/variables.js +105 -0
- package/dist/utils/variables.js.map +1 -0
- package/dist/utils/variables.test.d.ts +2 -0
- package/dist/utils/variables.test.d.ts.map +1 -0
- package/dist/utils/variables.test.js +110 -0
- package/dist/utils/variables.test.js.map +1 -0
- package/dist/utils/weiroll.d.ts +176 -0
- package/dist/utils/weiroll.d.ts.map +1 -0
- package/dist/utils/weiroll.js +341 -0
- package/dist/utils/weiroll.js.map +1 -0
- package/dist/utils/weiroll.test.d.ts +2 -0
- package/dist/utils/weiroll.test.d.ts.map +1 -0
- package/dist/utils/weiroll.test.js +430 -0
- package/dist/utils/weiroll.test.js.map +1 -0
- package/dist/utils/workflowExecute.d.ts +121 -0
- package/dist/utils/workflowExecute.d.ts.map +1 -0
- package/dist/utils/workflowExecute.js +577 -0
- package/dist/utils/workflowExecute.js.map +1 -0
- package/dist/utils/workflowExecute.test.d.ts +2 -0
- package/dist/utils/workflowExecute.test.d.ts.map +1 -0
- package/dist/utils/workflowExecute.test.js +117 -0
- package/dist/utils/workflowExecute.test.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import { concat, decodeAbiParameters, encodeAbiParameters } from 'viem';
|
|
2
|
+
// ---------------------------------------------------------------------------
|
|
3
|
+
// Call type flags (lower 2 bits of the flags byte)
|
|
4
|
+
// ---------------------------------------------------------------------------
|
|
5
|
+
/** State-changing call. */
|
|
6
|
+
export const CALL = 0x01;
|
|
7
|
+
/** Read-only call. */
|
|
8
|
+
export const STATICCALL = 0x02;
|
|
9
|
+
/** ETH-value call — ETH amount is taken from the first input specifier's state slot. */
|
|
10
|
+
export const VALUECALL = 0x03;
|
|
11
|
+
/** Raw calldata mode — set in the flags byte to bypass ABI encoding. */
|
|
12
|
+
export const FLAG_RAW = 0x20;
|
|
13
|
+
/** Extended command mode — the next command word contains up to 32 input specifiers. */
|
|
14
|
+
export const FLAG_EXTENDED_COMMAND = 0x40;
|
|
15
|
+
/** Sentinel value for unused input slots or a discarded return value. */
|
|
16
|
+
export const UNUSED_SLOT = 0xff;
|
|
17
|
+
const IDX_VALUE_MASK = 0x7f;
|
|
18
|
+
/** Maximum number of state slots (stateBitmap is uint128). */
|
|
19
|
+
const MAX_STATE_SLOTS = 128;
|
|
20
|
+
const MAX_COMMAND_INPUT_SPECIFIERS = 32;
|
|
21
|
+
const EMPTY_BYTES = '0x';
|
|
22
|
+
/**
|
|
23
|
+
* Fills runtime state slots with execution-time values.
|
|
24
|
+
*
|
|
25
|
+
* `buildScript()` initializes runtime slots to empty bytes. Before calling
|
|
26
|
+
* `OnchainPM.execute()`, the strategist must fill each runtime slot with the
|
|
27
|
+
* concrete value for this particular execution.
|
|
28
|
+
*
|
|
29
|
+
* Returns a copy of `state` with each runtime slot replaced by the
|
|
30
|
+
* corresponding value from `runtimeValues` (keyed by the slot's `key` field).
|
|
31
|
+
*
|
|
32
|
+
* @throws if any required runtime variable in `workflow.runtimeVariables` has no
|
|
33
|
+
* corresponding entry in `runtimeValues`
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* const { commands, state, stateBitmap } = buildScript(workflow, { poolContext, configurableValues })
|
|
38
|
+
* const filledState = fillRuntimeSlots(state, workflow, { amount: '0x000...0de0b6b3a7640000' })
|
|
39
|
+
* // submit OnchainPM.execute(commands, filledState, stateBitmap, [], proof)
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export function fillRuntimeSlots(state, workflow, runtimeValues) {
|
|
43
|
+
if (workflow.runtimeVariables) {
|
|
44
|
+
const missing = workflow.runtimeVariables.filter((key) => runtimeValues[key] === undefined);
|
|
45
|
+
if (missing.length > 0) {
|
|
46
|
+
throw new Error(`fillRuntimeSlots: missing runtime values for: ${missing.map((k) => `"${k}"`).join(', ')}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const nextState = state.map((slot, i) => {
|
|
50
|
+
const def = workflow.state[i];
|
|
51
|
+
if (!def || def.type !== 'runtime')
|
|
52
|
+
return slot;
|
|
53
|
+
const value = runtimeValues[def.key];
|
|
54
|
+
return value ?? slot;
|
|
55
|
+
});
|
|
56
|
+
for (let i = 0; i < workflow.state.length; i++) {
|
|
57
|
+
const def = workflow.state[i];
|
|
58
|
+
if (!def || def.type !== 'rawcalldata')
|
|
59
|
+
continue;
|
|
60
|
+
nextState[i] = assembleRawCalldataSlot(nextState, workflow, def);
|
|
61
|
+
}
|
|
62
|
+
return nextState;
|
|
63
|
+
}
|
|
64
|
+
function getWorkflowAbiParameter(parameter) {
|
|
65
|
+
if (parameter === '(address,uint256)[]') {
|
|
66
|
+
return {
|
|
67
|
+
type: 'tuple[]',
|
|
68
|
+
components: [{ type: 'address' }, { type: 'uint256' }],
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
if (parameter === '(address,address)[]') {
|
|
72
|
+
return {
|
|
73
|
+
type: 'tuple[]',
|
|
74
|
+
components: [{ type: 'address' }, { type: 'address' }],
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
return { type: parameter };
|
|
78
|
+
}
|
|
79
|
+
function decodeWorkflowValue(parameter, encodedValue, sourceSlot) {
|
|
80
|
+
if (parameter === 'bytes' && sourceSlot?.type === 'literal') {
|
|
81
|
+
// Literal `bytes` slots are stored in the inner ABI form [length][padded data] (see
|
|
82
|
+
// encodeLiteralValue). Recover the raw value so the rawcalldata assembler can re-encode it.
|
|
83
|
+
const length = Number(BigInt(`0x${encodedValue.slice(2, 66)}`));
|
|
84
|
+
return `0x${encodedValue.slice(66, 66 + length * 2)}`;
|
|
85
|
+
}
|
|
86
|
+
if (parameter === 'bytes') {
|
|
87
|
+
try {
|
|
88
|
+
const [decoded] = decodeAbiParameters([getWorkflowAbiParameter(parameter)], encodedValue);
|
|
89
|
+
return decoded;
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
return encodedValue;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
const [decoded] = decodeAbiParameters([getWorkflowAbiParameter(parameter)], encodedValue);
|
|
96
|
+
return decoded;
|
|
97
|
+
}
|
|
98
|
+
function canAssembleRawCalldataAtBuildTime(workflow, sourceSlots) {
|
|
99
|
+
return sourceSlots.every((sourceIndex) => {
|
|
100
|
+
const sourceSlot = workflow.state[sourceIndex];
|
|
101
|
+
if (!sourceSlot) {
|
|
102
|
+
throw new Error(`buildScript: raw calldata source slot ${sourceIndex} is out of range`);
|
|
103
|
+
}
|
|
104
|
+
return sourceSlot.type !== 'runtime' && sourceSlot.type !== 'rawcalldata';
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function assertRawCalldataSlotIsSupported(workflow, slot) {
|
|
108
|
+
for (const sourceIndex of slot.sourceSlots) {
|
|
109
|
+
const sourceSlot = workflow.state[sourceIndex];
|
|
110
|
+
if (!sourceSlot) {
|
|
111
|
+
throw new Error(`buildScript: workflow "${workflow.workflowRef}" raw calldata source slot ${sourceIndex} is out of range`);
|
|
112
|
+
}
|
|
113
|
+
if (sourceSlot.type === 'rawcalldata') {
|
|
114
|
+
throw new Error(`buildScript: workflow "${workflow.workflowRef}" raw calldata action ${slot.actionIndex ?? '?'} cannot depend on another raw calldata slot`);
|
|
115
|
+
}
|
|
116
|
+
if (sourceSlot.type === 'runtime' && !(workflow.runtimeVariables ?? []).includes(sourceSlot.key)) {
|
|
117
|
+
throw new Error(`buildScript: workflow "${workflow.workflowRef}" raw calldata action ${slot.actionIndex ?? '?'} depends on computed runtime slot "${sourceSlot.key}", which cannot be assembled off-chain`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function assembleRawCalldataSlot(state, workflow, slot) {
|
|
122
|
+
assertRawCalldataSlotIsSupported(workflow, slot);
|
|
123
|
+
if (slot.sourceSlots.length !== slot.parameterTypes.length) {
|
|
124
|
+
throw new Error(`buildScript: workflow "${workflow.workflowRef}" raw calldata action ${slot.actionIndex ?? '?'} has ${slot.sourceSlots.length} source slots for ${slot.parameterTypes.length} parameters`);
|
|
125
|
+
}
|
|
126
|
+
const decodedValues = slot.sourceSlots.map((sourceIndex, parameterIndex) => {
|
|
127
|
+
const encodedValue = state[sourceIndex];
|
|
128
|
+
if (encodedValue == null) {
|
|
129
|
+
throw new Error(`buildScript: workflow "${workflow.workflowRef}" raw calldata source slot ${sourceIndex} is missing`);
|
|
130
|
+
}
|
|
131
|
+
const parameter = slot.parameterTypes[parameterIndex];
|
|
132
|
+
const sourceSlot = workflow.state[sourceIndex];
|
|
133
|
+
const emptyBytesLiteral = parameter === 'bytes' && sourceSlot?.type === 'literal';
|
|
134
|
+
if (encodedValue === EMPTY_BYTES && !emptyBytesLiteral) {
|
|
135
|
+
const runtimeKey = sourceSlot && sourceSlot.type === 'runtime' ? sourceSlot.key : `slot ${sourceIndex}`;
|
|
136
|
+
throw new Error(`buildScript: workflow "${workflow.workflowRef}" raw calldata action ${slot.actionIndex ?? '?'} is missing value for "${runtimeKey}"`);
|
|
137
|
+
}
|
|
138
|
+
return decodeWorkflowValue(parameter, encodedValue, sourceSlot);
|
|
139
|
+
});
|
|
140
|
+
const encodedArgs = encodeAbiParameters(slot.parameterTypes.map(getWorkflowAbiParameter), decodedValues);
|
|
141
|
+
return concat([slot.selector, encodedArgs]);
|
|
142
|
+
}
|
|
143
|
+
function encodeCallbackScript(script) {
|
|
144
|
+
// weiroll's CommandBuilder copies state[idx] verbatim into the parent's
|
|
145
|
+
// calldata at the bytes-input offset, without writing a length-prefix word.
|
|
146
|
+
// For the receiver's `bytes calldata` parameter to decode correctly, the
|
|
147
|
+
// state slot must already begin with the 32-byte length word — i.e. it must
|
|
148
|
+
// be the abi-encoded bytes representation, not just the inner payload.
|
|
149
|
+
//
|
|
150
|
+
// Wrap the abi-encoded callback tuple with a length prefix so that
|
|
151
|
+
// bytes-input encoding produced by CommandBuilder = [length][tuple bytes]
|
|
152
|
+
// and the receiver (FlashLoanHelper.executeOperation, or any other
|
|
153
|
+
// callback dispatcher) can `abi.decode(params, ...)` directly.
|
|
154
|
+
const tuple = encodeAbiParameters([{ type: 'bytes32[]' }, { type: 'bytes[]' }, { type: 'uint128' }], [script.commands, script.state, script.stateBitmap]);
|
|
155
|
+
const tupleBytes = (tuple.length - 2) / 2;
|
|
156
|
+
const lengthWord = tupleBytes.toString(16).padStart(64, '0');
|
|
157
|
+
return `0x${lengthWord}${tuple.slice(2)}`;
|
|
158
|
+
}
|
|
159
|
+
function buildTemplateSlot(workflow, slot, context) {
|
|
160
|
+
if ((slot.workflow.runtimeVariables ?? []).length > 0) {
|
|
161
|
+
throw new Error(`buildScript: workflow "${workflow.workflowRef}" template callback "${slot.workflow.workflowRef}" has runtime variables and cannot be pinned`);
|
|
162
|
+
}
|
|
163
|
+
return encodeCallbackScript(buildScript(slot.workflow, context));
|
|
164
|
+
}
|
|
165
|
+
function decodeAddressTarget(value, key) {
|
|
166
|
+
if (/^0x[0-9a-fA-F]{40}$/.test(value)) {
|
|
167
|
+
return value.toLowerCase();
|
|
168
|
+
}
|
|
169
|
+
if (!/^0x[0-9a-fA-F]{64}$/.test(value)) {
|
|
170
|
+
throw new Error(`buildScript: magic target "${key}" must resolve to an address or left-padded bytes32 address, got "${value}"`);
|
|
171
|
+
}
|
|
172
|
+
const body = value.slice(2);
|
|
173
|
+
const prefix = body.slice(0, 24);
|
|
174
|
+
if (!/^0{24}$/i.test(prefix)) {
|
|
175
|
+
throw new Error(`buildScript: magic target "${key}" is not a left-padded address: "${value}"`);
|
|
176
|
+
}
|
|
177
|
+
return `0x${body.slice(24).toLowerCase()}`;
|
|
178
|
+
}
|
|
179
|
+
function encodeIndicesWord(inputs) {
|
|
180
|
+
if (inputs.length > MAX_COMMAND_INPUT_SPECIFIERS) {
|
|
181
|
+
throw new Error(`encodeCommandWords: inputs length ${inputs.length} exceeds maximum of ${MAX_COMMAND_INPUT_SPECIFIERS}`);
|
|
182
|
+
}
|
|
183
|
+
const paddedInputs = inputs.slice();
|
|
184
|
+
while (paddedInputs.length < MAX_COMMAND_INPUT_SPECIFIERS) {
|
|
185
|
+
paddedInputs.push(UNUSED_SLOT);
|
|
186
|
+
}
|
|
187
|
+
let word = 0n;
|
|
188
|
+
for (const idx of paddedInputs) {
|
|
189
|
+
word = (word << 8n) | BigInt(idx & 0xff);
|
|
190
|
+
}
|
|
191
|
+
return `0x${word.toString(16).padStart(64, '0')}`;
|
|
192
|
+
}
|
|
193
|
+
function encodeCommandWords(selector, flags, inputs, output, target) {
|
|
194
|
+
if (inputs.length <= 6) {
|
|
195
|
+
return [encodeCommand(selector, flags, inputs, output, target)];
|
|
196
|
+
}
|
|
197
|
+
return [encodeCommand(selector, flags | FLAG_EXTENDED_COMMAND, [], output, target), encodeIndicesWord(inputs)];
|
|
198
|
+
}
|
|
199
|
+
// ---------------------------------------------------------------------------
|
|
200
|
+
// encodeCommand
|
|
201
|
+
// ---------------------------------------------------------------------------
|
|
202
|
+
/**
|
|
203
|
+
* Packs a single weiroll command into a 32-byte word.
|
|
204
|
+
*
|
|
205
|
+
* Bit layout (from MSB):
|
|
206
|
+
* ```
|
|
207
|
+
* bits [255:224] selector (bytes4) — function selector
|
|
208
|
+
* bits [223:216] flags (uint8) — callType | FLAG_RAW
|
|
209
|
+
* bits [215:168] inputs (bytes6) — 6 × 1-byte input specifiers, MSB first
|
|
210
|
+
* bits [167:160] output (uint8) — output specifier or UNUSED_SLOT
|
|
211
|
+
* bits [159:0] target (address) — 20-byte contract address
|
|
212
|
+
* ```
|
|
213
|
+
*
|
|
214
|
+
* Equivalent Solidity expression:
|
|
215
|
+
* ```solidity
|
|
216
|
+
* (uint256(uint32(selector)) << 224) | (flags << 216) | (indices << 168) | (output << 160) | uint160(target)
|
|
217
|
+
* ```
|
|
218
|
+
*/
|
|
219
|
+
export function encodeCommand(selector, // 4 bytes
|
|
220
|
+
flags, // 1 byte: callType | optional FLAG_RAW
|
|
221
|
+
inputs, // up to 6 weiroll input specifiers (padded to 6 with UNUSED_SLOT)
|
|
222
|
+
output, // output specifier or UNUSED_SLOT
|
|
223
|
+
target // 20-byte address
|
|
224
|
+
) {
|
|
225
|
+
if (inputs.length > 6) {
|
|
226
|
+
throw new Error(`encodeCommand: inputs length ${inputs.length} exceeds maximum of 6`);
|
|
227
|
+
}
|
|
228
|
+
if (!/^0x[0-9a-fA-F]{8}$/.test(selector)) {
|
|
229
|
+
throw new Error(`encodeCommand: selector must be a 4-byte hex string (0x + 8 hex chars), got "${selector}"`);
|
|
230
|
+
}
|
|
231
|
+
if (!/^0x[0-9a-fA-F]{40}$/.test(target)) {
|
|
232
|
+
throw new Error(`encodeCommand: target must be a 20-byte address (0x + 40 hex chars), got "${target}"`);
|
|
233
|
+
}
|
|
234
|
+
for (const idx of inputs) {
|
|
235
|
+
if (idx < 0 || idx > 0xff) {
|
|
236
|
+
throw new Error(`encodeCommand: input specifier ${idx} out of range — must be 0–255`);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
if (output < 0 || output > 0xff) {
|
|
240
|
+
throw new Error(`encodeCommand: output specifier ${output} out of range — must be 0–255`);
|
|
241
|
+
}
|
|
242
|
+
// Pad to exactly 6 input specifiers
|
|
243
|
+
const paddedInputs = inputs.slice();
|
|
244
|
+
while (paddedInputs.length < 6) {
|
|
245
|
+
paddedInputs.push(UNUSED_SLOT);
|
|
246
|
+
}
|
|
247
|
+
// selector as uint32 (top 4 bytes)
|
|
248
|
+
const sel = BigInt(selector);
|
|
249
|
+
// flags as uint8
|
|
250
|
+
const f = BigInt(flags & 0xff);
|
|
251
|
+
// Pack 6 input specifiers into a uint48, MSB = inputs[0]
|
|
252
|
+
let indicesBig = 0n;
|
|
253
|
+
for (const idx of paddedInputs) {
|
|
254
|
+
indicesBig = (indicesBig << 8n) | BigInt((idx ?? UNUSED_SLOT) & 0xff);
|
|
255
|
+
}
|
|
256
|
+
// output as uint8
|
|
257
|
+
const out = BigInt(output & 0xff);
|
|
258
|
+
// target as uint160
|
|
259
|
+
const addr = BigInt(target);
|
|
260
|
+
const word = (sel << 224n) | (f << 216n) | (indicesBig << 168n) | (out << 160n) | addr;
|
|
261
|
+
return `0x${word.toString(16).padStart(64, '0')}`;
|
|
262
|
+
}
|
|
263
|
+
// ---------------------------------------------------------------------------
|
|
264
|
+
// buildScript
|
|
265
|
+
// ---------------------------------------------------------------------------
|
|
266
|
+
/**
|
|
267
|
+
* Builds the weiroll commands array and initial state from a workflow
|
|
268
|
+
* definition, resolving magic variables and configurable values.
|
|
269
|
+
*
|
|
270
|
+
* State slots classified as `literal`, `magic`, or `configurable` are pinned:
|
|
271
|
+
* their bit in `stateBitmap` is set to 1 and the resolved value is placed in
|
|
272
|
+
* `state[i]`. Slots classified as `runtime` are initialized to empty bytes
|
|
273
|
+
* with their bit set to 0 — the executor fills them at call time.
|
|
274
|
+
*
|
|
275
|
+
* @throws if a magic variable key is absent from `poolContext`
|
|
276
|
+
* @throws if a configurable key is absent from `configurableValues`
|
|
277
|
+
* @throws if the workflow has more than 128 state slots
|
|
278
|
+
*/
|
|
279
|
+
export function buildScript(workflow, context) {
|
|
280
|
+
const { poolContext, configurableValues } = context;
|
|
281
|
+
if (workflow.state.length > MAX_STATE_SLOTS) {
|
|
282
|
+
throw new Error(`buildScript: workflow "${workflow.workflowRef}" has ${workflow.state.length} state slots — maximum is ${MAX_STATE_SLOTS}`);
|
|
283
|
+
}
|
|
284
|
+
const state = [];
|
|
285
|
+
let stateBitmap = 0n;
|
|
286
|
+
for (let i = 0; i < workflow.state.length; i++) {
|
|
287
|
+
const slot = workflow.state[i];
|
|
288
|
+
if (slot.type === 'literal') {
|
|
289
|
+
state.push(slot.value);
|
|
290
|
+
stateBitmap |= 1n << BigInt(i);
|
|
291
|
+
}
|
|
292
|
+
else if (slot.type === 'magic') {
|
|
293
|
+
const value = poolContext[slot.key];
|
|
294
|
+
if (value === undefined) {
|
|
295
|
+
throw new Error(`buildScript: magic variable "${slot.key}" not found in pool context`);
|
|
296
|
+
}
|
|
297
|
+
state.push(value);
|
|
298
|
+
stateBitmap |= 1n << BigInt(i);
|
|
299
|
+
}
|
|
300
|
+
else if (slot.type === 'configurable') {
|
|
301
|
+
const value = configurableValues[slot.key];
|
|
302
|
+
if (value === undefined) {
|
|
303
|
+
throw new Error(`buildScript: configurable value "${slot.key}" not provided`);
|
|
304
|
+
}
|
|
305
|
+
state.push(value);
|
|
306
|
+
stateBitmap |= 1n << BigInt(i);
|
|
307
|
+
}
|
|
308
|
+
else if (slot.type === 'rawcalldata') {
|
|
309
|
+
if (canAssembleRawCalldataAtBuildTime(workflow, slot.sourceSlots)) {
|
|
310
|
+
state.push(assembleRawCalldataSlot(state, workflow, slot));
|
|
311
|
+
stateBitmap |= 1n << BigInt(i);
|
|
312
|
+
}
|
|
313
|
+
else {
|
|
314
|
+
state.push(EMPTY_BYTES);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
else if (slot.type === 'template') {
|
|
318
|
+
state.push(buildTemplateSlot(workflow, slot, context));
|
|
319
|
+
stateBitmap |= 1n << BigInt(i);
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
// runtime — placeholder, bit stays 0
|
|
323
|
+
state.push(EMPTY_BYTES);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
const commands = workflow.actions.flatMap((action) => {
|
|
327
|
+
const target = typeof action.target === 'string'
|
|
328
|
+
? action.target
|
|
329
|
+
: (() => {
|
|
330
|
+
const value = poolContext[action.target.key];
|
|
331
|
+
if (value === undefined) {
|
|
332
|
+
throw new Error(`buildScript: magic target "${action.target.key}" not found in pool context`);
|
|
333
|
+
}
|
|
334
|
+
return decodeAddressTarget(value, action.target.key);
|
|
335
|
+
})();
|
|
336
|
+
const flags = action.callType | (action.rawMode ? FLAG_RAW : 0);
|
|
337
|
+
return encodeCommandWords(action.selector, flags, action.inputs, action.output, target);
|
|
338
|
+
});
|
|
339
|
+
return { commands, state, stateBitmap };
|
|
340
|
+
}
|
|
341
|
+
//# sourceMappingURL=weiroll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"weiroll.js","sourceRoot":"","sources":["../../src/utils/weiroll.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,MAAM,CAAA;AAIvE,8EAA8E;AAC9E,mDAAmD;AACnD,8EAA8E;AAE9E,2BAA2B;AAC3B,MAAM,CAAC,MAAM,IAAI,GAAG,IAAa,CAAA;AACjC,sBAAsB;AACtB,MAAM,CAAC,MAAM,UAAU,GAAG,IAAa,CAAA;AACvC,wFAAwF;AACxF,MAAM,CAAC,MAAM,SAAS,GAAG,IAAa,CAAA;AAEtC,wEAAwE;AACxE,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAa,CAAA;AACrC,wFAAwF;AACxF,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAa,CAAA;AAElD,yEAAyE;AACzE,MAAM,CAAC,MAAM,WAAW,GAAG,IAAa,CAAA;AACxC,MAAM,cAAc,GAAG,IAAa,CAAA;AAEpC,8DAA8D;AAC9D,MAAM,eAAe,GAAG,GAAG,CAAA;AAC3B,MAAM,4BAA4B,GAAG,EAAE,CAAA;AACvC,MAAM,WAAW,GAAG,IAAiB,CAAA;AA+GrC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAAkB,EAClB,QAA4B,EAC5B,aAAwC;IAExC,IAAI,QAAQ,CAAC,gBAAgB,EAAE,CAAC;QAC9B,MAAM,OAAO,GAAG,QAAQ,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,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