Smart Contract Design Document
Below session illustrates the detailed logic, structure, pseudocode, and flow diagram of the DeltaDeFi smart contract
Last updated
validator virtual_dex_take_orders(oracle_nft, param_long_token, param_short_token)
Purpose of the validator:
- To validate whether the wallet can Withdraw stake rewards; AND
- To validate whether the wallet can publish delegation certificate
// Validation logic:
Accumulate proceeds supposed send to order creators, check output value to them:
1. Look through all inputs -> if from same address -> get (account_address, change_account_address, receive_value)
2. Merge all results above with same account_address
3. Check each unique account_address, if outputs to trade_account + change_account >= to_receive
return true if the above validations are passed. Otherwise, return false.validator virtual_dex(oracle_nft, take_orders)
// Purpose of the validator:
- To validate whether the wallet can spend of transaction output
// Validation logic:
- Perform the validation based on the specified TakeOrders or CancelOrder redeemer
- For TakeOrder: validate transaction has sufficient signatures
- For CancelOrder: validate if the order value is returned and operation key is signed
return true if either above validation is passed. Otherwise, return false.