Skip to content

Commit

Permalink
Revert "Made transfer_to a little more generic (FuelLabs#1853)" (Fuel…
Browse files Browse the repository at this point in the history
…Labs#1856)

This reverts commit cee607d.
  • Loading branch information
adlerjohn authored Jun 5, 2022
1 parent 326aafb commit 2ea91ce
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions sway-lib-std/src/token.sw
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use ::identity::Identity;
/// Mint `amount` coins of the current contract's `asset_id` and transfer them to `destination` by calling either force_transfer_to_contract() or transfer_to_output(), depending on the type of `Identity`.
pub fn mint_to(amount: u64, recipient: Identity) {
mint(amount);
transfer(recipient, amount, contract_id());
transfer_to(amount, recipient);
}

/// Mint `amount` coins of the current contract's `asset_id` and send them (!!! UNCONDITIONALLY !!!) to the contract at `destination`.
Expand Down Expand Up @@ -42,12 +42,15 @@ pub fn burn(amount: u64) {
}
}

/// Transfer `amount` coins of the specified `asset` and send them to `to` by calling either
/// force_transfer_to_contract() or transfer_to_output(), depending on the type of `Identity`.
pub fn transfer(to: Identity, amount: u64, asset: ContractId) {
match to {
Identity::Address(address) => transfer_to_output(amount, asset, address),
Identity::ContractId(id) => force_transfer_to_contract(amount, asset, id),
/// Transfer `amount` coins of the current contract's `asset_id` and send them to `destination` by calling either force_transfer_to_contract() or transfer_to_output(), depending on the type of `Identity`.
pub fn transfer_to(amount: u64, recipient: Identity) {
match recipient {
Identity::Address(addr) => {
transfer_to_output(amount, contract_id(), addr);
},
Identity::ContractId(id) => {
force_transfer_to_contract(amount, contract_id(), id);
},
}
}

Expand Down

0 comments on commit 2ea91ce

Please sign in to comment.