#![no_std]

use casper_contract::{
    contract_api::{runtime, system},
    unwrap_or_revert::UnwrapOrRevert,
};
use casper_types::{account::AccountHash, U512};

const ARG_TARGET: &str = "target";
const ARG_AMOUNT: &str = "amount";

/// Executes mote transfer to supplied account hash.
/// Transfers the requested amount.
#[no_mangle]
pub fn delegate() {
    let account_hash: AccountHash = runtime::get_named_arg(ARG_TARGET);
    let transfer_amount: U512 = runtime::get_named_arg(ARG_AMOUNT);
    system::transfer_to_account(account_hash, transfer_amount).unwrap_or_revert();
}
