{
"id": "ssc-b8923f70-c1f7-497f-961g",
"json": {
"contractName": "token2",
"contractAction": "create",
"contractPayload": {
"symbol": "PKTC",
"precision": 0,
"maxSupply": 1000000
}
}
}
You are viewing a single comment's thread from:
{
"id": "ssc-b8923f70-c1f7-497f-961g",
"json": {
"contractName": "token2",
"contractAction": "create",
"contractPayload": {
"symbol": "PKTC",
"precision": 0,
"maxSupply": 1000000
}
}
}
{
"id": "ssc-b8923f70-c1f7-497f-961g",
"json": {
"contractName": "token2",
"contractAction": "issue",
"contractPayload": {
"symbol": "PKTC",
"to": "harpagon",
"quantity": 1000
}
}
}
{
"id": "ssc-b8923f70-c1f7-497f-961h",
"json": {
"contractName": "contract",
"contractAction": "deploy",
"contractPayload": {
"name": "account",
"code": "YWN0aW9ucy5jcmVhdGVTU0MgPSBmdW5jdGlvbiAocGF5bG9hZCkgewogIGRiLmNyZWF0ZVRhYmxlKCdhY2NvdW50cycpOwp9CgovLyByZWdpc3RlciBhbiBhY2NvdW50IGhlbHBzIG90aGVyIGNvbnRyYWN0cyB0byBrbm93IAovLyBpZiBhbiBhY2NvdW50IGV4aXN0cyBvbiB0aGUgU3RlZW0gYmxvY2tjaGFpbgphY3Rpb25zLnJlZ2lzdGVyID0gZnVuY3Rpb24gKHBheWxvYWQpIHsKICBsZXQgYWNjb3VudHMgPSBkYi5nZXRUYWJsZSgnYWNjb3VudHMnKTsKCiAgbGV0IGFjY291bnQgPSBhY2NvdW50cy5maW5kT25lKHsgJ2lkJzogc2VuZGVyIH0pOwoKICBpZiAoYWNjb3VudCA9PT0gbnVsbCkgewogICAgY29uc3QgbmV3QWNjb3VudCA9IHsKICAgICAgJ2lkJzogc2VuZGVyCiAgICB9OwoKICAgIGFjY291bnRzLmluc2VydChuZXdBY2NvdW50KTsKICB9IAp9"
}
}
}
{
"id": "ssc-b8923f70-c1f7-497f-961h",
"json": {
"contractName": "account",
"contractAction": "register",
"contractPayload": {}
}
}
{
"id": "ssc-b8923f70-c1f7-497f-961h",
"json": {
"contractName": "contract",
"contractAction": "deploy",
"contractPayload": {
"name": "token",
"code": "YWN0aW9ucy5jcmVhdGVTU0MgPSBmdW5jdGlvbiAocGF5bG9hZCkgewogIGRiLmNyZWF0ZVRhYmxlKCd0b2tlbnMnKTsKICBkYi5jcmVhdGVUYWJsZSgnYmFsYW5jZXMnKTsKfQoKYWN0aW9ucy5jcmVhdGUgPSBmdW5jdGlvbiAocGF5bG9hZCkgewogIGNvbnN0IHsgc3ltYm9sLCBwcmVjaXNpb24sIG1heFN1cHBseSB9ID0gcGF5bG9hZDsKCiAgaWYgKHN5bWJvbCAmJiB0eXBlb2Ygc3ltYm9sID09PSAnc3RyaW5nJwogICAgJiYgKHByZWNpc2lvbiAmJiB0eXBlb2YgcHJlY2lzaW9uID09PSAnbnVtYmVyJyB8fCBwcmVjaXNpb24gPT09IDApCiAgICAmJiBtYXhTdXBwbHkgJiYgdHlwZW9mIG1heFN1cHBseSA9PT0gJ251bWJlcicpIHsKCiAgICBjb25zdCBSZWdleFB1cmVMZXR0ZXJzID0gL15bYS16QS1aXSskLzsKCiAgICAvLyB0aGUgc3ltYm9sIG11c3QgYmUgbWFkZSBvZiBsZXR0ZXJzIG9ubHkKICAgIC8vIHRoZSBwcmVjaXNpb24gbXVzdCBiZSBiZXR3ZWVuIDAgYW5kIDggYW5kIG11c3QgYmUgYW4gaW50ZWdlcgogICAgLy8gdGhlIG1heCBzdXBwbHkgbXVzdCBiZSBwb3NpdGl2ZQogICAgaWYgKGFzc2VydChSZWdleFB1cmVMZXR0ZXJzLnRlc3Qoc3ltYm9sKSwgJ2ludmFsaWQgc3ltYm9sJykKICAgICAgJiYgYXNzZXJ0KChwcmVjaXNpb24gPj0gMCAmJiBwcmVjaXNpb24gPD0gOCkgJiYgKE51bWJlci5pc0ludGVnZXIocHJlY2lzaW9uKSksICdpbnZhbGlkIHByZWNpc2lvbicpCiAgICAgICYmIGFzc2VydChtYXhTdXBwbHkgPiAwLCAnbWF4U3VwcGx5IG11c3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XVhbnRpdHksIHByZWNpc2lvbiwgYWRkKSB7CiAgaWYgKHByZWNpc2lvbiA9PT0gMCkgewogICAgcmV0dXJuIGFkZCA/IGJhbGFuY2UgKyBxdWFudGl0eSA6IGJhbGFuY2UgLSBxdWFudGl0eQogIH0KCiAgbGV0IHJhdGUgPSBNYXRoLnBvdygxMCwgcHJlY2lzaW9uKTsKICBsZXQgdG1wUXR5ID0gcXVhbnRpdHkgKiByYXRlOwogIGxldCB0bXBCYWxhbmNlID0gYmFsYW5jZSAqIHJhdGU7CgogIHJldHVybiBhZGQgPyAodG1wQmFsYW5jZSArIHRtcFF0eSkgLyByYXRlIDogKHRtcEJhbGFuY2UgLSB0bXBRdHkpIC8gcmF0ZTsKfQoKbGV0IGNvdW50RGVjaW1hbHMgPSBmdW5jdGlvbiAodmFsdWUpIHsKICBpZiAoTWF0aC5mbG9vcih2YWx1ZSkgPT09IHZhbHVlKSByZXR1cm4gMDsKICByZXR1cm4gdmFsdWUudG9TdHJpbmcoKS5zcGxpdCgnLicpWzFdLmxlbmd0aCB8fCAwOwp9"
}
}
}
{
"id": "ssc-b8923f70-c1f7-497f-961h",
"json": {
"contractName": "token",
"contractAction": "create",
"contractPayload": {
"symbol": "PKTC",
"precision": 0,
"maxSupply": 1000000
}
}
}
{
"id": "ssc-b8923f70-c1f7-497f-961h",
"json": {
"contractName": "contract",
"contractAction": "deploy",
"contractPayload": {
"name": "token2",
"code": "YWN0aW9ucy5jcmVhdGVTU0MgPSBmdW5jdGlvbiAocGF5bG9hZCkgewogIGRiLmNyZWF0ZVRhYmxlKCd0b2tlbnMnKTsKICBkYi5jcmVhdGVUYWJsZSgnYmFsYW5jZXMnKTsKfQoKYWN0aW9ucy5jcmVhdGUgPSBmdW5jdGlvbiAocGF5bG9hZCkgewogIGNvbnN0IHsgc3ltYm9sLCBwcmVjaXNpb24sIG1heFN1cHBseSB9ID0gcGF5bG9hZDsKCiAgaWYgKHN5bWJvbCAmJiB0eXBlb2Ygc3ltYm9s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HRtcEJhbGFuY2UgLSB0bXBRdHkpIC8gcmF0ZTsKfQoKbGV0IGNvdW50RGVjaW1hbHMgPSBmdW5jdGlvbiAodmFsdWUpIHsKICBpZiAoTWF0aC5mbG9vcih2YWx1ZSkgPT09IHZhbHVlKSByZXR1cm4gMDsKICByZXR1cm4gdmFsdWUudG9TdHJpbmcoKS5zcGxpdCgnLicpWzFdLmxlbmd0aCB8fCAwOwp9"
}
}
}
{
"id": "ssc-b8923f70-c1f7-497f-961h",
"json": {
"contractName": "token2",
"contractAction": "create",
"contractPayload": {
"symbol": "PKTC",
"precision": 0,
"maxSupply": 1000000
}
}
}