Skip to content

Instantly share code, notes, and snippets.

View samanshahmohamadi's full-sized avatar

Saman Shahmohamadi samanshahmohamadi

View GitHub Profile
@samanshahmohamadi
samanshahmohamadi / hgateway.sol
Created August 25, 2019 14:45
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.1+commit.c8a2cb62.js&optimize=false&gist=
pragma solidity >=0.4.22 <0.6.0;
contract owned {
address public owner = msg.sender;
uint public creationTime = now;
modifier onlyOwner {
require(
msg.sender == owner,
"Access restricted."
@samanshahmohamadi
samanshahmohamadi / AccountAddrResolverI.sol
Created March 12, 2019 15:13
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.25+commit.59dbf8f1.js&optimize=false&gist=
pragma solidity ^0.4.25;
contract AccountAddrResolverI {
address public addr;
address owner;
function AccountAddrResolverI(){
owner = msg.sender;
@samanshahmohamadi
samanshahmohamadi / AccountAddrResolverI.sol
Created March 12, 2019 14:57
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.25+commit.59dbf8f1.js&optimize=false&gist=
pragma solidity ^0.4.25;
contract AccountAddrResolverI {
address public addr;
address owner;
function AccountAddrResolverI(){
owner = msg.sender;
@samanshahmohamadi
samanshahmohamadi / AccountAddrResolverI.sol
Created March 12, 2019 14:56
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.25+commit.59dbf8f1.js&optimize=false&gist=
pragma solidity ^0.4.25;
contract AccountAddrResolverI {
address public addr;
address owner;
function AccountAddrResolverI(){
owner = msg.sender;
@samanshahmohamadi
samanshahmohamadi / MappingTest.sol
Created January 15, 2019 09:40
How to return whole mapping in solidity
pragma solidity ^0.4.25;
contract MappingTest {
mapping(uint=>address) public addresses;
uint addressRegistryCount;
function set(address userAddress) public{
addresses[addressRegistryCount] = userAddress;
addressRegistryCount++;
}
@samanshahmohamadi
samanshahmohamadi / Strings.sol
Created December 10, 2018 11:40
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=false&gist=
pragma solidity ^0.4.24;
/**
* Strings Library
*
* In summary this is a simple library of string functions which make simple
* string operations less tedious in solidity.
*
* Please be aware these functions can be quite gas heavy so use them only when
* necessary not to clog the blockchain with expensive transactions.
@samanshahmohamadi
samanshahmohamadi / IrohaController.java
Created December 4, 2018 13:36
Iroha WebApplication
package com.avalblock.irohaweb.controller;
import com.avalblock.common.exception.BaseException;
import com.avalblock.irohaweb.service.interfaces.IIrohaService;
import com.google.protobuf.ByteString;
import com.google.protobuf.Descriptors;
import com.google.protobuf.InvalidProtocolBufferException;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import io.swagger.annotations.ApiOperation;
@samanshahmohamadi
samanshahmohamadi / sawtooth-default-multi.yaml
Created October 16, 2018 07:41
Hyperledger Sawtooth configuration to setup a network with multiple validators.
# Copyright 2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,