#0
nonstandard
0.00004000 BSV
Q!±4û©^|·N:Ò\êÞ{:î¥)ǯ27ÒAyQ®MS{"__cls":"class LendersOfRecordSC {\n constructor(\n owners = [],\n facilityId,\n ) {\n this._owners = owners;\n this.facilityId = facilityId;\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, 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 decrease 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\n setInitialLender(fundId, numberOfShares, timestamp) {\n this.setLendersOfRecord(fundId, numberOfShares, timestamp)\n this.addUpdate('-', fundId, numberOfShares, timestamp)\n }\n}","__index":{"obj":0},"__func":"constructor","__args":[["02b10c34fba95e7cb74e973ad25ceade7b8b3aee11a50b9b29c71faf3237d24179"],"18e1e331b3e4c5f58facaa8a398b1ddc0ed83c2d1d5ed871d51352dbb49d8099:0"]}u
https://whatsonchain.com/tx/1ce1fcbe30b2bab4837d7efe986753e2ca472b1dad1d1d01959c2fdf85a266d8