Skip to content

Commit

Permalink
merge develop
Browse files Browse the repository at this point in the history
  • Loading branch information
manlikeHB committed Nov 30, 2024
2 parents 413c462 + 0f8a85c commit 96695ff
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
.snfoundry_cache
target
.snfoundry_cache/https___starknet_mainnet_public_blastapi_io_rpc_v0_7_631894_v3.json
.DS_Store
Scarb.lock
snfoundry_cache/https___starknet_mainnet_public_blastapi_io_rpc_v0_7_631894_v3.json
9 changes: 9 additions & 0 deletions Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry", tag = "v
casm = true
sierra = true

[scripts]
test = "snforge test"

[[tool.snforge.fork]]
name = "SEPOLIA_LATEST"
url = "https://starknet-sepolia.public.blastapi.io/rpc/v0_7"
block_id.tag = "latest"
# block_id.number = "325081"

[[tool.snforge.fork]]
name = "Mainnet"
url = "https://starknet-mainnet.public.blastapi.io/rpc/v0_7"
Expand Down
2 changes: 2 additions & 0 deletions src/campaign.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ mod TokengiverCampaign {
let new_campaign = Campaign {
campaign_address, campaign_owner: caller, metadata_URI: "", token_id,
};

self.campaign.write(campaign_address, new_campaign);
self.campaigns.write(count, campaign_address);
self.count.write(count);
Expand All @@ -139,6 +140,7 @@ mod TokengiverCampaign {
token_giver_nft_address: nft_address
}
);

campaign_address
}

Expand Down
45 changes: 44 additions & 1 deletion tests/test_token_giver_nft.cairo
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use core::num::traits::zero::Zero;
use core::starknet::SyscallResultTrait;
use core::traits::{TryInto, Into};
use starknet::{ContractAddress};
use starknet::{ContractAddress, ClassHash, get_block_timestamp};
// use snforge_std::{declare, ContractClassTrait, CheatTarget, start_prank, stop_prank,};
use snforge_std::{
declare, start_cheat_caller_address, stop_cheat_caller_address, ContractClassTrait,
Expand All @@ -13,6 +13,7 @@ use tokengiver::interfaces::ITokenGiverNft::{
ITokenGiverNftDispatcher, ITokenGiverNftDispatcherTrait
};
use tokengiver::base::errors::Errors::ALREADY_MINTED;
use tokengiver::interfaces::ICampaign::{ICampaignDispatcher, ICampaignDispatcherTrait};

const ADMIN: felt252 = 'ADMIN';
const USER_ONE: felt252 = 'BOB';
Expand All @@ -27,6 +28,48 @@ fn __setup__() -> ContractAddress {
return (nft_contract_address);
}

fn deploy_campaign_contract() -> ContractAddress {
let nft_class_hash = declare("TokenGiverNFT").unwrap().contract_class();

let mut constructor_calldata: Array<felt252> = ArrayTrait::new();
nft_class_hash.serialize(ref constructor_calldata);

let contract = declare("TokengiverCampaign").unwrap().contract_class();
let (contract_address, _) = contract.deploy(@constructor_calldata).unwrap();

contract_address
}

// #[test]
// #[fork("SEPOLIA_LATEST")]
// fn test_create_campaign() {
// let campaign_contract_address = deploy_campaign_contract();
// let campaign_contract = ICampaignDispatcher { contract_address: campaign_contract_address };

// // Using Sepolia V2 (Audited contract)

// let registry_hash: ClassHash = starknet::class_hash_const::<
// 0x046163525551f5a50ed027548e86e1ad023c44e0eeb0733f0dab2fb1fdc31ed0
// >();
// let registry_hash_in_felt: felt252 = registry_hash.into();

// let implementation_hash = starknet::class_hash_const::<
// 0x45d67b8590561c9b54e14dd309c9f38c4e2c554dd59414021f9d079811621bd
// >();
// let implementation_hash_in_felt: felt252 = implementation_hash.into();

// let salt = get_block_timestamp();
// let salt_in_felt: felt252 = salt.into();

// let recipient: ContractAddress = starknet::contract_address_const::<
// 0x01526C92E52c337b7B04d1307c6080Ece3a17071F2F0295197cEa8d077c6FF80
// >();

// campaign_contract
// .create_campaign(
// registry_hash_in_felt, implementation_hash_in_felt, salt_in_felt, recipient
// );
// }

// #[test]
// fn test_metadata() {
Expand Down

0 comments on commit 96695ff

Please sign in to comment.