update getRewardsFor function

This commit is contained in:
EmberSpirit
2023-10-07 16:44:07 +02:00
parent ea60d365d5
commit 2445bb1f78
7 changed files with 2515 additions and 2427 deletions
+25 -19
View File
@@ -39,24 +39,29 @@ export const useUniswapStore = defineStore("uniswap", {
},
async quoteExactInputSingle(amount) {
console.log("quoteExactInputSingle");
const memeBurnerStore = useMemeburnerStore();
var amountEthBase = await memeBurnerStore.getAmountETHBase(amount);
console.log("123", {
token1: this.poolData.token1,
token0: this.poolData.token0,
fee: this.poolData.fee,
amountEthBase,
pricelimit: 0, //sqrtPriceLimitX96
});
const quotedAmountOut = await this.quoateV3Contract.read.quoteExactInputSingle([
this.poolData.token1,
this.poolData.token0,
this.poolData.fee,
amountEthBase,
0, //sqrtPriceLimitX96
]);
return quotedAmountOut;
try {
console.log("quoteExactInputSingle");
const memeBurnerStore = useMemeburnerStore();
var amountEthBase = await memeBurnerStore.getAmountETHBase(amount);
console.log("amountEthBase", amountEthBase);
console.log("123", {
token0: this.poolData.token0,
token1: this.poolData.token1,
fee: this.poolData.fee,
amountEthBase: amountEthBase,
pricelimit: 0, //sqrtPriceLimitX96
});
const quotedAmountOut = await this.quoateV3Contract.read.quoteExactInputSingle([
this.poolData.token0, //bloodline
this.poolData.token1, //weth
this.poolData.fee,
amountEthBase,
0, //sqrtPriceLimitX96
]);
return {result: true, amount: quotedAmountOut};
} catch (error) {
return { result: false, amount: null };
}
},
async getPoolData() {
console.log("getPoolData");
@@ -80,7 +85,8 @@ export const useUniswapStore = defineStore("uniswap", {
});
this.poolData.token0 = data[0].result;
this.poolData.token1 = data[1].result;
this.poolData.fee = data[2].result;
this.poolData.fee = data[2].result;
console.log("this.poolData", this.poolData);
},
},
});