|
1 | 1 | use super::*; |
2 | 2 |
|
3 | | -use crate::pb::v1::{NetworkEconomics, SelfDescribingValue as SelfDescribingValuePb, Topic}; |
| 3 | +use crate::{ |
| 4 | + governance::test_data::{CREATE_SERVICE_NERVOUS_SYSTEM, IMAGE_1, IMAGE_2}, |
| 5 | + pb::v1::{NetworkEconomics, SelfDescribingValue as SelfDescribingValuePb, Topic}, |
| 6 | +}; |
4 | 7 |
|
5 | 8 | use ic_base_types::PrincipalId; |
6 | 9 | use ic_nns_governance_api::SelfDescribingValue; |
@@ -168,6 +171,143 @@ fn test_network_economics_to_self_describing_minimal() { |
168 | 171 | ); |
169 | 172 | } |
170 | 173 |
|
| 174 | +#[test] |
| 175 | +fn test_create_service_nervous_system_to_self_describing() { |
| 176 | + use SelfDescribingValue::*; |
| 177 | + |
| 178 | + assert_proposal_action_self_describing_value_is( |
| 179 | + CREATE_SERVICE_NERVOUS_SYSTEM.clone(), |
| 180 | + Map(hashmap! { |
| 181 | + "name".to_string() => Text("Hello, world!".to_string()), |
| 182 | + "description".to_string() => Text("Best app that you ever did saw.".to_string()), |
| 183 | + "url".to_string() => Text("https://best.app".to_string()), |
| 184 | + "logo".to_string() => Map(hashmap! { |
| 185 | + "base64_encoding".to_string() => Text(IMAGE_1.to_string()), |
| 186 | + }), |
| 187 | + "fallback_controller_principal_ids".to_string() => Array(vec![ |
| 188 | + Text("iakpb-r4pky-cqaaa-aaaap-4ai".to_string()), |
| 189 | + ]), |
| 190 | + "dapp_canisters".to_string() => Array(vec![ |
| 191 | + Text("uc7f6-kaaaa-aaaaq-qaaaa-cai".to_string()), |
| 192 | + ]), |
| 193 | + "initial_token_distribution".to_string() => Map(hashmap! { |
| 194 | + "developer_distribution".to_string() => Map(hashmap! { |
| 195 | + "developer_neurons".to_string() => Array(vec![ |
| 196 | + Map(hashmap! { |
| 197 | + "controller".to_string() => Text("qarve-vpdvu-gaaaa-aaaap-4ai".to_string()), |
| 198 | + "dissolve_delay".to_string() => Map(hashmap! { |
| 199 | + "seconds".to_string() => Nat(candid::Nat::from(15_778_800_u64)), |
| 200 | + }), |
| 201 | + "memo".to_string() => Nat(candid::Nat::from(763535_u64)), |
| 202 | + "stake".to_string() => Map(hashmap! { |
| 203 | + "e8s".to_string() => Nat(candid::Nat::from(756575_u64)), |
| 204 | + }), |
| 205 | + "vesting_period".to_string() => Map(hashmap! { |
| 206 | + "seconds".to_string() => Nat(candid::Nat::from(0_u64)), |
| 207 | + }), |
| 208 | + }), |
| 209 | + ]), |
| 210 | + }), |
| 211 | + "treasury_distribution".to_string() => Map(hashmap! { |
| 212 | + "total".to_string() => Map(hashmap! { |
| 213 | + "e8s".to_string() => Nat(candid::Nat::from(307064_u64)), |
| 214 | + }), |
| 215 | + }), |
| 216 | + "swap_distribution".to_string() => Map(hashmap! { |
| 217 | + "total".to_string() => Map(hashmap! { |
| 218 | + "e8s".to_string() => Nat(candid::Nat::from(1_840_880_000_u64)), |
| 219 | + }), |
| 220 | + }), |
| 221 | + }), |
| 222 | + "ledger_parameters".to_string() => Map(hashmap! { |
| 223 | + "transaction_fee".to_string() => Map(hashmap! { |
| 224 | + "e8s".to_string() => Nat(candid::Nat::from(11143_u64)), |
| 225 | + }), |
| 226 | + "token_name".to_string() => Text("Most valuable SNS of all time.".to_string()), |
| 227 | + "token_symbol".to_string() => Text("Kanye".to_string()), |
| 228 | + "token_logo".to_string() => Map(hashmap! { |
| 229 | + "base64_encoding".to_string() => Text(IMAGE_2.to_string()), |
| 230 | + }), |
| 231 | + }), |
| 232 | + "governance_parameters".to_string() => Map(hashmap! { |
| 233 | + "proposal_rejection_fee".to_string() => Map(hashmap! { |
| 234 | + "e8s".to_string() => Nat(candid::Nat::from(372250_u64)), |
| 235 | + }), |
| 236 | + "proposal_initial_voting_period".to_string() => Map(hashmap! { |
| 237 | + "seconds".to_string() => Nat(candid::Nat::from(709_499_u64)), |
| 238 | + }), |
| 239 | + "proposal_wait_for_quiet_deadline_increase".to_string() => Map(hashmap! { |
| 240 | + "seconds".to_string() => Nat(candid::Nat::from(75_891_u64)), |
| 241 | + }), |
| 242 | + "neuron_minimum_stake".to_string() => Map(hashmap! { |
| 243 | + "e8s".to_string() => Nat(candid::Nat::from(250_000_u64)), |
| 244 | + }), |
| 245 | + "neuron_minimum_dissolve_delay_to_vote".to_string() => Map(hashmap! { |
| 246 | + "seconds".to_string() => Nat(candid::Nat::from(482538_u64)), |
| 247 | + }), |
| 248 | + "neuron_maximum_dissolve_delay".to_string() => Map(hashmap! { |
| 249 | + "seconds".to_string() => Nat(candid::Nat::from(31_557_600_u64)), |
| 250 | + }), |
| 251 | + "neuron_maximum_dissolve_delay_bonus".to_string() => Map(hashmap! { |
| 252 | + "basis_points".to_string() => Nat(candid::Nat::from(1800_u64)), |
| 253 | + }), |
| 254 | + "neuron_maximum_age_for_age_bonus".to_string() => Map(hashmap! { |
| 255 | + "seconds".to_string() => Nat(candid::Nat::from(740908_u64)), |
| 256 | + }), |
| 257 | + "neuron_maximum_age_bonus".to_string() => Map(hashmap! { |
| 258 | + "basis_points".to_string() => Nat(candid::Nat::from(5400_u64)), |
| 259 | + }), |
| 260 | + "voting_reward_parameters".to_string() => Map(hashmap! { |
| 261 | + "initial_reward_rate".to_string() => Map(hashmap! { |
| 262 | + "basis_points".to_string() => Nat(candid::Nat::from(2592_u64)), |
| 263 | + }), |
| 264 | + "final_reward_rate".to_string() => Map(hashmap! { |
| 265 | + "basis_points".to_string() => Nat(candid::Nat::from(740_u64)), |
| 266 | + }), |
| 267 | + "reward_rate_transition_duration".to_string() => Map(hashmap! { |
| 268 | + "seconds".to_string() => Nat(candid::Nat::from(378025_u64)), |
| 269 | + }), |
| 270 | + }), |
| 271 | + }), |
| 272 | + "swap_parameters".to_string() => Map(hashmap! { |
| 273 | + "minimum_participants".to_string() => Nat(candid::Nat::from(50_u64)), |
| 274 | + "minimum_icp".to_string() => Null, |
| 275 | + "maximum_icp".to_string() => Null, |
| 276 | + "minimum_direct_participation_icp".to_string() => Map(hashmap! { |
| 277 | + "e8s".to_string() => Nat(candid::Nat::from(6_200_000_000_u64)), |
| 278 | + }), |
| 279 | + "maximum_direct_participation_icp".to_string() => Map(hashmap! { |
| 280 | + "e8s".to_string() => Nat(candid::Nat::from(18_900_000_000_u64)), |
| 281 | + }), |
| 282 | + "minimum_participant_icp".to_string() => Map(hashmap! { |
| 283 | + "e8s".to_string() => Nat(candid::Nat::from(100_000_000_u64)), |
| 284 | + }), |
| 285 | + "maximum_participant_icp".to_string() => Map(hashmap! { |
| 286 | + "e8s".to_string() => Nat(candid::Nat::from(10_000_000_000_u64)), |
| 287 | + }), |
| 288 | + "neuron_basket_construction_parameters".to_string() => Map(hashmap! { |
| 289 | + "count".to_string() => Nat(candid::Nat::from(2_u64)), |
| 290 | + "dissolve_delay_interval".to_string() => Map(hashmap! { |
| 291 | + "seconds".to_string() => Nat(candid::Nat::from(10_001_u64)), |
| 292 | + }), |
| 293 | + }), |
| 294 | + "confirmation_text".to_string() => Text("Confirm you are a human".to_string()), |
| 295 | + "restricted_countries".to_string() => Map(hashmap! { |
| 296 | + "iso_codes".to_string() => Array(vec![Text("CH".to_string())]), |
| 297 | + }), |
| 298 | + "start_time".to_string() => Map(hashmap! { |
| 299 | + "seconds_after_utc_midnight".to_string() => Nat(candid::Nat::from(0_u64)), |
| 300 | + }), |
| 301 | + "duration".to_string() => Map(hashmap! { |
| 302 | + "seconds".to_string() => Nat(candid::Nat::from(604_800_u64)), |
| 303 | + }), |
| 304 | + "neurons_fund_investment_icp".to_string() => Null, |
| 305 | + "neurons_fund_participation".to_string() => Nat(candid::Nat::from(0_u8)), |
| 306 | + }), |
| 307 | + }), |
| 308 | + ); |
| 309 | +} |
| 310 | + |
171 | 311 | // Tests for the SelfDescribing derive macro |
172 | 312 |
|
173 | 313 | /// Test struct with named fields. |
|
0 commit comments