Let $\t{Params}\t{VC}, \t{Bulla}\t{VC}$ be defined as in Vesting Configuration Model.
Let $\t{Coin}$ be defined as in the section Coin.
Let $โโ, ๐ฝโ, \mathcal{X}, \mathcal{Y}, \t{๐นโถโด2๐ฝโ}$ be defined as in the section Pallas and Vesta.
Let $tโ = \t{BlockWindow} โ ๐ฝโ$ be the current blockwindow as defined in Blockwindow.
Let $\t{PoseidonHash}$ be defined as in the section PoseidonHash Function.
Let $\t{ElGamal.Encrypt}, \t{ElGamalEncNote}โ$ be defined as in the section Verifiable In-Band Secret Distribution.
Denote the Vesting contract ID by $\t{CID}\t{V} โ ๐ฝโ$ and its Exec
function spend hook by $\t{SH}\t{V} โ ๐ฝโ$.
This function creates a vesting configuration bulla $โฌ_\t{VC}$. We
commit to the vesting configuration params and then add the bulla to
the set, along with the vested coin $\t{Coin}$ minted by the child
Money::transfer() call. Each vesting configuration keeps track of its
minted coins, to ensure that only those can be burned in next actions,
creating a sequence of coins, enabling the contract to keep track of
remaining balances anonymously. Additionally, we verify the minted
vesting coin is encrypted for the configuration shared secret key,
ensuring both parties have access to it.
TODO: add client pathTODO: add entrypoint pathTODO: add proof pathDefine the vest function params $$ \begin{aligned} โฌ\t{VC} &โ \t{im}(\t{Bulla}\t{VC}) \ \t{SPK} &โ โโ \end{aligned} $$
TODO: Add call params path
Vesting configuration bulla uniqueness โ whether $โฌ_\t{VC}$ already exists. If yes then fail.
Let there be a prover auxiliary witness inputs: $$ \begin{aligned} VAx &โ ๐ฝโ \ VPK &โ ๐ฝโ \ Sx &โ ๐ฝโ \ ฯ &โ ๐ฝโ \ T &โ โโโ \ C &โ โโโ \ S &โ โโโ \ E &โ โโโ \ V &โ โโโ \ b\t{VC} &โ ๐ฝโ \ b\t{Coin} &โ ๐ฝโ \end{aligned} $$
Attach a proof $ฯ$ such that the following relations hold:
Proof that start blockwindow is greater than current blockwindow โ $S > tโ$.
Proof that end blockwindow is greater than start blockwindow โ $E > S$.
Proof that total is greater than cliff โ $T >= C$.
Proof that blockwindow value is valid โ $T == (E - S) * V + C$.
Proof of vesting authority public key ownership โ $\t{VAPK} = \t{DerivePubKey}(VAx)$.
Proof of shared secret public key ownership โ $\t{SPK} = \t{DerivePubKey}(Sx)$.
Vesting configuration bulla integrity โ $โฌ = \t{Bulla}\t{VC}(\mathcal{X}(p.\t{VAPK}), \mathcal{Y}(p.\t{VAPK}), \mathcal{X}(p.\t{VPK}), \mathcal{Y}(p.\t{VPK}), \mathcal{X}(p.\t{SPK}), \mathcal{Y}(p.\t{SPK}), t, T, C, S, E, V, b\t{VC})$
Minted vested coin integrity โ $Coin = \t{PoseidonHash}(\mathcal{X}(p.\t{SPK}), \mathcal{Y}(p.\t{SPK}), T, t, \t{CID}\t{V}, \t{SH}\t{V}, โฌ, b_\t{Coin})$
Verifiable vested coin note encryption โ let $๐ง = (c.v, c.ฯ, c.\t{SH}, c.\t{UD}, c.n)$, and verify $a = \t{ElGamal}.\t{Encrypt}(๐ง, \t{esk}, d.\t{SPK})$.
There should be a single signature attached, which uses $\t{SPK}$ as the signature public key.
This function enables the vestee to withdraw the corresponding unlocked
value up to that blockwindow. The child Money::transfer() call must
contain a single input, the vested coin we burn, and two outputs. The
first one being the withdrawed one while the second one is the
remaining vested balance coin. Both coins values are verified by the
vesting configuration rules, and we store the second one as the current
vested coin, to burn in next actions. Additionally, we verify the
second/vested coin is encrypted for the configuration shared secret
key, ensuring both parties have access to it.
TODO: add client pathTODO: add entrypoint pathTODO: add proof pathDefine the withdraw function params $$ \begin{aligned} โฌ\t{VC} &โ \t{im}(\t{Bulla}\t{VC}) \ \t{SPK} &โ โโ \end{aligned} $$
TODO: Add call params path
Vesting configuration bulla existance โ whether $โฌ_\t{VC}$ exists. If no then fail.
Burned vested coin existance โ whether the burned coin $\t{BCoin}$ matches the vesting configuration record one. If no then fail.
Let there be a prover auxiliary witness inputs: $$ \begin{aligned} VAPK &โ ๐ฝโ \ Vx &โ ๐ฝโ \ Sx &โ ๐ฝโ \ ฯ &โ ๐ฝโ \ T &โ โโโ \ C &โ โโโ \ S &โ โโโ \ E &โ โโโ \ V &โ โโโ \ b\t{VC} &โ ๐ฝโ \ Bv &โ โโโ \ b\t{BCoin} &โ ๐ฝโ \ xc &โ ๐ฝโ \ Cv &โ โโโ \ b\t{Coin} &โ ๐ฝโ \end{aligned} $$
Attach a proof $ฯ$ such that the following relations hold:
Proof of vestee public key ownership โ $\t{VPK} = \t{DerivePubKey}(Vx)$.
Proof of shared secret public key ownership โ $\t{SPK} = \t{DerivePubKey}(Sx)$.
Vesting configuration bulla integrity โ $โฌ = \t{Bulla}\t{VC}(\mathcal{X}(p.\t{VAPK}), \mathcal{Y}(p.\t{VAPK}), \mathcal{X}(p.\t{VPK}), \mathcal{Y}(p.\t{VPK}), \mathcal{X}(p.\t{SPK}), \mathcal{Y}(p.\t{SPK}), t, T, C, Cb, S, E, V, b\t{VC})$
Proof that current blockwindow is greater than start blockwindow โ $tโ >= S$.
TODO: cond_select statement to pick current or end blockwindow
Proof of withdraw amount correctness โ $$ \begin{aligned} CurrentBlockwindow = CondSelect(BlockwindowCond, tโ, E); \ BlockwindowsPassed = CurrentBlockwindow - S; \ Available = (BlockwindowsPassed * V) + C; \ Withdrawn = T - Bv; \ WithdrawlCoinValue = Available - Withdrawn; \ VestingChangeValue = T - (Withdrawn + WithdrawlCoinValue); \end{aligned} $$
Verify the child Money::transfer() call correctnes:
Burned vested coin integrity โ $BCoin = \t{PoseidonHash}(\mathcal{X}(p.\t{SPK}), \mathcal{Y}(p.\t{SPK}), Bv, t, \t{CID}\t{V}, \t{SH}\t{V}, โฌ, b_\t{Coin})$
Burned vested coin nullifier integrity โ $\cN = \t{PoseidonHash}(x_c, BCoin)$
Minted vested coin integrity โ $Coin = \t{PoseidonHash}(\mathcal{X}(p.\t{SPK}), \mathcal{Y}(p.\t{SPK}), VestingChangeValue, t, \t{CID}\t{V}, \t{SH}\t{V}, โฌ, b_\t{Coin})$
Verifiable vested coin note encryption โ let $๐ง = (c.v, c.ฯ, c.\t{SH}, c.\t{UD}, c.n)$, and verify $a = \t{ElGamal}.\t{Encrypt}(๐ง, \t{esk}, d.\t{SPK})$.
There should be a single signature attached, which uses $\t{SPK}$ as the signature public key.
This function enables the vesting authority to forfeit a vesting
configuration, withdrawing the rest of vested value. The child
Money::transfer() call must containg a single input, the vested coin
we burn, and a single output, the newlly minted coin. Both coins values
are verified by the vesting configuration rules, and we remove the
vesting configuration bulla $โฌ_\t{VC}$ entry from the set.
TODO: add client pathTODO: add entrypoint pathTODO: add proof pathDefine the vest function params $$ \begin{aligned} โฌ\t{VC} &โ \t{im}(\t{Bulla}\t{VC}) \ \t{SPK} &โ โโ \end{aligned} $$
TODO: Add call params path
Vesting configuration bulla existance โ whether $โฌ_\t{VC}$ exists. If no then fail.
Burned vested coin existance โ whether the burned coin $\t{BCoin}$ matches the vesting configuration record one. If no then fail.
Let there be a prover auxiliary witness inputs: $$ \begin{aligned} VAx &โ ๐ฝโ \ VPK &โ ๐ฝโ \ Sx &โ ๐ฝโ \ ฯ &โ ๐ฝโ \ T &โ โโโ \ C &โ โโโ \ S &โ โโโ \ E &โ โโโ \ V &โ โโโ \ b\t{VC} &โ ๐ฝโ Bv &โ โโโ \ b\t{BCoin} &โ ๐ฝโ \ x_c &โ ๐ฝโ \end{aligned} $$
Attach a proof $ฯ$ such that the following relations hold:
Proof of vesting authority public key ownership โ $\t{VAPK} = \t{DerivePubKey}(VAx)$.
Proof of shared secret public key ownership โ $\t{SPK} = \t{DerivePubKey}(Sx)$.
Vesting configuration bulla integrity โ $โฌ = \t{Bulla}\t{VC}(\mathcal{X}(p.\t{VAPK}), \mathcal{Y}(p.\t{VAPK}), \mathcal{X}(p.\t{VPK}), \mathcal{Y}(p.\t{VPK}), \mathcal{X}(p.\t{SPK}), \mathcal{Y}(p.\t{SPK}), t, T, C, S, E, V, b\t{VC})$
Proof of forfeit amount correctness โ $ForfeitValue = T - Bv$
Verify the child Money::transfer() call correctnes:
Burned vested coin integrity โ $BCoin = \t{PoseidonHash}(\mathcal{X}(p.\t{SPK}), \mathcal{Y}(p.\t{SPK}), ForfeitValue, t, \t{CID}\t{V}, \t{SH}\t{V}, โฌ, b_\t{Coin})$
Burned vested coin nullifier integrity โ $\cN = \t{PoseidonHash}(x_c, BCoin)$
Minted coin integrity โ let $c.\t{CID}, c.\t{SH}, c.\t{UD}$ be the vesting authority chosen Contract ID, spend hook and user data for the minted coin, and verify $Coin = \t{PoseidonHash}(\mathcal{X}(p.\t{VAPK}), \mathcal{Y}(p.\t{VAPK}), ForfeitValue, t, \t{CID}, \t{SH}, \t{UD}, b_\t{Coin})$
There should be a single signature attached, which uses $\t{SPK}$ as the signature public key.