1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright 2022-2024, Offchain Labs, Inc.
// For licensing, see https://github.com/OffchainLabs/stylus-sdk-rs/blob/main/licenses/COPYRIGHT.md
use Vec;
use ;
use Host;
use RawCall;
/// Transfers an amount of ETH in wei to the given account.
/// Note that this method will call the other contract, which may in turn call others.
///
/// All gas is supplied, which the recipient may burn.
/// If this is not desired, the [`call`](super::call) function may be used directly.
///
/// ```
/// # use stylus_sdk::prelude::*;
/// # use stylus_sdk::stylus_core::host::Host;
/// # use stylus_sdk::call::transfer::transfer_eth;
/// # fn wrap(host: &impl Host) -> Result<(), Vec<u8>> {
/// # let value = alloy_primitives::U256::ZERO;
/// # let recipient = alloy_primitives::Address::ZERO;
/// transfer_eth(host, recipient, value)?; // these two are equivalent
/// call(host, Call::new().value(value), recipient, &[])?; // these two are equivalent
/// # Ok(())
/// # }
/// ```