- eth-contract generate a event on-chain
- js generate the event proof data off-chain
- call hmy-contract's
function ExecProof(proof-data) - hmy-contract verify the proof data then trigger function
onXxEvent(...) - vice-versa
for example: eth-contract emit
event Locked(A, B, C), and will trigger hmy-contract'sfunction onLockedEvent(A, B, C)hmy-contract's event also trigger eth-contract's
onXxEvent
- call eth-contract
CreateRainbow(),then will emitevent TokenMapReq(...) - trigger hmy-contract
function onTokenMapReqEvent(...):- create a new mintable token contract
- in the end, emit
event TokenMapAck(...)
- trigger eth-contract
function onTokenMapAckEvent(...), bridge init complete.
vice-versa
- user call ERC20's
Approveto approve eth-contract spent their token - user call eth-contract's
RainbowTo, it will emitevent Locked(...) - trigger hmy-contract's
function onLockedEvent(), Toekn-In complete
- user call HRC20's
Apprveto approve hmy-contract spent their token - user call hmy-contract's
function RainbowBack(), it will emitevent Burn(...) - trigger eth-contract's
onBurnEvent(), Toekn-Back complete.
vice-versa