0

I'm attempting to follow this guide, which seems official: https://developers.eos.io/eosio-home/docs/token-contract and which begins by grabbing the v1.4.0 branch of the EOSIO contracts:

git clone https://github.com/EOSIO/eosio.contracts --branch v1.4.0 --single-branch

in looking at the code I discovered that line 133 contains a reference to same_payer, what seems like an undeclared variable (if it's declared, I don't see where):

$ head -n 133 eosio.token.cpp |tail -n 1

to_acnts.modify( to, same_payer, [&]( auto& a ) {

now, I decided to pull the code from github directly, for this version:

https://github.com/EOSIO/eos/blob/v1.4.0/contracts/eosio.token/eosio.token.cpp

but curiously, that file is totally different (to begin with, it only has 120 lines) and contains a 0 instead:

to_acnts.modify( to, 0, [&]( auto& a ) {

so I have 2 questions:

1) am I pulling the wrong version from github (via the link) and if so, what is the proper way to do it? and

2) how can the code compile when it's making a reference to a variable that hasn't been declared?

2

It seems that you are using outdated eosio.cdt. eosio::same_payer is declared in multi_index.hpp.

Upgrade eosio.cdt from here.

The latest version of eosio.cdt is 1.4.1.

  • I have 1.4.1 installed (brew info eosio.cdt produces "eosio.cdt: stable 1.4.1 (bottled)") – ekkis Jan 11 at 20:46
  • actually, that makes sense, if I look in /usr/local/Cellar/eosio.cdt/1.4.1/opt/eosio.cdt/include/eosiolib/multi_index.hpp I see the definition. so that explains why the code compiles. but that brings up another perplexing point: the guide I'm following uses v1.4.0 of the contract, which seems to know about the new same_payer. that would mean it's very current. is 1.4.0 then later than what's on the master branch? – ekkis Jan 11 at 21:06
  • @ekkis Do you mean contracts/eosiolib/multi_index.hpp in the master branch of github.com/EOSIO/eos? It was written for eosiocpp (not eosio-cpp) which is old compiler, but now contracts directory in eos repository is used for testing purpose only. contracts directory will be removed in 1.6.0 release and testing would use libraries provided by eosio.cdt repository. – conr2d Jan 12 at 13:05
  • I guess I'm trying to understand whether the v1.4.0 version of the contracts that the guide uses is later or earlier than the master branch. I guess if it's a branch then it has yet to be merged into master and thus must be more recent. that would mean that the guide expects the latest version of things, which would be a good thing – ekkis Jan 14 at 0:27

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.