mesg-foundation / engine

Build apps or autonomous workflows with reusable, shareable integrations connecting any service, app, blockchain or decentralized network.
https://mesg.com/
Apache License 2.0
130 stars 13 forks source link

Execution price based on service task price and new credit module #1842

Closed antho1404 closed 4 years ago

antho1404 commented 4 years ago

New credit module

A credit module that stores a balance for each address (default 0) that can be negative. This is quite similar to the default bank module but with the possibility to go bellow 0 and have negative credits.

Process address payment

The process now has a new attribute paymentAddress that delegates the payment of executions of this process to a specific address. The default is the owner of the process. The process doesn't have any balance anymore and each executions transfer from the paymentAddress of the process and not the process itself. We can still have the a process that has credits and use the address of the process as paymentAddress.

Execution price

The execution price is not set by the user based on a minExecPrice anymore but calculated based on 3 variables defined by service's tasks:

All these payment are done with the credit modules and not the native token anymore. This allows to have negative credits for executions that can be paid later.

TODO in other PR / discuss: