When calculating the payouts to PT0, we store the intermediate accumulated value in memory. In our attempt to calculate this, we confused TransferCallID with SettlementAssetID meaning that we stored the results the wrong places in memory.
To solve this problem, we must be able to dynamically (in the runtime) map from TransferCallId to SettlementAssetID. I suggest that we make a subroutine for this. This subroutine will be our first contract-dependent subroutine!
To achieve this, we need
[x] Add SettlementAssetID to TransferCall data structure
[x] Make a statically generated subroutine (static to the swordc compiler, dynamic to the Haskell compiler)
[x] Use this new subroutine inside the loop of the payToPartyToken0 function.
When calculating the payouts to PT0, we store the intermediate accumulated value in memory. In our attempt to calculate this, we confused
TransferCallID
withSettlementAssetID
meaning that we stored the results the wrong places in memory.To solve this problem, we must be able to dynamically (in the runtime) map from
TransferCallId
toSettlementAssetID
. I suggest that we make a subroutine for this. This subroutine will be our first contract-dependent subroutine!To achieve this, we need
SettlementAssetID
toTransferCall
data structureswordc
compiler, dynamic to the Haskell compiler)payToPartyToken0
function.