Setup a Points Campaign
Last updated
Last updated
Royco points programs are smart contracts which can be slotted in anywhere the Royco protocol expects an ERC20 to be distributed as incentives. Unlike an ERC20 however, Royco Points Programs cannot be transferred, balances cannot be queried onchain, and the contract has no state, making it difficult to tokenize by an external party. Royco Points Programs simply award points via emitting events via a function that can only be called by Royco contracts, and only by allowed vault market vaults, or recipe market IPs.
Go to the PointsFactory contract on etherscan or the block explorer of the chain of your choice. All PointsFactories are deployed to 0x19112AdBDAfB465ddF0b57eCC07E68110Ad09c50
Navigate to the Write Contract page and deploy a Points contract, choosing values for the following Params:
_name: the name of your points program, which will be displayed on the Royco frontend
_symbol: the “ticker” of your points program, same as an ERC20 symbol
_decimals: Like an ERC20, 18 recommended
_owner: The address with admin privileges over the points program, allowed to add new IPs and Vaults permitted to award points. Ownership can be transferred.
After clicking ‘Write’, and confirming the transaction, click “View your transaction” and navigate to the “Internal Txns” tab. Find your new points contract in the create2 call. (The new contract can also be found in the transaction logs.) The new points contract should already be verified but if for whatever reason it is not, please reach out to @corddry on telegram
Verify the vaults/IPs that you want to allow to award points
If you have a vault market that you want to distribute points through, get the wrapped vault address (make sure to get the wrapped vault not the underlying vault!) and call the addAllowedVault function with it as a parameter
If you have a recipe market that you want to distribute points through, get the address of the account that you want to act as the Incentive Provider on Royco, and pass it to the addAllowedIP function
Note that multiple vaults and IPs may be added, but they cannot be removed. Your points program is now fully functional!
To add the points program to the Royco frontend, make a PR to the royco-frontend-template repository which adds your points program.
Determine the chainID of the chain you deployed your points contract on
See https://chainlist.org/
Ethereum Mainnet: 1
Base: 8453
Arbitrum One: 42161
Find the token-map with the corresponding chainID, for example token-map-42161.tsx for Arbitrum
The key should be the chain ID, in this case 42161, followed by a dash, followed by the Points contract address
id should be the same
chain_id should be chainID from earlier
contract_address should be the Points contract address
name should be the exact same name you passed in when creating the contract from the factory
symbol should also mirror the value passed to the factory
image should be a link to the icon you wish to use, ideally a square image of size 512px*512px, preferably an svg, then png, then jpeg.
decimals should mirror the value passed in when creating the contract from the factory
type should be “point”
Now submit the changes as a PR, and wait for review
Once your PR is accepted your points program will be available as an incentive asset on the Royco frontend! Freely add incentives on Royco using this asset, and Award events will be emitted. Later an offchain script can index these Award events to calculate the number of points a user has earned on Royco.
Add a config for your points contract at the bottom of the file, but before the final closing bracket, following the following example pattern: (note this can be done directly in Github by clicking the pencil icon in the top right)