Skip to content

push-protocol/push-smart-contracts

 
 

Repository files navigation

Push Protocol is a web3 communication network, enabling cross-chain notifications, messaging, video, and NFT chat for dapps, wallets, and services.πŸš€

Push Protocol Smart Contracts

Welcome to the repository for the smart contracts of the Push Protocol. This repository contains the core code that powers our decentralized communication network. The Push Protocol is a web3 communication protocol that enables cross-chain notifications and messaging for decentralized applications (dApps), wallets, and services.

Our smart contracts are the backbone of the Push Protocol, enabling the functionality that allows for on-chain and off-chain communication via user wallet addresses. This is done in an open, gasless, multichain, and platform-agnostic fashion.

In this repository, you will find the contracts that handle various aspects of the Push Protocol, from channel creation and verification to notification sending and subscription handling. We also provide a suite of tests to ensure the robustness and security of our contracts.

We invite you to explore, contribute, and help us build the future of web3 communication.


πŸ“š Table of Contents

Smart Contract Addresses

Contract addresses for Ethereum Mainnet.

Contract Name Contract Address
Push Token 0xf418588522d5dd018b425E472991E52EBBeEEEEE
Push CoreV2 0x66329Fdd4042928BfCAB60b179e1538D56eeeeeE
Push CommV2 0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa

Contract addresses for Ethereum Goerli Testnet.

Contract Name Contract Address
Push Token 0x2b9bE9259a4F5Ba6344c1b1c07911539642a2D33
Push CoreV2 0xd4E3ceC407cD36d9e3767cD189ccCaFBF549202C
Push CommV2 0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa

You can find addresses for other networks over at our Docs

🧩 Modules

Pushcomm
File Summary Module
PushCommV2.sol This code is the implementation of the Push Communicator protocol, which is a communication layer between end users and the Push Core Protocol. It allows users to subscribe to channels, unsubscribe from channels, and send notifications to specific recipients or all subscribers of a channel.
PushCommStorageV1_5.sol This Solidity code defines a contract for storing and managing user data in the Ethereum Push Notification Service (Push) protocol. It includes a User struct for organizing data about users and several mappings that track user and channel subscriptions. The contract also includes state variables for governance, user count, and more. contracts/PushComm/PushCommStorageV1_5.sol
PushCommAdmin.sol This code snippet is a Solidity contract that extends the ProxyAdmin contract from the OpenZeppelin library. Its main functionality is to serve as a proxy administrator for a smart contract system, allowing the updating and upgrading of contracts in the system, while maintaining the same deployment address and keeping the contract functionalities intact. The SPDX-License-Identifier is also included, specifying the open-source MIT license. contracts/PushComm/PushCommAdmin.sol
PushCommProxy.sol The provided Solidity contract is an implementation of a transparent upgradeable proxy using the OpenZeppelin library. It takes in parameters for the contract's logic, governance address, push-channel admin address, and chain name as part of its constructor function. Upon initialization, the contract transparently proxies its functionality, allowing future upgrades and modifications without breaking functionality or requiring migrations. contracts/PushComm/PushCommProxy.sol
PushCommV2.sol This code defines the storage contract for the Push Communicator protocol version 1.5. It includes the user struct and mappings to track user details, subscriptions, notification settings, and delegated notification senders. It also includes state variables for governance, push channel admin, chain ID, user count, migration status, Push Core address, chain name, and type hashes for various types of transactions. contracts/PushComm/PushCommV2.sol
Pushcore
File Summary Module
PushCommV2.sol The code is a smart contract implementation called "PushCommV2" for a decentralized notification protocol. It includes functionalities such as creating and managing channels, channel verification, depositing and withdrawing funds, and fair share ratio calculations for distributing rewards. contracts/PushCore/PushCommV2.sol
PushCoreProxy.sol The code defines a contract PushCoreProxy that extends the TransparentUpgradeableProxy to enable transparent and secure upgrades. It uses the constructor to set various parameters, such as logic contract, governance address, WETH and DAI addresses, and initialization parameters by encoding values using abi.encodeWithSignature(). contracts/PushCore/PushCoreProxy.sol
PushCoreStorageV2.sol The provided code defines a contract called PushCoreStorageV2 that has three state variables. It defines two types of byte32 hash constants and mappings for nonces, channel update counters and rewards claimed by addresses for channel creation. It specifies the Solidity compiler version to be used as greater than or equal to 0.6.0 and less than 0.7.0. contracts/PushCore/PushCoreStorageV2.sol
PushCoreAdmin.sol The code defines a contract called PushCoreAdmin that imports "ProxyAdmin" from the "@openzeppelin/contracts/proxy/" package. The contract defines no behavior of its own and essentially acts as a forwarding service that allows an admin to upgrade other contacts via a proxy. It is licensed under MIT. contracts/PushCore/PushCoreAdmin.sol
TempStorage.sol The provided code is for a Solidity smart contract called TempStorage, which serves as a temporary storage for channels whose poolContribution and weight have been updated. It uses a mapping data structure to keep track of updated channels and has two functions that allow users to check if a channel has been adjusted and to mark a channel as adjusted, respectively. The constructor function sets the Core_Address of the contract and requires that it be a non-zero address. contracts/PushCore/TempStorage.sol
PushCoreStorageV1_5.sol This Solidity contract defines the storage layout for an Ethereum Push Notification Service (Push). It includes various enums, constants, mappings, and state variables to keep track of channels created by users, historical data, fair share ratios, fee calculations, and more. contracts/PushCore/PushCoreStorageV1_5.sol

Getting Started

πŸ–₯ Installation

  1. Clone the push-smart-contracts repository:
git clone https://github.com/ethereum-push-notification-service/push-smart-contracts
  1. Change to the project directory:
cd push-smart-contracts
  1. Install the dependencies:
npm install

πŸ€– Using push-smart-contracts

cd contracts

πŸ§ͺ Running Tests

npx hardhat test

Deploy & verify

Environment Setup

Copy the sample environment file located in env/ into the target subdirectory of your choice (e.g., testnet or mainnet) and prefix the filename with your blockchain of choice:

mkdir env/testnet
cp env/.env.sample env/testnet/sepolia.env

Do this for each blockchain network that the contracts will be deployed to. Then configure each .env file.

Deploy

Deploy the contracts by running the following command for each target network:

bash sh/deploy.sh -n NETWORK_TYPE -c CHAIN_NAME -k PRIVATE_KEY -s DEPLOYMENT_SCRIPT -v VERIFICATION_KEY
# Argument examples
-n testnet, mainnet
-c avalanche, ethereum, sepolia
-s DeployPushNtt.s.sol, child/UpgradePushNtt.s.sol

The deployments are stored in ./broadcast

See the Foundry Book for available options.


Resources

  • Website To checkout our Product.
  • Docs For comprehensive documentation.
  • Blog To learn more about our partners, new launches, etc.
  • Discord for support and discussions with the community and the team.
  • GitHub for source code, project board, issues, and pull requests.
  • Twitter for the latest updates on the product and published blogs.

Contributing

Push Protocol is an open source Project. We firmly believe in a completely transparent development process and value any contributions. We would love to have you as a member of the community, whether you are assisting us in bug fixes, suggesting new features, enhancing our documentation, or simply spreading the word.

  • Bug Report: Please create a bug report if you encounter any errors or problems while utilising the Push Protocol.
  • Feature Request: Please submit a feature request if you have an idea or discover a capability that would make development simpler and more reliable.
  • Documentation Request: If you're reading the Push documentation and believe that we're missing something, please create a docs request.

Read how you can contribute HERE


Not sure where to start? Join our discord and we will help you get started!

Discord

License

Check out our License HERE

About

Push Core and Communicator Smart Contracts

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published