Skip to content
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
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: CI

on:
push:
branches: [ master, main ]
pull_request:
branches: [ master, main ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x

- name: Install Truffle
run: npm install -g truffle

- name: Install dependencies (Auction DApp Backend)
working-directory: code/auction_dapp/backend
run: npm install

- name: Compile Contracts (Auction DApp Backend)
working-directory: code/auction_dapp/backend
run: truffle compile
9 changes: 7 additions & 2 deletions code/OpenZeppelin/contracts/SampleCrowdsale.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
pragma solidity 0.4.23;
pragma solidity ^0.8.20;

// NOTE: Crowdsale contracts were removed from OpenZeppelin Contracts 4.x.
// This example serves as a reference for the book content but requires
// specific legacy libraries or a custom implementation to compile.

import './SampleToken.sol';
import 'openzeppelin-solidity/contracts/crowdsale/emission/MintedCrowdsale.sol';
Expand All @@ -8,7 +12,7 @@ contract SampleCrowdsale is PostDeliveryCrowdsale, MintedCrowdsale {

constructor(
uint256 _openingTime,
uint256 _closingTime
uint256 _closingTime,
uint256 _rate,
address _wallet,
MintableToken _token
Expand All @@ -19,3 +23,4 @@ contract SampleCrowdsale is PostDeliveryCrowdsale, MintedCrowdsale {
{
}
}
}
15 changes: 9 additions & 6 deletions code/OpenZeppelin/contracts/SampleToken.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
pragma solidity 0.4.23;
pragma solidity ^0.8.20;

import 'openzeppelin-solidity/contracts/token/ERC20/MintableToken.sol';
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract SampleToken is MintableToken {
string public name = "SAMPLE TOKEN";
string public symbol = "SAM";
uint8 public decimals = 18;
contract SampleToken is ERC20, Ownable {
constructor() ERC20("SAMPLE TOKEN", "SAM") Ownable(msg.sender) {}

function mint(address to, uint256 amount) public onlyOwner {
_mint(to, amount);
}
}
7 changes: 4 additions & 3 deletions code/Solidity/Faucet.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Our first contract is a faucet!
pragma solidity ^0.8.20;

contract Faucet {

// Give out ether to anyone who asks
Expand All @@ -8,10 +9,10 @@ contract Faucet {
require(withdraw_amount <= 100000000000000000);

// Send the amount to the address that requested it
msg.sender.transfer(withdraw_amount);
payable(msg.sender).transfer(withdraw_amount);
}

// Accept any incoming amount
function () public payable {}
receive() external payable {}

}
6 changes: 3 additions & 3 deletions code/Solidity/Faucet2.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Version of Solidity compiler this program was written for
pragma solidity ^0.4.19;
pragma solidity ^0.8.20;

// Our first contract is a faucet!
contract Faucet {
Expand All @@ -11,10 +11,10 @@ contract Faucet {
require(withdraw_amount <= 100000000000000000);

// Send the amount to the address that requested it
msg.sender.transfer(withdraw_amount);
payable(msg.sender).transfer(withdraw_amount);
}

// Accept any incoming amount
function () public payable {}
receive() external payable {}

}
8 changes: 4 additions & 4 deletions code/Solidity/Faucet3.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Version of Solidity compiler this program was written for
pragma solidity ^0.4.22;
pragma solidity ^0.8.20;

// Our first contract is a faucet!
contract Faucet {
Expand All @@ -14,7 +14,7 @@ contract Faucet {
// Contract destructor
function destroy() public {
require(msg.sender == owner);
selfdestruct(owner);
selfdestruct(payable(owner));
}

// Give out ether to anyone who asks
Expand All @@ -24,10 +24,10 @@ contract Faucet {
require(withdraw_amount <= 0.1 ether);

// Send the amount to the address that requested it
msg.sender.transfer(withdraw_amount);
payable(msg.sender).transfer(withdraw_amount);
}

// Accept any incoming amount
function () public payable {}
receive() external payable {}

}
8 changes: 4 additions & 4 deletions code/Solidity/Faucet4.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Version of Solidity compiler this program was written for
pragma solidity ^0.4.22;
pragma solidity ^0.8.20;

// Our first contract is a faucet!
contract Faucet {
Expand All @@ -19,7 +19,7 @@ contract Faucet {

// Contract destructor
function destroy() public onlyOwner {
selfdestruct(owner);
selfdestruct(payable(owner));
}

// Give out ether to anyone who asks
Expand All @@ -29,10 +29,10 @@ contract Faucet {
require(withdraw_amount <= 0.1 ether);

// Send the amount to the address that requested it
msg.sender.transfer(withdraw_amount);
payable(msg.sender).transfer(withdraw_amount);
}

// Accept any incoming amount
function () public payable {}
receive() external payable {}

}
8 changes: 4 additions & 4 deletions code/Solidity/Faucet5.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Version of Solidity compiler this program was written for
pragma solidity ^0.4.22;
pragma solidity ^0.8.20;

contract owned {
address owner;
Expand All @@ -17,7 +17,7 @@ contract owned {
contract mortal is owned {
// Contract destructor
function destroy() public onlyOwner {
selfdestruct(owner);
selfdestruct(payable(owner));
}
}

Expand All @@ -27,8 +27,8 @@ contract Faucet is mortal {
// Limit withdrawal amount
require(withdraw_amount <= 0.1 ether);
// Send the amount to the address that requested it
msg.sender.transfer(withdraw_amount);
payable(msg.sender).transfer(withdraw_amount);
}
// Accept any incoming amount
function () public payable {}
receive() external payable {}
}
8 changes: 4 additions & 4 deletions code/Solidity/Faucet6.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Version of Solidity compiler this program was written for
pragma solidity ^0.4.22;
pragma solidity ^0.8.20;

contract owned {
address owner;
Expand All @@ -17,7 +17,7 @@ contract owned {
contract mortal is owned {
// Contract destructor
function destroy() public onlyOwner {
selfdestruct(owner);
selfdestruct(payable(owner));
}
}

Expand All @@ -27,8 +27,8 @@ contract Faucet is mortal {
// Limit withdrawal amount
require(withdraw_amount <= 0.1 ether);
// Send the amount to the address that requested it
msg.sender.transfer(withdraw_amount);
payable(msg.sender).transfer(withdraw_amount);
}
// Accept any incoming amount
function () public payable {}
receive() external payable {}
}
12 changes: 6 additions & 6 deletions code/Solidity/Faucet7.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Version of Solidity compiler this program was written for
pragma solidity ^0.4.22;
pragma solidity ^0.8.20;

contract owned {
address owner;
Expand All @@ -17,7 +17,7 @@ contract owned {
contract mortal is owned {
// Contract destructor
function destroy() public onlyOwner {
selfdestruct(owner);
selfdestruct(payable(owner));
}
}

Expand All @@ -26,11 +26,11 @@ contract Faucet is mortal {
function withdraw(uint withdraw_amount) public {
// Limit withdrawal amount
require(withdraw_amount <= 0.1 ether);
require(this.balance >= withdraw_amount,
"Insufficient balance in faucet for withdrawal request")
require(address(this).balance >= withdraw_amount,
"Insufficient balance in faucet for withdrawal request");
// Send the amount to the address that requested it
msg.sender.transfer(withdraw_amount);
payable(msg.sender).transfer(withdraw_amount);
}
// Accept any incoming amount
function () public payable {}
receive() external payable {}
}
10 changes: 5 additions & 5 deletions code/Solidity/Faucet8.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Version of Solidity compiler this program was written for
pragma solidity ^0.4.22;
pragma solidity ^0.8.20;

contract owned {
address owner;
Expand All @@ -17,7 +17,7 @@ contract owned {
contract mortal is owned {
// Contract destructor
function destroy() public onlyOwner {
selfdestruct(owner);
selfdestruct(payable(owner));
}
}

Expand All @@ -29,14 +29,14 @@ contract Faucet is mortal {
function withdraw(uint withdraw_amount) public {
// Limit withdrawal amount
require(withdraw_amount <= 0.1 ether);
require(this.balance >= withdraw_amount,
require(address(this).balance >= withdraw_amount,
"Insufficient balance in faucet for withdrawal request");
// Send the amount to the address that requested it
msg.sender.transfer(withdraw_amount);
payable(msg.sender).transfer(withdraw_amount);
emit Withdrawal(msg.sender, withdraw_amount);
}
// Accept any incoming amount
function () public payable {
receive() external payable {
emit Deposit(msg.sender, msg.value);
}
}
4 changes: 2 additions & 2 deletions code/Solidity/Token.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import "Faucet.sol"
import "./Faucet8.sol";

contract Token is mortal {

Faucet _faucet;

constructor(address _f) {
_faucet = Faucet(_f);
_faucet.withdraw(0.1 ether)
_faucet.withdraw(0.1 ether);
}
}
Loading