From 75102e02f43b4105141a38e0c61abec205a7659a Mon Sep 17 00:00:00 2001 From: qwer951123 Date: Wed, 1 Sep 2021 16:13:28 +0800 Subject: [PATCH] feat: add compound cash types, #165 --- packages/type-definitions/src/compoundCash.ts | 19 ++ packages/type-definitions/src/index.ts | 4 +- packages/type-definitions/src/json/types.json | 14 + .../src/json/typesBundle.json | 252 ++++++++++++++++++ .../types/src/interfaces/augment-types.ts | 5 + .../interfaces/compoundCash/definitions.ts | 4 + .../src/interfaces/compoundCash/index.ts | 4 + .../src/interfaces/compoundCash/types.ts | 33 +++ packages/types/src/interfaces/definitions.ts | 1 + packages/types/src/interfaces/types.ts | 1 + 10 files changed, 336 insertions(+), 1 deletion(-) create mode 100644 packages/type-definitions/src/compoundCash.ts create mode 100644 packages/types/src/interfaces/compoundCash/definitions.ts create mode 100644 packages/types/src/interfaces/compoundCash/index.ts create mode 100644 packages/types/src/interfaces/compoundCash/types.ts diff --git a/packages/type-definitions/src/compoundCash.ts b/packages/type-definitions/src/compoundCash.ts new file mode 100644 index 00000000..442d9074 --- /dev/null +++ b/packages/type-definitions/src/compoundCash.ts @@ -0,0 +1,19 @@ +export default { + rpc: {}, + types: { + CashYieldIndex: 'u128', + GatewayNoticePayload: { + _enum: { + SetSupplyCap: '(CurrencyId, Balance)', + ChangeAuthorities: 'Vec', + Unlock: '(CurrencyId, Balance, AccountId)', + SetFutureYield: '(Balance, CashYieldIndex, Moment)' + } + }, + GatewayNotice: { + id: 'u64', + payload: 'GatewayNoticePayload' + }, + CompoundAuthoritySignature: 'AccountId' + } +}; diff --git a/packages/type-definitions/src/index.ts b/packages/type-definitions/src/index.ts index 8923e0bc..5020d0d8 100644 --- a/packages/type-definitions/src/index.ts +++ b/packages/type-definitions/src/index.ts @@ -19,6 +19,7 @@ import primitives from './primitives'; // ecosystem import renvmBridge from './renvmBridge'; import { chainBridge, chainSafeTransfer } from './chainSafe'; +import compoundCash from './compoundCash'; import runtime from './runtime'; import { signedExtensions as acalaSignedExtensions } from './signedExtensions'; @@ -56,7 +57,8 @@ const acalaDefs = { // ecosystem renvmBridge, chainBridge, - chainSafeTransfer + chainSafeTransfer, + compoundCash }; export const types = { diff --git a/packages/type-definitions/src/json/types.json b/packages/type-definitions/src/json/types.json index b30bac5e..8097322d 100644 --- a/packages/type-definitions/src/json/types.json +++ b/packages/type-definitions/src/json/types.json @@ -371,5 +371,19 @@ "DepositNonce": "u64", "ResourceId": "[u8; 32]", "ChainId": "u8", + "CashYieldIndex": "u128", + "GatewayNoticePayload": { + "_enum": { + "SetSupplyCap": "(CurrencyId, Balance)", + "ChangeAuthorities": "Vec", + "Unlock": "(CurrencyId, Balance, AccountId)", + "SetFutureYield": "(Balance, CashYieldIndex, Moment)" + } + }, + "GatewayNotice": { + "id": "u64", + "payload": "GatewayNoticePayload" + }, + "CompoundAuthoritySignature": "AccountId", "Keys": "SessionKeys1" } \ No newline at end of file diff --git a/packages/type-definitions/src/json/typesBundle.json b/packages/type-definitions/src/json/typesBundle.json index 8967e71f..bd655bb7 100644 --- a/packages/type-definitions/src/json/typesBundle.json +++ b/packages/type-definitions/src/json/typesBundle.json @@ -546,6 +546,20 @@ "DepositNonce": "u64", "ResourceId": "[u8; 32]", "ChainId": "u8", + "CashYieldIndex": "u128", + "GatewayNoticePayload": { + "_enum": { + "SetSupplyCap": "(CurrencyId, Balance)", + "ChangeAuthorities": "Vec", + "Unlock": "(CurrencyId, Balance, AccountId)", + "SetFutureYield": "(Balance, CashYieldIndex, Moment)" + } + }, + "GatewayNotice": { + "id": "u64", + "payload": "GatewayNoticePayload" + }, + "CompoundAuthoritySignature": "AccountId", "Keys": "SessionKeys1", "Address": "LookupSource", "LookupSource": "IndicesLookupSource" @@ -925,6 +939,20 @@ "DepositNonce": "u64", "ResourceId": "[u8; 32]", "ChainId": "u8", + "CashYieldIndex": "u128", + "GatewayNoticePayload": { + "_enum": { + "SetSupplyCap": "(CurrencyId, Balance)", + "ChangeAuthorities": "Vec", + "Unlock": "(CurrencyId, Balance, AccountId)", + "SetFutureYield": "(Balance, CashYieldIndex, Moment)" + } + }, + "GatewayNotice": { + "id": "u64", + "payload": "GatewayNoticePayload" + }, + "CompoundAuthoritySignature": "AccountId", "Keys": "SessionKeys1", "Address": "GenericMultiAddress", "LookupSource": "GenericMultiAddress" @@ -1308,6 +1336,20 @@ "DepositNonce": "u64", "ResourceId": "[u8; 32]", "ChainId": "u8", + "CashYieldIndex": "u128", + "GatewayNoticePayload": { + "_enum": { + "SetSupplyCap": "(CurrencyId, Balance)", + "ChangeAuthorities": "Vec", + "Unlock": "(CurrencyId, Balance, AccountId)", + "SetFutureYield": "(Balance, CashYieldIndex, Moment)" + } + }, + "GatewayNotice": { + "id": "u64", + "payload": "GatewayNoticePayload" + }, + "CompoundAuthoritySignature": "AccountId", "Keys": "SessionKeys1", "Address": "GenericMultiAddress", "LookupSource": "GenericMultiAddress", @@ -1694,6 +1736,20 @@ "DepositNonce": "u64", "ResourceId": "[u8; 32]", "ChainId": "u8", + "CashYieldIndex": "u128", + "GatewayNoticePayload": { + "_enum": { + "SetSupplyCap": "(CurrencyId, Balance)", + "ChangeAuthorities": "Vec", + "Unlock": "(CurrencyId, Balance, AccountId)", + "SetFutureYield": "(Balance, CashYieldIndex, Moment)" + } + }, + "GatewayNotice": { + "id": "u64", + "payload": "GatewayNoticePayload" + }, + "CompoundAuthoritySignature": "AccountId", "Keys": "SessionKeys1" } }, @@ -2081,6 +2137,20 @@ "DepositNonce": "u64", "ResourceId": "[u8; 32]", "ChainId": "u8", + "CashYieldIndex": "u128", + "GatewayNoticePayload": { + "_enum": { + "SetSupplyCap": "(CurrencyId, Balance)", + "ChangeAuthorities": "Vec", + "Unlock": "(CurrencyId, Balance, AccountId)", + "SetFutureYield": "(Balance, CashYieldIndex, Moment)" + } + }, + "GatewayNotice": { + "id": "u64", + "payload": "GatewayNoticePayload" + }, + "CompoundAuthoritySignature": "AccountId", "Keys": "SessionKeys1" } }, @@ -2462,6 +2532,20 @@ "DepositNonce": "u64", "ResourceId": "[u8; 32]", "ChainId": "u8", + "CashYieldIndex": "u128", + "GatewayNoticePayload": { + "_enum": { + "SetSupplyCap": "(CurrencyId, Balance)", + "ChangeAuthorities": "Vec", + "Unlock": "(CurrencyId, Balance, AccountId)", + "SetFutureYield": "(Balance, CashYieldIndex, Moment)" + } + }, + "GatewayNotice": { + "id": "u64", + "payload": "GatewayNoticePayload" + }, + "CompoundAuthoritySignature": "AccountId", "Keys": "SessionKeys1" } } @@ -3032,6 +3116,20 @@ "DepositNonce": "u64", "ResourceId": "[u8; 32]", "ChainId": "u8", + "CashYieldIndex": "u128", + "GatewayNoticePayload": { + "_enum": { + "SetSupplyCap": "(CurrencyId, Balance)", + "ChangeAuthorities": "Vec", + "Unlock": "(CurrencyId, Balance, AccountId)", + "SetFutureYield": "(Balance, CashYieldIndex, Moment)" + } + }, + "GatewayNotice": { + "id": "u64", + "payload": "GatewayNoticePayload" + }, + "CompoundAuthoritySignature": "AccountId", "Keys": "SessionKeys1", "Address": "LookupSource", "LookupSource": "IndicesLookupSource" @@ -3411,6 +3509,20 @@ "DepositNonce": "u64", "ResourceId": "[u8; 32]", "ChainId": "u8", + "CashYieldIndex": "u128", + "GatewayNoticePayload": { + "_enum": { + "SetSupplyCap": "(CurrencyId, Balance)", + "ChangeAuthorities": "Vec", + "Unlock": "(CurrencyId, Balance, AccountId)", + "SetFutureYield": "(Balance, CashYieldIndex, Moment)" + } + }, + "GatewayNotice": { + "id": "u64", + "payload": "GatewayNoticePayload" + }, + "CompoundAuthoritySignature": "AccountId", "Keys": "SessionKeys1", "Address": "GenericMultiAddress", "LookupSource": "GenericMultiAddress" @@ -3794,6 +3906,20 @@ "DepositNonce": "u64", "ResourceId": "[u8; 32]", "ChainId": "u8", + "CashYieldIndex": "u128", + "GatewayNoticePayload": { + "_enum": { + "SetSupplyCap": "(CurrencyId, Balance)", + "ChangeAuthorities": "Vec", + "Unlock": "(CurrencyId, Balance, AccountId)", + "SetFutureYield": "(Balance, CashYieldIndex, Moment)" + } + }, + "GatewayNotice": { + "id": "u64", + "payload": "GatewayNoticePayload" + }, + "CompoundAuthoritySignature": "AccountId", "Keys": "SessionKeys1", "Address": "GenericMultiAddress", "LookupSource": "GenericMultiAddress", @@ -4180,6 +4306,20 @@ "DepositNonce": "u64", "ResourceId": "[u8; 32]", "ChainId": "u8", + "CashYieldIndex": "u128", + "GatewayNoticePayload": { + "_enum": { + "SetSupplyCap": "(CurrencyId, Balance)", + "ChangeAuthorities": "Vec", + "Unlock": "(CurrencyId, Balance, AccountId)", + "SetFutureYield": "(Balance, CashYieldIndex, Moment)" + } + }, + "GatewayNotice": { + "id": "u64", + "payload": "GatewayNoticePayload" + }, + "CompoundAuthoritySignature": "AccountId", "Keys": "SessionKeys1" } }, @@ -4567,6 +4707,20 @@ "DepositNonce": "u64", "ResourceId": "[u8; 32]", "ChainId": "u8", + "CashYieldIndex": "u128", + "GatewayNoticePayload": { + "_enum": { + "SetSupplyCap": "(CurrencyId, Balance)", + "ChangeAuthorities": "Vec", + "Unlock": "(CurrencyId, Balance, AccountId)", + "SetFutureYield": "(Balance, CashYieldIndex, Moment)" + } + }, + "GatewayNotice": { + "id": "u64", + "payload": "GatewayNoticePayload" + }, + "CompoundAuthoritySignature": "AccountId", "Keys": "SessionKeys1" } }, @@ -4948,6 +5102,20 @@ "DepositNonce": "u64", "ResourceId": "[u8; 32]", "ChainId": "u8", + "CashYieldIndex": "u128", + "GatewayNoticePayload": { + "_enum": { + "SetSupplyCap": "(CurrencyId, Balance)", + "ChangeAuthorities": "Vec", + "Unlock": "(CurrencyId, Balance, AccountId)", + "SetFutureYield": "(Balance, CashYieldIndex, Moment)" + } + }, + "GatewayNotice": { + "id": "u64", + "payload": "GatewayNoticePayload" + }, + "CompoundAuthoritySignature": "AccountId", "Keys": "SessionKeys1" } } @@ -5518,6 +5686,20 @@ "DepositNonce": "u64", "ResourceId": "[u8; 32]", "ChainId": "u8", + "CashYieldIndex": "u128", + "GatewayNoticePayload": { + "_enum": { + "SetSupplyCap": "(CurrencyId, Balance)", + "ChangeAuthorities": "Vec", + "Unlock": "(CurrencyId, Balance, AccountId)", + "SetFutureYield": "(Balance, CashYieldIndex, Moment)" + } + }, + "GatewayNotice": { + "id": "u64", + "payload": "GatewayNoticePayload" + }, + "CompoundAuthoritySignature": "AccountId", "Keys": "SessionKeys1", "Address": "LookupSource", "LookupSource": "IndicesLookupSource" @@ -5897,6 +6079,20 @@ "DepositNonce": "u64", "ResourceId": "[u8; 32]", "ChainId": "u8", + "CashYieldIndex": "u128", + "GatewayNoticePayload": { + "_enum": { + "SetSupplyCap": "(CurrencyId, Balance)", + "ChangeAuthorities": "Vec", + "Unlock": "(CurrencyId, Balance, AccountId)", + "SetFutureYield": "(Balance, CashYieldIndex, Moment)" + } + }, + "GatewayNotice": { + "id": "u64", + "payload": "GatewayNoticePayload" + }, + "CompoundAuthoritySignature": "AccountId", "Keys": "SessionKeys1", "Address": "GenericMultiAddress", "LookupSource": "GenericMultiAddress" @@ -6280,6 +6476,20 @@ "DepositNonce": "u64", "ResourceId": "[u8; 32]", "ChainId": "u8", + "CashYieldIndex": "u128", + "GatewayNoticePayload": { + "_enum": { + "SetSupplyCap": "(CurrencyId, Balance)", + "ChangeAuthorities": "Vec", + "Unlock": "(CurrencyId, Balance, AccountId)", + "SetFutureYield": "(Balance, CashYieldIndex, Moment)" + } + }, + "GatewayNotice": { + "id": "u64", + "payload": "GatewayNoticePayload" + }, + "CompoundAuthoritySignature": "AccountId", "Keys": "SessionKeys1", "Address": "GenericMultiAddress", "LookupSource": "GenericMultiAddress", @@ -6666,6 +6876,20 @@ "DepositNonce": "u64", "ResourceId": "[u8; 32]", "ChainId": "u8", + "CashYieldIndex": "u128", + "GatewayNoticePayload": { + "_enum": { + "SetSupplyCap": "(CurrencyId, Balance)", + "ChangeAuthorities": "Vec", + "Unlock": "(CurrencyId, Balance, AccountId)", + "SetFutureYield": "(Balance, CashYieldIndex, Moment)" + } + }, + "GatewayNotice": { + "id": "u64", + "payload": "GatewayNoticePayload" + }, + "CompoundAuthoritySignature": "AccountId", "Keys": "SessionKeys1" } }, @@ -7053,6 +7277,20 @@ "DepositNonce": "u64", "ResourceId": "[u8; 32]", "ChainId": "u8", + "CashYieldIndex": "u128", + "GatewayNoticePayload": { + "_enum": { + "SetSupplyCap": "(CurrencyId, Balance)", + "ChangeAuthorities": "Vec", + "Unlock": "(CurrencyId, Balance, AccountId)", + "SetFutureYield": "(Balance, CashYieldIndex, Moment)" + } + }, + "GatewayNotice": { + "id": "u64", + "payload": "GatewayNoticePayload" + }, + "CompoundAuthoritySignature": "AccountId", "Keys": "SessionKeys1" } }, @@ -7434,6 +7672,20 @@ "DepositNonce": "u64", "ResourceId": "[u8; 32]", "ChainId": "u8", + "CashYieldIndex": "u128", + "GatewayNoticePayload": { + "_enum": { + "SetSupplyCap": "(CurrencyId, Balance)", + "ChangeAuthorities": "Vec", + "Unlock": "(CurrencyId, Balance, AccountId)", + "SetFutureYield": "(Balance, CashYieldIndex, Moment)" + } + }, + "GatewayNotice": { + "id": "u64", + "payload": "GatewayNoticePayload" + }, + "CompoundAuthoritySignature": "AccountId", "Keys": "SessionKeys1" } } diff --git a/packages/types/src/interfaces/augment-types.ts b/packages/types/src/interfaces/augment-types.ts index 5261913e..caf796f2 100644 --- a/packages/types/src/interfaces/augment-types.ts +++ b/packages/types/src/interfaces/augment-types.ts @@ -6,6 +6,7 @@ import type { PalletBalanceOf } from '@acala-network/types/interfaces/accounts'; import type { CollateralAuctionItem, DebitAuctionItem, SurplusAuctionItem } from '@acala-network/types/interfaces/auctionManager'; import type { ChangeBalance, ChangeOptionRate, ChangeOptionRatio, LiquidationStrategy, OptionRate, OptionRatio, RiskManagementParams } from '@acala-network/types/interfaces/cdpEngine'; import type { CandidateInfoOf } from '@acala-network/types/interfaces/collatorSelection'; +import type { CashYieldIndex, CompoundAuthoritySignature, GatewayNotice, GatewayNoticePayload } from '@acala-network/types/interfaces/compoundCash'; import type { BalanceRequest, BalanceWrapper, TradingPairProvisionParameters, TradingPairStatus } from '@acala-network/types/interfaces/dex'; import type { CallRequest, CodeInfo, Erc20Info, EstimateResourcesResponse, EvmAccountInfo, EvmAddress, EvmContractInfo } from '@acala-network/types/interfaces/evm'; import type { RedeemStrategy } from '@acala-network/types/interfaces/homa'; @@ -223,6 +224,7 @@ declare module '@polkadot/types/types/registry' { CandidateInfoOf: CandidateInfoOf; CandidatePendingAvailability: CandidatePendingAvailability; CandidateReceipt: CandidateReceipt; + CashYieldIndex: CashYieldIndex; ChainId: ChainId; ChainProperties: ChainProperties; ChainType: ChainType; @@ -255,6 +257,7 @@ declare module '@polkadot/types/types/registry' { CompactAssignmentsWith24: CompactAssignmentsWith24; CompactScore: CompactScore; CompactScoreCompact: CompactScoreCompact; + CompoundAuthoritySignature: CompoundAuthoritySignature; ConfigData: ConfigData; Consensus: Consensus; ConsensusEngineId: ConsensusEngineId; @@ -472,6 +475,8 @@ declare module '@polkadot/types/types/registry' { FundInfo: FundInfo; Fungibility: Fungibility; Gas: Gas; + GatewayNotice: GatewayNotice; + GatewayNoticePayload: GatewayNoticePayload; GiltBid: GiltBid; GlobalValidationData: GlobalValidationData; GlobalValidationSchedule: GlobalValidationSchedule; diff --git a/packages/types/src/interfaces/compoundCash/definitions.ts b/packages/types/src/interfaces/compoundCash/definitions.ts new file mode 100644 index 00000000..1ecc9224 --- /dev/null +++ b/packages/types/src/interfaces/compoundCash/definitions.ts @@ -0,0 +1,4 @@ +import { Definitions } from '@polkadot/types/types'; +import compoundCash from '@acala-network/type-definitions/compoundCash'; + +export default compoundCash as Definitions; diff --git a/packages/types/src/interfaces/compoundCash/index.ts b/packages/types/src/interfaces/compoundCash/index.ts new file mode 100644 index 00000000..2d307291 --- /dev/null +++ b/packages/types/src/interfaces/compoundCash/index.ts @@ -0,0 +1,4 @@ +// Auto-generated via `yarn polkadot-types-from-defs`, do not edit +/* eslint-disable */ + +export * from './types'; diff --git a/packages/types/src/interfaces/compoundCash/types.ts b/packages/types/src/interfaces/compoundCash/types.ts new file mode 100644 index 00000000..84b4a091 --- /dev/null +++ b/packages/types/src/interfaces/compoundCash/types.ts @@ -0,0 +1,33 @@ +// Auto-generated via `yarn polkadot-types-from-defs`, do not edit +/* eslint-disable */ + +import type { Enum, Struct, Vec, u128, u64 } from '@polkadot/types'; +import type { ITuple } from '@polkadot/types/types'; +import type { CurrencyId } from '@acala-network/types/interfaces/primitives'; +import type { AccountId, Balance, Moment } from '@acala-network/types/interfaces/runtime'; + +/** @name CashYieldIndex */ +export interface CashYieldIndex extends u128 {} + +/** @name CompoundAuthoritySignature */ +export interface CompoundAuthoritySignature extends AccountId {} + +/** @name GatewayNotice */ +export interface GatewayNotice extends Struct { + readonly id: u64; + readonly payload: GatewayNoticePayload; +} + +/** @name GatewayNoticePayload */ +export interface GatewayNoticePayload extends Enum { + readonly isSetSupplyCap: boolean; + readonly asSetSupplyCap: ITuple<[CurrencyId, Balance]>; + readonly isChangeAuthorities: boolean; + readonly asChangeAuthorities: Vec; + readonly isUnlock: boolean; + readonly asUnlock: ITuple<[CurrencyId, Balance, AccountId]>; + readonly isSetFutureYield: boolean; + readonly asSetFutureYield: ITuple<[Balance, CashYieldIndex, Moment]>; +} + +export type PHANTOM_COMPOUNDCASH = 'compoundCash'; diff --git a/packages/types/src/interfaces/definitions.ts b/packages/types/src/interfaces/definitions.ts index 2f291bd8..73fd6148 100644 --- a/packages/types/src/interfaces/definitions.ts +++ b/packages/types/src/interfaces/definitions.ts @@ -14,4 +14,5 @@ export { default as primitives } from './primitives/definitions'; export { default as runtime } from './runtime/definitions'; export { default as stakingPool } from './stakingPool/definitions'; export { default as renvmBridge } from './renvmBridge/definitions'; +export { default as compoundCash } from './compoundCash/definitions'; export { default as support } from './support/definitions'; diff --git a/packages/types/src/interfaces/types.ts b/packages/types/src/interfaces/types.ts index 00f46538..d6a00326 100644 --- a/packages/types/src/interfaces/types.ts +++ b/packages/types/src/interfaces/types.ts @@ -17,4 +17,5 @@ export * from './primitives/types'; export * from './runtime/types'; export * from './stakingPool/types'; export * from './renvmBridge/types'; +export * from './compoundCash/types'; export * from './support/types';