Skip to content

Commit

Permalink
fix: ✅ add missing update token constraint proposals
Browse files Browse the repository at this point in the history
  • Loading branch information
ignazio-bovo committed Jun 2, 2024
1 parent ac48824 commit 1cb93ad
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -292,15 +292,61 @@ export class CreateProposalsFixture extends StandardizedFixture {
assert.equal(qProposal.details.dampingFactor.toString(), details.toString())
break
}
case 'UpdateTokenPalletTokenConstraints': {
Utils.assert(qProposal.details.__typename === 'UpdateTokenPalletTokenConstraintsProposalDetails')
const details = proposalDetails.asUpdateTokenPalletTokenConstraints
if (details.minAmmSlope.isSome) {
assert.equal(qProposal.details.minAmmSlope.toString(), details.minAmmSlope.unwrap().toString())
}
if (details.ammBuyTxFees.isSome) {
assert.isNotNull(qProposal.details.ammBuyTxFees)
assert.isDefined(qProposal.details.ammBuyTxFees)
assert.equal(qProposal.details.ammBuyTxFees!.toString(), details.ammBuyTxFees.unwrap().toString())
}
if (details.ammSellTxFees.isSome) {
assert.isNotNull(qProposal.details.ammSellTxFees)
assert.isDefined(qProposal.details.ammSellTxFees)
assert.equal(qProposal.details.ammSellTxFees!.toString(), details.ammSellTxFees.unwrap().toString())
}
if (details.maxYearlyRate.isSome) {
assert.isNotNull(qProposal.details.maxYearlyRate)
assert.isDefined(qProposal.details.maxYearlyRate)
assert.equal(qProposal.details.maxYearlyRate!.toString(), details.maxYearlyRate.unwrap().toString())
}
if (details.minSaleDuration.isSome) {
assert.isNotNull(qProposal.details.minSaleDuration)
assert.isDefined(qProposal.details.minSaleDuration)
assert.equal(qProposal.details.minSaleDuration!.toString(), details.minSaleDuration.unwrap().toString())
}
if (details.minRevenueSplitDuration.isSome) {
assert.isNotNull(qProposal.details.minRevenueSplitDuration)
assert.isDefined(qProposal.details.minRevenueSplitDuration)
assert.equal(
qProposal.details.minRevenueSplitDuration!.toString(),
details.minRevenueSplitDuration.unwrap().toString()
)
}
if (details.minRevenueSplitTimeToStart.isSome) {
assert.isNotNull(qProposal.details.minRevenueSplitTimeToStart)
assert.isDefined(qProposal.details.minRevenueSplitTimeToStart)
assert.equal(
qProposal.details.minRevenueSplitTimeToStart!.toString(),
details.minRevenueSplitTimeToStart.unwrap().toString()
)
}
if (details.salePlatformFee.isSome) {
assert.isNotNull(qProposal.details.salePlatformFee)
assert.isDefined(qProposal.details.salePlatformFee)
assert.equal(qProposal.details.salePlatformFee!.toString(), details.salePlatformFee.unwrap().toString())
}
if (details.bloatBond.isSome) {
assert.isNotNull(qProposal.details.bloatBond)
assert.isDefined(qProposal.details.bloatBond)
assert.equal(qProposal.details.bloatBond!.toString(), details.bloatBond.unwrap().toString())
break
}
}
}
// TODO(petra): missing proposals:
/**
* - [X] set pallet frozen status
* - [ ] update pallet token constraints
* - [ ] update argo bridge constraints
* - [X] set era payout damping factor
* - [X] decrease council budget
*/
}

protected assertQueriedProposalsAreValid(qProposals: ProposalFieldsFragment[]): void {
Expand Down
19 changes: 17 additions & 2 deletions tests/network-tests/src/flows/proposals/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,27 @@ export default async function creatingProposals({ api, query, lock }: FlowProps)
},
{
details: createType('PalletProposalsCodexProposalDetails', {
DecreaseCouncilBudget: 100,
DecreaseCouncilBudget: 100, // 100 HAPI
}),
},
{
details: createType('PalletProposalsCodexProposalDetails', {
SetEraPayoutDampingFactor: 100,
SetEraPayoutDampingFactor: 95, // 95 %
}),
},
{
details: createType('PalletProposalsCodexProposalDetails', {
UpdateTokenPalletTokenConstraints: {
minSaleDuration: 10,
minRevenueSplitDuration: 10,
minRevenueSplitTimeToStart: 0,
maxYearlyRate: 15,
bloatBond: 0,
salePlatformFee: 10,
minAmmSlope: 100,
ammBuyTxFees: 1,
ammSellTxFees: 1,
},
}),
},
]
Expand Down
12 changes: 12 additions & 0 deletions tests/network-tests/src/graphql/queries/proposals.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,18 @@ fragment ProposalDetailsFields on ProposalDetails {
... on SetEraPayoutDampingFactorProposalDetails {
dampingFactor
}

... on UpdateTokenPalletTokenConstraintsProposalDetails {
maxYearlyRate
minAmmSlope
minSaleDuration
minRevenueSplitDuration
minRevenueSplitTimeToStart
salePlatformFee
ammBuyTxFees
ammSellTxFees
bloatBond
}
}

fragment ProposalFields on Proposal {
Expand Down

0 comments on commit 1cb93ad

Please sign in to comment.