Skip to content

Latest commit

 

History

History
79 lines (61 loc) · 2.23 KB

WASM_MIGRATE.md

File metadata and controls

79 lines (61 loc) · 2.23 KB

Wasm Migration Guide from Terra Classic

Terra Rebirth is now using wasm module of wasmd and it introduces minor compatibility issue with Terra Classic.

Contract Address

Contract Address length will be different from normal account.

// VerifyAddressLen ensures that the address matches the expected length
// ContractAddrLen = 32
// SDKAddrLen = 20
func VerifyAddressLen() func(addr []byte) error {
	return func(addr []byte) error {
		if len(addr) != ContractAddrLen && len(addr) != SDKAddrLen {
			return sdkerrors.ErrInvalidAddress
		}
		return nil
	}
}

Store

Permission

A code uploader can specify the permission of code for instantiation

const (
	// AccessTypeUnspecified placeholder for empty value
	AccessTypeUnspecified AccessType = 0
	// AccessTypeNobody forbidden
	AccessTypeNobody AccessType = 1
	// AccessTypeOnlyAddress restricted to an address
	AccessTypeOnlyAddress AccessType = 2
	// AccessTypeEverybody unrestricted
	AccessTypeEverybody AccessType = 3
)

Instantiate

Reply

The contracts, which are using reply to check instantiated contract address, should update the proto file to the following.

// MsgInstantiateContractResponse return instantiation result data
message MsgInstantiateContractResponse {
  // Address is the bech32 address of the new contract instance.
  string address = 1;
  // Data contains base64-encoded bytes to returned from the contract
  bytes data = 2;
}

Ex) terraswap/terraswap#47

Event

Event key for instantiated contract also should be changed from instantiate.contract_address to instantiate._contract_address.

Label

Now label is used to represent the contract info

Burn Operation

CosmosMsg::Bank(BankMsg::Burn) is enabled

Execute

Event

Event key for instantiated contract also should be changed from execute.contract_address to execute._contract_address.

Migrate

Event

Event key for instantiated contract also should be changed from migrate.contract_address to migrate._contract_address.

Reply

Event

Event key for instantiated contract also should be changed from reply.contract_address to reply._contract_address.