RedPacket icon indicating copy to clipboard operation
RedPacket copied to clipboard

RedPacket

Introduction

This project(RedPacket smart contract) is a Dapplet based on the Mask browser extension. Inspired by Red Packet. It enables you to put cryptocurrency tokens(ETH or ERC-20) into red packets and send them to your friends and family.

Besides, Mask Network developed a new red packet for ERC721/NFT token.

Getting Started

This is a hardhat project. To install required node.js modules

npm ci

To compile the solidity source code

npm run compile

To run ERC20 RedPacket unit test

npm run test:normal

To run ERC721/NFT RedPacket unit test

npm run test:erc721

To deploy the smart contract on Ethereum ropsten testnet

NOTE:

Before run deploy scripts, please configure the .env file according to .env.example file.

  • For verify: if set false, the contract won't be verified during deployment, and vice versa.
  • For upgrade: if set false, the script will deploy a new contract on the specified chain. Otherwise, the script will upgrade the contract.

If you don't configure the .env file properly, the script will deploy a new contract and won't verify contract by default;

npm run deploy ropsten

Deployed Contract Address

Chain HappyRedPacket HappyRedPacket_ERC721
mainnet 0xaBBe1101 0x8d285739
ropsten 0x0722507c 0x8fF42e93
bsc 0x0ca42C17 0xf8968e1F
matic 0x93e0b87A 0xf6Dc0427
arbitrum_rinkeby 0x4A77E797
arbitrum 0x83D6b366 0x561c5f3a
xdai 0x54a0A221 0x561c5f3a
goerli 0x8bF6b979 0x0a04e23f
fantom 0x578a7Fee 0xF9F7C149
avalanche 0xF9F7C149 0x96c7D011
celo 0xab7b1be4 0x96c7D011
optimism_kovan 0x68EDbfA3 0x556F63d7
optimism 0x981be454 0x02Ea0720
aurora 0x19f179D7 0x05ee315E
fuse 0x561c5f3a 0x066804d9
boba 0x578a7Fee 0xF9F7C149
moonriver 0x578a7Fee 0xF9F7C149
conflux_espace 0x96c7d011 0x5b966f3a
conflux_espace_test 0x913975af 0x71834a3f
harmony 0xab7b1be4 0x83d6b366
harmony_test 0x96c7d011 0x981be454
metis 0x2cf91AD8 0x81246335
metis_test 0xAb7B1bE4 0x2cf91AD8
kardia 0x081ea643 0xc3e62b2C
astar 0x2cF46Db8 0xc3e62b2C
base 0x8D03d9b4 0xbC7d9898
base_goerli 0x16f61cb3 0x727F8030
scroll_sepolia 0x16f61cb3 0x727F8030
scroll 0x16f61cb3 0x727F8030
x1_test 0x977baB5f 0xd81c16d7
manta 0x0Cc83D72 0xB349AC5E
linea 0xB349AC5E 0x8A42F700
zksync_era 0x5916FEE6 0x191805D4
x1 0xDb847f1D 0x977baB5f
sei 0xB349AC5E 0x8A42F700

Test report

Unit test and performance(gas consumption) results, please see test report and gas consumption test report.

Version history

Change, please see Change log for changes.

Contribute

Any contribution is welcomed to make it better.

If you have any questions, please create an issue.

Security report

If you have any security issue, please send to [email protected].

License

MIT LICENSE