#0
nonstandard
0.00004000 BSV
Q!øÌç(ú$¶±A-ó¤ùu$á,ßHeñQ®M,{"__cls":"class LendersOfRecordSC {\n constructor(\n owners = [],\n ) {\n this._owners = owners;\n this.updates = [];\n this.lendersOfRecord = []\n }\n \n setLendersOfRecord(fundId, numberOfShares, timestamp=Date.now()) {\n const prev = this.lendersOfRecord.filter(x => x.fundId === fundId);\n const commitmentAmount = numberOfShares;\n if (prev.length !== 0) {\n prev[0].commitmentAmount += commitmentAmount;\n } else {\n this.lendersOfRecord.push({ fundId, status: 'Actual', commitmentAmount, timestamp });\n }\n }\n \n descreaseLendersOfRecord(fundId, numberOfShares) {\n const prev = this.lendersOfRecord.filter(x => x.fundId === fundId);\n const commitmentAmount = numberOfShares;\n if (!!prev && prev[0].commitmentAmount >= numberOfShares) {\n prev[0].commitmentAmount -= commitmentAmount;\n } else {\n throw new Error('Cannot descrease number of shares')\n }\n }\n\n transferPosition(fundFrom, fundTo, numberOfShares, timestamp) {\n this.setLendersOfRecord(fundTo, numberOfShares, timestamp)\n this.descreaseLendersOfRecord(fundFrom, numberOfShares)\n this.addUpdate(fundFrom, fundTo, numberOfShares, timestamp)\n }\n\n addUpdate(fundFrom, fundTo, numberOfShares, timestamp) {\n this.updates.push([fundFrom, fundTo, numberOfShares, timestamp])\n } \n}","__index":{"obj":0},"__func":"constructor","__args":[["02f8cc1e8880e78428fa24b68cb1412df38f0fa4ad80f98a750424e12cdf4865f1"]]}u
https://whatsonchain.com/tx/f943a3ab15a4e6b7a7dbdd3102392fba42f5277e832638e62cbb4ca2efe4bb27