The are three main phases in any contract: deposit, settlement, and withdraw.
After a contract is created, the funding period starts. During this period, users can deposit the collateral required for a chosen side, e.g. long or short. The collaterals are deposited in a special escrow account which ensures that the two sides will actually pay what the contract determines at expiry.
Early withdrawal is allowed in case only one side has been funded by the end of the funding period. In that case, after the funding period has ended, the user can claim back his original collateral, and the contract expires worthless.
Instructions
If both sides have been funded, the collaterals deposited become locked for the full duration of the contract, e.g. 1 week. After the duration has passed, the settlement happens.
To settle, the value of the oracle needs to be updated, as well as the collateral value of the counterparties. The settlement records the value of the underlying price(s) at expiration of the contract and, based on the payoff parameters specified during the creation, redistributes the collateral between the two sides.
After settlement, the collateral distribution is set and no more changes can occur.
Instructions
After settlement, the users can go and claim their collateral, which will depend on the original amount deposited, and the settlement result of the trade (profit or loss on the trade). Users can withdraw anytime after the settlement of the contract, knowing that the collateral distribution will not change.
Instructions