Commit b50531f6 authored by Mark Brooker's avatar Mark Brooker
Browse files

Additional DeFi tweaks

parent aeaa0abc
......@@ -20,7 +20,7 @@ tokens="https://bscscan.com/token/0x4b04fd7060ee7e30d5a2b369ee542f9ad8ada571"
def protected_soup(url, key):
req=Request(url, headers={'User-Agent': 'Mozilla/5.0'})
try:
page=urlopen(req, timeout=2.5)
page=urlopen(req, timeout=5)
except HTTPError as error:
print('Data not retrieved because %s\nURL: %s', error, url)
except URLError as error:
......
......@@ -69,6 +69,8 @@ function createMainContent(){
function createDeFiContent(){
$content['priceInfo'] = getPriceInfo();
$content['defi'] = getFunnyMoney();
$content['percentDeFi'] = round($content['defi']['wCRWtotal']/$content['priceInfo']['issued']*100,2);
$content['percentMCap'] = round($content['defi']["wCRWdollars"]/$content['priceInfo']['marketCap']*100,2);
return $content;
}
......@@ -122,8 +124,8 @@ function getPriceInfo(){
$result['CRW/USD'] = round($p1 * $p2, 4);
$txoutset = $crownd->gettxoutsetinfo();
$result['issued'] = number_format(floor($txoutset['total_amount']));
$result['marketCap'] = number_format(round($txoutset['total_amount'] * $result['CRW/USD'], 0));
$result['issued'] = floor($txoutset['total_amount']);
$result['marketCap'] = round($txoutset['total_amount'] * $result['CRW/USD'], 0);
return $result;
}
......@@ -158,7 +160,7 @@ function getFunnyMoney(){
// get wCRW total supply
curl_setopt($ch, CURLOPT_URL, "https://api.bscscan.com/api?module=stats&action=tokensupply&contractaddress=" . Config::Token1ContractAddress . "&apikey=" . Config::ApiKey);
$decoded = json_decode(curl_exec($ch),TRUE);
$content['wCRWtotal'] = number_format($decoded['result']/1000000000000000000);
$content['wCRWtotal'] = $decoded['result']/1000000000000000000;
$content["wCRWContractAddress"] = Config::Token1ContractAddress;
// get Pancake V1 wCRW/BUSD-T LP total supply
......@@ -191,7 +193,7 @@ function getFunnyMoney(){
$content["LP3ContractUnits"] = Config::Swap3ContractUnits;
// external call to scrape the $ value of the LP contracts
exec("python3 scrape.py", $out, $rc);
$content["wCRWdollars"] = number_format($out[0]);
$content["wCRWdollars"] = $out[0];
$content["LPTVL"] = number_format($out[1] + $out[2] + $out[3] + $out[4]);
$content["LP0dollars"] = number_format($out[1]);
$content["LP1dollars"] = number_format($out[2]);
......
......@@ -3,43 +3,49 @@
<div class="panel-body">
<div class="row tile_count">
<div class="col-md-4 col-sm-6 col-xs-6 tile_stats_count">
<span class="count_top"><i class="fas fa-magic"></i> wCRW on BSC</span>
<div class="count"><a href="https://bscscan.com/token/<?= $content['defi']["wCRWContractAddress"] ?>" target="_blank"><small>$<?= $content['defi']['wCRWdollars']?></small></a></div>
<span class="count_bottom"><?=$content['defi']['wCRWtotal'] ?> wCRW</span>
<span class="count_top"><i class="fas fa-magic"></i> wCRW on BSC</span>
<div class="count"><a href="https://bscscan.com/token/<?= $content['defi']["wCRWContractAddress"] ?>" target="_blank"><small>$<?= number_format($content['defi']['wCRWdollars'])?></small></a></div>
<span class="count_bottom"><?=number_format($content['defi']['wCRWtotal']) ?> wCRW</span>
</div>
<div class="col-md-4 col-sm-6 col-xs-6 tile_stats_count">
<span class="count_top"><i class="fas fa-magic"></i> <?= $content['defi']["LP0ContractLabel"] ?></span>
<div class="count"><a href="https://bscscan.com/address/<?= $content['defi']["LP0ContractAddress"] ?>" target="_blank"><small>$<?= $content['defi']['LP0dollars']?></small></a></div>
<span class="count_bottom"><?=$content['defi']['LP0total'] . " " . $content['defi']['LP0ContractUnits']?></span>
<span class="count_top"><i class="fas fa-magic"></i> <?= $content['defi']["LP0ContractLabel"] ?></span>
<div class="count"><a href="https://bscscan.com/address/<?= $content['defi']["LP0ContractAddress"] ?>" target="_blank"><small>$<?= $content['defi']['LP0dollars']?></small></a></div>
<span class="count_bottom"><?=$content['defi']['LP0total'] . " " . $content['defi']['LP0ContractUnits']?></span>
</div>
<div class="col-md-4 col-sm-6 col-xs-6 tile_stats_count">
<span class="count_top"><i class="fas fa-magic"></i> <?= $content['defi']["LP1ContractLabel"] ?></span>
<div class="count"><a href="https://bscscan.com/address/<?= $content['defi']["LP1ContractAddress"] ?>" target="_blank"><small>$<?= $content['defi']['LP1dollars']?></small></a></div>
<span class="count_bottom"><?=$content['defi']['LP1total'] . " " . $content['defi']['LP1ContractUnits']?></span>
<span class="count_top"><i class="fas fa-magic"></i> <?= $content['defi']["LP1ContractLabel"] ?></span>
<div class="count"><a href="https://bscscan.com/address/<?= $content['defi']["LP1ContractAddress"] ?>" target="_blank"><small>$<?= $content['defi']['LP1dollars']?></small></a></div>
<span class="count_bottom"><?=$content['defi']['LP1total'] . " " . $content['defi']['LP1ContractUnits']?></span>
</div>
</div>
<div class="row tile_count">
<div class="col-md-4 col-sm-6 col-xs-6 tile_stats_count">
<span class="count_top"><i class="fas fa-magic"></i> <?= $content['defi']["LP2ContractLabel"] ?></span>
<div class="count"><a href="https://bscscan.com/address/<?= $content['defi']["LP2ContractAddress"] ?>" target="_blank"><small>$<?= $content['defi']['LP2dollars']?></small></a></div>
<span class="count_bottom"><?=$content['defi']['LP2total']. " " . $content['defi']['LP2ContractUnits'] ?></span>
<span class="count_top"><i class="fas fa-magic"></i> <?= $content['defi']["LP2ContractLabel"] ?></span>
<div class="count"><a href="https://bscscan.com/address/<?= $content['defi']["LP2ContractAddress"] ?>" target="_blank"><small>$<?= $content['defi']['LP2dollars']?></small></a></div>
<span class="count_bottom"><?=$content['defi']['LP2total']. " " . $content['defi']['LP2ContractUnits'] ?></span>
</div>
<div class="col-md-4 col-sm-6 col-xs-6 tile_stats_count">
<span class="count_top"><i class="fas fa-magic"></i> <?= $content['defi']["LP3ContractLabel"] ?></span>
<div class="count"><a href="https://bscscan.com/address/<?= $content['defi']["LP3ContractAddress"] ?>" target="_blank"><small>$<?= $content['defi']['LP3dollars']?></small></a></div>
<span class="count_bottom"><?=$content['defi']['LP3total'] . " " . $content['defi']['LP3ContractUnits']?></span>
<span class="count_top"><i class="fas fa-magic"></i> <?= $content['defi']["LP3ContractLabel"] ?></span>
<div class="count"><a href="https://bscscan.com/address/<?= $content['defi']["LP3ContractAddress"] ?>" target="_blank"><small>$<?= $content['defi']['LP3dollars']?></small></a></div>
<span class="count_bottom"><?=$content['defi']['LP3total'] . " " . $content['defi']['LP3ContractUnits']?></span>
</div>
<div class="col-md-4 col-sm-6 col-xs-6 tile_stats_count">
<span class="count_top"><i class="fas fa-magic"></i> wCRW/CRW DeFi penetration </span>
<div class="count"><small><?= $content['percentDeFi'] . "% wrapped"?></small></div>
<span class="count_bottom"><?=$content['percentMCap'] . "% Market cap"?></span>
</div>
</div>
<div class="row tile_count">
<div class="col-md-4 col-sm-6 col-xs-6 tile_stats_count">
<span class="count_top">CRW/BTC <?= $content['priceInfo']['CRW/BTC'] ?> sats</span>
<div class="count"><a href="https://bittrex.com/Market/Index?MarketName=BTC-CRW" target="_blank">$<?= $content['priceInfo']['CRW/USD']?></a></div>
<span class="count_bottom">BTC $<?=$content['priceInfo']['BTC/USD'] ?></span>
<span class="count_top">CRW/BTC <?= $content['priceInfo']['CRW/BTC'] ?> sats</span>
<div class="count"><a href="https://bittrex.com/Market/Index?MarketName=BTC-CRW" target="_blank">$<?= $content['priceInfo']['CRW/USD']?></a></div>
<span class="count_bottom">BTC $<?=$content['priceInfo']['BTC/USD'] ?></span>
</div>
<div class="col-md-4 col-sm-6 col-xs-6 tile_stats_count">
<span class="count_top"><i class="fas fa-crown"></i> Market cap</span>
<div class="count"><a href="https://www.coingecko.com/en/coins/crown" target="_blank"><small>$<?= $content['priceInfo']['marketCap']?></small></a></div>
<span class="count_bottom"><?=$content['priceInfo']['issued'] ?> CRW issued</span>
<span class="count_top"><i class="fas fa-crown"></i> Market cap</span>
<div class="count"><a href="https://www.coingecko.com/en/coins/crown" target="_blank"><small>$<?= number_format($content['priceInfo']['marketCap'])?></small></a></div>
<span class="count_bottom"><?=number_format($content['priceInfo']['issued']) ?> CRW issued</span>
</div>
</div>
......
......@@ -53,13 +53,13 @@
</div>
<div class="col-md-3 col-sm-4 col-xs-6 tile_stats_count">
<span class="count_top"><i class="fas fa-crown"></i> Market cap</span>
<div class="count"><a href="https://www.coingecko.com/en/coins/crown" target="_blank"><small>$<?= $content['priceInfo']['marketCap']?></small></a></div>
<span class="count_bottom"><?=$content['priceInfo']['issued'] ?> CRW issued</span>
<div class="count"><a href="https://www.coingecko.com/en/coins/crown" target="_blank"><small>$<?= number_format($content['priceInfo']['marketCap'])?></small></a></div>
<span class="count_bottom"><?=number_format($content['priceInfo']['issued']) ?> CRW issued</span>
</div>
<div class="col-md-3 col-sm-4 col-xs-6 tile_stats_count">
<span class="count_top"><i class="fas fa-magic"></i> wCRW on BSC</span>
<div class="count"><a href="https://bscscan.com/token/<?= $content['defi']['wCRWContractAddress'] ?>" target="_blank"><small>$<?= $content['defi']['wCRWdollars']?></small></a></div>
<span class="count_bottom"><?=$content['defi']['wCRWtotal'] ?> wCRW</span>
<div class="count"><a href="https://bscscan.com/token/<?= $content['defi']['wCRWContractAddress'] ?>" target="_blank"><small>$<?= number_format($content['defi']['wCRWdollars'])?></small></a></div>
<span class="count_bottom"><?=number_format($content['defi']['wCRWtotal']) ?> wCRW</span>
</div>
<div class="col-md-3 col-sm-4 col-xs-6 tile_stats_count">
<span class="count_top"><i class="fas fa-magic"></i> Pancake + YieldField </span>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment