#0
nonstandard
0.00004000 BSV
Q!¿2<T^³\!ð¯aIì?nÖÃícwÃÓ_Q®MX{"__cls":"class PositionSC {\r\n constructor(owners = [], percentage = 0, facilityId = '', fundId = '') {\r\n this._owners = owners;\r\n this.percentage = percentage;\r\n this.facilityId = facilityId;\r\n this.fundId = fundId;\r\n }\r\n\r\n split(newPercentage) {\r\n if (newPercentage < this.percentage) {\r\n this.percentage -= newPercentage;\r\n return new PositionSC(this._owners[0], newPercentage, this.facilityId, this.fundId);\r\n }\r\n throw new Error(`Cannot split current transaction`);\r\n }\r\n\r\n merge(...positions) {\r\n try {\r\n let sendPercentage = this.percentage;\r\n this.setPercentage(0);\r\n for (let i = 0; i < positions.length; i += 1) {\r\n sendPercentage += positions[i].percentage;\r\n positions[i].setPercentage(0);\r\n }\r\n return new PositionSC(this._owners[0], sendPercentage, this.facilityId, this.fundId);\r\n } catch (err) {\r\n throw new Error(`Unable to concat positions`);\r\n }\r\n }\r\n\r\n send(to, fundId, percentage) {\r\n if (this.percentage < percentage) throw new Error(`Insufficient funds`);\r\n this.setPercentage(this.percentage - percentage);\r\n return new PositionSC(to, percentage, this.facilityId, fundId);\r\n }\r\n\r\n setPercentage(percentage) {\r\n this.percentage = percentage;\r\n }\r\n}","__index":{"obj":0},"__func":"constructor","__args":[["03bf323c545eb35c918f21168d98f01daf6149ec3f6ed687c3ed1c637711c3d35f"],123,"01d16778ec1a7339bb25cd217fdffe4b64df1f1979ae1e1bd880fe796acd9902:0","98d7fe082b6ae7f61061778a922cba7ffd3667aae710fb181a107c56b26f5820:0"]}u
https://whatsonchain.com/tx/dbf224ecfd352f4df1f941fc78f6bbe36d753b67bda23feed6ac68add1a2ebee