-
Notifications
You must be signed in to change notification settings - Fork 1
Basic Contract Functions
The following spec outlines the core functions required for the bilateral derivative smart contract as originally specified in the TRS whitepaper.
These core contract functions are the basis for the bilateral derivative smart contract. They are the core means by which a contract can be valued, accessed, and secured.
Core Contract Functions:
-
function remargin() external returns (bool success)
Does the following:- Call
calcNPV()
to determine the current contract value; - Move funds between the margin and escrow accounts such that the escrow balance equals the current NPV;
- Call
terminate()
to determine if the contract should be terminated.
- Call
-
function calcNPV() internal returns (bool success)
Recalculates the economic terms of the function. -
function withdraw(address _destination, uint _amount) external returns (bool success)
Allows either the maker or taker to withdraw funds from their respective margin accounts into their public wallet addresses. -
function deposit(address _destination) external returns (bool success);
Transfers incoming funds into the margin account of either the maker or taker. -
function terminate() external returns (bool success)
Does the following:- Call
calcNPV()
to determine the current contract value; - Move funds between the margin and escrow accounts such that the escrow balance equals the current NPV;
- Call
terminate()
to determine if the contract should be terminated.
- Call