@@ -172,58 +172,58 @@ pub mod crowdfunding {
172172 // Processes a new contribution to the campaign
173173 // Validates the transaction and transfers tokens from contributor
174174 fn fund_to_contract (ref self : ContractState , amount : u256 ) {
175- println! (" amount: {}" , amount );
175+ // println!("amount: {}", amount);
176176 let caller_address = get_caller_address ();
177- let caller_felt : felt252 = caller_address . try_into (). unwrap ();
178- println! (" caller_address (hex): 0x{:x}" , caller_felt );
177+ // let caller_felt: felt252 = caller_address.try_into().unwrap();
178+ // println!("caller_address (hex): 0x{:x}", caller_felt);
179179
180180 let current_contract_address = starknet :: get_contract_address ();
181- let contract_felt : felt252 = current_contract_address . try_into (). unwrap ();
181+ // let contract_felt: felt252 = current_contract_address.try_into().unwrap();
182182
183183 // Validation checks
184184 assert (caller_address != current_contract_address , ' No self fund.' );
185185 assert (amount > 0 , ' Amount <= 0' );
186186
187187 // Check if campaign is still active
188188 let current_timestamp = starknet :: get_block_timestamp ();
189- println! (" current_timestamp: {}" , current_timestamp );
189+ // println!("current_timestamp: {}", current_timestamp);
190190 let deadline : u64 = self . deadline. read (). try_into (). unwrap ();
191- println! (" deadline: {}" , deadline );
191+ // println!("deadline: {}", deadline);
192192 assert (current_timestamp <= deadline , ' Campaign has ended' );
193193
194194 let token_dispatcher = IERC20Dispatcher { contract_address : self . token. read () };
195- println! (" contract_address (hex): 0x{:x}" , contract_felt );
195+ // println!("contract_address (hex): 0x{:x}", contract_felt);
196196
197197 // 检查余额
198198 let balance = token_dispatcher . balance_of (caller_address );
199- println! (" caller balance: {}" , balance );
199+ // println!("caller balance: {}", balance);
200200 assert (balance >= amount , ' Insufficient balance' );
201201
202202 // 检查授权额度
203203 let allowance = token_dispatcher . allowance (caller_address , current_contract_address );
204- println! (" allowance: {}" , allowance );
204+ // println!("allowance: {}", allowance);
205205 assert (allowance >= amount , ' Insufficient allowance' );
206206
207207 // 执行转账
208- println! (" Attempting transfer from 0x{:x} to 0x{:x} amount {}" ,
209- caller_felt ,
210- contract_felt ,
211- amount
212- );
208+ // println!("Attempting transfer from 0x{:x} to 0x{:x} amount {}",
209+ // caller_felt,
210+ // contract_felt,
211+ // amount
212+ // );
213213
214214 // Check allowance before transfer
215- let allowance = token_dispatcher . allowance (caller_address , current_contract_address );
216- println! (" Contract allowance: {}" , allowance );
215+ // let allowance = token_dispatcher.allowance(caller_address, current_contract_address);
216+ // println!("Contract allowance: {}", allowance);
217217
218218 match token_dispatcher . transfer_from (
219219 caller_address , current_contract_address , amount
220220 ) {
221221 true => {
222- println! (" Transfer successful!" );
222+ // println!("Transfer successful!");
223223 self . emit (Transfer { from : caller_address , to : current_contract_address , amount : amount });
224224 },
225225 false => {
226- println! (" Transfer failed!" );
226+ // println!("Transfer failed!");
227227 self . emit (TransferFailed {
228228 from : caller_address ,
229229 to : current_contract_address ,
@@ -239,7 +239,7 @@ pub mod crowdfunding {
239239 fn withdraw_funds (ref self : ContractState ) {
240240 self . ownable. assert_only_owner ();
241241 assert (self . active. read (), ' Not active status' );
242- println! (" in:in" );
242+ // println!("in:in" );
243243 // Check if deadline has passed or target is met
244244 let token_dispatcher = IERC20Dispatcher { contract_address : self . token. read () };
245245 let current_timestamp = starknet :: get_block_timestamp ();
@@ -248,37 +248,36 @@ pub mod crowdfunding {
248248 let balance = token_dispatcher . balance_of (current_contract_address );
249249 let target = self . fund_target. read ();
250250
251- println! (" current_timestamp: {}" , current_timestamp );
252- println! (" deadline: {}" , deadline );
253- println! (" fund_target raw: {}" , target );
254- println! (" fund_target from getter: {}" , self . get_fund_target ());
255- println! (" balance: {}" , balance );
251+ // println!("current_timestamp: {}", current_timestamp);
252+ // println!("deadline: {}", deadline);
253+ // println!("fund_target raw: {}", target);
254+ // println!("fund_target from getter: {}", self.get_fund_target());
255+ // println!("balance: {}", balance);
256256
257257 assert (
258258 current_timestamp > deadline || balance >= target ,
259259 ' Cannot withdraw!'
260260 );
261261
262- println! (" Assert passed successfully" );
263- let contract_felt : felt252 = current_contract_address . try_into (). unwrap ();
262+ // println!("Assert passed successfully");
264263 let grantee_address = self . grantee_address. read ();
265- let grantee_address_felt : felt252 = grantee_address . try_into (). unwrap ();
264+ // let grantee_address_felt: felt252 = grantee_address.try_into().unwrap();
266265
267- println! (" Attempting transfer_from..." );
268- println! (" From address: (hex): 0x{:x}" , contract_felt );
269- println! (" To address: (hex): 0x{:x}" , grantee_address_felt );
270- println! (" Amount: {}" , balance );
266+ // println!("Attempting transfer_from...");
267+ // println!("From address: (hex): 0x{:x}", contract_felt);
268+ // println!("To address: (hex): 0x{:x}", grantee_address_felt);
269+ // println!("Amount: {}", balance);
271270
272- println! (" Attempting direct transfer..." );
271+ // println!("Attempting direct transfer...");
273272 match token_dispatcher . transfer (grantee_address , balance ) {
274273 true => {
275- println! (" Transfer successful!" );
274+ // println!("Transfer successful!");
276275 self . active. write (false ); // 提现后设置为非激活状态
277276 self . emit (Transfer { from : current_contract_address , to : grantee_address , amount : balance });
278277 self . emit (ActiveChanged { active : false });
279278 },
280279 false => {
281- println! (" Transfer failed!" );
280+ // println!("Transfer failed!");
282281 self . emit (TransferFailed {
283282 from : current_contract_address ,
284283 to : grantee_address ,
@@ -315,15 +314,15 @@ pub mod crowdfunding {
315314 fn get_token_symbol (self : @ ContractState ) -> core :: byte_array :: ByteArray {
316315 let token_address = self . token. read ();
317316 let contract_felt : felt252 = token_address . try_into (). unwrap ();
318- println! (" Token address: (hex): 0x{:x}" , contract_felt );
317+ // println!("Token address: (hex): 0x{:x}", contract_felt);
319318
320319 // 根据合约地址返回对应的符号
321320 if contract_felt == 0x04718f5a0Fc34cC1AF16A1cdee98fFB20C31f5cD61D6Ab07201858f4287c938D {
322- println! (" Token identified as STRK" );
321+ // println!("Token identified as STRK");
323322 let strk : core :: byte_array :: ByteArray = " STRK" ;
324323 strk
325324 } else if contract_felt == 0x049D36570D4e46f48e99674bd3fcc84644DdD6b96F7C741B1562B82f9e004dC7 {
326- println! (" Token identified as ETH" );
325+ // println!("Token identified as ETH");
327326 let eth : core :: byte_array :: ByteArray = " ETH" ;
328327 eth
329328 } else {
0 commit comments