Skip to content

Instantly share code, notes, and snippets.

@MajdT51
MajdT51 / docker-compose.ymal
Created December 14, 2019 10:38
proxy as service in the docker-compose
proxy:
restart: "on-failure"
build:
context: .
ports:
- "22003:7545"
- "22004:7546"
- "22005:7547"
networks:
quorum-simple-net:
@MajdT51
MajdT51 / Docker file
Created December 14, 2019 10:27
docker file for quorum-rpc-proxy
# use the 'node' official image
FROM node:8.16.2-alpine3.9
# expose ports 7545, 7546, 7547
EXPOSE 7545
EXPOSE 7546
EXPOSE 7547
# use alpine package manager to install git
RUN apk add --no-cache git
@MajdT51
MajdT51 / docker-compose.yml
Created December 8, 2019 13:28
complete version without proxy
# QUORUM_DOCKER_IMAGE: default to quorumengineering/quorum:2.3.0
# To use Remix, set QUORUM_GETH_ARGS="--rpccorsdomain https://remix.ethereum.org"
version: "3.6"
x-quorum-def:
&quorum-def
restart: "on-failure"
image: "${QUORUM_DOCKER_IMAGE:-quorumengineering/quorum:2.3.0}"
expose:
- "21000"
- "50400"
@MajdT51
MajdT51 / docker-compose.yml
Created December 8, 2019 13:11
The services and network and vol for one node
services:
node1:
<< : *quorum-def
hostname: node1
ports:
- "22000:8545"
volumes:
- vol1:/qdata
- ./3nodes:/3nodes:ro
environment:
@MajdT51
MajdT51 / docker-compose.yml
Last active December 8, 2019 13:05
The quorum-def configuration
x-quorum-def:
&quorum-def
restart: "on-failure"
image: "${QUORUM_DOCKER_IMAGE:-quorumengineering/quorum:2.3.0}"
expose:
- "21000"
- "50400"
healthcheck:
test: ["CMD", "wget", "--spider", "--proxy", "off", "http://localhost:8545"]
interval: 4s
@MajdT51
MajdT51 / TokenContract.sol
Last active September 25, 2019 11:39
example contract using AddrArrayLib
pragma solidity >= 0.4.25 < 0.6.0;
import '../node_modules/openzeppelin solidity/contracts/ownership/Ownable.sol';
import '../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol';
import './AddrArrayLib.sol';
contract TokenContract is Ownable {
using AddrArrayLib for AddrArrayLib.Addresses;
using SafeMath for uint256;
@MajdT51
MajdT51 / example.sol
Last active September 20, 2019 09:28
example how to use library in contract
uint256 currentBalance;
function pay(uint256 amount) public {
require(amount > 0, "amount is not bigger than zero");
uint256 currentBalance = 10;
currentBalance = currentBalance.add(amount);
}
@MajdT51
MajdT51 / AddrArrayLib.sol
Last active September 21, 2019 09:01
AddrArrayLib Implementation
/*
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity >=0.4.25 <0.6.0;
@MajdT51
MajdT51 / SafeMath.sol
Last active September 21, 2019 09:09
modified SafeMath library example
pragma solidity >= 0.4.25 < 0.6.0;
library SafeMath {
struct Balance { uint256 _balance; }
function add(Num storage self, uint256 amount) public {
uint256 newBalance = self._ balance + amount;
require(newBalance >= self._ balance, "addition overflow");
self._ balance = newBalance;
@MajdT51
MajdT51 / SafeMath.sol
Last active September 21, 2019 09:09
SafeMath library example
pragma solidity >= 0.4.25 < 0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) public pure returns (uint256){
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}