network : baobab
kip7 contract address : 0x127cC6A7A03d4E28c3Ea4Dc524e5bab5F1285C0C
owner public key : 0xc5cd84D60102B89fE69CA707E153ba93F4C7a70E
owner의 public key로 balanceof를 하면 123456789 토큰이 들어 있습니다.
아래는 KaiKas에 토큰 추가하는 코드와 컨트랙트입니다.
잘못된점 있으면 알려주시면 감사하겠습니다.
myToken: {
tokenAddress: "0x127cC6A7A03d4E28c3Ea4Dc524e5bab5F1285C0C",
tokenSymbol: "TFF",
tokenDecimals: 18,
tokenImage: 'https://avatars3.githubusercontent.com/u/32095134?s=460&v=4',
}
.....
const { tokenAddress, tokenSymbol, tokenDecimals, tokenImage } = App.myToken;
App.kaiKasProvider.sendAsync(
{
method: 'wallet_watchAsset',
params: {
type: 'ERC20', // Initially only supports ERC20, but eventually more!
options: {
address: tokenAddress, // The address that the token is at.
symbol: tokenSymbol, // A ticker symbol or shorthand, up to 5 chars.
decimals: tokenDecimals, // The number of decimals in the token
image: tokenImage // A string url of the token logo
}
}/*,
id: Math.round(Math.random() * 100000)*/
},
(err, result) => {
if (result.result) {
console.log('Thanks for your interest!')
} else {
console.log('Your loss!')
}
}
);
..... Smart Contract
pragma solidity ^0.5.0;
import "./klaytn-contracts/token/KIP7/KIP7.sol";
import "./klaytn-contracts/token/KIP7/KIP7Mintable.sol";
contract TestForFront is KIP7, KIP7Mintable {
uint256 private number;
constructor() public
{
_mint(msg.sender, 123456789);
}
function get() public view returns (uint256) {
return number;
}
function set(uint256 value) public {
number = value;
}
}