Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions dfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@
"type": "custom",
"candid": "src/airdrop/airdrop.did",
"wasm": "src/airdrop/airdrop.wasm"
},
"neuron_controller": {
"type": "custom",
"candid": "src/neuron_controller/neuron_controller.did",
"wasm": "src/neuron_controller/neuron_controller.wasm.gz"
}
},
"defaults": {
Expand Down
9 changes: 9 additions & 0 deletions scripts/sns/neuron_controller/dissolve_delay_params.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

set -euo pipefail

NEURON_ID=${1:-}
DELAY_SECONDS=${2:-}
MANAGE_CMD="(record {command = variant {Configure=record {operation = opt variant {IncreaseDissolveDelay = record { additional_dissolve_delay_seconds = $DELAY_SECONDS:nat32 }}}}; neuron_id = ${NEURON_ID}:nat64;})"

echo "${MANAGE_CMD}"
472 changes: 472 additions & 0 deletions scripts/sns/neuron_controller/sns_init.yaml

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions scripts/sns/neuron_controller/start_dissolve_params.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

set -euo pipefail

export NEURON_ID=${1}
export MANAGE_CMD="(record {command = variant {Configure = record { operation = opt variant { StartDissolving = record {}} }}; neuron_id = ${NEURON_ID}:nat64;})"

echo "${MANAGE_CMD}"
1 change: 1 addition & 0 deletions scripts/sns/sns_config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ exports.canisterCommands = [
"dfx canister id rs",
"dfx canister id vesting",
"dfx canister id modclub_assets",
"dfx canister id neuron_controller",
];
99 changes: 99 additions & 0 deletions src/neuron_controller/neuron_controller.did
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
type AccountIdentifier = record { hash : vec nat8 };
type AddHotKey = record { new_hot_key : opt principal };
type Amount = record { e8s : nat64 };
type By = variant {
NeuronIdOrSubaccount : record {};
MemoAndController : ClaimOrRefreshNeuronFromAccount;
Memo : nat64;
};
type ChangeAutoStakeMaturity = record {
requested_setting_for_auto_stake_maturity : bool;
};
type ClaimOrRefresh = record { by : opt By };
type ClaimOrRefreshNeuronFromAccount = record {
controller : opt principal;
memo : nat64;
};
type Command = variant {
Spawn : Spawn;
Split : Split;
Follow : Follow;
ClaimOrRefresh : ClaimOrRefresh;
Configure : Configure;
RegisterVote : RegisterVote;
Merge : Merge;
DisburseToNeuron : DisburseToNeuron;
StakeMaturity : StakeMaturity;
MergeMaturity : MergeMaturity;
Disburse : Disburse;
};
type Configure = record { operation : opt Operation };
type Disburse = record {
to_account : opt AccountIdentifier;
amount : opt Amount;
};
type DisburseToNeuron = record {
dissolve_delay_seconds : nat64;
kyc_verified : bool;
amount_e8s : nat64;
new_controller : opt principal;
nonce : nat64;
};
type Follow = record { topic : int32; followees : vec NeuronId };
type IncreaseDissolveDelay = record {
additional_dissolve_delay_seconds : nat32;
};
type ManageNeuron = record {
id : opt NeuronId;
command : opt Command;
neuron_id_or_subaccount : opt NeuronIdOrSubaccount;
};
type Merge = record { source_neuron_id : opt NeuronId };
type MergeMaturity = record { percentage_to_merge : nat32 };
type NeuronId = record { id : nat64 };
type NeuronIdOrSubaccount = variant {
Subaccount : vec nat8;
NeuronId : NeuronId;
};
type Operation = variant {
RemoveHotKey : RemoveHotKey;
AddHotKey : AddHotKey;
ChangeAutoStakeMaturity : ChangeAutoStakeMaturity;
StopDissolving : record {};
StartDissolving : record {};
IncreaseDissolveDelay : IncreaseDissolveDelay;
JoinCommunityFund : record {};
LeaveCommunityFund : record {};
SetDissolveTimestamp : SetDissolveTimestamp;
};
type RegisterVote = record { vote : int32; proposal : opt NeuronId };
type RemoveHotKey = record { hot_key_to_remove : opt principal };
type SetDissolveTimestamp = record { dissolve_timestamp_seconds : nat64 };
type Spawn = record {
percentage_to_spawn : opt nat32;
new_controller : opt principal;
nonce : opt nat64;
};
type Split = record { amount_e8s : nat64 };
type StakeMaturity = record { percentage_to_stake : opt nat32 };

type ManageNnsNeuronArgs = record {
neuron_id : nat64;
command : Command;
};

type ManageNnsNeuronResponse = variant {
Success: text;
InternalError : text;
};

type StakeNnsNeuronResponse = variant {
Success : nat64;
InternalError : text;
};

service : {
manage_nns_neuron : (ManageNnsNeuronArgs) -> (ManageNnsNeuronResponse);
get_neuron : (NeuronId) -> (ManageNnsNeuronResponse);
stake_nns_neuron : () -> (StakeNnsNeuronResponse);
}
Binary file added src/neuron_controller/neuron_controller.wasm.gz
Binary file not shown.