Skip to content

Commit

Permalink
Add Fee Reserve
Browse files Browse the repository at this point in the history
  • Loading branch information
Gogs committed Jul 29, 2017
1 parent 2719f79 commit d6e3bda
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 10 deletions.
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
piWallet
========

piWallet is a secure opensource online altcoin wallet that works with practically any altcoin.
piWallet is a secure opensource online altcoin wallet that works with practically any altcoin. piWallet uses PHP, mySQL, JavaScript and Bootstrap.

Setup: https://github.com/johnathanmartin/piWallet/wiki

Bitcoin Talk: https://bitcointalk.org/index.php?topic=911212

Please be cautious when paying others to install piWallet for you, I'd be willing to install for a negotiable fee. Please send me an email. [email protected]

Whats New:

- Manual User Reserve

- QR Codes use a local generation URL

- Multilanguage support for over 90% of text - Currently supported languages include English, Greek, Mandarin, Hindi, Italian, Portuguese, Spanish, and Tagalog.
Expand All @@ -18,8 +23,6 @@ Whats New:

- Google 2 Factor Auth

- [Support Pin](https://github.com/johnathanmartin/piWallet/wiki/Support-Pin)


Planned Features:
- Have QR Codes open in lightbox instead of new tab
Expand All @@ -28,6 +31,6 @@ Planned Features:

- Control of Private Keys

Donate:
More Information:

1LXEEZefwFKBC86oLndPuu7fLJre97Xtyu
Created by Johnathan Martin of fitbobcat.com
6 changes: 5 additions & 1 deletion common.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php
//ini_set('display_startup_errors',1);
//ini_set('display_errors',1);
//error_reporting(-1);

session_start();
header('Cache-control: private'); // IE 6 FIX

Expand Down Expand Up @@ -37,7 +41,7 @@ function satoshitrim($satoshitrim) {
$hide_ids = array(1); //Hide account from admin dashboard
$donation_address = "13jy6rHB7HMgQBoYxQQXSM7TFTZZ6CDAAZ"; //Donation Address

$fee = "0"; //Set a fee to prevent negitive balances. WARNING: This function is incomplete. Setting a fee will show a negitve balance for all new user accounts.
$reserve = "0"; //This fee acts as a reserve. The users balance will display as the balance in the daemon minus the reserve. We don't reccomend setting this more than the Fee the daemon charges.

if(isSet($_GET['lang']))
{
Expand Down
20 changes: 16 additions & 4 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,27 @@
$admin_action = $_GET['a'];
}
if (!$admin_action) {
$balance = $client->getBalance($user_session) - $fee;
if (!empty($_POST['jsaction'])) {
$noresbal = $client->getBalance($user_session);
$resbalance = $client->getBalance($user_session) - $reserve;
if ($resbalance < 0) {
$balance = $noresbal; //Don't show the user a negitive balance if they have no coins with us
} else {
$balance = $resbalance;
}
if (!empty($_POST['jsaction'])) {
$json = array();
switch ($_POST['jsaction']) {
case "new_address":
$client->getnewaddress($user_session);
$json['success'] = true;
$json['message'] = "A new address was added to your wallet";
$json['balance'] = $client->getBalance($user_session) - $fee;
$jsonbal = $client->getBalance($user_session);
$jsonbalreserve = $client->getBalance($user_session) - $reserve;
if ($jsonbalreserve < 0) {
$json['balance'] = $jsonbal;
} else {
$json['balance'] = $jsonbalreserve; }
$json['balance'] = $jsonbal;
$json['addressList'] = $client->getAddressList($user_session);
$json['transactionList'] = $client->getTransactionList($user_session);
echo json_encode($json); exit;
Expand All @@ -43,7 +55,7 @@
$_SESSION['token'] = sha1('@s%a$l£t#'.rand(0,10000));
$json['newtoken'] = $_SESSION['token'];
} elseif ($_POST['amount'] > $balance) {
$json['message'] = "Withdrawal amount exceeds your wallet balance";
$json['message'] = "Withdrawal amount exceeds your wallet balance. Please note the wallet owner has set a reserve fee of $reserve $short.";
} else {
$withdraw_message = $client->withdraw($user_session, $_POST['address'], (float)$_POST['amount']);
$_SESSION['token'] = sha1('@s%a$l£t#'.rand(0,10000));
Expand Down

0 comments on commit d6e3bda

Please sign in to comment.