TheGuestbook
TheGuestbook is a decentralized guestbook application built on the Ethereum blockchain. Users can sign the guestbook, leave messages, and even sponsor messages through a Dutch auction pricing mechanism. The smart contract allows for easy maintenance and updating of guestbook entries while ensuring the integrity and permanence of the data stored.
Features
- Sign the guestbook with a personal message
- Sponsor a message to stand out from the crowd
- Update your guestbook entry through the contract on Etherscan
- VRDA pricing mechanism for sponsored messages
- Admin features to maintain a clean and welcoming guestbook
Smart Contract
Functions
signGuestbookNew(string memory message)
: Sign the guestbook with a new message.sponsorMessage(string memory message)
: Sponsor a message with the Dutch auction pricing mechanism.updateGuestbook(uint256 guestId, string memory message)
: Update an existing guestbook entry.withdrawAll()
: Withdraw all Ether from the contract (admin only).withdrawAllERC20(IERC20Metadata _erc20Token)
: Withdraw all ERC20 tokens from the contract (admin only).rewriteMessage(uint256 guestId)
: Rewrite a guestbook message if it is hateful or inflammatory (admin only).getAllGuests()
: Get all guestbook entries, including sponsored messages.getCurrentMinPrice()
: Get the current minimum price for sponsored messages based on the Dutch auction mechanism.updateSponsoredMessageParameters(uint256 _sponsoredMessageMinPrice, uint256 _dutchAuctionPeriod)
: Update the sponsored message parameters (admin only).updateSponsoredMessageMinPrice(uint256 _sponsoredMessageMinPrice)
: Update the sponsored message minimum price (admin only).updateDutchAuctionPeriod(uint256 _dutchAuctionPeriod)
: Update the Dutch auction period (admin only).
Events
Gm
: Emitted when the contract is deployed.GuestbookSigned
: Emitted when a guest signs the guestbook.GuestbookUpdated
: Emitted when a guestbook entry is updated.GuestbookMessageRewritten
: Emitted when a guestbook message is rewritten by an admin.EmptyMessageError
: Emitted when an empty message error occurs.MessageTooLongError
: Emitted when a message is too long.
How to use
- Connect your Ethereum wallet (such as MetaMask) to the application.
- Choose whether you want to sign the guestbook with a regular or sponsored message.
- Enter your message and click "Sign the Guestbook".
- If you want to sponsor a message, enter your message and the amount you want to pay, then click "Sponsor Message".
- Browse and filter guestbook entries to see what others have written.
- Admins can use the admin panel to rewrite messages, withdraw funds, and update contract parameters.