Skip to content

Instantly share code, notes, and snippets.

eval `ssh-agent -s` && ssh-add ~/.ssh/<your key>
@Ramarti
Ramarti / genesis.json
Last active November 9, 2017 23:22
Steps to geth private network with allocated accounts
{
"config": {
"chainId": <your network id>,
"homesteadBlock": 1,
"eip150Block": 2,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"eip155Block": 3,
"eip158Block": 3,
"byzantiumBlock": 4,
"ethash": {}
pragma solidity ^0.4.11;
import '../token/MintableToken.sol';
import '../math/SafeMath.sol';
/**
* @title Crowdsale
* @dev Crowdsale is a base contract for managing a token crowdsale.
* Crowdsales have a start and end timestamps, where investors can make
* token purchases and the crowdsale will assign them tokens based
pragma solidity ^0.4.18;
import '../math/SafeMath.sol';
import './TokenDistributionStrategy.sol';
/**
* @title CompositeCrowdsale
* @dev CompositeCrowdsale is a base contract for managing a token crowdsale.
* Contrary to a classic crowdsale, it favours composition over inheritance.
@Ramarti
Ramarti / EthicHubLending_Reputation_Hooks.sol
Last active June 5, 2018 07:54
Reputation update hooks
pragma solidity ^0.4.23;
//...
contract EthicHubLending is EthicHubBase, Ownable, Pausable {
//...
// In this moment, when the borrower returns the money, we evaluate how "well" they paid.
function returnBorrowedEth() payable public {
@Ramarti
Ramarti / reputation.tex
Created May 17, 2018 10:19
EthicHubReputation formulas
Rc = Rc_{p} - Rc_{p} · \frac{d}{d_{max} }
Dln = Rln_{p} · \frac{d}{d_{max} }
Rln =\begin{cases} Rln_{p} - Dln & Dln < 1\\Rln_{p} - 1 & Dln >= 1\end{cases}
P_{a} = t_{n}·C
Rc = Rc_{p} + \frac{1}{N_{t_{n}}
@Ramarti
Ramarti / EthicHubReputation.sol
Last active June 5, 2018 07:56
EthicHubReputation snippet
pragma solidity ^0.4.23;
import '../EthicHubBase.sol';
import '../math/SafeMath.sol';
import './EthicHubReputationInterface.sol';
contract EthicHubReputation is EthicHubBase, EthicHubReputationInterface {
//10 with 2 decilmals
uint maxReputation = 1000;
pragma solidity ^0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
@Ramarti
Ramarti / docker_commands.txt
Last active November 21, 2018 12:17
Docker commands
# Restart one service
docker-compose -f local.yml build --no-cache $(docker ps --format '{{.Names}}' --filter=ancestor=ethichub_local_vue)
import axios from 'axios'
import VueAxios from 'vue-axios'
import Vue from 'vue'
Vue.use(VueAxios, axios)
Vue.axios.defaults.baseURL = process.env.VUE_APP_BASE_URL
Vue.axios.defaults.headers.common['Content-Type'] = 'application/json'
Vue.axios.defaults.headers.post['Content-Type'] = 'application/json'
Vue.axios.defaults.headers.put['Content-Type'] = 'application/json'