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

HAL-16 remove transfer from #762

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 1 addition & 31 deletions protocol-units/bridge/move-modules/sources/MOVETH.move
Original file line number Diff line number Diff line change
Expand Up @@ -174,36 +174,6 @@ module atomic_bridge::moveth {
);
}

/// Allow a spender to transfer tokens from the owner's account given their signed approval.
/// Caller needs to provide the from account's scheme and public key which can be gotten via the Aptos SDK.
public fun transfer_from(
spender: &signer,
proof: vector<u8>,
from: address,
from_account_scheme: u8,
from_public_key: vector<u8>,
to: address,
amount: u64,
) acquires Management, State, MovethAddress {
assert_not_paused();
assert_not_denylisted(from);
assert_not_denylisted(to);

let expected_message = Approval {
owner: from,
to: to,
nonce: account::get_sequence_number(from),
chain_id: chain_id::get(),
spender: signer::address_of(spender),
amount,
};
account::verify_signed_message(from, from_account_scheme, from_public_key, proof, expected_message);

let transfer_ref = &borrow_global<Management>(moveth_address()).transfer_ref;
// Only use with_ref API for primary_fungible_store (PFS) transfers in this module.
primary_fungible_store::transfer_with_ref(transfer_ref, from, to, amount);
}

/// Deposit function override to ensure that the account is not denylisted and the moveth is not paused.
public fun deposit<T: key>(
store: Object<T>,
Expand Down Expand Up @@ -351,4 +321,4 @@ module atomic_bridge::moveth {
public fun init_for_test(moveth_signer: &signer) {
init_module(moveth_signer);
}
}
}