L2 development workflow(DRAFT)
Introduction
This document is development workflow idea for building applications run on OVM client.
Quick getting started
Write verifyStateTransition
Developers can write business logic of their application by defining state transition
code:js
function verifyStateTransition(preState, transaction) {
// ...
return newState;
}
The interface of verifyStateTransitions are different between channel, Plasma and oprimistic rollup.
Choose claims from design patterns and setup your state transitions!
Plasma, Channel!
combine 2 transitions
fee&game
depending on other construction
e.g.) channel on Plasma,
conditional payment
substate model
offline swap
code:js
original_channel_claim() := channel_exit_claim(YourStateTransition)
original_plasma_claim() := IsDeprecated(YourStateTransition, FeeStateTransition)
Write frontend application!
code:js
const MyApp = require('MyApp');
const app = new MyApp()
app.claimExit()
app.query()
app.transfer() // <- predefined
app.atomicSwap() // <- predefined
app.check_fast_finality_merchant() // <- predefined
app.openChessGame() // <- your original!
app.grantToUser() // original
Connecting to existing L2 network
You can get L2 network endpoint from CEL development portal
code:js
More deeply
Generate smart contract
Automatically generating smart contract which has finalizeClaim for each claims
Solidity API
This component is provided as Solidity smart contract, user can inherit generated contract
Framework automatically transforms the claim to application specific data structure
code:js
contract MyDepositContract is DepositContract {
function finalize${claim_name}(decidedClaimObject: FinalizedObject) {
// decidedClaimObject is not Property, more application specific object
ERC20.transfer(decidedClaimObject.owner, decidedClaimObject.amount)
}
}
Conclusion