Improvements & Project Suggestions

Welcome to the discussion thread about this lecture section. Here you can feel free to discuss the topic at hand and ask questions.

thecil:dogcontract:github

Some improvements im working in the dog contract, at this time, its not completed, but im working and researching in order to learn how to build a decent contract.

1st challenge is to learn how to manage tables with structs variables has vectors, from my understanding, it is the most simple and decent way to build your tables.

Next days ill be building the erase, modify actions.

2nd challenge is to learn how to insert time stamp or block timestamp on the table:

  • time stamps or block timestamps are need it in order to set future actions once a data has reach certain block or time. (planning to fed the dog with food, dogs can only be fed once or two per day)

3rd challenge is to learn how to build functions to get data from tables, in order to create a table explorer.

any suggestion is greatly accepted, also more contracts and web site to research more about eos smart contracts.
PD: will be all docummented when its finish, so it can be used (if filip aprove it) has another example for academy members.

UPDATE 12/2/2020: modify, erase and erase all has been added.
UPDATE 25/2/2020: time stamp added, no block number for now WHY?.

2 Likes

UPDATE 27/3/2020: been lazy with this, still improving it, im researching mostly the timestamp and time management, i change the hole structure of the contract, opinions would be awesome…

Hi @filip and @ivga80

I did the EOS101+201 course and started working on more complex smart contracts after. But in doing so I found I needed something more comprehensive than EOSStudio and a bit more friendly than running nodeos - like Truffle/Ganache in the Ethereum world.

What do you guys think of TypeScript test environments like:

Do you plan to introduce these kind of environments in the next iteration of the course?

1 Like

Hi.
We are currently working on an update of the EOS courses, but i’m not sure what kind of environments Filip will introduce in the next iteration of the EOS courses. But all suggestions are appreciated.

Ivo

Thanks for the feedback Ivo!

1 Like

Hi Filip,

I recently joined the Ivan o Tech Academy, hoping to improve my skills and learn more about EOS smart contract development. I have a general idea about most things, however I am finding it difficult to continue due to the fact the dog/pet contract from EOS 101 has been updated and is now different from the dog/pet contract in EOS 201. I have tried to follow along and modify the existing contract from EOS 101 but I seem to be running into a few issues which has brought my course to a halt.
Is the EOS 201 course scheduled to be updated, with a new contract to match the EOS 101 course allowing new course users to continue ?

1 Like

Hello sir, congratulations on finishing the EOS 101 course!

Now the EOS 201 update is not planned for now, but it will come at any moment.
I have my personal notes over the EOS 201 course, here you can find 2 smart contracts (cpp files) that are 100% compatible with the EOS 201 course, you can use them as example to fix your contract, or you can take it for yourself.
thecil-github-EOSCoding

Hope you find this useful. :slight_smile:

If you have any doubt, please let us know so we can help you!

Carlos Z.

Thank you very much :hugs:

Im not sure where Im still going wrong or if its an issue with the contract, Im still experiencing the same error when trying to send tokens to the dogcontract. I cloned the dogcontractTOKEN.cpp from github, compiled and deployed to my node without any changes… I created some DOGCOIN, issued them, transferred them to a seperate account (tycen) and then attempted to transfer DOGCOIN to dogcontract.
Im getting the error “Not the right coin”, meaning quantity.symbol != currency_symbol when it fact it does, so I am baffled.

CONTRACT dogcontract : public contract {
public:
using contract::contract;
dogcontract(name receiver, name code, datastream<const char*> ds)
:contract(receiver, code, ds)
, currency_symbol(“DOGCOIN”, 0){}


users-iMac:dogcontract user$ cleos push action eosio.token issue ‘[“eosio.token”, “1000.0000 DOGCOIN”, “issue 1000 DOGCOIN”]’ -p eosio.token@active
executed transaction: 0aeaa754299e3ccc20559a1f4e446ff7f36b6aec2f7e904f9a03c2cfad22a4db 136 bytes 250 us

eosio.token <= eosio.token::issue {“to”:“eosio.token”,“quantity”:“1000.0000 DOGCOIN”,“memo”:“issue 10000 DOGCOIN”}

warning: transaction executed locally, but may not be confirmed by the network yet ]
users-iMac:dogcontract user$ cleos transfer eosio.token tycen “200 DOGCOIN” “memmeo” -p eosio.token@active
executed transaction: 0902c4d2303717ac63b509873ee3d22616e773b3d006ca8c2f59a6e045d8faa1 136 bytes 209 us

eosio.token <= eosio.token::transfer {“from”:“eosio.token”,“to”:“tycen”,“quantity”:“200.0000 DOGCOIN”,“memo”:“memmeo”}

tycen <= eosio.token::transfer {“from”:“eosio.token”,“to”:“tycen”,“quantity”:“200.0000 DOGCOIN”,“memo”:“memmeo”}

warning: transaction executed locally, but may not be confirmed by the network yet ]
users-iMac:dogcontract user$ cleos transfer tycen dogcontract “200 DOGCOIN” “memmo” -p tycen@active
Error 3050003: eosio_assert_message assertion failure
Error Details:
assertion failure with message: Not the right coin.

This was the same error I was getting when modifying the new contract from EOS101 and where I was getting stuck before. It totally doesn’t make sense to me :sob:

1 Like

Scratch that :grin:

Issue was that I created the token with 4 decimals… after modifying the constructor to currency_symbol(“DOGCOIN”,4) all is good :ok_hand:

1 Like

Glad to see you find the answer by yourself! congratulations! :muscle:

If you have any doubt, please let us know so we can help you! :slight_smile:

Carlos Z.

I am yet to finish the course, at the time of writing (22/32 lessons completed). I feel as though while going through the whole pets table setup etc… there were some new syntax and EOS functions not seen before which could have been explained.

For example:

It was not explained why we needed an empty constructor pet_t(){}. What purpose does the empty constructor serve? Is it not obsolete when we are not using it?

In the screenshot above there is a different kind of way towards defining a constructor via the use of : followed by property(parameter) assignment which was not seen before in the C++ Programming course.

  • image

A little explanation about EOSLIB_SERIALIZE and why we need to serialize all members of the class.

*

What does emplace do?