without more context and just these lines of code, it's difficult to answer precisely.
Do you go through a DEFI smart contract that handles the transaction?
or is it a full exchange contract?
So here are some general clues, but I will be able to answer more accurately if you answer the previous.
When you look at the ERC777 documentation, you can see that sentence:
The token contract MUST emit a Sent event with the correct values as defined in the Sent Event.
the idea is that you (or the other contract) must create an event to see if the transfer is done or not.
Maybe this example can help you.
pragma solidity ^0.5.0;
import "@openzeppelin/contracts/token/ERC777/IERC777.sol";
import "@openzeppelin/contracts/introspection/IERC1820Registry.sol";
import "@openzeppelin/contracts/introspection/ERC1820Implementer.sol";
import "@openzeppelin/contracts/token/ERC777/IERC777Sender.sol";
contract Simple777Sender is IERC777Sender, ERC1820Implementer {
bytes32 constant public TOKENS_SENDER_INTERFACE_HASH = keccak256("ERC777TokensSender");
event DoneStuff(address operator, address from, address to, uint256 amount, bytes userData, bytes operatorData);
function senderFor(address account) public {
_registerInterfaceForAddress(TOKENS_SENDER_INTERFACE_HASH, account);
}
function tokensToSend(
address operator,
address from,
address to,
uint256 amount,
bytes calldata userData,
bytes calldata operatorData
) external {
// do stuff
emit DoneStuff(operator, from, to, amount, userData, operatorData);
}
}