@jolt-network/contracts
v0.6.2
Published
A smart contract platofrm to enable cryptoincentivized workers to work for registered contracts that need poking or automated calls of any kind.
Downloads
5
Readme
Jolt network
These docs are in active development by the Jolt community.
Jolt network is a decentralized network of workers created for projects that need external devops and for external teams to find onchain jobs.
Workers
Worker is the term used to refer to an external person/team/bot that executes a job on the Jolt network. This can be as simplistic as calling a transaction, or as complex as requiring extensive off-chain logic. The scope of Jolt network is not to manage these jobs themselves, but to allow contracts to register as jobs for workers, and for workers to register themselves as available to perform jobs. It is up to the individual worker to set up their devops and infrastructure and create their own rules based on what transactions they deem profitable (even though the Jolt network CLI can help considerably in setting up a profitable worker from a predefined set of jobs).
Jobs
Job is the term used to refer to a smart contract that wishes an external entity to perform an action. They would like the action to be performed in "good will" and not have a malicious result. For this reason they register as a job, and workers can then execute on their contract.
Becoming a worker
To become a worker you just need to bond some JOLT
to the platform. In order
to do so you will have to call bond(uint256)
on the Bonder
contract. There
is a bonding delay before you can activate as a worker. The extent of the delay
is decided though governance by the Jolt guild. Once the bonding time has
passed, you can call consolidateBond()
to officially register as a valid
worker.
Registering a job
A job can be any system that requires external execution, the scope of Jolt is not to define or restrict the action taken, but to create an incentive mechanism for all parties involved. There are two core ways to create a job;
Registering a job via governance
If you prefer, you can register as a job by simply submitting a proposal via governance to the Jolt guild, to include the contract as a job. If governance approves, no further steps are required.
Registering a job by becoming a job creator
Job creators are a privileged entity in the platform, since they can create jobs at any time without further validation. Job creators can only be allowed through governance, and the Jolt guild must approve them after carefully considering the details of the application. Most of the time, job creators are platforms that wish to create a certain number of Jolt jobs without much friction.
Job interface
Some contracts require external event execution on some conditions. These normally require a restricted access control list, however these can be difficult for fully decentralized projects to manage, as they lack devops infrastructure.
These interfaces can be broken down into types depending on security considerations.
For no, or low risk executions, you can simply call Master.worker(msg.sender)
which will let you know if the given actor is a valid worker in the network.
For high, sensitive, or critical risk executions, you can specify a minimum
bond, minimum earned, and minimum worker age required to execute this function.
Based on these 3 limits you can define your own trust ratio on these keepers. In
general, to create a job one can simply extend from either the Job
or
JobUpgradeable
contract. The contract needs to be passed the Master
instance
address on the targeted network and override the workable
and work
function
(making sure to apply either the needsExecution
or
needsExecutionWithRequirements
modifier to it, depending on the needs).
You can take a look at a simple example job here.
Job credits
As mentioned above, a job has a set amount of credits
that they can award
workers with, and any ERC20 token can be awarded as credit. But if you need to
add a job to the platform, you can avoid purchasing credit tokens directly. You
can instead opt to receive bonus credits by providing liquidity to specific
pools, as defined by governance. After having provided liquidity, you can "sell"
the LP token to the platform for an amount of JOLT equal to the value of the LP
tokens plus a premium. The premium amount is decided by the governance. This is
a way to buy up credits at a discount. Keep in mind that credits obtained this
way can never be withdrawn from the platform.
With the v1 of Jolt, a frontend will obviously be released to make it a lot easier to interact with the platform.