Last updated
Last updated
caver.klay.KIP7
은 KIP-7 표준을 구현한 스마트 컨트랙트를 JavaScript 객체 형태로 Klaytn 블록체인에서 손쉽게 다룰 수 있도록 돕습니다.
The caver.klay.KIP7
inherits to implement the KIP-7 token contract. caver.klay.KIP7
은 caver.klay.Contract
와 동일한 속성값들을 가지며, 추가 기능 구현을 위해 메서드를 더 가지고 있습니다. 이 장은 caver.klay.KIP7
메쏘드들 중 오직 새롭게 추가된 메쏘드들만을 소개합니다.
caver.klay.KIP7에서 사용된 abi와 바이트 코드는 예시를 사용하여 구현되었습니다.
For more information about KIP-7, see .
참고 caver.klay.KIP7
는 caver-js부터 지원됩니다.
Deploys the KIP-7 token contract to the Klaytn blockchain. caver.klay.KIP7.deploy를 사용해 배포한 컨트랙트는 KIP-7 표준을 따르는 대체 가능 토큰입니다.
After successful deployment, the promise will be resolved with a new KIP7 instance.
Parameters
The tokenInfo object must contain the following:
NOTE The initialSupply
parameter accepts Number
type but if the fed value were out of the range capped by Number.MAX_SAFE_INTEGER, it might cause an unexpected result or error. In this case, it is recommended to use the BigNumber
type, especially for a uint256
sized numeric input value.
Return Value
PromiEvent
: A promise combined event emitter, which is resolved with a new KIP7 instance. Additionally, the following events can occur:
Example
Creates a new KIP7 instance with its bound methods and events.
Parameters
Return Value
Example
Clones the current KIP7 instance.
Parameters
Return Value
Example
Returns true
if this contract implements the interface defined by interfaceId
.
Parameters
Return Value
Promise
returns Boolean
: true
if this contract implements the interface defined by interfaceId
.
Example
Returns the name of the token.
Parameters
None
Return Value
Promise
returns String
: The name of the token.
Example
Returns the symbol of the token.
Parameters
None
Return Value
Promise
returns String
: The symbol of the token.
Example
토큰이 사용하는 소수점 자릿수를 반환합니다.
Parameters
None
Return Value
프로미스
는 Number
를 반환합니다 - 토큰이 사용하는 소수점 자릿수입니다.
Example
공급된 토큰 총량을 반환합니다.
Parameters
None
Return Value
Promise
returns BigNumber
: The total number of tokens.
Example
Returns the balance of the given account address.
Parameters
Return Value
Promise
returns BigNumber
: The account balance.
Example
spender
가 owner
의 잔액에서 인출하도록 허락받은 토큰 수량을 반환합니다.
Parameters
Return Value
Promise
returns BigNumber
: The remaining number of tokens that spender is allowed to spend in place of the owner.
Example
주어진 계정이 새 KIP7 토큰을 발행할 수 있는 발행자라면 true
를 반환합니다.
Parameters
Return Value
Promise
returns Boolean
: true
if the account is a minter.
Example
Returns true
if the given account is a pauser who can suspend transferring tokens.
Parameters
Return Value
Promise
returns Boolean
: true
if the account is a pauser.
Example
Returns true
if the contract is paused, and false
otherwise.
Parameters
None
Return Value
Promise
returns Boolean
: true
if the contract is paused.
Example
Set the amount
of the tokens of the token owner to be spent by the spender
.
Note that this method will submit a transaction from the owner to the Klaytn network, which will charge the transaction fee to the owner.
Parameters
NOTE The amount
parameter accepts Number
type but if the fed value were out of the range capped by Number.MAX_SAFE_INTEGER, it might cause an unexpected result or error. In this case, it is recommended to use the BigNumber
type, especially for a uint256
sized numeric input value.
The sendParam
object contains the following:
Return Value
Example
주어진 amount
만큼의 토큰을 토큰 소유자 잔액에서 recipient
에게 보냅니다. The token owner should execute this token transfer with its own hands. 따라서 토큰 소유자는 이 트랜잭션 발신자이어야 하며, 토큰 소유자의 주소는 반드시 sendParam.from
또는 kip7Instance.options.from
에 주어져야 합니다. Without sendParam.from
nor kip7Instance.options.from
being provided, an error would occur.
Note that sending this transaction will charge the transaction fee to the transaction sender.
Parameters
NOTE The amount
parameter accepts Number
type but if the fed value were out of the range capped by Number.MAX_SAFE_INTEGER, it might cause an unexpected result or error. In this case, it is recommended to use the BigNumber
type, especially for a uint256
sized numeric input value.
Return Value
Example
주어진 amount
만큼의 토큰을 토큰 소유자 잔액에서 recipient
에게 안전하게 보냅니다. The token owner should execute this token transfer with its own hands. Thus, the token owner should be the sender of this transaction whose address must be given at sendParam.from
or kip7Instance.options.from
. Without sendParam.from
nor kip7Instance.options.from
being provided, an error would occur.
Note that sending this transaction will charge the transaction fee to the transaction sender.
Parameters
NOTE The amount
parameter accepts Number
type but if the fed value were out of the range capped by Number.MAX_SAFE_INTEGER, it might cause an unexpected result or error. In this case, it is recommended to use the BigNumber
type, especially for a uint256
sized numeric input value.
Return Value
Example
Transfers the given amount
of token from the token owner's balance to the recipient
. The address who was approved to send the token owner's tokens is expected to execute this token transferring transaction. 따라서 토큰을 보내도록 허락받은 계정이 이 트랜잭션 발신자이어야 하며, 허락받은 계정의 주소는 반드시 sendParam.from
또는 kip7Instance.options.from
에 주어져야 합니다. Without sendParam.from
nor kip7Instance.options.from
being provided, an error would occur.
Note that sending this transaction will charge the transaction fee to the transaction sender.
Parameters
NOTE The amount
parameter accepts Number
type but if the fed value were out of the range capped by Number.MAX_SAFE_INTEGER, it might cause an unexpected result or error. In this case, it is recommended to use the BigNumber
type, especially for a uint256
sized numeric input value.
Return Value
Example
Safely transfers the given amount
of token from the token owner's balance to the recipient
. The address who was approved to send the token owner's tokens is expected to execute this token transferring transaction. Thus, the approved one should be the sender of this transaction whose address must be given at sendParam.from
or kip7Instance.options.from
. Without sendParam.from
nor kip7Instance.options.from
being provided, an error would occur.
Note that sending this transaction will charge the transaction fee to the transaction sender.
Parameters
NOTE The amount
parameter accepts Number
type but if the fed value were out of the range capped by Number.MAX_SAFE_INTEGER, it might cause an unexpected result or error. In this case, it is recommended to use the BigNumber
type, especially for a uint256
sized numeric input value.
Return Value
Example
Creates the amount
of token and issues it to the account
, increasing the total supply of token.
Note that this method will submit a transaction to the Klaytn network, which will charge the transaction fee to the sender.
Parameters
NOTE The amount
parameter accepts Number
type but if the fed value were out of the range capped by Number.MAX_SAFE_INTEGER, it might cause an unexpected result or error. In this case, it is recommended to use the BigNumber
type, especially for a uint256
sized numeric input value.
참고 만약 sendParam.from
또는 kip7Instance.options.from
이 주어졌다면, 이 주소는 반드시 MinterRole를 가진 발행자이어야 합니다.
Return Value
Example
Adds an account as a minter, who are permitted to mint tokens.
Note that this method will submit a transaction to the Klaytn network, which will charge the transaction fee to the sender.
Parameters
참고 만약 sendParam.from
또는 kip7Instance.options.from
이 주어졌다면, 이 주소는 반드시 발행자이어야 합니다.
Return Value
Example
Renounces the right to mint tokens. Only a minter address can renounce the minting right.
Note that this method will submit a transaction to the Klaytn network, which will charge the transaction fee to the sender.
Parameters
NOTE If sendParam.from
or kip7Instance.options.from
were given, it should be a minter with MinterRole.
Return Value
Example
Destroys the amount
of tokens in the sender's balance. Without sendParam.from
nor kip7Instance.options.from
being provided, an error would occur.
Note that this method will submit a transaction to the Klaytn network, which will charge the transaction fee to the sender.
Parameters
NOTE The amount
parameter accepts Number
type but if the fed value were out of the range capped by Number.MAX_SAFE_INTEGER, it might cause an unexpected result or error. In this case, it is recommended to use the BigNumber
type, especially for a uint256
sized numeric input value.
Return Value
Example
Destroys the given number of tokens from account
. sendParam.from
또는 kip7Instance.options.from
에 허용된 토큰량은 account
계정 잔고와 함께 줄어듭니다.
Note that this method will submit a transaction to the Klaytn network, which will charge the transaction fee to the sender.
Parameters
NOTE The amount
parameter accepts Number
type but if the fed value were out of the range capped by Number.MAX_SAFE_INTEGER, it might cause an unexpected result or error. In this case, it is recommended to use the BigNumber
type, especially for a uint256
sized numeric input value.
Return Value
Example
Adds an account as a pauser that has the right to suspend the contract.
Note that this method will submit a transaction to the Klaytn network, which will charge the transaction fee to the sender.
Parameters
참고 만약 sendParam.from
또는 kip7Instance.options.from
이 주어졌다면, 이 주소는 반드시 PauserRole을 가진 컨트랙트 중지 권한 소유자이어야 합니다.
Return Value
Example
Renounces the right to pause the contract. Only a pauser address can renounce the pausing right.
Note that this method will submit a transaction to the Klaytn network, which will charge the transaction fee to the sender.
Parameters
NOTE If sendParam.from
or kip7Instance.options.from
were given, it should be a pauser with PauserRole.
Return Value
Example
Suspends functions related to sending tokens.
Note that this method will submit a transaction to the Klaytn network, which will charge the transaction fee to the sender.
Parameters
NOTE If sendParam.from
or kip7Instance.options.from
were given, it should be a pauser with PauserRole.
Return Value
Example
Resumes the paused contract.
Note that this method will submit a transaction to the Klaytn network, which will charge the transaction fee to the sender.
Parameters
NOTE If sendParam.from
or kip7Instance.options.from
were given, it should be a pauser with PauserRole.
Return Value
Example
Promise
returns Object
- The receipt containing the result of the transaction execution. If you want to know about the properties inside the receipt object, see the description of . Receipts from KIP7 instances have an 'events' attribute parsed via ABI instead of a 'logs' attribute.
Promise
returns Object
- The receipt containing the result of the transaction execution. If you want to know about the properties inside the receipt object, see the description of . Receipts from KIP7 instances have an 'events' attribute parsed via ABI instead of a 'logs' attribute.
If the recipient was a contract address, it should implement . Otherwise, the transfer is reverted.
Promise
returns Object
- The receipt containing the result of the transaction execution. If you want to know about the properties inside the receipt object, see the description of . Receipts from KIP17 instances have an 'events' attribute parsed via ABI instead of a 'logs' attribute.
Promise
returns Object
- The receipt containing the result of the transaction execution. If you want to know about the properties inside the receipt object, see the description of . Receipts from KIP7 instances have an 'events' attribute parsed via ABI instead of a 'logs' attribute.
If the recipient was a contract address, it should implement . Otherwise, the transfer is reverted.
Promise
returns Object
- The receipt containing the result of the transaction execution. If you want to know about the properties inside the receipt object, see the description of . Receipts from KIP17 instances have an 'events' attribute parsed via ABI instead of a 'logs' attribute.
Promise
returns Object
- The receipt containing the result of the transaction execution. If you want to know about the properties inside the receipt object, see the description of . Receipts from KIP7 instances have an 'events' attribute parsed via ABI instead of a 'logs' attribute.
Promise
returns Object
- The receipt containing the result of the transaction execution. If you want to know about the properties inside the receipt object, see the description of . Receipts from KIP7 instances have an 'events' attribute parsed via ABI instead of a 'logs' attribute.
Promise
returns Object
- The receipt containing the result of the transaction execution. If you want to know about the properties inside the receipt object, see the description of . Receipts from KIP7 instances have an 'events' attribute parsed via ABI instead of a 'logs' attribute.
Promise
returns Object
- The receipt containing the result of the transaction execution. If you want to know about the properties inside the receipt object, see the description of . Receipts from KIP7 instances have an 'events' attribute parsed via ABI instead of a 'logs' attribute.
Promise
returns Object
- The receipt containing the result of the transaction execution. If you want to know about the properties inside the receipt object, see the description of . Receipts from KIP7 instances have an 'events' attribute parsed via ABI instead of a 'logs' attribute.
Promise
returns Object
- The receipt containing the result of the transaction execution. If you want to know about the properties inside the receipt object, see the description of . Receipts from KIP7 instances have an 'events' attribute parsed via ABI instead of a 'logs' attribute.
Promise
returns Object
- The receipt containing the result of the transaction execution. If you want to know about the properties inside the receipt object, see the description of . Receipts from KIP7 instances have an 'events' attribute parsed via ABI instead of a 'logs' attribute.
Promise
returns Object
- The receipt containing the result of the transaction execution. If you want to know about the properties inside the receipt object, see the description of . Receipts from KIP7 instances have an 'events' attribute parsed via ABI instead of a 'logs' attribute.
Promise
returns Object
- The receipt containing the result of the transaction execution. If you want to know about the properties inside the receipt object, see the description of . Receipts from KIP7 instances have an 'events' attribute parsed via ABI instead of a 'logs' attribute.