diff --git a/.github/workflows/all_canisters_test_suite_on_any_push.yml b/.github/workflows/all_canisters_test_suite_on_any_push.yml
index c5ffd7ca..5e3e26da 100644
--- a/.github/workflows/all_canisters_test_suite_on_any_push.yml
+++ b/.github/workflows/all_canisters_test_suite_on_any_push.yml
@@ -49,19 +49,19 @@ jobs:
run: nix-shell --run "dfx stop"
- name: Build platform_orchestrator canister
run: |
- nix-shell --run "dfx build platform_orchestrator"
+ nix-shell --run "dfx build platform_orchestrator --ic"
gzip -f -1 ./target/wasm32-unknown-unknown/release/platform_orchestrator.wasm
- name: Build individual_user_template canister
run: |
- nix-shell --run "dfx build individual_user_template"
+ nix-shell --run "dfx build individual_user_template --ic"
gzip -f -1 ./target/wasm32-unknown-unknown/release/individual_user_template.wasm
- name: Build user_index canister
run: |
- nix-shell --run "dfx build user_index"
+ nix-shell --run "dfx build user_index --ic"
gzip -f -1 ./target/wasm32-unknown-unknown/release/user_index.wasm
- name: Build post_cache canister
run: |
- nix-shell --run "dfx build post_cache"
+ nix-shell --run "dfx build post_cache --ic"
gzip -f -1 ./target/wasm32-unknown-unknown/release/post_cache.wasm
- name: Run canister test suite
env:
diff --git a/Cargo.lock b/Cargo.lock
index 1bc875d8..d273df8d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -132,6 +132,12 @@ version = "1.0.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10f00e1f6e58a40e807377c75c6a7f97bf9044fab57816f2414e6f5f4499d7b8"
+[[package]]
+name = "arrayref"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb"
+
[[package]]
name = "arrayvec"
version = "0.5.2"
@@ -324,6 +330,19 @@ dependencies = [
"wyz",
]
+[[package]]
+name = "blake3"
+version = "1.5.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d82033247fd8e890df8f740e407ad4d038debb9eb1f40533fffb32e7d17dc6f7"
+dependencies = [
+ "arrayref",
+ "arrayvec 0.7.6",
+ "cc",
+ "cfg-if",
+ "constant_time_eq",
+]
+
[[package]]
name = "block-buffer"
version = "0.9.0"
@@ -437,6 +456,12 @@ version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64fa3c856b712db6612c019f14756e64e4bcea13337a6b33b696333a9eaa2d06"
+[[package]]
+name = "byte-slice-cast"
+version = "1.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c"
+
[[package]]
name = "byte-unit"
version = "4.0.19"
@@ -753,6 +778,12 @@ version = "0.9.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8"
+[[package]]
+name = "constant_time_eq"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6"
+
[[package]]
name = "convert_case"
version = "0.4.0"
@@ -1204,6 +1235,12 @@ dependencies = [
"signature",
]
+[[package]]
+name = "ed25519-compact"
+version = "2.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e9b3460f44bea8cd47f45a0c70892f1eff856d97cd55358b2f73f663789f6190"
+
[[package]]
name = "ed25519-consensus"
version = "2.1.0"
@@ -1593,6 +1630,21 @@ dependencies = [
"crunchy",
]
+[[package]]
+name = "hash-db"
+version = "0.16.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e7d7786361d7425ae2fe4f9e407eb0efaa0840f5212d109cc018c40c35c6ab4"
+
+[[package]]
+name = "hash256-std-hasher"
+version = "0.15.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "92c171d55b98633f4ed3860808f004099b36c1cc29c42cfc53aa8591b21efcf2"
+dependencies = [
+ "crunchy",
+]
+
[[package]]
name = "hashbrown"
version = "0.12.3"
@@ -3375,6 +3427,17 @@ dependencies = [
"unicode-normalization",
]
+[[package]]
+name = "impl-trait-for-tuples"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+]
+
[[package]]
name = "indexmap"
version = "1.9.3"
@@ -3556,9 +3619,9 @@ dependencies = [
[[package]]
name = "k256"
-version = "0.13.3"
+version = "0.13.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b"
+checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b"
dependencies = [
"cfg-if",
"ecdsa",
@@ -3711,6 +3774,15 @@ dependencies = [
"libc",
]
+[[package]]
+name = "memory-db"
+version = "0.32.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "808b50db46293432a45e63bc15ea51e0ab4c0a1647b8eb114e31a3e698dd6fbe"
+dependencies = [
+ "hash-db",
+]
+
[[package]]
name = "merlin"
version = "3.0.0"
@@ -3729,6 +3801,16 @@ version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
+[[package]]
+name = "mime_guess"
+version = "2.0.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e"
+dependencies = [
+ "mime",
+ "unicase",
+]
+
[[package]]
name = "minimal-lexical"
version = "0.2.1"
@@ -3974,6 +4056,17 @@ dependencies = [
"group 0.12.1",
]
+[[package]]
+name = "parity-scale-codec"
+version = "3.6.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "306800abfa29c7f16596b5970a588435e3d5b3149683d00c12b699cc19f895ee"
+dependencies = [
+ "arrayvec 0.7.6",
+ "byte-slice-cast",
+ "impl-trait-for-tuples",
+]
+
[[package]]
name = "parking_lot"
version = "0.12.3"
@@ -4156,11 +4249,10 @@ dependencies = [
[[package]]
name = "pocket-ic"
-version = "3.1.0"
+version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f9765eeff77b8750cf6258eaeea237b96607cd770aa3d4003f021924192b7e4e"
+checksum = "beff607d4dbebff8d003453ced669d2645e905de496ca93713f3d47633357e6c"
dependencies = [
- "async-trait",
"base64 0.13.1",
"candid",
"hex",
@@ -4170,6 +4262,9 @@ dependencies = [
"serde",
"serde_bytes",
"serde_json",
+ "sha2 0.10.8",
+ "slog",
+ "tokio",
"tracing",
"tracing-appender",
"tracing-subscriber",
@@ -4662,6 +4757,7 @@ dependencies = [
"js-sys",
"log",
"mime",
+ "mime_guess",
"once_cell",
"percent-encoding",
"pin-project-lite",
@@ -5216,19 +5312,27 @@ dependencies = [
name = "shared_utils"
version = "0.1.0"
dependencies = [
+ "blake3",
"candid",
"ciborium",
+ "ed25519-compact",
"futures",
+ "hash-db",
+ "hash256-std-hasher",
"ic-cdk 0.15.1",
"ic-cdk-timers",
"ic-stable-structures",
"icrc-ledger-types 0.1.6",
+ "memory-db",
+ "parity-scale-codec",
"pprof",
"rmp-serde",
"serde",
"serde_bytes",
"serde_json_any_key",
"test_utils",
+ "trie-db",
+ "trie-root",
]
[[package]]
@@ -5237,6 +5341,15 @@ version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
+[[package]]
+name = "signal-hook-registry"
+version = "1.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1"
+dependencies = [
+ "libc",
+]
+
[[package]]
name = "signature"
version = "2.2.0"
@@ -5617,11 +5730,25 @@ dependencies = [
"bytes",
"libc",
"mio",
+ "parking_lot",
"pin-project-lite",
+ "signal-hook-registry",
"socket2",
+ "tokio-macros",
"windows-sys 0.52.0",
]
+[[package]]
+name = "tokio-macros"
+version = "2.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.77",
+]
+
[[package]]
name = "tokio-rustls"
version = "0.26.0"
@@ -5788,6 +5915,26 @@ dependencies = [
"tracing-serde",
]
+[[package]]
+name = "trie-db"
+version = "0.29.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0c992b4f40c234a074d48a757efeabb1a6be88af84c0c23f7ca158950cb0ae7f"
+dependencies = [
+ "hash-db",
+ "log",
+ "smallvec",
+]
+
+[[package]]
+name = "trie-root"
+version = "0.18.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d4ed310ef5ab98f5fa467900ed906cb9232dd5376597e00fd4cba2a449d06c0b"
+dependencies = [
+ "hash-db",
+]
+
[[package]]
name = "try-lock"
version = "0.2.5"
@@ -5812,6 +5959,15 @@ version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9"
+[[package]]
+name = "unicase"
+version = "2.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89"
+dependencies = [
+ "version_check",
+]
+
[[package]]
name = "unicode-bidi"
version = "0.3.15"
@@ -5826,9 +5982,9 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
name = "unicode-normalization"
-version = "0.1.23"
+version = "0.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5"
+checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921"
dependencies = [
"tinyvec",
]
diff --git a/Cargo.toml b/Cargo.toml
index 7155d2fc..9f290772 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,7 +14,7 @@ members = [
[workspace.dependencies]
candid = "0.10.2"
ciborium = "0.2.1"
-pocket-ic = "3.0.0"
+pocket-ic = "5.0.0"
ic-cdk = "0.15.1"
ic-cdk-timers = "0.7.0"
ic-cdk-macros = "0.16.0"
diff --git a/default.nix b/default.nix
index ac65b3a9..100542d4 100644
--- a/default.nix
+++ b/default.nix
@@ -3,7 +3,7 @@ let
rev = "1c3a28d84f970e7774af04372ade06399add182e";
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz";
pkgs = import nixpkgs { };
- dfx-env = import (builtins.fetchTarball "https://github.com/ninegua/ic-nix/releases/download/20240610/dfx-env.tar.gz") { version = "20240610"; inherit pkgs; };
+ dfx-env = import (builtins.fetchTarball "https://github.com/ninegua/ic-nix/releases/download/20240924/dfx-env.tar.gz") { version = "20240924"; inherit pkgs; };
in
dfx-env.overrideAttrs (old: {
nativeBuildInputs = with pkgs; old.nativeBuildInputs ++
diff --git a/pocket-ic b/pocket-ic
index 2e723978..84f59e98 100755
Binary files a/pocket-ic and b/pocket-ic differ
diff --git a/scripts/canisters/local_deploy/create_pool_of_individual_canister_user_index.sh b/scripts/canisters/local_deploy/create_pool_of_individual_canister_user_index.sh
index 04ddfc79..86caf938 100755
--- a/scripts/canisters/local_deploy/create_pool_of_individual_canister_user_index.sh
+++ b/scripts/canisters/local_deploy/create_pool_of_individual_canister_user_index.sh
@@ -12,5 +12,5 @@ char_escaped=$(printf "%s" "$char" | sed 's/../\\&/g')
# Create a shell script with the escaped hexadecimal string
printf "(\"v1.0.0\", blob \"%s\")" "$char_escaped" > argument
-dfx canister call user_index create_pool_of_individual_user_available_canisters --argument-file argument
dfx ledger fabricate-cycles --cycles 20000000000000000 --canister user_index
+dfx canister call user_index create_pool_of_individual_user_available_canisters --argument-file argument
diff --git a/scripts/canisters/local_deploy/install_all_canisters.sh b/scripts/canisters/local_deploy/install_all_canisters.sh
index 08ce0447..db0069d7 100755
--- a/scripts/canisters/local_deploy/install_all_canisters.sh
+++ b/scripts/canisters/local_deploy/install_all_canisters.sh
@@ -27,17 +27,8 @@ dfx canister create --no-wallet post_cache
dfx canister create --no-wallet user_index
dfx canister create --no-wallet platform_orchestrator
-gzip_canister() {
- gzip -f -1 ./target/wasm32-unknown-unknown/release/$1.wasm
-}
-
scripts/candid_generator.sh
-gzip_canister individual_user_template
-gzip_canister user_index
-gzip_canister post_cache
-gzip_canister platform_orchestrator
-
if [[ $skip_test != true ]]
then
cargo test
@@ -90,6 +81,9 @@ dfx canister install user_index --argument "(record {
vec { variant { CanisterAdmin }; variant { CanisterController }; }
};
};
+ proof_of_participation = opt record {
+ chain = vec {};
+ };
version= \"v1.0.0\"
})"
diff --git a/src/canister/individual_user_template/Cargo.toml b/src/canister/individual_user_template/Cargo.toml
index 8f324188..f3be9a3c 100644
--- a/src/canister/individual_user_template/Cargo.toml
+++ b/src/canister/individual_user_template/Cargo.toml
@@ -35,3 +35,4 @@ hex = "0.4.3"
[dev-dependencies]
test_utils = { workspace = true }
+
diff --git a/src/canister/individual_user_template/can.did b/src/canister/individual_user_template/can.did
index c15e507d..36259049 100644
--- a/src/canister/individual_user_template/can.did
+++ b/src/canister/individual_user_template/can.did
@@ -4,6 +4,10 @@ type AggregateStats = record {
total_number_of_hot_bets : nat64;
};
type AirdropDistribution = record { airdrop_neurons : vec NeuronDistribution };
+type AirdropMember = record {
+ user_principal : principal;
+ user_canister : principal;
+};
type BetDetails = record {
bet_direction : BetDirection;
bet_maker_canister_id : principal;
@@ -155,6 +159,7 @@ type IdealMatchedParticipationFunction = record {
serialized_representation : opt text;
};
type IndividualUserTemplateInitArgs = record {
+ proof_of_participation : opt ProofOfParticipation;
known_principal_ids : opt vec record { KnownPrincipalType; principal };
version : text;
url_to_send_canister_metrics_to : opt text;
@@ -337,6 +342,13 @@ type PostViewStatistics = record {
average_watch_percentage : nat8;
threshold_view_count : nat64;
};
+type ProofOfChild = record {
+ proof_of_inclusion : vec blob;
+ "principal" : principal;
+ children_proof : ProofOfChildren;
+};
+type ProofOfChildren = record { signature : blob; merkle_root : blob };
+type ProofOfParticipation = record { chain : vec ProofOfChild };
type RejectionCode = variant {
NoError;
CanisterError;
@@ -348,44 +360,43 @@ type RejectionCode = variant {
};
type Result = variant { Ok : bool; Err : text };
type Result_1 = variant { Ok : nat64; Err : text };
-type Result_10 = variant { Ok : Post; Err };
-type Result_11 = variant { Ok : SystemTime; Err : text };
-type Result_12 = variant {
+type Result_10 = variant { Ok : BetDetails; Err : text };
+type Result_11 = variant { Ok : Post; Err };
+type Result_12 = variant { Ok : SystemTime; Err : text };
+type Result_13 = variant {
Ok : vec PostDetailsForFrontend;
Err : GetPostsOfUserProfileError;
};
-type Result_13 = variant { Ok : SessionType; Err : text };
-type Result_14 = variant { Ok : vec SuccessHistoryItemV1; Err : text };
-type Result_15 = variant { Ok : vec principal; Err : PaginationError };
-type Result_16 = variant {
+type Result_14 = variant { Ok : SessionType; Err : text };
+type Result_15 = variant { Ok : vec SuccessHistoryItemV1; Err : text };
+type Result_16 = variant { Ok : vec principal; Err : PaginationError };
+type Result_17 = variant {
Ok : vec record { nat64; TokenEvent };
Err : PaginationError;
};
-type Result_17 = variant { Ok : vec WatchHistoryItem; Err : text };
-type Result_18 = variant { Ok : vec text; Err : NamespaceErrors };
-type Result_19 = variant { Ok : vec record { nat64; nat8 }; Err : text };
+type Result_18 = variant { Ok : vec WatchHistoryItem; Err : text };
+type Result_19 = variant { Ok : vec text; Err : NamespaceErrors };
type Result_2 = variant { Ok : bool; Err : CdaoTokenError };
-type Result_20 = variant { Ok; Err : MigrationErrors };
-type Result_21 = variant { Committed : Committed; Aborted : record {} };
-type Result_22 = variant { Ok : Ok; Err : GovernanceError };
-type Result_23 = variant { Ok; Err : CdaoTokenError };
+type Result_20 = variant { Ok : vec record { nat64; nat8 }; Err : text };
+type Result_21 = variant { Ok; Err : MigrationErrors };
+type Result_22 = variant { Committed : Committed; Aborted : record {} };
+type Result_23 = variant { Ok : Ok; Err : GovernanceError };
type Result_24 = variant { Ok : text; Err : text };
type Result_25 = variant {
Ok : UserProfileDetailsForFrontend;
Err : UpdateProfileDetailsError;
};
-type Result_26 = variant { Ok; Err : text };
-type Result_27 = variant { Ok; Err : UpdateProfileSetUniqueUsernameError };
-type Result_3 = variant {
+type Result_26 = variant { Ok; Err : UpdateProfileSetUniqueUsernameError };
+type Result_3 = variant { Ok; Err : text };
+type Result_4 = variant {
Ok : BettingStatus;
Err : BetOnCurrentlyViewingPostError;
};
-type Result_4 = variant { Ok : NamespaceForFrontend; Err : NamespaceErrors };
-type Result_5 = variant { Ok : opt text; Err : NamespaceErrors };
-type Result_6 = variant { Ok; Err : NamespaceErrors };
-type Result_7 = variant { Ok : DeployedCdaoCanisters; Err : CdaoDeployError };
-type Result_8 = variant { Ok : bool; Err : FollowAnotherUserProfileError };
-type Result_9 = variant { Ok : BetDetails; Err : text };
+type Result_5 = variant { Ok : NamespaceForFrontend; Err : NamespaceErrors };
+type Result_6 = variant { Ok : opt text; Err : NamespaceErrors };
+type Result_7 = variant { Ok; Err : NamespaceErrors };
+type Result_8 = variant { Ok : DeployedCdaoCanisters; Err : CdaoDeployError };
+type Result_9 = variant { Ok : bool; Err : FollowAnotherUserProfileError };
type RoomBetPossibleOutcomes = variant { HotWon; BetOngoing; Draw; NotWon };
type RoomDetails = record {
total_hot_bets : nat64;
@@ -396,10 +407,10 @@ type RoomDetails = record {
};
type SessionType = variant { AnonymousSession; RegisteredSession };
type SettleNeuronsFundParticipationRequest = record {
- result : opt Result_21;
+ result : opt Result_22;
nns_proposal_id : opt nat64;
};
-type SettleNeuronsFundParticipationResponse = record { result : opt Result_22 };
+type SettleNeuronsFundParticipationResponse = record { result : opt Result_23 };
type SlotDetails = record { room_details : vec record { nat64; RoomDetails } };
type SnsInitPayload = record {
url : opt text;
@@ -548,21 +559,30 @@ service : (IndividualUserTemplateInitArgs) -> {
add_device_id : (text) -> (Result);
add_post_v2 : (PostDetailsFromFrontend) -> (Result_1);
add_token : (principal) -> (Result_2);
- bet_on_currently_viewing_post : (PlaceBetArg) -> (Result_3);
+ add_tokens : (vec principal) -> (vec Result_2);
+ add_user_to_airdrop_chain : (ProofOfParticipation, AirdropMember) -> (
+ Result_3,
+ );
+ bet_on_currently_viewing_post : (PlaceBetArg) -> (Result_4);
check_and_update_scores_and_share_with_post_cache_if_difference_beyond_threshold : (
vec nat64,
) -> ();
clear_snapshot : () -> ();
- create_a_namespace : (text) -> (Result_4);
- delete_key_value_pair : (nat64, text) -> (Result_5);
- delete_multiple_key_value_pairs : (nat64, vec text) -> (Result_6);
- deploy_cdao_sns : (SnsInitPayload, nat64) -> (Result_7);
+ create_a_namespace : (text) -> (Result_5);
+ delete_key_value_pair : (nat64, text) -> (Result_6);
+ delete_multiple_key_value_pairs : (nat64, vec text) -> (Result_7);
+ deploy_cdao_sns : (SnsInitPayload, nat64) -> (Result_8);
deployed_cdao_canisters : () -> (vec DeployedCdaoCanisters) query;
- do_i_follow_this_user : (FolloweeArg) -> (Result_8) query;
+ distribute_newly_created_token_to_token_chain : (DeployedCdaoCanisters) -> (
+ Result_3,
+ );
+ do_i_follow_this_user : (FolloweeArg) -> (Result_9) query;
download_snapshot : (nat64, nat64) -> (blob) query;
- get_bet_details_for_a_user_on_a_post : (principal, nat64) -> (Result_9) query;
+ get_bet_details_for_a_user_on_a_post : (principal, nat64) -> (
+ Result_10,
+ ) query;
get_device_identities : () -> (vec DeviceIdentity) query;
- get_entire_individual_post_detail_by_id : (nat64) -> (Result_10) query;
+ get_entire_individual_post_detail_by_id : (nat64) -> (Result_11) query;
get_hot_or_not_bet_details_for_this_post : (nat64) -> (BettingStatus) query;
get_hot_or_not_bets_placed_by_this_profile_with_pagination : (nat64) -> (
vec PlacedBetDetail,
@@ -571,14 +591,14 @@ service : (IndividualUserTemplateInitArgs) -> {
opt PlacedBetDetail,
) query;
get_individual_post_details_by_id : (nat64) -> (PostDetailsForFrontend) query;
- get_last_access_time : () -> (Result_11) query;
- get_last_canister_functionality_access_time : () -> (Result_11) query;
+ get_last_access_time : () -> (Result_12) query;
+ get_last_canister_functionality_access_time : () -> (Result_12) query;
get_ml_feed_cache_paginated : (nat64, nat64) -> (vec MLFeedCacheItem) query;
get_posts_of_this_user_profile_with_pagination : (nat64, nat64) -> (
- Result_12,
+ Result_13,
) query;
get_posts_of_this_user_profile_with_pagination_cursor : (nat64, nat64) -> (
- Result_12,
+ Result_13,
) query;
get_principals_that_follow_this_profile_paginated : (opt nat64) -> (
vec record { nat64; FollowEntryDetail },
@@ -590,43 +610,45 @@ service : (IndividualUserTemplateInitArgs) -> {
get_profile_details_v2 : () -> (UserProfileDetailsForFrontendV2) query;
get_rewarded_for_referral : (principal, principal) -> ();
get_rewarded_for_signing_up : () -> ();
- get_session_type : () -> (Result_13) query;
+ get_session_type : () -> (Result_14) query;
get_stable_memory_size : () -> (nat64) query;
- get_success_history : () -> (Result_14) query;
+ get_success_history : () -> (Result_15) query;
get_token_roots_of_this_user_with_pagination_cursor : (nat64, nat64) -> (
- Result_15,
+ Result_16,
) query;
get_user_caniser_cycle_balance : () -> (nat) query;
get_user_utility_token_transaction_history_with_pagination : (
nat64,
nat64,
- ) -> (Result_16) query;
+ ) -> (Result_17) query;
get_utility_token_balance : () -> (nat64) query;
get_version : () -> (text) query;
get_version_number : () -> (nat64) query;
- get_watch_history : () -> (Result_17) query;
+ get_watch_history : () -> (Result_18) query;
get_well_known_principal_value : (KnownPrincipalType) -> (
opt principal,
) query;
http_request : (HttpRequest) -> (HttpResponse) query;
- list_namespace_keys : (nat64) -> (Result_18) query;
+ list_namespace_keys : (nat64) -> (Result_19) query;
list_namespaces : (nat64, nat64) -> (vec NamespaceForFrontend) query;
load_snapshot : (nat64) -> ();
- once_reenqueue_timers_for_pending_bet_outcomes : () -> (Result_19);
- read_key_value_pair : (nat64, text) -> (Result_5) query;
+ once_reenqueue_timers_for_pending_bet_outcomes : () -> (Result_20);
+ parent_airdrop_chain : () -> (vec AirdropMember) query;
+ read_key_value_pair : (nat64, text) -> (Result_6) query;
receive_and_save_snaphot : (nat64, blob) -> ();
- receive_bet_from_bet_makers_canister : (PlaceBetArg, principal) -> (Result_3);
+ receive_bet_from_bet_makers_canister : (PlaceBetArg, principal) -> (Result_4);
receive_bet_winnings_when_distributed : (nat64, BetOutcomeForBetMaker) -> ();
- receive_data_from_hotornot : (principal, nat64, vec Post) -> (Result_20);
+ receive_data_from_hotornot : (principal, nat64, vec Post) -> (Result_21);
+ receive_reward_for_being_referred : () -> (Result_3);
+ receive_reward_for_referring : (ProofOfParticipation, principal) -> (
+ Result_3,
+ );
return_cycles_to_user_index_canister : (opt nat) -> ();
save_snapshot_json : () -> (nat32);
settle_neurons_fund_participation : (
SettleNeuronsFundParticipationRequest,
) -> (SettleNeuronsFundParticipationResponse);
- transfer_token_to_user_canister : (principal, principal, opt blob, nat) -> (
- Result_23,
- );
- transfer_tokens_and_posts : (principal, principal) -> (Result_20);
+ transfer_tokens_and_posts : (principal, principal) -> (Result_21);
update_last_access_time : () -> (Result_24);
update_last_canister_functionality_access_time : () -> ();
update_ml_feed_cache : (vec MLFeedCacheItem) -> (Result_24);
@@ -638,21 +660,21 @@ service : (IndividualUserTemplateInitArgs) -> {
update_profile_display_details : (UserProfileUpdateDetailsFromFrontend) -> (
Result_25,
);
- update_profile_owner : (opt principal) -> (Result_26);
- update_profile_set_unique_username_once : (text) -> (Result_27);
+ update_profile_owner : (opt principal) -> (Result_3);
+ update_profile_set_unique_username_once : (text) -> (Result_26);
update_profiles_i_follow_toggle_list_with_specified_profile : (
FolloweeArg,
- ) -> (Result_8);
+ ) -> (Result_9);
update_profiles_that_follow_me_toggle_list_with_specified_profile : (
FollowerArg,
- ) -> (Result_8);
+ ) -> (Result_9);
update_referrer_details : (UserCanisterDetails) -> (Result_24);
update_session_type : (SessionType) -> (Result_24);
update_success_history : (SuccessHistoryItemV1) -> (Result_24);
update_watch_history : (WatchHistoryItem) -> (Result_24);
update_well_known_principal : (KnownPrincipalType, principal) -> ();
- write_key_value_pair : (nat64, text, text) -> (Result_5);
+ write_key_value_pair : (nat64, text, text) -> (Result_6);
write_multiple_key_value_pairs : (nat64, vec record { text; text }) -> (
- Result_6,
+ Result_7,
);
}
diff --git a/src/canister/individual_user_template/src/api/airdrop/mod.rs b/src/canister/individual_user_template/src/api/airdrop/mod.rs
new file mode 100644
index 00000000..291c72b0
--- /dev/null
+++ b/src/canister/individual_user_template/src/api/airdrop/mod.rs
@@ -0,0 +1,108 @@
+use candid::{Nat, Principal};
+use futures::{future, stream::FuturesUnordered, StreamExt};
+use ic_cdk::{update, query};
+use icrc_ledger_types::icrc1::{account::Account, transfer::{TransferArg, TransferError}};
+use shared_utils::{canister_specific::individual_user_template::types::{airdrop::AirdropMember, cdao::DeployedCdaoCanisters}, common::participant_crypto::ProofOfParticipation};
+
+use crate::CANISTER_DATA;
+
+#[update]
+pub async fn add_user_to_airdrop_chain(pop: ProofOfParticipation, member: AirdropMember) -> Result<(), String> {
+ pop.verify_caller_is_participant(&CANISTER_DATA).await?;
+ add_user_to_airdrop_chain_inner(member).await;
+
+ Ok(())
+}
+
+
+/// Returns the token amount to transfer for airdrop
+/// returns None if not enough tokens are available
+/// returns Ok(Some(Nat)) if enough tokens are available, where Nat is the amount to transfer
+pub(crate) async fn is_balance_enough_for_airdrop(ledger: Principal, transfer_cnt: usize) -> Result