mirror of
https://github.com/wharfkit/tutorial-todo-contract.git
synced 2026-07-21 17:43:37 +00:00
chore: switching to cdt-cpp
This commit is contained in:
@@ -11,7 +11,7 @@ node_modules:
|
||||
yarn install --non-interactive --frozen-lockfile
|
||||
|
||||
contract/%.abi: contract/%.cpp contract/%.contracts.md
|
||||
eosio-cpp -R contract -contract=$(notdir $(basename $<)) \
|
||||
cdt-cpp -R contract -contract=$(notdir $(basename $<)) \
|
||||
-abigen -abigen_output=$@ -o $(basename $<).wasm -O3 $<
|
||||
|
||||
src/contract-types.ts: contract/$(CONTRACT).abi
|
||||
@@ -21,7 +21,7 @@ src/contract-types.ts: contract/$(CONTRACT).abi
|
||||
contract: contract/$(CONTRACT).abi
|
||||
|
||||
.PHONY: deploy-contract
|
||||
deploy-contract: contract
|
||||
deploy-contract:
|
||||
cleos -u $(NODE_URL) set contract \
|
||||
$(CONTRACT_ACCOUNT) contract/ ${CONTRACT}.wasm ${CONTRACT}.abi
|
||||
|
||||
|
||||
+2
-2
@@ -55,7 +55,7 @@ public:
|
||||
require_auth(author);
|
||||
todos_table todos(_self, author.value);
|
||||
auto itr = todos.find(id);
|
||||
check(itr != todos.end(), "Todo not found");
|
||||
check(itr != todos.end(), "Todo was not found");
|
||||
check(itr->author == author, "You are not the author");
|
||||
todos.erase(itr);
|
||||
}
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
require_auth(author);
|
||||
todos_table todos(_self, author.value);
|
||||
auto itr = todos.find(id);
|
||||
check(itr != todos.end(), "Todo not found");
|
||||
check(itr != todos.end(), "Todo was not found");
|
||||
check(itr->author == author, "You are not the author");
|
||||
todos.modify(itr, _self, [&](todo_row &row) { // Contract pays for RAM
|
||||
row.completed = complete ? 1 : 0; // Set the todo as completed (1) or incomplete (0) based on the boolean value
|
||||
|
||||
Reference in New Issue
Block a user