Skip to content

Commit

Permalink
chore: updated to new prerelease version
Browse files Browse the repository at this point in the history
  • Loading branch information
mangatafinance committed Nov 21, 2023
1 parent 1fb4dc4 commit 434f80d
Show file tree
Hide file tree
Showing 10 changed files with 559 additions and 282 deletions.
7 changes: 2 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/types/metadata.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/types/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mangata-finance/types",
"version": "2.0.1-feature-3rdparty-rewards-merge.8",
"version": "2.0.1-feature-3rdparty-rewards-merge.9",
"description": "Polkadot.js type definitions for Mangata Network",
"author": "Mangata Finance <[email protected]>",
"repository": {
Expand All @@ -19,7 +19,7 @@
"@polkadot/api": "^10.9.1"
},
"devDependencies": {
"@mangata-finance/type-definitions": "2.0.0"
"@mangata-finance/type-definitions": "^2.0.0"
},
"type": "module",
"module": "./src/index.js",
Expand Down
22 changes: 22 additions & 0 deletions packages/types/src/interfaces/augment-api-errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -731,8 +731,13 @@ declare module '@polkadot/api-base/types/errors' {
proofOfStake: {
CalculateRewardsAllMathError: AugmentedError<ApiType>;
CalculateRewardsMathError: AugmentedError<ApiType>;
/**
* Cannot schedule rewards in past
**/
CannotScheduleRewardsInPast: AugmentedError<ApiType>;
DeprecatedExtrinsic: AugmentedError<ApiType>;
LiquidityCheckpointMathError: AugmentedError<ApiType>;
LiquidityLockedIn3rdpartyRewards: AugmentedError<ApiType>;
MathError: AugmentedError<ApiType>;
/**
* Math overflow
Expand All @@ -751,10 +756,27 @@ declare module '@polkadot/api-base/types/errors' {
* Not enough rewards earned
**/
NotEnoughRewardsEarned: AugmentedError<ApiType>;
NoThirdPartyPartyRewardsToClaim: AugmentedError<ApiType>;
/**
* Past time calculation
**/
PastTimeCalculation: AugmentedError<ApiType>;
/**
* Pool does not exist
**/
PoolDoesNotExist: AugmentedError<ApiType>;
/**
* Too little rewards per session
**/
TooLittleRewards: AugmentedError<ApiType>;
/**
* Too many schedules
**/
TooManySchedules: AugmentedError<ApiType>;
/**
* Too small volume of the pool
**/
TooSmallVolume: AugmentedError<ApiType>;
/**
* Generic error
**/
Expand Down
3 changes: 3 additions & 0 deletions packages/types/src/interfaces/augment-api-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,9 @@ declare module '@polkadot/api-base/types/events' {
LiquidityDeactivated: AugmentedEvent<ApiType, [AccountId32, u32, u128]>;
PoolPromotionUpdated: AugmentedEvent<ApiType, [u32, Option<u8>]>;
RewardsClaimed: AugmentedEvent<ApiType, [AccountId32, u32, u128]>;
ThirdPartyLiquidityActivated: AugmentedEvent<ApiType, [AccountId32, u32, u32, u128]>;
ThirdPartyLiquidityDeactivated: AugmentedEvent<ApiType, [AccountId32, u32, u32, u128]>;
ThirdPartyRewardsClaimed: AugmentedEvent<ApiType, [AccountId32, u32, u32, u128]>;
/**
* Generic event
**/
Expand Down
49 changes: 47 additions & 2 deletions packages/types/src/interfaces/augment-api-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import '@polkadot/api-base/types/storage';

import type { ApiTypes, AugmentedQuery, QueryableStorageEntry } from '@polkadot/api-base/types';
import type { Data } from '@polkadot/types';
import type { BTreeMap, Bytes, Null, Option, Vec, bool, u128, u16, u32, u64 } from '@polkadot/types-codec';
import type { BTreeMap, Bytes, Null, Option, U256, Vec, bool, u128, u16, u32, u64 } from '@polkadot/types-codec';
import type { AnyNumber, ITuple } from '@polkadot/types-codec/types';
import type { AccountId32, Call, H256, Perbill } from '@polkadot/types/interfaces/runtime';
import type { CumulusPalletDmpQueueConfigData, CumulusPalletDmpQueuePageIndexData, CumulusPalletParachainSystemCodeUpgradeAuthorization, CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot, CumulusPalletParachainSystemUnincludedSegmentAncestor, CumulusPalletParachainSystemUnincludedSegmentSegmentTracker, CumulusPalletXcmpQueueInboundChannelDetails, CumulusPalletXcmpQueueOutboundChannelDetails, CumulusPalletXcmpQueueQueueConfigData, FrameSupportDispatchPerDispatchClassWeight, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, MangataRococoRuntimeSessionKeys, OrmlTokensAccountData, OrmlTokensBalanceLock, OrmlTokensReserveData, OrmlTraitsAssetRegistryAssetMetadata, PalletBootstrapBootstrapPhase, PalletCollectiveMangataVotes, PalletCrowdloanRewardsRewardInfo, PalletFeeLockAccountFeeLockDataInfo, PalletFeeLockFeeLockMetadataInfo, PalletIdentityRegistrarInfo, PalletIdentityRegistration, PalletIssuanceIssuanceInfo, PalletMaintenanceMaintenanceStatusInfo, PalletMultipurposeLiquidityRelockStatusInfo, PalletMultipurposeLiquidityReserveStatusInfo, PalletProofOfStakePromotedPools, PalletProofOfStakeRewardInfo, PalletProxyAnnouncement, PalletProxyProxyDefinition, PalletTransactionPaymentMangataReleases, PalletTreasuryProposal, PalletVestingMangataReleases, PalletVestingMangataVestingInfo, PalletXcmQueryStatus, PalletXcmRemoteLockedFungibleRecord, PalletXcmVersionMigrationStage, ParachainStakingAggregatorMetadataType, ParachainStakingBond, ParachainStakingCollatorCandidate, ParachainStakingCollatorSnapshot, ParachainStakingDelegator, ParachainStakingRoundCollatorRewardInfoType, ParachainStakingRoundInfo, ParachainStakingSetOrderedSetBond, PolkadotCorePrimitivesOutboundHrmpMessage, PolkadotPrimitivesV5AbridgedHostConfiguration, PolkadotPrimitivesV5PersistedValidationData, PolkadotPrimitivesV5UpgradeGoAhead, PolkadotPrimitivesV5UpgradeRestriction, SpConsensusAuraSr25519AppSr25519Public, SpCoreCryptoKeyTypeId, SpRuntimeDigest, SpTrieStorageProof, SpWeightsWeightV2Weight, StagingXcmV3MultiLocation, StagingXcmVersionedAssetId, StagingXcmVersionedMultiLocation } from '@polkadot/types/lookup';
import type { CumulusPalletDmpQueueConfigData, CumulusPalletDmpQueuePageIndexData, CumulusPalletParachainSystemCodeUpgradeAuthorization, CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot, CumulusPalletParachainSystemUnincludedSegmentAncestor, CumulusPalletParachainSystemUnincludedSegmentSegmentTracker, CumulusPalletXcmpQueueInboundChannelDetails, CumulusPalletXcmpQueueOutboundChannelDetails, CumulusPalletXcmpQueueQueueConfigData, FrameSupportDispatchPerDispatchClassWeight, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, MangataRococoRuntimeSessionKeys, OrmlTokensAccountData, OrmlTokensBalanceLock, OrmlTokensReserveData, OrmlTraitsAssetRegistryAssetMetadata, PalletBootstrapBootstrapPhase, PalletCollectiveMangataVotes, PalletCrowdloanRewardsRewardInfo, PalletFeeLockAccountFeeLockDataInfo, PalletFeeLockFeeLockMetadataInfo, PalletIdentityRegistrarInfo, PalletIdentityRegistration, PalletIssuanceIssuanceInfo, PalletMaintenanceMaintenanceStatusInfo, PalletMultipurposeLiquidityRelockStatusInfo, PalletMultipurposeLiquidityReserveStatusInfo, PalletProofOfStakePromotedPools, PalletProofOfStakeRewardInfo, PalletProofOfStakeSchedule, PalletProofOfStakeScheduleRewardsCalculatorActivatedLiquidityPerSchedule, PalletProofOfStakeScheduleRewardsCalculatorScheduleRewards, PalletProofOfStakeSchedulesList, PalletProxyAnnouncement, PalletProxyProxyDefinition, PalletTransactionPaymentMangataReleases, PalletTreasuryProposal, PalletVestingMangataReleases, PalletVestingMangataVestingInfo, PalletXcmQueryStatus, PalletXcmRemoteLockedFungibleRecord, PalletXcmVersionMigrationStage, ParachainStakingAggregatorMetadataType, ParachainStakingBond, ParachainStakingCollatorCandidate, ParachainStakingCollatorSnapshot, ParachainStakingDelegator, ParachainStakingRoundCollatorRewardInfoType, ParachainStakingRoundInfo, ParachainStakingSetOrderedSetBond, PolkadotCorePrimitivesOutboundHrmpMessage, PolkadotPrimitivesV5AbridgedHostConfiguration, PolkadotPrimitivesV5PersistedValidationData, PolkadotPrimitivesV5UpgradeGoAhead, PolkadotPrimitivesV5UpgradeRestriction, SpConsensusAuraSr25519AppSr25519Public, SpCoreCryptoKeyTypeId, SpRuntimeDigest, SpTrieStorageProof, SpWeightsWeightV2Weight, StagingXcmV3MultiLocation, StagingXcmVersionedAssetId, StagingXcmVersionedMultiLocation } from '@polkadot/types/lookup';
import type { Observable } from '@polkadot/types/types';

export type __AugmentedQuery<ApiType extends ApiTypes> = AugmentedQuery<ApiType, () => unknown>;
Expand Down Expand Up @@ -584,6 +584,25 @@ declare module '@polkadot/api-base/types/storage' {
[key: string]: QueryableStorageEntry<ApiType>;
};
proofOfStake: {
/**
* Tracks how much liquidity user activated for particular (liq token, reward token) pair
* StorageNMap was used because it only require single read to know if user deactivated all
* liquidity associated with particular liquidity_token that is rewarded. If so part of the
* liquididty tokens can be unlocked.
**/
activatedLiquidityForSchedules: AugmentedQuery<ApiType, (arg1: AccountId32 | string | Uint8Array, arg2: u32 | AnyNumber | Uint8Array, arg3: u32 | AnyNumber | Uint8Array) => Observable<Option<u128>>, [AccountId32, u32, u32]> & QueryableStorageEntry<ApiType, [AccountId32, u32, u32]>;
/**
* Tracks how much of the liquidity was activated for schedule rewards and not yet
* liquidity mining rewards. That information is essential to properly handle token unlcocks
* when liquidity is deactivated.
**/
activatedLockedLiquidityForSchedules: AugmentedQuery<ApiType, (arg1: AccountId32 | string | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<u128>, [AccountId32, u32]> & QueryableStorageEntry<ApiType, [AccountId32, u32]>;
/**
* Tracks how much of the liquidity was activated for schedule rewards and not yet
* liquidity mining rewards. That information is essential to properly handle token unlcocks
* when liquidity is deactivated.
**/
activatedNativeRewardsLiq: AugmentedQuery<ApiType, (arg1: AccountId32 | string | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<u128>, [AccountId32, u32]> & QueryableStorageEntry<ApiType, [AccountId32, u32]>;
/**
* Stores information about pool weight and accumulated rewards. The accumulated
* rewards amount is the number of rewards that can be claimed per liquidity
Expand All @@ -592,7 +611,33 @@ declare module '@polkadot/api-base/types/storage' {
**/
promotedPoolRewards: AugmentedQuery<ApiType, () => Observable<BTreeMap<u32, PalletProofOfStakePromotedPools>>, []> & QueryableStorageEntry<ApiType, []>;
rewardsInfo: AugmentedQuery<ApiType, (arg1: AccountId32 | string | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<PalletProofOfStakeRewardInfo>, [AccountId32, u32]> & QueryableStorageEntry<ApiType, [AccountId32, u32]>;
/**
* Stores information about pool weight and accumulated rewards
**/
rewardsInfoForScheduleRewards: AugmentedQuery<ApiType, (arg1: AccountId32 | string | Uint8Array, arg2: ITuple<[u32, u32]> | [u32 | AnyNumber | Uint8Array, u32 | AnyNumber | Uint8Array]) => Observable<PalletProofOfStakeRewardInfo>, [AccountId32, ITuple<[u32, u32]>]> & QueryableStorageEntry<ApiType, [AccountId32, ITuple<[u32, u32]>]>;
/**
* List of activated schedules sorted by expiry date
**/
rewardsSchedules: AugmentedQuery<ApiType, () => Observable<BTreeMap<ITuple<[u32, u32, u32, u128, u64]>, Null>>, []> & QueryableStorageEntry<ApiType, []>;
rewardsSchedulesList: AugmentedQuery<ApiType, (arg: u64 | AnyNumber | Uint8Array) => Observable<Option<ITuple<[PalletProofOfStakeSchedule, Option<u64>]>>>, [u64]> & QueryableStorageEntry<ApiType, [u64]>;
/**
* Maps liquidity token to list of tokens that it ever was rewarded with
**/
rewardTokensPerPool: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<Null>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
scheduleRewardsPerLiquidity: AugmentedQuery<ApiType, (arg: ITuple<[u32, u32]> | [u32 | AnyNumber | Uint8Array, u32 | AnyNumber | Uint8Array]) => Observable<ITuple<[U256, u64]>>, [ITuple<[u32, u32]>]> & QueryableStorageEntry<ApiType, [ITuple<[u32, u32]>]>;
/**
* How much scheduled rewards per single liquidty_token should be distribute_rewards
* the **value is multiplied by u128::MAX** to avoid floating point arithmetic
**/
scheduleRewardsTotal: AugmentedQuery<ApiType, (arg: ITuple<[u32, u32]> | [u32 | AnyNumber | Uint8Array, u32 | AnyNumber | Uint8Array]) => Observable<PalletProofOfStakeScheduleRewardsCalculatorScheduleRewards>, [ITuple<[u32, u32]>]> & QueryableStorageEntry<ApiType, [ITuple<[u32, u32]>]>;
schedulesListMetadata: AugmentedQuery<ApiType, () => Observable<PalletProofOfStakeSchedulesList>, []> & QueryableStorageEntry<ApiType, []>;
totalActivatedLiquidity: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<u128>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
/**
* Tracks number of activated liquidity per schedule. It is used for calculation of
* "cumulative rewrds amount" per 1 liquidity token. Therefore activation/deactivation needs
* to be deffered same way as schedule rewards are delayed.
**/
totalActivatedLiquidityForSchedules: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<PalletProofOfStakeScheduleRewardsCalculatorActivatedLiquidityPerSchedule>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
/**
* Generic query
**/
Expand Down
30 changes: 29 additions & 1 deletion packages/types/src/interfaces/augment-api-tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { Data } from '@polkadot/types';
import type { Bytes, Compact, Option, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
import type { AnyNumber, IMethod, ITuple } from '@polkadot/types-codec/types';
import type { AccountId32, Call, H256, MultiAddress, Perbill, Permill } from '@polkadot/types/interfaces/runtime';
import type { CommonRuntimeConfigPalletProxyProxyType, CumulusPrimitivesParachainInherentParachainInherentData, MangataRococoRuntimeOriginCaller, MangataRococoRuntimeSessionKeys, MangataTypesAssetsCustomMetadata, MangataTypesMultipurposeLiquidityActivateKind, MangataTypesMultipurposeLiquidityBondKind, OrmlTraitsAssetRegistryAssetMetadata, PalletIdentityBitFlags, PalletIdentityIdentityInfo, PalletIdentityJudgement, PalletIssuanceTgeInfo, PalletVestingMangataVestingInfo, ParachainStakingMetadataUpdateAction, ParachainStakingPairedOrLiquidityToken, SpRuntimeMultiSignature, SpWeightsWeightV2Weight, StagingXcmV3MultiLocation, StagingXcmV3WeightLimit, StagingXcmVersionedMultiAsset, StagingXcmVersionedMultiAssets, StagingXcmVersionedMultiLocation, StagingXcmVersionedXcm } from '@polkadot/types/lookup';
import type { CommonRuntimeConfigPalletProxyProxyType, CumulusPrimitivesParachainInherentParachainInherentData, MangataRococoRuntimeOriginCaller, MangataRococoRuntimeSessionKeys, MangataTypesAssetsCustomMetadata, MangataTypesMultipurposeLiquidityActivateKind, MangataTypesMultipurposeLiquidityBondKind, OrmlTraitsAssetRegistryAssetMetadata, PalletIdentityBitFlags, PalletIdentityIdentityInfo, PalletIdentityJudgement, PalletIssuanceTgeInfo, PalletProofOfStakeThirdPartyActivationKind, PalletVestingMangataVestingInfo, ParachainStakingMetadataUpdateAction, ParachainStakingPairedOrLiquidityToken, SpRuntimeMultiSignature, SpWeightsWeightV2Weight, StagingXcmV3MultiLocation, StagingXcmV3WeightLimit, StagingXcmVersionedMultiAsset, StagingXcmVersionedMultiAssets, StagingXcmVersionedMultiLocation, StagingXcmVersionedXcm } from '@polkadot/types/lookup';

export type __AugmentedSubmittable = AugmentedSubmittable<() => unknown>;
export type __SubmittableExtrinsic<ApiType extends ApiTypes> = SubmittableExtrinsic<ApiType>;
Expand Down Expand Up @@ -507,6 +507,22 @@ declare module '@polkadot/api-base/types/submittable' {
* See [`Pallet::activate_liquidity`].
**/
activateLiquidity: AugmentedSubmittable<(liquidityTokenId: u32 | AnyNumber | Uint8Array, amount: u128 | AnyNumber | Uint8Array, useBalanceFrom: Option<MangataTypesMultipurposeLiquidityActivateKind> | null | Uint8Array | MangataTypesMultipurposeLiquidityActivateKind | 'AvailableBalance' | 'StakedUnactivatedReserves' | 'UnspentReserves' | number) => SubmittableExtrinsic<ApiType>, [u32, u128, Option<MangataTypesMultipurposeLiquidityActivateKind>]>;
/**
* See [`Pallet::activate_liquidity_for_3rdparty_rewards`].
**/
activateLiquidityFor3rdpartyRewards: AugmentedSubmittable<(liquidityTokenId: u32 | AnyNumber | Uint8Array, amount: u128 | AnyNumber | Uint8Array, rewardToken: u32 | AnyNumber | Uint8Array, useBalanceFrom: Option<PalletProofOfStakeThirdPartyActivationKind> | null | Uint8Array | PalletProofOfStakeThirdPartyActivationKind | { ActivateKind: any } | { ActivatedLiquidity: any } | { NativeRewardsLiquidity: any } | string) => SubmittableExtrinsic<ApiType>, [u32, u128, u32, Option<PalletProofOfStakeThirdPartyActivationKind>]>;
/**
* See [`Pallet::activate_liquidity_for_native_rewards`].
**/
activateLiquidityForNativeRewards: AugmentedSubmittable<(liquidityTokenId: u32 | AnyNumber | Uint8Array, amount: u128 | AnyNumber | Uint8Array, useBalanceFrom: Option<MangataTypesMultipurposeLiquidityActivateKind> | null | Uint8Array | MangataTypesMultipurposeLiquidityActivateKind | 'AvailableBalance' | 'StakedUnactivatedReserves' | 'UnspentReserves' | number) => SubmittableExtrinsic<ApiType>, [u32, u128, Option<MangataTypesMultipurposeLiquidityActivateKind>]>;
/**
* See [`Pallet::claim_3rdparty_rewards`].
**/
claim3rdpartyRewards: AugmentedSubmittable<(liquidityTokenId: u32 | AnyNumber | Uint8Array, rewardToken: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32]>;
/**
* See [`Pallet::claim_native_rewards`].
**/
claimNativeRewards: AugmentedSubmittable<(liquidityTokenId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;
/**
* See [`Pallet::claim_rewards_all`].
**/
Expand All @@ -515,6 +531,18 @@ declare module '@polkadot/api-base/types/submittable' {
* See [`Pallet::deactivate_liquidity`].
**/
deactivateLiquidity: AugmentedSubmittable<(liquidityTokenId: u32 | AnyNumber | Uint8Array, amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u128]>;
/**
* See [`Pallet::deactivate_liquidity_for_3rdparty_rewards`].
**/
deactivateLiquidityFor3rdpartyRewards: AugmentedSubmittable<(liquidityTokenId: u32 | AnyNumber | Uint8Array, amount: u128 | AnyNumber | Uint8Array, rewardToken: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u128, u32]>;
/**
* See [`Pallet::deactivate_liquidity_for_native_rewards`].
**/
deactivateLiquidityForNativeRewards: AugmentedSubmittable<(liquidityTokenId: u32 | AnyNumber | Uint8Array, amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u128]>;
/**
* See [`Pallet::reward_pool`].
**/
rewardPool: AugmentedSubmittable<(pool: ITuple<[u32, u32]> | [u32 | AnyNumber | Uint8Array, u32 | AnyNumber | Uint8Array], tokenId: u32 | AnyNumber | Uint8Array, amount: u128 | AnyNumber | Uint8Array, scheduleEnd: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [ITuple<[u32, u32]>, u32, u128, u32]>;
/**
* See [`Pallet::update_pool_promotion`].
**/
Expand Down
Loading

0 comments on commit 434f80d

Please sign in to comment.