This project demonstrates a very basic Abstract account, meaning a wallet that is a smart contract instead of a traditional wallet. This example has a smart contract wallet that is capable of storing and sending Eth and ERC20 tokens. This wallet can be used by anyone who knows the wallet password, instead of a seedphrase, this allows easy wallet sharing between users, or password recovery by storing your password with a friend or an institution.
After cloning the repo, you will want to do the following to get the code running on your computer.
- Inside the project directory, in the terminal type:
npm i
- Run
npx hardhat compile
andnpx hardhat test
to compile solidity code and verify it works - Open two additional terminals in your VS code
- In the second terminal type:
npx hardhat node
- In the third terminal, type:
npx hardhat run --network localhost scripts/deploy.ts
to deploy Degen token - Create a
.env.local
file in the root folder and putNEXT_PUBLIC_DEGEN_TOKEN_CONTRACT_ADDRESS=%{Deployed contract adress}%
, filling in the address deploy script printed - Back in the first terminal, type
npm run dev
to launch the front-end.
After this, the project will be running on your localhost. Typically at http://localhost:3000/
In your browser, pull up your Metamask (or similar) wallet, and import some accounts using private keys generated by hardhat, printed in the terminal where you ran npx hardhat node
.
Then add hardhat local network to Metamask:
- Network Name
HardhatNetwork
(can be anything really) - RPC url
http://127.0.0.1:8545
(check the node terminal, this might be different) - Chain ID
31337
Now you should be able to to connect to the web UI and interact with the dApp via your web3 wallet.
See a quick demo here
- Solidity
- Hardhat
- Typescript
- Next.js
- React
- Typechain
- Ethers.js
- HTML
- CSS