From 3ba2211ef2308fc7e72cd9a607bb41955e11783c Mon Sep 17 00:00:00 2001 From: momodaka <463435681@qq.com> Date: Mon, 5 Aug 2024 21:56:49 +0800 Subject: [PATCH] docs: fix merkle tree contracts typo issues (#4169) --- contrib-contracts/modules/MerkleDistributor.move | 10 +++++----- contrib-contracts/src/merkle_distributor_test.rs | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/contrib-contracts/modules/MerkleDistributor.move b/contrib-contracts/modules/MerkleDistributor.move index 8621c6b069..1c609b67f1 100644 --- a/contrib-contracts/modules/MerkleDistributor.move +++ b/contrib-contracts/modules/MerkleDistributor.move @@ -2,9 +2,9 @@ address StarcoinAssociation { module MerkleDistributorScripts { use StarcoinAssociation::MerkleDistributor; use StarcoinFramework::Account; - public(script) fun create(signer: signer, merkle_root: vector, token_amounts: u128, leafs: u64) { + public(script) fun create(signer: signer, merkle_root: vector, token_amounts: u128, leaves: u64) { let tokens = Account::withdraw(&signer, token_amounts); - MerkleDistributor::create(&signer, merkle_root, tokens, leafs); + MerkleDistributor::create(&signer, merkle_root, tokens, leaves); } public(script) fun claim_for_address(distribution_address: address, index: u64, account: address, amount: u128, merkle_proof: vector>) { @@ -72,9 +72,9 @@ module MerkleDistributor { const ALREADY_CLAIMED: u64 = 2; /// Initialization. - public fun create(signer: &signer, merkle_root: vector, tokens: Token, leafs: u64) { - let bitmap_count = leafs / 128; - if (bitmap_count * 128 < leafs) { + public fun create(signer: &signer, merkle_root: vector, tokens: Token, leaves: u64) { + let bitmap_count = leaves / 128; + if (bitmap_count * 128 < leaves) { bitmap_count = bitmap_count + 1; }; let claimed_bitmap = Vector::empty(); diff --git a/contrib-contracts/src/merkle_distributor_test.rs b/contrib-contracts/src/merkle_distributor_test.rs index 60dd3a2920..e3f842e4a4 100644 --- a/contrib-contracts/src/merkle_distributor_test.rs +++ b/contrib-contracts/src/merkle_distributor_test.rs @@ -52,7 +52,7 @@ fn test_merkle_distributor() -> Result<()> { let merkle_root = MoveValue::vector_u8(raw_root); let rewards_total = MoveValue::U128(proofs.iter().map(|p| p.amount).sum()); - let leafs = MoveValue::U64(proofs.len() as u64); + let leaves = MoveValue::U64(proofs.len() as u64); let script_function = ScriptFunction::new( ModuleId::new( @@ -64,7 +64,7 @@ fn test_merkle_distributor() -> Result<()> { vec![ merkle_root.simple_serialize().unwrap(), rewards_total.simple_serialize().unwrap(), - leafs.simple_serialize().unwrap(), + leaves.simple_serialize().unwrap(), ], );