Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in app.js #35

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# eth-todo-list
Blockchain Todo App Tutorial Powered by Ethereum Smart Contracts


TODO_:

1) 'Loading...' does not appears although there is no wallet/account connected. But when one tries to create a task, 'Loading...' appears.
3) After connecting to the site with a new account/wallet, one needs to refresh the page manually to be able to get rid of 'Loading..'
4) MetaMask does not ask if you want the 'Transaction' and how much you want to pay for that.
2 changes: 1 addition & 1 deletion bs-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
"/vendor": "./node_modules"
}
}
}
}
1,761 changes: 648 additions & 1,113 deletions build/contracts/Migrations.json

Large diffs are not rendered by default.

3,128 changes: 1,628 additions & 1,500 deletions build/contracts/TodoList.json

Large diffs are not rendered by default.

20 changes: 8 additions & 12 deletions contracts/Migrations.sol
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
pragma solidity >=0.4.21 <0.6.0;
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;

contract Migrations {
address public owner;
address public owner = msg.sender;
uint public last_completed_migration;

constructor() public {
owner = msg.sender;
}

modifier restricted() {
if (msg.sender == owner) _;
require(
msg.sender == owner,
"This function is restricted to the contract's owner"
);
_;
}

function setCompleted(uint completed) public restricted {
last_completed_migration = completed;
}

function upgrade(address new_address) public restricted {
Migrations upgraded = Migrations(new_address);
upgraded.setCompleted(last_completed_migration);
}
}
18 changes: 9 additions & 9 deletions contracts/TodoList.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pragma solidity ^0.5.0;
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;

contract TodoList {
uint public taskCount = 0;
Expand All @@ -9,11 +10,15 @@ contract TodoList {
bool completed;
}

constructor() public{
createTask('Example Task Intialized');
}

mapping(uint => Task) public tasks;

event TaskCreated(
uint id,
string content,
string content,
bool completed
);

Expand All @@ -22,12 +27,8 @@ contract TodoList {
bool completed
);

constructor() public {
createTask("Check out dappuniversity.com");
}

function createTask(string memory _content) public {
taskCount ++;
taskCount++;
tasks[taskCount] = Task(taskCount, _content, false);
emit TaskCreated(taskCount, _content, false);
}
Expand All @@ -38,5 +39,4 @@ contract TodoList {
tasks[_id] = _task;
emit TaskCompleted(_id, _task.completed);
}

}
}
4 changes: 2 additions & 2 deletions migrations/1_initial_migration.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var Migrations = artifacts.require("./Migrations.sol");
const Migrations = artifacts.require("Migrations");

module.exports = function(deployer) {
module.exports = function (deployer) {
deployer.deploy(Migrations);
};
4 changes: 2 additions & 2 deletions migrations/2_deploy_contracts.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var TodoList = artifacts.require("./TodoList.sol");
const TodoList = artifacts.require("TodoList");

module.exports = function(deployer) {
module.exports = function (deployer) {
deployer.deploy(TodoList);
};
Loading