Transaction

a2cd5963b32b21d67e32d27ce23216eb03922d2b329856e5cdb3a0489524a9f9
( - )
224,996
2020-10-08 01:33:14
1
5,285 B

3 Outputs

Total Output:
  • jrun b1b605103eM¢{"in":0,"ref":["native://Jig","cab03f284dd7e84231896990a0f421dc3dbb4a6d2c45857370778f40f65e16e8_o2"],"out":["e0b4aafd334db52563ba7c070eb102dd52cb83ea32729811cbcaf912a96d1238"],"del":[],"cre":["mr9zdspVwjQBCsRQ464ct8M2wJgaL7CcaQ"],"exec":[{"op":"DEPLOY","data":["class RevokerContract extends Jig {\r\n\r\n init(){\r\n this.classname = \"RevokerContract: \"\r\n //\r\n this.is_frozen = false\r\n this.is_revoked = false\r\n this.is_backedup = false\r\n\r\n this.revoked_state = \"\"\r\n\r\n this.revoke_count = null\r\n this.new_token_contract = null\r\n }\r\n // if we add the send then we must absolutely send it immediately after creation\r\n // otherwise a hacker of the token contract would be able to send it to himself and take full control\r\n send(to, timestamp) {\r\n const function_id = this.classname+\"send(): \"\r\n //\r\n if(!timestamp) throw function_id+\"timestamp missing: \"+timestamp\r\n this._checkTimestamp(timestamp)\r\n //\r\n this.owner = to // there is already internal run's checks on bitcoin addresses for owner\r\n }\r\n backup(new_token_contract, timestamp){\r\n const function_id = this.classname+\"backup(): \"\r\n //\r\n this._checkContractState()\r\n this._checkNewTokenContract(new_token_contract)\r\n\r\n if(!timestamp) throw function_id+\"timestamp missing: \"+timestamp\r\n this._checkTimestamp(timestamp)\r\n\r\n this.timestamp = timestamp\r\n this.new_token_contract = new_token_contract\r\n this.is_backedup = true\r\n this.revoked_state = \"backed-up\"\r\n }\r\n freeze(timestamp){\r\n const function_id = this.classname+\"freeze(): \"\r\n //\r\n this._checkContractState()\r\n if(this.is_frozen) throw function_id+\"contract is already frozen\" \r\n\r\n if(!timestamp) throw function_id+\"timestamp missing: \"+timestamp\r\n this._checkTimestamp(timestamp)\r\n\r\n // freezes all coins but doesn't give a new contract to exchange to\r\n // useful to end the network and/or reissue tokens on a new protocol after freezing it\r\n this.timestamp = timestamp\r\n this.is_frozen = true\r\n this.revoked_state = \"frozen\"\r\n }\r\n revoke(revoke_count, new_token_contract, timestamp){\r\n const function_id = this.classname+\"revoke(): \"\r\n //\r\n this._checkContractState()\r\n this._checkRevokeCount(revoke_count)\r\n this._checkNewTokenContract(new_token_contract)\r\n\r\n if(!timestamp) throw function_id+\"timestamp missing: \"+timestamp\r\n this._checkTimestamp(timestamp)\r\n\r\n this.timestamp = timestamp\r\n this.revoke_count = revoke_count\r\n this.new_token_contract = new_token_contract\r\n this.is_revoked = true\r\n this.revoked_state = \"revoked\"\r\n }\r\n /*\r\n isUnused(){ // fast way to make sure the revoke contract was never used yet\r\n if(this.is_frozen == false && this.is_revoked == false && this.is_backedup == false) return true\r\n else return false\r\n }\r\n */\r\n _checkContractState(){\r\n const function_id = this.classname+\"_checkContractState(): \"\r\n if(this.is_revoked) throw function_id+\"contract is already revoked\"\r\n if(this.is_backedup) throw function_id+\"contract is already backed up\"\r\n //if(this.is_frozen) throw function_id+\"contract is already frozen\" // don't check freeze so we can backup or revoke after freeze!\r\n }\r\n _checkRevokeCount (revoke_count) { // check positive integer\r\n const function_id = this.classname+\": _checkRevokeCount(): \"\r\n if (typeof revoke_count !== 'number') throw(function_id+'revoke_count is not a number : '+revoke_count) // throw gives better error trace than expect()\r\n if (!(revoke_count > 0)) throw new Error(function_id+'revoke_count must be positive : '+revoke_count)\r\n if (revoke_count > Number.MAX_SAFE_INTEGER) throw new Error(function_id+'revoke_count too large : '+revoke_count)\r\n if (!Number.isInteger(revoke_count)) throw(function_id+'revoke_count must be an integer : '+revoke_count) \r\n }\r\n _checkNewTokenContract(new_token_contract) {\r\n const function_id = this.classname+\": _checkNewTokenContract(): \"\r\n expect(new_token_contract).toBeObject(function_id+': bad new_token_contract type, should be Object, is '+(typeof new_token_contract))\r\n expect(new_token_contract).toBeInstanceOf(Jig, function_id+': bad new_token_contract type, should be instance of Jig')\r\n }\r\n _checkTimestamp (timestamp) {\r\n const function_id = this.classname+\": _checkTimestamp(): \"\r\n if(!timestamp) throw function_id+\"timestamp missing: \"+timestamp\r\n try {\r\n this._checkRevokeCount(timestamp) // applies as well to timestamp: positive integer\r\n } catch(e) { throw(function_id+e) }\r\n if( !(timestamp > 1600939295117) ) throw(function_id+': timestamp must be older than 1600939295117 : '+timestamp) // make sure the timestamp here is in ms!!\r\n }\r\n}",{"deps":{"Jig":{"$jig":0},"expect":{"$jig":1}},"sealed":true}]}]}
    https://whatsonchain.com/tx/a2cd5963b32b21d67e32d27ce23216eb03922d2b329856e5cdb3a0489524a9f9