Skip to content

Instantly share code, notes, and snippets.

@llSourcell
Created February 28, 2018 15:10
Show Gist options
  • Select an option

  • Save llSourcell/8e98e2b8bb14a79ee051aeff3fd33b86 to your computer and use it in GitHub Desktop.

Select an option

Save llSourcell/8e98e2b8bb14a79ee051aeff3fd33b86 to your computer and use it in GitHub Desktop.
//pseudo code
create_account():
trustee_reward = (1000*12) * 1.02 ** years
accounts[message.sender] = (block.time – 1month, 0, trustee_reward)
add_account(account1, account2):
//somehow check that both accounts signed the message
if int(account1) > int(acount2):
trustees[account1].append(account2)
else:
trustees[account2].append(account1)
//credit and update the trustee reward
balance[account1][account2] = accounts[account2][3] / 2
balance[account2][account1] = accounts[account1][3] / 2
accounts[account2][3] /= 2
accounts[account1][3] /= 2
revoke_trust(account):
if int(message.sender) > account:
trustees[message.sender].remove(account)
else:
trustees[account].remove(message.sender)
send_money(amount, currency, receiver):
if balance[message.sender][currency] >= amount:
balance[message.sender][currency] -= amount
balance[receiver][currency] += amount
send_new_income(receiver, amount):
//todo factor in 2% growth rate
income_generated = (block.time – accounts[message.sender][0])/ weeks * 1000
if income_generated – money_spent > amount:
money_spent += amount
balance[receiver][currency] += amount
exchange_money(account1, account2, amount)
if message.sender == account1 or message.sender == account2:
if account2 in trustees[account1]:
if balance[account1][account1] >= amount:
if balance[account2][account2] >= amount:
balance[account1][account1] -= amount
balance[account2][account2] -= amount
balance[account1][account2] += amount
balance[account2][account1] += amount
create_group()
groups[message.sender] = Set()
add_group_member(account)
groups[message.sender].add(account)
remove_groupt_member(account)
groups[message.sender].remove(account)
convert_into_group_money(group, amount)
if message.sender in groups[group]:
if amounts[message.sender][message.sender] >= amount:
amounts[message.sender][message.sender] -= amount
amounts[message.sender][group] += amount
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment