이 문서에서는 Injective에서 토큰을 출시하는 방법을 설명합니다.
Injective에서 토큰을 출시하는 두 가지 옵션이 있습니다: 기존 토큰 브릿징 또는 새 토큰 생성.
브릿징
Injective에서 토큰을 출시하는 가장 쉬운 방법은 Injective가 상호 운용 가능한 지원되는 네트워크 중 하나에서 기존 자산을 브릿징하는 것입니다. bridge 섹션에서 다른 네트워크에서 Injective로 자산을 브릿징하는 가이드를 참조할 수 있습니다.
브릿징 프로세스가 완료되면 Injective에 토큰이 생성되며, 이를 사용하여 마켓을 출시 할 수 있습니다.
새 토큰 생성
TokenFactory 모듈을 사용하여 Injective에서 새 토큰을 생성할 수도 있습니다. 이를 달성하는 여러 가지 방법이 있습니다.
Injective Hub 사용
Injective Hub 웹 앱은 토큰을 원활하게 생성하고 관리하며, Injective의 네이티브 오더북 에서 마켓을 생성하는 기능을 제공합니다.
TokenStation 사용
TokenStation 웹 앱은 토큰을 원활하게 생성하고 관리하며, Injective의 네이티브 오더북 에서 마켓을 생성하고, 에어드롭을 시작하는 등 다양한 기능을 제공합니다.
DojoSwap 사용
위와 유사하게, DojoSwap의 Market Creation 모듈 을 활용하여 토큰을 생성, 관리 및 상장할 수 있으며, 여러 가지 유용한 기능도 함께 사용할 수 있습니다.
프로그래밍 방식
TypeScript 사용
토큰 출시 에 대해 자세히 알아보세요.
Injective CLI 사용
이 튜토리얼을 진행하기 전에 로컬에 injectived가 설치되어 있어야 합니다. injectived 페이지에서 자세히 알아볼 수 있습니다.
injectived를 설치하고 키를 추가한 후, CLI를 사용하여 토큰을 출시할 수 있습니다:
TokenFactory denom 생성
factory denom 생성 수수료는 0.1 INJ입니다.
injectived tx tokenfactory create-denom [subdenom] [name] [symbol] [decimals] --from = YOUR_KEY --chain-id = injective-888 --node = https://testnet.tm.injective.network:443 --gas-prices = 500000000inj --gas 1000000
토큰은 생성자 주소에 의해 네임스페이스가 지정되어 무허가성을 보장하고 이름 충돌을 방지합니다. 위 예제에서 subdenom은 ak이지만 denom 명명은 factory/{creator address}/{subdenom}이 됩니다.
토큰 메타데이터 제출
Injective dApp에서 토큰이 표시되도록 하려면 메타데이터를 제출해야 합니다.
injectived tx tokenfactory set-denom-metadata "My Token Description" 'factory/inj17vytdwqczqz72j65saukplrktd4gyfme5agf6c/ak' AKK AKCoin AK '' '' '[
{"denom":"factory/inj17vytdwqczqz72j65saukplrktd4gyfme5agf6c/ak","exponent":0,"aliases":[]},
{"denom":"AKK","exponent":6,"aliases":[]}
]' 6 --from=YOUR_KEY --chain-id=injective-888 --node=https://testnet.sentry.tm.injective.network:443 --gas-prices=500000000inj --gas 1000000
이 명령은 다음 인수를 예상합니다:
injectived tx tokenfactory set-denom-metadata [description] [base] [display] [name] [symbol] [uri] [uri-hash] [denom-unit ( json )] [decimals]
토큰 발행
토큰을 생성하고 토큰 메타데이터를 제출한 후, 토큰을 발행할 차례입니다.
injectived tx tokenfactory mint 1000000factory/inj17vytdwqczqz72j65saukplrktd4gyfme5agf6c/ak --from=gov --chain-id=injective-888 --node=https://testnet.sentry.tm.injective.network:443 --gas-prices=500000000inj --gas 1000000
이 명령은 토큰이 6 decimals를 가진다고 가정하면 1 토큰을 발행합니다.
토큰 소각
토큰의 admin은 토큰을 소각할 수도 있습니다.
injectived tx tokenfactory burn 1000000factory/inj17vytdwqczqz72j65saukplrktd4gyfme5agf6c/ak --from=gov --chain-id=injective-888 --node=https://testnet.sentry.tm.injective.network:443 --gas-prices=500000000inj --gas 1000000
admin 변경
초기 공급량을 발행한 후에는 토큰 공급량이 조작되지 않도록 admin을 null 주소로 변경하는 것이 권장됩니다. 다시 말해, 토큰의 admin은 언제든지 공급량을 발행하고 소각할 수 있습니다. 위에서 설명한 대로 대부분의 경우 NEW_ADDRESS는 inj1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqe2hm49로 설정해야 합니다.
injectived tx tokenfactory change-admin factory/inj17vytdwqczqz72j65saukplrktd4gyfme5agf6c/ak NEW_ADDRESS --from=gov --chain-id=injective-888 --node=https://testnet.sentry.tm.injective.network:443 --gas-prices=500000000inj --gas 1000000
위의 예제는 테스트넷용입니다. 메인넷에서 실행하려면 다음과 같이 변경하세요: injective-888 > injective-1https://testnet.sentry.tm.injective.network:443 > http://sentry.tm.injective.network:443
Cosmwasm 사용
스마트 컨트랙트를 통해 프로그래밍 방식으로 bank 토큰을 생성하고 관리하려면 injective-cosmwasm 패키지에서 다음 메시지를 사용할 수 있습니다:
create_new_denom_msg
pub fn create_new_denom_msg ( sender : String , subdenom : String ) -> CosmosMsg < InjectiveMsgWrapper > {
InjectiveMsgWrapper {
route : InjectiveRoute :: Tokenfactory ,
msg_data : InjectiveMsg :: CreateDenom { sender , subdenom },
}
. into ()
}
목적: tokenfactory 모듈을 사용하여 새 토큰 denomination을 생성하는 메시지를 만듭니다.
파라미터:
sender: 생성을 시작하는 계정의 주소.
subdenom: 새 토큰의 sub-denomination 식별자.
반환: Injective 블록체인으로 전송할 준비가 된 InjectiveMsgWrapper로 래핑된 CosmosMsg.
예제:
let new_denom_message = create_new_denom_msg (
env . contract . address, // 발신자 주소
"mytoken" . to_string (), // Sub-denomination 식별자
);
pub fn create_set_token_metadata_msg ( denom : String , name : String , symbol : String , decimals : u8 ) -> CosmosMsg < InjectiveMsgWrapper > {
InjectiveMsgWrapper {
route : InjectiveRoute :: Tokenfactory ,
msg_data : InjectiveMsg :: SetTokenMetadata {
denom ,
name ,
symbol ,
decimals ,
},
}
. into ()
}
목적: 토큰의 메타데이터를 설정하거나 업데이트하는 메시지를 만듭니다.
파라미터:
denom: 토큰의 denomination 식별자.
name: 토큰의 전체 이름.
symbol: 토큰의 심볼.
decimals: 토큰이 사용하는 소수점 자릿수.
반환: Injective 블록체인으로 전송할 준비가 된 InjectiveMsgWrapper로 래핑된 CosmosMsg.
예제:
let metadata_message = create_set_token_metadata_msg (
"mytoken" . to_string (), // Denomination 식별자
"My Custom Token" . to_string (), // 전체 이름
"MYT" . to_string (), // 심볼
18 , // 소수점 자릿수
);
create_mint_tokens_msg
pub fn create_mint_tokens_msg ( sender : Addr , amount : Coin , mint_to : String ) -> CosmosMsg < InjectiveMsgWrapper > {
InjectiveMsgWrapper {
route : InjectiveRoute :: Tokenfactory ,
msg_data : InjectiveMsg :: Mint { sender , amount , mint_to },
}
. into ()
}
목적: 새 토큰을 발행하는 메시지를 만듭니다. 토큰은 tokenfactory 토큰이어야 하고 발신자는 토큰 admin이어야 합니다.
파라미터:
sender: 발행 작업을 시작하는 계정의 주소.
amount: 발행할 토큰 양.
mint_to: 새로 발행된 토큰이 전송될 수신자 주소.
반환: Injective 블록체인으로 전송할 준비가 된 InjectiveMsgWrapper로 래핑된 CosmosMsg.
예제:
let mint_message = create_mint_tokens_msg (
env . contract . address, // 발신자 주소
Coin :: new ( 1000 , "factory/<creator-address>/mytoken" ), // 발행할 양
"inj1..." . to_string (), // 수신자 주소
);
create_burn_tokens_msg
pub fn create_burn_tokens_msg ( sender : Addr , amount : Coin ) -> CosmosMsg < InjectiveMsgWrapper > {
InjectiveMsgWrapper {
route : InjectiveRoute :: Tokenfactory ,
msg_data : InjectiveMsg :: Burn { sender , amount },
}
. into ()
}
목적: 토큰을 소각하는 메시지를 만듭니다. 토큰은 tokenfactory 토큰이어야 하고 발신자는 토큰 admin이어야 합니다.
파라미터:
sender: 소각 작업을 시작하는 계정의 주소.
amount: 소각할 토큰 양.
반환: Injective 블록체인으로 전송할 준비가 된 InjectiveMsgWrapper로 래핑된 CosmosMsg.
예제:
let burn_message = create_burn_tokens_msg (
env . contract . address, // 발신자 주소
Coin :: new ( 500 , "factory/<creator-address>/mytoken" ), // 소각할 양
);