一、合约编写(C++)
- 合约示例:
#include "xchain/xchain.h"
struct Counter : public xchain::Contract {
};
DEFINE_METHOD(Counter, initialize) {
xchain::Context* ctx = self.context();
const std::string& creator = ctx->arg("creator");
if (creator.empty()) {
ctx->error("missing creator");
return;
}
ctx->put_object("creator", creator);
ctx->ok("initialize succeed");
}
DEFINE_METHOD(Counter