Steempegged Smart Contract

in #steem-engine5 years ago (edited)

{
"id": "ssc-mainnet1",
"json": {
"contractName": "contract",
"contractAction": "update",
"contractPayload": {
"name": "steempegged",
"params": "",
"code": "LyogZXNsaW50LWRpc2FibGUgbm8tYXdhaXQtaW4tbG9vcCAqLwovKiBnbG9iYWwgYWN0aW9ucywgYXBpICovCgphY3Rpb25zLmNyZWF0ZVNTQyA9IGFzeW5jICgpID0+IHsKICBjb25zdCB0YWJsZUV4aXN0cyA9IGF3YWl0IGFwaS5kYi50YWJsZUV4aXN0cygnd2l0aGRyYXdhbHMnKTsKCiAgaWYgKHRhYmxlRXhpc3RzID09PSBmYWxzZSkgewogICAgYXdhaXQgYXBpLmRiLmNyZWF0ZVRhYmxlKCd3aXRoZHJhd2FscycpOwogIH0KfTsKCmFjdGlvbnMuYnV5ID0gYXN5bmMgKHBheWxvYWQpID0+IHsKICBjb25zdCB7IHJlY2lwaWVudCwgYW1vdW50U1RFRU1TQkQsIGlzU2lnbmVkV2l0aEFjdGl2ZUtleSB9ID0gcGF5bG9hZDsKCiAgaWYgKHJlY2lwaWVudCAhPT0gYXBpLm93bmVyKSByZXR1cm47CgogIGlmIChyZWNpcGllbnQgJiYgYW1vdW50U1RFRU1TQkQgJiYgaXNTaWduZWRXaXRoQWN0aXZlS2V5KSB7CiAgICBjb25zdCByZXMgPSBhbW91bnRTVEVFTVNCRC5zcGxpdCgnICcpOwoKICAgIGNvbnN0IHVuaXQgPSByZXNbMV07CgogICAgLy8gU1RFRU0KICAgIGlmIChhcGkuYXNzZXJ0KHVuaXQgPT09ICdTVEVFTScsICdvbmx5IFNURUVNIGNhbiBiZSB1c2VkJykpIHsKICAgICAgbGV0IHF1YW50aXR5VG9TZW5kID0gcmVzWzBdOwoKICAgICAgLy8gY2FsY3VsYXRlIHRoZSAxJSBmZWUgKHdpdGggYSBtaW4gb2YgMC4wMDEgU1RFRU0pCiAgICAgIGxldCBmZWUgPSBhcGkuQmlnTnVtYmVyKHF1YW50aXR5V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lKCd3aXRoZHJhd2FscycsIHsgaWQ6IGZpbmFsSWQgfSk7CgogICAgaWYgKHdpdGhkcmF3YWwpIHsKICAgICAgYXdhaXQgYXBpLmRiLnJlbW92ZSgnd2l0aGRyYXdhbHMnLCB3aXRoZHJhd2FsKTsKICAgIH0KICB9Cn07Cgpjb25zdCBpbml0aWF0ZVdpdGhkcmF3YWwgPSBhc3luYyAoaWQsIHJlY2lwaWVudCwgcXVhbnRpdHksIG1lbW8pID0+IHsKICBjb25zdCB3aXRoZHJhd2FsID0ge307CgogIHdpdGhkcmF3YWwuaWQgPSBpZDsKICB3aXRoZHJhd2FsLnR5cGUgPSAnU1RFRU0nOwogIHdpdGhkcmF3YWwucmVjaXBpZW50ID0gcmVjaXBpZW50OwogIHdpdGhkcmF3YWwubWVtbyA9IG1lbW87CiAgd2l0aGRyYXdhbC5xdWFudGl0eSA9IHF1YW50aXR5OwoKICBhd2FpdCBhcGkuZGIuaW5zZXJ0KCd3aXRoZHJhd2FscycsIHdpdGhkcmF3YWwpOwp9Owo="
}
}
}

Sort:  

what can I do with the smat contract? What is its use?

What's this?

Steem Smart Contracts is a sidechain powered by Steem, it allows you to perform actions on a decentralized database via the power of Smart Contracts.

Hello, How can I create an intelligent contract with steem-peg ???

This is actually pretty easy, you basically need a Steem account and that's it. To interact with the Smart Contracts you simply post a message on the Steem blockchain (formatted in a specific way), the message will then be catched by the sidechain and processed.

Hello, How can I create an intelligent contract with steem-peg ???

Well well, I didn't expect to fall on a post like this. This is very interesting, I'll make sure to go check it out. I guess its a little bit like remix or tronweb/ide. Truly a shame that I realise that steemit dapps are easier than I thought 🤔. Thanks for sharing this

I mistakenly sent 5 Steem to your account directly from my wallet instead of using 'Deposit' onSteem engine. Can I get a refund please? @steem-peg

I just mistakenly sent 5 Steem directly from my wallet to your account on the Steemitwallet site instead of using the 'Deposit' option on Steem-engine. Can you refund it please? @steem-peg

Good Morning! I mistakenly sent 0.559 steem from my account @ pablo1601 to your steemit wallet when I really wanted to send it to my account on steem-engine.

Can you credit the funds in my account @pablo1601? @steem-peg

What is this? I do not understand what it is about? Could someone explain to me?

I did't receive 15 steem (without fee) withdrawing from steem-engine a few minutes ago. Please check this and let me know.

Congratulations @steem-peg! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 1 year!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Need a refund accidentally sent hive i didn't want to. Can anyone help

please send my 28 hive back i accidentally sent in error. I need it