import { QueryCondition, QueryConditionSDKType } from "../lockup/lock"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp } from "../../google/protobuf/timestamp"; import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import * as _m0 from "protobufjs/minimal"; import { toTimestamp, Long, fromTimestamp, DeepPartial } from "../../helpers"; /** * Gauge is an object that stores and distributes yields to recipients who * satisfy certain conditions. Currently gauges support conditions around the * duration for which a given denom is locked. */ export interface Gauge { /** id is the unique ID of a Gauge */ id: Long; /** * is_perpetual is a flag to show if it's a perpetual or non-perpetual gauge * Non-perpetual gauges distribute their tokens equally per epoch while the * gauge is in the active period. Perpetual gauges distribute all their tokens * at a single time and only distribute their tokens again once the gauge is * refilled, Intended for use with incentives that get refilled daily. */ isPerpetual: boolean; /** * distribute_to is where the gauge rewards are distributed to. * This is queried via lock duration or by timestamp */ distributeTo?: QueryCondition; /** * coins is the total amount of coins that have been in the gauge * Can distribute multiple coin denoms */ coins: Coin[]; /** start_time is the distribution start time */ startTime?: Date; /** * num_epochs_paid_over is the number of total epochs distribution will be * completed over */ numEpochsPaidOver: Long; /** * filled_epochs is the number of epochs distribution has been completed on * already */ filledEpochs: Long; /** distributed_coins are coins that have been distributed already */ distributedCoins: Coin[]; } /** * Gauge is an object that stores and distributes yields to recipients who * satisfy certain conditions. Currently gauges support conditions around the * duration for which a given denom is locked. */ export interface GaugeSDKType { /** id is the unique ID of a Gauge */ id: Long; /** * is_perpetual is a flag to show if it's a perpetual or non-perpetual gauge * Non-perpetual gauges distribute their tokens equally per epoch while the * gauge is in the active period. Perpetual gauges distribute all their tokens * at a single time and only distribute their tokens again once the gauge is * refilled, Intended for use with incentives that get refilled daily. */ is_perpetual: boolean; /** * distribute_to is where the gauge rewards are distributed to. * This is queried via lock duration or by timestamp */ distribute_to?: QueryConditionSDKType; /** * coins is the total amount of coins that have been in the gauge * Can distribute multiple coin denoms */ coins: CoinSDKType[]; /** start_time is the distribution start time */ start_time?: Date; /** * num_epochs_paid_over is the number of total epochs distribution will be * completed over */ num_epochs_paid_over: Long; /** * filled_epochs is the number of epochs distribution has been completed on * already */ filled_epochs: Long; /** distributed_coins are coins that have been distributed already */ distributed_coins: CoinSDKType[]; } export interface LockableDurationsInfo { /** List of incentivised durations that gauges will pay out to */ lockableDurations: Duration[]; } export interface LockableDurationsInfoSDKType { /** List of incentivised durations that gauges will pay out to */ lockable_durations: DurationSDKType[]; } function createBaseGauge(): Gauge { return { id: Long.UZERO, isPerpetual: false, distributeTo: undefined, coins: [], startTime: undefined, numEpochsPaidOver: Long.UZERO, filledEpochs: Long.UZERO, distributedCoins: [] }; } export const Gauge = { encode(message: Gauge, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { if (!message.id.isZero()) { writer.uint32(8).uint64(message.id); } if (message.isPerpetual === true) { writer.uint32(16).bool(message.isPerpetual); } if (message.distributeTo !== undefined) { QueryCondition.encode(message.distributeTo, writer.uint32(26).fork()).ldelim(); } for (const v of message.coins) { Coin.encode(v!, writer.uint32(34).fork()).ldelim(); } if (message.startTime !== undefined) { Timestamp.encode(toTimestamp(message.startTime), writer.uint32(42).fork()).ldelim(); } if (!message.numEpochsPaidOver.isZero()) { writer.uint32(48).uint64(message.numEpochsPaidOver); } if (!message.filledEpochs.isZero()) { writer.uint32(56).uint64(message.filledEpochs); } for (const v of message.distributedCoins) { Coin.encode(v!, writer.uint32(66).fork()).ldelim(); } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Gauge { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGauge(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.id = (reader.uint64() as Long); break; case 2: message.isPerpetual = reader.bool(); break; case 3: message.distributeTo = QueryCondition.decode(reader, reader.uint32()); break; case 4: message.coins.push(Coin.decode(reader, reader.uint32())); break; case 5: message.startTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; case 6: message.numEpochsPaidOver = (reader.uint64() as Long); break; case 7: message.filledEpochs = (reader.uint64() as Long); break; case 8: message.distributedCoins.push(Coin.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); break; } } return message; }, fromPartial(object: DeepPartial): Gauge { const message = createBaseGauge(); message.id = object.id !== undefined && object.id !== null ? Long.fromValue(object.id) : Long.UZERO; message.isPerpetual = object.isPerpetual ?? false; message.distributeTo = object.distributeTo !== undefined && object.distributeTo !== null ? QueryCondition.fromPartial(object.distributeTo) : undefined; message.coins = object.coins?.map(e => Coin.fromPartial(e)) || []; message.startTime = object.startTime ?? undefined; message.numEpochsPaidOver = object.numEpochsPaidOver !== undefined && object.numEpochsPaidOver !== null ? Long.fromValue(object.numEpochsPaidOver) : Long.UZERO; message.filledEpochs = object.filledEpochs !== undefined && object.filledEpochs !== null ? Long.fromValue(object.filledEpochs) : Long.UZERO; message.distributedCoins = object.distributedCoins?.map(e => Coin.fromPartial(e)) || []; return message; } }; function createBaseLockableDurationsInfo(): LockableDurationsInfo { return { lockableDurations: [] }; } export const LockableDurationsInfo = { encode(message: LockableDurationsInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { for (const v of message.lockableDurations) { Duration.encode(v!, writer.uint32(10).fork()).ldelim(); } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): LockableDurationsInfo { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseLockableDurationsInfo(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.lockableDurations.push(Duration.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); break; } } return message; }, fromPartial(object: DeepPartial): LockableDurationsInfo { const message = createBaseLockableDurationsInfo(); message.lockableDurations = object.lockableDurations?.map(e => Duration.fromPartial(e)) || []; return message; } };