Skip to content

A collection of Cyberconnect middlewares to apply a discount on an essence in different ways.

Notifications You must be signed in to change notification settings

nickyharpor/cyberconnect-discount-middlewares

Repository files navigation

Cyberconnect Discount Middlewares

This repository contains a collection of Cyberconnect middlewares to apply a discount on an essence in different ways. CollectPaidMw.sol is used as the base for writing these new middlewares.

Usage:

Option 1:

The interfaces and bytecodes of all the contracts are available. You can use them to deploy your own contract using deploy.js.

Option 2:

To compile and deploy the contracts you can clone the original cybercontracts repo, and copy your desired .sol file under essence directory. Next, follow the deployment guide to compile and deploy.

Demo (BNB Testnet):

Middleware Address
Early Bird 0x998A7331529EDe43fdB3CabA7f85F265eE63B636
First N 0x8B08012f7fab8FaDD7c3c6d686ABA3e73Cf9262D
Hot Essence 0x09bccAF5769A44DfbA3BD7610d693f604764f9Cf
Upgrade 0x36f797cf56a9b772470658eb02F25507081e7bF9

Middlewares:

Discount applies for the early bird collectors. A target block in future is set as the end of early bird discount.

Example use cases:
  • Increasing the hype of an essence
  • Selling more in less time
Additional init params:

uint256 targetBlock indicates a block in the future after which the discount is disabled.

uint256 discount sets discount percentage. Must be less than or equal to Constants._MAX_BPS. Zero means no discount.


A discount is applied for the first N collectors of the essence.

Example use cases:
  • Selling tickets to an event
  • Promoting a profile by making users check for such an essence more often
Additional init params:

uint256 firstN indicates how many first collectors receive a discount.

uint256 discount sets discount percentage. Must be less than or equal to Constants._MAX_BPS. Zero means no discount.


Discount applies on the essence when it's not in trend any more (i.e. after a target block has passed.)

Example use cases:
  • Selling trading signals
  • Selling a music album
Additional init params:

uint256 targetBlock indicates the block at which the discount starts to apply.

uint256 discount sets discount percentage. Must be less than or equal to Constants._MAX_BPS. Zero means no discount.


Discount applies on the essence only if the collector has already collected a specified essence (e.g. an essence containing an older version of a software)

Example use cases:
  • App upgrades
  • Loyalty programs
Additional init params:

uint256 previousEssenceId indicates the ID of the essence which should have been already collected in order to get a discount.

uint256 upgradeDiscount sets discount percentage. Must be less than or equal to Constants._MAX_BPS. Zero means no discount.

About

A collection of Cyberconnect middlewares to apply a discount on an essence in different ways.

Topics

Resources

Stars

Watchers

Forks