Investa-Farm / investafarm-canisters

Backend canisters for investa farm
https://a4gq6-oaaaa-aaaab-qaa4q-cai.raw.icp0.io/?id=4c3lo-haaaa-aaaam-adi5q-cai
0 stars 0 forks source link

Implementing ckETH payments & transactional fees logic #35

Closed Stephen-Kimoi closed 4 months ago

Stephen-Kimoi commented 4 months ago

ckETH Payments Logic

The following functions have been added in the ck_eth_payments.rs file:

Transactional fees logic: The logic for the transactional fees can be found in the transaction_fee.rs file

The logic has been implemented in the verify_transaction function inside the ck_eth_payments.rs file.

From line 117 :arrow_down:

    // Deduct 0.5% from the amount (transactional fees) 
    let deduction = amount_f64 * 0.005; 
    let _ = transaction_fees::store_transaction_fee(hash.clone(), deduction);
    let new_amount = amount_f64 - deduction; 

    let _ = payments::store_investments(
        0, // change this to farm_id
        new_amount, 
        0, // change this to investor_id
        hash.clone(),  
        "ckETH".to_string()
    ); 
chriss1525 commented 4 months ago

This looks awesome! could you work on the merge conflicts first?

Stephen-Kimoi commented 4 months ago

Yes, I’ll work on the conflicts. It seems it’s on the candid files.