{
"id": "ssc-b8923f70-c1f7-497f-961d",
"json": {
"contractName": "account",
"contractAction": "register",
"contractPayload": {}
}
}
You are viewing a single comment's thread from:
{
"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": "YWN0aW9ucy5jcmVhdGVTU0MgPSBmdW5jdGlvbiAocGF5bG9hZCkgewogIGRiLmNyZWF0ZVRhYmxlKCd0b2tlbnMnKTsKICBkYi5jcmVhdGVUYWJsZSgnYmFsYW5jZXMnKTsKfQoKYWN0aW9ucy5jcmVhdGUgPSBmdW5jdGlvbiAocGF5bG9hZCkgewogIGNvbnN0IHsgc3ltYm9sLCBwcmVjaXNpb24sIG1heFN1cHBseSB9ID0gcGF5bG9hZDsKCiAgaWYgKHN5bWJvbCAmJiB0eXBlb2Ygc3ltYm9sID09PSAnc3RyaW5nJwogICAgJiYgKHByZWNpc2lvbiAmJiB0eXBlb2YgcHJlY2lzaW9uID09PSAnbnVtYmVyJyB8fCBwcmVjaXNpb24gPT09IDApCiAgICAmJiBtYXhTdXBwbHkgJiYgdHlwZW9mIG1heFN1cHBseSA9PT0gJ251bWJlcicpIHsKCiAgICBjb25zdCBSZWdleFB1cmVMZXR0ZXJzID0gL15bYS16QS1aXSsk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XR5LCB0b2tlbi5wcmVjaXNpb24sIHRydWUpOwoKICAgIGJhbGFuY2VzLnVwZGF0ZShiYWxhbmNlKTsKICB9Cn0KCmxldCBjYWxjdWxhdGVCYWxhbmNlID0gZnVuY3Rpb24gKGJhbGFuY2UsIHF1YW50aXR5LCBwcmVjaXNpb24sIGFkZCkgewogIGlmIChwcmVjaXNpb24gPT09IDApIHsKICAgIHJldHVybiBhZGQgPyBiYWxhbmNlICsgcXVhbnRpdHkgOiBiYWxhbmNlIC0gcXVhbnRpdHkKICB9CgogIGxldCByYXRlID0gTWF0aC5wb3coMTAsIHByZWNpc2lvbik7CiAgbGV0IHRtcFF0eSA9IHF1YW50aXR5ICogcmF0ZTsKICBsZXQgdG1wQmFsYW5jZSA9IGJhbGFuY2UgKiByYXRlOwoKICByZXR1cm4gYWRkID8gKHRtcEJhbGFuY2UgKyB0bXBRdHkpIC8gcmF0ZSA6ICh0bXBCYWxhbmNlIC0gdG1wUXR5KSAvIHJhdGU7Cn0KCmxldCBjb3VudERlY2ltYWxzID0gZnVuY3Rpb24gKHZhbHVlKSB7CiAgaWYgKE1hdGguZmxvb3IodmFsdWUpID09PSB2YWx1ZSkgcmV0dXJuIDA7CiAgcmV0dXJuIHZhbHVlLnRvU3RyaW5nKCkuc3BsaXQoJy4nKVsxXS5sZW5ndGggfHwgMDsKfQ=="
}
}
}
{
"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
}
}
}
{
"id": "ssc-b8923f70-c1f7-497f-961g",
"json": {
"contractName": "token",
"contractAction": "issue",
"contractPayload": {
"symbol": "PKTC",
"to": "harpagon",
"quantity": 1000
}
}
}
{
"id": "ssc-b8923f70-c1f7-497f-961g",
"json": {
"contractName": "token2",
"contractAction": "create",
"contractPayload": {
"symbol": "PKTC",
"precision": 0,
"maxSupply": 1000000
}
}
}