Skip to content

Commit

Permalink
feat: add compound cash types, #165
Browse files Browse the repository at this point in the history
  • Loading branch information
qwer951123 committed Sep 1, 2021
1 parent eda4383 commit 75102e0
Show file tree
Hide file tree
Showing 10 changed files with 336 additions and 1 deletion.
19 changes: 19 additions & 0 deletions packages/type-definitions/src/compoundCash.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export default {
rpc: {},
types: {
CashYieldIndex: 'u128',
GatewayNoticePayload: {
_enum: {
SetSupplyCap: '(CurrencyId, Balance)',
ChangeAuthorities: 'Vec<CompoundAuthoritySignature>',
Unlock: '(CurrencyId, Balance, AccountId)',
SetFutureYield: '(Balance, CashYieldIndex, Moment)'
}
},
GatewayNotice: {
id: 'u64',
payload: 'GatewayNoticePayload'
},
CompoundAuthoritySignature: 'AccountId'
}
};
4 changes: 3 additions & 1 deletion packages/type-definitions/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -56,7 +57,8 @@ const acalaDefs = {
// ecosystem
renvmBridge,
chainBridge,
chainSafeTransfer
chainSafeTransfer,
compoundCash
};

export const types = {
Expand Down
14 changes: 14 additions & 0 deletions packages/type-definitions/src/json/types.json
Original file line number Diff line number Diff line change
Expand Up @@ -371,5 +371,19 @@
"DepositNonce": "u64",
"ResourceId": "[u8; 32]",
"ChainId": "u8",
"CashYieldIndex": "u128",
"GatewayNoticePayload": {
"_enum": {
"SetSupplyCap": "(CurrencyId, Balance)",
"ChangeAuthorities": "Vec<CompoundAuthoritySignature>",
"Unlock": "(CurrencyId, Balance, AccountId)",
"SetFutureYield": "(Balance, CashYieldIndex, Moment)"
}
},
"GatewayNotice": {
"id": "u64",
"payload": "GatewayNoticePayload"
},
"CompoundAuthoritySignature": "AccountId",
"Keys": "SessionKeys1"
}
252 changes: 252 additions & 0 deletions packages/type-definitions/src/json/typesBundle.json

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions packages/types/src/interfaces/augment-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -223,6 +224,7 @@ declare module '@polkadot/types/types/registry' {
CandidateInfoOf: CandidateInfoOf;
CandidatePendingAvailability: CandidatePendingAvailability;
CandidateReceipt: CandidateReceipt;
CashYieldIndex: CashYieldIndex;
ChainId: ChainId;
ChainProperties: ChainProperties;
ChainType: ChainType;
Expand Down Expand Up @@ -255,6 +257,7 @@ declare module '@polkadot/types/types/registry' {
CompactAssignmentsWith24: CompactAssignmentsWith24;
CompactScore: CompactScore;
CompactScoreCompact: CompactScoreCompact;
CompoundAuthoritySignature: CompoundAuthoritySignature;
ConfigData: ConfigData;
Consensus: Consensus;
ConsensusEngineId: ConsensusEngineId;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions packages/types/src/interfaces/compoundCash/definitions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Definitions } from '@polkadot/types/types';
import compoundCash from '@acala-network/type-definitions/compoundCash';

export default compoundCash as Definitions;
4 changes: 4 additions & 0 deletions packages/types/src/interfaces/compoundCash/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */

export * from './types';
33 changes: 33 additions & 0 deletions packages/types/src/interfaces/compoundCash/types.ts
Original file line number Diff line number Diff line change
@@ -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<CompoundAuthoritySignature>;
readonly isUnlock: boolean;
readonly asUnlock: ITuple<[CurrencyId, Balance, AccountId]>;
readonly isSetFutureYield: boolean;
readonly asSetFutureYield: ITuple<[Balance, CashYieldIndex, Moment]>;
}

export type PHANTOM_COMPOUNDCASH = 'compoundCash';
1 change: 1 addition & 0 deletions packages/types/src/interfaces/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
1 change: 1 addition & 0 deletions packages/types/src/interfaces/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

0 comments on commit 75102e0

Please sign in to comment.