+ );
useEffect(() => {
- checkWalletIsConnected()
- }, [])
+ checkWalletIsConnected();
+ }, []);
return (
-
+
-

+
Core
- Dapp Starter
+ DApp Starter
- {currentAccount ? storageButton() : connectWalletButton()}
+ {currentAccount ? renderStorageButtons() : renderConnectWalletButton()}
-
+
- )
-}
+ );
+};
-export default App
+export default App;
diff --git a/src/contract/Storage copy.json b/src/contract/Storage copy.json
new file mode 100644
index 00000000..09afabca
--- /dev/null
+++ b/src/contract/Storage copy.json
@@ -0,0 +1,37 @@
+{
+ "_format": "hh-sol-artifact-1",
+ "contractName": "Storage",
+ "sourceName": "contracts/Storage.sol",
+ "abi": [
+ {
+ "inputs": [],
+ "name": "retrieve",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "uint256",
+ "name": "num",
+ "type": "uint256"
+ }
+ ],
+ "name": "store",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ }
+ ],
+ "bytecode": "0x6080604052348015600f57600080fd5b5060ac8061001e6000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c80632e64cec11460375780636057361d14604c575b600080fd5b60005460405190815260200160405180910390f35b605c6057366004605e565b600055565b005b600060208284031215606f57600080fd5b503591905056fea26469706673582212205bf847a0de0d9d42b6c46f829a7531ca62252925a5b8edd20fb8e03933afb9f664736f6c63430008130033",
+ "deployedBytecode": "0x6080604052348015600f57600080fd5b506004361060325760003560e01c80632e64cec11460375780636057361d14604c575b600080fd5b60005460405190815260200160405180910390f35b605c6057366004605e565b600055565b005b600060208284031215606f57600080fd5b503591905056fea26469706673582212205bf847a0de0d9d42b6c46f829a7531ca62252925a5b8edd20fb8e03933afb9f664736f6c63430008130033",
+ "linkReferences": {},
+ "deployedLinkReferences": {}
+}
diff --git a/src/contract/Storage copy.sol b/src/contract/Storage copy.sol
new file mode 100644
index 00000000..cfbed10a
--- /dev/null
+++ b/src/contract/Storage copy.sol
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: GPL-3.0
+
+
+pragma solidity >=0.7.0 <0.9.0;
+
+
+/**
+ * @title Storage
+ * @dev Store & retrieve value in a variable
+ */
+contract Storage {
+
+
+ uint256 number;
+
+
+ /**
+ * @dev Store value in variable
+ * @param num value to store
+ */
+ function store(uint256 num) public {
+ number = num;
+ }
+
+
+ /**
+ * @dev Return value
+ * @return value of 'number'
+ */
+ function retrieve() public view returns (uint256){
+ return number;
+ }
+}
\ No newline at end of file
diff --git a/src/index.tsx b/src/index.tsx
index 727b8511..8afa3c03 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -1,9 +1,14 @@
-import { createRoot } from 'react-dom/client'
-import 'tailwindcss/tailwind.css'
-import './style/index.css'
-import App from 'components/App'
+// src/index.tsx
-const container = document.getElementById('root') as HTMLDivElement
-const root = createRoot(container)
+import React from 'react';
+import { createRoot } from 'react-dom/client';
+import 'tailwindcss/tailwind.css';
+import './style/index.css'; // Ensure you have a CSS file for custom styles
+import App from './components/App';
-root.render(
)
+// Ensure the root element is available
+const container = document.getElementById('root') as HTMLElement;
+const root = createRoot(container);
+
+// Render the App component
+root.render(
);
diff --git a/src/public/service-worker.js b/src/public/service-worker.js
new file mode 100644
index 00000000..15cb2d64
--- /dev/null
+++ b/src/public/service-worker.js
@@ -0,0 +1,46 @@
+// src/public/service-worker.js
+
+const CACHE_NAME = 'core-dao-dapp-cache-v1';
+const urlsToCache = [
+ '/',
+ '/index.html',
+ '/src/style/index.css',
+ '/src/public/favicon.svg',
+ // Add any other assets you want to cache
+];
+
+self.addEventListener('install', event => {
+ event.waitUntil(
+ caches.open(CACHE_NAME)
+ .then(cache => {
+ return cache.addAll(urlsToCache);
+ })
+ );
+});
+
+self.addEventListener('fetch', event => {
+ event.respondWith(
+ caches.match(event.request)
+ .then(response => {
+ if (response) {
+ return response;
+ }
+ return fetch(event.request);
+ })
+ );
+});
+
+self.addEventListener('activate', event => {
+ const cacheWhitelist = [CACHE_NAME];
+ event.waitUntil(
+ caches.keys().then(cacheNames => {
+ return Promise.all(
+ cacheNames.map(cacheName => {
+ if (cacheWhitelist.indexOf(cacheName) === -1) {
+ return caches.delete(cacheName);
+ }
+ })
+ );
+ })
+ );
+});
diff --git a/src/style/index.css b/src/style/index.css
index 08a33a80..592260a2 100644
--- a/src/style/index.css
+++ b/src/style/index.css
@@ -3,10 +3,25 @@
@tailwind utilities;
@layer components {
- :root{
+ :root {
+ /* Define any custom CSS variables here, if needed */
+ }
+
+ body {
+ font-family: 'Roboto', sans-serif;
+ }
- }
.btn-primary {
- @apply py-2 px-4 bg-orange-500 text-white font-semibold rounded-lg shadow-md hover:bg-orange-700 focus:outline-none focus:ring-2 focus:ring-blue-400 focus:ring-opacity-75;
+ @apply py-2 px-4 bg-orange-500 text-white font-semibold rounded-lg shadow-md
+ hover:bg-orange-600 focus:outline-none focus:ring-2
+ focus:ring-blue-400 focus:ring-opacity-75 transition-transform transform;
+ }
+
+ .btn-primary:hover {
+ transform: scale(1.05);
+ }
+
+ input {
+ @apply rounded-lg border-2 border-gray-300 py-2 px-4 focus:outline-none focus:ring-2 focus:ring-blue-400;
}
}