Compare commits

2 Commits
Author SHA1 Message Date
Johann Barbie 610e6e83ac testing the test page 2023-06-24 21:07:22 +02:00
Johann Barbie d4af7da669 fix versions 2023-06-24 20:49:25 +02:00
43 changed files with 944 additions and 9630 deletions
-1
View File
@@ -1 +0,0 @@
VITE_GOERLI_KEY= "0-W9tOm6v_QP1PfRV8RuBCpWr-qoEbkN"
+7 -7
View File
@@ -2,11 +2,11 @@
module.exports = { module.exports = {
root: true, root: true,
extends: ["plugin:vue/vue3-essential", "eslint:recommended"], extends: [
'plugin:vue/vue3-essential',
'eslint:recommended',
],
parserOptions: { parserOptions: {
ecmaVersion: "latest", ecmaVersion: 'latest'
}, }
global: { }
BigInt: true,
},
};
+123 -7198
View File
File diff suppressed because it is too large Load Diff
+1 -9
View File
@@ -13,23 +13,15 @@
"@fortawesome/free-brands-svg-icons": "^6.4.0", "@fortawesome/free-brands-svg-icons": "^6.4.0",
"@fortawesome/free-solid-svg-icons": "^6.4.0", "@fortawesome/free-solid-svg-icons": "^6.4.0",
"@fortawesome/vue-fontawesome": "^3.0.3", "@fortawesome/vue-fontawesome": "^3.0.3",
"@walletconnect/ethereum-provider": "^2.9.0",
"@walletconnect/modal": "^2.6.0",
"@walletconnect/web3-provider": "^1.8.0",
"@web3modal/html": "^2.7.0",
"abi-decoder": "^2.4.0",
"ethers": "^6.6.3",
"pinia": "^2.0.36", "pinia": "^2.0.36",
"pinia-plugin-persistedstate": "^3.1.0", "pinia-plugin-persistedstate": "^3.1.0",
"sass": "^1.62.1", "sass": "^1.62.1",
"swiper": "^9.4.1", "swiper": "^9.4.1",
"vue": "^3.3.2", "vue": "^3.3.2",
"vue-router": "^4.2.0", "vue-router": "^4.2.0",
"web3": "^v1.9.0" "web3": "^1.7.1"
}, },
"devDependencies": { "devDependencies": {
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
"@vitejs/plugin-vue": "^4.2.3", "@vitejs/plugin-vue": "^4.2.3",
"eslint": "^8.39.0", "eslint": "^8.39.0",
"eslint-plugin-vue": "^9.11.0", "eslint-plugin-vue": "^9.11.0",
Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

+19 -60
View File
@@ -1,60 +1,35 @@
<script setup> <script setup>
import { onMounted, onUnmounted, provide, ref } from "vue"; import { onMounted } from "vue";
import { storeToRefs } from "pinia"; import { storeToRefs } from "pinia";
import Web3 from "web3";
import Navbar from "./components/Navbar.vue"; import Navbar from "./components/Navbar.vue";
import { useWalletStore } from "@/stores/wallet"; import { useWalletStore } from "@/stores/wallet";
const walletStore = useWalletStore(); const walletStore = useWalletStore();
import { useTokenStore } from "@/stores/tokens"; import { useTokenStore } from "@/stores/tokens";
import { useContractStore } from "@/stores/contracts"; import { useContractStore } from "@/stores/contracts";
import { useMemeburnerStore } from "@/stores/memeburner";
import { useRewardLockerStore } from "@/stores/rewardlocker";
import { useMultiCallStore } from "@/stores/multicall";
import { useRoundsStore } from "@/stores/rounds";
const tokenStore = useTokenStore(); const tokenStore = useTokenStore();
const contractStore = useContractStore(); const contractStore = useContractStore();
const memeBurnerStore = useMemeburnerStore(); const { memeBurner } = storeToRefs(tokenStore);
const rewardLockerStore = useRewardLockerStore();
const multiCallStore = useMultiCallStore();
const roundsStore = useRoundsStore();
const { memeBurner, token } = storeToRefs(tokenStore);
const { list } = storeToRefs(contractStore); const { list } = storeToRefs(contractStore);
const isMobile = ref(false);
isMobile.value = isMobileFunc();
onUnmounted(() => {
window.removeEventListener("resize", handleWindowSizeChange);
});
const handleWindowSizeChange = () => {
isMobile.value = isMobileFunc();
// your code
};
function isMobileFunc() {
if (screen.width <= 760) {
return true;
} else {
return false;
}
}
provide("isMobile", isMobile);
onMounted(async () => { onMounted(async () => {
window.addEventListener("resize", handleWindowSizeChange); var test = await walletStore.isConnected();
handleWindowSizeChange(); console.log("test", test);
// initContracts
await walletStore.init();
await tokenStore.init();
await memeBurnerStore.init();
await rewardLockerStore.init();
await memeBurnerStore.init();
await multiCallStore.init();
//Memeburner Contract
//init let web3 = new Web3("https://eth-goerli.g.alchemy.com/v2/0-W9tOm6v_QP1PfRV8RuBCpWr-qoEbkN");
roundsStore.currentRound = parseInt(await memeBurnerStore.getCurrentRound());
console.log("roundsStore.currentRound", roundsStore.currentRound); const contract = new web3.eth.Contract(memeBurner.value.config.abi, memeBurner.value.config.contractAddress);
roundsStore.activeRound = roundsStore.currentRound; list.value.memeBurnerPublic = new web3.eth.Contract(
await roundsStore.fillRound(roundsStore.activeRound); memeBurner.value.config.abi,
memeBurner.value.config.contractAddress
);
console.log("list", list.value);
const currentRound = await contract.methods.currentRound().call();
const rounds = await contract.methods.rounds("0x0e349D42C125acA39ea58024FFC23ED0fE5feE32").call();
console.log("currentRound", currentRound);
console.log("rounds", rounds);
}); });
</script> </script>
@@ -63,22 +38,6 @@ onMounted(async () => {
<div class="main"> <div class="main">
<RouterView /> <RouterView />
</div> </div>
<div class="footer">
<div class="footer-inner">
$BLOOD is 100%<br />
community owned.<br />
No team %, no pre-mine.
</div>
</div>
</template> </template>
<style lang="sass"> <style lang="sass"></style>
.footer
height: 450px
min-height: 450px
background-color: var(--grey2)
.footer-inner
padding: 24px
font-size: 24px
text-align: center
</style>
+7 -152
View File
@@ -1,6 +1,6 @@
{ {
"contractName": "LiquidityOwner", "contractName": "LiquidityOwner",
"contractAddress": "0x88E69D5CE691644F7cE151a2b085798194DAFEa1", "contractAddress": "0x0ce1d955f2a2658d6ca1CF61Fa300234fD8A262c",
"abi": [ "abi": [
{ {
"inputs": [ "inputs": [
@@ -38,65 +38,6 @@
"stateMutability": "payable", "stateMutability": "payable",
"type": "constructor" "type": "constructor"
}, },
{
"inputs": [
{
"internalType": "int24",
"name": "tickLower",
"type": "int24"
},
{
"internalType": "int24",
"name": "tickUpper",
"type": "int24"
}
],
"name": "_concatenateTicks",
"outputs": [
{
"internalType": "int48",
"name": "",
"type": "int48"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "int24",
"name": "tickLower",
"type": "int24"
},
{
"internalType": "int24",
"name": "tickUpper",
"type": "int24"
},
{
"internalType": "uint128",
"name": "liquidity",
"type": "uint128"
},
{
"internalType": "uint80",
"name": "tokenId",
"type": "uint80"
}
],
"internalType": "struct LiquidityOwner.Position",
"name": "position",
"type": "tuple"
}
],
"name": "addETHPositionToLinkedList",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{ {
"inputs": [ "inputs": [
{ {
@@ -125,32 +66,6 @@
"stateMutability": "nonpayable", "stateMutability": "nonpayable",
"type": "function" "type": "function"
}, },
{
"inputs": [
{
"internalType": "int48",
"name": "",
"type": "int48"
}
],
"name": "allRangesLinkedList",
"outputs": [
{
"internalType": "int48",
"name": "",
"type": "int48"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "burn",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{ {
"inputs": [], "inputs": [],
"name": "chunk", "name": "chunk",
@@ -365,6 +280,11 @@
], ],
"name": "positions", "name": "positions",
"outputs": [ "outputs": [
{
"internalType": "uint128",
"name": "liquidity",
"type": "uint128"
},
{ {
"internalType": "int24", "internalType": "int24",
"name": "tickLower", "name": "tickLower",
@@ -374,16 +294,6 @@
"internalType": "int24", "internalType": "int24",
"name": "tickUpper", "name": "tickUpper",
"type": "int24" "type": "int24"
},
{
"internalType": "uint128",
"name": "liquidity",
"type": "uint128"
},
{
"internalType": "uint80",
"name": "tokenId",
"type": "uint80"
} }
], ],
"stateMutability": "view", "stateMutability": "view",
@@ -398,26 +308,7 @@
} }
], ],
"name": "provideLiquidity", "name": "provideLiquidity",
"outputs": [ "outputs": [],
{
"internalType": "uint256",
"name": "ethSpentOnGas",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "rebalance",
"outputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"stateMutability": "nonpayable", "stateMutability": "nonpayable",
"type": "function" "type": "function"
}, },
@@ -440,35 +331,6 @@
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function"
}, },
{
"inputs": [
{
"internalType": "uint256",
"name": "payForGas",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "memeAltarGasPrice",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "consumedGasByMemeAltar",
"type": "uint256"
}
],
"name": "triggeredByMemeAltar",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{ {
"inputs": [], "inputs": [],
"name": "uniV3Pool", "name": "uniV3Pool",
@@ -518,13 +380,6 @@
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function"
}, },
{
"inputs": [],
"name": "withdrawETH",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{ {
"stateMutability": "payable", "stateMutability": "payable",
"type": "receive" "type": "receive"
+40 -379
View File
@@ -1,6 +1,6 @@
{ {
"contractName": "MemeBurner", "contractName": "MemeBurner",
"contractAddress": "0xc9cC73C414f122f85EfE20382EB753d29C5a0351", "contractAddress": "0x6eEAe97975e156400DD1DDD8eFc4CcB167BaAFC3",
"abi": [ "abi": [
{ {
"inputs": [ "inputs": [
@@ -24,11 +24,6 @@
"name": "_developer", "name": "_developer",
"type": "address" "type": "address"
}, },
{
"internalType": "address",
"name": "_admin",
"type": "address"
},
{ {
"internalType": "address", "internalType": "address",
"name": "_rewardLocker", "name": "_rewardLocker",
@@ -43,6 +38,11 @@
"internalType": "uint256[]", "internalType": "uint256[]",
"name": "roundGoals", "name": "roundGoals",
"type": "uint256[]" "type": "uint256[]"
},
{
"internalType": "uint256",
"name": "_liquidityAmountLimit",
"type": "uint256"
} }
], ],
"stateMutability": "nonpayable", "stateMutability": "nonpayable",
@@ -63,41 +63,27 @@
"name": "LiquidityOwnerAlreadyInitialized", "name": "LiquidityOwnerAlreadyInitialized",
"type": "error" "type": "error"
}, },
{
"inputs": [],
"name": "LiquidityOwnerTriggerFailed",
"type": "error"
},
{
"inputs": [],
"name": "MemeIsNotInAList",
"type": "error"
},
{
"inputs": [],
"name": "NextRoundRegistrationFailed",
"type": "error"
},
{ {
"inputs": [], "inputs": [],
"name": "NothingToSacrifice", "name": "NothingToSacrifice",
"type": "error" "type": "error"
}, },
{
"inputs": [],
"name": "RewardRegistrationFailed",
"type": "error"
},
{
"inputs": [],
"name": "RoundCompletedRegistrationFailed",
"type": "error"
},
{ {
"inputs": [], "inputs": [],
"name": "TokenIsNotInSacrificableList", "name": "TokenIsNotInSacrificableList",
"type": "error" "type": "error"
}, },
{
"inputs": [
{
"internalType": "address",
"name": "memeToTransfer",
"type": "address"
}
],
"name": "TokenTransferFailed",
"type": "error"
},
{ {
"inputs": [ "inputs": [
{ {
@@ -113,44 +99,26 @@
"anonymous": false, "anonymous": false,
"inputs": [ "inputs": [
{ {
"indexed": true, "indexed": false,
"internalType": "uint256",
"name": "roundNumber",
"type": "uint256"
},
{
"indexed": true,
"internalType": "address", "internalType": "address",
"name": "meme", "name": "meme",
"type": "address" "type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "memeMarket",
"type": "address"
} }
], ],
"name": "MemeAddedToSacrificableList", "name": "MemeAddedToSacrificeList",
"type": "event" "type": "event"
}, },
{ {
"anonymous": false, "anonymous": false,
"inputs": [ "inputs": [
{ {
"indexed": true, "indexed": false,
"internalType": "uint256",
"name": "roundNumber",
"type": "uint256"
},
{
"indexed": true,
"internalType": "address", "internalType": "address",
"name": "meme", "name": "meme",
"type": "address" "type": "address"
} }
], ],
"name": "MemeRemovedFromSacrificableList", "name": "MemeRemovedFromSacrificeList",
"type": "event" "type": "event"
}, },
{ {
@@ -178,90 +146,6 @@
"name": "MemeSacrificed", "name": "MemeSacrificed",
"type": "event" "type": "event"
}, },
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "newAdmin",
"type": "address"
}
],
"name": "NewAdmin",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"components": [
{
"internalType": "uint8",
"name": "b1",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "m1",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "b2",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "m2",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "b3",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "m4",
"type": "uint8"
}
],
"indexed": true,
"internalType": "struct MemeBurner.BM",
"name": "_bm",
"type": "tuple"
}
],
"name": "NewBM",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint256",
"name": "newDefaultGoal",
"type": "uint256"
}
],
"name": "NewDefaultRoundGoal",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint256",
"name": "newDurationLimit",
"type": "uint256"
}
],
"name": "NewRoundDurationLimit",
"type": "event"
},
{ {
"inputs": [ "inputs": [
{ {
@@ -276,156 +160,10 @@
} }
], ],
"name": "addMemeToList", "name": "addMemeToList",
"outputs": [ "outputs": [],
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable", "stateMutability": "nonpayable",
"type": "function" "type": "function"
}, },
{
"inputs": [
{
"components": [
{
"internalType": "uint8",
"name": "b1",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "m1",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "b2",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "m2",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "b3",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "m4",
"type": "uint8"
}
],
"internalType": "struct MemeBurner.BM",
"name": "newBM",
"type": "tuple"
}
],
"name": "adjustBM",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "newDefaultGoal",
"type": "uint256"
}
],
"name": "adjustDefaultGoal",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "newDurationLimit",
"type": "uint256"
}
],
"name": "adjustRoundDurationLimit",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "admin",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "bm",
"outputs": [
{
"internalType": "uint8",
"name": "b1",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "m1",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "b2",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "m2",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "b3",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "m4",
"type": "uint8"
}
],
"stateMutability": "view",
"type": "function"
},
{ {
"inputs": [], "inputs": [],
"name": "currentRound", "name": "currentRound",
@@ -439,57 +177,6 @@
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function"
}, },
{
"inputs": [],
"name": "defaultGoal",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "memeToSacrifice",
"type": "address"
}
],
"name": "getAmountToReachGoal",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "roundNumber",
"type": "uint256"
}
],
"name": "getGoalInBLD",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{ {
"inputs": [ "inputs": [
{ {
@@ -543,6 +230,19 @@
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function"
}, },
{
"inputs": [],
"name": "liquidityAmountLimit",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{ {
"inputs": [], "inputs": [],
"name": "liquidityOwner", "name": "liquidityOwner",
@@ -603,13 +303,7 @@
} }
], ],
"name": "removeMemeFromList", "name": "removeMemeFromList",
"outputs": [ "outputs": [],
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable", "stateMutability": "nonpayable",
"type": "function" "type": "function"
}, },
@@ -626,19 +320,6 @@
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function"
}, },
{
"inputs": [],
"name": "roundDurationLimit",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{ {
"inputs": [ "inputs": [
{ {
@@ -653,11 +334,6 @@
"internalType": "uint256", "internalType": "uint256",
"name": "goal", "name": "goal",
"type": "uint256" "type": "uint256"
},
{
"internalType": "uint256",
"name": "expirationTimestamp",
"type": "uint256"
} }
], ],
"stateMutability": "view", "stateMutability": "view",
@@ -700,25 +376,6 @@
"stateMutability": "nonpayable", "stateMutability": "nonpayable",
"type": "function" "type": "function"
}, },
{
"inputs": [
{
"internalType": "address",
"name": "newAdmin",
"type": "address"
}
],
"name": "switchAdmin",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{ {
"inputs": [], "inputs": [],
"name": "weth", "name": "weth",
@@ -731,6 +388,10 @@
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function"
},
{
"stateMutability": "payable",
"type": "receive"
} }
] ]
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"contractName": "MemeToken", "contractName": "MemeToken",
"contractAddress": "0x9dcD7Cd83ED0Fe69DDfE3c2A265a1207F2Bc3219", "contractAddress": "0xeC73Ec89897a36E9Ca36B2190964bBd8C46748AD",
"abi": [ "abi": [
{ {
"inputs": [ "inputs": [
-444
View File
@@ -1,444 +0,0 @@
{
"contractName": "Multicall3",
"contractAddress": "0xcA11bde05977b3631167028862bE2a173976CA11",
"abi": [
{
"inputs": [
{
"components": [
{
"internalType": "address",
"name": "target",
"type": "address"
},
{
"internalType": "bytes",
"name": "callData",
"type": "bytes"
}
],
"internalType": "struct Multicall3.Call[]",
"name": "calls",
"type": "tuple[]"
}
],
"name": "aggregate",
"outputs": [
{
"internalType": "uint256",
"name": "blockNumber",
"type": "uint256"
},
{
"internalType": "bytes[]",
"name": "returnData",
"type": "bytes[]"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "address",
"name": "target",
"type": "address"
},
{
"internalType": "bool",
"name": "allowFailure",
"type": "bool"
},
{
"internalType": "bytes",
"name": "callData",
"type": "bytes"
}
],
"internalType": "struct Multicall3.Call3[]",
"name": "calls",
"type": "tuple[]"
}
],
"name": "aggregate3",
"outputs": [
{
"components": [
{
"internalType": "bool",
"name": "success",
"type": "bool"
},
{
"internalType": "bytes",
"name": "returnData",
"type": "bytes"
}
],
"internalType": "struct Multicall3.Result[]",
"name": "returnData",
"type": "tuple[]"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "address",
"name": "target",
"type": "address"
},
{
"internalType": "bool",
"name": "allowFailure",
"type": "bool"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "callData",
"type": "bytes"
}
],
"internalType": "struct Multicall3.Call3Value[]",
"name": "calls",
"type": "tuple[]"
}
],
"name": "aggregate3Value",
"outputs": [
{
"components": [
{
"internalType": "bool",
"name": "success",
"type": "bool"
},
{
"internalType": "bytes",
"name": "returnData",
"type": "bytes"
}
],
"internalType": "struct Multicall3.Result[]",
"name": "returnData",
"type": "tuple[]"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "address",
"name": "target",
"type": "address"
},
{
"internalType": "bytes",
"name": "callData",
"type": "bytes"
}
],
"internalType": "struct Multicall3.Call[]",
"name": "calls",
"type": "tuple[]"
}
],
"name": "blockAndAggregate",
"outputs": [
{
"internalType": "uint256",
"name": "blockNumber",
"type": "uint256"
},
{
"internalType": "bytes32",
"name": "blockHash",
"type": "bytes32"
},
{
"components": [
{
"internalType": "bool",
"name": "success",
"type": "bool"
},
{
"internalType": "bytes",
"name": "returnData",
"type": "bytes"
}
],
"internalType": "struct Multicall3.Result[]",
"name": "returnData",
"type": "tuple[]"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [],
"name": "getBasefee",
"outputs": [
{
"internalType": "uint256",
"name": "basefee",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "blockNumber",
"type": "uint256"
}
],
"name": "getBlockHash",
"outputs": [
{
"internalType": "bytes32",
"name": "blockHash",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getBlockNumber",
"outputs": [
{
"internalType": "uint256",
"name": "blockNumber",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getChainId",
"outputs": [
{
"internalType": "uint256",
"name": "chainid",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getCurrentBlockCoinbase",
"outputs": [
{
"internalType": "address",
"name": "coinbase",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getCurrentBlockDifficulty",
"outputs": [
{
"internalType": "uint256",
"name": "difficulty",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getCurrentBlockGasLimit",
"outputs": [
{
"internalType": "uint256",
"name": "gaslimit",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getCurrentBlockTimestamp",
"outputs": [
{
"internalType": "uint256",
"name": "timestamp",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "addr",
"type": "address"
}
],
"name": "getEthBalance",
"outputs": [
{
"internalType": "uint256",
"name": "balance",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getLastBlockHash",
"outputs": [
{
"internalType": "bytes32",
"name": "blockHash",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bool",
"name": "requireSuccess",
"type": "bool"
},
{
"components": [
{
"internalType": "address",
"name": "target",
"type": "address"
},
{
"internalType": "bytes",
"name": "callData",
"type": "bytes"
}
],
"internalType": "struct Multicall3.Call[]",
"name": "calls",
"type": "tuple[]"
}
],
"name": "tryAggregate",
"outputs": [
{
"components": [
{
"internalType": "bool",
"name": "success",
"type": "bool"
},
{
"internalType": "bytes",
"name": "returnData",
"type": "bytes"
}
],
"internalType": "struct Multicall3.Result[]",
"name": "returnData",
"type": "tuple[]"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bool",
"name": "requireSuccess",
"type": "bool"
},
{
"components": [
{
"internalType": "address",
"name": "target",
"type": "address"
},
{
"internalType": "bytes",
"name": "callData",
"type": "bytes"
}
],
"internalType": "struct Multicall3.Call[]",
"name": "calls",
"type": "tuple[]"
}
],
"name": "tryBlockAndAggregate",
"outputs": [
{
"internalType": "uint256",
"name": "blockNumber",
"type": "uint256"
},
{
"internalType": "bytes32",
"name": "blockHash",
"type": "bytes32"
},
{
"components": [
{
"internalType": "bool",
"name": "success",
"type": "bool"
},
{
"internalType": "bytes",
"name": "returnData",
"type": "bytes"
}
],
"internalType": "struct Multicall3.Result[]",
"name": "returnData",
"type": "tuple[]"
}
],
"stateMutability": "payable",
"type": "function"
}
]
}
+6 -147
View File
@@ -1,6 +1,6 @@
{ {
"contractName": "RewardLocker", "contractName": "RewardLocker",
"contractAddress": "0x7C3D5a19878d550D0c6c2b0BFC884ef410F6e440", "contractAddress": "0x3bEc26159dbA0A32210eaDF6A938F1BbE8bfDAA0",
"abi": [ "abi": [
{ {
"inputs": [ "inputs": [
@@ -116,12 +116,6 @@
"name": "user", "name": "user",
"type": "address" "type": "address"
}, },
{
"indexed": true,
"internalType": "uint256",
"name": "roundNumber",
"type": "uint256"
},
{ {
"indexed": true, "indexed": true,
"internalType": "address", "internalType": "address",
@@ -129,7 +123,7 @@
"type": "address" "type": "address"
}, },
{ {
"indexed": false, "indexed": true,
"internalType": "uint256", "internalType": "uint256",
"name": "reward", "name": "reward",
"type": "uint256" "type": "uint256"
@@ -154,7 +148,7 @@
"type": "address" "type": "address"
}, },
{ {
"indexed": true, "indexed": false,
"internalType": "uint256", "internalType": "uint256",
"name": "totalRoundRewards", "name": "totalRoundRewards",
"type": "uint256" "type": "uint256"
@@ -268,78 +262,6 @@
"stateMutability": "nonpayable", "stateMutability": "nonpayable",
"type": "function" "type": "function"
}, },
{
"inputs": [
{
"internalType": "uint256",
"name": "roundNumber",
"type": "uint256"
}
],
"name": "getSacrificableTokens",
"outputs": [
{
"internalType": "address[]",
"name": "",
"type": "address[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "roundNumber",
"type": "uint256"
},
{
"internalType": "address",
"name": "sacrificedToken",
"type": "address"
}
],
"name": "getSacrificedTokenCoefficient",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "roundNumber",
"type": "uint256"
},
{
"internalType": "address",
"name": "sacrificedToken",
"type": "address"
}
],
"name": "getSacrificedTokenTotalRewards",
"outputs": [
{
"internalType": "uint256",
"name": "totalDefaultRewardsForToken",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "totalRewardsForToken",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{ {
"inputs": [ "inputs": [
{ {
@@ -487,35 +409,6 @@
"stateMutability": "nonpayable", "stateMutability": "nonpayable",
"type": "function" "type": "function"
}, },
{
"inputs": [
{
"internalType": "address",
"name": "user",
"type": "address"
},
{
"internalType": "address",
"name": "_sacrificedToken",
"type": "address"
},
{
"internalType": "uint256",
"name": "reward",
"type": "uint256"
}
],
"name": "registerRewardNextRound",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{ {
"inputs": [ "inputs": [
{ {
@@ -580,9 +473,9 @@
"name": "rounds", "name": "rounds",
"outputs": [ "outputs": [
{ {
"internalType": "uint256", "internalType": "bool",
"name": "roundCompletedTimestamp", "name": "roundCompleted",
"type": "uint256" "type": "bool"
}, },
{ {
"internalType": "uint256", "internalType": "uint256",
@@ -598,40 +491,6 @@
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function"
}, },
{
"inputs": [
{
"internalType": "uint256",
"name": "stakeCoefficient",
"type": "uint256"
},
{
"internalType": "uint256[]",
"name": "_rounds",
"type": "uint256[]"
},
{
"internalType": "address[]",
"name": "_sacrificedTokens",
"type": "address[]"
}
],
"name": "stakeAndClaim",
"outputs": [
{
"internalType": "uint256",
"name": "stakedAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "claimedAmount",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{ {
"inputs": [ "inputs": [
{ {

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 120 KiB

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

+4 -27
View File
@@ -1,21 +1,12 @@
.bloodline-devider .bloodline-devider
font-size: 42px font-size: 42px
text-align: center
margin: 16px 0
@media (min-width: 992px)
margin: 24px 0 margin: 24px 0
text-align: center
.bloodline-border .bloodline-border
padding: 16px
border-radius: 16px
border: 2px solid #000
&.bloodline-border--variant1
border: 4px solid var(--midnight-black)
@media (min-width: 992px)
padding: 24px 32px padding: 24px 32px
border: 4px solid #000 border: 4px solid #000000
&.purple border-radius: 16px
border-color: var(--purple)
.bloodline-badge .bloodline-badge
padding: 8px 16px 8px 16px padding: 8px 16px 8px 16px
@@ -39,20 +30,6 @@
border-color: rgba(var(--v-border-color),var(--v-border-opacity)) border-color: rgba(var(--v-border-color),var(--v-border-opacity))
border-style: solid border-style: solid
border-width: 0 border-width: 0
border-radius: 16px border-radius: 4px
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) 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 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
+3 -7
View File
@@ -1,17 +1,13 @@
.btn .btn
&.btn-immortal &.btn-immortal
background-color: $red
background-color: $purple
color: $button-color color: $button-color
font-size: 24px font-size: 24px
padding: 16px 24px padding: 16px 24px
gap: 8px gap: 8px
border-radius: 14px border-radius: 14px
&:hover,&:focus,&:active &:hover,&:focus,&:active
background-color: darken($purple, 10%), background-color: lighten($button-background-color, 10%),
color: darken($button-color, 10%),
cursor: pointer cursor: pointer
&.btn--disabled
background-color: #151515
color: #808080
cursor: not-allowed
+9 -12
View File
@@ -37,12 +37,18 @@ body
margin-top: auto margin-top: auto
.container .container
padding-right: 15px
padding-left: 15px
margin-right: auto margin-right: auto
margin-left: auto margin-left: auto
@media (min-width: 992px) @media (min-width: 992px)
max-width: 800px max-width: 800px
padding-right: 15px .section-header-container
padding-left: 15px width: 655px
text-align: center
font-size: 24px
margin-top: 64px
margin-bottom: 64px
h1 h1
font-weight: 700 font-weight: 700
@@ -51,16 +57,7 @@ h1
@media (min-width: 992px) @media (min-width: 992px)
font-size: 60px font-size: 60px
@media (min-width: 1200px) @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 .page-head
margin-bottom: 80px margin-bottom: 80px
.page-body .page-body
+1 -5
View File
@@ -13,9 +13,8 @@ $black: #0F0F0F
$grey: #808080 $grey: #808080
$red: #8B0000 $red: #8B0000
$purple: #4B0082 $purple: #4B0082
$midnight-black: #0F0F0F
$darkgrey: #202020 $darkgrey: #202020
$grey2: #2D2D2D
$button-color: $white $button-color: $white
$button-background-color: $black $button-background-color: $black
@@ -30,11 +29,8 @@ $button-background-color: $black
--tertiary-light: #{$tertiary-light} --tertiary-light: #{$tertiary-light}
--tertiary-dark: #{$tertiary-dark} --tertiary-dark: #{$tertiary-dark}
--grey: #{$grey} --grey: #{$grey}
--grey2: #{$grey2}
--purple: #{$purple} --purple: #{$purple}
--blood-color: #{$red} --blood-color: #{$red}
--midnight-black: #{$midnight-black}
--darkgrey: #{$darkgrey}
// :root // :root
// --font-size-text: 16px // --font-size-text: 16px
// --font-size-title: 32px // --font-size-title: 32px
+25 -55
View File
@@ -1,15 +1,13 @@
<template> <template>
<div class="blood-chart-wrapper" v-if="props.data"> <div class="blood-chart-wrapper">
<div class="blood-chart-element" v-for="coin in props.data.token" :key="coin.name"> <div class="blood-chart-element" v-for="coin in dataPoints" :key="coin.name">
<div class="blood-chart-element-header"> <div class="blood-chart-element-header">
<div class="blood-chart-coin"> <div class="blood-chart-coin"></div>
<img :src="getImageUrl(coin.vamplogo)" alt="logo" />
</div>
<div class="blood-chart-coin-title">{{ coin.name }}</div> <div class="blood-chart-coin-title">{{ coin.name }}</div>
</div> </div>
<div class="blood-chart-element-body"> <div class="blood-chart-element-body">
<div class="blood-chart-bar-wrapper"> <div class="blood-chart-bar-wrapper">
<div class="blood-chart-bar" :style="`height: ${getPercentage(coin.amount, props.data.goal)}%`"> <div class="blood-chart-bar" :style="`height: ${coin.percentage}%`">
<svg <svg
class="waves" class="waves"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
@@ -39,14 +37,12 @@
<div><span class="dot"></span></div> <div><span class="dot"></span></div>
<div><span class="dot"></span></div> <div><span class="dot"></span></div>
</div> </div>
<div class="blood-chart-bar-percentage">{{ getPercentage(coin.amount, props.data.goal) }}%</div> <div class="blood-chart-bar-percentage">{{ coin.percentage }}%</div>
</div> </div>
</div> </div>
</div> </div>
<div class="blood-chart-element-footer"> <div class="blood-chart-element-footer">
<div class="blood-chart-amount"> <div class="blood-chart-amount">130,4b</div>
{{ compactNumber(coin.amount) }}
</div>
<div class="blood-chart-coin">$BLOOD</div> <div class="blood-chart-coin">$BLOOD</div>
</div> </div>
</div> </div>
@@ -54,51 +50,27 @@
</template> </template>
<script setup> <script setup>
import { getPercentage, compactNumber } from "@/helper/helper.js"; const dataPoints = [
import { useMemeburnerStore } from "@/stores/memeburner"; {
name: "PEPE",
const memeBurnerStore = useMemeburnerStore(); percentage: 62.2,
},
const props = defineProps({ {
data: Array, name: "Shiba",
}); percentage: 31.2,
},
console.log(props.data); {
name: "Doge",
function getImageUrl(url) { percentage: 54.5,
return new URL(url, import.meta.url).href; },
} ];
// const dataPoints = [
// {
// name: "$PEPE",
// percentage: 62.2,
// icon: "/assets/img/token/pepevamp.png",
// },
// {
// name: "$SHIB",
// percentage: 31.2,
// icon: "/assets/img/token/shibvamp.png",
// },
// {
// name: "$ELON",
// percentage: 54.5,
// icon: "/assets/img/token/elonvamp.png",
// },
// ];
</script> </script>
<style lang="sass"> <style lang="sass">
.blood-chart-wrapper .blood-chart-wrapper
height: 750px height: 750px
width: 100%
justify-content: space-around
display: inline-flex display: inline-flex
@media (min-width: 992px)
gap: 96px gap: 96px
width: unset
justify-content: unset
.blood-chart-element .blood-chart-element
height: 100% height: 100%
width: 80px width: 80px
@@ -110,22 +82,19 @@ function getImageUrl(url) {
height: 80px height: 80px
width: 80px width: 80px
border-radius: 80px border-radius: 80px
background-color: grey
margin-left: auto margin-left: auto
margin-right: auto margin-right: auto
position: relative position: relative
margin-bottom: 16px margin-bottom: 16px
overflow: hidden
.blood-chart-coin-title .blood-chart-coin-title
text-align: center text-align: center
margin-bottom: 32px margin-bottom: 32px
font-size: 16px
@media (min-width: 992px)
font-size: 24px font-size: 24px
.blood-chart-element-body .blood-chart-element-body
background-color: rgba(233, 233, 233, 0.2) background-color: rgba(233, 233, 233, 0.2)
flex: 0 0 500px flex: 1 1 auto
border-radius: 8px 8px 40px 40px border-radius: 8px 8px 40px 40px
text-align: left
.blood-chart-bar-wrapper .blood-chart-bar-wrapper
height: 100% height: 100%
display: flex display: flex
@@ -134,13 +103,14 @@ function getImageUrl(url) {
margin-top: auto margin-top: auto
background-color: var(--blood-color) background-color: var(--blood-color)
position: relative position: relative
border-radius: 0 0 40px 40px border-radius: 8px 8px 40px 40px
.blood-chart-bar-percentage .blood-chart-bar-percentage
font-size: 14px font-size: 14px
text-align: center text-align: center
margin-top: 16px
.waves .waves
position: absolute position: absolute
top: -10px top: -8px
width: 100% width: 100%
height: 10px height: 10px
.blood-chart-element-footer .blood-chart-element-footer
+8 -29
View File
@@ -1,17 +1,15 @@
<script setup> <script setup>
import { storeToRefs } from "pinia"; import { storeToRefs } from "pinia";
import { ref, onMounted, onBeforeUnmount, inject } from "vue"; import { ref, onMounted, onBeforeUnmount } from "vue";
import { useWalletStore } from "@/stores/wallet"; import { useWalletStore } from "@/stores/wallet";
const walletStore = useWalletStore(); const walletStore = useWalletStore();
const { connected, address } = storeToRefs(walletStore); const { connected, address } = storeToRefs(walletStore);
const isMobile = inject("isMobile");
const showNavbar = ref(true); const showNavbar = ref(true);
const lastScrollPosition = ref(0); const lastScrollPosition = ref(0);
function onScroll() { function onScroll() {
const currentScrollPosition = const currentScrollPosition = window.pageYOffset || document.documentElement.scrollTop;
window.pageYOffset || document.documentElement.scrollTop;
if (currentScrollPosition < 0) { if (currentScrollPosition < 0) {
return; return;
} }
@@ -34,11 +32,12 @@ onBeforeUnmount(() => {
<div class="navbar-inner"> <div class="navbar-inner">
<div class="navbar-icon"> <div class="navbar-icon">
<router-link to="/"> <router-link to="/">
<img alt="logo" class="logo" src="/assets/img/vampir.png" /> <!-- <img alt="Parry logo" class="logo" src="@/assets/img/logo.svg" /> -->
<img alt="logo" class="logo" src="@/assets/img/vampir.png" />
</router-link> </router-link>
</div> </div>
<div class="navbar-text">Bloodline</div> <div class="navbar-text">Bloodline</div>
<div class="navbar-center" v-if="!isMobile"> <div class="navbar-center">
<div class="navbar-social-links"> <div class="navbar-social-links">
<div class="social-bloodline-badge"> <div class="social-bloodline-badge">
<div class="social-bloodline-badge-icon"> <div class="social-bloodline-badge-icon">
@@ -61,14 +60,9 @@ onBeforeUnmount(() => {
</div> </div>
</div> </div>
<div class="navbar-end"> <div class="navbar-end">
<div v-if="!isMobile">
<div v-if="!connected" class="btn btn-immortal" @click="walletStore.connectWallet">connect</div> <div v-if="!connected" class="btn btn-immortal" @click="walletStore.connectWallet">connect</div>
<span v-else> {{ address }}</span> <span v-else> {{ address }}</span>
</div> </div>
<div v-else class="hamburger-menu">
<font-awesome-icon :icon="['fas', 'bars']" />
</div>
</div>
</div> </div>
</div> </div>
</header> </header>
@@ -84,8 +78,6 @@ header
width: 100% width: 100%
transform: translate3d(0,0,0) transform: translate3d(0,0,0)
transition: transform .3s ease,visibility 0s .3s linear transition: transform .3s ease,visibility 0s .3s linear
height: 82px
@media (min-width: 992px)
height: 128px height: 128px
&.navbar--hidden &.navbar--hidden
transform: translate3d(0,-100%,0) transform: translate3d(0,-100%,0)
@@ -97,18 +89,10 @@ header
align-items: center align-items: center
@media (min-width: 992px) @media (min-width: 992px)
padding: 16px 24px padding: 16px 24px
.navbar-icon
img
height: 50px
width: 50px
.navbar-text .navbar-text
font-family: 'Vampire', sans-serif font-family: 'Vampire', sans-serif
font-size: 36px
margin-left: 16px
letter-spacing: 0.138em
line-height: 73.107px
@media (min-width: 992px)
font-size: 64px font-size: 64px
letter-spacing: 0.138em
.navbar-center .navbar-center
display: flex display: flex
margin-left: auto margin-left: auto
@@ -121,15 +105,10 @@ header
border-radius: 14px border-radius: 14px
background-color: #0F0F0F background-color: #0F0F0F
display: flex display: flex
&:hover,&:active,&:focus
background-color: lighten(#0F0F0F, 10%)
cursor: pointer
.social-bloodline-badge-icon .social-bloodline-badge-icon
margin-right: 8px margin-right: 8px
.navbar-end .navbar-end
display: flex display: flex
margin-left: auto flex: 0 0 200px
.hamburger-menu justify-content: flex-end
color: var(--purple)
font-size: 42px
</style> </style>
-54
View File
@@ -1,54 +0,0 @@
<template>
<div class="rewards-wrapper">
<div class="rewards-header">
<div class="rewards-header-title">
{{ props.title }}
</div>
<div class="rewards-header-info">{{ props.info }}</div>
</div>
<div class="rewards-sacrifice-wrapper bloodline-border bloodline-border--variant1">
<div class="rewards-body">
<div class="rewards-coin">$BLOOD</div>
<div class="rewards-amount">{{ props.amount }}</div>
</div>
<img class="bloodline-token" :src="props.image" alt="vampir" />
</div>
</div>
</template>
<script setup>
const props = defineProps({
title: String,
info: String,
amount: String,
image: String,
});
</script>
<style lang="sass">
.rewards-header
font-size: 16px
padding: 8px
display: flex
@media (min-width: 992px)
font-size: 24px
.rewards-header-info
margin-left: auto
.rewards-sacrifice-wrapper, .rewards-clan-wrapper
display: flex
.rewards-body
align-self: center
.rewards-coin
font-size: 16px
@media (min-width: 992px)
font-size: 24px
.rewards-amount
font-size: 24px
margin-top: 8px
@media (min-width: 992px)
font-size: 40px
margin-top: 0
img
margin-left: auto
align-self: center
</style>
+52 -153
View File
@@ -1,81 +1,51 @@
<template> <template>
<div class="sacrifice-wrapper card bloodline-wrapper"> <div class="sacrifice-wrapper card bloodline-wrapper">
{{ activeToken.allowance }} {{ activeToken.allowance }}
<div class="sacrifice-headline">Select Token</div>
<div class="sacrifice-inner">
<div class="sacrifice-headline">Select Sacrifice</div>
<div class="sacrifice-select-tokens"> <div class="sacrifice-select-tokens">
<div class="sacrifice-tokens"> <div class="sacrifice-tokens">
<div <div
class="sacrifice-token" class="sacrifice-token"
:class="[ :class="[{ 'sacrifice-token--active': token.contractAddress === activeToken.contractAddress }]"
{
'sacrifice-token--active': token.contractAddress === activeToken.contractAddress,
'bloodline-border': token.contractAddress === activeToken.contractAddress,
'bloodline-border--variant1': token.contractAddress === activeToken.contractAddress,
},
]"
v-for="token in props.data" v-for="token in props.data"
:key="token.contractAddress" :key="token.contractAddress"
@click="tokenStore.changeActiveToken(token)" @click="tokenStore.changeActiveToken(token)"
> >
<div class="sacrifice-token-logo"> {{ token.name }}
<img v-if="isMobile" :src="token.logoMobile" alt="token logo" />
<img v-if="!isMobile" :src="token.logo" alt="token logo" />
</div>
<div class="sacrifice-token-name">{{ token.name }}</div>
</div> </div>
</div> </div>
</div> </div>
<div class="sacrifice-from-to-wrapper" v-if="activeToken.contractAddress"> <div class="sacrifice-from-to-wrapper" v-if="activeToken.contractAddress">
<div <div class="sacrifice-from-wrapper bloodline-border">
:class="{
'sacrifice-from-wrapper': true,
'bloodline-border': true,
'bloodline-border--variant1': true,
purple: isMobile,
}"
>
<div class="sarcrifice-from-input"> <div class="sarcrifice-from-input">
<input @input="processChange" v-model="tokenNumber" :placeholder="0" /> <input @input="processChange" type="number" v-model="tokenNumber" :placeholder="0" /><img
<div class="sacrifice-logo"> src="@/assets/img/vampir.png"
<img :src="activeToken.logo" alt="vampir" /> alt="vampir"
</div> />
</div> </div>
<div class="value-adder"> <div class="value-adder">
<div class="sacrifice-adder-step bloodline-badge" @click="addTokens(1000000)">+1m</div>
<div class="sacrifice-adder-step bloodline-badge" @click="addTokens(10000000)">+10m</div> <div class="sacrifice-adder-step bloodline-badge" @click="addTokens(10000000)">+10m</div>
<div class="sacrifice-adder-step bloodline-badge" @click="addTokens(100000000)">+100m</div> <div class="sacrifice-adder-step bloodline-badge" @click="addTokens(100000000)">+100m</div>
<div class="sacrifice-adder-step bloodline-badge" @click="addTokens(1000000000)">+1b</div> <div class="sacrifice-adder-balance">Balance: {{ parseFloat(activeToken.balance) }}</div>
<!-- <div class="sacrifice-adder-balance">Balance: {{ parseFloat(activeToken.balance) }}</div> <div class="sacrifice-adder-max" @click="tokenNumber = parseFloat(activeToken.balance)">Max</div>
<div class="sacrifice-adder-max" @click="tokenNumber = parseFloat(activeToken.balance)">
Max
</div> -->
</div> </div>
</div> </div>
<div class="sacrifice-divider bloodline-devider"> <div class="sacrifice-divider bloodline-devider">
<font-awesome-icon :icon="['fas', 'arrow-down']" /> <font-awesome-icon :icon="['fas', 'arrow-down']" />
</div> </div>
<div <div class="sacrifice-to-wrapper bloodline-border">
:class="{
'sacrifice-from-wrapper': true,
'bloodline-border': true,
'bloodline-border--variant1': true,
purple: isMobile && output && output > 0,
}"
>
<div class="sarcrifice-from-input"> <div class="sarcrifice-from-input">
<div class="sacrifice-to-output"> <div class="sacrifice-to-output">
<div class="sacrifice-to-output-coin">$BLOOD</div> <div class="sacrifice-to-output-coin">{{ activeToken.name }}</div>
<div class="sacrifice-to-output-rewards">{{ output }}</div> <div class="sacrifice-to-output-rewards">{{ output }}</div>
</div> </div>
<div class="sacrifice-logo"> <img src="@/assets/img/vampir.png" alt="vampir" />
<img :src="activeToken.vamp.logo" :alt="activeToken.vamp.name" />
</div>
</div> </div>
</div> </div>
<div class="sacrifice-fees-info-wrapper"> <div class="sacrifice-fees-info-wrapper">
<div class="sacrifice-fees-img"> <div class="sacrifice-fees-img">
<img src="/assets/img/fuel-noozle.png" alt="fuel noozle" /> <img src="@/assets/img/fuel-noozle.png" alt="fuel noozle" />
</div> </div>
<div class="sacrifice-fees-body"> <div class="sacrifice-fees-body">
<div class="sacrifice-fees-body-header"> <div class="sacrifice-fees-body-header">
@@ -90,17 +60,12 @@
<div <div
class="btn btn-immortal" class="btn btn-immortal"
v-if="activeToken.allowance > 0 && activeToken.allowance >= tokenNumber" v-if="activeToken.allowance > 0 && activeToken.allowance >= tokenNumber"
@click="approvalData = memeburnerStore.sacrificeMeme(tokenNumber)" @click="approvalData = tokenStore.sacrificeToken(1)"
>
<font-awesome-icon v-if="memeburnerStore.loading" icon="spinner" spin />
Sacrifce {{ activeToken.name }}
</div>
<div
class="btn btn-immortal"
v-else
@click="approvalData = tokenStore.approveToken(tokenNumber)"
> >
<font-awesome-icon v-if="loading" icon="spinner" spin /> <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)">
Approve {{ activeToken.name }} Approve {{ activeToken.name }}
</div> </div>
</div> </div>
@@ -110,17 +75,14 @@
</div> </div>
</div> </div>
</div> </div>
</div>
</template> </template>
<script setup> <script setup>
import { ref, defineProps, watch, inject, computed } from "vue"; import { ref, defineProps, watch } from "vue";
import { useWalletStore } from "@/stores/wallet"; import { useWalletStore } from "@/stores/wallet";
import { useTokenStore } from "@/stores/tokens"; import { useTokenStore } from "@/stores/tokens";
import { useMemeburnerStore } from "@/stores/memeBurner";
import { storeToRefs } from "pinia"; import { storeToRefs } from "pinia";
import Helper from "@/utils/helper.js"; import Helper from "@/utils/helper.js";
const isMobile = inject("isMobile");
const walletStore = useWalletStore(); const walletStore = useWalletStore();
const { contract, connected } = storeToRefs(walletStore); const { contract, connected } = storeToRefs(walletStore);
@@ -128,8 +90,6 @@ const { contract, connected } = storeToRefs(walletStore);
const tokenStore = useTokenStore(); const tokenStore = useTokenStore();
const { activeToken, loading } = storeToRefs(tokenStore); const { activeToken, loading } = storeToRefs(tokenStore);
const memeburnerStore = useMemeburnerStore();
const props = defineProps({ const props = defineProps({
data: Array, data: Array,
}); });
@@ -146,152 +106,90 @@ const tokenNumber = ref(0);
const output = ref(0); const output = ref(0);
const approvalData = ref(null); const approvalData = ref(null);
const processChange = Helper.debounce((e) => getRewardsFor(e)); const processChange = Helper.debounce((e) => test(e));
async function getRewardsFor(e) { async function test(e) {
if (!e.target.value || isNaN(e.target.value)) { console.log("hier", e);
output.value = 0; output.value = await tokenStore.getRewardsFor(parseInt(e.target.value));
return;
}
console.log("activeToken.value.decimals", activeToken.value.decimals);
const rewardsForResult = await memeburnerStore.getRewardsFor(
BigInt(e.target.value * Math.pow(10, activeToken.value.decimals))
);
// var test = await memeburnerStore.getRewardsFor(10000);
// console.log("test", test);
// const rewardsForResult = await tokenStore.getRewardsFor(10000);
console.log("rewardsForResult", rewardsForResult);
console.log("tokenStore.memeToken.decimals", tokenStore.memeToken.decimals);
console.log(
"Math.pow(10, tokenStore.memeToken.decimals)",
Math.pow(10, tokenStore.memeToken.decimals)
);
output.value =
rewardsForResult / Math.pow(10, tokenStore.memeToken.decimals);
} }
function addTokens(value) {
async function addTokens(value) {
tokenNumber.value = tokenNumber.value + value; tokenNumber.value = tokenNumber.value + value;
output.value = await memeburnerStore.getRewardsFor(
parseInt(tokenNumber.value)
);
} }
</script> </script>
<style lang="sass"> <style lang="sass">
.sacrifice-wrapper .sacrifice-wrapper
display: flex display: flex
flex-direction: column flex-direction: column
margin-left: auto margin-left: auto
margin-right: auto margin-right: auto
background-color: var(--primary) background-color: var(--primary)
.sacrifice-inner
padding: 48px 24px
@media (min-width: 992px)
padding: 48px 64px
.sacrifice-headline .sacrifice-headline
text-align: center text-align: center
font-size: 24px
margin-bottom: 32px
@media (min-width: 992px)
font-size: 36px font-size: 36px
.sacrifice-select-tokens .sacrifice-select-tokens
padding: 24px
display: flex display: flex
margin-bottom: 32px margin-bottom: 32px
.sacrifice-tokens .sacrifice-tokens
display: flex display: flex
width: 100% width: 100%
justify-content: space-between
@media (min-width: 992px)
justify-content: space-evenly justify-content: space-evenly
.sacrifice-token .sacrifice-token
width: 132px
height: 132px
border-radius: 16px border-radius: 16px
padding: 12px padding: 12px
border: 1px solid lightgrey
cursor: pointer cursor: pointer
background-color: #0F0F0F background-color: var(--tertiary)
text-align: center &:hover,
user-select: none &:active,
border: 4px solid transparent &:focus
.sacrifice-token-logo background-color: var(--tertiary-dark)
pointer-events: none
// @media (min-width: 992px)
// padding: 0
// background-color: unset
&.sacrifice-token--active &.sacrifice-token--active
border-color: var(--purple) background-color: var(--tertiary-dark)
.sacrifice-token-name
padding: 5px 26px
font-size: 16px
@media (min-width: 992px)
font-size: 24px
.sacrifice-buttons-function-wrapper .sacrifice-buttons-function-wrapper
text-align: center text-align: center
display: flex
justify-content: center justify-content: center
margin-top: 24px margin-top: 24px
display: block
@media (min-width: 992px)
display: flex
.btn .btn
padding: 16px 64px padding: 16px 64px
.sacrifice-fees-info-wrapper .sacrifice-fees-info-wrapper
display: flex display: flex
border: 2px dashed var(--grey) border: 2px dashed var(--grey)
color: var(--grey)
border-radius: 16px border-radius: 16px
padding: 16px 24px padding: 16px 24px
margin-top: 24px margin-top: 24px
font-size: 16px
.sacrifice-fees-img .sacrifice-fees-img
flex: 0 0 15% flex: 0 0 15%
.sacrifice-fees-body .sacrifice-fees-body
flex: 1 1 auto flex: 1 1 auto
.sacrifice-fees-body-header .sacrifice-fees-body-header
font-size: 24px
display: flex display: flex
flex-direction: row flex-direction: row
justify-content: space-between justify-content: space-between
margin-bottom: 8px
@media (min-width: 992px)
font-size: 24px
margin-bottom: 0
.sacrifice-from-to-wrapper .sacrifice-from-to-wrapper
.sacrifice-from-wrapper,.sacrifice-to-wrapper .sacrifice-from-wrapper,.sacrifice-to-wrapper
.sarcrifice-from-input .sarcrifice-from-input
display: flex display: flex
margin-bottom: 8px margin-bottom: 8px
// height: 60px height: 60px
input input
width: 100% width: 100%
height: 45px
font-size: 24px
border-radius: 16px
padding: 0 16px
@media (min-width: 992px)
font-size: 32px font-size: 32px
height: auto
.sacrifice-logo
margin-left: 16px
img img
width: 45px margin-left: 16px
height: 45px
border-radius: 50%
pointer-events: none
@media (min-width: 992px)
height: 83px
width: auto
.sacrifice-to-output .sacrifice-to-output
flex: 1 1 auto flex: 1 1 auto
text-align: left text-align: left
.sacrifice-to-output-coin .sacrifice-to-output-coin
font-size: 16px
@media (min-width: 992px)
font-size: 24px font-size: 24px
.sacrifice-to-output-rewards .sacrifice-to-output-rewards
font-size: 24px
@media (min-width: 992px)
font-size: 42px font-size: 42px
.value-adder .value-adder
display: flex display: flex
@@ -302,16 +200,17 @@ async function addTokens(value) {
&:active, &:active,
&:focus &:focus
background-color: var(--secondary) background-color: var(--secondary)
border: 1px solid var(--secondary-dark)
cursor: pointer cursor: pointer
// .sacrifice-adder-balance .sacrifice-adder-balance
// margin-left: auto margin-left: auto
// .sacrifice-adder-max .sacrifice-adder-max
// margin-left: 12px margin-left: 12px
// color: red color: red
// &:hover, &:hover,
// &:focus, &:focus,
// &:active &:active
// color: darken(red, 10%) color: darken(red, 10%)
// transform: scale(1.1) transform: scale(1.1)
// transition: transform 0s transition: transform 0s
</style> </style>
+34 -76
View File
@@ -1,99 +1,57 @@
<template> <template>
<div class="claim bloodline-border"> <div class="claim bloodline-border">
<div class="rewards-wrapper" v-if="!isMobile"> <div class="rewards-wrapper">
<rewards-wrapper <div class="rewards-headline">Sacrafice Reward</div>
title="Sacrafice Reward" <div class="rewards-sacrifice-wrapper bloodline-border">
coin="$BLOOD" <div class="rewards-body">
:amount="getCurrentRoundData?.rewards_sacrifice" <div class="rewards-coin">$BLOOD</div>
image="/assets/img/vampir.png" <div class="rewards-amount">0</div>
/> </div>
<img src="@/assets/img/vampir.png" alt="vampir" />
</div>
<div class="rewards-divider bloodline-devider"> <div class="rewards-divider bloodline-devider">
<font-awesome-icon icon="fa-solid fa-plus" /> <font-awesome-icon icon="fa-solid fa-plus" />
</div> </div>
<rewards-wrapper <div class="rewards-headline">Clan Reward</div>
title="Clan Reward" <div class="rewards-clan-wrapper bloodline-border">
coin="$BLOOD" <div class="rewards-body">
:amount="getCurrentRoundData?.rewards_clan" <div class="rewards-coin">$BLOOD</div>
image="/assets/img/vampir.png" <div class="rewards-amount">0</div>
/>
</div> </div>
<div class="rewards-list" v-else> <img src="@/assets/img/vampir.png" alt="vampir" />
<rewards-wrapper
title="Total Sacrafice Reward"
coin="$BLOOD"
amount="0"
image="/assets/img/vampir.png"
/>
<rewards-wrapper
title="Total Stake Reward"
coin="$BLOOD"
amount="0"
info="max: 312m"
image="/assets/img/vampir.png"
/>
<rewards-wrapper title="Clan Bonus" coin="$BLOOD" amount="0" image="/assets/img/vampir.png" />
<rewards-wrapper title="Total Reward" coin="$BLOOD" amount="0" image="/assets/img/vampir.png" />
</div> </div>
<div class="claim-button"> <div class="claim-button">
<div v-if="activeRound === currentRound" class="btn btn-immortal btn--disabled">Cycle Active</div> <div class="btn btn-immortal">Claim</div>
<div v-else-if="getCurrentRoundData?.rewards_total > 0" class="btn btn-immortal" @click="claimRewards">
Claim
</div> </div>
<div v-else class="btn btn-immortal btn--disabled">Nothing to claim</div>
</div>
<div class="stake-buttons">
<div class="btn btn-immortal">Stake</div>
<div class="btn btn-immortal">Unstake</div>
</div> </div>
</div> </div>
</template> </template>
<script setup> <script setup></script>
import { storeToRefs } from "pinia";
import RewardsWrapper from "@/components/RewardsWrapper.vue";
import { inject, ref, onMounted } from "vue";
import { useRewardLockerStore } from "@/stores/rewardlocker";
import { useWalletStore } from "@/stores/wallet";
import { useRoundsStore } from "@/stores/rounds";
const clanRewards = ref(0);
const rewards = ref(0);
const isMobile = inject("isMobile");
const rewardLockerStore = useRewardLockerStore();
const walletStore = useWalletStore();
const roundStore = useRoundsStore();
const { address } = storeToRefs(walletStore);
const { activeRound, currentRound, getCurrentRoundData } =
storeToRefs(roundStore);
onMounted(async () => {});
async function claimRewards() {
console.log("getCurrentRoundData", getCurrentRoundData);
console.log("activeRound.value", activeRound.value);
var result = await rewardLockerStore.claim([activeRound.value]);
console.log("result", result);
}
</script>
<style lang="sass"> <style lang="sass">
.claim .claim
display: flex display: flex
padding: 32px 20px
flex-direction: column flex-direction: column
@media (min-width: 992px)
padding: 32px 40px padding: 32px 40px
.claim-button .claim-button
text-align: center text-align: center
margin: 32px 0 margin-top: 32px
.stake-buttons .rewards-wrapper
width: 100%
.rewards-headline
font-size: 24px
padding: 0 0 4px 8px
.rewards-divider
text-align: center
.rewards-sacrifice-wrapper, .rewards-clan-wrapper
display: flex display: flex
text-align: center .rewards-body
gap: 32px align-self: center
div .rewards-coin
flex: 1 1 50% font-size: 24px
.rewards-wrapper .rewards-amount
margin-bottom: 16px font-size: 40px
.rewards-divider img
text-align: center margin-left: auto
</style> </style>
-18
View File
@@ -1,18 +0,0 @@
export function getImageUrl(url) {
return new URL(url, import.meta.url).href;
}
export function getPercentage(amount, goal) {
console.log("amount", amount);
console.log("goal", goal);
return ((amount / goal) * 100).toFixed(2);
}
export function compactNumber(number) {
return Intl.NumberFormat("en-US", {
notation: "compact",
maximumFractionDigits: 2,
}).format(parseInt(number));
}
+2 -2
View File
@@ -14,12 +14,12 @@ import { library } from '@fortawesome/fontawesome-svg-core'
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome' import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
/* import specific icons */ /* import specific icons */
import { faArrowDown, faSpinner ,faPlus, faCaretLeft, faCaretRight, faBars } from "@fortawesome/free-solid-svg-icons"; import { faArrowDown, faSpinner ,faPlus } from "@fortawesome/free-solid-svg-icons";
import { faDiscord, faTwitter, faTelegram } from "@fortawesome/free-brands-svg-icons"; import { faDiscord, faTwitter, faTelegram } from "@fortawesome/free-brands-svg-icons";
/* add icons to the library */ /* add icons to the library */
library.add(faArrowDown, faDiscord, faTwitter, faTelegram, faSpinner, faPlus, faCaretLeft, faCaretRight, faBars); library.add(faArrowDown, faDiscord, faTwitter, faTelegram, faSpinner, faPlus);
const app = createApp(App) const app = createApp(App)
-106
View File
@@ -1,106 +0,0 @@
import { defineStore } from "pinia";
import MemeBurnerJson from "@/assets/contracts/MemeBurner.json";
import { useTokenStore } from "./tokens";
import { useMultiCallStore } from "./multicall";
import { useWalletStore } from "./wallet";
import { useRoundsStore } from "@/stores/rounds";
export const useMemeburnerStore = defineStore("memeburner", {
state: () => ({
config: MemeBurnerJson,
contract: null,
loading: false,
}),
getters: {},
actions: {
async init() {
console.log("-----------init memeburner-------------");
const walletStore = useWalletStore();
const roundsStore = useRoundsStore();
this.contract = new walletStore.web3.eth.Contract(this.config.abi, this.config.contractAddress);
const websocketMemeBurner = new walletStore.web3socket.eth.Contract(
this.config.abi,
this.config.contractAddress
);
websocketMemeBurner.events
.MemeSacrificed()
.on("data", async (event) => {
console.log("sacrificedAmount", event.returnValues.sacrificedAmount);
console.log("sacrificedToken", event.returnValues.sacrificedToken);
await roundsStore.updateCurrentRound(
event.returnValues.sacrificedToken,
event.returnValues.sacrificedAmount
);
})
.on("error", (error) => console.log("MemeSacrificederror", error));
},
async getRewardsFor(amount) {
const tokenStore = useTokenStore();
var rewards = await this.contract.methods
.getRewardFor(tokenStore.activeToken.contractAddress, amount)
.call();
return rewards;
},
async getCurrentRound() {
return await this.contract.methods.currentRound().call();
},
async getGoal(roundnumber) {
return await this.contract.methods.rounds(roundnumber).call();
},
//returns participated, amount achieved
async getSacrificedMeme(roundnumber, tokenAddress) {
return await this.contract.methods.getSacrificedMeme(roundnumber, tokenAddress).call();
},
async getAmountToReachGoal(tokenAddress) {
return await this.contract.methods.getAmountToReachGoal(tokenAddress).call();
},
async getSacrificedRound(roundnumber) {
console.log("getSacrificedRound", roundnumber);
const tokenStore = useTokenStore();
const calls = [];
// const calls1 = [];
for (let index = 0; index < tokenStore.token.length; index++) {
const token = tokenStore.token[index];
console.log("token.contractAddress", token.contractAddress);
console.log("roundnumber", roundnumber);
var test = await this.getSacrificedMeme(roundnumber, token.contractAddress);
console.log(token.name, test);
calls.push(this.contract.methods.getSacrificedMeme(roundnumber, token.contractAddress));
// calls1.push(this.contract.methods.getAmountToReachGoal(token.contractAddress));
}
console.log("this.contract", this.contract);
const multicallStore = useMultiCallStore();
return await multicallStore.aggregate(calls);
},
async sacrificeMeme(amount) {
const walletStore = useWalletStore();
const tokenStore = useTokenStore();
try {
if (!amount || amount == 0) {
//todo error
console.error("amount is 0 or null or undefined");
return;
}
this.loading = true;
const amountDecimal = BigInt(amount * Math.pow(10, tokenStore.activeToken.decimals));
var reward = await this.contract.methods
.sacrificeMeme(tokenStore.activeToken.contractAddress, amountDecimal)
.send({ from: walletStore.address });
console.log("reward", reward);
tokenStore.activeToken.allowance = await tokenStore.allowance();
} catch (error) {
console.error(error);
} finally {
this.loading = false;
}
},
async getGoalInBLD(roundNumber) {
return await this.contract.methods.getGoalInBLD(roundNumber).call();
}
},
});
-49
View File
@@ -1,49 +0,0 @@
import { defineStore } from "pinia";
import MulticallJson from "@/assets/contracts/Multicall.json";
import { useWalletStore } from "./wallet";
export const useMultiCallStore = defineStore("multicall", {
state: () => ({
config: MulticallJson,
contract: null,
}),
getters: {},
actions: {
async init() {
console.log("-----------init multicall-------------");
const walletStore = useWalletStore();
this.contract = new walletStore.web3.eth.Contract(
this.config.abi,
this.config.contractAddress
);
},
async aggregate(calls, parameters = {}) {
const callRequests = calls.map((call) => {
const callData = call.encodeABI();
return {
target: call._parent._address,
callData,
};
});
const { returnData } = await this.contract.methods.aggregate(callRequests).call(parameters);
return returnData.map((hex, index) => {
const types = calls[index]._method.outputs.map((o) =>
o.internalType !== o.type && o.internalType !== undefined ? o : o.type
);
const walletStore = useWalletStore();
let result = walletStore.web3.eth.abi.decodeParameters(types, hex);
delete result.__length__;
result = Object.values(result);
return result.length === 1 ? result[0] : result;
});
}
}
}
);
-58
View File
@@ -1,58 +0,0 @@
import { defineStore } from "pinia";
import RewardLockerJson from "@/assets/contracts/RewardLocker.json";
import { useTokenStore } from "./tokens";
import { useMultiCallStore } from "./multicall";
import { useWalletStore } from "./wallet";
import { ethers } from "ethers";
export const useRewardLockerStore = defineStore("rewardlocker", {
state: () => ({
config: RewardLockerJson,
contract: null,
ethcontract: null,
}),
getters: {},
actions: {
async init() {
console.log("-----------init rewardlocker-------------");
const walletStore = useWalletStore();
this.contract = new walletStore.web3.eth.Contract(this.config.abi, this.config.contractAddress);
},
/*
* @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 getRewardsForAllToken(roundNumber) {
console.log("getRewardsForAllToken");
const tokenStore = useTokenStore();
const walletStore = useWalletStore();
const calls = [];
for (let index = 0; index < tokenStore.token.length; index++) {
const token = tokenStore.token[index];
calls.push(this.contract.methods.rewards(walletStore.address, roundNumber, token.contractAddress));
}
const multicallStore = useMultiCallStore();
return await multicallStore.aggregate(calls);
},
async getSacrificedTokenCoefficient(roundNumber, sacrificedToken) {
return await this.contract.methods.getSacrificedTokenCoefficient(roundNumber, sacrificedToken).call();
},
async lastCompletedRound() {
return await this.contract.methods.lastCompletedRound().call();
},
async claim(round) {
const walletStore = useWalletStore();
// return await this.contract.methods.claim(round).call();
console.log(this.contract.methods.claim(round));
return await this.contract.methods.claim(round).send({from: walletStore.address, to: this.contractAddress});
},
async getTotalRewardsOf(address, rounds) {
return await this.contract.methods.getTotalRewardsOf(address, rounds).call();
},
},
});
-100
View File
@@ -1,100 +0,0 @@
import { defineStore } from "pinia";
import { useMemeburnerStore } from "./memeburner";
import { useTokenStore } from "./tokens";
import { useRewardLockerStore } from "./rewardlocker";
import { useWalletStore } from "./wallet";
export const useRoundsStore = defineStore("rounds", {
state: () => ({
rounds: [
],
activeRound: null,
currentRound: null
}),
getters: {
getCurrentRoundData() {
return this.rounds[this.activeRound];
}
},
actions: {
async init() {
//fill initial round
},
async updateCurrentRound(sacrificedToken, sacrificedAmount) {
const tokenStore = useTokenStore();
const memeBurnerStore = useMemeburnerStore();
var data = await memeBurnerStore.getSacrificedRound(this.currentRound)
console.log("data123", data);
var tokenIndex = this.rounds[this.currentRound].token.findIndex((tokenData) => tokenData.contractAddress === sacrificedToken);
this.rounds[this.currentRound].token[tokenIndex].amount = data[tokenIndex][1];
},
async fillRound() {
console.log("fillRound");
const memeBurnerStore = useMemeburnerStore();
const tokenStore = useTokenStore();
const walletStore = useWalletStore();
const rewardLockerStore = useRewardLockerStore();
// if (this.activeRound === this.currentRound) {
// console.log("activeRound is not completed");
// } else
if (!this.rounds[this.activeRound]) {
console.log("round not filled --> fill round");
console.log("vor error");
var data = await memeBurnerStore.getSacrificedRound(this.activeRound)
let rewardData = null;
if (await walletStore.isConnected()) {
rewardData = await rewardLockerStore.getRewardsForAllToken(this.activeRound);
}
console.log("rewardData123", rewardData);
var goal = await memeBurnerStore.getGoal(this.activeRound);
var tokenArray = []
var rewards_clan = BigInt(0);
var rewards_sacrifice = BigInt(0);
for (let index = 0; index < data.length; index++) {
var tokenData = {};
const token = tokenStore.token[index];
var testcoef = await rewardLockerStore.getSacrificedTokenCoefficient(this.activeRound, token.contractAddress);
tokenData.name = token.name;
tokenData.contractAddress = token.contractAddress;
tokenData.vamplogo = token.vamp.logo;
tokenData.vampname = token.vamp.name;
tokenData.amount = data[index][1];
tokenData.getAmountToReachGoal= await memeBurnerStore.getAmountToReachGoal(token.contractAddress);
if (this.currentRound !== this.activeRound && await walletStore.isConnected()) {
const clanwin = BigInt((testcoef / 10000 - 1) * rewardData[index]);
const sacrificeRewards = BigInt(rewardData[index]) - clanwin;
tokenData.rewards_ges = rewardData[index];
tokenData.rewards_clan = clanwin;
tokenData.rewards_sacrifice = sacrificeRewards;
rewards_clan = rewards_clan + BigInt(clanwin / BigInt(Math.pow(10, token.decimals)));
rewards_sacrifice =
rewards_sacrifice + BigInt(sacrificeRewards / BigInt(Math.pow(10, token.decimals)));
}
tokenArray.push(tokenData);
}
const goalInBLD = await memeBurnerStore.getGoalInBLD(this.activeRound);
this.rounds[this.activeRound] = {
goal: goal.goal,
goalInBLD: goalInBLD /Math.pow(10, tokenStore.memeToken.decimals),
expirationTimestamp: goal.expirationTimestamp,
rewards_clan: rewards_clan,
rewards_sacrifice: rewards_sacrifice,
rewards_total: rewards_clan + rewards_sacrifice,
token: tokenArray,
};
} else {
console.log("round already filled");
}
console.log("this.rounds123", this.rounds);
},
},
});
+424 -72
View File
@@ -1,53 +1,411 @@
import { defineStore } from "pinia"; import { defineStore } from "pinia";
import { markRaw } from "vue";
import Web3 from "web3"; import Web3 from "web3";
import { useWalletStore } from "./wallet"; import { useWalletStore } from "./wallet";
import { useContractStore } from "./contracts"; import { useContractStore } from "./contracts";
import { ethers } from "ethers";
import { useMemeburnerStore } from "./memeburner";
import Meme1Json from "@/assets/contracts/Meme1.json"; import Meme1Json from "@/assets/contracts/Meme1.json";
import Meme2Json from "@/assets/contracts/Meme2.json"; import Meme2Json from "@/assets/contracts/Meme2.json";
import MemeToken from "@/assets/contracts/MemeToken.json";
import MemeBurnerJson from "@/assets/contracts/MemeBurner.json"; import MemeBurnerJson from "@/assets/contracts/MemeBurner.json";
export const useTokenStore = defineStore("token", { export const useTokenStore = defineStore("token", {
state: () => ({ state: () => ({
token: [ token: [
// {
// name: "PEPE",
// contractAddress: "0x6982508145454Ce325dDbE47a25d4ec3d2311933",
// abi: [
// {
// inputs: [{ internalType: "uint256", name: "_totalSupply", type: "uint256" }],
// stateMutability: "nonpayable",
// type: "constructor",
// },
// {
// anonymous: false,
// inputs: [
// { indexed: true, internalType: "address", name: "owner", type: "address" },
// { indexed: true, internalType: "address", name: "spender", type: "address" },
// { indexed: false, internalType: "uint256", name: "value", type: "uint256" },
// ],
// name: "Approval",
// type: "event",
// },
// {
// anonymous: false,
// inputs: [
// { indexed: true, internalType: "address", name: "previousOwner", type: "address" },
// { indexed: true, internalType: "address", name: "newOwner", type: "address" },
// ],
// name: "OwnershipTransferred",
// type: "event",
// },
// {
// anonymous: false,
// inputs: [
// { indexed: true, internalType: "address", name: "from", type: "address" },
// { indexed: true, internalType: "address", name: "to", type: "address" },
// { indexed: false, internalType: "uint256", name: "value", type: "uint256" },
// ],
// name: "Transfer",
// type: "event",
// },
// {
// inputs: [
// { internalType: "address", name: "owner", type: "address" },
// { internalType: "address", name: "spender", type: "address" },
// ],
// name: "allowance",
// outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
// stateMutability: "view",
// type: "function",
// },
// {
// inputs: [
// { internalType: "address", name: "spender", type: "address" },
// { internalType: "uint256", name: "amount", type: "uint256" },
// ],
// name: "approve",
// outputs: [{ internalType: "bool", name: "", type: "bool" }],
// stateMutability: "nonpayable",
// type: "function",
// },
// {
// inputs: [{ internalType: "address", name: "account", type: "address" }],
// name: "balanceOf",
// outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
// stateMutability: "view",
// type: "function",
// },
// {
// inputs: [
// { internalType: "address", name: "_address", type: "address" },
// { internalType: "bool", name: "_isBlacklisting", type: "bool" },
// ],
// name: "blacklist",
// outputs: [],
// stateMutability: "nonpayable",
// type: "function",
// },
// {
// inputs: [{ internalType: "address", name: "", type: "address" }],
// name: "blacklists",
// outputs: [{ internalType: "bool", name: "", type: "bool" }],
// stateMutability: "view",
// type: "function",
// },
// {
// inputs: [{ internalType: "uint256", name: "value", type: "uint256" }],
// name: "burn",
// outputs: [],
// stateMutability: "nonpayable",
// type: "function",
// },
// {
// inputs: [],
// name: "decimals",
// outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
// stateMutability: "view",
// type: "function",
// },
// {
// inputs: [
// { internalType: "address", name: "spender", type: "address" },
// { internalType: "uint256", name: "subtractedValue", type: "uint256" },
// ],
// name: "decreaseAllowance",
// outputs: [{ internalType: "bool", name: "", type: "bool" }],
// stateMutability: "nonpayable",
// type: "function",
// },
// {
// inputs: [
// { internalType: "address", name: "spender", type: "address" },
// { internalType: "uint256", name: "addedValue", type: "uint256" },
// ],
// name: "increaseAllowance",
// outputs: [{ internalType: "bool", name: "", type: "bool" }],
// stateMutability: "nonpayable",
// type: "function",
// },
// {
// inputs: [],
// name: "limited",
// outputs: [{ internalType: "bool", name: "", type: "bool" }],
// stateMutability: "view",
// type: "function",
// },
// {
// inputs: [],
// name: "maxHoldingAmount",
// outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
// stateMutability: "view",
// type: "function",
// },
// {
// inputs: [],
// name: "minHoldingAmount",
// outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
// stateMutability: "view",
// type: "function",
// },
// {
// inputs: [],
// name: "name",
// outputs: [{ internalType: "string", name: "", type: "string" }],
// stateMutability: "view",
// type: "function",
// },
// {
// inputs: [],
// name: "owner",
// outputs: [{ internalType: "address", name: "", type: "address" }],
// stateMutability: "view",
// type: "function",
// },
// {
// inputs: [],
// name: "renounceOwnership",
// outputs: [],
// stateMutability: "nonpayable",
// type: "function",
// },
// {
// inputs: [
// { internalType: "bool", name: "_limited", type: "bool" },
// { internalType: "address", name: "_uniswapV2Pair", type: "address" },
// { internalType: "uint256", name: "_maxHoldingAmount", type: "uint256" },
// { internalType: "uint256", name: "_minHoldingAmount", type: "uint256" },
// ],
// name: "setRule",
// outputs: [],
// stateMutability: "nonpayable",
// type: "function",
// },
// {
// inputs: [],
// name: "symbol",
// outputs: [{ internalType: "string", name: "", type: "string" }],
// stateMutability: "view",
// type: "function",
// },
// {
// inputs: [],
// name: "totalSupply",
// outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
// stateMutability: "view",
// type: "function",
// },
// {
// inputs: [
// { internalType: "address", name: "recipient", type: "address" },
// { internalType: "uint256", name: "amount", type: "uint256" },
// ],
// name: "transfer",
// outputs: [{ internalType: "bool", name: "", type: "bool" }],
// stateMutability: "nonpayable",
// type: "function",
// },
// {
// inputs: [
// { internalType: "address", name: "sender", type: "address" },
// { internalType: "address", name: "recipient", type: "address" },
// { internalType: "uint256", name: "amount", type: "uint256" },
// ],
// name: "transferFrom",
// outputs: [{ internalType: "bool", name: "", type: "bool" }],
// stateMutability: "nonpayable",
// type: "function",
// },
// {
// inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
// name: "transferOwnership",
// outputs: [],
// stateMutability: "nonpayable",
// type: "function",
// },
// {
// inputs: [],
// name: "uniswapV2Pair",
// outputs: [{ internalType: "address", name: "", type: "address" }],
// stateMutability: "view",
// type: "function",
// },
// ],
// },
// {
// name: "SHIBA INU",
// contractAddress: "0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE",
// abi: [
// {
// constant: true,
// inputs: [],
// name: "name",
// outputs: [{ name: "", type: "string" }],
// payable: false,
// stateMutability: "view",
// type: "function",
// },
// {
// constant: false,
// inputs: [
// { name: "spender", type: "address" },
// { name: "value", type: "uint256" },
// ],
// name: "approve",
// outputs: [{ name: "", type: "bool" }],
// payable: false,
// stateMutability: "nonpayable",
// type: "function",
// },
// {
// constant: true,
// inputs: [],
// name: "totalSupply",
// outputs: [{ name: "", type: "uint256" }],
// payable: false,
// stateMutability: "view",
// type: "function",
// },
// {
// constant: false,
// inputs: [
// { name: "sender", type: "address" },
// { name: "recipient", type: "address" },
// { name: "amount", type: "uint256" },
// ],
// name: "transferFrom",
// outputs: [{ name: "", type: "bool" }],
// payable: false,
// stateMutability: "nonpayable",
// type: "function",
// },
// {
// constant: true,
// inputs: [],
// name: "decimals",
// outputs: [{ name: "", type: "uint8" }],
// payable: false,
// stateMutability: "view",
// type: "function",
// },
// {
// constant: false,
// inputs: [
// { name: "spender", type: "address" },
// { name: "addedValue", type: "uint256" },
// ],
// name: "increaseAllowance",
// outputs: [{ name: "", type: "bool" }],
// payable: false,
// stateMutability: "nonpayable",
// type: "function",
// },
// {
// constant: false,
// inputs: [{ name: "value", type: "uint256" }],
// name: "burn",
// outputs: [],
// payable: false,
// stateMutability: "nonpayable",
// type: "function",
// },
// {
// constant: true,
// inputs: [{ name: "account", type: "address" }],
// name: "balanceOf",
// outputs: [{ name: "", type: "uint256" }],
// payable: false,
// stateMutability: "view",
// type: "function",
// },
// {
// constant: true,
// inputs: [],
// name: "symbol",
// outputs: [{ name: "", type: "string" }],
// payable: false,
// stateMutability: "view",
// type: "function",
// },
// {
// constant: false,
// inputs: [
// { name: "spender", type: "address" },
// { name: "subtractedValue", type: "uint256" },
// ],
// name: "decreaseAllowance",
// outputs: [{ name: "", type: "bool" }],
// payable: false,
// stateMutability: "nonpayable",
// type: "function",
// },
// {
// constant: false,
// inputs: [
// { name: "recipient", type: "address" },
// { name: "amount", type: "uint256" },
// ],
// name: "transfer",
// outputs: [{ name: "", type: "bool" }],
// payable: false,
// stateMutability: "nonpayable",
// type: "function",
// },
// {
// constant: true,
// inputs: [
// { name: "owner", type: "address" },
// { name: "spender", type: "address" },
// ],
// name: "allowance",
// outputs: [{ name: "", type: "uint256" }],
// payable: false,
// stateMutability: "view",
// type: "function",
// },
// {
// inputs: [
// { name: "name", type: "string" },
// { name: "symbol", type: "string" },
// { name: "decimals", type: "uint8" },
// { name: "totalSupply", type: "uint256" },
// { name: "feeReceiver", type: "address" },
// { name: "tokenOwnerAddress", type: "address" },
// ],
// payable: true,
// stateMutability: "payable",
// type: "constructor",
// },
// {
// anonymous: false,
// inputs: [
// { indexed: true, name: "from", type: "address" },
// { indexed: true, name: "to", type: "address" },
// { indexed: false, name: "value", type: "uint256" },
// ],
// name: "Transfer",
// type: "event",
// },
// {
// anonymous: false,
// inputs: [
// { indexed: true, name: "owner", type: "address" },
// { indexed: true, name: "spender", type: "address" },
// { indexed: false, name: "value", type: "uint256" },
// ],
// name: "Approval",
// type: "event",
// },
// ],
// },
{ {
name: "$PEPE", name: "Meme1",
logo: "/assets/img/token/pepe.png",
logoMobile: "/assets/img/token/pepeMobile.png",
vamp: {
logo: "/assets/img/token/pepevamp.png",
name: "$PEPE Vamp Token",
},
backgroundColor: "#4b8501",
abi: Meme1Json.abi, abi: Meme1Json.abi,
contractAddress: Meme1Json.contractAddress, contractAddress: Meme1Json.contractAddress,
ethcontract: null,
}, },
{ {
name: "$SHIB", name: "Meme2",
logo: "/assets/img/token/shib.png",
logoMobile: "/assets/img/token/shibMobile.png",
vamp: {
logo: "/assets/img/token/shibvamp.png",
name: "$SHIBA Vamp Token",
},
abi: Meme2Json.abi, abi: Meme2Json.abi,
contractAddress: Meme2Json.contractAddress, contractAddress: Meme2Json.contractAddress,
}, },
// {
// name: "$ELON",
// logo: "/assets/img/token/elon.png",
// logoMobile: "/assets/img/token/elonMobile.png",
// vamp: {
// logo: "/assets/img/token/shibvamp.png",
// name: "$ELON Vamp Token",
// },
// abi: null,
// contractAddress: null,
// },
], ],
activeToken: { activeToken: {
address: null, address: null,
@@ -57,31 +415,13 @@ export const useTokenStore = defineStore("token", {
allowance: null, allowance: null,
}, },
loading: false, loading: false,
memeToken: { memeBurner: {
config: { config: MemeBurnerJson,
abi: MemeToken.abi, contract: null
contractAddress: MemeToken.contractAddress, }
},
},
}), }),
getters: {}, getters: {},
actions: { actions: {
async init() {
console.log("-----------init token-------------");
const walletStore = useWalletStore();
for (let index = 0; index < this.token.length; index++) {
const token = this.token[index];
token.contract = new walletStore.web3.eth.Contract(token.abi, token.contractAddress);
token.decimals = parseInt(await token.contract.methods.decimals().call());
}
//MemeToken init
this.memeToken.contract = new walletStore.web3.eth.Contract(
this.memeToken.config.abi,
this.memeToken.config.contractAddress
);
this.memeToken.decimals = parseInt(await this.memeToken.contract.methods.decimals().call());
},
async changeActiveToken(token) { async changeActiveToken(token) {
this.activeToken = token; this.activeToken = token;
const web3 = new Web3(window.ethereum); const web3 = new Web3(window.ethereum);
@@ -90,44 +430,56 @@ export const useTokenStore = defineStore("token", {
if (walletStore.connected) { if (walletStore.connected) {
this.activeToken.balance = await walletStore.getTokenBalance(token); this.activeToken.balance = await walletStore.getTokenBalance(token);
this.activeToken.allowance = await this.allowance(); this.activeToken.allowance = await this.allowance();
} }
}, },
async allowance() { async allowance() {
console.log("allowance");
const walletStore = useWalletStore(); const walletStore = useWalletStore();
const memeBurnerStore = useMemeburnerStore(); console.log("walletStore.address", walletStore.address);
var allowance = await this.contract.methods const allowance = await this.contract.methods.allowance(walletStore.address, MemeBurnerJson.contractAddress).call();
.allowance(walletStore.address, memeBurnerStore.config.contractAddress) console.log("allowance", allowance);
.call();
var decimals = await this.contract.methods.decimals().call();
console.log("decimals", decimals);
console.log("Math.pow(10, decimals)", Math.pow(10, decimals));
allowance = BigInt(allowance / Math.pow(10, decimals));
return allowance; return allowance;
}, },
async approveToken(amount) { 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;
},
async sacrificeToken(amount) {
try { try {
this.loading = true; this.loading = true;
console.log("this.activeToken.", this.activeToken.contractAddress);
const walletStore = useWalletStore(); const walletStore = useWalletStore();
const memeBurnerStore = useMemeburnerStore(); console.log("walletStore.address", walletStore.address);
var approve = await this.contract.methods var reward = await this.memeBurner.contract.methods
.approve(memeBurnerStore.config.contractAddress, amount) .sacrificeMeme(this.activeToken.contractAddress, "400000000000000000")
.send({ from: walletStore.address}); .send({ from: walletStore.address });
//todo parameter value übergeben in eth web3.utils.toHex(web3.utils.toWei(amount, 'ether')) console.log("reward", reward);
// .send({ from: walletStore.address, value: 0.5 });
this.activeToken.allowance = await this.allowance();
return approve;
} catch (error) { } catch (error) {
console.error(error); error.log(error);
} finally { } finally {
this.loading = false; this.loading = false;
} }
}, },
async getRewardsFor(amount) {
const contractsStore = useContractStore();
var rewards = await contractsStore.list.memeBurnerPublic.methods
.getRewardFor(this.activeToken.contractAddress, amount)
.call();
return rewards
},
getTokenContract(token) { getTokenContract(token) {
console.log("token", token); console.log("token", token);
const contractAddress = token.contractAddress; const contractAddress = token.contractAddress;
console.log("contractAddress", contractAddress);
const activeToken = this.token.find((obj) => obj.contractAddress === contractAddress); const activeToken = this.token.find((obj) => obj.contractAddress === contractAddress);
console.log("activeToken", activeToken);
const web3 = new Web3(window.ethereum); const web3 = new Web3(window.ethereum);
const contract = new web3.eth.Contract(activeToken.abi, contractAddress); const contract = new web3.eth.Contract(activeToken.abi, contractAddress);
return contract; return contract;
+28 -59
View File
@@ -1,5 +1,4 @@
import { defineStore } from "pinia"; import { defineStore } from "pinia";
import { markRaw } from "vue";
import { useTokenStore } from "./tokens"; import { useTokenStore } from "./tokens";
import Web3 from "web3"; import Web3 from "web3";
export const useWalletStore = defineStore("wallet", { export const useWalletStore = defineStore("wallet", {
@@ -8,55 +7,32 @@ export const useWalletStore = defineStore("wallet", {
alchemy: null, alchemy: null,
connected: false, connected: false,
address: null, address: null,
web3: null,
provider: null
}), }),
getters: { getters: {
double: (state) => state.count * 2,
}, },
actions: { actions: {
async init() { increment() {
console.log("wallet init"); this.count++;
await this.isConnected();
const goerliKey = import.meta.env.VITE_GOERLI_KEY;
if (this.connected) {
const web3 = new Web3(window.ethereum);
this.web3 = markRaw(web3);
console.log("hierabc");
window.ethereum.on("accountsChanged", async (data) => {
console.log("accountsChanged", data);
console.log("data", data);
if (data.length > 0) {
this.address = data[0]
this.connected = true;
} else {
this.address = null;
this.connected = false;
}
});
// provider = new ethers.BrowserProvider(window.ethereum);
} else {
const url = `https://eth-goerli.g.alchemy.com/v2/${goerliKey}`;
this.web3 = new Web3(url);
// provider = new ethers.AlchemyProvider("goerli", goerliKey);
}
//Websocket
this.web3socket = new Web3(
new Web3.providers.WebsocketProvider(`wss://eth-goerli.g.alchemy.com/v2/${goerliKey}`)
);
}, },
connectWallet() { connectWallet() {
const tokenStore = useTokenStore(); console.log("window.ethereum", window.ethereum);
// if (window.ethereum) { // if (window.ethereum) {
window.ethereum window.ethereum
.request({ method: "eth_requestAccounts" }) .request({ method: "eth_requestAccounts" })
.then((data) => { .then((data) => {
console.log("data", data); console.log("data", data);
this.address = data[0]; this.isConnected();
this.connected = true; // this.address = data[0];
this.init(); // this.connected = true;
// const tokenStore = useTokenStore();
// if (tokenStore.activeToken.address) {
// //Token selected but not refreshed
// this.getTokenBalance(tokenStore.activeToken.address).then(
// (data) => (tokenStore.activeToken.balance = data)
// );
// }
// console.log("permissions", permissions);
}) })
.catch((error) => { .catch((error) => {
if (error.code === 4001) { if (error.code === 4001) {
@@ -77,30 +53,24 @@ export const useWalletStore = defineStore("wallet", {
async isConnected() { async isConnected() {
try { try {
this.loading = true; this.loading = true;
if (!window.ethereum) {
console.warn("Metamask not installed"),
this.connected = false;
return;
}
const accounts = await window.ethereum.request({ method: "eth_accounts" }); const accounts = await window.ethereum.request({ method: "eth_accounts" });
if (accounts.length) { if (accounts.length) {
this.connected = true; this.connected = true;
this.address = accounts[0]; this.address = accounts[0];
console.log(`You're connected to: ${accounts[0]}`); console.log(`You're connected to: ${accounts[0]}`);
// const web3 = new Web3(window.ethereum); const web3 = new Web3(window.ethereum);
// const tokenStore = useTokenStore(); const tokenStore = useTokenStore();
// console.log("tokenStore.activeToken", tokenStore.activeToken); console.log("tokenStore.activeToken", tokenStore.activeToken);
// if (tokenStore.activeToken.contractAddress) { if (tokenStore.activeToken.contractAddress) {
// tokenStore.activeToken.balance = await this.getTokenBalance( tokenStore.activeToken.balance = await this.getTokenBalance(
// tokenStore.activeToken tokenStore.activeToken
// ); );
// tokenStore.activeToken.allowance = await tokenStore.allowance(); tokenStore.activeToken.allowance = await tokenStore.allowance();
// } }
// tokenStore.memeBurner.contract = new web3.eth.Contract( tokenStore.memeBurner.contract = new web3.eth.Contract(
// tokenStore.memeBurner.config.abi, tokenStore.memeBurner.config.abi,
// tokenStore.memeBurner.config.contractAddress tokenStore.memeBurner.config.contractAddress
// ); );
} else { } else {
console.log("Metamask is not connected"); console.log("Metamask is not connected");
this.connected = false; this.connected = false;
@@ -109,7 +79,6 @@ export const useWalletStore = defineStore("wallet", {
console.log("error", error); console.log("error", error);
} finally { } finally {
this.loading = false; this.loading = false;
return this.connected
} }
} }
+25 -187
View File
@@ -1,5 +1,4 @@
<script setup> <script setup>
import { ref, computed, inject, onMounted, onBeforeUnmount } from "vue";
import { storeToRefs } from "pinia"; import { storeToRefs } from "pinia";
import SacrificeToken from "@/components/SacrificeToken.vue"; import SacrificeToken from "@/components/SacrificeToken.vue";
import BloodChart from "@/components/BloodChart.vue"; import BloodChart from "@/components/BloodChart.vue";
@@ -7,74 +6,16 @@ import TokenClaim from "@/components/TokenClaim.vue";
// import Web3 from "web3"; // import Web3 from "web3";
// import { useWalletStore } from "@/stores/wallet"; // import { useWalletStore } from "@/stores/wallet";
import { useTokenStore } from "@/stores/tokens"; import { useTokenStore } from "@/stores/tokens";
import { useRoundsStore } from "@/stores/rounds";
const tokenStore = useTokenStore(); const tokenStore = useTokenStore();
const roundsStore = useRoundsStore();
const { token } = storeToRefs(tokenStore); const { token } = storeToRefs(tokenStore);
const { getCurrentRoundData } = storeToRefs(roundsStore); import { Navigation } from "swiper";
// Import Swiper Vue.js components
const { currentRound, activeRound, rounds } = storeToRefs(roundsStore); import { Swiper, SwiperSlide } from "swiper/vue";
import "swiper/css";
const days = ref(null); import "swiper/css/navigation";
const hours = ref(null); // let web3 = new Web3(
const minutes = ref(null); // "https://eth-goerli.g.alchemy.com/v2/0-W9tOm6v_QP1PfRV8RuBCpWr-qoEbkN"
const seconds = ref(null); // );
const timer = ref(null);
const modules = [Navigation];
const isMobile = inject("isMobile");
async function prevSlide() {
if (activeRound.value > 1) {
activeRound.value--;
await roundsStore.fillRound();
}
}
async function nextSlide() {
if (activeRound.value < currentRound.value) {
activeRound.value++;
await roundsStore.fillRound();
}
}
onMounted(() => {
console.log("getCurrentRoundData", getCurrentRoundData);
timer.value = setInterval(function () {
timeBetweenDates();
}, 1000);
});
onBeforeUnmount(() => {
clearInterval(timer.value);
});
function timeBetweenDates() {
const dateEntered = new Date(
getCurrentRoundData.value?.expirationTimestamp * 1000
);
if (dateEntered) {
var now = new Date();
var difference = dateEntered.getTime() - now.getTime();
if (difference <= 0) {
clearInterval(timer.value);
} else {
var _seconds = Math.floor(difference / 1000);
var _minutes = Math.floor(_seconds / 60);
var _hours = Math.floor(_minutes / 60);
var _days = Math.floor(_hours / 24);
days.value = _days;
hours.value = _hours % 24;
minutes.value = _minutes % 60;
seconds.value = _seconds % 60;
days.value = ("0" + days.value).slice(-2) + "d";
hours.value = ("0" + hours.value).slice(-2) + "h";
minutes.value = ("0" + minutes.value).slice(-2) + "m";
}
}
}
</script> </script>
<template> <template>
@@ -90,37 +31,28 @@ function timeBetweenDates() {
<sacrifice-token :data="token"></sacrifice-token> <sacrifice-token :data="token"></sacrifice-token>
</section> </section>
<swiper :slides-per-view="1" :navigation="true" :space-between="50">
<swiper-slide>Slide 1</swiper-slide>
<swiper-slide>Slide 2</swiper-slide>
<swiper-slide>Slide 3</swiper-slide>
<swiper-slide>Slide 4</swiper-slide>
<swiper-slide>Slide 5</swiper-slide>
</swiper>
<div class="container section-header-container"> <div class="container section-header-container">
<h3>Bloodline Cycle</h3> <h2>Bloodline Cycle</h2>
Become the most powerful clan each cycle and claim extra rewards.<br />Claim and trade your $BLOOD at Become the most powerful clan each cycle and claim extra rewards.<br />Claim and trade your $BLOOD at
each cycle's end. each cycle's end.
</div> </div>
<section id="cycle-section" class="container"> <section id="cycle-section" class="container">
<div class="slider-wrapper">
<font-awesome-icon
:class="{ 'slider-prev': true, disabled: roundsStore.activeRound <= 1 }"
@click="prevSlide"
:icon="['fas', 'caret-left']"
/>
<div class="slider-text">Cycle {{ roundsStore.activeRound }}</div>
<font-awesome-icon
:class="{ 'slider-next': true, disabled: currentRound === roundsStore.activeRound }"
@click="nextSlide"
:icon="['fas', 'caret-right']"
/>
</div>
<div class="cycle card bloodline-wrapper"> <div class="cycle card bloodline-wrapper">
<div class="bloodline-inner">
<token-claim></token-claim> <token-claim></token-claim>
</div> <div>
<h2>Bloodline Clan</h2>
<div class="bloodline-clan">
<h3>Bloodline Clan</h3>
<p> <p>
Win extra rewards for you and your clan. Increase the strength of your bloodline by Win extra rewards for you and your clan. Increase the strength of your bloodline by
sacrificing more memes. sacrificing more memes.
</p> </p>
<table class="bonus-table" v-if="!isMobile"> <table class="bonus-table">
<tbody> <tbody>
<tr> <tr>
<th scope="row">1st</th> <th scope="row">1st</th>
@@ -136,36 +68,8 @@ function timeBetweenDates() {
</tr> </tr>
</tbody> </tbody>
</table> </table>
<div class="bloodline-container" v-else>
<div class="bloodline-border purple">
Get up to +100% Clan Bonus <br />on your sacrifice.
</div>
</div>
<div class="blood-chart"> <div class="blood-chart">
<blood-chart :data="rounds[activeRound]"></blood-chart> <blood-chart></blood-chart>
</div>
<div class="cycle-end-wrapper">
<div class="cycle-end-inner">
<h2>Cycle End</h2>
<div class="cycle-end-text">A cycle ends when only one of these goals is reached.</div>
<div class="bloodline-border">
<table>
<tr>
<td>Sacrifice:</td>
<td class="divider"></td>
<td>{{ getCurrentRoundData?.goalInBLD?.toFixed(2) }} $BDL</td>
</tr>
<tr>
<td>Time left:</td>
<td class="divider"></td>
<td v-if="currentRound === roundsStore.activeRound">
{{ days }} {{ hours }} {{ minutes }}
</td>
<td v-else>0</td>
</tr>
</table>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -179,8 +83,7 @@ function timeBetweenDates() {
<div class="card"> <div class="card">
<h2>Tokenomics</h2> <h2>Tokenomics</h2>
<p>100% clan owned. No team %, no pre-mine</p> <p>100% clan owned. No team %, no pre-mine</p>
<img v-if="isMobile" src="/assets/img/tokenomics_footer.png" alt="tokenomics" /> <img src="@/assets/img/tokenomics.png" alt="tokenomics" />
<img v-else src="/assets/img/tokenomics.png" alt="tokenomics" />
</div> </div>
</section> </section>
</div> </div>
@@ -189,25 +92,17 @@ function timeBetweenDates() {
<style lang="sass"> <style lang="sass">
.blood-chart .blood-chart
margin-top: 56px
display: flex display: flex
justify-content: center justify-content: center
margin-bottom: 80px .bloodline-wrapper
padding: 48px 64px
.header-text .header-text
text-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25)
font-size: 32px
text-align: center
margin-top: 64px
margin-bottom: 100px
@media (min-width: 992px)
font-size: 64px font-size: 64px
margin-top: 0px
line-height: unset
text-shadow: unset
line-height: 80px line-height: 80px
font-weight: 600 font-weight: 600
text-align: center
margin-bottom: 100px
.chart-wrapper-coin .chart-wrapper-coin
display: flex display: flex
justify-content: space-evenly justify-content: space-evenly
@@ -231,16 +126,12 @@ function timeBetweenDates() {
th th
padding-right: 16px padding-right: 16px
#tokenomics #tokenomics
background-color: var(--darkgrey)
padding-bottom: 32px
>div >div
text-align: center text-align: center
img img
display: block display: block
margin-left: auto margin-left: auto
margin-right: auto margin-right: auto
pointer-events: none
user-select: none
.chart-wrapper .chart-wrapper
width: 600px width: 600px
height: 600px height: 600px
@@ -258,57 +149,4 @@ function timeBetweenDates() {
margin-top: auto margin-top: auto
text-align: center text-align: center
padding-top: 10px padding-top: 10px
.slider-wrapper
display: flex
justify-content: center
font-size: 24px
user-select: none
.slider-text
margin: 0 24px
margin-top: auto
margin-bottom: auto
.slider-prev, .slider-next
color: var(--purple)
font-size: 40px
cursor: pointer
&:hover,&:active, &:focus
filter: brightness(0.80)
&.disabled
opacity: .35
pointer-events: none
.section-header-container
text-align: center
font-size: 24px
margin-top: 64px
margin-bottom: 64px
@media (min-width: 992px)
width: 655px
.bloodline-wrapper
.bloodline-inner
padding: 4px
@media (min-width: 992px)
padding: 20px
.bloodline-clan
text-align: center
.cycle-end-wrapper
.cycle-end-inner
text-align: center
font-size: 24px
padding: 0 24px 48px 24px
.cycle-end-text
margin-bottom: 32px
table
width: 100%
tr
td
text-align: left
&.divider
width: 10px
h2
font-size: 40px
</style> </style>
+1 -21
View File
@@ -1,7 +1,6 @@
<template> <template>
<div> <div>
<button @click="mintToken">mint</button> <button @click="mintToken">mint</button>
<button @click="mintToken2">mint2</button>
<button @click="sacrificeMeme">sacrifice Meme</button> <button @click="sacrificeMeme">sacrifice Meme</button>
<button @click="approveMeme1">approve Meme1</button> <button @click="approveMeme1">approve Meme1</button>
<button @click="tokenStore.approveToken(MemeBurnerJson, 10)">wallet approve</button> <button @click="tokenStore.approveToken(MemeBurnerJson, 10)">wallet approve</button>
@@ -31,7 +30,6 @@ console.log("RewardLockerJson", RewardLockerJson);
// ); // );
// console.log("balanceOf", balanceOf); // console.log("balanceOf", balanceOf);
const web3 = ref(null); const web3 = ref(null);
const contractMeme2 = ref(null);
const contractMeme1 = ref(null); const contractMeme1 = ref(null);
const contractBurner = ref(null); const contractBurner = ref(null);
@@ -44,7 +42,6 @@ onMounted(async () => {
web3.value.eth.Contract.defaultAccount = accounts[0]; web3.value.eth.Contract.defaultAccount = accounts[0];
contractMeme1.value = new web3.value.eth.Contract(Meme1Json.abi, Meme1Json.contractAddress); contractMeme1.value = new web3.value.eth.Contract(Meme1Json.abi, Meme1Json.contractAddress);
contractMeme2.value = new web3.value.eth.Contract(Meme2Json.abi, Meme2Json.contractAddress);
contractBurner.value = new web3.value.eth.Contract(MemeBurnerJson.abi, MemeBurnerJson.contractAddress); contractBurner.value = new web3.value.eth.Contract(MemeBurnerJson.abi, MemeBurnerJson.contractAddress);
}); });
@@ -64,24 +61,7 @@ async function approveMeme1() {
// change this value to make yourself rich quick // change this value to make yourself rich quick
async function mintToken() { async function mintToken() {
try { try {
var mint = await contractMeme1.value.methods var mint = await contractMeme1.value.methods.mint("1000000000000000").send({ from: web3.value.eth.Contract.defaultAccount });
.mint("100000000000000000000000")
.send({ from: web3.value.eth.Contract.defaultAccount });
console.log("mint", mint);
} catch (error) {
console.log(error);
}
// var balanceOf = await contract.methods.balanceOf("0x66422602B2f4885c57EE794174f98d9E4DDBBBC6").call();
// console.log("balanceOf", balanceOf);
// var totalSupply = await contract.methods.totalSupply().call();
// console.log("totalSupply", totalSupply);
}
async function mintToken2() {
try {
var mint = await contractMeme2.value.methods
.mint("100000000000000000000")
.send({ from: web3.value.eth.Contract.defaultAccount });
console.log("mint", mint); console.log("mint", mint);
} catch (error) { } catch (error) {
console.log(error); console.log(error);
+4 -22
View File
@@ -1,32 +1,14 @@
import { fileURLToPath, URL } from 'node:url' import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite' import { defineConfig } from 'vite'
import GlobalsPolyfills from "@esbuild-plugins/node-globals-polyfill";
import NodeModulesPolyfills from "@esbuild-plugins/node-modules-polyfill";
import vue from '@vitejs/plugin-vue' import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
base: "./",
plugins: [vue()], plugins: [vue()],
optimizeDeps: {
esbuildOptions: {
plugins: [
NodeModulesPolyfills(),
GlobalsPolyfills({
process: true,
buffer: true,
}),
],
define: {
global: "globalThis",
},
},
},
resolve: { resolve: {
alias: { alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)), '@': fileURLToPath(new URL('./src', import.meta.url))
}, }
}, }
}); })