pub fn force_transfer_to_contract(to: ContractId, asset_id: AssetId, amount: u64) 
Expand description

UNCONDITIONAL transfer of amount coins of type asset_id to
the contract at to.

Additional Information

This will transfer coins to a contract even with no way to retrieve them
(i.e. no withdrawal functionality on receiving contract), possibly leading
to the PERMANENT LOSS OF COINS if not used with care.


  • to: [ContractId] - The recipient contract.
  • asset_id: [AssetId] - The asset to transfer.
  • amount: [u64] - The amount of coins to transfer.


  • When amount is greater than the contract balance for asset_id.
  • When amount is equal to zero.


use std::{constants::ZERO_B256, asset::force_transfer_to_contract};

fn foo() {
    let to_contract_id = ContractId::from(ZERO_B256);
    force_transfer_to_contract(to_contract_id, AssetId::base(), 500);