Skip to content

Instantly share code, notes, and snippets.

@Neurone
Created February 3, 2023 20:06
Show Gist options
  • Save Neurone/29d032604bcee50efa874b4f988b560f to your computer and use it in GitHub Desktop.
Save Neurone/29d032604bcee50efa874b4f988b560f to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=true&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
interface IHederaTokenService {
function associateToken(address account, address token) external returns (int responseCode);
function transferToken(address token, address sender, address recipient, int64 amount) external returns (int responseCode);
}
contract MoveFunds {
address constant precompileAddress = address(0x167);
function send(address token, address sender, address receiver, int64 amount) public {
precompileAddress.call(abi.encodeWithSelector(IHederaTokenService.transferToken.selector,
token, sender, receiver, amount));
}
function associateToken(address account, address token) public {
precompileAddress.call(abi.encodeWithSelector(IHederaTokenService.associateToken.selector,
account, token));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment