Last updated
Last updated
caver.kct.kip7
는 JavaScript의 객체로서 KIP-7을 구현하는 스마트 컨트랙트를 Klaytn 블록체인 플랫폼에서 쉽게 다룰 수 있도록 도와줍니다.
caver.kct.kip7
는 KIP-7 토큰 컨트랙트를 구현하기 위해 를 상속합니다. caver.kct.kip7
은 caver.contract
와 동일한 속성값들을 가지며, 추가 기능 구현을 위해 메소드를 더 가지고 있습니다. 이 장은 caver.kct.kip7
메소드들 중 오직 새롭게 추가된 것들만 소개합니다.
caver.kct.kip7에서 사용된 abi와 바이트 코드는 예시를 사용하여 구현되었습니다.
The code that implements KIP-7 for caver-js is available on the .
For more information about KIP-7, see .
KIP-7 토큰 컨트랙트를 Klaytn 블록체인에 배포합니다. caver.kct.kip7.deploy를 사용해 배포한 컨트랙트는 KIP-7 표준을 따르는 대체 가능 토큰입니다.
성공적으로 배포된 후, 프로미스는 새로운 KIP7 인스턴스를 반환할 것입니다.
Parameters
The tokenInfo object must contain the following:
참고 initialSupply
파라미터는 number
타입을 받지만, 입력된 값이 number.MAX_SAFE_INTEGER 범위를 초과할 경우, 예상치 못한 결과나 오류가 발생할 수 있습니다. In this case, it is recommended to use the BigNumber
type, especially for a uint256
sized numeric input value.
Return Value
PromiEvent
: 이벤트 이미터와 결합된 프로미스이며 새로운 KIP7 인스턴스를 반환합니다. Additionally, the following events can occur:
Example
Parameters
Return Value
Example
Parameters
Return Value
Example
Creates a new KIP7 instance with its bound methods and events.
Parameters
Return Value
Example
현재 KIP7 인스턴스를 복제합니다.
Parameters
Return Value
Example
Returns the information of the interface implemented by the token contract.
Parameters
None
Return Value
Example
Return true
if this contract implements the interface defined by interfaceId
.
Parameters
Return Value
프로미스
는 Boolean
을 반환: 이 컨트랙트가 해당 interfaceId
를 가진 인터페이스를 구현한다면 true
를 반환합니다.
Example
토큰 이름을 반환합니다.
Parameters
None
Return Value
Promise
returns string
: The name of the token.
Example
토큰 심볼을 반환합니다.
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
주어진 계정 주소의 잔액을 반환합니다.
Parameters
Return Value
Promise
returns BigNumber
: The account balance.
Example
spender
가 owner
의 잔액에서 인출하도록 허락받은 토큰 수량을 반환합니다.
Parameters
Return Value
프로미스
는 BigNumber
를 반환: 토큰 소유자를 대신해 토큰 사용자가 사용할 수 있도록 남아있는 토큰 수량입니다.
Example
주어진 계정이 새 KIP-7 토큰을 발행할 수 있는 minter라면 true
를 반환합니다.
Parameters
Return Value
프로미스
는 Boolean
을 반환: 계정이 발행자라면 true
를 반환합니다.
Example
주어진 계정이 토큰 전송을 멈출 수 있는 pauser라면 true
를 반환합니다.
Parameters
Return Value
프로미스
는 Boolean
을 반환: 이 계정이 중지 권한을 가진 계정이라면 true
를 반환합니다.
Example
컨트랙트가 작동을 멈추었다면 true
를 반환하고, 그렇지 않으면 false
를 반환합니다.
Parameters
None
Return Value
프로미스
는 Boolean
을 반환: 이 컨트랙트가 중지되었다면 true
를 반환합니다.
Example
토큰 소유자의 토큰을 spender
가 amount
만큼 사용하도록 허락합니다.
이 메서드는 토큰 소유자가 트랜잭션 발신자로서 Klaytn 네트워크에 트랜잭션을 전송하며, 트랜잭션 수수료가 트랜잭션 발신자에게 부과됩니다.
Parameters
참고 amount
파라미터는 Number
타입 값을 받지만, 입력된 값이 Number.MAX_SAFE_INTEGER 범위를 초과하면 예상치 못한 결과 또는 오류를 발생시킬 수 있습니다. 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
에게 보냅니다. 토큰 소유자는 이 토큰 전송을 직접 실행해야 합니다. 따라서 토큰 소유자는 이 트랜잭션 발신자이어야 하며, 토큰 소유자의 주소는 반드시 sendParam.from
또는 kip7.options.from
에 주어져야 합니다. sendParam.from
또는 kip7.options.from
가 주어지지 않는다면 에러가 발생합니다.
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 kip7.options.from
. Without sendParam.from
nor kip7.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 the token from the token owner's balance to the recipient
. 토큰 소유자의 토큰을 보내도록 허락받은 주소가 이 토큰 전송 트랜잭션을 실행할 수 있습니다. 따라서 토큰을 보내도록 허락받은 계정이 이 트랜잭션 발신자이어야 하며, 허락받은 계정의 주소는 반드시 sendParam.from
또는 kip7.options.from
에 주어져야 합니다. Without sendParam.from
nor kip7.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 the 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 kip7.options.from
. Without sendParam.from
nor kip7.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
만큼의 토큰을 만들어 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.
참고 만약 sendParam.from
또는 kip7.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
또는 kip7.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 kip7.options.from
were given, it should be a minter with MinterRole.
Return Value
Example
amount
만큼의 토큰을 트랜잭션 발신자 잔액에서 제거합니다. Without sendParam.from
nor kip7.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
account
에서 주어진 토큰 수량을 제거합니다. sendParam.from
또는 kip7.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
또는 kip7.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 kip7.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 kip7.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 kip7.options.from
were given, it should be a pauser with PauserRole.
Return Value
Example
Returns the information of the interface implemented by the token contract. 이 정적 함수는 를 사용합니다.
Promise
returns an object
containing the result with boolean values whether each is implemented.
새로운 KIP7 인스턴스를 인스턴스 메소드, 이벤트들과 함께 생성합니다. 이 함수는 과 동일하게 작동합니다.
참고 caver.kct.kip7.create
는 caver-js 부터 지원됩니다.
를 참고하세요.
See the .
Promise
returns an object
containing the result with boolean values whether each is implemented.
NOTE feeDelegation
, feePayer
and feeRatio
are supported since caver-js .
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 . KIP7 인스턴스의 영수증은 'logs' 속성 대신에 ABI로 파싱된 'events' 속성을 가지고 있습니다.
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 . KIP7 인스턴스의 영수증은 'logs' 속성 대신에 ABI로 파싱된 'events' 속성을 가지고 있습니다.
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.