contract sovereign {
	//sovereign currency parameters of a given Community
	address Treasury; //the address of the Treasury of the DAO. The creator and minter of the currency
	address Commons; //the address of the Commounity account. Where donations and taxes are paid. Account used to pay Commons works. 
	int demurrage; //the depreciation at each transaction. The VAT to be paid to the DAO. % x 100
	uint reward; //reward to the moneyLender of a successful credit, as a multiplier of the creditLine amount. % x 100
	int available; //is the spending limit of an account, given the account balance in sovereigns and the credit
	int amount;
	int creditLine;
	struct sovereignWallet {
		int sovereigns; //sovereigns is the actual balance of the currency sovereigns in the Wallet of the account. It can be negative!!!	
		uint credit; //credit is the limit of sovereigns the account is authorized to become negative	
		uint deadline; //deadline is the time limit on which the credit should be already cancelled and becomes zero again. Its measured in number of blocks
		address moneyLender; //moneyLender is the address of the money lender. The credit line authorizer.
		uint reputation; //reputation is the volume of the credit in terms of reputation Cost the money lender can authorize; that is, his available reputation Cost 
		uint reputationCost; //reputationCost is the cost in reputation of a particular credit line authorization. It is calculated in terms of credit volume time x amount
	function sovereign() {
		Treasury = msg.sender; //the address of the DAO delegated to manage the currency. It is taken at the currency creation. 
		Commons = 0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae; //the address of the DAO to manage public accounts. Put here the correct address. 
		demurrage = 1;
		reward = 20;
	mapping (address => sovereignWallet) balances;	
//the Treasury can issue as much sovereign and reputation he likes and send it to whoever he likes
	function createAssignSovereigns (address beneficiary, int funds) {
        if (msg.sender != Treasury) return;
		balances[beneficiary].sovereigns += funds;

	function createAssignReputation (address beneficiary, uint funds) {
        if (msg.sender != Treasury) return;
        balances[beneficiary].reputation += funds;
//function make a payment 
	function pay(address payee, uint payment) {
	//update the credit status
		if (balances[msg.sender].credit > 0) {
		//check if deadline is over
			if (block.number > balances[msg.sender].deadline) {
			//if time is over
				//if balance is negative the credit was not returned, the money lender reputation is not restored and is penalized with a 20%
				if (balances[msg.sender].sovereigns < 0) {
					balances[balances[msg.sender].moneyLender].reputation -= balances[msg.sender].reputationCost * reward/100;
					//if balance is not negative the credit was returned, the money lender reputation is restored and is rewarded with a 20%
				else {
					balances[balances[msg.sender].moneyLender].reputation += balances[msg.sender].reputationCost * (100 + reward)/100;
					//reset credit to zero, deadline to zero
					balances[msg.sender].credit = 0;
					balances[msg.sender].deadline = 0;
		//if time is not over proceed with the payment
	//if there was no credit proceed
	//pay with the reviewed balance and credit
	    creditLine = int(balances[msg.sender].credit);
		available = balances[msg.sender].sovereigns + creditLine;
		amount = int(payment);
		if (available > amount) {
		balances[msg.sender].sovereigns += amount;
		balances[payee].sovereigns += amount;
		//apply demurrage
		balances[payee].sovereigns -= amount * (100 - demurrage)/100;
		balances[Commons].sovereigns += amount * (demurrage)/100;
//function authorize a credit
	function credit(address borrower, uint credit, uint blocks) returns(bool successful) {
		if (balances[msg.sender].reputation > credit * blocks) {
			balances[msg.sender].reputation -= credit * blocks;
			balances[borrower].credit += credit;
			balances[borrower].moneyLender = msg.sender;
			balances[borrower].deadline = block.number + blocks; //the deadline is established as a number of blocks ahead
			balances[borrower].reputationCost = credit * blocks;

Solidity contract for Ethereum

Currency with: P2P credit authorization based on lenders reputation. Money is created out of the nothing, not the lenders pocket. - rewarding (adjustable) the lender reputation if credit successful - penalty (adjustable) the lender reputation if not


Note: Your changes won't be saved, because not Logged-in.

Create your own Contract