diff --git a/src/App.vue b/src/App.vue index 59768d1..e26c1a4 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,5 +1,5 @@ @@ -38,6 +90,22 @@ onMounted(async () => {
+ - + diff --git a/src/assets/contracts/LiquidityOwner.json b/src/assets/contracts/LiquidityOwner.json index 8aa5996..77484f6 100644 --- a/src/assets/contracts/LiquidityOwner.json +++ b/src/assets/contracts/LiquidityOwner.json @@ -1,6 +1,6 @@ { "contractName": "LiquidityOwner", - "contractAddress": "0x0ce1d955f2a2658d6ca1CF61Fa300234fD8A262c", + "contractAddress": "0xF58FC44A2862335F3577253EC544488006aF676A", "abi": [ { "inputs": [ @@ -83,7 +83,7 @@ "inputs": [ { "internalType": "uint256[]", - "name": "liquidityTokenIds", + "name": "tokenIds", "type": "uint256[]" } ], @@ -198,7 +198,7 @@ "inputs": [ { "internalType": "uint256[]", - "name": "positionsToCancel", + "name": "tokenIds", "type": "uint256[]" }, { @@ -240,22 +240,22 @@ "inputs": [ { "internalType": "address", - "name": "", + "name": "operator", "type": "address" }, { "internalType": "address", - "name": "", + "name": "from", "type": "address" }, { "internalType": "uint256", - "name": "", + "name": "tokenId", "type": "uint256" }, { "internalType": "bytes", - "name": "", + "name": "data", "type": "bytes" } ], @@ -267,7 +267,7 @@ "type": "bytes4" } ], - "stateMutability": "pure", + "stateMutability": "nonpayable", "type": "function" }, { diff --git a/src/assets/contracts/MemeBurner.json b/src/assets/contracts/MemeBurner.json index 75101a0..16eddb0 100644 --- a/src/assets/contracts/MemeBurner.json +++ b/src/assets/contracts/MemeBurner.json @@ -1,6 +1,6 @@ { "contractName": "MemeBurner", - "contractAddress": "0x6eEAe97975e156400DD1DDD8eFc4CcB167BaAFC3", + "contractAddress": "0x5c7077b0424c0e425B16363AdA59f1D72914C5c5", "abi": [ { "inputs": [ @@ -146,6 +146,35 @@ "name": "MemeSacrificed", "type": "event" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "goal", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "achieved", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountOfAsset", + "type": "uint256" + } + ], + "name": "_calculateLinearDecreasingReward", + "outputs": [ + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, { "inputs": [ { @@ -177,59 +206,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "memeToSacrifice", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amountToSacrifice", - "type": "uint256" - } - ], - "name": "getRewardFor", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "roundNumber", - "type": "uint256" - }, - { - "internalType": "address", - "name": "meme", - "type": "address" - } - ], - "name": "getSacrificedMeme", - "outputs": [ - { - "internalType": "bool", - "name": "participation", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "amountAchieved", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "liquidityAmountLimit", diff --git a/src/assets/contracts/MemeToken.json b/src/assets/contracts/MemeToken.json index 6a269f7..145b585 100644 --- a/src/assets/contracts/MemeToken.json +++ b/src/assets/contracts/MemeToken.json @@ -1,6 +1,6 @@ { "contractName": "MemeToken", - "contractAddress": "0xeC73Ec89897a36E9Ca36B2190964bBd8C46748AD", + "contractAddress": "0x0e349D42C125acA39ea58024FFC23ED0fE5feE32", "abi": [ { "inputs": [ diff --git a/src/assets/contracts/RewardLocker.json b/src/assets/contracts/RewardLocker.json index 0c278ee..02f662f 100644 --- a/src/assets/contracts/RewardLocker.json +++ b/src/assets/contracts/RewardLocker.json @@ -1,6 +1,6 @@ { "contractName": "RewardLocker", - "contractAddress": "0x3bEc26159dbA0A32210eaDF6A938F1BbE8bfDAA0", + "contractAddress": "0x6749F75Ece2755d38f209Da1cBab07A1caD69554", "abi": [ { "inputs": [ @@ -15,7 +15,7 @@ }, { "inputs": [], - "name": "MemeAltarAlreadyInitialized", + "name": "MemeBurnerAlreadyInitialized", "type": "error" }, { @@ -23,21 +23,6 @@ "name": "MemeTokenAlreadyInitialized", "type": "error" }, - { - "inputs": [], - "name": "RoundIsNotCompletedYet", - "type": "error" - }, - { - "inputs": [], - "name": "TooEarlyToUnstake", - "type": "error" - }, - { - "inputs": [], - "name": "Unsynchronized", - "type": "error" - }, { "anonymous": false, "inputs": [ @@ -48,7 +33,7 @@ "type": "address" }, { - "indexed": true, + "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" @@ -57,56 +42,6 @@ "name": "ClaimedReward", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "stakedRound", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "stakedAmount", - "type": "uint256" - } - ], - "name": "RewardStaked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "unstaker", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "unstakeRound", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "unstakedAmount", - "type": "uint256" - } - ], - "name": "RewardUnstaked", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -171,29 +106,23 @@ "type": "event" }, { - "anonymous": false, "inputs": [ { - "indexed": true, "internalType": "address", - "name": "unstaker", + "name": "_burnedToken", "type": "address" - }, + } + ], + "name": "claim", + "outputs": [ { - "indexed": true, "internalType": "uint256", - "name": "unstakeRound", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "unstakedAmount", + "name": "claimedAmount", "type": "uint256" } ], - "name": "UnstakeOrdered", - "type": "event" + "stateMutability": "nonpayable", + "type": "function" }, { "inputs": [ @@ -204,7 +133,7 @@ }, { "internalType": "address[]", - "name": "_sacrificedTokens", + "name": "_burnedTokens", "type": "address[]" } ], @@ -219,6 +148,81 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_burnedTokens", + "type": "address[]" + } + ], + "name": "claim", + "outputs": [ + { + "internalType": "uint256", + "name": "claimedAmount", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_round", + "type": "uint256" + } + ], + "name": "claim", + "outputs": [ + { + "internalType": "uint256", + "name": "claimedAmount", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_round", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "_burnedTokens", + "type": "address[]" + } + ], + "name": "claim", + "outputs": [ + { + "internalType": "uint256", + "name": "claimedAmount", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "claim", + "outputs": [ + { + "internalType": "uint256", + "name": "claimedAmount", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -247,7 +251,31 @@ }, { "internalType": "address", - "name": "_sacrificedToken", + "name": "_burnedToken", + "type": "address" + } + ], + "name": "claim", + "outputs": [ + { + "internalType": "uint256", + "name": "claimedAmount", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_round", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_burnedToken", "type": "address" } ], @@ -266,31 +294,7 @@ "inputs": [ { "internalType": "address", - "name": "beneficiary", - "type": "address" - }, - { - "internalType": "uint256[]", - "name": "roundNumbers", - "type": "uint256[]" - } - ], - "name": "getTotalRewardsOf", - "outputs": [ - { - "internalType": "uint256", - "name": "totalRewardsAmount", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_memeAltar", + "name": "_memeBurner", "type": "address" }, { @@ -319,7 +323,7 @@ }, { "inputs": [], - "name": "memeAltar", + "name": "memeBurner", "outputs": [ { "internalType": "address", @@ -343,19 +347,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "orderUnstake", - "outputs": [ - { - "internalType": "uint256", - "name": "unstakeRound", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -365,7 +356,7 @@ }, { "internalType": "address[]", - "name": "sacrificableTokens", + "name": "burnableTokens", "type": "address[]" } ], @@ -389,7 +380,7 @@ }, { "internalType": "address", - "name": "_sacrificedToken", + "name": "_burnedToken", "type": "address" }, { @@ -477,11 +468,6 @@ "name": "roundCompleted", "type": "bool" }, - { - "internalType": "uint256", - "name": "totalDefaultRewards", - "type": "uint256" - }, { "internalType": "uint256", "name": "totalRewards", @@ -490,150 +476,6 @@ ], "stateMutability": "view", "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - } - ], - "name": "stakeToBeSecured", - "outputs": [ - { - "internalType": "uint256", - "name": "stakedAmount", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256[]", - "name": "_rounds", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "_sacrificedTokens", - "type": "address[]" - } - ], - "name": "stakeToBeSecured", - "outputs": [ - { - "internalType": "uint256", - "name": "stakedAmount", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "stakeToBeSecured", - "outputs": [ - { - "internalType": "uint256", - "name": "stakedAmount", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "staked", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "unstakeRound", - "type": "uint256" - } - ], - "name": "unstake", - "outputs": [ - { - "internalType": "uint256", - "name": "unstakedAmount", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "unstakeOrdered", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" } ] } diff --git a/src/assets/img/token/elon.png b/src/assets/img/token/elon.png new file mode 100644 index 0000000..f76f332 Binary files /dev/null and b/src/assets/img/token/elon.png differ diff --git a/src/assets/img/token/elonMobile.png b/src/assets/img/token/elonMobile.png new file mode 100644 index 0000000..5575eb1 Binary files /dev/null and b/src/assets/img/token/elonMobile.png differ diff --git a/src/assets/img/token/elonvamp.png b/src/assets/img/token/elonvamp.png new file mode 100644 index 0000000..baf3846 Binary files /dev/null and b/src/assets/img/token/elonvamp.png differ diff --git a/src/assets/img/token/pepe.png b/src/assets/img/token/pepe.png new file mode 100644 index 0000000..73556bd Binary files /dev/null and b/src/assets/img/token/pepe.png differ diff --git a/src/assets/img/token/pepeMobile.png b/src/assets/img/token/pepeMobile.png new file mode 100644 index 0000000..c0e6db4 Binary files /dev/null and b/src/assets/img/token/pepeMobile.png differ diff --git a/src/assets/img/token/pepevamp.png b/src/assets/img/token/pepevamp.png new file mode 100644 index 0000000..f1dfc69 Binary files /dev/null and b/src/assets/img/token/pepevamp.png differ diff --git a/src/assets/img/token/shib.png b/src/assets/img/token/shib.png new file mode 100644 index 0000000..a2f2e0f Binary files /dev/null and b/src/assets/img/token/shib.png differ diff --git a/src/assets/img/token/shibMobile.png b/src/assets/img/token/shibMobile.png new file mode 100644 index 0000000..7712a19 Binary files /dev/null and b/src/assets/img/token/shibMobile.png differ diff --git a/src/assets/img/token/shibvamp.png b/src/assets/img/token/shibvamp.png new file mode 100644 index 0000000..497e726 Binary files /dev/null and b/src/assets/img/token/shibvamp.png differ diff --git a/src/assets/img/tokenomics_footer.png b/src/assets/img/tokenomics_footer.png new file mode 100644 index 0000000..87e7360 Binary files /dev/null and b/src/assets/img/tokenomics_footer.png differ diff --git a/src/assets/sass/base.sass b/src/assets/sass/base.sass index e0dccbd..eb52556 100644 --- a/src/assets/sass/base.sass +++ b/src/assets/sass/base.sass @@ -1,12 +1,23 @@ .bloodline-devider font-size: 42px - margin: 24px 0 text-align: center + margin: 16px 0 + @media (min-width: 992px) + margin: 24px 0 .bloodline-border - padding: 24px 32px - border: 4px solid #000000 + padding: 16px border-radius: 16px + border: 2px solid #000 + &.bloodline-border--variant1 + border: 4px solid var(--midnight-black) + @media (min-width: 992px) + border: 4px solid #000 + @media (min-width: 992px) + padding: 24px 32px + border: 4px solid #000 + &.purple + border-color: var(--purple) .bloodline-badge padding: 8px 16px 8px 16px @@ -30,6 +41,20 @@ border-color: rgba(var(--v-border-color),var(--v-border-opacity)) border-style: solid border-width: 0 - border-radius: 4px + border-radius: 16px box-shadow: 0 2px 1px -1px rgba(0, 0, 0, .2),0 1px 1px 0rgba(0, 0, 0, .14),0 1px 3px 0 rgba(0, 0, 0, .12) background-color: $darkgrey + @media (min-width: 992px) + border-radius: 4px + &.card--variant1 + border-radius: 0 + +.bloodline-token + height: 50px + width: 50px + @media (min-width: 992px) + height: auto + width: auto + +.bloodline-container + padding: 0 24px diff --git a/src/assets/sass/buttons.sass b/src/assets/sass/buttons.sass index 9127f6f..c79de41 100644 --- a/src/assets/sass/buttons.sass +++ b/src/assets/sass/buttons.sass @@ -1,12 +1,15 @@ .btn &.btn-immortal - background-color: $red + + background-color: $purple color: $button-color font-size: 24px padding: 16px 24px gap: 8px border-radius: 14px + @media (min-width: 992px) + background-color: $red &:hover,&:focus,&:active background-color: lighten($button-background-color, 10%), color: darken($button-color, 10%), diff --git a/src/assets/sass/main.sass b/src/assets/sass/main.sass index 4518ac0..ca212e4 100644 --- a/src/assets/sass/main.sass +++ b/src/assets/sass/main.sass @@ -37,18 +37,12 @@ body margin-top: auto .container - padding-right: 15px - padding-left: 15px margin-right: auto margin-left: auto @media (min-width: 992px) max-width: 800px -.section-header-container - width: 655px - text-align: center - font-size: 24px - margin-top: 64px - margin-bottom: 64px + padding-right: 15px + padding-left: 15px h1 font-weight: 700 @@ -57,7 +51,16 @@ h1 @media (min-width: 992px) font-size: 60px @media (min-width: 1200px) - +h2 + font-size: 40px + font-weight: 200 + @media (min-width: 992px) + font-size: 40px +h3 + font-size: 32px + font-weight: 200 + @media (min-width: 992px) + font-size: 40px .page-head margin-bottom: 80px .page-body diff --git a/src/assets/sass/variables.sass b/src/assets/sass/variables.sass index c8a756f..89ceca0 100644 --- a/src/assets/sass/variables.sass +++ b/src/assets/sass/variables.sass @@ -13,8 +13,9 @@ $black: #0F0F0F $grey: #808080 $red: #8B0000 $purple: #4B0082 - +$midnight-black: #0F0F0F $darkgrey: #202020 +$grey2: #2D2D2D $button-color: $white $button-background-color: $black @@ -29,8 +30,11 @@ $button-background-color: $black --tertiary-light: #{$tertiary-light} --tertiary-dark: #{$tertiary-dark} --grey: #{$grey} + --grey2: #{$grey2} --purple: #{$purple} --blood-color: #{$red} + --midnight-black: #{$midnight-black} + --darkgrey: #{$darkgrey} // :root // --font-size-text: 16px // --font-size-title: 32px diff --git a/src/components/BloodChart.vue b/src/components/BloodChart.vue index 9ebe204..98805c2 100644 --- a/src/components/BloodChart.vue +++ b/src/components/BloodChart.vue @@ -2,7 +2,9 @@
-
+
+ logo +
{{ coin.name }}
@@ -50,18 +52,25 @@ @@ -69,8 +78,14 @@ const dataPoints = [ diff --git a/src/components/RewardsWrapper.vue b/src/components/RewardsWrapper.vue new file mode 100644 index 0000000..3bfa167 --- /dev/null +++ b/src/components/RewardsWrapper.vue @@ -0,0 +1,53 @@ + + + + + diff --git a/src/components/SacrificeToken.vue b/src/components/SacrificeToken.vue index 0c3e1b2..d90f044 100644 --- a/src/components/SacrificeToken.vue +++ b/src/components/SacrificeToken.vue @@ -1,76 +1,87 @@ diff --git a/src/components/TokenClaim.vue b/src/components/TokenClaim.vue index 551d09f..c3841f6 100644 --- a/src/components/TokenClaim.vue +++ b/src/components/TokenClaim.vue @@ -1,57 +1,53 @@ - + diff --git a/src/helper/helper.js b/src/helper/helper.js new file mode 100644 index 0000000..7448db2 --- /dev/null +++ b/src/helper/helper.js @@ -0,0 +1,4 @@ + +export function getImageUrl(url) { + return new URL(url, import.meta.url).href; +} \ No newline at end of file diff --git a/src/main.js b/src/main.js index 0713bce..f215ec8 100644 --- a/src/main.js +++ b/src/main.js @@ -14,12 +14,12 @@ import { library } from '@fortawesome/fontawesome-svg-core' import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome' /* import specific icons */ -import { faArrowDown, faSpinner ,faPlus } from "@fortawesome/free-solid-svg-icons"; +import { faArrowDown, faSpinner ,faPlus, faCaretLeft, faCaretRight, faBars } from "@fortawesome/free-solid-svg-icons"; import { faDiscord, faTwitter, faTelegram } from "@fortawesome/free-brands-svg-icons"; /* add icons to the library */ -library.add(faArrowDown, faDiscord, faTwitter, faTelegram, faSpinner, faPlus); +library.add(faArrowDown, faDiscord, faTwitter, faTelegram, faSpinner, faPlus, faCaretLeft, faCaretRight, faBars); const app = createApp(App) diff --git a/src/stores/memeburner.js b/src/stores/memeburner.js new file mode 100644 index 0000000..140c454 --- /dev/null +++ b/src/stores/memeburner.js @@ -0,0 +1,18 @@ +import { defineStore } from "pinia"; +import MemeBurnerJson from "@/assets/contracts/MemeBurner.json"; + +export const useMemeburnerStore = defineStore("memeburner", { + state: () => ({ + config: MemeBurnerJson, + contract: null, + }), + getters: {}, + actions: { + async getCurrentRound() { + return await this.contract.methods.currentRound().call(); + }, + async getGoal(roundnumber) { + return await this.contract.methods.rounds(roundnumber).call(); + }, + }, +}); diff --git a/src/stores/rewardlocker.js b/src/stores/rewardlocker.js new file mode 100644 index 0000000..bd30f47 --- /dev/null +++ b/src/stores/rewardlocker.js @@ -0,0 +1,24 @@ +import { defineStore } from "pinia"; +import RewardLockerJson from "@/assets/contracts/RewardLocker.json"; + +export const useRewardLockerStore = defineStore("rewardlocker", { + state: () => ({ + config: RewardLockerJson, + contract: null, + }), + getters: {}, + actions: { + /* + * @param {*} walletAddress + * @param {*} roundNumber + * @param {*} tokenAddress + * @returns Rewards for specific token and specific round + */ + async getRewards(walletAddress, roundNumber, tokenAddress) { + return await this.contract.methods.rewards(walletAddress, roundNumber, tokenAddress).call(); + }, + async lastCompletedRound() { + return await this.contract.methods.lastCompletedRound().call(); + }, + }, +}); diff --git a/src/stores/tokens.js b/src/stores/tokens.js index 1c4111e..ba7642d 100644 --- a/src/stores/tokens.js +++ b/src/stores/tokens.js @@ -397,28 +397,52 @@ export const useTokenStore = defineStore("token", { // ], // }, { - name: "Meme1", + name: "$PEPE", + logo: "/src/assets/img/token/pepe.png", + logoMobile: "/src/assets/img/token/pepeMobile.png", + vamp: { + logo: "/src/assets/img/token/pepevamp.png", + name: "$PEPE Vamp Token", + }, + backgroundColor: "#4b8501", abi: Meme1Json.abi, contractAddress: Meme1Json.contractAddress, }, { - name: "Meme2", + name: "$SHIB", + logo: "/src/assets/img/token/shib.png", + logoMobile: "/src/assets/img/token/shibMobile.png", + vamp: { + logo: "/src/assets/img/token/shibvamp.png", + name: "$SHIBA Vamp Token", + }, abi: Meme2Json.abi, contractAddress: Meme2Json.contractAddress, }, + { + name: "$ELON", + logo: "/src/assets/img/token/elon.png", + logoMobile: "/src/assets/img/token/elonMobile.png", + vamp: { + logo: "/src/assets/img/token/shibvamp.png", + name: "$ELON Vamp Token", + }, + abi: null, + contractAddress: null, + }, ], activeToken: { address: null, abi: null, balance: null, - contract: null, - allowance: null, + contract: null, + allowance: null, + }, + loading: false, + memeBurner: { + config: MemeBurnerJson, + contract: null, }, - loading: false, - memeBurner: { - config: MemeBurnerJson, - contract: null - } }), getters: {}, actions: { @@ -428,31 +452,32 @@ export const useTokenStore = defineStore("token", { this.contract = new web3.eth.Contract(token.abi, token.contractAddress); const walletStore = useWalletStore(); if (walletStore.connected) { - this.activeToken.balance = await walletStore.getTokenBalance(token); - this.activeToken.allowance = await this.allowance(); - + this.activeToken.balance = await walletStore.getTokenBalance(token); + this.activeToken.allowance = await this.allowance(); } - }, - async allowance() { - const walletStore = useWalletStore(); - console.log("walletStore.address", walletStore.address); - const allowance = await this.contract.methods.allowance(walletStore.address, MemeBurnerJson.contractAddress).call(); - console.log("allowance", allowance); - return allowance; - }, - async approveToken(amount) { + }, + async allowance() { const walletStore = useWalletStore(); - this.loading = true; + console.log("walletStore.address", walletStore.address); + const allowance = await this.contract.methods + .allowance(walletStore.address, MemeBurnerJson.contractAddress) + .call(); + console.log("allowance", allowance); + return allowance; + }, + async approveToken(amount) { + const walletStore = useWalletStore(); + this.loading = true; var approve = await this.contract.methods .approve(this.memeBurner.config.contractAddress, amount) - .send({ from: walletStore.address }); - console.log("approve", approve); - this.loading = false; - return approve; + .send({ from: walletStore.address }); + console.log("approve", approve); + this.loading = false; + return approve; }, - async sacrificeToken(amount) { - try { - this.loading = true; + async sacrificeToken(amount) { + try { + this.loading = true; console.log("this.activeToken.", this.activeToken.contractAddress); const walletStore = useWalletStore(); console.log("walletStore.address", walletStore.address); @@ -460,24 +485,23 @@ export const useTokenStore = defineStore("token", { .sacrificeMeme(this.activeToken.contractAddress, "400000000000000000") .send({ from: walletStore.address }); console.log("reward", reward); - } catch (error) { - error.log(error); - - } finally { - this.loading = false; - } - }, - async getRewardsFor(amount) { + } catch (error) { + error.log(error); + } finally { + this.loading = false; + } + }, + async getRewardsFor(amount) { const contractsStore = useContractStore(); - var rewards = await contractsStore.list.memeBurnerPublic.methods + var rewards = await contractsStore.list.memeBurnerPublic.methods .getRewardFor(this.activeToken.contractAddress, amount) - .call(); - return rewards - }, - getTokenContract(token) { - console.log("token", token); + .call(); + return rewards; + }, + getTokenContract(token) { + console.log("token", token); const contractAddress = token.contractAddress; - console.log("contractAddress", contractAddress); + console.log("contractAddress", contractAddress); const activeToken = this.token.find((obj) => obj.contractAddress === contractAddress); console.log("activeToken", activeToken); const web3 = new Web3(window.ethereum); diff --git a/src/stores/wallet.js b/src/stores/wallet.js index df929c6..1b55af7 100644 --- a/src/stores/wallet.js +++ b/src/stores/wallet.js @@ -9,7 +9,6 @@ export const useWalletStore = defineStore("wallet", { address: null, }), getters: { - double: (state) => state.count * 2, }, actions: { increment() { diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index 8f69b09..9877192 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -1,4 +1,5 @@