relevant tag icon
Push Core V1.5
copy icon
Zaryab
• version 1.0.0
pushcoreV1.5
Audited

Push Core V1.5

Audited

The Push core protocol, as the name might indicate, is the main smart contract as it handles some of the most crucial features like Channel creation, governance, channel state changes as well as funds and incentive mechanisms, etc. It’s very important to note, however, that the Push Core smart contract will only be deployed on the Ethereum blockchain and not on any other chain.

*Visit desktop site to download or deploy

Version

1.0.0

Creator

Zaryab

Last Publish

2/9/2023
Any contract you deploy is yours.
Fully owned and controlled by your wallet.
Documentation
Source Code
initialize(address,address,address,address,address,address,address,uint256) :
This function is the initializer for the PushChannel contract. It sets up the contract by assigning the addresses of the pushChannelAdmin, pushTokenAddress, wethAddress, uniswapRouterAddress, lendingPoolProviderAddress, daiAddress, aDaiAddress, and referralCode. It also sets the fee amount, minimum pool contribution, and add channel minimum fees. Finally, it sets the groupLastUpdate, groupNormalizedWeight, and ADJUST_FOR_FLOAT variables. (autogenerated documentation)
addSubGraph() :
This function allows an activated channel to add a subgraph to the Graph Protocol. The function takes in a calldata parameter, _subGraphData, which contains the data for the subgraph. The function then emits an event, AddSubGraph, which contains the address of the sender and the data for the subgraph. (autogenerated documentation)
updateWETHAddress(address) :
This function allows the Push Channel Admin to update the WETH address associated with the contract. It takes in a new address as an argument and sets the WETH_ADDRESS variable to the new address. This allows the contract to use the new address for any future transactions. (autogenerated documentation)
updateUniswapRouterAddress(address) :
This function allows the Push Channel Admin to update the address of the Uniswap V2 Router. It does this by setting the UNISWAP_V2_ROUTER variable to the new address provided as an argument. This allows the Push Channel Admin to update the address of the Uniswap V2 Router in the event that the address changes. (autogenerated documentation)
setEpnsCommunicatorAddress(address) :
This function sets the address of the EPNS Communicator contract. It can only be called by the Push Channel Admin and takes an address as an argument. This address is then stored in the epnsCommunicator variable. (autogenerated documentation)
setGovernanceAddress(address) :
This function allows the Push Channel Admin to set the address of the governance contract. This is done by passing in the address of the governance contract as an argument to the function. The function then sets the governance address to the address passed in. (autogenerated documentation)
setMigrationComplete() :
This function sets the boolean variable isMigrationComplete to true. It can only be called by the PushChannelAdmin, which is an address that has been granted special privileges to manage the contract. This allows the PushChannelAdmin to mark the migration process as complete. (autogenerated documentation)
setFeeAmount(uint256) :
This function allows the governance to set the fee amount for creating a new channel. It requires that the new fee amount is greater than zero and less than the minimum fee amount for creating a channel. If these conditions are met, the new fee amount is set. (autogenerated documentation)
setMinPoolContribution(uint256) :
This function allows the governance of the EPNSCoreV1_5 contract to set the minimum amount of contribution that a pool must make in order to be eligible for rewards. The function requires that the new amount is greater than zero, and if it is, it sets the MIN_POOL_CONTRIBUTION variable to the new amount. (autogenerated documentation)
pauseContract() :
This function pauses the contract, preventing any further transactions from being processed. It can only be called by the governance address, which is set when the contract is deployed. When called, the function calls the internal _pause() function, which pauses the contract. (autogenerated documentation)
unPauseContract() :
This function is used to unpause a contract. It can only be called by the governance address, which is set when the contract is deployed. The function calls the internal _unpause() function, which sets the paused state of the contract to false. This allows the contract to resume normal operations. (autogenerated documentation)
setMinChannelCreationFees(uint256) :
This function allows the governance to set the minimum fees for creating a new channel. It requires that the new fees must be greater than the minimum pool contribution. If the new fees are valid, the function sets the ADD_CHANNEL_MIN_FEES variable to the new fees. (autogenerated documentation)
transferPushChannelAdminControl(address) :
This function allows the current Push Channel Admin to transfer control of the Push Channel to a new address. It requires that the new address is not 0 and is not the same as the current Push Channel Admin. If these conditions are met, the new address is set as the Push Channel Admin. (autogenerated documentation)
getChannelState(address) :
This function retrieves the current state of a given channel. It does this by taking in the address of the channel as an argument and then returning the value of the channelState variable stored in the channels mapping for that channel. (autogenerated documentation)
updateChannelMeta(address,uint256) :
This function allows the owner of a channel to update the identity associated with the channel. It requires a deposit of a minimum amount of fees, which increases with each update. The deposit is transferred from the channel address to the protocol pool fees address. The new identity is then emitted in an UpdateChannel event. (autogenerated documentation)
createChannelWithPUSH(uint256,uint256) :
This function creates a new channel with PUSH token. It requires the sender to provide the channel type, identity, amount, and channel expiry time. The function checks that the amount is greater than the minimum fees required to add a channel and emits an AddChannel event. It then transfers the amount from the sender to the contract address and calls the _createChannel function to create the channel. (autogenerated documentation)
migrateChannelData(uint256,uint256,uint256[],uint256[]) :
This function is used to migrate channel data from a previous version of the EPNSCore contract to the current version. It takes in an array of channel addresses, channel types, identities, amounts, and expiry times as arguments. It then loops through the array, checking if the channel state is 0 (i.e. not yet created). If it is, it transfers the amount from the sender to the contract, emits an AddChannel event, and creates the channel. (autogenerated documentation)
_createChannel(address,uint256,uint256) :
This function is used to create a new channel in the EPNSCoreV1_5 smart contract. It takes in four parameters: the address of the channel, the type of channel, the amount deposited, and the channel expiry time. It then calculates the pool fee amount and pool fund amount, and stores these values in the CHANNEL_POOL_FUNDS and PROTOCOL_POOL_FEES variables. It also calculates the channel weight and stores it in the channels[_channel].channelWeight variable. It then stores the other parameters in the channels[_channel] variables and increments the channelsCount variable. If the channel type is TimeBound, it checks that the channelExpiryTime is greater than (autogenerated documentation)
destroyTimeBoundChannel(address) :
This function is used to destroy a time-bound channel. It requires that the channel is of type time-bound, and that either the sender is the channel address and the channel has expired, or the sender is the push channel admin and the channel has expired for more than 14 days. It then refunds the pool contribution to either the sender or the protocol pool fees, depending on who is calling the function. It then unsubscribes the channel from the EPNS communicator, decrements the channels count, and deletes the channel from the channels mapping. Finally, it emits an event to indicate that the time-bound channel has been destroyed. (autogenerated documentation)
createChannelSettings(uint256,string,string,uint256) :
This function allows a user to create channel settings for their account. It takes in four parameters: _notifOptions, _notifSettings, _notifDescription, and _amountDeposited. The function first checks that the amount deposited is greater than or equal to the minimum fees required to add a channel. It then stores the notifSettings in the channelNotifSettings mapping, adds the amount deposited to the protocol pool fees, and transfers the amount from the user to the contract. Finally, it emits an event to indicate that the channel settings have been added. (autogenerated documentation)
deactivateChannel() :
This function deactivates a channel by the sender. It first calculates the total refundable amount by subtracting the minimum pool contribution from the pool contribution. It then sets the channel state to 2 (deactivated), subtracts the total refundable amount from the channel pool funds, sets the channel weight to the minimum pool contribution divided by the minimum pool contribution, and sets the pool contribution to the minimum pool contribution. Finally, it transfers the total refundable amount to the sender and emits a DeactivateChannel event. (autogenerated documentation)
reactivateChannel(uint256) :
This function allows a user to reactivate a previously deactivated channel. It requires the user to pass in an amount of funds that is greater than or equal to the minimum fees required to add a channel. The function then transfers the amount from the user to the contract, deducts the fee amount from the total, and adds the remaining amount to the channel pool funds. It then updates the channel data for the user, setting the channel state to active, updating the pool contribution and channel weight accordingly. Finally, it emits an event to signal that the channel has been reactivated. (autogenerated documentation)
blockChannel(address) :
This function is used to block a channel. It is called by the Push Channel Admin and can only be used on unblocked channels. The function first calculates the current pool contribution of the channel and subtracts it from the total channel pool funds. It then adds the current pool contribution to the protocol pool fees. It then sets the channel state to 3 (blocked) and sets the channel weight to the minimum pool contribution. Finally, it emits an event to indicate that the channel has been blocked. (autogenerated documentation)
transferChannelOwnership(address,address,uint256) :
This function allows a user to transfer the ownership of a channel from one address to another. It requires that the new channel address is valid and that the amount deposited is greater than the minimum fees required to add a channel. The function then transfers the amount deposited from the old channel address to the contract address, and updates the protocol pool fees accordingly. It then updates the channel data in the channels mapping, and subscribes the new channel address to the EPNS communicator. Finally, it unsubscribes the old channel address from the EPNS communicator and deletes the old channel data from the channels mapping. The function emits an event to signal the ownership transfer and returns true. (autogenerated documentation)
getChannelVerfication(address) :
This function is used to determine the verification status of a given channel. It checks if the channel is verified by the pushChannelAdmin, or if it is the pushChannelAdmin itself. If neither of these is true, it will loop through the channels to check if the channel is verified by any other channel. If it is, the verification status will be set to 2. If it is not, the verification status will be set to 0. (autogenerated documentation)
batchVerification(uint256,uint256) :
This function allows the Push Channel Admin to verify a batch of channels in one go. It takes in a start index, an end index, and an array of channel addresses as parameters. It then loops through the array of channel addresses from the start index to the end index, calling the verifyChannel() function on each address. Finally, it returns a boolean value indicating that the batch verification was successful. (autogenerated documentation)
batchRevokeVerification(uint256,uint256) :
This function is used to revoke the verification status of multiple channels at once. It takes in a start index, an end index, and an array of channel addresses as parameters. It then loops through the array of channel addresses, starting at the start index and ending at the end index, and calls the unverifyChannel() function for each address. This function returns true if all of the channels were successfully unverified. (autogenerated documentation)
verifyChannel(address) :
This function verifies a channel by setting the verifiedBy field of the channel to the address of the caller. The function requires that the caller is verified and that the channel is not already verified. If these conditions are met, the function sets the verifiedBy field of the channel to the address of the caller and emits an event to notify of the verification. (autogenerated documentation)
unverifyChannel(address) :
This function allows the sender of the transaction (either the channel who verified the channel or the Push Channel Admin) to revoke the verification of a channel. It sets the verifiedBy field of the channel to 0x0, and emits an event to indicate that the verification has been revoked. (autogenerated documentation)
getChainId() :
This function is used to get the chain ID of the current Ethereum network. It does this by using the chainid() assembly instruction, which returns the chain ID of the current network. The function then returns the chain ID as a uint256. (autogenerated documentation)

Get Cookin'
share iconShare

copy iconDownload Source
copy iconnpx cookbookdev i Push-Core-V1.5
copy icon

Last Publish

2/9/2023

Version

1.0.0

Creator

Zaryab

Cookbook is free.
Any contract you deploy is yours.
Your contract is owned and controlled by you.