Skip to content

Commit

Permalink
blockchain
Browse files Browse the repository at this point in the history
  • Loading branch information
bliutech committed Oct 2, 2022
1 parent 1542f8a commit 8fc8668
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 1,897 deletions.
12 changes: 8 additions & 4 deletions blockchain/contracts/Articles.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
pragma solidity ^0.5.0;

contract Articles {
uint public articleCount = 0;
Expand All @@ -12,21 +12,25 @@ contract Articles {
}

mapping(uint => Article) public articles;
// Article[] public articles;

event ArticleCreated(
uint id,
uint datetime,
string author,
string content
string content,
string value
);

constructor() {
constructor() public {
createArticle(100, "Benson", "# hello world");
// createArticle(1000, "alskdj", "# hello asdl;kasjld");
// createArticle(1200, "asdasdalskdj", "# hello asdl;kasjldasdasd");
}

function createArticle(uint _datetime, string memory _author, string memory _content) public {
articleCount++;
articles[articleCount] = Article(articleCount, _datetime, _author, _content);
emit ArticleCreated(articleCount, _datetime, _author, _content);
emit ArticleCreated(articleCount, _datetime, _author, _content, articles[articleCount].content);
}
}
6 changes: 4 additions & 2 deletions blockchain/contracts/Edits.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
pragma solidity ^0.5.16;

contract Edits{
uint editCount = 0;
Expand All @@ -13,6 +13,8 @@ contract Edits{

mapping(uint => Edit) public edits;

constructor() {}
constructor() public {

}

}
6 changes: 3 additions & 3 deletions blockchain/contracts/Migrations.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
pragma solidity >=0.4.21 <0.6.0;

contract Migrations {
address public owner;
uint public last_completed_migration;

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

Expand All @@ -21,4 +21,4 @@ contract Migrations {
Migrations upgraded = Migrations(new_address);
upgraded.setCompleted(last_completed_migration);
}
}
}
File renamed without changes.
5 changes: 5 additions & 0 deletions blockchain/migrations/2_deploy_contracts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var Articles = artifacts.require("./Articles.sol");

module.exports = function(deployer) {
deployer.deploy(Articles);
};
5 changes: 0 additions & 5 deletions blockchain/migrations/deploy_contracts.js

This file was deleted.

Loading

0 comments on commit 8fc8668

Please sign in to comment.