You are viewing a single comment's thread from:

RE: Test title

in #topic16 years ago (edited)

{
"id": "ssc-b8923f70-c1f7-497f-961d",
"json": {
"contractName": "contract",
"contractAction": "deploy",
"contractPayload": {
"name": "account",
"code": "YWN0aW9ucy5jcmVhdGVTU0MgPSBmdW5jdGlvbiAocGF5bG9hZCkgewogIGRiLmNyZWF0ZVRhYmxlKCdhY2NvdW50cycpOwp9CgovLyByZWdpc3RlciBhbiBhY2NvdW50IGhlbHBzIG90aGVyIGNvbnRyYWN0cyB0byBrbm93IAovLyBpZiBhbiBhY2NvdW50IGV4aXN0cyBvbiB0aGUgU3RlZW0gYmxvY2tjaGFpbgphY3Rpb25zLnJlZ2lzdGVyID0gZnVuY3Rpb24gKHBheWxvYWQpIHsKICBsZXQgYWNjb3VudHMgPSBkYi5nZXRUYWJsZSgnYWNjb3VudHMnKTsKCiAgbGV0IGFjY291bnQgPSBhY2NvdW50cy5maW5kT25lKHsgJ2lkJzogc2VuZGVyIH0pOwoKICBpZiAoYWNjb3VudCA9PT0gbnVsbCkgewogICAgY29uc3QgbmV3QWNjb3VudCA9IHsKICAgICAgJ2lkJzogc2VuZGVyCiAgICB9OwoKICAgIGFjY291bnRzLmluc2VydChuZXdBY2NvdW50KTsKICB9IAp9"
}
}
}

Sort:  

{
"id": "ssc-b8923f70-c1f7-497f-961d",
"json": {
"contractName": "contract",
"contractAction": "deploy",
"contractPayload": {
"name": "token",
"code": "YWN0aW9ucy5jcmVhdGVTU0MgPSBmdW5jdGlvbiAocGF5bG9hZCkgewogICAgICBkYi5jcmVhdGVUYWJsZSgndG9rZW5zJyk7CiAgICAgIGRiLmNyZWF0ZVRhYmxlKCdiYWxhbmNlcycpOwogICAgfQogICAgCiAgICBhY3Rpb25zLmNyZWF0ZSA9IGZ1bmN0aW9uIChwYXlsb2FkKSB7CiAgICAgIGNvbnN0IHsgc3ltYm9sLCBwcmVjaXNpb24sIG1heFN1cHBseSB9ID0gcGF5bG9hZDsKICAgIAogICAgICBpZiAoc3lt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J3N5bWJvbCBhbHJlYWR5IGV4aXN0cycpKSB7IAogICAgICAgICAgICAgIGNvbnN0IG5ld1Rva2VuID0gewogICAgICAgICAgICAgICAgJ2lzc3Vlcic6IHNlbmRlciwKICAgICAgICAgICAgICAgIHN5bWJvbCwKICAgICAgICAgICAgICAgIHByZWNpc2lvbiwKICAgICAgICAgICAgICAgIG1heFN1cHBseSwKICAgICAgICAgICAgICAgICdzdXBwbHknOiAwCiAgICAgICAgICAgICAgfTsKICAgICAgICAgIAogICAgICAgICAgICAgIHRva2Vucy5pbnNlcnQobmV3VG9rZW4pOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICAKICAgIGFjdGlvbnMuaXNzdWUgPSBmdW5jdGlvbiAocGF5bG9hZCkgewogICAgICBjb25zdCB7IHRvLCBzeW1ib2wsIHF1YW50aXR5IH0gPSBwYXlsb2FkOwogICAgCiAgICAgIGlmICh0byAmJiB0eXBlb2YgdG8gPT09ICdzdHJpbmcnCiAgICAgICAgICAmJiBzeW1ib2wgJiYgdHlwZW9mIHN5bWJvbCA9PT0gJ3N0cmluZycKICAgICAgICAgICYmIHF1YW50aXR5ICYmIHR5cGVvZiBxdWFudGl0eSA9PT0gJ251bWJlcicpIHsKICAgICAgICAKICAgICAgICBsZXQgdG9rZW5zID0gZGIuZ2V0VGFibGUoJ3Rva2VucycpOwogICAgICAgIGxldCB0b2tlbiA9IHRva2Vucy5maW5kT25lKHsgc3ltYm9sIH0pOwogICAgCiAgICAgICAgLy8gdGhlIHN5bWJvbCBtdXN0IGV4aXN0CiAgICAgICAgLy8gdGhlIHNlbmRlciBtdXN0IGJlIHRoZSBpc3N1ZXIKICAgICAgICAvLyB0aGVuIHdlIG5lZWQgdG8gY2hlY2sgdGhhdCB0aGUgcXVhbnRpdHkgaXMgY29ycmVjdAogICAgICAgIGlmIChhc3NlcnQodG9rZW4gIT09IG51bGwsICdzeW1ib2wgZG9lcyBub3QgZXhpc3QnKQogICAgICAgICAg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ciwgdG9rZW4sIHF1YW50aXR5KTsKICAgIAogICAgICAgICAgICAgIGlmKHRvICE9PSB0b2tlbi5pc3N1ZXIpIHsKICAgICAgICAgICAgICAgIGFjdGlvbnMudHJhbnNmZXIocGF5bG9hZCk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICAKICAgIGFjdGlvbnMudHJhbnNmZXIgPSBmdW5jdGlvbiAocGF5bG9hZCkgewogICAgICBjb25zdCB7IHRvLCBzeW1ib2wsIHF1YW50aXR5IH0gPSBwYXlsb2FkOwogICAgCiAgICAgIGlmICh0byAmJiB0eXBlb2YgdG8gPT09ICdzdHJpbmcnCiAgICAgICAgICAmJiBzeW1ib2wgJiYgdHlwZW9mIHN5bWJvbCA9PT0gJ3N0cmluZycKICAgICAgICAgICYmIHF1YW50aXR5ICYmIHR5cGVvZiBxdWFudGl0eSA9PT0gJ251bWJlcicpIHsKICAgIAogICAgICAgIGlmIChhc3NlcnQodG8gIT09IHNlbmRlciwgJ2Nhbm5vdCB0cmFuc2ZlciB0byBzZWxmJykpIHsKICAgICAgICAgIGxldCBhY2NvdW50ID0gZGIuZmluZE9uZUluVGFibGUoJ2FjY291bnQnLCAnYWNjb3VudHMnLCB7ICdpZCc6IHRvIH0pOwogICAgCiAgICAgICAgICAvLyB0aGUgYWNjb3VudCBtdXN0IGhhdmUgYmVlbiByZWdpc3RlcmVkIGJlZm9yZQogICAgICAgICAgaWYgKGFzc2VydChhY2NvdW50ICE9PSBudWxsLCAndG8gYWNjb3VudCBkb2VzIG5vdCBleGlzdCcpKSB7CiAgICAgICAgICAgIGxldCB0b2tlbnMgPSBkYi5nZXRUYWJsZSgndG9rZW5zJyk7CiAgICAgICAgICAgIGxldCB0b2tlbiA9IHRva2Vucy5maW5kT25lKHsgc3ltYm9sIH0pOwogICAgCiAgICAgICAgICAgIC8vIHRoZSBzeW1ib2wgbXVzdCBleGlzdAogICAgICAgICAgICAvLyB0aGVuIHdlIG5lZWQgdG8gY2hlY2sgdGhhdCB0aGUgcXVhbnRpdHkgaXMgY29ycmVjdAogICAgICAgICAgICBpZiAoYXNzZXJ0KHRva2VuICE9PSBudWxsLCAnc3ltYm9sIGRvZXMgbm90IGV4aXN0JykKICAgICAgICAgICAgICAgICYmIGFzc2VydChjb3VudERlY2ltYWxzKHF1YW50aXR5KSA8PSB0b2tlbi5wcmVjaXNpb24sICdzeW1ib2wgcHJlY2lzaW9uIG1pc21hdGNoJykKICAgICAgICAgICAgICAgICYmIGFzc2VydChxdWFudGl0eSA+IDAsICdtdXN0IHRyYW5zZmVyIHBvc2l0aXZlIHF1YW50aXR5JykpIHsKICAgICAgICAgICAgICAKICAgICAgICAgICAgICBpZiAoc3ViQmFsYW5jZShzZW5kZXIsIHRva2VuLCBxdWFudGl0eSkpIHsKICAgICAgICAgICAgICAgIGFkZEJhbGFuY2UodG8sIHRva2VuLCBxdWFudGl0eSk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICAKICAgIGxldCBzdWJCYWxhbmNlID0gZnVuY3Rpb24gKGFjY291bnQsIHRva2VuLCBxdWFudGl0eSkgewogICAgICBsZXQgYmFsYW5jZXMgPSBkYi5nZXRUYWJsZSgnYmFsYW5jZXMnKTsKICAgICAgbGV0IGJhbGFuY2UgPSBiYWxhbmNlcy5maW5kT25lKHsgYWNjb3VudCwgJ3N5bWJvbCc6IHRva2VuLnN5bWJvbCB9KTsKICAgICAgZGVidWcoYmFsYW5jZXMuY291bnQoKSkKICAgICAgaWYgKGFzc2VydChiYWxhbmNlICE9PSBudWxsLCAnYmFsYW5jZSBkb2VzIG5vdCBleGlzdCcpICYmCiAgICAgICAgYXNzZXJ0KGJhbGFuY2UuYmFsYW5jZSA+PSBxdWFudGl0eSwgJ292ZXJkcmF3biBiYWxhbmNlJykpIHsKICAgIAogICAgICAgIGJhbGFuY2UuYmFsYW5jZSA9IGN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3Rpb24gKGJhbGFuY2UsIHF1YW50aXR5LCBwcmVjaXNpb24sIGFkZCkgewogICAgICBpZiAocHJlY2lzaW9uID09PSAwKSB7CiAgICAgICAgcmV0dXJuIGFkZCA/IGJhbGFuY2UgKyBxdWFudGl0eSA6IGJhbGFuY2UgLSBxdWFudGl0eSAKICAgICAgfQoKICAgICAgbGV0IHJhdGUgPSBNYXRoLnBvdygxMCwgcHJlY2lzaW9uKTsKICAgICAgbGV0IHRtcFF0eSA9IHF1YW50aXR5ICogcmF0ZTsKICAgICAgbGV0IHRtcEJhbGFuY2U9IGJhbGFuY2UgKiByYXRlOwoKICAgICAgcmV0dXJuIGFkZCA/ICh0bXBCYWxhbmNlICsgdG1wUXR5KSAvIHJhdGUgOiAodG1wQmFsYW5jZSAtIHRtcFF0eSkgLyByYXRlOwogICAgfQogICAgCiAgICBsZXQgY291bnREZWNpbWFscyA9IGZ1bmN0aW9uICh2YWx1ZSkgewogICAgICBpZihNYXRoLmZsb29yKHZhbHVlKSA9PT0gdmFsdWUpIHJldHVybiAwOwogICAgICByZXR1cm4gdmFsdWUudG9TdHJpbmcoKS5zcGxpdCgnLicpWzFdLmxlbmd0aCB8fCAwOyAKICAgIH0="
}
}
}

{
"id": "ssc-b8923f70-c1f7-497f-961d",
"json": {
"contractName": "account2",
"contractAction": "register",
"contractPayload": {}
}
}

{
"id": "ssc-b8923f70-c1f7-497f-961g",
"json": {
"contractName": "contract",
"contractAction": "deploy",
"contractPayload": {
"name": "account",
"code": "YWN0aW9ucy5jcmVhdGVTU0MgPSBmdW5jdGlvbiAocGF5bG9hZCkgewogIGRiLmNyZWF0ZVRhYmxlKCdhY2NvdW50cycpOwp9CgovLyByZWdpc3RlciBhbiBhY2NvdW50IGhlbHBzIG90aGVyIGNvbnRyYWN0cyB0byBrbm93IAovLyBpZiBhbiBhY2NvdW50IGV4aXN0cyBvbiB0aGUgU3RlZW0gYmxvY2tjaGFpbgphY3Rpb25zLnJlZ2lzdGVyID0gZnVuY3Rpb24gKHBheWxvYWQpIHsKICBsZXQgYWNjb3VudHMgPSBkYi5nZXRUYWJsZSgnYWNjb3VudHMnKTsKCiAgbGV0IGFjY291bnQgPSBhY2NvdW50cy5maW5kT25lKHsgJ2lkJzogc2VuZGVyIH0pOwoKICBpZiAoYWNjb3VudCA9PT0gbnVsbCkgewogICAgY29uc3QgbmV3QWNjb3VudCA9IHsKICAgICAgJ2lkJzogc2VuZGVyCiAgICB9OwoKICAgIGFjY291bnRzLmluc2VydChuZXdBY2NvdW50KTsKICB9IAp9"
}
}
}

{
"id": "ssc-b8923f70-c1f7-497f-961g",
"json": {
"contractName": "account",
"contractAction": "register",
"contractPayload": {}
}
}

{
"id": "ssc-b8923f70-c1f7-497f-961d",
"json": {
"contractName": "account",
"contractAction": "register",
"contractPayload": {}
}
}

{
"id": "ssc-b8923f70-c1f7-497f-961d",
"json": {
"contractName": "token",
"contractAction": "create",
"contractPayload": {
"symbol": "PKTC",
"precision": 0,
"maxSupply": 1000000
}
}
}

{
"id": "ssc-b8923f70-c1f7-497f-961d",
"json": {
"contractName": "token",
"contractAction": "issue",
"contractPayload": {
"symbol": "PKTC",
"to": "harpagon",
"quantity": 100
}
}
}

{
"id": "ssc-b8923f70-c1f7-497f-961d",
"json": {
"contractName": "token",
"contractAction": "issue",
"contractPayload": {
"symbol": "PKTC",
"to": "harpagon",
"quantity": 900
}
}
}

{
"id": "ssc-b8923f70-c1f7-497f-961g",
"json": {
"contractName": "contract",
"contractAction": "deploy",
"contractPayload": {
"name": "token",
"code": "YWN0aW9ucy5jcmVhdGVTU0MgPSBmdW5jdGlvbiAocGF5bG9hZCkgewogIGRiLmNyZWF0ZVRhYmxlKCd0b2tlbnMnKTsKICBkYi5jcmVhdGVUYWJsZSgnYmFsYW5jZXMnKTsKfQoKYWN0aW9ucy5jcmVhdGUgPSBmdW5jdGlvbiAocGF5bG9hZCkgewogIGNvbnN0IHsgc3ltYm9sLCBwcmVjaXNpb24sIG1heFN1cHBseSB9ID0g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BpZiAoYmFsYW5jZSA9PT0gbnVsbCkgewogICAgYmFsYW5jZSA9IHsKICAgICAgYWNjb3VudCwKICAgICAgJ3N5bWJvbCc6IHRva2VuLnN5bWJvbCwKICAgICAgJ2JhbGFuY2UnOiBxdWFudGl0eQogICAgfQoKICAgIGJhbGFuY2VzLmluc2VydChiYWxhbmNlKTsKICB9IGVsc2UgewogICAgYmFsYW5jZS5iYWxhbmNlID0gY2FsY3VsYXRlQmFsYW5jZShiYWxhbmNlLmJhbGFuY2UsIHF1YW50aXR5LCB0b2tlbi5wcmVjaXNpb24sIHRydWUpOwoKICAgIGJhbGFuY2VzLnVwZGF0ZShiYWxhbmNlKTsKICB9Cn0KCmxldCBjYWxjdWxhdGVCYWxhbmNlID0gZnVuY3Rpb24gKGJhbGFuY2UsIHF1YW50aXR5LCBwcmVjaXNpb24sIGFkZCkgewogIGlmIChwcmVjaXNpb24gPT09IDApIHsKICAgIHJldHVybiBhZGQgPyBiYWxhbmNlICsgcXVhbnRpdHkgOiBiYWxhbmNlIC0gcXVhbnRpdHkKICB9CgogIGxldCByYXRlID0gTWF0aC5wb3coMTAsIHByZWNpc2lvbik7CiAgbGV0IHRtcFF0eSA9IHF1YW50aXR5ICogcmF0ZTsKICBsZXQgdG1wQmFsYW5jZSA9IGJhbGFuY2UgKiByYXRlOwoKICByZXR1cm4gYWRkID8gKHRtcEJhbGFuY2UgKyB0bXBRdHkpIC8gcmF0ZSA6ICh0bXBCYWxhbmNlIC0gdG1wUXR5KSAvIHJhdGU7Cn0KCmxldCBjb3VudERlY2ltYWxzID0gZnVuY3Rpb24gKHZhbHVlKSB7CiAgaWYgKE1hdGguZmxvb3IodmFsdWUpID09PSB2YWx1ZSkgcmV0dXJuIDA7CiAgcmV0dXJuIHZhbHVlLnRvU3RyaW5nKCkuc3BsaXQoJy4nKVsxXS5sZW5ndGggfHwgMDsKfQ=="
}
}
}

{
"id": "ssc-b8923f70-c1f7-497f-961d-g",
"json": {
"contractName": "token",
"contractAction": "create",
"contractPayload": {
"symbol": "PKTC",
"precision": 0,
"maxSupply": 1000000
}
}
}

{
"id": "ssc-b8923f70-c1f7-497f-961g",
"json": {
"contractName": "token",
"contractAction": "create",
"contractPayload": {
"symbol": "PKTC",
"precision": 0,
"maxSupply": 1000000
}
}
}