@oddmaki-protocol/sdk 1.4.0 → 1.5.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/index.d.mts +48 -1
- package/dist/index.d.ts +48 -1
- package/dist/index.js +122 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +121 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -9264,6 +9264,27 @@ declare class UmaModule extends BaseModule {
|
|
|
9264
9264
|
* Settle an assertion after the liveness period
|
|
9265
9265
|
*/
|
|
9266
9266
|
settleAssertion(assertionId: `0x${string}`): Promise<`0x${string}`>;
|
|
9267
|
+
/**
|
|
9268
|
+
* Get the UMA Optimistic Oracle V3 address for the active Diamond.
|
|
9269
|
+
*/
|
|
9270
|
+
getUmaOracleAddress(): Promise<Address>;
|
|
9271
|
+
/**
|
|
9272
|
+
* Dispute an active assertion directly on the UMA Optimistic Oracle V3.
|
|
9273
|
+
*
|
|
9274
|
+
* The dispute escalates the assertion to UMA's DVM, which arbitrates the
|
|
9275
|
+
* outcome via tokenholder vote. The disputer must post a bond equal to the
|
|
9276
|
+
* asserter's bond — the winner is reimbursed and receives a share of the
|
|
9277
|
+
* loser's bond.
|
|
9278
|
+
*
|
|
9279
|
+
* @param params.assertionId - The active assertionId to dispute
|
|
9280
|
+
* @param params.autoApprove - Approve the bond currency to the oracle if needed (default: true)
|
|
9281
|
+
*
|
|
9282
|
+
* @returns Transaction hash
|
|
9283
|
+
*/
|
|
9284
|
+
disputeAssertion(params: {
|
|
9285
|
+
assertionId: `0x${string}`;
|
|
9286
|
+
autoApprove?: boolean;
|
|
9287
|
+
}): Promise<`0x${string}`>;
|
|
9267
9288
|
/**
|
|
9268
9289
|
* Report resolution after UMA settlement
|
|
9269
9290
|
*/
|
|
@@ -9328,6 +9349,8 @@ declare class UmaModule extends BaseModule {
|
|
|
9328
9349
|
canSettle: boolean;
|
|
9329
9350
|
disputer: `0x${string}`;
|
|
9330
9351
|
isDisputed: boolean;
|
|
9352
|
+
currency: Address;
|
|
9353
|
+
bond: bigint;
|
|
9331
9354
|
}>;
|
|
9332
9355
|
/**
|
|
9333
9356
|
* Get comprehensive market status for UMA resolution
|
|
@@ -9619,6 +9642,11 @@ declare const CONTRACT_ADDRESSES: {
|
|
|
9619
9642
|
readonly subgraph: "https://api.studio.thegraph.com/query/1716020/oddmaki-base/version/latest";
|
|
9620
9643
|
};
|
|
9621
9644
|
};
|
|
9645
|
+
declare const SUBGRAPH_IDS: {
|
|
9646
|
+
readonly 8453: "CxoYVjELrNCMLopAmVshnfVAie7yH6QZyCSKD3r41XSQ";
|
|
9647
|
+
readonly 84532: "DCnd3ozSyvYxRg7kmZYiDWGBiJCe6QHwu8M93jMN1Q3b";
|
|
9648
|
+
};
|
|
9649
|
+
declare function buildSubgraphGatewayUrl(chainId: number, apiKey: string): string | undefined;
|
|
9622
9650
|
declare const DEFAULT_CHAIN: {
|
|
9623
9651
|
blockExplorers: {
|
|
9624
9652
|
readonly default: {
|
|
@@ -17245,6 +17273,25 @@ var UmaOracle = [
|
|
|
17245
17273
|
outputs: [
|
|
17246
17274
|
],
|
|
17247
17275
|
stateMutability: "nonpayable"
|
|
17276
|
+
},
|
|
17277
|
+
{
|
|
17278
|
+
type: "function",
|
|
17279
|
+
name: "disputeAssertion",
|
|
17280
|
+
inputs: [
|
|
17281
|
+
{
|
|
17282
|
+
name: "assertionId",
|
|
17283
|
+
type: "bytes32",
|
|
17284
|
+
internalType: "bytes32"
|
|
17285
|
+
},
|
|
17286
|
+
{
|
|
17287
|
+
name: "disputer",
|
|
17288
|
+
type: "address",
|
|
17289
|
+
internalType: "address"
|
|
17290
|
+
}
|
|
17291
|
+
],
|
|
17292
|
+
outputs: [
|
|
17293
|
+
],
|
|
17294
|
+
stateMutability: "nonpayable"
|
|
17248
17295
|
}
|
|
17249
17296
|
];
|
|
17250
17297
|
|
|
@@ -17386,4 +17433,4 @@ declare function parseMetadata<T extends {
|
|
|
17386
17433
|
|
|
17387
17434
|
declare const version = "0.1.0";
|
|
17388
17435
|
|
|
17389
|
-
export { AccessControlFacet as AccessControlFacetABI, AccessControlModule, BatchOrdersFacet as BatchOrdersFacetABI, CONTRACT_ADDRESSES, type ChancePercentInput, ConditionalTokens as ConditionalTokensABI, DEFAULT_CHAIN, ERC20 as ERC20ABI, FeedProvider, GET_ALL_MARKETS_FEED, GET_ALL_MARKETS_FEED_BY_VOLUME, GET_CHART_TRADES, GET_CHART_TRADES_ALL, GET_GROUP_MARKETS, GET_LEADERBOARD, GET_MARKET, GET_MARKETS, GET_MARKETS_WITH_PRICING, GET_MARKET_GROUP, GET_MARKET_GROUPS, GET_MARKET_GROUP_ITEM, GET_MARKET_TOP_HOLDERS, GET_ORDERS, GET_PROTOCOL_STATS, GET_QUESTION, GET_QUESTIONS, GET_RECENT_MARKETS, GET_RECENT_TRADES, GET_TOP_OF_BOOK, GET_TRADER_CLOSED_POSITIONS, GET_TRADER_FILLS, GET_TRADER_POSITIONS, GET_TRADER_PROFILE, GET_TRADES, GET_UNIFIED_MARKET_FEED, GET_UNIFIED_MARKET_FEED_BY_VOLUME, GET_USER, GET_VENUES, LimitOrdersFacet as LimitOrdersFacetABI, MarketGroupFacet as MarketGroupFacetABI, type MarketMetadata, MarketModule, MarketOrdersFacet as MarketOrdersFacetABI, type MarketQuestion, type MarketStatus, MarketsFacet as MarketsFacetABI, MatchingFacet as MatchingFacetABI, MetadataFacet as MetadataFacetABI, NegRiskFacet as NegRiskFacetABI, OddMakiClient, type OddMakiClientConfig, type OddMakiConfig, OrderBookFacet as OrderBookFacetABI, PROTOCOL_FEES, type PriceMarketData, PriceMarketFacet as PriceMarketFacetABI, PriceMarketModule, ProtocolFacet as ProtocolFacetABI, PublicModule, PythResolutionFacet as PythResolutionFacetABI, type PythUpdate, ResolutionFacet as ResolutionFacetABI, SubgraphClient, type SubgraphMarketPriceData, TICK_SIZE_FINE, TICK_SIZE_STANDARD, TagsFacet as TagsFacetABI, TokenModule, type TopOfBookEntry, TradeModule, UMA_DEFAULTS, UmaModule, UmaOracle as UmaOracleABI, VALID_TICK_SIZES, VaultFacet as VaultFacetABI, VenueFacet as VenueFacetABI, type VenueMetadata, VenueModule, WhitelistAccessControl as WhitelistAccessControlABI, calculateChancePercent, clearDecimalsCache, createExpiry, createOddMakiClient, formatAmount, formatAncillaryData, formatTimestamp, getCachedTokenDecimals, getOutcomePrice, getTokenDecimals, isValidTickSize, parseAmount, parseAncillaryData, parseMetadata, parseTokenAmount, priceToTick, resolveIPFSUri, tickToPercentage, tickToPrice, version };
|
|
17436
|
+
export { AccessControlFacet as AccessControlFacetABI, AccessControlModule, BatchOrdersFacet as BatchOrdersFacetABI, CONTRACT_ADDRESSES, type ChancePercentInput, ConditionalTokens as ConditionalTokensABI, DEFAULT_CHAIN, ERC20 as ERC20ABI, FeedProvider, GET_ALL_MARKETS_FEED, GET_ALL_MARKETS_FEED_BY_VOLUME, GET_CHART_TRADES, GET_CHART_TRADES_ALL, GET_GROUP_MARKETS, GET_LEADERBOARD, GET_MARKET, GET_MARKETS, GET_MARKETS_WITH_PRICING, GET_MARKET_GROUP, GET_MARKET_GROUPS, GET_MARKET_GROUP_ITEM, GET_MARKET_TOP_HOLDERS, GET_ORDERS, GET_PROTOCOL_STATS, GET_QUESTION, GET_QUESTIONS, GET_RECENT_MARKETS, GET_RECENT_TRADES, GET_TOP_OF_BOOK, GET_TRADER_CLOSED_POSITIONS, GET_TRADER_FILLS, GET_TRADER_POSITIONS, GET_TRADER_PROFILE, GET_TRADES, GET_UNIFIED_MARKET_FEED, GET_UNIFIED_MARKET_FEED_BY_VOLUME, GET_USER, GET_VENUES, LimitOrdersFacet as LimitOrdersFacetABI, MarketGroupFacet as MarketGroupFacetABI, type MarketMetadata, MarketModule, MarketOrdersFacet as MarketOrdersFacetABI, type MarketQuestion, type MarketStatus, MarketsFacet as MarketsFacetABI, MatchingFacet as MatchingFacetABI, MetadataFacet as MetadataFacetABI, NegRiskFacet as NegRiskFacetABI, OddMakiClient, type OddMakiClientConfig, type OddMakiConfig, OrderBookFacet as OrderBookFacetABI, PROTOCOL_FEES, type PriceMarketData, PriceMarketFacet as PriceMarketFacetABI, PriceMarketModule, ProtocolFacet as ProtocolFacetABI, PublicModule, PythResolutionFacet as PythResolutionFacetABI, type PythUpdate, ResolutionFacet as ResolutionFacetABI, SUBGRAPH_IDS, SubgraphClient, type SubgraphMarketPriceData, TICK_SIZE_FINE, TICK_SIZE_STANDARD, TagsFacet as TagsFacetABI, TokenModule, type TopOfBookEntry, TradeModule, UMA_DEFAULTS, UmaModule, UmaOracle as UmaOracleABI, VALID_TICK_SIZES, VaultFacet as VaultFacetABI, VenueFacet as VenueFacetABI, type VenueMetadata, VenueModule, WhitelistAccessControl as WhitelistAccessControlABI, buildSubgraphGatewayUrl, calculateChancePercent, clearDecimalsCache, createExpiry, createOddMakiClient, formatAmount, formatAncillaryData, formatTimestamp, getCachedTokenDecimals, getOutcomePrice, getTokenDecimals, isValidTickSize, parseAmount, parseAncillaryData, parseMetadata, parseTokenAmount, priceToTick, resolveIPFSUri, tickToPercentage, tickToPrice, version };
|
package/dist/index.d.ts
CHANGED
|
@@ -9264,6 +9264,27 @@ declare class UmaModule extends BaseModule {
|
|
|
9264
9264
|
* Settle an assertion after the liveness period
|
|
9265
9265
|
*/
|
|
9266
9266
|
settleAssertion(assertionId: `0x${string}`): Promise<`0x${string}`>;
|
|
9267
|
+
/**
|
|
9268
|
+
* Get the UMA Optimistic Oracle V3 address for the active Diamond.
|
|
9269
|
+
*/
|
|
9270
|
+
getUmaOracleAddress(): Promise<Address>;
|
|
9271
|
+
/**
|
|
9272
|
+
* Dispute an active assertion directly on the UMA Optimistic Oracle V3.
|
|
9273
|
+
*
|
|
9274
|
+
* The dispute escalates the assertion to UMA's DVM, which arbitrates the
|
|
9275
|
+
* outcome via tokenholder vote. The disputer must post a bond equal to the
|
|
9276
|
+
* asserter's bond — the winner is reimbursed and receives a share of the
|
|
9277
|
+
* loser's bond.
|
|
9278
|
+
*
|
|
9279
|
+
* @param params.assertionId - The active assertionId to dispute
|
|
9280
|
+
* @param params.autoApprove - Approve the bond currency to the oracle if needed (default: true)
|
|
9281
|
+
*
|
|
9282
|
+
* @returns Transaction hash
|
|
9283
|
+
*/
|
|
9284
|
+
disputeAssertion(params: {
|
|
9285
|
+
assertionId: `0x${string}`;
|
|
9286
|
+
autoApprove?: boolean;
|
|
9287
|
+
}): Promise<`0x${string}`>;
|
|
9267
9288
|
/**
|
|
9268
9289
|
* Report resolution after UMA settlement
|
|
9269
9290
|
*/
|
|
@@ -9328,6 +9349,8 @@ declare class UmaModule extends BaseModule {
|
|
|
9328
9349
|
canSettle: boolean;
|
|
9329
9350
|
disputer: `0x${string}`;
|
|
9330
9351
|
isDisputed: boolean;
|
|
9352
|
+
currency: Address;
|
|
9353
|
+
bond: bigint;
|
|
9331
9354
|
}>;
|
|
9332
9355
|
/**
|
|
9333
9356
|
* Get comprehensive market status for UMA resolution
|
|
@@ -9619,6 +9642,11 @@ declare const CONTRACT_ADDRESSES: {
|
|
|
9619
9642
|
readonly subgraph: "https://api.studio.thegraph.com/query/1716020/oddmaki-base/version/latest";
|
|
9620
9643
|
};
|
|
9621
9644
|
};
|
|
9645
|
+
declare const SUBGRAPH_IDS: {
|
|
9646
|
+
readonly 8453: "CxoYVjELrNCMLopAmVshnfVAie7yH6QZyCSKD3r41XSQ";
|
|
9647
|
+
readonly 84532: "DCnd3ozSyvYxRg7kmZYiDWGBiJCe6QHwu8M93jMN1Q3b";
|
|
9648
|
+
};
|
|
9649
|
+
declare function buildSubgraphGatewayUrl(chainId: number, apiKey: string): string | undefined;
|
|
9622
9650
|
declare const DEFAULT_CHAIN: {
|
|
9623
9651
|
blockExplorers: {
|
|
9624
9652
|
readonly default: {
|
|
@@ -17245,6 +17273,25 @@ var UmaOracle = [
|
|
|
17245
17273
|
outputs: [
|
|
17246
17274
|
],
|
|
17247
17275
|
stateMutability: "nonpayable"
|
|
17276
|
+
},
|
|
17277
|
+
{
|
|
17278
|
+
type: "function",
|
|
17279
|
+
name: "disputeAssertion",
|
|
17280
|
+
inputs: [
|
|
17281
|
+
{
|
|
17282
|
+
name: "assertionId",
|
|
17283
|
+
type: "bytes32",
|
|
17284
|
+
internalType: "bytes32"
|
|
17285
|
+
},
|
|
17286
|
+
{
|
|
17287
|
+
name: "disputer",
|
|
17288
|
+
type: "address",
|
|
17289
|
+
internalType: "address"
|
|
17290
|
+
}
|
|
17291
|
+
],
|
|
17292
|
+
outputs: [
|
|
17293
|
+
],
|
|
17294
|
+
stateMutability: "nonpayable"
|
|
17248
17295
|
}
|
|
17249
17296
|
];
|
|
17250
17297
|
|
|
@@ -17386,4 +17433,4 @@ declare function parseMetadata<T extends {
|
|
|
17386
17433
|
|
|
17387
17434
|
declare const version = "0.1.0";
|
|
17388
17435
|
|
|
17389
|
-
export { AccessControlFacet as AccessControlFacetABI, AccessControlModule, BatchOrdersFacet as BatchOrdersFacetABI, CONTRACT_ADDRESSES, type ChancePercentInput, ConditionalTokens as ConditionalTokensABI, DEFAULT_CHAIN, ERC20 as ERC20ABI, FeedProvider, GET_ALL_MARKETS_FEED, GET_ALL_MARKETS_FEED_BY_VOLUME, GET_CHART_TRADES, GET_CHART_TRADES_ALL, GET_GROUP_MARKETS, GET_LEADERBOARD, GET_MARKET, GET_MARKETS, GET_MARKETS_WITH_PRICING, GET_MARKET_GROUP, GET_MARKET_GROUPS, GET_MARKET_GROUP_ITEM, GET_MARKET_TOP_HOLDERS, GET_ORDERS, GET_PROTOCOL_STATS, GET_QUESTION, GET_QUESTIONS, GET_RECENT_MARKETS, GET_RECENT_TRADES, GET_TOP_OF_BOOK, GET_TRADER_CLOSED_POSITIONS, GET_TRADER_FILLS, GET_TRADER_POSITIONS, GET_TRADER_PROFILE, GET_TRADES, GET_UNIFIED_MARKET_FEED, GET_UNIFIED_MARKET_FEED_BY_VOLUME, GET_USER, GET_VENUES, LimitOrdersFacet as LimitOrdersFacetABI, MarketGroupFacet as MarketGroupFacetABI, type MarketMetadata, MarketModule, MarketOrdersFacet as MarketOrdersFacetABI, type MarketQuestion, type MarketStatus, MarketsFacet as MarketsFacetABI, MatchingFacet as MatchingFacetABI, MetadataFacet as MetadataFacetABI, NegRiskFacet as NegRiskFacetABI, OddMakiClient, type OddMakiClientConfig, type OddMakiConfig, OrderBookFacet as OrderBookFacetABI, PROTOCOL_FEES, type PriceMarketData, PriceMarketFacet as PriceMarketFacetABI, PriceMarketModule, ProtocolFacet as ProtocolFacetABI, PublicModule, PythResolutionFacet as PythResolutionFacetABI, type PythUpdate, ResolutionFacet as ResolutionFacetABI, SubgraphClient, type SubgraphMarketPriceData, TICK_SIZE_FINE, TICK_SIZE_STANDARD, TagsFacet as TagsFacetABI, TokenModule, type TopOfBookEntry, TradeModule, UMA_DEFAULTS, UmaModule, UmaOracle as UmaOracleABI, VALID_TICK_SIZES, VaultFacet as VaultFacetABI, VenueFacet as VenueFacetABI, type VenueMetadata, VenueModule, WhitelistAccessControl as WhitelistAccessControlABI, calculateChancePercent, clearDecimalsCache, createExpiry, createOddMakiClient, formatAmount, formatAncillaryData, formatTimestamp, getCachedTokenDecimals, getOutcomePrice, getTokenDecimals, isValidTickSize, parseAmount, parseAncillaryData, parseMetadata, parseTokenAmount, priceToTick, resolveIPFSUri, tickToPercentage, tickToPrice, version };
|
|
17436
|
+
export { AccessControlFacet as AccessControlFacetABI, AccessControlModule, BatchOrdersFacet as BatchOrdersFacetABI, CONTRACT_ADDRESSES, type ChancePercentInput, ConditionalTokens as ConditionalTokensABI, DEFAULT_CHAIN, ERC20 as ERC20ABI, FeedProvider, GET_ALL_MARKETS_FEED, GET_ALL_MARKETS_FEED_BY_VOLUME, GET_CHART_TRADES, GET_CHART_TRADES_ALL, GET_GROUP_MARKETS, GET_LEADERBOARD, GET_MARKET, GET_MARKETS, GET_MARKETS_WITH_PRICING, GET_MARKET_GROUP, GET_MARKET_GROUPS, GET_MARKET_GROUP_ITEM, GET_MARKET_TOP_HOLDERS, GET_ORDERS, GET_PROTOCOL_STATS, GET_QUESTION, GET_QUESTIONS, GET_RECENT_MARKETS, GET_RECENT_TRADES, GET_TOP_OF_BOOK, GET_TRADER_CLOSED_POSITIONS, GET_TRADER_FILLS, GET_TRADER_POSITIONS, GET_TRADER_PROFILE, GET_TRADES, GET_UNIFIED_MARKET_FEED, GET_UNIFIED_MARKET_FEED_BY_VOLUME, GET_USER, GET_VENUES, LimitOrdersFacet as LimitOrdersFacetABI, MarketGroupFacet as MarketGroupFacetABI, type MarketMetadata, MarketModule, MarketOrdersFacet as MarketOrdersFacetABI, type MarketQuestion, type MarketStatus, MarketsFacet as MarketsFacetABI, MatchingFacet as MatchingFacetABI, MetadataFacet as MetadataFacetABI, NegRiskFacet as NegRiskFacetABI, OddMakiClient, type OddMakiClientConfig, type OddMakiConfig, OrderBookFacet as OrderBookFacetABI, PROTOCOL_FEES, type PriceMarketData, PriceMarketFacet as PriceMarketFacetABI, PriceMarketModule, ProtocolFacet as ProtocolFacetABI, PublicModule, PythResolutionFacet as PythResolutionFacetABI, type PythUpdate, ResolutionFacet as ResolutionFacetABI, SUBGRAPH_IDS, SubgraphClient, type SubgraphMarketPriceData, TICK_SIZE_FINE, TICK_SIZE_STANDARD, TagsFacet as TagsFacetABI, TokenModule, type TopOfBookEntry, TradeModule, UMA_DEFAULTS, UmaModule, UmaOracle as UmaOracleABI, VALID_TICK_SIZES, VaultFacet as VaultFacetABI, VenueFacet as VenueFacetABI, type VenueMetadata, VenueModule, WhitelistAccessControl as WhitelistAccessControlABI, buildSubgraphGatewayUrl, calculateChancePercent, clearDecimalsCache, createExpiry, createOddMakiClient, formatAmount, formatAncillaryData, formatTimestamp, getCachedTokenDecimals, getOutcomePrice, getTokenDecimals, isValidTickSize, parseAmount, parseAncillaryData, parseMetadata, parseTokenAmount, priceToTick, resolveIPFSUri, tickToPercentage, tickToPrice, version };
|
package/dist/index.js
CHANGED
|
@@ -19,6 +19,14 @@ var CONTRACT_ADDRESSES = {
|
|
|
19
19
|
subgraph: "https://api.studio.thegraph.com/query/1716020/oddmaki-base/version/latest"
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
+
var SUBGRAPH_IDS = {
|
|
23
|
+
[chains.base.id]: "CxoYVjELrNCMLopAmVshnfVAie7yH6QZyCSKD3r41XSQ",
|
|
24
|
+
[chains.baseSepolia.id]: "DCnd3ozSyvYxRg7kmZYiDWGBiJCe6QHwu8M93jMN1Q3b"
|
|
25
|
+
};
|
|
26
|
+
function buildSubgraphGatewayUrl(chainId, apiKey) {
|
|
27
|
+
const id = SUBGRAPH_IDS[chainId];
|
|
28
|
+
return id ? `https://gateway.thegraph.com/api/${apiKey}/subgraphs/id/${id}` : void 0;
|
|
29
|
+
}
|
|
22
30
|
var DEFAULT_CHAIN = chains.base;
|
|
23
31
|
var SubgraphClient = class {
|
|
24
32
|
constructor(endpoint) {
|
|
@@ -7113,6 +7121,24 @@ var UmaOracle_default = [
|
|
|
7113
7121
|
],
|
|
7114
7122
|
outputs: [],
|
|
7115
7123
|
stateMutability: "nonpayable"
|
|
7124
|
+
},
|
|
7125
|
+
{
|
|
7126
|
+
type: "function",
|
|
7127
|
+
name: "disputeAssertion",
|
|
7128
|
+
inputs: [
|
|
7129
|
+
{
|
|
7130
|
+
name: "assertionId",
|
|
7131
|
+
type: "bytes32",
|
|
7132
|
+
internalType: "bytes32"
|
|
7133
|
+
},
|
|
7134
|
+
{
|
|
7135
|
+
name: "disputer",
|
|
7136
|
+
type: "address",
|
|
7137
|
+
internalType: "address"
|
|
7138
|
+
}
|
|
7139
|
+
],
|
|
7140
|
+
outputs: [],
|
|
7141
|
+
stateMutability: "nonpayable"
|
|
7116
7142
|
}
|
|
7117
7143
|
];
|
|
7118
7144
|
|
|
@@ -10491,6 +10517,97 @@ var UmaModule = class extends BaseModule {
|
|
|
10491
10517
|
});
|
|
10492
10518
|
return wallet.writeContract(request);
|
|
10493
10519
|
}
|
|
10520
|
+
/**
|
|
10521
|
+
* Get the UMA Optimistic Oracle V3 address for the active Diamond.
|
|
10522
|
+
*/
|
|
10523
|
+
async getUmaOracleAddress() {
|
|
10524
|
+
return await this.publicClient.readContract({
|
|
10525
|
+
address: this.config.diamondAddress,
|
|
10526
|
+
abi: ProtocolFacet_default,
|
|
10527
|
+
functionName: "getUmaOracle"
|
|
10528
|
+
});
|
|
10529
|
+
}
|
|
10530
|
+
/**
|
|
10531
|
+
* Dispute an active assertion directly on the UMA Optimistic Oracle V3.
|
|
10532
|
+
*
|
|
10533
|
+
* The dispute escalates the assertion to UMA's DVM, which arbitrates the
|
|
10534
|
+
* outcome via tokenholder vote. The disputer must post a bond equal to the
|
|
10535
|
+
* asserter's bond — the winner is reimbursed and receives a share of the
|
|
10536
|
+
* loser's bond.
|
|
10537
|
+
*
|
|
10538
|
+
* @param params.assertionId - The active assertionId to dispute
|
|
10539
|
+
* @param params.autoApprove - Approve the bond currency to the oracle if needed (default: true)
|
|
10540
|
+
*
|
|
10541
|
+
* @returns Transaction hash
|
|
10542
|
+
*/
|
|
10543
|
+
async disputeAssertion(params) {
|
|
10544
|
+
const wallet = this.walletClient;
|
|
10545
|
+
const account = await this.getSignerAccount();
|
|
10546
|
+
const accountAddress = await this.getSignerAddress();
|
|
10547
|
+
const autoApprove = params.autoApprove ?? true;
|
|
10548
|
+
const oracleAddress = await this.getUmaOracleAddress();
|
|
10549
|
+
const assertion = await this.publicClient.readContract({
|
|
10550
|
+
address: oracleAddress,
|
|
10551
|
+
abi: UmaOracle_default,
|
|
10552
|
+
functionName: "getAssertion",
|
|
10553
|
+
args: [params.assertionId]
|
|
10554
|
+
});
|
|
10555
|
+
const currency = assertion.currency;
|
|
10556
|
+
const bondAmount = BigInt(assertion.bond);
|
|
10557
|
+
if (assertion.disputer !== "0x0000000000000000000000000000000000000000") {
|
|
10558
|
+
throw new Error("Assertion has already been disputed");
|
|
10559
|
+
}
|
|
10560
|
+
if (assertion.settled) {
|
|
10561
|
+
throw new Error("Assertion is already settled");
|
|
10562
|
+
}
|
|
10563
|
+
const currentTime = Math.floor(Date.now() / 1e3);
|
|
10564
|
+
if (currentTime >= Number(assertion.expirationTime)) {
|
|
10565
|
+
throw new Error("Liveness period has expired \u2014 assertion can no longer be disputed");
|
|
10566
|
+
}
|
|
10567
|
+
const currentAllowance = await this.publicClient.readContract({
|
|
10568
|
+
address: currency,
|
|
10569
|
+
abi: viem.erc20Abi,
|
|
10570
|
+
functionName: "allowance",
|
|
10571
|
+
args: [accountAddress, oracleAddress]
|
|
10572
|
+
});
|
|
10573
|
+
if (currentAllowance < bondAmount && autoApprove) {
|
|
10574
|
+
const approveHash = await wallet.writeContract({
|
|
10575
|
+
address: currency,
|
|
10576
|
+
abi: viem.erc20Abi,
|
|
10577
|
+
functionName: "approve",
|
|
10578
|
+
args: [oracleAddress, bondAmount],
|
|
10579
|
+
account,
|
|
10580
|
+
chain: this.config.chain
|
|
10581
|
+
});
|
|
10582
|
+
await this.publicClient.waitForTransactionReceipt({
|
|
10583
|
+
hash: approveHash,
|
|
10584
|
+
confirmations: 2
|
|
10585
|
+
});
|
|
10586
|
+
} else if (currentAllowance < bondAmount) {
|
|
10587
|
+
throw new Error(
|
|
10588
|
+
`Insufficient bond currency allowance for oracle. Required: ${bondAmount.toString()}, Current: ${currentAllowance.toString()}.`
|
|
10589
|
+
);
|
|
10590
|
+
}
|
|
10591
|
+
const balance = await this.publicClient.readContract({
|
|
10592
|
+
address: currency,
|
|
10593
|
+
abi: viem.erc20Abi,
|
|
10594
|
+
functionName: "balanceOf",
|
|
10595
|
+
args: [accountAddress]
|
|
10596
|
+
});
|
|
10597
|
+
if (balance < bondAmount) {
|
|
10598
|
+
throw new Error(
|
|
10599
|
+
`Insufficient bond currency balance. Required: ${bondAmount.toString()}, Have: ${balance.toString()}`
|
|
10600
|
+
);
|
|
10601
|
+
}
|
|
10602
|
+
const { request } = await this.publicClient.simulateContract({
|
|
10603
|
+
address: oracleAddress,
|
|
10604
|
+
abi: UmaOracle_default,
|
|
10605
|
+
functionName: "disputeAssertion",
|
|
10606
|
+
args: [params.assertionId, accountAddress],
|
|
10607
|
+
account
|
|
10608
|
+
});
|
|
10609
|
+
return wallet.writeContract(request);
|
|
10610
|
+
}
|
|
10494
10611
|
/**
|
|
10495
10612
|
* Report resolution after UMA settlement
|
|
10496
10613
|
*/
|
|
@@ -10706,7 +10823,9 @@ var UmaModule = class extends BaseModule {
|
|
|
10706
10823
|
expirationTime,
|
|
10707
10824
|
canSettle: currentTime >= expirationTime,
|
|
10708
10825
|
disputer: assertion.disputer,
|
|
10709
|
-
isDisputed: assertion.disputer !== "0x0000000000000000000000000000000000000000"
|
|
10826
|
+
isDisputed: assertion.disputer !== "0x0000000000000000000000000000000000000000",
|
|
10827
|
+
currency: assertion.currency,
|
|
10828
|
+
bond: BigInt(assertion.bond)
|
|
10710
10829
|
};
|
|
10711
10830
|
}
|
|
10712
10831
|
/**
|
|
@@ -11458,6 +11577,7 @@ exports.ProtocolFacetABI = ProtocolFacet_default;
|
|
|
11458
11577
|
exports.PublicModule = PublicModule;
|
|
11459
11578
|
exports.PythResolutionFacetABI = PythResolutionFacet_default;
|
|
11460
11579
|
exports.ResolutionFacetABI = ResolutionFacet_default;
|
|
11580
|
+
exports.SUBGRAPH_IDS = SUBGRAPH_IDS;
|
|
11461
11581
|
exports.SubgraphClient = SubgraphClient;
|
|
11462
11582
|
exports.TICK_SIZE_FINE = TICK_SIZE_FINE;
|
|
11463
11583
|
exports.TICK_SIZE_STANDARD = TICK_SIZE_STANDARD;
|
|
@@ -11472,6 +11592,7 @@ exports.VaultFacetABI = VaultFacet_default;
|
|
|
11472
11592
|
exports.VenueFacetABI = VenueFacet_default;
|
|
11473
11593
|
exports.VenueModule = VenueModule;
|
|
11474
11594
|
exports.WhitelistAccessControlABI = WhitelistAccessControl_default;
|
|
11595
|
+
exports.buildSubgraphGatewayUrl = buildSubgraphGatewayUrl;
|
|
11475
11596
|
exports.calculateChancePercent = calculateChancePercent;
|
|
11476
11597
|
exports.clearDecimalsCache = clearDecimalsCache;
|
|
11477
11598
|
exports.createExpiry = createExpiry;
|