Some time ago I expressed an idea that Ergo can be good for “self-sovereign” DeFi without a clear explanation what could be that about. I still do not have a concrete definition, but let me show an example which I have in my mind.
So let’s take the crowdfunding pledge contract from the ErgoScript whitepaper:
{
val fundraisingFailure = HEIGHT >= deadline && backerPubKey
val enoughRaised = {(outBox: Box) =>
outBox.value >= minToRaise &&outBox.propositionBytes == projectPubKey.propBytes
}
val fundraisingSuccess = HEIGHT < deadline &&projectPubKey && OUTPUTS.exists(enoughRaised)
fundraisingFailure || fundraisingSuccess
}
Which is basically saying that a box protected by the pledge contract can be spent before a deadline if a spending transaction collects enoughRaised nanoergs.
This contract has two crowdfunding-related parameters then, deadline, and amount the project has to raise in order to get the pledge. But these parameters can be individual! Even more, if a user is willing to support the project unconditionally, he may send funds via just simple transfer.
Consider Alice doing fundraising. Bob is constructing such a pledge contract that he contributes if Alice is raising at least 100 ergs before height = 300K. Carol’s contract is about 50 ergs and 350K. Dave is sending 75 ergs unconditionally.
Then Alice can claim Carol’s pledge before deadline as well. She can claim Bob’s funds before Alice’s pledge deadline if Carol’s pledge is not less than 25 ergs.
Pledge contracts may be more complex as well, e.g. encode pledge size as a function of time.
Thus different users can set different pledge contracts, and still a joint action (the crowdfunding in our example) may take place. That’s what self-sovereign DeFi could be about. And surely a lot of new complexities come in regards with UX etc.