Customers and Examples

Our Customers and the Smart Contract examples developed by our company for blockchain platforms

Our Customers

MosEnergoSbyt
MosEnergoSbyt
https://mosenergosbyt.ru
Romanov Empire
Romanov Empire
http://romanovempire.com
Sberbank
Sberbank
https://sberbank.ru
TerraMiner
TerraMiner
https://terraminer.online
Fairloris
Fairloris
https://fairloris.com
Bloomzed
Bloomzed
https://bloomzed.io
Arqute
ARQUTE G.A.S
https://arqute.com
Gazprom Neft
Gazprom Neft
http://www.gazprom-neft.ru
Algomizer
Algomizer
https://www.algomizer.com


The Smart Contract Examples

If you wish to learn more about the technical aspects of our activity, some smart contract examples developed by our company available for you publicly are provided below. We cannot make all our performed works available for you publicly according to the Privacy Policy agreement with our Customers. However, we have decided to publish some of the developed smart contract types on our site and moreover you may use them for your own purposes.

The given smart contracts are written for the Ethereum platform in the programming language called Solidity

Example №1

The given smart contract is used for the conduct of a pre-ICO and tokens’ emission. The following parameters are used in the smart contract:

  • The time when the ICO is started
  • The time when the ICO is finished
  • The token’s price at the time when the ICO is being conducted
  • The token decimals
  • The token balance of the team when the ICO is finished
A programming language:
Solidity
pragma solidity ^0.4.11;

library SafeMath {
	function mul(uint256 a, uint256 b) internal constant returns (uint256) {
		uint256 c = a * b;
		assert(a == 0 || c / a == b);
		return c;
	}

	function div(uint256 a, uint256 b) internal constant returns (uint256) {
		uint256 c = a / b;
		return c;
	}

	function sub(uint256 a, uint256 b) internal constant returns (uint256) {
		assert(b <= a);
		return a - b;
	}

	function add(uint256 a, uint256 b) internal constant returns (uint256) {
		uint256 c = a + b;
		assert(c >= a);
		return c;
	}
}

contract ERC20Basic {
	uint256 public totalSupply;
	function balanceOf(address who) constant returns (uint256);
	function transfer(address to, uint256 value) returns (bool);
	event Transfer(address indexed from, address indexed to, uint256 value);
}


contract Ownable {
	address public owner;


	event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

	function Ownable() {
		owner = msg.sender;
	}

	modifier onlyOwner() {
		require(msg.sender == owner);
		_;
	}

	function transferOwnership(address newOwner) onlyOwner {
		require(newOwner != address(0));
		OwnershipTransferred(owner, newOwner);
		owner = newOwner;
	}

}

contract ERC20 is ERC20Basic {
	function allowance(address owner, address spender) constant returns (uint256);
	function transferFrom(address from, address to, uint256 value) returns (bool);
	function approve(address spender, uint256 value) returns (bool);
	event Approval(address indexed owner, address indexed spender, uint256 value);
}

contract BasicToken is ERC20Basic {
	using SafeMath for uint256;

	mapping(address => uint256) balances;

	function transfer(address _to, uint256 _value) returns (bool) {
		require(_to != address(0));

		balances[msg.sender] = balances[msg.sender].sub(_value);
		balances[_to] = balances[_to].add(_value);
		Transfer(msg.sender, _to, _value);
		return true;
	}

	function balanceOf(address _owner) constant returns (uint256 balance) {
		return balances[_owner];
	}

}

contract StandardToken is ERC20, BasicToken {

	mapping (address => mapping (address => uint256)) allowed;

	function transferFrom(address _from, address _to, uint256 _value) returns (bool) {
		require(_to != address(0));

		var _allowance = allowed[_from][msg.sender];

		balances[_from] = balances[_from].sub(_value);
		balances[_to] = balances[_to].add(_value);
		allowed[_from][msg.sender] = _allowance.sub(_value);
		Transfer(_from, _to, _value);
		return true;
	}

	function approve(address _spender, uint256 _value) returns (bool) {

		require((_value == 0) || (allowed[msg.sender][_spender] == 0));

		allowed[msg.sender][_spender] = _value;
		Approval(msg.sender, _spender, _value);
		return true;
	}

	function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
		return allowed[_owner][_spender];
	}


	function increaseApproval (address _spender, uint _addedValue)
		returns (bool success) {
		allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
		Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
		return true;
	}

	function decreaseApproval (address _spender, uint _subtractedValue)
		returns (bool success) {
		uint oldValue = allowed[msg.sender][_spender];
		if (_subtractedValue > oldValue) {
			allowed[msg.sender][_spender] = 0;
		} else {
			allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
		}
		Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
		return true;
	}

}


contract MintableToken is StandardToken, Ownable {
	event Mint(address indexed to, uint256 amount);
	event MintFinished();

	bool public mintingFinished = false;


	modifier canMint() {
		require(!mintingFinished);
		_;
	}


	function mint(address _to, uint256 _amount) onlyOwner canMint returns (bool) {
		totalSupply = totalSupply.add(_amount);
		balances[_to] = balances[_to].add(_amount);
		Mint(_to, _amount);
		Transfer(0x0, _to, _amount);
		return true;
	}

	function finishMinting() onlyOwner returns (bool) {
		mintingFinished = true;
		MintFinished();
		return true;
	}
}

contract TestToken is MintableToken {
	string public constant name = "TestToken";
	string public constant symbol = "TT";
	uint8 public constant decimals = 18;
}

contract TESTCrowdsale is Ownable {

	using SafeMath for uint256;

	TestToken public token;

	uint256 public startTime;
	uint256 public endTime;

	address public wallet;

	uint256 public rate;

	uint256 public weiRaised;

	event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);

	function TESTCrowdsale(uint256 _startTime, uint256 _endTime, uint256 _rate, address _wallet) {
		// require(_startTime >= now);
		require(_endTime >= _startTime);
		require(_rate > 0);
		require(_wallet != 0x0);

		token = createTokenContract();
		startTime = _startTime;
		endTime = _endTime;
		rate = _rate;
		wallet = _wallet;
	}

	function createTokenContract() internal returns (TestToken) {
		return new TestToken();
	}

	function () payable {
		buyTokens(msg.sender);
	}

	function buyTokens(address beneficiary) payable {
		require(beneficiary != 0x0);
		require(validPurchase());

		uint256 weiAmount = msg.value;
		uint256 tokens = weiAmount.mul(rate);
		weiRaised = weiRaised.add(weiAmount);

		token.mint(beneficiary, tokens);
		TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);

		forwardFunds();
	}

	function forwardFunds() internal {
		wallet.transfer(msg.value);
	}

	function validPurchase() internal constant returns (bool) {
		bool withinPeriod = now >= startTime && now <= endTime;
		bool nonZeroPurchase = msg.value != 0;
		return withinPeriod && nonZeroPurchase;
	}

	function hasEnded() public constant returns (bool) {
		return now > endTime;
	}

	function closeAndTransferTokenOwnership() onlyOwner {
		require(now > endTime);
		// reserve for a team
		uint256 toMint = token.totalSupply().mul(15).div(100);
		token.mint(owner, toMint);
		// transfer of ownership
		token.transferOwnership(owner);
	}

}

Example №2

Two ways described in the given example allow to provide security for group rental payments. The first standalone smart contract is a micro-system of rental payments, it stores payment data. After the participants of the payment accumulate the necessary sum on the contract, the payment is registered as received and the payment is performed, then the payment data and the status are registered in the blockchain network and can be exported.

A programming language:
Solidity
pragma solidity ^0.4.11;

contract Biller {
		
		struct Bill {
				uint id;
				uint status;
				address reciever;
				uint summ;
				string clientData;
				string payers;
				address[] wallets;
				int[] amounts;
				int[] payStatuses;
		}
		
		event Closed(
				uint billId
		);
		
		event Saved(
				uint billId
		);
		
		event Dead(
				uint billId
		);
		
		mapping(uint => Bill) public bills;

		function Biller() {
		}
		
		function saveOpenBill(uint id, address reciever, uint summ, string clientData, string payers, address[] wallets, int[] amounts, int[] payStatuses) {
				bills[id] = Bill(id, 1, reciever, summ, clientData, payers, wallets, amounts, payStatuses);
				Saved(id);
		}
		
		function setClosing(uint id, address[] wallets, int[] amounts) public {
				bills[id].status = 2;
				bills[id].wallets = wallets;
				bills[id].amounts = amounts;
				Closed(id);
		}
		
		function getAmounts(uint id) public constant returns (int[])  {
				return bills[id].amounts;
		}
		
		function getWallets(uint id) public constant returns (address[])  {
				return bills[id].wallets;
		}
		
		function getPayStatuses(uint id) public constant returns (int[])  {
				return bills[id].payStatuses;
		}
		
		function confirm(uint id, address wallet) public {
				var bill = bills[id];
				for (uint i = 0; i < bill.wallets.length; i++) {
						if (wallet == bill.wallets[i]) {
								bills[id].payStatuses[i] = 2;
						}
				}
				
				int notPayedCount = 0;
				for (uint j = 0; j < bills[id].amounts.length; j++) {
						if(bills[id].amounts[j] != 0) {
								if(bills[id].payStatuses[j] != 2) {
										notPayedCount++;
								}
						}
				}
				
				if(notPayedCount == 0) {
						bills[id].status = 3;
						Dead(id);
				}
		}
		
		function getBillById(uint id) public constant returns (uint, address, uint, string, string) {
				var bill = bills[id];
				return (bill.status, bill.reciever, bill.summ, bill.clientData, bill.payers);
		}

}

Example №3

The new tasks are set in the given smart contract: to divide the payment history and the history of payers statuses and to introduce the freezing and unfreezing of accounts. The combination of three smart contacts allows to solve the problem of new cases.

A programming language:
Solidity
pragma solidity ^0.4.11;

contract Payer {
		
		bytes32[] id;
		string name;
		uint frozeStart;
		uint period = 3000;
		uint balance = 0;
		
		event Frozen(address frozened, uint amount);
		event Unfrozen(address winner, uint amount);
		event Priveleged(bytes32[] id);
		
		function Payer(bytes32[] id, string name, uint balance) {
				id = id;
				name = name;
				balance = balance;
		}
		
		function frozePayer() {
				frozeStart = now;
		}
		
		function unfrozePayer() {
				require(now >= (frozeStart + period)); 
				Unfrozen(this, balance);
		}
		
		function addPriveleges() {
				Priveleged(id);
		}

}

contract BillFactory {
		
		
		event Dead(
				uint billId
		);
		
		Bill[] bills;

		function createBill (bytes32 name, uint summ) {
				Bill newBill = new Bill(name, summ);
				bills.push(newBill);
		} 
		
		// function getBill (uint i) public constant returns (uint, address, uint, string, string) {
		//     Bill bill = Bill(bills[i]);
		//     return (bill.status, bill.reciever, bill.summ, bill.clientData, bill.payers);
		// }
		
		string[] names;
		
		event Closed(
				uint billId
		);
		
		event Saved(
				uint billId
		);
		
		function saveOpenBill(uint id, address reciever, uint summ, string clientData, string payers, address[] wallets, int[] amounts, int[] payStatuses) {
				bills[id] = Bill(id, 1, reciever, summ, clientData, payers, wallets, amounts, payStatuses);
				Saved(id);
		}
		
		function setClosing(uint id, address[] wallets, int[] amounts) public {
				bills[id].status = 2;
				bills[id].wallets = wallets;
				bills[id].amounts = amounts;
				Closed(id);
		}
		
		function getAmounts(uint id) public constant returns (int[])  {
				return bills[id].amounts;
		}
		
		function getWallets(uint id) public constant returns (address[])  {
				return bills[id].wallets;
		}
		
		function getPayStatuses(uint id) public constant returns (int[])  {
				return bills[id].payStatuses;
		}
		
		function confirm(uint id, address wallet) public {
				
				var bill = bills[id];
				for (uint i = 0; i < bill.length; i++) {
						if (wallet == bill.wallets[i]) {
								bills[id].payStatuses[i] = 2;
						}
				}
				
				int notPayedCount = 0;
				for (uint j = 0; j < bill.length; j++) {
						if(bills[id].amounts[j] != 0) {
								if(bills[id].payStatuses[j] != 2) {
										notPayedCount++;
								}
						}
				}
				
				if(notPayedCount == 0) {
						bills[id].status = 3;
						Dead(id);
				}
		}
		
		
}

contract Bill {
		
		event Closed(
				uint billId
		);
		
		event Saved(
				uint billId
		);
		
		event Reserved(
				uint billId
		);
		
		uint id;
		uint status;
		address reciever;
		uint summ;
		string clientData;
		Payer[] payers;
		address[] wallets;
		int[] amounts;
		int[] payStatuses;

		function Bill (bytes32 name, uint summ) {
				name = name;
				summ = summ;
		}
		
		function closeBill() {
				Closed(id);
		}
		
		function reserveBill() {
				Reserved(id);
		}
		
}

License

This code is free for you to distribute and use.