Register Modifiers

In the previous chapters we already saw instructions that modified the XCVM registers. This chapter contains more instructions that change the XCVM registers. We will discuss the following instructions:

  • SetErrorHandler
  • SetAppendixHandler
  • ClearError
  • ClearTransactStatus
  • SetTopic
  • ClearTopic

SetErrorHandler

#![allow(unused)]
fn main() {
SetErrorHandler(Xcm<Call>)
}

The SetErrorHandler instructions is used to set the Error Handler Register. As discussed in the XCVM chapter, the Error Handler is executed when an error is thrown during the regular instruction execution.

SetAppendix

#![allow(unused)]
fn main() {
SetAppendix(Xcm<Call>)
}

The SetAppendix instruction is used to set the Appendix Register. As discussed in the XCVM chapter, the Appendix instructions are executed after the regular and error handler instruction are executed. These instructions are executed regardless of whether an error occurred.

ClearError

#![allow(unused)]
fn main() {
ClearError
}

The ClearError instruction clears the Error Register by setting it to None.

ClearTransactStatus

#![allow(unused)]
fn main() {
ClearTransactStatus
}

The ClearTransactStatus instruction sets the Transact Status Register to its default, cleared, value.

SetTopic

#![allow(unused)]
fn main() {
SetTopic([u8; 32])
}

The SetTopic instruction sets the Topic Register.

ClearTopic

#![allow(unused)]
fn main() {
ClearTopic
}

The ClearTopic instruction clears the Topic Register.