Providers¶
The Crayon Protocol team decided to leave it to third parties to host front-ends to access the protocol’s desks. Integration with Crayon can also benefit DEXes who can then source loans for leveraged trading on their platforms. Providers are incentivized by letting them specify and keep a percentage of reward tokens earned by their users. When minting reward tokens for a user, the protocol awards that percentage of the rewards to the provider the user used. DEXes integrating with Crayon also benefit by being able to flashloan collateral posted by their users at no cost.
The following functions in the Control smart contract are available for provider interaction.
- register_provider(_provider_percentage: uint256)¶
Register
msg.senderas a provider (of front end in most common use case). Reverts ifmsg.senderis already registered or had registered in the past and then unregistered._provider_percentage: The percentage of reward tokens earned by its users that the provider will keep
Note
A provider that un-registers cannot later re-register using its previous address but can re-register using a new address. This is meant to protect users from abusive behavior.
- unregister_provider()¶
Unregister
msg.senderas a provider. Reverts ifmsg.senderis not already registered as a provider. Provider still earns rewards from activity that happened prior to un-registering.
- is_registered_provider(_provider: address) bool¶
Returns
TrueorFalse.Truemeans_providerhas registered as a provider and has specified the percentage of its users’ reward tokens that it will keep. This is aviewfunction._provider: The address
- provider_percentage(_provider: address) uint256¶
Return the percentage of the cumulated reward tokens a provider keeps. A return value of 5 means the provider keeps 5% of its users’ rewards. This is a
viewfunction._provider: The address of the provider