Skip to content

Commit

Permalink
update to scarb 2.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
moodysalem committed Dec 3, 2024
1 parent 16eaf80 commit 6b5202b
Show file tree
Hide file tree
Showing 15 changed files with 270 additions and 268 deletions.
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
scarb 2.8.5
scarb 2.9.1
14 changes: 7 additions & 7 deletions src/airdrop.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub trait IAirdrop<TContractState> {
// proof verification is optimized in this method.
// Returns the number of claims that were executed.
fn claim_128(
ref self: TContractState, claims: Span<Claim>, remaining_proof: Span<felt252>
ref self: TContractState, claims: Span<Claim>, remaining_proof: Span<felt252>,
) -> u8;

// Returns whether the claim with the given ID has been claimed.
Expand All @@ -60,12 +60,12 @@ pub mod Airdrop {
use governance::interfaces::erc20::{IERC20DispatcherTrait};
use governance::utils::exp2::{exp2};
use starknet::storage::{
Map, StorageMapReadAccess, StorageMapWriteAccess, StoragePointerWriteAccess,
StoragePointerReadAccess
Map, StorageMapReadAccess, StorageMapWriteAccess, StoragePointerReadAccess,
StoragePointerWriteAccess,
};
use starknet::{get_block_timestamp, get_contract_address};

use super::{Config, IAirdrop, ContractAddress, Claim, IERC20Dispatcher};
use super::{Claim, Config, ContractAddress, IAirdrop, IERC20Dispatcher};

pub fn hash_function(a: felt252, b: felt252) -> felt252 {
let a_u256: u256 = a.into();
Expand Down Expand Up @@ -96,7 +96,7 @@ pub mod Airdrop {

#[derive(Drop, starknet::Event)]
pub(crate) struct Claimed {
pub claim: Claim
pub claim: Claim,
}

#[derive(starknet::Event, Drop)]
Expand Down Expand Up @@ -187,7 +187,7 @@ pub mod Airdrop {
}

fn claim_128(
ref self: ContractState, mut claims: Span<Claim>, remaining_proof: Span<felt252>
ref self: ContractState, mut claims: Span<Claim>, remaining_proof: Span<felt252>,
) -> u8 {
assert(claims.len() < 129, 'TOO_MANY_CLAIMS');
assert(!claims.is_empty(), 'CLAIMS_EMPTY');
Expand All @@ -204,7 +204,7 @@ pub mod Airdrop {

assert(
config.root == compute_pedersen_root(root_of_group, remaining_proof),
'INVALID_PROOF'
'INVALID_PROOF',
);

let mut bitmap = self.claimed_bitmap.read(word);
Expand Down
6 changes: 3 additions & 3 deletions src/airdrop_claim_check.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ trait IAirdropClaimCheck<TContractState> {
mod AirdropClaimCheck {
use governance::airdrop::{IAirdropDispatcherTrait};
use governance::interfaces::erc20::{IERC20Dispatcher, IERC20DispatcherTrait};
use super::{IAirdropClaimCheck, CheckParams, CheckResult};
use super::{CheckParams, CheckResult, IAirdropClaimCheck};

#[storage]
struct Storage {}
Expand All @@ -34,12 +34,12 @@ mod AirdropClaimCheck {

while let Option::Some(claim_check) = claims.pop_front() {
let token = IERC20Dispatcher {
contract_address: (*claim_check.airdrop).get_token()
contract_address: (*claim_check.airdrop).get_token(),
};
let claimed = (*claim_check.airdrop).is_claimed(*claim_check.claim_id);
let funded = token
.balanceOf(
*claim_check.airdrop.contract_address
*claim_check.airdrop.contract_address,
) >= ((*claim_check.amount).into());
result.append(CheckResult { claimed, funded });
};
Expand Down
Loading

0 comments on commit 6b5202b

Please sign in to comment.