From 2dda53240c1a91df38a96c51dbb098220ea9aebe Mon Sep 17 00:00:00 2001 From: moneromooo Date: Sun, 28 Dec 2014 10:23:17 +0000 Subject: [PATCH] Move coin specs to a separate module, and make a monero module --- README | 5 +++++ tipbot.py | 21 ++++++++++++++------- tipbot_monero.py | 18 ++++++++++++++++++ 3 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 tipbot_monero.py diff --git a/README b/README index bc94b8e..7a52d15 100644 --- a/README +++ b/README @@ -12,6 +12,11 @@ for these in tipbot.py. Before starting, read the configuration parameters at the top of tipbot.py and change as appropriate. +Start the bot with the coin name as parameter (eg, python tipbot.py monero). Coin specs +are defined in a file called tipbot_.py. If you want to add a coin that the +tipbot does not support yet, simply copy an existing spec module and adapt to that coin's +particular specs. + The tipbot will need a wallet. Any wallet can do, but it is recommended to use a separate wallet. This wallet should be loaded in the simplewallet the tipbot connects to. diff --git a/tipbot.py b/tipbot.py index 19040ff..384ab98 100644 --- a/tipbot.py +++ b/tipbot.py @@ -10,6 +10,7 @@ # any later version. # +import sys import socket import select import sys @@ -22,6 +23,18 @@ import httplib import time import string +try: + setup = sys.argv[1] +except Exception,e: + print 'Usage: tipbot.py ' + exit(1) +try: + print('Importing %s module' % setup) + exec "from tipbot_%s import coin_name, coin, coin_denominations, address_length, address_prefix, min_withdrawal_fee, web_wallet_url" % setup +except Exception,e: + print 'Failed to load setup for %s: %s' % (setup, str(e)) + exit(1) + tipbot_name = "monero-testnet-tipbot" irc_network = 'irc.freenode.net' irc_port = 6667 @@ -36,16 +49,10 @@ bitmonerod_port = 28081 # 6060 wallet_host = '127.0.0.1' wallet_port = 6061 wallet_update_time = 30 # seconds -coin=1e12 -coin_name = "Monero" -coin_denominations = [[1000000, 1, "piconero"], [1000000000, 1e6, "micronero"], [1000000000000, 1e9, "millinero"]] -address_length = [95, 95] # min/max size of addresses -address_prefix = ['4', '9'] # allowed prefixes of addresses -withdrawal_fee = 10000000000 +withdrawal_fee=min_withdrawal_fee min_withdraw_amount = 2*withdrawal_fee withdraw_disabled = False disable_withdraw_on_error = True -web_wallet_url = "https://mymonero.com/" # None is there's none admins = ["moneromooo", "moneromoo"] diff --git a/tipbot_monero.py b/tipbot_monero.py new file mode 100644 index 0000000..f7223c9 --- /dev/null +++ b/tipbot_monero.py @@ -0,0 +1,18 @@ +#!/bin/python +# +# Cryptonote tipbot - monero setup +# Copyright 2014 moneromooo +# +# The Cryptonote tipbot is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as published +# by the Free Software Foundation; either version 2, or (at your option) +# any later version. +# + +coin_name="Monero" +coin=1e12 +coin_denominations = [[1000000, 1, "piconero"], [1000000000, 1e6, "micronero"], [1000000000000, 1e9, "millinero"]] +address_length = [95, 95] # min/max size of addresses +address_prefix = ['4', '9'] # allowed prefixes of addresses +min_withdrawal_fee = 10000000000 +web_wallet_url = "https://mymonero.com/" # None is there's none