Messenger
is a message dapp that allows text and tokens (AVAX) to be exchanged.
git clone [this_repository]
cd [this_repository]
yarn install
yarn client dev
After executing the above command, access localhost:3000
in your browser.
contract
- Solidity
test & deploy
- hardhat
- typescript
Root: packages/contract
Messenger.sol
Implementing Messenger contract core code.Ownable.sol
Provide owner functionality to Messenger contract.
-
Send message
The message sender calls thepost
function with the text and the receiver address as arguments.
The sender can also attach some AVAX to the message.
The contract then holds the message data as an array. -
Check message
The user calls thegetOwnMessage
function.
Then the contract finds the message array of which the caller is the receiver and returns it. -
Accept or deny message
The message receiver calls theaccept
ordeny
function with the index number of message array as an argument.
ifaccept
, the contract send the AVAX to the receiver.
ifdeny
, the contract send the AVAX to the sender.
- typescript
- React.js
- Next.js
Root: packages/client
components
,hooks
,pages
,styles
Directories containing client side codeutils/Messenger.json
Includes the contract ABI.
All pages initially confirm the connection of the user wallet and acquire the contract object.
And the user calls the function of the contract on each page.
Send message pages/message/SendMessagePage.tsx
Check and accept or deny message pages/message/ConfirmMessagePage.tsx