@boostxyz/sdk 8.0.0-canary.0 → 8.0.0-canary.2
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/Actions/Action.cjs +1 -1
- package/dist/Actions/Action.js +1 -1
- package/dist/Actions/EventAction.cjs +1 -1
- package/dist/Actions/EventAction.cjs.map +1 -1
- package/dist/Actions/EventAction.d.ts +19 -0
- package/dist/Actions/EventAction.d.ts.map +1 -1
- package/dist/Actions/EventAction.js +209 -204
- package/dist/Actions/EventAction.js.map +1 -1
- package/dist/{AllowList-CWqAYlwr.js → AllowList-DQf-8HQC.js} +30 -30
- package/dist/{AllowList-CWqAYlwr.js.map → AllowList-DQf-8HQC.js.map} +1 -1
- package/dist/{AllowList-Lpqz7tn9.cjs → AllowList-DaX239DR.cjs} +2 -2
- package/dist/{AllowList-Lpqz7tn9.cjs.map → AllowList-DaX239DR.cjs.map} +1 -1
- package/dist/AllowLists/AllowList.cjs +1 -1
- package/dist/AllowLists/AllowList.js +3 -3
- package/dist/AllowLists/SimpleAllowList.cjs +1 -1
- package/dist/AllowLists/SimpleAllowList.js +4 -4
- package/dist/AllowLists/SimpleDenyList.cjs +1 -1
- package/dist/AllowLists/SimpleDenyList.js +3 -3
- package/dist/Auth/PassthroughAuth.cjs +1 -1
- package/dist/Auth/PassthroughAuth.js +2 -2
- package/dist/BoostCore.cjs +2 -2
- package/dist/BoostCore.cjs.map +1 -1
- package/dist/BoostCore.d.ts +35 -0
- package/dist/BoostCore.d.ts.map +1 -1
- package/dist/BoostCore.js +75 -75
- package/dist/BoostRegistry.cjs +1 -1
- package/dist/BoostRegistry.js +13 -13
- package/dist/{Budget-BPPXnBAK.js → Budget-LnAQ_Slw.js} +40 -40
- package/dist/{Budget-BPPXnBAK.js.map → Budget-LnAQ_Slw.js.map} +1 -1
- package/dist/{Budget-rZm-AY09.cjs → Budget-WIB8IJoM.cjs} +2 -2
- package/dist/{Budget-rZm-AY09.cjs.map → Budget-WIB8IJoM.cjs.map} +1 -1
- package/dist/Budgets/Budget.cjs +1 -1
- package/dist/Budgets/Budget.js +2 -2
- package/dist/Budgets/ManagedBudget.cjs +1 -1
- package/dist/Budgets/ManagedBudget.js +25 -25
- package/dist/Deployable/DeployableTarget.cjs +1 -1
- package/dist/Deployable/DeployableTarget.js +3 -3
- package/dist/Deployable/DeployableTargetWithRBAC.cjs +1 -1
- package/dist/Deployable/DeployableTargetWithRBAC.js +21 -21
- package/dist/{Incentive-D1sYPD0W.js → Incentive-D_IBex5V.js} +22 -22
- package/dist/{Incentive-D1sYPD0W.js.map → Incentive-D_IBex5V.js.map} +1 -1
- package/dist/{Incentive-Bse5BKbF.cjs → Incentive-gT7z-4v3.cjs} +2 -2
- package/dist/{Incentive-Bse5BKbF.cjs.map → Incentive-gT7z-4v3.cjs.map} +1 -1
- package/dist/Incentives/AllowListIncentive.cjs +1 -1
- package/dist/Incentives/AllowListIncentive.js +13 -13
- package/dist/Incentives/CGDAIncentive.cjs +1 -1
- package/dist/Incentives/CGDAIncentive.js +43 -43
- package/dist/Incentives/ERC20Incentive.cjs +1 -1
- package/dist/Incentives/ERC20Incentive.js +16 -16
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentive.cjs +1 -1
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentive.js +35 -35
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.cjs +1 -1
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.cjs.map +1 -1
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.d.ts.map +1 -1
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.js +146 -161
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.js.map +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentive.cjs +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentive.js +7 -7
- package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.cjs +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.cjs.map +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.d.ts.map +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.js +103 -118
- package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.js.map +1 -1
- package/dist/Incentives/ERC20VariableIncentive.cjs +1 -1
- package/dist/Incentives/ERC20VariableIncentive.js +9 -9
- package/dist/Incentives/Incentive.cjs +1 -1
- package/dist/Incentives/Incentive.js +2 -2
- package/dist/Incentives/PointsIncentive.cjs +1 -1
- package/dist/Incentives/PointsIncentive.js +16 -16
- package/dist/{SimpleDenyList-BtEUdiAj.js → SimpleDenyList-CtdXM49y.js} +7 -7
- package/dist/{SimpleDenyList-BtEUdiAj.js.map → SimpleDenyList-CtdXM49y.js.map} +1 -1
- package/dist/{SimpleDenyList-DEoMIYhE.cjs → SimpleDenyList-D5AoBdVi.cjs} +2 -2
- package/dist/{SimpleDenyList-DEoMIYhE.cjs.map → SimpleDenyList-D5AoBdVi.cjs.map} +1 -1
- package/dist/{Validator-Kpvmj9Bs.js → Validator-BEUqV28V.js} +27 -27
- package/dist/{Validator-Kpvmj9Bs.js.map → Validator-BEUqV28V.js.map} +1 -1
- package/dist/{Validator-DHS4vjSa.cjs → Validator-FxcxYKhR.cjs} +2 -2
- package/dist/{Validator-DHS4vjSa.cjs.map → Validator-FxcxYKhR.cjs.map} +1 -1
- package/dist/Validators/LimitedSignerValidator.cjs +1 -1
- package/dist/Validators/LimitedSignerValidator.js +4 -4
- package/dist/Validators/SignerValidator.cjs +1 -1
- package/dist/Validators/SignerValidator.js +8 -8
- package/dist/Validators/Validator.cjs +1 -1
- package/dist/Validators/Validator.js +2 -2
- package/dist/deployments-DimWVnA4.cjs +2 -0
- package/dist/deployments-DimWVnA4.cjs.map +1 -0
- package/dist/deployments-Dw5Suk_D.js +158 -0
- package/dist/deployments-Dw5Suk_D.js.map +1 -0
- package/dist/deployments.json +69 -107
- package/dist/generated-Cf82M-QP.cjs +3 -0
- package/dist/generated-Cf82M-QP.cjs.map +1 -0
- package/dist/{generated-D6oDILUw.js → generated-krkFnwbV.js} +290 -247
- package/dist/generated-krkFnwbV.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +165 -164
- package/package.json +1 -1
- package/src/Actions/EventAction.test.ts +100 -71
- package/src/Actions/EventAction.ts +57 -30
- package/src/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.ts +13 -41
- package/src/Incentives/ERC20VariableCriteriaIncentiveV2.ts +13 -41
- package/dist/deployments-Coa8CGi2.js +0 -194
- package/dist/deployments-Coa8CGi2.js.map +0 -1
- package/dist/deployments-Dgzcz4Ev.cjs +0 -2
- package/dist/deployments-Dgzcz4Ev.cjs.map +0 -1
- package/dist/generated-BzLYuFx3.cjs +0 -3
- package/dist/generated-BzLYuFx3.cjs.map +0 -1
- package/dist/generated-D6oDILUw.js.map +0 -1
|
@@ -41,12 +41,10 @@ import {
|
|
|
41
41
|
transactionSenderClaimant,
|
|
42
42
|
packFieldIndexes,
|
|
43
43
|
unpackFieldIndexes,
|
|
44
|
-
packCriteriaFieldIndexes,
|
|
45
|
-
unpackCriteriaFieldIndexes,
|
|
46
|
-
isCriteriaFieldIndexTuple,
|
|
47
44
|
packClaimantFieldIndexes,
|
|
48
45
|
decodeAndReorderLogArgs,
|
|
49
|
-
ActionClaimant
|
|
46
|
+
ActionClaimant,
|
|
47
|
+
getScalarValue,
|
|
50
48
|
} from "./EventAction";
|
|
51
49
|
import { allKnownSignatures } from "@boostxyz/test/allKnownSignatures";
|
|
52
50
|
import { getTransactionReceipt } from "@wagmi/core";
|
|
@@ -1519,89 +1517,120 @@ describe('decodeAndReorderLogArgs', () => {
|
|
|
1519
1517
|
});
|
|
1520
1518
|
|
|
1521
1519
|
describe("criteria field index tuple support", () => {
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1520
|
+
test("extracts scalar value from single-level tuple", () => {
|
|
1521
|
+
const args = [123n, [456n, 789n], 999n];
|
|
1522
|
+
const fieldIndex = packFieldIndexes([1, 0]);
|
|
1523
|
+
const result = getScalarValue(args, fieldIndex);
|
|
1524
|
+
expect(result).toBe(456n);
|
|
1525
|
+
});
|
|
1528
1526
|
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1527
|
+
test("extracts scalar value from two-level nested tuple", () => {
|
|
1528
|
+
const args = [
|
|
1529
|
+
100n,
|
|
1530
|
+
[
|
|
1531
|
+
200n,
|
|
1532
|
+
[300n, 400n, 500n],
|
|
1533
|
+
600n
|
|
1534
|
+
],
|
|
1535
|
+
700n
|
|
1536
|
+
];
|
|
1537
|
+
const fieldIndex = packFieldIndexes([1, 1, 2]);
|
|
1533
1538
|
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1539
|
+
const result = getScalarValue(args, fieldIndex);
|
|
1540
|
+
expect(result).toBe(500n);
|
|
1541
|
+
});
|
|
1537
1542
|
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1543
|
+
test("extracts scalar value from three-level nested tuple", () => {
|
|
1544
|
+
const args = [
|
|
1545
|
+
[
|
|
1546
|
+
[
|
|
1547
|
+
[111n, 222n],
|
|
1548
|
+
[333n, 444n]
|
|
1549
|
+
],
|
|
1550
|
+
555n
|
|
1551
|
+
],
|
|
1552
|
+
666n
|
|
1553
|
+
];
|
|
1554
|
+
const fieldIndex = packFieldIndexes([0, 0, 1, 1]);
|
|
1542
1555
|
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
const packed3 = packCriteriaFieldIndexes([1, 3]);
|
|
1556
|
+
const result = getScalarValue(args, fieldIndex);
|
|
1557
|
+
expect(result).toBe(444n);
|
|
1558
|
+
});
|
|
1547
1559
|
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1560
|
+
test("extracts scalar value from four-level nested tuple (max depth)", () => {
|
|
1561
|
+
const args = [
|
|
1562
|
+
[
|
|
1563
|
+
[
|
|
1564
|
+
[
|
|
1565
|
+
[1n, 2n, 3n],
|
|
1566
|
+
[4n, 5n, 6n]
|
|
1567
|
+
],
|
|
1568
|
+
[[7n, 8n], [9n, 10n]]
|
|
1569
|
+
]
|
|
1570
|
+
]
|
|
1571
|
+
];
|
|
1572
|
+
const fieldIndex = packFieldIndexes([0, 0, 0, 1, 2]);
|
|
1573
|
+
|
|
1574
|
+
const result = getScalarValue(args, fieldIndex);
|
|
1575
|
+
expect(result).toBe(6n);
|
|
1552
1576
|
});
|
|
1553
1577
|
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1578
|
+
test("throws error when field index unpacks to empty array", () => {
|
|
1579
|
+
const args = [123n, 456n];
|
|
1580
|
+
const fieldIndex = 0xFFFFFFF;
|
|
1557
1581
|
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1582
|
+
expect(() => getScalarValue(args, fieldIndex)).toThrowError(
|
|
1583
|
+
"Failed to unpack any indexes from fieldIndex"
|
|
1584
|
+
);
|
|
1585
|
+
});
|
|
1562
1586
|
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
);
|
|
1567
|
-
|
|
1568
|
-
expect(() => unpackCriteriaFieldIndexes(254)).toThrowError(
|
|
1569
|
-
"Field index must be between 32-253"
|
|
1570
|
-
);
|
|
1587
|
+
test("throws error when accessing non-array at intermediate level", () => {
|
|
1588
|
+
const args = [123n, 'not-an-array', 789n];
|
|
1589
|
+
const fieldIndex = packFieldIndexes([1, 0]);
|
|
1571
1590
|
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
});
|
|
1591
|
+
expect(() => getScalarValue(args, fieldIndex)).toThrowError(
|
|
1592
|
+
"Expected array at level 1, but got string"
|
|
1593
|
+
);
|
|
1576
1594
|
});
|
|
1577
1595
|
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
expect(isCriteriaFieldIndexTuple(15)).toBe(false);
|
|
1596
|
+
test("returns early if bigint is found at intermediate level", () => {
|
|
1597
|
+
const args = [123n, 456n, 789n];
|
|
1598
|
+
const fieldIndex = packFieldIndexes([1, 0]);
|
|
1582
1599
|
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1600
|
+
const result = getScalarValue(args, fieldIndex);
|
|
1601
|
+
expect(result).toBe(456n);
|
|
1602
|
+
});
|
|
1586
1603
|
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1604
|
+
test("throws error when index is out of bounds", () => {
|
|
1605
|
+
const args = [[100n, 200n], [300n]];
|
|
1606
|
+
const fieldIndex = packFieldIndexes([1, 5]);
|
|
1607
|
+
|
|
1608
|
+
expect(() => getScalarValue(args, fieldIndex)).toThrowError(
|
|
1609
|
+
"Index 5 is out of bounds at level 1. Array length is 1"
|
|
1610
|
+
);
|
|
1592
1611
|
});
|
|
1593
1612
|
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1613
|
+
test("throws error when final value is not a bigint", () => {
|
|
1614
|
+
const args = [["hello", "world"], [123n, 456n]];
|
|
1615
|
+
const fieldIndex = packFieldIndexes([0, 0]);
|
|
1616
|
+
|
|
1617
|
+
expect(() => getScalarValue(args, fieldIndex)).toThrowError(
|
|
1618
|
+
"Expected bigint at final position, but got string"
|
|
1619
|
+
);
|
|
1620
|
+
});
|
|
1621
|
+
|
|
1622
|
+
test("handles direct field access (single index)", () => {
|
|
1623
|
+
const args = [111n, 222n, 333n];
|
|
1624
|
+
const fieldIndex = packFieldIndexes([2]);
|
|
1625
|
+
|
|
1626
|
+
const result = getScalarValue(args, fieldIndex);
|
|
1627
|
+
expect(result).toBe(333n);
|
|
1628
|
+
});
|
|
1629
|
+
|
|
1630
|
+
test("throws error for index exceeding max field index", () => {
|
|
1631
|
+
expect(() => packFieldIndexes([0, 64])).toThrowError(
|
|
1632
|
+
"Index 64 exceeds the maximum allowed value"
|
|
1633
|
+
);
|
|
1605
1634
|
});
|
|
1606
1635
|
});
|
|
1607
1636
|
|
|
@@ -1945,6 +1945,8 @@ export function decodeAndReorderLogArgs(event: AbiEvent, log: Log) {
|
|
|
1945
1945
|
}
|
|
1946
1946
|
|
|
1947
1947
|
/**
|
|
1948
|
+
* @deprecated Do not use CriteriaFieldIndex methods. Use {@link packFieldIndexes} instead.
|
|
1949
|
+
*
|
|
1948
1950
|
* IMPORTANT: For variable incentive criteria use only.
|
|
1949
1951
|
* Do NOT use for action steps - use {@link packFieldIndexes} instead.
|
|
1950
1952
|
*
|
|
@@ -1977,6 +1979,8 @@ export function packCriteriaFieldIndexes([firstIndex, secondIndex]: [
|
|
|
1977
1979
|
}
|
|
1978
1980
|
|
|
1979
1981
|
/**
|
|
1982
|
+
* @deprecated Do not use CriteriaFieldIndex methods. Use {@link unpackFieldIndexes} instead.
|
|
1983
|
+
*
|
|
1980
1984
|
* Unpacks a uint8 packed index value into an array of indices.
|
|
1981
1985
|
*
|
|
1982
1986
|
* @export
|
|
@@ -1997,6 +2001,8 @@ export function unpackCriteriaFieldIndexes(packed: number): [number, number] {
|
|
|
1997
2001
|
}
|
|
1998
2002
|
|
|
1999
2003
|
/**
|
|
2004
|
+
* @deprecated Do not use CriteriaFieldIndex methods. Use {@link packFieldIndexes} instead.
|
|
2005
|
+
*
|
|
2000
2006
|
* Determines if a fieldIndex represents a tuple index (value >= 32) or a normal field index.
|
|
2001
2007
|
*
|
|
2002
2008
|
* @export
|
|
@@ -2038,55 +2044,76 @@ export function unpackClaimantFieldIndexes(packed: number): [number, number] {
|
|
|
2038
2044
|
}
|
|
2039
2045
|
|
|
2040
2046
|
/**
|
|
2041
|
-
* Extracts a scalar value from
|
|
2042
|
-
*
|
|
2047
|
+
* Extracts a scalar value from event or function arguments using a field index.
|
|
2048
|
+
* Supports both direct field access and nested tuple access (up to 4 levels).
|
|
2043
2049
|
*
|
|
2044
2050
|
* @export
|
|
2045
2051
|
* @param {unknown[]} args - The decoded arguments from an event or function call
|
|
2046
|
-
* @param {number} fieldIndex - The
|
|
2052
|
+
* @param {number} fieldIndex - The packed field index (supports both direct and nested access)
|
|
2047
2053
|
* @returns {bigint} The extracted scalar value as a bigint
|
|
2048
2054
|
* @throws {DecodedArgsError} If arguments are missing or cannot be converted to bigint
|
|
2049
2055
|
*/
|
|
2050
|
-
export function
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
)
|
|
2054
|
-
if (!isCriteriaFieldIndexTuple(fieldIndex)) {
|
|
2056
|
+
export function getScalarValue(args: unknown[], fieldIndex: number): bigint {
|
|
2057
|
+
const indexes = unpackFieldIndexes(fieldIndex);
|
|
2058
|
+
|
|
2059
|
+
if (indexes.length === 0) {
|
|
2055
2060
|
throw new DecodedArgsError(
|
|
2056
|
-
`
|
|
2061
|
+
`Failed to unpack any indexes from fieldIndex ${fieldIndex}`,
|
|
2057
2062
|
);
|
|
2058
2063
|
}
|
|
2059
2064
|
|
|
2060
|
-
|
|
2065
|
+
let scalarValue: unknown = args;
|
|
2061
2066
|
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
`Failed to unpack field indexes from ${fieldIndex}`,
|
|
2065
|
-
);
|
|
2066
|
-
}
|
|
2067
|
+
for (let level = 0; level < indexes.length; level++) {
|
|
2068
|
+
const idx = indexes[level];
|
|
2067
2069
|
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2070
|
+
if (idx === undefined) {
|
|
2071
|
+
throw new DecodedArgsError(`Undefined index at level ${level}`);
|
|
2072
|
+
}
|
|
2071
2073
|
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
)
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2074
|
+
if (typeof scalarValue === 'bigint') {
|
|
2075
|
+
return scalarValue;
|
|
2076
|
+
}
|
|
2077
|
+
|
|
2078
|
+
if (!Array.isArray(scalarValue)) {
|
|
2079
|
+
throw new DecodedArgsError(
|
|
2080
|
+
`Expected array at level ${level}, but got ${typeof scalarValue}`,
|
|
2081
|
+
);
|
|
2082
|
+
}
|
|
2083
|
+
|
|
2084
|
+
if (idx >= scalarValue.length) {
|
|
2085
|
+
throw new DecodedArgsError(
|
|
2086
|
+
`Index ${idx} is out of bounds at level ${level}. Array length is ${scalarValue.length}`,
|
|
2087
|
+
);
|
|
2088
|
+
}
|
|
2089
|
+
|
|
2090
|
+
scalarValue = scalarValue[idx];
|
|
2082
2091
|
}
|
|
2083
2092
|
|
|
2084
|
-
const scalarValue = tuple[index1] as unknown;
|
|
2085
2093
|
if (typeof scalarValue !== 'bigint') {
|
|
2086
2094
|
throw new DecodedArgsError(
|
|
2087
|
-
`Expected bigint at
|
|
2095
|
+
`Expected bigint at final position, but got ${typeof scalarValue}`,
|
|
2088
2096
|
);
|
|
2089
2097
|
}
|
|
2090
2098
|
|
|
2091
2099
|
return scalarValue;
|
|
2092
2100
|
}
|
|
2101
|
+
|
|
2102
|
+
/**
|
|
2103
|
+
* @deprecated Use {@link getScalarValue} instead.
|
|
2104
|
+
*
|
|
2105
|
+
* Extracts a scalar value from a tuple within event or function arguments.
|
|
2106
|
+
* This is used for incentive criteria when determining reward amounts.
|
|
2107
|
+
*
|
|
2108
|
+
* @export
|
|
2109
|
+
* @param {unknown[]} args - The decoded arguments from an event or function call
|
|
2110
|
+
* @param {number} fieldIndex - The tuple-encoded index
|
|
2111
|
+
* @returns {bigint} The extracted scalar value as a bigint
|
|
2112
|
+
* @throws {DecodedArgsError} If arguments are missing or cannot be converted to bigint
|
|
2113
|
+
*/
|
|
2114
|
+
export function getScalarValueFromTuple(
|
|
2115
|
+
args: unknown[],
|
|
2116
|
+
fieldIndex: number,
|
|
2117
|
+
): bigint {
|
|
2118
|
+
return getScalarValue(args, fieldIndex);
|
|
2119
|
+
}
|
|
@@ -38,8 +38,7 @@ import { ERC20PeggedVariableCriteriaIncentiveV2 as ERC20PeggedVariableCriteriaIn
|
|
|
38
38
|
import {
|
|
39
39
|
SignatureType,
|
|
40
40
|
decodeAndReorderLogArgs,
|
|
41
|
-
|
|
42
|
-
isCriteriaFieldIndexTuple,
|
|
41
|
+
getScalarValue,
|
|
43
42
|
} from '../Actions/EventAction';
|
|
44
43
|
import type {
|
|
45
44
|
DeployableOptions,
|
|
@@ -269,17 +268,13 @@ export class ERC20PeggedVariableCriteriaIncentiveV2 extends DeployableTarget<
|
|
|
269
268
|
|
|
270
269
|
if (signatureMatchingLogs.length > 0) {
|
|
271
270
|
for (const log of signatureMatchingLogs) {
|
|
272
|
-
|
|
273
|
-
return
|
|
271
|
+
try {
|
|
272
|
+
return getScalarValue(
|
|
274
273
|
log.args as unknown[],
|
|
275
274
|
criteria.fieldIndex,
|
|
276
275
|
);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
? (log.args as string[])[criteria.fieldIndex]
|
|
280
|
-
: undefined;
|
|
281
|
-
if (scalarValue !== undefined) {
|
|
282
|
-
return BigInt(scalarValue);
|
|
276
|
+
} catch {
|
|
277
|
+
continue;
|
|
283
278
|
}
|
|
284
279
|
}
|
|
285
280
|
}
|
|
@@ -315,23 +310,10 @@ export class ERC20PeggedVariableCriteriaIncentiveV2 extends DeployableTarget<
|
|
|
315
310
|
);
|
|
316
311
|
}
|
|
317
312
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
);
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
const scalarValue =
|
|
326
|
-
decodedEvents[0] && decodedEvents[0].args
|
|
327
|
-
? (decodedEvents[0].args as string[])[criteria.fieldIndex]
|
|
328
|
-
: undefined;
|
|
329
|
-
if (scalarValue === undefined) {
|
|
330
|
-
throw new DecodedArgsError(
|
|
331
|
-
`Decoded argument at index ${criteria.fieldIndex} is undefined`,
|
|
332
|
-
);
|
|
333
|
-
}
|
|
334
|
-
return BigInt(scalarValue);
|
|
313
|
+
return getScalarValue(
|
|
314
|
+
decodedEvents[0]?.args as unknown[],
|
|
315
|
+
criteria.fieldIndex,
|
|
316
|
+
);
|
|
335
317
|
} catch (e) {
|
|
336
318
|
throw new DecodedArgsError(
|
|
337
319
|
`Failed to decode event log for signature ${criteria.signature}: ${(e as Error).message}`,
|
|
@@ -351,20 +333,10 @@ export class ERC20PeggedVariableCriteriaIncentiveV2 extends DeployableTarget<
|
|
|
351
333
|
data: transaction.input,
|
|
352
334
|
});
|
|
353
335
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
);
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
const scalarValue = decodedFunction.args[criteria.fieldIndex] as string;
|
|
362
|
-
if (scalarValue === undefined || scalarValue === null) {
|
|
363
|
-
throw new DecodedArgsError(
|
|
364
|
-
`Decoded argument at index ${criteria.fieldIndex} is undefined`,
|
|
365
|
-
);
|
|
366
|
-
}
|
|
367
|
-
return BigInt(scalarValue);
|
|
336
|
+
return getScalarValue(
|
|
337
|
+
decodedFunction.args as unknown[],
|
|
338
|
+
criteria.fieldIndex,
|
|
339
|
+
);
|
|
368
340
|
} catch (e) {
|
|
369
341
|
throw new DecodedArgsError(
|
|
370
342
|
`Failed to decode function data for signature ${criteria.signature}: ${(e as Error).message}`,
|
|
@@ -24,8 +24,7 @@ import {
|
|
|
24
24
|
SignatureType,
|
|
25
25
|
ValueType,
|
|
26
26
|
decodeAndReorderLogArgs,
|
|
27
|
-
|
|
28
|
-
isCriteriaFieldIndexTuple,
|
|
27
|
+
getScalarValue,
|
|
29
28
|
} from '../Actions/EventAction';
|
|
30
29
|
import type {
|
|
31
30
|
DeployableOptions,
|
|
@@ -283,17 +282,13 @@ export class ERC20VariableCriteriaIncentiveV2 extends ERC20VariableIncentive<
|
|
|
283
282
|
|
|
284
283
|
if (signatureMatchingLogs.length > 0) {
|
|
285
284
|
for (const log of signatureMatchingLogs) {
|
|
286
|
-
|
|
287
|
-
return
|
|
285
|
+
try {
|
|
286
|
+
return getScalarValue(
|
|
288
287
|
log.args as unknown[],
|
|
289
288
|
criteria.fieldIndex,
|
|
290
289
|
);
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
? (log.args as string[])[criteria.fieldIndex]
|
|
294
|
-
: undefined;
|
|
295
|
-
if (scalarValue !== undefined) {
|
|
296
|
-
return BigInt(scalarValue);
|
|
290
|
+
} catch {
|
|
291
|
+
continue;
|
|
297
292
|
}
|
|
298
293
|
}
|
|
299
294
|
}
|
|
@@ -329,23 +324,10 @@ export class ERC20VariableCriteriaIncentiveV2 extends ERC20VariableIncentive<
|
|
|
329
324
|
);
|
|
330
325
|
}
|
|
331
326
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
);
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
const scalarValue =
|
|
340
|
-
decodedEvents[0] && decodedEvents[0].args
|
|
341
|
-
? (decodedEvents[0].args as string[])[criteria.fieldIndex]
|
|
342
|
-
: undefined;
|
|
343
|
-
if (scalarValue === undefined) {
|
|
344
|
-
throw new DecodedArgsError(
|
|
345
|
-
`Decoded argument at index ${criteria.fieldIndex} is undefined`,
|
|
346
|
-
);
|
|
347
|
-
}
|
|
348
|
-
return BigInt(scalarValue);
|
|
327
|
+
return getScalarValue(
|
|
328
|
+
decodedEvents[0]?.args as unknown[],
|
|
329
|
+
criteria.fieldIndex,
|
|
330
|
+
);
|
|
349
331
|
} catch (e) {
|
|
350
332
|
throw new DecodedArgsError(
|
|
351
333
|
`Failed to decode event log for signature ${criteria.signature}: ${(e as Error).message}`,
|
|
@@ -365,20 +347,10 @@ export class ERC20VariableCriteriaIncentiveV2 extends ERC20VariableIncentive<
|
|
|
365
347
|
data: transaction.input,
|
|
366
348
|
});
|
|
367
349
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
);
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
const scalarValue = decodedFunction.args[criteria.fieldIndex] as string;
|
|
376
|
-
if (scalarValue === undefined || scalarValue === null) {
|
|
377
|
-
throw new DecodedArgsError(
|
|
378
|
-
`Decoded argument at index ${criteria.fieldIndex} is undefined`,
|
|
379
|
-
);
|
|
380
|
-
}
|
|
381
|
-
return BigInt(scalarValue);
|
|
350
|
+
return getScalarValue(
|
|
351
|
+
decodedFunction.args as unknown[],
|
|
352
|
+
criteria.fieldIndex,
|
|
353
|
+
);
|
|
382
354
|
} catch (e) {
|
|
383
355
|
throw new DecodedArgsError(
|
|
384
356
|
`Failed to decode function data for signature ${criteria.signature}: ${(e as Error).message}`,
|