rounds implemented + over all improvements
This commit is contained in:
@@ -24,9 +24,9 @@
|
||||
<div class="sacrifice-from-to-wrapper" v-if="activeToken.contractAddress">
|
||||
<div class="sacrifice-from-wrapper bloodline-border bloodline-border--variant1">
|
||||
<div class="sarcrifice-from-input">
|
||||
<input @input="processChange" type="number" v-model="tokenNumber" :placeholder="0" />
|
||||
<input @input="processChange" v-model="tokenNumber" :placeholder="0" />
|
||||
<div class="sacrifice-logo">
|
||||
<img src="@/assets/img/vampir.png" alt="vampir" />
|
||||
<img :src="activeToken.logo" alt="vampir" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="value-adder">
|
||||
@@ -70,12 +70,17 @@
|
||||
<div
|
||||
class="btn btn-immortal"
|
||||
v-if="activeToken.allowance > 0 && activeToken.allowance >= tokenNumber"
|
||||
@click="approvalData = tokenStore.sacrificeToken(1)"
|
||||
@click="approvalData = tokenStore.sacrificeToken(tokenNumber)"
|
||||
>
|
||||
<font-awesome-icon v-if="loading" icon="spinner" spin />
|
||||
Sacrifce {{ activeToken.name }}
|
||||
</div>
|
||||
<div class="btn btn-immortal" v-else @click="approvalData = tokenStore.approveToken(1)">
|
||||
<div
|
||||
class="btn btn-immortal"
|
||||
v-else
|
||||
@click="approvalData = tokenStore.approveToken(tokenNumber)"
|
||||
>
|
||||
<font-awesome-icon v-if="loading" icon="spinner" spin />
|
||||
Approve {{ activeToken.name }}
|
||||
</div>
|
||||
</div>
|
||||
@@ -118,14 +123,23 @@ const tokenNumber = ref(0);
|
||||
const output = ref(0);
|
||||
const approvalData = ref(null);
|
||||
|
||||
const processChange = Helper.debounce((e) => test(e));
|
||||
const processChange = Helper.debounce((e) => getRewardsFor(e));
|
||||
|
||||
async function test(e) {
|
||||
console.log("hier", e);
|
||||
output.value = await tokenStore.getRewardsFor(parseInt(e.target.value));
|
||||
async function getRewardsFor(e) {
|
||||
if (!e.target.value) {
|
||||
output.value = 0;
|
||||
return;
|
||||
}
|
||||
console.log("e.target.value * 18", e.target.value * Math.pow(10, 18));
|
||||
const rewardsForResult = await tokenStore.getRewardsFor(
|
||||
BigInt(e.target.value * Math.pow(10, activeToken.value.decimals))
|
||||
);
|
||||
output.value = rewardsForResult / Math.pow(10, tokenStore.memeToken.decimals);
|
||||
}
|
||||
function addTokens(value) {
|
||||
|
||||
async function addTokens(value) {
|
||||
tokenNumber.value = tokenNumber.value + value;
|
||||
output.value = await tokenStore.getRewardsFor(parseInt(tokenNumber.value));
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -230,7 +244,7 @@ function addTokens(value) {
|
||||
height: 45px
|
||||
border-radius: 50%
|
||||
@media (min-width: 992px)
|
||||
height: auto
|
||||
height: 83px
|
||||
width: auto
|
||||
.sacrifice-to-output
|
||||
flex: 1 1 auto
|
||||
|
||||
Reference in New Issue
Block a user