Prefix wormhole token names

Change-Id: Ieea61ea2833f66c29a2fa0f52ae1a914a3956146
This commit is contained in:
Hendrik Hofstadt 2021-08-26 13:19:56 +02:00
parent f97ff5e079
commit 50afa0fe9e
3 changed files with 11 additions and 6 deletions

View File

@ -34,11 +34,11 @@ contract TokenImplementation is TokenState, Context {
} }
function name() public view returns (string memory) { function name() public view returns (string memory) {
return _state.name; return string(abi.encodePacked("Wormhole: ", _state.name));
} }
function symbol() public view returns (string memory) { function symbol() public view returns (string memory) {
return _state.symbol; return string(abi.encodePacked("wh", _state.symbol));
} }
function owner() public view returns (address) { function owner() public view returns (address) {

View File

@ -140,6 +140,11 @@ pub fn create_wrapped(
}, },
)?; )?;
let mut name = String::from("Wormhole: ") + accs.vaa.name.as_str();
name.truncate(32);
let mut symbol = String::from("wh") + accs.vaa.symbol.as_str();
symbol.truncate(10);
let spl_token_metadata_ix = spl_token_metadata::instruction::create_metadata_accounts( let spl_token_metadata_ix = spl_token_metadata::instruction::create_metadata_accounts(
spl_token_metadata::id(), spl_token_metadata::id(),
*accs.spl_metadata.key, *accs.spl_metadata.key,
@ -147,8 +152,8 @@ pub fn create_wrapped(
*accs.mint_authority.info().key, *accs.mint_authority.info().key,
*accs.payer.info().key, *accs.payer.info().key,
*accs.mint_authority.info().key, *accs.mint_authority.info().key,
accs.vaa.name.clone(), name,
accs.vaa.symbol.clone(), symbol,
String::from(""), String::from(""),
None, None,
0, 0,

View File

@ -23,8 +23,8 @@ pub fn init<S: Storage, A: Api, Q: Querier>(
) -> StdResult<InitResponse> { ) -> StdResult<InitResponse> {
// store token info using cw20-base format // store token info using cw20-base format
let data = TokenInfo { let data = TokenInfo {
name: msg.name, name: String::from("Wormhole:") + msg.name.as_str(),
symbol: msg.symbol, symbol: String::from("wh") + msg.symbol.as_str(),
decimals: msg.decimals, decimals: msg.decimals,
total_supply: Uint128(0), total_supply: Uint128(0),
// set creator as minter // set creator as minter