1

In the Address Book example I notice the contract structure is

#include <eosio/eosio.hpp>

using namespace eosio;

class [[eosio::contract("addressbook")]] addressbook : public eosio::contract {
  public:

  private: 

};

and in the Hello World example

#include <eosio/eosio.hpp>

using namespace eosio;

class [[eosio::contract]] hello : public contract {
  public:
     using contract::contract;
};

Notice public eosio::contract or public contract also notice contract("addressbook" and eosio::contract

What's the difference and/or why is there this inconsistency?

1

If you specify the optional string arguments (as in addressbook), then you are saying that the contract name on chain should be called "addressbook", regardless of the class names being used. It matters only for the creation of the ABI file with the generator.

As for whether it should have eosio:: before or not doesn't matter if the namespace is included, normal C++ rules apply in this case.

  • Thank you Phillip – Bill Jun 25 '19 at 6:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.