One of the most important assets on blockchain is fungible tokens or FT. Here, we made deploying and distributing FT easy.
const ftDeploy = async () => {
const decimals = 18;
const totalSupply = "100000000000000000000000";
const res = await client.client.ft.ftDeploy(
(user as any)?.account_id,
totalSupply,
{
spec: "ft-1.0.0",
name: "FT Tutorial Contract",
symbol: "GOTEAM",
decimals: decimals,
icon: null,
reference: null,
reference_hash: null,
}
);
console.log("res", res);
};
After you have deployed the FT contract, you might want to reward your loyal members, you can go with this code.
const ftTransfer = async () => {
const receiverId = "cymac.testnet"
const amount = "1000000000000000000"
const res = await client.client.ft.ftTransfer(
(user as any)?.account_id,
receiverId,
amount,
null
)
console.log(res)
}
const getBalance = async () => {
const friendAccountId = "cymac.testnet"
const res = await client.client.ft.ftBalanceOf(
(user as any)?.account_id,
friendAccountId
)
console.log(res)
}
const getFtMetadata = async () => {
const res = await client.client.ft.ftMetadata(
(user as any)?.account_id,
)
console.log(res)
}
const getTotalSupply = async () => {
const res = await client.client.ft.ftTotalSupply(
(user as any)?.account_id,
)
console.log(res)
}