1.7 KiB
1.7 KiB
Blockchain Collection fee
files:
- {$Dena_path}/app/workers/daemons/deposit.rb
- {$Dena_path}/app/services/wallet_service.rb
implementation
during blockchain deposit daemon, WalletService asks its Adapter (by passing The relevant deposit wallet) that the prepare_deposit_collection! method was implemented or not.
if not, the daemon kept continues its process, but if that method existed in the coin Adapter, the deposit daemon call the collect_fee method on the deposit DB record.
collect_fee function
- Check the spread column of the deposit to find was filled or not. if not call
spread_between_wallets!from the Deposit model. - Active relevant fee wallet will be found from DB. if not found, we will back to the deposit daemon process.
- Create WalletService object by passing active fee wallet and run
deposit_collection_fees!method on the deposit record. deposit_collection_feesmethod, runprepare_deposit_collectionprepare_deposit_collectionmethod will have a unique implementation for each coin (blockchain),but eventually, the output must be a transaction that in addition to sending into the relevant blockchain, also will be saved in the local DB.- Change the state column of the deposit record from
processingtofee_processing
graph TD
A((Depoist Daemon)) -->|deposit record| B[WalletService ]
B --> |the Depoist Wallet Record| C{Adapter}
C --> |`prepare_deposit_collection` is not impelemented |A
C --> |`prepare_deposit_collection` is impelemented| E(WalletService)
E --> |the Fee Wallet Record| C
C --> D(`deposit_collection_fees!`)
D --> |change state to fee_processing|A