createAccount
//Import library of libra
import 0x0.LibraAccount;
import 0x0.LibraCoin;
main() {
//Define 4 var
let addr: address;
let account_exists: bool;
let ten_coins: R#LibraCoin.T;
let account_exists_now: bool;
//verify if the account exists
addr = 0x011111111111111111111111111111111111111111111111111111110111111111111111111111111110;
account_exists: LibraAccount.exists(copy(addr));
assert(!move(account_exists), 83);
//grab coins from the sender
ten_coins = LibraAccount.withdraw_from_sender(10);
//create a new acount
create_account(copy(addr));
//Deposit the amount to the other user
LibraAccount.deposit(copy(addr), move(ten_coins));
account_exists_now = LibraAccount.exists(copy(addr));
assert(move(account_exists_now), 84)
}
Last updated
Was this helpful?