Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[framework] Auto bind bitcoin address to rooch address when transfer #2340

Closed
jolestar opened this issue Aug 2, 2024 · 1 comment · Fixed by #2628
Closed

[framework] Auto bind bitcoin address to rooch address when transfer #2340

jolestar opened this issue Aug 2, 2024 · 1 comment · Fixed by #2628
Labels
area:stdlib Move stdlib or framework issues skill::move Need the Move language skill to complete the issue
Milestone

Comments

@jolestar
Copy link
Contributor

jolestar commented Aug 2, 2024

Auto bind bitcoin address to rooch address when transferring coin or object.

public entry fun transfer_coin_to_bitcoin_address<CoinType: key + store>(
from: &signer,
to: String,
amount: u256,
) {
let btc_address = bitcoin_address::from_string(&to);
let rooch_address = bitcoin_address::to_rooch_address(&btc_address);
account_coin_store::transfer<CoinType>(from, rooch_address, amount)
}

/// Transfer `from` owned `Object<T>` to a Bitcoin Address.
public entry fun transfer_object_to_bitcoin_address<T: key + store>(
to: String,
obj: Object<T>) {
let btc_address = bitcoin_address::from_string(&to);
let rooch_address = bitcoin_address::to_rooch_address(&btc_address);
object::transfer(obj, rooch_address);
}

@jolestar jolestar added skill::move Need the Move language skill to complete the issue area:stdlib Move stdlib or framework issues labels Aug 2, 2024
@jolestar jolestar added this to the Rooch v0.7 milestone Aug 2, 2024
@feliciss
Copy link
Collaborator

Is this issue available for resolving?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:stdlib Move stdlib or framework issues skill::move Need the Move language skill to complete the issue
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants