TreasuryProposal (#825)

This commit is contained in:
Jaco Greeff
2019-05-27 15:45:50 +12:00
committed by ian.he
parent 6b6b7fe145
commit 382e903b8f
9 changed files with 63 additions and 5 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ There primitive types are available: [[Bool]], [[Bytes]], [[Data]], [[H160]], [[
## Substrate types
These types implement specific types that are found as part of the Substrate base: [[AccountId]], [[AccountIndex]], [[Address]], [[Amount]], [[AssetOf]], [[AttestedCandidate]], [[AuthorityId]], [[Balance]], [[BalanceLock]], [[BalanceOf]], [[Block]], [[BlockNumber]], [[CodeHash]], [[Digest]], [[Event]], [[EventRecord]], [[Exposure]], [[Extrinsic]], [[ExtrinsicEra]], [[ExtrinsicSignature]], [[Gas]], [[Hash]], [[Header]], [[IndividualExposure]], [[InherentOfflineReport]], [[Justification]], [[Key]], [[KeyValue]], [[LockIdentifier]], [[MisbehaviorReport]], [[NewAccountOutcome]], [[Nonce]], [[Origin]], [[ParaId]], [[Perbill]], [[Permill]], [[PrefabWasmModule]], [[PropIndex]], [[Proposal]], [[ProposalIndex]], [[ReferendumIndex]], [[ReferendumInfo]], [[RewardDestination]], [[Schedule]], [[SeedOf]], [[SessionKey]], [[Signature]], [[SignaturePayload]], [[StakingLedger]], [[StoredPendingChange]], [[UnlockChunk]], [[ValidatorPrefs]], [[VestingSchedule]], [[Vote]], [[VoteIndex]], [[VoteThreshold]], [[WithdrawReasons]]
These types implement specific types that are found as part of the Substrate base: [[AccountId]], [[AccountIndex]], [[Address]], [[Amount]], [[AssetOf]], [[AttestedCandidate]], [[AuthorityId]], [[Balance]], [[BalanceLock]], [[BalanceOf]], [[Block]], [[BlockNumber]], [[CodeHash]], [[Digest]], [[Event]], [[EventRecord]], [[Exposure]], [[Extrinsic]], [[ExtrinsicEra]], [[ExtrinsicSignature]], [[Gas]], [[Hash]], [[Header]], [[IndividualExposure]], [[InherentOfflineReport]], [[Justification]], [[Key]], [[KeyValue]], [[LockIdentifier]], [[MisbehaviorReport]], [[NewAccountOutcome]], [[Nonce]], [[Origin]], [[ParaId]], [[Perbill]], [[Permill]], [[PrefabWasmModule]], [[PropIndex]], [[Proposal]], [[ProposalIndex]], [[ReferendumIndex]], [[ReferendumInfo]], [[RewardDestination]], [[Schedule]], [[SeedOf]], [[SessionKey]], [[Signature]], [[SignaturePayload]], [[StakingLedger]], [[StoredPendingChange]], [[TreasuryProposal]], [[UnlockChunk]], [[ValidatorPrefs]], [[VestingSchedule]], [[Vote]], [[VoteIndex]], [[VoteThreshold]], [[WithdrawReasons]]
## Codec types
@@ -2708,7 +2708,7 @@
"type": {
"MapType": {
"key": "ProposalIndex",
"value": "Proposal"
"value": "TreasuryProposal"
}
},
"default": "0x00",
@@ -2461,7 +2461,7 @@
"type": {
"MapType": {
"key": "ProposalIndex",
"value": "Proposal"
"value": "TreasuryProposal"
}
},
"fallback": "0x00",
@@ -2573,7 +2573,7 @@
"type": {
"MapType": {
"key": "ProposalIndex",
"value": "Proposal",
"value": "TreasuryProposal",
"isLinked": false
}
},
@@ -2632,7 +2632,7 @@
"type": {
"MapType": {
"key": "ProposalIndex",
"value": "Proposal",
"value": "TreasuryProposal",
"isLinked": false
}
},
+2
View File
@@ -37,6 +37,8 @@ export default class Type extends Text {
const mappings: Array<Mapper> = [
// alias <T::InherentOfflineReport as InherentOfflineReport>::Inherent -> InherentOfflineReport
Type._alias('<T::InherentOfflineReport as InherentOfflineReport>::Inherent', 'InherentOfflineReport'),
// alias TreasuryProposal from Proposal<T::AccountId, BalanceOf<T>>
Type._alias('Proposal<T::AccountId, BalanceOf<T>>', 'TreasuryProposal'),
// <T::Balance as HasCompact>
Type._cleanupCompact(),
// Remove all the trait prefixes
@@ -0,0 +1,51 @@
// Copyright 2017-2019 @polkadot/types authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import Struct from '../codec/Struct';
import AccountId from './AccountId';
import Balance from './Balance';
/**
* @name TreasuryProposal
* @description
* A Proposal made for Treasury
*/
export default class TreasuryProposal extends Struct {
constructor (value: any) {
super({
proposer: AccountId,
value: Balance,
beneficiary: AccountId,
bond: Balance
}, value);
}
/**
* @description The beneficiary
*/
get beneficiary (): AccountId {
return this.get('beneficiary') as AccountId;
}
/**
* @description The bond
*/
get bond (): Balance {
return this.get('bond') as Balance;
}
/**
* @description The proposer
*/
get proposer (): AccountId {
return this.get('proposer') as AccountId;
}
/**
* @description The bond
*/
get value (): Balance {
return this.get('value') as Balance;
}
}
+1
View File
@@ -64,6 +64,7 @@ export { default as SessionKey } from './SessionKey';
export { default as Signature, Ed25519Signature, Sr25519Signature } from './Signature';
export { default as StakingLedger } from './StakingLedger';
export { default as StoredPendingChange } from './StoredPendingChange';
export { default as TreasuryProposal } from './TreasuryProposal';
export { default as UnlockChunk } from './UnlockChunk';
export { default as ValidatorPrefs } from './ValidatorPrefs';
export { default as VestingSchedule } from './VestingSchedule';