memeburner: use minETH and minBLOOD params in sacrifice functions.
This commit is contained in:
@@ -48,7 +48,7 @@ export const useMemeburnerStore = defineStore("memeburner", {
|
||||
return await this.contract.read.getSacrificedMeme([cycleNumber, tokenAddress]);
|
||||
},
|
||||
async getAmountToReachGoal(tokenAddress) {
|
||||
return await this.contract.read.getAmountToReachGoal([tokenAddress, 0]);
|
||||
return await this.contract.read.getAmountToReachGoal([tokenAddress]);
|
||||
},
|
||||
async getSacrificedCycle(cycleNumber) {
|
||||
console.log("getSacrificedCycle", cycleNumber);
|
||||
@@ -70,7 +70,7 @@ export const useMemeburnerStore = defineStore("memeburner", {
|
||||
});
|
||||
return data;
|
||||
},
|
||||
async sacrificeMeme(amount) {
|
||||
async sacrificeMeme(amount, minETH) {
|
||||
const tokenStore = useTokenStore();
|
||||
try {
|
||||
if (!amount || amount == 0) {
|
||||
@@ -79,11 +79,12 @@ export const useMemeburnerStore = defineStore("memeburner", {
|
||||
return;
|
||||
}
|
||||
this.loading = true;
|
||||
const amountDecimal = BigInt(amount * Math.pow(10, tokenStore.activeToken.decimals));
|
||||
// TODO: store all integer values as one type: BigInt
|
||||
const amountDecimal = BigInt(amount) * 10n ** BigInt(tokenStore.activeToken.decimals);
|
||||
var hash = await this.contract.write.sacrificeMeme([
|
||||
tokenStore.activeToken.contractAddress,
|
||||
amountDecimal.toString(),
|
||||
0
|
||||
minETH.toString()
|
||||
]);
|
||||
return hash;
|
||||
} catch (error) {
|
||||
@@ -93,14 +94,14 @@ export const useMemeburnerStore = defineStore("memeburner", {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
async sacrificeMemeAndBuyBLOOD(amount) {
|
||||
async sacrificeMemeAndBuyBLOOD(amount, minBLOOD) {
|
||||
const tokenStore = useTokenStore();
|
||||
|
||||
const amountDecimal = BigInt(amount * Math.pow(10, tokenStore.activeToken.decimals));
|
||||
const amountDecimal = BigInt(amount) * 10n ** BigInt(tokenStore.activeToken.decimals);
|
||||
var hash = await this.contract.write.sacrificeMemeAndBuyBLOOD([
|
||||
tokenStore.activeToken.contractAddress,
|
||||
amountDecimal.toString(),
|
||||
0,
|
||||
minBLOOD.toString()
|
||||
]);
|
||||
return hash;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user