I have got contract code below:
#include <eosiolib/eosio.hpp>
#include <eosiolib/print.hpp>
using namespace std;
using namespace eosio;
class deneme: contract {
// @abi table
struct countries {
name sender;
string country;
name primary_key() const { return sender; }
EOSLIB_SERIALIZE( countries, (sender)(country) )
};
public:
deneme(account_name self):
contract(self),
_countries(_self, _self) {}
multi_index< N(countries), countries > _countries;
// @abi action
void myaction(name sender,string country) {
// add to table, first argument is account to bill for storage
_countries.emplace(sender, [&](auto& row) {
row.sender = sender;
row.country = country;
});
}
};
EOSIO_ABI( deneme, (myaction) )
And generate wast and abi file with:
eosiocpp -o deneme.wast deneme.cpp
eosiocpp -g deneme.abi deneme.cpp
Deploy contract with (there was no change on nodeos terminal when setting contract):
cleos set contract eosio ../deneme -p eosio
Finally I try to push action like :
cleos push action deneme myaction '{"sender":"eosio","country":"anywhere"}' -p eosio
I've got an error below :
Error 3060004: Contract Query Exception
Most likely, the given contract doesnt' exist in the blockchain.
nodeos says:
162072ms thread-0 http_plugin.cpp:405 handle_exception]
FC Exception encountered while processing chain.abi_json_to_bin
162072ms thread-0 http_plugin.cpp:406 handle_exception]
Exception Details: 3060004 contract_query_exception: Contract Query
Exception
Contract can't be found deneme
{"contract":"deneme"}threadchain_plugin.cpp:1103 abi_json_to_bin{"params.code":"deneme","params.action":"myaction","params.args
{"sender":"eosio","country":"istanbul"}}thread-0 chain_plugin.cpp:1119 abi_json_to_bin
Also when I set contract nodeos says nothing (no changes on nodeos terminal). Where am I doing wrong?