diff --git a/generated/contract/include/mmx/contract/Identity.hxx b/generated/contract/include/mmx/contract/Identity.hxx deleted file mode 100644 index fff029537..000000000 --- a/generated/contract/include/mmx/contract/Identity.hxx +++ /dev/null @@ -1,85 +0,0 @@ - -// AUTO GENERATED by vnxcppcodegen - -#ifndef INCLUDE_mmx_contract_Identity_HXX_ -#define INCLUDE_mmx_contract_Identity_HXX_ - -#include -#include -#include -#include - - -namespace mmx { -namespace contract { - -class MMX_CONTRACT_EXPORT Identity : public ::mmx::Contract { -public: - - ::mmx::addr_t entity; - ::mmx::addr_t authority; - std::shared_ptr solution; - - typedef ::mmx::Contract Super; - - static const vnx::Hash64 VNX_TYPE_HASH; - static const vnx::Hash64 VNX_CODE_HASH; - - static constexpr uint64_t VNX_TYPE_ID = 0x69710dd250a33c5eull; - - Identity() {} - - vnx::Hash64 get_type_hash() const override; - std::string get_type_name() const override; - const vnx::TypeCode* get_type_code() const override; - - static std::shared_ptr create(); - std::shared_ptr clone() const override; - - void read(vnx::TypeInput& _in, const vnx::TypeCode* _type_code, const uint16_t* _code) override; - void write(vnx::TypeOutput& _out, const vnx::TypeCode* _type_code, const uint16_t* _code) const override; - - void read(std::istream& _in) override; - void write(std::ostream& _out) const override; - - template - void accept_generic(T& _visitor) const; - void accept(vnx::Visitor& _visitor) const override; - - vnx::Object to_object() const override; - void from_object(const vnx::Object& object) override; - - vnx::Variant get_field(const std::string& name) const override; - void set_field(const std::string& name, const vnx::Variant& value) override; - - friend std::ostream& operator<<(std::ostream& _out, const Identity& _value); - friend std::istream& operator>>(std::istream& _in, Identity& _value); - - static const vnx::TypeCode* static_get_type_code(); - static std::shared_ptr static_create_type_code(); - -protected: - std::shared_ptr vnx_call_switch(std::shared_ptr _method) override; - -}; - -template -void Identity::accept_generic(T& _visitor) const { - _visitor.template type_begin(4); - _visitor.type_field("version", 0); _visitor.accept(version); - _visitor.type_field("entity", 1); _visitor.accept(entity); - _visitor.type_field("authority", 2); _visitor.accept(authority); - _visitor.type_field("solution", 3); _visitor.accept(solution); - _visitor.template type_end(4); -} - - -} // namespace mmx -} // namespace contract - - -namespace vnx { - -} // vnx - -#endif // INCLUDE_mmx_contract_Identity_HXX_ diff --git a/generated/contract/include/mmx/contract/accept_generic.hxx b/generated/contract/include/mmx/contract/accept_generic.hxx index b2a8efd70..c5a83afec 100644 --- a/generated/contract/include/mmx/contract/accept_generic.hxx +++ b/generated/contract/include/mmx/contract/accept_generic.hxx @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include @@ -48,15 +47,6 @@ void accept_generic(V& visitor, std::shared_ptr -void accept_generic(V& visitor, std::shared_ptr value) { - if(value) { - value->accept_generic(visitor); - } else { - visitor.accept(nullptr); - } -} - template void accept_generic(V& visitor, std::shared_ptr value) { if(value) { diff --git a/generated/contract/include/mmx/contract/package.hxx b/generated/contract/include/mmx/contract/package.hxx index 0d70fa332..e42b50427 100644 --- a/generated/contract/include/mmx/contract/package.hxx +++ b/generated/contract/include/mmx/contract/package.hxx @@ -27,7 +27,6 @@ void register_all_types(); class Binary; class Data; class Executable; -class Identity; class MultiSig; class PubKey; class TokenBase; @@ -38,7 +37,6 @@ struct method_t; MMX_CONTRACT_EXPORT extern const vnx::TypeCode* const vnx_native_type_code_Binary; ///< \private MMX_CONTRACT_EXPORT extern const vnx::TypeCode* const vnx_native_type_code_Data; ///< \private MMX_CONTRACT_EXPORT extern const vnx::TypeCode* const vnx_native_type_code_Executable; ///< \private -MMX_CONTRACT_EXPORT extern const vnx::TypeCode* const vnx_native_type_code_Identity; ///< \private MMX_CONTRACT_EXPORT extern const vnx::TypeCode* const vnx_native_type_code_MultiSig; ///< \private MMX_CONTRACT_EXPORT extern const vnx::TypeCode* const vnx_native_type_code_PubKey; ///< \private MMX_CONTRACT_EXPORT extern const vnx::TypeCode* const vnx_native_type_code_TokenBase; ///< \private @@ -55,7 +53,6 @@ namespace vnx { void read(TypeInput& in, ::mmx::contract::Binary& value, const TypeCode* type_code, const uint16_t* code); ///< \private void read(TypeInput& in, ::mmx::contract::Data& value, const TypeCode* type_code, const uint16_t* code); ///< \private void read(TypeInput& in, ::mmx::contract::Executable& value, const TypeCode* type_code, const uint16_t* code); ///< \private -void read(TypeInput& in, ::mmx::contract::Identity& value, const TypeCode* type_code, const uint16_t* code); ///< \private void read(TypeInput& in, ::mmx::contract::MultiSig& value, const TypeCode* type_code, const uint16_t* code); ///< \private void read(TypeInput& in, ::mmx::contract::PubKey& value, const TypeCode* type_code, const uint16_t* code); ///< \private void read(TypeInput& in, ::mmx::contract::TokenBase& value, const TypeCode* type_code, const uint16_t* code); ///< \private @@ -66,7 +63,6 @@ void read(TypeInput& in, ::mmx::contract::method_t& value, const TypeCode* type_ void write(TypeOutput& out, const ::mmx::contract::Binary& value, const TypeCode* type_code, const uint16_t* code); ///< \private void write(TypeOutput& out, const ::mmx::contract::Data& value, const TypeCode* type_code, const uint16_t* code); ///< \private void write(TypeOutput& out, const ::mmx::contract::Executable& value, const TypeCode* type_code, const uint16_t* code); ///< \private -void write(TypeOutput& out, const ::mmx::contract::Identity& value, const TypeCode* type_code, const uint16_t* code); ///< \private void write(TypeOutput& out, const ::mmx::contract::MultiSig& value, const TypeCode* type_code, const uint16_t* code); ///< \private void write(TypeOutput& out, const ::mmx::contract::PubKey& value, const TypeCode* type_code, const uint16_t* code); ///< \private void write(TypeOutput& out, const ::mmx::contract::TokenBase& value, const TypeCode* type_code, const uint16_t* code); ///< \private @@ -77,7 +73,6 @@ void write(TypeOutput& out, const ::mmx::contract::method_t& value, const TypeCo void read(std::istream& in, ::mmx::contract::Binary& value); ///< \private void read(std::istream& in, ::mmx::contract::Data& value); ///< \private void read(std::istream& in, ::mmx::contract::Executable& value); ///< \private -void read(std::istream& in, ::mmx::contract::Identity& value); ///< \private void read(std::istream& in, ::mmx::contract::MultiSig& value); ///< \private void read(std::istream& in, ::mmx::contract::PubKey& value); ///< \private void read(std::istream& in, ::mmx::contract::TokenBase& value); ///< \private @@ -88,7 +83,6 @@ void read(std::istream& in, ::mmx::contract::method_t& value); ///< \private void write(std::ostream& out, const ::mmx::contract::Binary& value); ///< \private void write(std::ostream& out, const ::mmx::contract::Data& value); ///< \private void write(std::ostream& out, const ::mmx::contract::Executable& value); ///< \private -void write(std::ostream& out, const ::mmx::contract::Identity& value); ///< \private void write(std::ostream& out, const ::mmx::contract::MultiSig& value); ///< \private void write(std::ostream& out, const ::mmx::contract::PubKey& value); ///< \private void write(std::ostream& out, const ::mmx::contract::TokenBase& value); ///< \private @@ -99,7 +93,6 @@ void write(std::ostream& out, const ::mmx::contract::method_t& value); ///< \pri void accept(Visitor& visitor, const ::mmx::contract::Binary& value); ///< \private void accept(Visitor& visitor, const ::mmx::contract::Data& value); ///< \private void accept(Visitor& visitor, const ::mmx::contract::Executable& value); ///< \private -void accept(Visitor& visitor, const ::mmx::contract::Identity& value); ///< \private void accept(Visitor& visitor, const ::mmx::contract::MultiSig& value); ///< \private void accept(Visitor& visitor, const ::mmx::contract::PubKey& value); ///< \private void accept(Visitor& visitor, const ::mmx::contract::TokenBase& value); ///< \private @@ -114,8 +107,6 @@ void accept_generic(V& visitor, std::shared_ptr val template void accept_generic(V& visitor, std::shared_ptr value); ///< \private template -void accept_generic(V& visitor, std::shared_ptr value); ///< \private -template void accept_generic(V& visitor, std::shared_ptr value); ///< \private template void accept_generic(V& visitor, std::shared_ptr value); ///< \private @@ -195,29 +186,6 @@ struct type<::mmx::contract::Executable> { void create_dynamic_code(std::vector& code, const ::mmx::contract::Executable& value, bool special = false); }; -/// \private -template<> -struct type<::mmx::contract::Identity> { - void read(TypeInput& in, ::mmx::contract::Identity& value, const TypeCode* type_code, const uint16_t* code) { - vnx::read(in, value, type_code, code); - } - void write(TypeOutput& out, const ::mmx::contract::Identity& value, const TypeCode* type_code, const uint16_t* code) { - vnx::write(out, value, type_code, code); - } - void read(std::istream& in, ::mmx::contract::Identity& value) { - vnx::read(in, value); - } - void write(std::ostream& out, const ::mmx::contract::Identity& value) { - vnx::write(out, value); - } - void accept(Visitor& visitor, const ::mmx::contract::Identity& value) { - vnx::accept(visitor, value); - } - const TypeCode* get_type_code(); - void create_dynamic_code(std::vector& code); - void create_dynamic_code(std::vector& code, const ::mmx::contract::Identity& value, bool special = false); -}; - /// \private template<> struct type<::mmx::contract::MultiSig> { diff --git a/generated/contract/src/Identity.cpp b/generated/contract/src/Identity.cpp deleted file mode 100644 index 5b3e1ebb1..000000000 --- a/generated/contract/src/Identity.cpp +++ /dev/null @@ -1,276 +0,0 @@ - -// AUTO GENERATED by vnxcppcodegen - -#include -#include -#include -#include -#include - -#include - - -namespace mmx { -namespace contract { - - -const vnx::Hash64 Identity::VNX_TYPE_HASH(0x69710dd250a33c5eull); -const vnx::Hash64 Identity::VNX_CODE_HASH(0x21aac14c6869b22aull); - -vnx::Hash64 Identity::get_type_hash() const { - return VNX_TYPE_HASH; -} - -std::string Identity::get_type_name() const { - return "mmx.contract.Identity"; -} - -const vnx::TypeCode* Identity::get_type_code() const { - return mmx::contract::vnx_native_type_code_Identity; -} - -std::shared_ptr Identity::create() { - return std::make_shared(); -} - -std::shared_ptr Identity::clone() const { - return std::make_shared(*this); -} - -void Identity::read(vnx::TypeInput& _in, const vnx::TypeCode* _type_code, const uint16_t* _code) { - vnx::read(_in, *this, _type_code, _code); -} - -void Identity::write(vnx::TypeOutput& _out, const vnx::TypeCode* _type_code, const uint16_t* _code) const { - vnx::write(_out, *this, _type_code, _code); -} - -void Identity::accept(vnx::Visitor& _visitor) const { - const vnx::TypeCode* _type_code = mmx::contract::vnx_native_type_code_Identity; - _visitor.type_begin(*_type_code); - _visitor.type_field(_type_code->fields[0], 0); vnx::accept(_visitor, version); - _visitor.type_field(_type_code->fields[1], 1); vnx::accept(_visitor, entity); - _visitor.type_field(_type_code->fields[2], 2); vnx::accept(_visitor, authority); - _visitor.type_field(_type_code->fields[3], 3); vnx::accept(_visitor, solution); - _visitor.type_end(*_type_code); -} - -void Identity::write(std::ostream& _out) const { - _out << "{\"__type\": \"mmx.contract.Identity\""; - _out << ", \"version\": "; vnx::write(_out, version); - _out << ", \"entity\": "; vnx::write(_out, entity); - _out << ", \"authority\": "; vnx::write(_out, authority); - _out << ", \"solution\": "; vnx::write(_out, solution); - _out << "}"; -} - -void Identity::read(std::istream& _in) { - if(auto _json = vnx::read_json(_in)) { - from_object(_json->to_object()); - } -} - -vnx::Object Identity::to_object() const { - vnx::Object _object; - _object["__type"] = "mmx.contract.Identity"; - _object["version"] = version; - _object["entity"] = entity; - _object["authority"] = authority; - _object["solution"] = solution; - return _object; -} - -void Identity::from_object(const vnx::Object& _object) { - for(const auto& _entry : _object.field) { - if(_entry.first == "authority") { - _entry.second.to(authority); - } else if(_entry.first == "entity") { - _entry.second.to(entity); - } else if(_entry.first == "solution") { - _entry.second.to(solution); - } else if(_entry.first == "version") { - _entry.second.to(version); - } - } -} - -vnx::Variant Identity::get_field(const std::string& _name) const { - if(_name == "version") { - return vnx::Variant(version); - } - if(_name == "entity") { - return vnx::Variant(entity); - } - if(_name == "authority") { - return vnx::Variant(authority); - } - if(_name == "solution") { - return vnx::Variant(solution); - } - return vnx::Variant(); -} - -void Identity::set_field(const std::string& _name, const vnx::Variant& _value) { - if(_name == "version") { - _value.to(version); - } else if(_name == "entity") { - _value.to(entity); - } else if(_name == "authority") { - _value.to(authority); - } else if(_name == "solution") { - _value.to(solution); - } -} - -/// \private -std::ostream& operator<<(std::ostream& _out, const Identity& _value) { - _value.write(_out); - return _out; -} - -/// \private -std::istream& operator>>(std::istream& _in, Identity& _value) { - _value.read(_in); - return _in; -} - -const vnx::TypeCode* Identity::static_get_type_code() { - const vnx::TypeCode* type_code = vnx::get_type_code(VNX_TYPE_HASH); - if(!type_code) { - type_code = vnx::register_type_code(static_create_type_code()); - } - return type_code; -} - -std::shared_ptr Identity::static_create_type_code() { - auto type_code = std::make_shared(); - type_code->name = "mmx.contract.Identity"; - type_code->type_hash = vnx::Hash64(0x69710dd250a33c5eull); - type_code->code_hash = vnx::Hash64(0x21aac14c6869b22aull); - type_code->is_native = true; - type_code->is_class = true; - type_code->native_size = sizeof(::mmx::contract::Identity); - type_code->parents.resize(1); - type_code->parents[0] = ::mmx::Contract::static_get_type_code(); - type_code->create_value = []() -> std::shared_ptr { return std::make_shared(); }; - type_code->fields.resize(4); - { - auto& field = type_code->fields[0]; - field.data_size = 4; - field.name = "version"; - field.code = {3}; - } - { - auto& field = type_code->fields[1]; - field.is_extended = true; - field.name = "entity"; - field.code = {11, 32, 1}; - } - { - auto& field = type_code->fields[2]; - field.is_extended = true; - field.name = "authority"; - field.code = {11, 32, 1}; - } - { - auto& field = type_code->fields[3]; - field.is_extended = true; - field.name = "solution"; - field.code = {16}; - } - type_code->build(); - return type_code; -} - -std::shared_ptr Identity::vnx_call_switch(std::shared_ptr _method) { - switch(_method->get_type_hash()) { - } - return nullptr; -} - - -} // namespace mmx -} // namespace contract - - -namespace vnx { - -void read(TypeInput& in, ::mmx::contract::Identity& value, const TypeCode* type_code, const uint16_t* code) { - if(code) { - switch(code[0]) { - case CODE_OBJECT: - case CODE_ALT_OBJECT: { - Object tmp; - vnx::read(in, tmp, type_code, code); - value.from_object(tmp); - return; - } - case CODE_DYNAMIC: - case CODE_ALT_DYNAMIC: - vnx::read_dynamic(in, value); - return; - } - } - if(!type_code) { - vnx::skip(in, type_code, code); - return; - } - if(code) { - switch(code[0]) { - case CODE_STRUCT: type_code = type_code->depends[code[1]]; break; - case CODE_ALT_STRUCT: type_code = type_code->depends[vnx::flip_bytes(code[1])]; break; - default: { - vnx::skip(in, type_code, code); - return; - } - } - } - const auto* const _buf = in.read(type_code->total_field_size); - if(type_code->is_matched) { - if(const auto* const _field = type_code->field_map[0]) { - vnx::read_value(_buf + _field->offset, value.version, _field->code.data()); - } - } - for(const auto* _field : type_code->ext_fields) { - switch(_field->native_index) { - case 1: vnx::read(in, value.entity, type_code, _field->code.data()); break; - case 2: vnx::read(in, value.authority, type_code, _field->code.data()); break; - case 3: vnx::read(in, value.solution, type_code, _field->code.data()); break; - default: vnx::skip(in, type_code, _field->code.data()); - } - } -} - -void write(TypeOutput& out, const ::mmx::contract::Identity& value, const TypeCode* type_code, const uint16_t* code) { - if(code && code[0] == CODE_OBJECT) { - vnx::write(out, value.to_object(), nullptr, code); - return; - } - if(!type_code || (code && code[0] == CODE_ANY)) { - type_code = mmx::contract::vnx_native_type_code_Identity; - out.write_type_code(type_code); - vnx::write_class_header<::mmx::contract::Identity>(out); - } - else if(code && code[0] == CODE_STRUCT) { - type_code = type_code->depends[code[1]]; - } - auto* const _buf = out.write(4); - vnx::write_value(_buf + 0, value.version); - vnx::write(out, value.entity, type_code, type_code->fields[1].code.data()); - vnx::write(out, value.authority, type_code, type_code->fields[2].code.data()); - vnx::write(out, value.solution, type_code, type_code->fields[3].code.data()); -} - -void read(std::istream& in, ::mmx::contract::Identity& value) { - value.read(in); -} - -void write(std::ostream& out, const ::mmx::contract::Identity& value) { - value.write(out); -} - -void accept(Visitor& visitor, const ::mmx::contract::Identity& value) { - value.accept(visitor); -} - -} // vnx diff --git a/generated/contract/src/package.cpp b/generated/contract/src/package.cpp index 3b6047604..ac2f3039f 100644 --- a/generated/contract/src/package.cpp +++ b/generated/contract/src/package.cpp @@ -4,7 +4,6 @@ #include #include #include -#include #include #include #include @@ -55,18 +54,6 @@ void type<::mmx::contract::Executable>::create_dynamic_code(std::vector::get_type_code() { - return mmx::contract::vnx_native_type_code_Identity; -} - -void type<::mmx::contract::Identity>::create_dynamic_code(std::vector& code) { - create_dynamic_code(code, ::mmx::contract::Identity()); -} - -void type<::mmx::contract::Identity>::create_dynamic_code(std::vector& code, const ::mmx::contract::Identity& value, bool special) { - code.push_back(CODE_OBJECT); -} - const TypeCode* type<::mmx::contract::MultiSig>::get_type_code() { return mmx::contract::vnx_native_type_code_MultiSig; } @@ -151,7 +138,6 @@ void register_all_types() { vnx::register_type_code(::mmx::contract::Binary::static_create_type_code()); vnx::register_type_code(::mmx::contract::Data::static_create_type_code()); vnx::register_type_code(::mmx::contract::Executable::static_create_type_code()); - vnx::register_type_code(::mmx::contract::Identity::static_create_type_code()); vnx::register_type_code(::mmx::contract::MultiSig::static_create_type_code()); vnx::register_type_code(::mmx::contract::PubKey::static_create_type_code()); vnx::register_type_code(::mmx::contract::TokenBase::static_create_type_code()); @@ -169,7 +155,6 @@ static struct vnx_static_init { const vnx::TypeCode* const vnx_native_type_code_Binary = vnx::get_type_code(vnx::Hash64(0xbbeba47fc8b740e5ull)); const vnx::TypeCode* const vnx_native_type_code_Data = vnx::get_type_code(vnx::Hash64(0xadfeee3822244f50ull)); const vnx::TypeCode* const vnx_native_type_code_Executable = vnx::get_type_code(vnx::Hash64(0xfa6a3ac9103ebb12ull)); -const vnx::TypeCode* const vnx_native_type_code_Identity = vnx::get_type_code(vnx::Hash64(0x69710dd250a33c5eull)); const vnx::TypeCode* const vnx_native_type_code_MultiSig = vnx::get_type_code(vnx::Hash64(0x7d674c5f7297dedull)); const vnx::TypeCode* const vnx_native_type_code_PubKey = vnx::get_type_code(vnx::Hash64(0x9b3cd508d7f41423ull)); const vnx::TypeCode* const vnx_native_type_code_TokenBase = vnx::get_type_code(vnx::Hash64(0x5aeed4c96d232b5eull)); diff --git a/interface/contract/Identity.vni b/interface/contract/Identity.vni deleted file mode 100644 index 6366c1480..000000000 --- a/interface/contract/Identity.vni +++ /dev/null @@ -1,13 +0,0 @@ -package mmx.contract; - -import mmx.addr_t; - -class Identity extends mmx.Contract { - - addr_t entity; - - addr_t authority; - - mmx.Solution* solution; - -}