Sword-Smith / Sword

Sword — A financial derivative language for the blockchain
MIT License
29 stars 2 forks source link

Remove superfluous transferCall ID #40

Open Sword-Smith opened 3 years ago

Sword-Smith commented 3 years ago

This TCID value is not needed as all transfer calls are already uniquely identified by their party token (which currently is held in the _to parameter of the intermediate contract). This code removes this ID from the code base. The only non-trivial change is to the expression subtractEvaluatedPTValuesFromSaAmounts where a calculation of the payback streams to the PT0 holder is calculated. This loops over all party token IDs from the max value to 1 and calculates the how much should be paid back to PT0. Previously the condition to check if the loop was done was tcid <= 0; now the condition is ptid == 0, this saves three instructions. This function also necessitated that a subroutine was changed, it previously mapped from map from TCID to SAID but now maps from PTID to SAID.

This addresses #39.

This commit has been successfully tested against the test set in geth_tools.