Skip to content

Commit

Permalink
PNK Campaign End Update
Browse files Browse the repository at this point in the history
  • Loading branch information
remedcu committed Nov 8, 2020
1 parent f5cd005 commit a7ef925
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 60 deletions.
Binary file added img/OmenHeader.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed img/PNKFarmingOnOmenHeader.png
Binary file not shown.
26 changes: 4 additions & 22 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Omen Pool Token APR</title>
<meta name="description" content="Find the PNK Reward you can get from providing Liquidity Pool to Omen">
<title>Omen Liquidity Pool</title>
<meta name="description" content="Omen Liquidity Pool">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="container text-center" id="theme-bg">
<button id="theme" onclick="changeTheme()">&#9790;</button>
<div class="header-image">
<img src="img/PNKFarmingOnOmenHeader.png" alt="PNK Farming On Omen" class="rounded img-fluid">
<img src="img/OmenHeader.png" alt="Omen Prediction Market" class="rounded img-fluid" width="500" height="500">
</div>
<div class="market-details">
<h1>Omen Pool Liquidity</h1>
Expand All @@ -26,30 +26,12 @@ <h1 id="omen-market-usd">0</h1>
Finding all the Fixed Product Market Makers...
</div>
<div>
<div class="apr-details">
<h3>Calculate APR</h3>
<div class="apr-details-form">
<label for="amount">Amount in USD: </label><br>
<input class="form-control" type="number" name="amount" id="calculate-amount" placeholder="Enter the amount" oninput="calculate()">
</div>
</div>
<div id="calculate-apr">
The monthly reward is <div id="pnk">?</div> <b>PNK</b><br>
which is equivalent to <b>$</b><div id="dollar">??</div><br>
i.e. An APR of <div id="apr">???</div> %<br>
</div>
<div class="reward-rules">
<p>For more info on rewards, <a href="https://blog.kleros.io/make-pnk-with-omen-conditional-markets-a-guide/" target="_blank">read this post</a>.</p>
<small>Note that rewards are given to market creators only, to farm PNK you must be creative and create a new market.</small><br>
<small>Creating markets with unequal probability will result in smaller liquidity due to part of the outcome tokens not being put into the curve. Please consider that while creating markets.</small>
</div>
<hr>
<div id="market-list"></div>
</div>
<hr>
</div>
<script src="https://cdn.jsdelivr.net/npm/web3@latest/dist/web3.min.js"></script>
<script src="js/check.js"></script>
<script src="js/calculate.js"></script>
<script src="js/theme.js"></script>
</body>
</html>
10 changes: 0 additions & 10 deletions js/calculate.js

This file was deleted.

34 changes: 6 additions & 28 deletions js/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,19 @@ let sortedFPMM;
let marketList = '';

// Functions
function addFPMMList(Title, FPMM, PNKAmount, PNKUSDAmount, USDAmount){
function addFPMMList(Title, FPMM, USDAmount){
let head =
'<table class="table table-striped" id="market-table">'+
'<thead id="market-table-head" class="thead-light" id="market-table-head"><tr>'+
'<th scope="col">Title</th>'+
'<th scope="col">Pool Liquidity</th>'+
'<th scope="col">Monthly PNK</th>'+
'<th scope="col">Monthly PNK ($)</th>'+
'</tr></thead>'+
'<tbody>';
let bottom = '</tbody></table>';
marketList +=
'<tr>'+
'<th scope="row"><a href="https://omen.eth.link/#/'+FPMM+'" target="_blank">'+Title+'</a></th>'+
'<td>$'+USDAmount+'</td>'+
'<td class="PNKAmount">'+PNKAmount+'</td>'+
'<td class="PNKUSDAmount">$'+PNKUSDAmount+'</td>'+
'</tr>';

document.getElementById('market-list').innerHTML = head + marketList + bottom;
Expand Down Expand Up @@ -131,43 +127,25 @@ fetch(omenURL, {
})
.then(function() {
document.getElementById('status').innerHTML = "Finding the pool liquidity of all the markets...";
// Finally this calculates the entire amount in USD from Pool Markets.
FPMMs.forEach(FPMM => {
if(FPMM.arbitrator == "0xd47f72a2d1d0e91b0ec5e5f5d02b2dc26d00a14d"
&& FPMM.answerFinalizedTimestamp == null
&& FPMM.scaledLiquidityMeasure != 0
&& FPMM.creator != "0xacbc967d956f491cadb6288878de103b4a0eb38c"
&& FPMM.creator != "0x32981c1eeef4f5af3470069836bf95a0f8ac0508"){
individualTotalPoolTokeninUSDValue = FPMM.scaledLiquidityMeasure * tokenToETHValue[FPMM.collateralToken] * ETHPrice;
totalPoolLiquidity += individualTotalPoolTokeninUSDValue;
}
totalPoolLiquidity = Math.ceil(totalPoolLiquidity);
document.getElementById("omen-market-usd").innerHTML = totalPoolLiquidity;
});
})
.then(function() {
document.getElementById('status').innerHTML = "Creating the table list...";
sortedFPMM = FPMMs.sort((a, b) => (a.scaledLiquidityMeasure * tokenToETHValue[a.collateralToken] < b.scaledLiquidityMeasure * tokenToETHValue[b.collateralToken]) ? 1 : -1);
// This makes the table entries
// Finally this calculates the entire amount in USD from Pool Markets.
sortedFPMM.forEach(FPMM => {
if(FPMM.arbitrator == "0xd47f72a2d1d0e91b0ec5e5f5d02b2dc26d00a14d"
&& FPMM.answerFinalizedTimestamp == null
&& FPMM.scaledLiquidityMeasure != 0
&& FPMM.creator != "0xacbc967d956f491cadb6288878de103b4a0eb38c"
&& FPMM.creator != "0x32981c1eeef4f5af3470069836bf95a0f8ac0508"){
individualTotalPoolTokeninUSDValue = Math.ceil(FPMM.scaledLiquidityMeasure * tokenToETHValue[FPMM.collateralToken] * ETHPrice);
let pnkAmount = Math.ceil(monthlyPNKReward * individualTotalPoolTokeninUSDValue / totalPoolLiquidity);
let PNKUSDAmount = Math.ceil(monthlyPNKReward * tokenToETHValue[pnkContractAddress] * ETHPrice * individualTotalPoolTokeninUSDValue / totalPoolLiquidity);
totalPoolLiquidity += individualTotalPoolTokeninUSDValue;

// Here we are adding the FPMM List with their respective USD Value
addFPMMList(FPMM.title, FPMM.id, pnkAmount, PNKUSDAmount, individualTotalPoolTokeninUSDValue);
addFPMMList(FPMM.title, FPMM.id, individualTotalPoolTokeninUSDValue);
}
document.getElementById("omen-market-usd").innerHTML = Math.ceil(totalPoolLiquidity);
totalPoolLiquidity = Math.ceil(totalPoolLiquidity);
document.getElementById("omen-market-usd").innerHTML = totalPoolLiquidity;
});
})
.then(function() {
document.getElementById('status').innerHTML = "Done!";
document.getElementById('status').innerHTML = "";
document.getElementById("calculate-amount").value = 100;
calculate();
});

0 comments on commit a7ef925

Please sign in to comment.