From 98961a9468478f59e4bb1d55bdd20ffac6fddf9b Mon Sep 17 00:00:00 2001 From: dankelleher Date: Tue, 26 Dec 2023 12:06:53 +0100 Subject: [PATCH] Quadratic Voting: Missing fields in the IDL --- .../src/instructions/create_registrar.rs | 2 +- src/quadraticVoter/quadratic.ts | 41 +++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/programs/quadratic/src/instructions/create_registrar.rs b/programs/quadratic/src/instructions/create_registrar.rs index 01271785..ee75c454 100644 --- a/programs/quadratic/src/instructions/create_registrar.rs +++ b/programs/quadratic/src/instructions/create_registrar.rs @@ -8,7 +8,7 @@ use spl_governance::state::realm; /// Creates a Plugin Registrar for spl-gov Realm /// This instruction should only be executed once per realm/governing_token_mint to create the account #[derive(Accounts)] -#[instruction(use_previous_voter_weight_plugin:bool)] +#[instruction(coefficients: QuadraticCoefficients, use_previous_voter_weight_plugin:bool)] pub struct CreateRegistrar<'info> { /// The quadratic Registrar /// There can only be a single registrar per governance Realm and governing mint of the Realm diff --git a/src/quadraticVoter/quadratic.ts b/src/quadraticVoter/quadratic.ts index 3bbde641..59ed7696 100644 --- a/src/quadraticVoter/quadratic.ts +++ b/src/quadraticVoter/quadratic.ts @@ -69,6 +69,12 @@ export const IDL: Idl = { } ], "args": [ + { + "name": "coefficients", + "type": { + "defined": "QuadraticCoefficients" + } + }, { "name": "usePreviousVoterWeightPlugin", "type": "bool" @@ -108,6 +114,12 @@ export const IDL: Idl = { } ], "args": [ + { + "name": "coefficients", + "type": { + "defined": "QuadraticCoefficients" + } + }, { "name": "usePreviousVoterWeightPlugin", "type": "bool" @@ -351,6 +363,15 @@ export const IDL: Idl = { "option": "publicKey" } }, + { + "name": "quadraticCoefficients", + "docs": [ + "A set of coefficients to be used when calculating the voter weight" + ], + "type": { + "defined": "QuadraticCoefficients" + } + }, { "name": "reserved", "docs": [ @@ -463,6 +484,26 @@ export const IDL: Idl = { } ], "types": [ + { + "name": "QuadraticCoefficients", + "type": { + "kind": "struct", + "fields": [ + { + "name": "a", + "type": "f64" + }, + { + "name": "b", + "type": "f64" + }, + { + "name": "c", + "type": "f64" + } + ] + } + }, { "name": "VoterWeightAction", "docs": [