The following functions have been added in the ck_eth_payments.rs file:
eth_get_transaction_receipt: this function gets the ckETH transaction receipt from the transaction hash submitted
verify_transaction: this is the main function as it verifies the transaction has happened on-chain for this particular canister, ideally it checks whether the funds have been sent to this particular canister on-chain
The rest of the functions inside the ck_eth_payments.rs file are helper functions
Transactional fees logic:
The logic for the transactional fees can be found in the transaction_fee.rs file
store_transaction_fee is responsible for storing all the transactional fees
get_all_transaction_fees is responsible for getting all transactional fees
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()
);
ckETH Payments Logic
The following functions have been added in the
ck_eth_payments.rs
file:eth_get_transaction_receipt
: this function gets the ckETH transaction receipt from the transaction hash submittedverify_transaction
: this is the main function as it verifies the transaction has happened on-chain for this particular canister, ideally it checks whether the funds have been sent to this particular canister on-chainck_eth_payments.rs
file are helper functionsTransactional fees logic: The logic for the transactional fees can be found in the
transaction_fee.rs
filestore_transaction_fee
is responsible for storing all the transactional feesget_all_transaction_fees
is responsible for getting all transactional feesThe logic has been implemented in the
verify_transaction
function inside theck_eth_payments.rs
file.From line 117 :arrow_down: