Settings

Blockchain
Network
Unit
Language
Theme
Sound New Block

Transaction

881232bd26efa332274eb9cb98505f1dfc7119edef95f5e8cf767695940ccf2a
Timestamp (utc)
2020-09-17 16:56:52
Fee Paid
0.00003489 BSV
(
0.00036258 BSV
-
0.00032769 BSV
)
Fee Rate
500.1 sat/KB
Version
1
Confirmations
341,394
Size Stats
6,976 B

4 Outputs

Total Output:
0.00032769 BSV
  • jrunM&{"in":0,"ref":["native://Jig"],"out":["e0ad07d15ca36c58ae988636bae6d5bf5078373068f040ee56e3e5b66c1f7fa3","2db315449d20dcc41488a245517866c441ba2d86488331d61d033a1f479a80ea"],"del":[],"cre":["mge9PJwnAno5Z3pehdqqUF7CEekHmFvfYu","mge9PJwnAno5Z3pehdqqUF7CEekHmFvfYu"],"exec":[{"op":"DEPLOY","data":["class TokenContract extends Jig {\n //\n // with RUN 0.6 preview version \n //\n init(...tokens) {\n this.classname = \"TokenContract: \";\n const function_id = this.classname + \"init(): \";\n this.supply = 0; // The base Token class cannot be created on its own\n\n if (Object.getPrototypeOf(this.constructor) === Jig) {\n throw new Error('Token must be extended');\n } // Case: Mint\n\n\n if (caller === this.constructor) {\n // call from static function of this class\n this._checkAmount(caller.mintAmount);\n\n this.amount = caller.mintAmount;\n return;\n } // Case: Send\n\n\n if (caller && caller.constructor === this.constructor) {\n this._checkAmount(caller.sendAmount);\n\n this.amount = caller.sendAmount;\n this.owner = caller.sendOwner;\n return;\n } // Case: Combine\n\n\n if (!Array.isArray(tokens) || tokens.length < 2) {\n throw new Error('Invalid tokens to combine');\n } // Each token to combine must all be of this type\n\n\n if (tokens.some(token => token.constructor !== this.constructor)) {\n throw new Error('Cannot combine different token classes');\n } // Check for duplicate tokens in the array\n\n\n const countOf = token => tokens.reduce((count, next) => next === token ? count + 1 : count, 0);\n\n if (tokens.some(token => countOf(token) > 1)) throw new Error('Cannot combine duplicate tokens'); // Destroy each token, absorbing it into this one\n\n this.amount = 0;\n tokens.forEach(token => {\n this.amount += token.amount;\n token.destroy();\n }); // Make sure our new amount is within safe range\n\n this._checkAmount(this.amount);\n }\n\n static mint(amount) {\n this.mintAmount = amount;\n const token = new this();\n delete this.mintAmount;\n this.supply += amount;\n return token;\n } // redefining the one from extended Jig class\n\n\n destroy() {\n const function_id = this.classname + \"destroy(): \"; // beware destroy applies to all coins so it doesn't decrease supply because that would require the class's owner access\n // so you should use BURN to burn coins & reduce supply at the same time\n // we could also check in destroy() if the caller is the class owner to reduce supply in that case\n\n if (caller && caller.owner == this.constructor.owner) {\n console.log(function_id + \" caller is the token class' owner\"); // you also need to distinguish between destroy due to combining tokens, which doesn't decrease supply, and destroy done by the user\n\n if (caller instanceof this.constructor) {\n console.log(function_id + \" caller is the user and not combine()\"); // user called destroy(). we are not combining tokens\n // send to burn address, or send issuer a destroy receipt jig, or decrease supply if caller is the class owner\n\n this.constructor.supply -= amount;\n }\n }\n\n super.destroy();\n this.amount = 0;\n }\n\n send(to, amount = this.amount) {\n this._checkAmount(amount);\n\n if (amount > this.amount) {\n throw new Error('Not enough funds');\n }\n\n this.sendAmount = amount;\n this.sendOwner = to;\n const sent = new this.constructor();\n delete this.sendAmount;\n delete this.sendOwner;\n\n if (this.amount === amount) {\n this.destroy();\n } else {\n this.amount -= amount;\n }\n\n return sent;\n }\n\n _checkAmount(amount) {\n if (typeof amount !== 'number') throw new Error('amount is not a number');\n if (!Number.isInteger(amount)) throw new Error('amount must be an integer');\n if (amount <= 0) throw new Error('amount must be positive');\n if (amount > Number.MAX_SAFE_INTEGER) throw new Error('amount too large');\n }\n\n}",{"decimals":8,"deps":{"expect":{"$jig":2},"Jig":{"$jig":0}},"icon":{"emoji":null},"sealed":false,"supply":0,"symbol":null},"function expect(t){let e=!1;const n=t=>{if(\"object\"!=typeof t||!t)return t;try{return JSON.stringify(t)}catch(e){return t.toString()}};function r(r,o,i){if(e?r:!r)throw new Error(i||`expected value${e?\" not\":\"\"} to be ${o} but was ${n(t)}`)}function o(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(\"object\"!=typeof t)return!1;if(null===t||null===e)return!1;if(Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;if(Object.keys(t).length!==Object.keys(e).length)return!1;if(!Object.keys(t).every(n=>o(t[n],e[n])))return!1;if(t instanceof Set){if(t.size!==e.size)return!1;if(!o(Array.from(t.entries()),Array.from(e.entries())))return!1}if(t instanceof Map){if(t.size!==e.size)return!1;if(!o(Array.from(t.entries()),Array.from(e.entries())))return!1}return!0}function i(t,e){if(\"function\"!=typeof t)return!1;if(\"function\"!=typeof e)return!1;for(;t;)if((t=Object.getPrototypeOf(t))===e)return!0;return!1}return{get not(){return e=!e,this},toBe:(e,o)=>r(t===e,\"\"+n(e),o),toEqual:(e,i)=>r(o(t,e),\"equal to \"+n(e),i),toBeInstanceOf:(e,n)=>r(t&&t instanceof e,\"an instance of \"+(e&&e.name),n),toBeDefined:e=>r(void 0!==t,\"defined\",e),toBeNull:e=>r(null===t,\"null\",e),toBeNumber:e=>r(\"number\"==typeof t,\"a number\",e),toBeInteger:e=>r(Number.isInteger(t),\"an integer\",e),toBeLessThan:(e,n)=>r(t<e&&\"number\"==typeof t&&\"number\"==typeof e,\"less than \"+e,n),toBeLessThanOrEqualTo:(e,n)=>r(t<=e&&\"number\"==typeof t&&\"number\"==typeof e,\"less than or equal to \"+e,n),toBeGreaterThan:(e,n)=>r(t>e&&\"number\"==typeof t&&\"number\"==typeof e,\"greater than \"+e,n),toBeGreaterThanOrEqualTo:(e,n)=>r(t>=e&&\"number\"==typeof t&&\"number\"==typeof e,\"greater than or equal to \"+e,n),toBeBoolean:e=>r(\"boolean\"==typeof t,\"a boolean\",e),toBeString:e=>r(\"string\"==typeof t,\"a string\",e),toBeObject:e=>r(t&&\"object\"==typeof t,\"an object\",e),toBeArray:e=>r(Array.isArray(t),\"an array\",e),toBeSet:e=>r(t instanceof Set,\"a set\",e),toBeMap:e=>r(t instanceof Map,\"a map\",e),toBeUint8Array:e=>r(t instanceof Uint8Array,\"a uint8array\",e),toBeClass:e=>r(\"function\"==typeof t&&t.toString().startsWith(\"class\"),\"a class\",e),toBeFunction:e=>r(\"function\"==typeof t&&!t.toString().startsWith(\"class\"),\"a function\",e),toBeJigClass:e=>r(\"function\"==typeof t&&t.toString().startsWith(\"class\")&&i(t,Jig),\"a jig class\",e),toExtendFrom:(e,n)=>r(i(t,e),\"an extension of \"+(e&&e.name),n)}}",{"deps":{"Jig":{"$dup":["1","deps","Jig"]}}}]}]}
    https://whatsonchain.com/tx/881232bd26efa332274eb9cb98505f1dfc7119edef95f5e8cf767695940ccf2a