Can I deploy a Contract to a readable address in a test environment?

Viewed 29

The readable address are talking about here is in the form of an "*.near."

    fn get_context(predecessor_account_id: AccountId) -> VMContext {
        VMContext {
            current_account_id: "alice.near".to_string(),
            signer_account_id: "bob.near".to_string(),
            signer_account_pk: vec![0, 1, 2],
            predecessor_account_id,
            input: vec![],
            block_index: 0,
            block_timestamp: 0,
            account_balance: 1_000_000_000_000_000_000_000_000_000u128,
            account_locked_balance: 0,
            storage_usage: 10u64.pow(6),
            attached_deposit: 0,
            prepaid_gas: 10u64.pow(18),
            random_seed: vec![0, 1, 2],
            is_view: false,
            output_data_receivers: vec![],
            epoch_height: 0,
        }
    }

I'm using the above context.

What should I do if I want to deploy NEP21 tokens to the address "token.alice.near"?

Thanks.

1 Answers

This testing environment does not do any real deployment. You can specify token.alice.near as the current_account_id, so near_sdk::env::current_account_id() will report token.alice.near when you access it from your contract methods.

Related