@ottochain/sdk 1.0.2 → 1.1.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/cjs/apps/contracts/state-machines/contract.json +1 -29
- package/dist/cjs/apps/contracts/state-machines/escrow.json +2 -32
- package/dist/cjs/generated/index.js +11 -1
- package/dist/cjs/metakit/drop-nulls.js +50 -0
- package/dist/cjs/metakit/normalize.js +147 -0
- package/dist/cjs/ottochain/metagraph-client.js +147 -0
- package/dist/cjs/validation.js +1 -1
- package/dist/esm/apps/contracts/state-machines/contract.json +1 -29
- package/dist/esm/apps/contracts/state-machines/escrow.json +2 -32
- package/dist/esm/generated/index.js +11 -1
- package/dist/esm/metakit/drop-nulls.js +46 -0
- package/dist/esm/metakit/normalize.js +140 -0
- package/dist/esm/ottochain/metagraph-client.js +147 -0
- package/dist/esm/validation.js +1 -1
- package/dist/types/generated/index.d.ts +11 -1
- package/dist/types/metakit/drop-nulls.d.ts +29 -0
- package/dist/types/metakit/normalize.d.ts +67 -0
- package/dist/types/ottochain/index.d.ts +1 -1
- package/dist/types/ottochain/metagraph-client.d.ts +90 -0
- package/package.json +12 -12
- package/dist/apps/contracts/index.d.ts +0 -21
- package/dist/apps/contracts/index.js +0 -39
- package/dist/apps/contracts/types.d.ts +0 -24
- package/dist/apps/contracts/types.js +0 -48
- package/dist/apps/identity/index.d.ts +0 -22
- package/dist/apps/identity/index.js +0 -40
- package/dist/apps/identity/types.d.ts +0 -30
- package/dist/apps/identity/types.js +0 -53
- package/dist/apps/index.d.ts +0 -29
- package/dist/apps/index.js +0 -60
- package/dist/apps/markets/index.d.ts +0 -26
- package/dist/apps/markets/index.js +0 -46
- package/dist/apps/markets/types.d.ts +0 -185
- package/dist/apps/markets/types.js +0 -252
- package/dist/apps/oracles/index.d.ts +0 -26
- package/dist/apps/oracles/index.js +0 -46
- package/dist/apps/oracles/types.d.ts +0 -211
- package/dist/apps/oracles/types.js +0 -306
- package/dist/cjs/apps/contracts/types.js +0 -48
- package/dist/cjs/apps/corporate/types.js +0 -44
- package/dist/cjs/apps/governance/types.js +0 -42
- package/dist/cjs/apps/identity/types.js +0 -53
- package/dist/cjs/apps/markets/types.js +0 -219
- package/dist/cjs/apps/oracles/types.js +0 -282
- package/dist/cjs/generated/ottochain/apps/contracts/v1/contract_pb.js +0 -100
- package/dist/cjs/generated/ottochain/apps/corporate/v1/corporate_pb.js +0 -392
- package/dist/cjs/generated/ottochain/apps/governance/v1/governance_pb.js +0 -235
- package/dist/cjs/generated/ottochain/apps/identity/v1/agent_pb.js +0 -116
- package/dist/cjs/generated/ottochain/apps/identity/v1/attestation_pb.js +0 -79
- package/dist/cjs/generated/ottochain/apps/markets/v1/market_pb.js +0 -151
- package/dist/cjs/generated/ottochain/apps/oracles/v1/oracle_pb.js +0 -109
- package/dist/cjs/generated/ottochain/v1/common_pb.js +0 -37
- package/dist/cjs/generated/ottochain/v1/fiber_pb.js +0 -86
- package/dist/cjs/generated/ottochain/v1/messages_pb.js +0 -44
- package/dist/cjs/generated/ottochain/v1/records_pb.js +0 -44
- package/dist/errors.d.ts +0 -221
- package/dist/errors.js +0 -293
- package/dist/esm/apps/contracts/types.js +0 -44
- package/dist/esm/apps/corporate/types.js +0 -38
- package/dist/esm/apps/governance/types.js +0 -35
- package/dist/esm/apps/identity/types.js +0 -50
- package/dist/esm/apps/markets/types.js +0 -206
- package/dist/esm/apps/oracles/types.js +0 -267
- package/dist/esm/generated/ottochain/apps/contracts/v1/contract_pb.js +0 -97
- package/dist/esm/generated/ottochain/apps/corporate/v1/corporate_pb.js +0 -389
- package/dist/esm/generated/ottochain/apps/governance/v1/governance_pb.js +0 -232
- package/dist/esm/generated/ottochain/apps/identity/v1/agent_pb.js +0 -113
- package/dist/esm/generated/ottochain/apps/identity/v1/attestation_pb.js +0 -76
- package/dist/esm/generated/ottochain/apps/markets/v1/market_pb.js +0 -148
- package/dist/esm/generated/ottochain/apps/oracles/v1/oracle_pb.js +0 -106
- package/dist/esm/generated/ottochain/v1/common_pb.js +0 -34
- package/dist/esm/generated/ottochain/v1/fiber_pb.js +0 -83
- package/dist/esm/generated/ottochain/v1/messages_pb.js +0 -41
- package/dist/esm/generated/ottochain/v1/records_pb.js +0 -41
- package/dist/generated/index.d.ts +0 -15
- package/dist/generated/index.js +0 -34
- package/dist/generated/ottochain/apps/contracts/v1/contract_pb.d.ts +0 -274
- package/dist/generated/ottochain/apps/contracts/v1/contract_pb.js +0 -100
- package/dist/generated/ottochain/apps/identity/v1/agent_pb.d.ts +0 -211
- package/dist/generated/ottochain/apps/identity/v1/agent_pb.js +0 -116
- package/dist/generated/ottochain/apps/identity/v1/attestation_pb.d.ts +0 -238
- package/dist/generated/ottochain/apps/identity/v1/attestation_pb.js +0 -79
- package/dist/generated/ottochain/apps/markets/v1/market_pb.d.ts +0 -436
- package/dist/generated/ottochain/apps/markets/v1/market_pb.js +0 -151
- package/dist/generated/ottochain/apps/oracles/v1/oracle_pb.d.ts +0 -393
- package/dist/generated/ottochain/apps/oracles/v1/oracle_pb.js +0 -109
- package/dist/generated/ottochain/v1/common_pb.d.ts +0 -86
- package/dist/generated/ottochain/v1/common_pb.js +0 -37
- package/dist/generated/ottochain/v1/fiber_pb.d.ts +0 -292
- package/dist/generated/ottochain/v1/fiber_pb.js +0 -86
- package/dist/generated/ottochain/v1/messages_pb.d.ts +0 -190
- package/dist/generated/ottochain/v1/messages_pb.js +0 -44
- package/dist/generated/ottochain/v1/records_pb.d.ts +0 -221
- package/dist/generated/ottochain/v1/records_pb.js +0 -44
- package/dist/index.d.ts +0 -21
- package/dist/index.js +0 -77
- package/dist/metakit/binary.d.ts +0 -38
- package/dist/metakit/binary.js +0 -58
- package/dist/metakit/canonicalize.d.ts +0 -26
- package/dist/metakit/canonicalize.js +0 -40
- package/dist/metakit/codec.d.ts +0 -16
- package/dist/metakit/codec.js +0 -45
- package/dist/metakit/currency-transaction.d.ts +0 -157
- package/dist/metakit/currency-transaction.js +0 -319
- package/dist/metakit/currency-types.d.ts +0 -55
- package/dist/metakit/currency-types.js +0 -13
- package/dist/metakit/hash.d.ts +0 -50
- package/dist/metakit/hash.js +0 -84
- package/dist/metakit/index.d.ts +0 -23
- package/dist/metakit/index.js +0 -74
- package/dist/metakit/network/client.d.ts +0 -23
- package/dist/metakit/network/client.js +0 -78
- package/dist/metakit/network/currency-l1-client.d.ts +0 -71
- package/dist/metakit/network/currency-l1-client.js +0 -101
- package/dist/metakit/network/data-l1-client.d.ts +0 -57
- package/dist/metakit/network/data-l1-client.js +0 -76
- package/dist/metakit/network/index.d.ts +0 -10
- package/dist/metakit/network/index.js +0 -16
- package/dist/metakit/network/types.d.ts +0 -74
- package/dist/metakit/network/types.js +0 -20
- package/dist/metakit/sign.d.ts +0 -65
- package/dist/metakit/sign.js +0 -120
- package/dist/metakit/signed-object.d.ts +0 -66
- package/dist/metakit/signed-object.js +0 -100
- package/dist/metakit/types.d.ts +0 -67
- package/dist/metakit/types.js +0 -14
- package/dist/metakit/verify.d.ts +0 -55
- package/dist/metakit/verify.js +0 -217
- package/dist/metakit/wallet.d.ts +0 -70
- package/dist/metakit/wallet.js +0 -127
- package/dist/ottochain/index.d.ts +0 -13
- package/dist/ottochain/index.js +0 -45
- package/dist/ottochain/metagraph-client.d.ts +0 -111
- package/dist/ottochain/metagraph-client.js +0 -157
- package/dist/ottochain/snapshot.d.ts +0 -86
- package/dist/ottochain/snapshot.js +0 -110
- package/dist/ottochain/types.d.ts +0 -278
- package/dist/ottochain/types.js +0 -11
- package/dist/types/apps/contracts/types.d.ts +0 -24
- package/dist/types/apps/corporate/types.d.ts +0 -9861
- package/dist/types/apps/governance/types.d.ts +0 -344
- package/dist/types/apps/identity/types.d.ts +0 -30
- package/dist/types/apps/markets/types.d.ts +0 -155
- package/dist/types/apps/oracles/types.d.ts +0 -193
- package/dist/types/generated/ottochain/apps/contracts/v1/contract_pb.d.ts +0 -274
- package/dist/types/generated/ottochain/apps/corporate/v1/corporate_pb.d.ts +0 -1172
- package/dist/types/generated/ottochain/apps/governance/v1/governance_pb.d.ts +0 -772
- package/dist/types/generated/ottochain/apps/identity/v1/agent_pb.d.ts +0 -211
- package/dist/types/generated/ottochain/apps/identity/v1/attestation_pb.d.ts +0 -238
- package/dist/types/generated/ottochain/apps/markets/v1/market_pb.d.ts +0 -436
- package/dist/types/generated/ottochain/apps/oracles/v1/oracle_pb.d.ts +0 -393
- package/dist/types/generated/ottochain/v1/common_pb.d.ts +0 -86
- package/dist/types/generated/ottochain/v1/fiber_pb.d.ts +0 -292
- package/dist/types/generated/ottochain/v1/messages_pb.d.ts +0 -190
- package/dist/types/generated/ottochain/v1/records_pb.d.ts +0 -221
- package/dist/validation.d.ts +0 -449
- package/dist/validation.js +0 -312
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agent Identity Utilities
|
|
3
|
-
*
|
|
4
|
-
* Constants and utilities for the Agent Identity application.
|
|
5
|
-
* Core types are generated from protobuf - see the generated exports.
|
|
6
|
-
*
|
|
7
|
-
* @packageDocumentation
|
|
8
|
-
*/
|
|
9
|
-
import { AgentState } from '../../generated/ottochain/apps/identity/v1/agent_pb.js';
|
|
10
|
-
import { AttestationType } from '../../generated/ottochain/apps/identity/v1/attestation_pb.js';
|
|
11
|
-
// ---------------------------------------------------------------------------
|
|
12
|
-
// Configuration Defaults
|
|
13
|
-
// ---------------------------------------------------------------------------
|
|
14
|
-
/**
|
|
15
|
-
* Default reputation configuration for agent identity
|
|
16
|
-
*/
|
|
17
|
-
export const DEFAULT_REPUTATION_CONFIG = {
|
|
18
|
-
baseReputation: 10,
|
|
19
|
-
completionDelta: 5,
|
|
20
|
-
vouchDelta: 2,
|
|
21
|
-
violationDelta: -10,
|
|
22
|
-
behavioralDelta: 3,
|
|
23
|
-
minReputation: 0,
|
|
24
|
-
challengeThreshold: 5,
|
|
25
|
-
};
|
|
26
|
-
// ---------------------------------------------------------------------------
|
|
27
|
-
// State Machine Transitions
|
|
28
|
-
// ---------------------------------------------------------------------------
|
|
29
|
-
/**
|
|
30
|
-
* Valid transitions for each agent state
|
|
31
|
-
*/
|
|
32
|
-
export const AGENT_TRANSITIONS = {
|
|
33
|
-
[AgentState.UNSPECIFIED]: [],
|
|
34
|
-
[AgentState.REGISTERED]: ['activate', 'withdraw'],
|
|
35
|
-
[AgentState.ACTIVE]: ['challenge', 'withdraw'],
|
|
36
|
-
[AgentState.CHALLENGED]: ['uphold_challenge', 'dismiss_challenge'],
|
|
37
|
-
[AgentState.SUSPENDED]: ['begin_probation'],
|
|
38
|
-
[AgentState.PROBATION]: ['complete_probation'],
|
|
39
|
-
[AgentState.WITHDRAWN]: [], // Terminal state
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* Reputation delta by attestation type
|
|
43
|
-
*/
|
|
44
|
-
export const ATTESTATION_DELTAS = {
|
|
45
|
-
[AttestationType.UNSPECIFIED]: 0,
|
|
46
|
-
[AttestationType.COMPLETION]: 5,
|
|
47
|
-
[AttestationType.VOUCH]: 2,
|
|
48
|
-
[AttestationType.VIOLATION]: -10,
|
|
49
|
-
[AttestationType.BEHAVIORAL]: 3,
|
|
50
|
-
};
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Markets Application Types
|
|
3
|
-
*
|
|
4
|
-
* Constants, types, and utilities for the Markets application on OttoChain.
|
|
5
|
-
*
|
|
6
|
-
* Core types (MarketType, MarketState, Market, Commitment, Resolution) are
|
|
7
|
-
* exported from proto-generated types in index.ts.
|
|
8
|
-
*
|
|
9
|
-
* @packageDocumentation
|
|
10
|
-
*/
|
|
11
|
-
import { MarketType, MarketState } from '../../generated/ottochain/apps/markets/v1/market_pb.js';
|
|
12
|
-
/**
|
|
13
|
-
* Commitment direction (for prediction markets)
|
|
14
|
-
*/
|
|
15
|
-
export var CommitmentSide;
|
|
16
|
-
(function (CommitmentSide) {
|
|
17
|
-
CommitmentSide[CommitmentSide["UNSPECIFIED"] = 0] = "UNSPECIFIED";
|
|
18
|
-
CommitmentSide[CommitmentSide["YES"] = 1] = "YES";
|
|
19
|
-
CommitmentSide[CommitmentSide["NO"] = 2] = "NO";
|
|
20
|
-
})(CommitmentSide || (CommitmentSide = {}));
|
|
21
|
-
/**
|
|
22
|
-
* Default market configuration
|
|
23
|
-
*/
|
|
24
|
-
export const DEFAULT_MARKET_CONFIG = {
|
|
25
|
-
platformFeePercent: 0.01,
|
|
26
|
-
creatorFeePercent: 0.02,
|
|
27
|
-
oracleFeePercent: 0.01,
|
|
28
|
-
minQuorum: 100n,
|
|
29
|
-
resolutionWindowEpochs: 24,
|
|
30
|
-
disputeWindowEpochs: 12,
|
|
31
|
-
minCommitment: 1n,
|
|
32
|
-
maxSlippagePercent: 0.05,
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* Type-specific market configurations
|
|
36
|
-
*/
|
|
37
|
-
export const MARKET_TYPE_CONFIGS = {
|
|
38
|
-
[MarketType.UNSPECIFIED]: {},
|
|
39
|
-
[MarketType.PREDICTION]: {
|
|
40
|
-
platformFeePercent: 0.02,
|
|
41
|
-
oracleFeePercent: 0.02,
|
|
42
|
-
},
|
|
43
|
-
[MarketType.AUCTION]: {
|
|
44
|
-
platformFeePercent: 0.025,
|
|
45
|
-
creatorFeePercent: 0,
|
|
46
|
-
oracleFeePercent: 0,
|
|
47
|
-
minQuorum: 1n,
|
|
48
|
-
},
|
|
49
|
-
[MarketType.CROWDFUND]: {
|
|
50
|
-
platformFeePercent: 0.03,
|
|
51
|
-
creatorFeePercent: 0,
|
|
52
|
-
oracleFeePercent: 0,
|
|
53
|
-
disputeWindowEpochs: 0,
|
|
54
|
-
},
|
|
55
|
-
[MarketType.GROUP_BUY]: {
|
|
56
|
-
platformFeePercent: 0.015,
|
|
57
|
-
creatorFeePercent: 0.01,
|
|
58
|
-
oracleFeePercent: 0,
|
|
59
|
-
},
|
|
60
|
-
};
|
|
61
|
-
// ---------------------------------------------------------------------------
|
|
62
|
-
// State Machine Transitions
|
|
63
|
-
// ---------------------------------------------------------------------------
|
|
64
|
-
/**
|
|
65
|
-
* Valid transitions for each market state (aligned with proto MarketState enum)
|
|
66
|
-
*/
|
|
67
|
-
export const MARKET_TRANSITIONS = {
|
|
68
|
-
[MarketState.UNSPECIFIED]: [],
|
|
69
|
-
[MarketState.PROPOSED]: ['open', 'cancel'],
|
|
70
|
-
[MarketState.OPEN]: ['close', 'cancel', 'commit'],
|
|
71
|
-
[MarketState.CLOSED]: ['submit_resolution', 'refund'],
|
|
72
|
-
[MarketState.RESOLVING]: ['submit_resolution', 'finalize', 'refund'],
|
|
73
|
-
[MarketState.SETTLED]: ['claim'], // Terminal (only claims allowed)
|
|
74
|
-
[MarketState.REFUNDED]: [], // Terminal state
|
|
75
|
-
[MarketState.CANCELLED]: [], // Terminal state
|
|
76
|
-
};
|
|
77
|
-
/**
|
|
78
|
-
* Check if a market state is terminal
|
|
79
|
-
*/
|
|
80
|
-
export function isTerminalMarketState(state) {
|
|
81
|
-
return [
|
|
82
|
-
MarketState.SETTLED,
|
|
83
|
-
MarketState.REFUNDED,
|
|
84
|
-
MarketState.CANCELLED,
|
|
85
|
-
].includes(state);
|
|
86
|
-
}
|
|
87
|
-
// ---------------------------------------------------------------------------
|
|
88
|
-
// Commitment Calculations
|
|
89
|
-
// ---------------------------------------------------------------------------
|
|
90
|
-
/**
|
|
91
|
-
* Calculate effective commitment after fees
|
|
92
|
-
*
|
|
93
|
-
* @param amount - Raw commitment amount
|
|
94
|
-
* @param config - Market configuration (uses defaults if not provided)
|
|
95
|
-
* @returns Net commitment amount after platform fees
|
|
96
|
-
*/
|
|
97
|
-
export function calculateNetCommitment(amount, config = {}) {
|
|
98
|
-
const feePercent = config.platformFeePercent ?? DEFAULT_MARKET_CONFIG.platformFeePercent;
|
|
99
|
-
const feeAmount = (amount * BigInt(Math.floor(feePercent * 10000))) / 10000n;
|
|
100
|
-
return amount - feeAmount;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Calculate total fees for a commitment
|
|
104
|
-
*
|
|
105
|
-
* @param amount - Commitment amount
|
|
106
|
-
* @param marketType - Type of market for type-specific fees
|
|
107
|
-
* @returns Fee breakdown object
|
|
108
|
-
*/
|
|
109
|
-
export function calculateFees(amount, marketType = MarketType.PREDICTION) {
|
|
110
|
-
const typeConfig = { ...DEFAULT_MARKET_CONFIG, ...MARKET_TYPE_CONFIGS[marketType] };
|
|
111
|
-
const platform = (amount * BigInt(Math.floor(typeConfig.platformFeePercent * 10000))) / 10000n;
|
|
112
|
-
const creator = (amount * BigInt(Math.floor(typeConfig.creatorFeePercent * 10000))) / 10000n;
|
|
113
|
-
const oracle = (amount * BigInt(Math.floor(typeConfig.oracleFeePercent * 10000))) / 10000n;
|
|
114
|
-
return {
|
|
115
|
-
platform,
|
|
116
|
-
creator,
|
|
117
|
-
oracle,
|
|
118
|
-
total: platform + creator + oracle,
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Calculate payout for a winning commitment in a prediction market
|
|
123
|
-
*
|
|
124
|
-
* Winner receives: their original + proportional share of losing pool (minus fees)
|
|
125
|
-
*
|
|
126
|
-
* @param shares - Pool and commitment details
|
|
127
|
-
* @param marketType - Type of market for fee calculation
|
|
128
|
-
* @returns Payout amount
|
|
129
|
-
*/
|
|
130
|
-
export function calculatePayout(shares, marketType = MarketType.PREDICTION) {
|
|
131
|
-
if (shares.winningPool === 0n)
|
|
132
|
-
return 0n;
|
|
133
|
-
const fees = calculateFees(shares.losingPool, marketType);
|
|
134
|
-
const distributablePool = shares.losingPool - fees.total;
|
|
135
|
-
// Proportional share of losing pool
|
|
136
|
-
const winnings = (distributablePool * shares.userCommitment) / shares.winningPool;
|
|
137
|
-
// Return original commitment + winnings
|
|
138
|
-
return shares.userCommitment + winnings;
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Calculate refund for cancelled market
|
|
142
|
-
*
|
|
143
|
-
* @param commitment - Original commitment amount
|
|
144
|
-
* @param refundFeePercent - Optional fee retained on refund (default 0)
|
|
145
|
-
* @returns Refund amount
|
|
146
|
-
*/
|
|
147
|
-
export function calculateRefund(commitment, refundFeePercent = 0) {
|
|
148
|
-
const fee = (commitment * BigInt(Math.floor(refundFeePercent * 10000))) / 10000n;
|
|
149
|
-
return commitment - fee;
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Validate a commitment against market rules
|
|
153
|
-
*/
|
|
154
|
-
export function validateCommitment(amount, marketState, config = {}) {
|
|
155
|
-
const minCommitment = config.minCommitment ?? DEFAULT_MARKET_CONFIG.minCommitment;
|
|
156
|
-
if (marketState !== MarketState.OPEN) {
|
|
157
|
-
return { valid: false, reason: 'Market is not open for commitments' };
|
|
158
|
-
}
|
|
159
|
-
if (amount < minCommitment) {
|
|
160
|
-
return { valid: false, reason: `Commitment below minimum: ${minCommitment}` };
|
|
161
|
-
}
|
|
162
|
-
return { valid: true };
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Calculate crowdfund campaign progress
|
|
166
|
-
*/
|
|
167
|
-
export function calculateCrowdfundProgress(current, goal) {
|
|
168
|
-
if (goal === 0n) {
|
|
169
|
-
return { current, goal, percentComplete: 0, goalReached: false };
|
|
170
|
-
}
|
|
171
|
-
const percentComplete = Number((current * 10000n) / goal) / 100;
|
|
172
|
-
return {
|
|
173
|
-
current,
|
|
174
|
-
goal,
|
|
175
|
-
percentComplete: Math.min(percentComplete, 100),
|
|
176
|
-
goalReached: current >= goal,
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Calculate applicable discount based on participant count
|
|
181
|
-
*/
|
|
182
|
-
export function calculateGroupBuyDiscount(participantCount, tiers) {
|
|
183
|
-
// Sort tiers descending by minParticipants
|
|
184
|
-
const sortedTiers = [...tiers].sort((a, b) => b.minParticipants - a.minParticipants);
|
|
185
|
-
for (const tier of sortedTiers) {
|
|
186
|
-
if (participantCount >= tier.minParticipants) {
|
|
187
|
-
return tier.discountPercent;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
return 0;
|
|
191
|
-
}
|
|
192
|
-
// ---------------------------------------------------------------------------
|
|
193
|
-
// Type Guards
|
|
194
|
-
// ---------------------------------------------------------------------------
|
|
195
|
-
/**
|
|
196
|
-
* Check if a value is a valid MarketState
|
|
197
|
-
*/
|
|
198
|
-
export function isMarketState(value) {
|
|
199
|
-
return typeof value === 'number' && value in MarketState;
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Check if a value is a valid MarketType
|
|
203
|
-
*/
|
|
204
|
-
export function isMarketType(value) {
|
|
205
|
-
return typeof value === 'number' && value in MarketType;
|
|
206
|
-
}
|
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Oracles Application Types
|
|
3
|
-
*
|
|
4
|
-
* Constants, types, and utilities for the Oracle system on OttoChain.
|
|
5
|
-
* Oracles provide truth resolution for markets and disputes.
|
|
6
|
-
*
|
|
7
|
-
* Core types (OracleState, Oracle, etc.) are exported from proto-generated
|
|
8
|
-
* types in index.ts.
|
|
9
|
-
*
|
|
10
|
-
* @packageDocumentation
|
|
11
|
-
*/
|
|
12
|
-
import { OracleState } from '../../generated/ottochain/apps/oracles/v1/oracle_pb.js';
|
|
13
|
-
/**
|
|
14
|
-
* Types of oracle resolutions
|
|
15
|
-
*/
|
|
16
|
-
export var ResolutionType;
|
|
17
|
-
(function (ResolutionType) {
|
|
18
|
-
ResolutionType[ResolutionType["UNSPECIFIED"] = 0] = "UNSPECIFIED";
|
|
19
|
-
/** Binary yes/no outcome */
|
|
20
|
-
ResolutionType[ResolutionType["BINARY"] = 1] = "BINARY";
|
|
21
|
-
/** One of multiple predefined outcomes */
|
|
22
|
-
ResolutionType[ResolutionType["MULTI_CHOICE"] = 2] = "MULTI_CHOICE";
|
|
23
|
-
/** Numeric value (e.g., price) */
|
|
24
|
-
ResolutionType[ResolutionType["NUMERIC"] = 3] = "NUMERIC";
|
|
25
|
-
/** Free-form attestation */
|
|
26
|
-
ResolutionType[ResolutionType["ATTESTATION"] = 4] = "ATTESTATION";
|
|
27
|
-
})(ResolutionType || (ResolutionType = {}));
|
|
28
|
-
/**
|
|
29
|
-
* Reasons for slashing oracle stake
|
|
30
|
-
*/
|
|
31
|
-
export var SlashingReason;
|
|
32
|
-
(function (SlashingReason) {
|
|
33
|
-
SlashingReason[SlashingReason["UNSPECIFIED"] = 0] = "UNSPECIFIED";
|
|
34
|
-
/** Failed to submit resolution in time */
|
|
35
|
-
SlashingReason[SlashingReason["TIMEOUT"] = 1] = "TIMEOUT";
|
|
36
|
-
/** Resolution overturned by dispute */
|
|
37
|
-
SlashingReason[SlashingReason["INCORRECT_RESOLUTION"] = 2] = "INCORRECT_RESOLUTION";
|
|
38
|
-
/** Evidence of collusion or manipulation */
|
|
39
|
-
SlashingReason[SlashingReason["COLLUSION"] = 3] = "COLLUSION";
|
|
40
|
-
/** Violation of oracle protocol */
|
|
41
|
-
SlashingReason[SlashingReason["PROTOCOL_VIOLATION"] = 4] = "PROTOCOL_VIOLATION";
|
|
42
|
-
})(SlashingReason || (SlashingReason = {}));
|
|
43
|
-
/**
|
|
44
|
-
* Default oracle configuration
|
|
45
|
-
*/
|
|
46
|
-
export const DEFAULT_ORACLE_CONFIG = {
|
|
47
|
-
minStake: 10000n,
|
|
48
|
-
timeoutSlashPercent: 0.05,
|
|
49
|
-
incorrectSlashPercent: 0.25,
|
|
50
|
-
collusionSlashPercent: 1.0,
|
|
51
|
-
violationSlashPercent: 0.10,
|
|
52
|
-
cooldownEpochs: 48,
|
|
53
|
-
baseReputation: 50,
|
|
54
|
-
highValueThreshold: 100,
|
|
55
|
-
resolutionWindowEpochs: 12,
|
|
56
|
-
challengeWindowEpochs: 6,
|
|
57
|
-
oracleRewardPercent: 0.01,
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* Slashing percentages by reason
|
|
61
|
-
*/
|
|
62
|
-
export const SLASHING_PERCENTAGES = {
|
|
63
|
-
[SlashingReason.UNSPECIFIED]: 0,
|
|
64
|
-
[SlashingReason.TIMEOUT]: DEFAULT_ORACLE_CONFIG.timeoutSlashPercent,
|
|
65
|
-
[SlashingReason.INCORRECT_RESOLUTION]: DEFAULT_ORACLE_CONFIG.incorrectSlashPercent,
|
|
66
|
-
[SlashingReason.COLLUSION]: DEFAULT_ORACLE_CONFIG.collusionSlashPercent,
|
|
67
|
-
[SlashingReason.PROTOCOL_VIOLATION]: DEFAULT_ORACLE_CONFIG.violationSlashPercent,
|
|
68
|
-
};
|
|
69
|
-
// ---------------------------------------------------------------------------
|
|
70
|
-
// State Machine Transitions
|
|
71
|
-
// ---------------------------------------------------------------------------
|
|
72
|
-
/**
|
|
73
|
-
* Valid transitions for each oracle state (aligned with proto OracleState enum)
|
|
74
|
-
*/
|
|
75
|
-
export const ORACLE_TRANSITIONS = {
|
|
76
|
-
[OracleState.UNSPECIFIED]: [],
|
|
77
|
-
[OracleState.UNREGISTERED]: ['register'],
|
|
78
|
-
[OracleState.REGISTERED]: ['activate', 'withdraw'],
|
|
79
|
-
[OracleState.ACTIVE]: ['add_stake', 'record_resolution', 'slash', 'withdraw'],
|
|
80
|
-
[OracleState.SLASHED]: ['reactivate', 'withdraw'],
|
|
81
|
-
[OracleState.WITHDRAWN]: [], // Terminal state
|
|
82
|
-
};
|
|
83
|
-
/**
|
|
84
|
-
* Check if an oracle state is terminal
|
|
85
|
-
*/
|
|
86
|
-
export function isTerminalOracleState(state) {
|
|
87
|
-
return state === OracleState.WITHDRAWN;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Check if an oracle can accept new assignments
|
|
91
|
-
*/
|
|
92
|
-
export function canAcceptAssignment(state) {
|
|
93
|
-
return state === OracleState.ACTIVE;
|
|
94
|
-
}
|
|
95
|
-
// ---------------------------------------------------------------------------
|
|
96
|
-
// Reputation Calculations
|
|
97
|
-
// ---------------------------------------------------------------------------
|
|
98
|
-
/**
|
|
99
|
-
* Reputation update factors
|
|
100
|
-
*/
|
|
101
|
-
export const REPUTATION_DELTAS = {
|
|
102
|
-
/** Successfully resolved market without challenge */
|
|
103
|
-
successfulResolution: 5,
|
|
104
|
-
/** Resolution upheld after challenge */
|
|
105
|
-
upheldChallenge: 10,
|
|
106
|
-
/** Resolution overturned (negative) */
|
|
107
|
-
overturnedResolution: -25,
|
|
108
|
-
/** Timeout on assigned market (negative) */
|
|
109
|
-
timeout: -15,
|
|
110
|
-
/** Collusion detected (negative) */
|
|
111
|
-
collusion: -100,
|
|
112
|
-
/** Protocol violation (negative) */
|
|
113
|
-
violation: -20,
|
|
114
|
-
/** Bonus for high-value market resolution */
|
|
115
|
-
highValueBonus: 3,
|
|
116
|
-
};
|
|
117
|
-
/**
|
|
118
|
-
* Calculate new reputation after an event
|
|
119
|
-
*
|
|
120
|
-
* @param currentReputation - Current reputation score
|
|
121
|
-
* @param delta - Reputation change (positive or negative)
|
|
122
|
-
* @param minReputation - Minimum reputation floor (default 0)
|
|
123
|
-
* @returns New reputation score
|
|
124
|
-
*/
|
|
125
|
-
export function calculateReputation(currentReputation, delta, minReputation = 0) {
|
|
126
|
-
return Math.max(minReputation, currentReputation + delta);
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Calculate weighted reputation considering history
|
|
130
|
-
*
|
|
131
|
-
* @param baseReputation - Current base reputation
|
|
132
|
-
* @param successCount - Number of successful resolutions
|
|
133
|
-
* @param failureCount - Number of failed/overturned resolutions
|
|
134
|
-
* @returns Weighted reputation score
|
|
135
|
-
*/
|
|
136
|
-
export function calculateWeightedReputation(baseReputation, successCount, failureCount) {
|
|
137
|
-
const totalAttempts = successCount + failureCount;
|
|
138
|
-
if (totalAttempts === 0)
|
|
139
|
-
return baseReputation;
|
|
140
|
-
const successRate = successCount / totalAttempts;
|
|
141
|
-
const experienceMultiplier = Math.min(1 + Math.log10(totalAttempts + 1) * 0.2, 1.5);
|
|
142
|
-
return Math.round(baseReputation * successRate * experienceMultiplier);
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Check if oracle qualifies for high-value markets
|
|
146
|
-
*/
|
|
147
|
-
export function qualifiesForHighValue(reputation, stake, threshold = DEFAULT_ORACLE_CONFIG.highValueThreshold, minStakeMultiplier = 5) {
|
|
148
|
-
return (reputation >= threshold &&
|
|
149
|
-
stake >= DEFAULT_ORACLE_CONFIG.minStake * BigInt(minStakeMultiplier));
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Predefined slashing conditions
|
|
153
|
-
*/
|
|
154
|
-
export const SLASHING_CONDITIONS = {
|
|
155
|
-
[SlashingReason.UNSPECIFIED]: {
|
|
156
|
-
reason: SlashingReason.UNSPECIFIED,
|
|
157
|
-
slashPercent: 0,
|
|
158
|
-
description: 'No slashing',
|
|
159
|
-
appealable: false,
|
|
160
|
-
suspensionEpochs: 0,
|
|
161
|
-
},
|
|
162
|
-
[SlashingReason.TIMEOUT]: {
|
|
163
|
-
reason: SlashingReason.TIMEOUT,
|
|
164
|
-
slashPercent: DEFAULT_ORACLE_CONFIG.timeoutSlashPercent,
|
|
165
|
-
description: 'Failed to submit resolution within deadline',
|
|
166
|
-
appealable: true,
|
|
167
|
-
suspensionEpochs: 12,
|
|
168
|
-
},
|
|
169
|
-
[SlashingReason.INCORRECT_RESOLUTION]: {
|
|
170
|
-
reason: SlashingReason.INCORRECT_RESOLUTION,
|
|
171
|
-
slashPercent: DEFAULT_ORACLE_CONFIG.incorrectSlashPercent,
|
|
172
|
-
description: 'Resolution overturned by dispute process',
|
|
173
|
-
appealable: true,
|
|
174
|
-
suspensionEpochs: 48,
|
|
175
|
-
},
|
|
176
|
-
[SlashingReason.COLLUSION]: {
|
|
177
|
-
reason: SlashingReason.COLLUSION,
|
|
178
|
-
slashPercent: DEFAULT_ORACLE_CONFIG.collusionSlashPercent,
|
|
179
|
-
description: 'Evidence of collusion or market manipulation',
|
|
180
|
-
appealable: false,
|
|
181
|
-
suspensionEpochs: -1, // Permanent
|
|
182
|
-
},
|
|
183
|
-
[SlashingReason.PROTOCOL_VIOLATION]: {
|
|
184
|
-
reason: SlashingReason.PROTOCOL_VIOLATION,
|
|
185
|
-
slashPercent: DEFAULT_ORACLE_CONFIG.violationSlashPercent,
|
|
186
|
-
description: 'Violation of oracle operating protocol',
|
|
187
|
-
appealable: true,
|
|
188
|
-
suspensionEpochs: 24,
|
|
189
|
-
},
|
|
190
|
-
};
|
|
191
|
-
/**
|
|
192
|
-
* Calculate slash amount for a given stake and reason
|
|
193
|
-
*
|
|
194
|
-
* @param stake - Oracle's current stake
|
|
195
|
-
* @param reason - Reason for slashing
|
|
196
|
-
* @returns Amount to be slashed
|
|
197
|
-
*/
|
|
198
|
-
export function calculateSlashAmount(stake, reason) {
|
|
199
|
-
const condition = SLASHING_CONDITIONS[reason];
|
|
200
|
-
return (stake * BigInt(Math.floor(condition.slashPercent * 10000))) / 10000n;
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Calculate remaining stake after slashing
|
|
204
|
-
*/
|
|
205
|
-
export function calculateStakeAfterSlash(stake, reason) {
|
|
206
|
-
return stake - calculateSlashAmount(stake, reason);
|
|
207
|
-
}
|
|
208
|
-
/**
|
|
209
|
-
* Calculate oracle selection score
|
|
210
|
-
* Higher score = more likely to be selected
|
|
211
|
-
*
|
|
212
|
-
* @param candidate - Oracle candidate details
|
|
213
|
-
* @param marketValue - Value of market to resolve (affects weight for high-value markets)
|
|
214
|
-
* @returns Selection score
|
|
215
|
-
*/
|
|
216
|
-
export function calculateSelectionScore(candidate, marketValue = 0n) {
|
|
217
|
-
const reputationWeight = 0.4;
|
|
218
|
-
const stakeWeight = 0.3;
|
|
219
|
-
const successWeight = 0.2;
|
|
220
|
-
const loadWeight = 0.1;
|
|
221
|
-
// Normalize stake to 0-100 range (assuming 1M max)
|
|
222
|
-
const normalizedStake = Math.min(Number(candidate.stake / 10000n), 100);
|
|
223
|
-
// Load penalty (fewer active = better)
|
|
224
|
-
const loadScore = Math.max(0, 100 - candidate.activeAssignments * 20);
|
|
225
|
-
// High-value market bonus for qualified oracles
|
|
226
|
-
const highValueBonus = marketValue > 100000n &&
|
|
227
|
-
qualifiesForHighValue(candidate.reputation, candidate.stake) ? 10 : 0;
|
|
228
|
-
return (candidate.reputation * reputationWeight +
|
|
229
|
-
normalizedStake * stakeWeight +
|
|
230
|
-
candidate.successRate * 100 * successWeight +
|
|
231
|
-
loadScore * loadWeight +
|
|
232
|
-
highValueBonus);
|
|
233
|
-
}
|
|
234
|
-
// ---------------------------------------------------------------------------
|
|
235
|
-
// Reward Calculations
|
|
236
|
-
// ---------------------------------------------------------------------------
|
|
237
|
-
/**
|
|
238
|
-
* Calculate oracle reward for successful resolution
|
|
239
|
-
*
|
|
240
|
-
* @param marketFees - Total fees collected from market
|
|
241
|
-
* @param rewardPercent - Oracle's reward percentage (default from config)
|
|
242
|
-
* @returns Oracle reward amount
|
|
243
|
-
*/
|
|
244
|
-
export function calculateOracleReward(marketFees, rewardPercent = DEFAULT_ORACLE_CONFIG.oracleRewardPercent) {
|
|
245
|
-
return (marketFees * BigInt(Math.floor(rewardPercent * 10000))) / 10000n;
|
|
246
|
-
}
|
|
247
|
-
// ---------------------------------------------------------------------------
|
|
248
|
-
// Type Guards
|
|
249
|
-
// ---------------------------------------------------------------------------
|
|
250
|
-
/**
|
|
251
|
-
* Check if a value is a valid OracleState
|
|
252
|
-
*/
|
|
253
|
-
export function isOracleState(value) {
|
|
254
|
-
return typeof value === 'number' && value in OracleState;
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* Check if a value is a valid SlashingReason
|
|
258
|
-
*/
|
|
259
|
-
export function isSlashingReason(value) {
|
|
260
|
-
return typeof value === 'number' && value in SlashingReason;
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* Check if a value is a valid ResolutionType
|
|
264
|
-
*/
|
|
265
|
-
export function isResolutionType(value) {
|
|
266
|
-
return typeof value === 'number' && value in ResolutionType;
|
|
267
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
// @generated by protoc-gen-es v2.2.0 with parameter "target=ts,import_extension=.js"
|
|
2
|
-
// @generated from file ottochain/apps/contracts/v1/contract.proto (package ottochain.apps.contracts.v1, syntax proto3)
|
|
3
|
-
/* eslint-disable */
|
|
4
|
-
import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1";
|
|
5
|
-
import { file_ottochain_v1_common } from "../../../v1/common_pb.js";
|
|
6
|
-
import { file_google_protobuf_struct, file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt";
|
|
7
|
-
/**
|
|
8
|
-
* Describes the file ottochain/apps/contracts/v1/contract.proto.
|
|
9
|
-
*/
|
|
10
|
-
export const file_ottochain_apps_contracts_v1_contract = /*@__PURE__*/ fileDesc("CipvdHRvY2hhaW4vYXBwcy9jb250cmFjdHMvdjEvY29udHJhY3QucHJvdG8SG290dG9jaGFpbi5hcHBzLmNvbnRyYWN0cy52MSKSAwoIQ29udHJhY3QSCgoCaWQYASABKAkSEwoLY29udHJhY3RfaWQYAiABKAkSJwoIcHJvcG9zZXIYAyABKAsyFS5vdHRvY2hhaW4udjEuQWRkcmVzcxIrCgxjb3VudGVycGFydHkYBCABKAsyFS5vdHRvY2hhaW4udjEuQWRkcmVzcxI5CgVzdGF0ZRgFIAEoDjIqLm90dG9jaGFpbi5hcHBzLmNvbnRyYWN0cy52MS5Db250cmFjdFN0YXRlEiYKBXRlcm1zGAYgASgLMhcuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdBIvCgtwcm9wb3NlZF9hdBgHIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXASLwoLYWNjZXB0ZWRfYXQYCCABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEjAKDGNvbXBsZXRlZF9hdBgJIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXASGAoQY29tcGxldGlvbl9wcm9vZhgKIAEoCSKrAQoWUHJvcG9zZUNvbnRyYWN0UmVxdWVzdBInCghwcm9wb3NlchgBIAEoCzIVLm90dG9jaGFpbi52MS5BZGRyZXNzEisKDGNvdW50ZXJwYXJ0eRgCIAEoCzIVLm90dG9jaGFpbi52MS5BZGRyZXNzEiYKBXRlcm1zGAMgASgLMhcuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdBITCgtkZXNjcmlwdGlvbhgEIAEoCSJVChVBY2NlcHRDb250cmFjdFJlcXVlc3QSEwoLY29udHJhY3RfaWQYASABKAkSJwoIYWNjZXB0b3IYAiABKAsyFS5vdHRvY2hhaW4udjEuQWRkcmVzcyJnChdDb21wbGV0ZUNvbnRyYWN0UmVxdWVzdBITCgtjb250cmFjdF9pZBgBIAEoCRIoCgljb21wbGV0ZXIYAiABKAsyFS5vdHRvY2hhaW4udjEuQWRkcmVzcxINCgVwcm9vZhgDIAEoCSJlChVSZWplY3RDb250cmFjdFJlcXVlc3QSEwoLY29udHJhY3RfaWQYASABKAkSJwoIcmVqZWN0b3IYAiABKAsyFS5vdHRvY2hhaW4udjEuQWRkcmVzcxIOCgZyZWFzb24YAyABKAkieQoWRGlzcHV0ZUNvbnRyYWN0UmVxdWVzdBITCgtjb250cmFjdF9pZBgBIAEoCRIoCglkaXNwdXRhbnQYAiABKAsyFS5vdHRvY2hhaW4udjEuQWRkcmVzcxIQCghldmlkZW5jZRgDIAEoCRIOCgZyZWFzb24YBCABKAkiVAoSQ29udHJhY3REZWZpbml0aW9uEh8KF3JlcXVpcmVfYm90aF9zaWduYXR1cmVzGAEgASgIEh0KFWRpc3B1dGVfd2luZG93X2Vwb2NocxgCIAEoBSrdAQoNQ29udHJhY3RTdGF0ZRIeChpDT05UUkFDVF9TVEFURV9VTlNQRUNJRklFRBAAEhsKF0NPTlRSQUNUX1NUQVRFX1BST1BPU0VEEAESGQoVQ09OVFJBQ1RfU1RBVEVfQUNUSVZFEAISHAoYQ09OVFJBQ1RfU1RBVEVfQ09NUExFVEVEEAMSGwoXQ09OVFJBQ1RfU1RBVEVfUkVKRUNURUQQBBIbChdDT05UUkFDVF9TVEFURV9ESVNQVVRFRBAFEhwKGENPTlRSQUNUX1NUQVRFX0NBTkNFTExFRBAGQr8BCh9jb20ub3R0b2NoYWluLmFwcHMuY29udHJhY3RzLnYxQg1Db250cmFjdFByb3RvUAGiAgNPQUOqAhtPdHRvY2hhaW4uQXBwcy5Db250cmFjdHMuVjHKAhtPdHRvY2hhaW5cQXBwc1xDb250cmFjdHNcVjHiAidPdHRvY2hhaW5cQXBwc1xDb250cmFjdHNcVjFcR1BCTWV0YWRhdGHqAh5PdHRvY2hhaW46OkFwcHM6OkNvbnRyYWN0czo6VjFiBnByb3RvMw", [file_ottochain_v1_common, file_google_protobuf_struct, file_google_protobuf_timestamp]);
|
|
11
|
-
/**
|
|
12
|
-
* Describes the message ottochain.apps.contracts.v1.Contract.
|
|
13
|
-
* Use `create(ContractSchema)` to create a new message.
|
|
14
|
-
*/
|
|
15
|
-
export const ContractSchema = /*@__PURE__*/ messageDesc(file_ottochain_apps_contracts_v1_contract, 0);
|
|
16
|
-
/**
|
|
17
|
-
* Describes the message ottochain.apps.contracts.v1.ProposeContractRequest.
|
|
18
|
-
* Use `create(ProposeContractRequestSchema)` to create a new message.
|
|
19
|
-
*/
|
|
20
|
-
export const ProposeContractRequestSchema = /*@__PURE__*/ messageDesc(file_ottochain_apps_contracts_v1_contract, 1);
|
|
21
|
-
/**
|
|
22
|
-
* Describes the message ottochain.apps.contracts.v1.AcceptContractRequest.
|
|
23
|
-
* Use `create(AcceptContractRequestSchema)` to create a new message.
|
|
24
|
-
*/
|
|
25
|
-
export const AcceptContractRequestSchema = /*@__PURE__*/ messageDesc(file_ottochain_apps_contracts_v1_contract, 2);
|
|
26
|
-
/**
|
|
27
|
-
* Describes the message ottochain.apps.contracts.v1.CompleteContractRequest.
|
|
28
|
-
* Use `create(CompleteContractRequestSchema)` to create a new message.
|
|
29
|
-
*/
|
|
30
|
-
export const CompleteContractRequestSchema = /*@__PURE__*/ messageDesc(file_ottochain_apps_contracts_v1_contract, 3);
|
|
31
|
-
/**
|
|
32
|
-
* Describes the message ottochain.apps.contracts.v1.RejectContractRequest.
|
|
33
|
-
* Use `create(RejectContractRequestSchema)` to create a new message.
|
|
34
|
-
*/
|
|
35
|
-
export const RejectContractRequestSchema = /*@__PURE__*/ messageDesc(file_ottochain_apps_contracts_v1_contract, 4);
|
|
36
|
-
/**
|
|
37
|
-
* Describes the message ottochain.apps.contracts.v1.DisputeContractRequest.
|
|
38
|
-
* Use `create(DisputeContractRequestSchema)` to create a new message.
|
|
39
|
-
*/
|
|
40
|
-
export const DisputeContractRequestSchema = /*@__PURE__*/ messageDesc(file_ottochain_apps_contracts_v1_contract, 5);
|
|
41
|
-
/**
|
|
42
|
-
* Describes the message ottochain.apps.contracts.v1.ContractDefinition.
|
|
43
|
-
* Use `create(ContractDefinitionSchema)` to create a new message.
|
|
44
|
-
*/
|
|
45
|
-
export const ContractDefinitionSchema = /*@__PURE__*/ messageDesc(file_ottochain_apps_contracts_v1_contract, 6);
|
|
46
|
-
/**
|
|
47
|
-
* Contract lifecycle states
|
|
48
|
-
*
|
|
49
|
-
* @generated from enum ottochain.apps.contracts.v1.ContractState
|
|
50
|
-
*/
|
|
51
|
-
export var ContractState;
|
|
52
|
-
(function (ContractState) {
|
|
53
|
-
/**
|
|
54
|
-
* @generated from enum value: CONTRACT_STATE_UNSPECIFIED = 0;
|
|
55
|
-
*/
|
|
56
|
-
ContractState[ContractState["UNSPECIFIED"] = 0] = "UNSPECIFIED";
|
|
57
|
-
/**
|
|
58
|
-
* Awaiting counterparty acceptance
|
|
59
|
-
*
|
|
60
|
-
* @generated from enum value: CONTRACT_STATE_PROPOSED = 1;
|
|
61
|
-
*/
|
|
62
|
-
ContractState[ContractState["PROPOSED"] = 1] = "PROPOSED";
|
|
63
|
-
/**
|
|
64
|
-
* Both parties agreed, in progress
|
|
65
|
-
*
|
|
66
|
-
* @generated from enum value: CONTRACT_STATE_ACTIVE = 2;
|
|
67
|
-
*/
|
|
68
|
-
ContractState[ContractState["ACTIVE"] = 2] = "ACTIVE";
|
|
69
|
-
/**
|
|
70
|
-
* Successfully fulfilled (terminal)
|
|
71
|
-
*
|
|
72
|
-
* @generated from enum value: CONTRACT_STATE_COMPLETED = 3;
|
|
73
|
-
*/
|
|
74
|
-
ContractState[ContractState["COMPLETED"] = 3] = "COMPLETED";
|
|
75
|
-
/**
|
|
76
|
-
* Counterparty declined (terminal)
|
|
77
|
-
*
|
|
78
|
-
* @generated from enum value: CONTRACT_STATE_REJECTED = 4;
|
|
79
|
-
*/
|
|
80
|
-
ContractState[ContractState["REJECTED"] = 4] = "REJECTED";
|
|
81
|
-
/**
|
|
82
|
-
* Under dispute resolution
|
|
83
|
-
*
|
|
84
|
-
* @generated from enum value: CONTRACT_STATE_DISPUTED = 5;
|
|
85
|
-
*/
|
|
86
|
-
ContractState[ContractState["DISPUTED"] = 5] = "DISPUTED";
|
|
87
|
-
/**
|
|
88
|
-
* Cancelled by proposer before acceptance (terminal)
|
|
89
|
-
*
|
|
90
|
-
* @generated from enum value: CONTRACT_STATE_CANCELLED = 6;
|
|
91
|
-
*/
|
|
92
|
-
ContractState[ContractState["CANCELLED"] = 6] = "CANCELLED";
|
|
93
|
-
})(ContractState || (ContractState = {}));
|
|
94
|
-
/**
|
|
95
|
-
* Describes the enum ottochain.apps.contracts.v1.ContractState.
|
|
96
|
-
*/
|
|
97
|
-
export const ContractStateSchema = /*@__PURE__*/ enumDesc(file_ottochain_apps_contracts_v1_contract, 0);
|