Skip to content

Commit

Permalink
refactor home page, split logic into 3 hooks, add invite write flow
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthurgallina1 committed Oct 29, 2024
1 parent 31661b3 commit bd277a5
Show file tree
Hide file tree
Showing 14 changed files with 5,765 additions and 106 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file modified hardhat/.DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion hardhat/contracts/Web3DevToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ contract Web3DevToken is ERC20 {
require(balanceOf(msg.sender) > 0, "You are not invited");
require(msg.sender != to, "You can't invite yourself");
require(inviteCount[msg.sender] < MAX_INVITES, "You can't invite more than 3 people");
require(balanceOf(to) >= inviteAmount, "Address alreayd invited");
// require(balanceOf(to) > inviteAmount, "Address alreayd invited");

_mint(to, inviteAmount);
inviteCount[msg.sender]++;
Expand Down
17 changes: 9 additions & 8 deletions hardhat/scripts/interact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import hre from 'hardhat'
// quero um script para convidar o endereço 0xA9BC6d9681Ca08a90fe9b79c79D7660A6936F4c3

const WEB3DEVTOKEN_ADDRESS = '0x5fbdb2315678afecb367f032d93f642f64180aa3'
const METAMASK_WALLET_ADDRESS = '0xA9BC6d9681Ca08a90fe9b79c79D7660A6936F4c3'
const METAMASK_WALLET_ADDRESS = '0x70997970C51812dc3A010C7d01b50e0d17dc79C8' //'0xA9BC6d9681Ca08a90fe9b79c79D7660A6936F4c3'

async function main() {
const [account] = await hre.viem.getWalletClients()
Expand All @@ -16,15 +16,16 @@ async function main() {
// const balance = await web3devToken.read.balanceOf([METAMASK_WALLET_ADDRESS])
// console.log('Balance of 1', balance.toString())

const inviteCount = await web3devToken.read.getInviteCount([
account.account.address,
])
// const inviteCount = await web3devToken.read.getInviteCount([
// account.account.address,
// ])

console.log('Invite count', inviteCount.toString())
// console.log('Invite count', inviteCount.toString())

// const inviteTxnHash = await web3devToken.write.invite([
// METAMASK_WALLET_ADDRESS,
// ])
const inviteTxnHash = await web3devToken.write.invite([
METAMASK_WALLET_ADDRESS,
])
console.log('hash', inviteTxnHash)

// const inviteTxnHash2 = await web3devToken.write.invite([
// METAMASK_WALLET_ADDRESS,
Expand Down
2 changes: 2 additions & 0 deletions w3c-fe/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
"dependencies": {
"@rainbow-me/rainbowkit": "^2.1.7",
"@tanstack/react-query": "^5.59.0",
"jsonwebtoken": "^9.0.2",
"next": "14.2.14",
"react": "^18",
"react-dom": "^18",
"viem": "^2.21.19",
"wagmi": "^2.12.17"
},
"devDependencies": {
"@types/jsonwebtoken": "^9.0.7",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
Expand Down
Loading

0 comments on commit bd277a5

Please sign in to comment.