Skip to content
This repository has been archived by the owner on Sep 3, 2019. It is now read-only.

Commit

Permalink
Rename to event factory md
Browse files Browse the repository at this point in the history
  • Loading branch information
dwalintukan committed Dec 5, 2017
1 parent d74fd53 commit 6e8ea19
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 86 deletions.
107 changes: 107 additions & 0 deletions docs/bodhi_core/event_factory.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Deployed Contracts

**QTUM Testnet**

* EventFactory: `85d5a6870fb450a255603ba1a34e699f759eacfb`

# Interface (ABI)
<textarea id="eventfactory_abi" class="abi" readonly rows="2">
[{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"topics","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_oracle","type":"address"},{"name":"_name","type":"bytes32[10]"},{"name":"_resultNames","type":"bytes32[10]"},{"name":"_bettingEndBlock","type":"uint256"},{"name":"_resultSettingEndBlock","type":"uint256"}],"name":"createTopic","outputs":[{"name":"topicEvent","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_name","type":"bytes32[10]"},{"name":"_resultNames","type":"bytes32[10]"},{"name":"_bettingEndBlock","type":"uint256"},{"name":"_resultSettingEndBlock","type":"uint256"}],"name":"doesTopicExist","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_addressManager","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_topicAddress","type":"address"},{"indexed":true,"name":"_creator","type":"address"},{"indexed":true,"name":"_oracle","type":"address"},{"indexed":false,"name":"_name","type":"bytes32[10]"},{"indexed":false,"name":"_resultNames","type":"bytes32[10]"},{"indexed":false,"name":"_bettingEndBlock","type":"uint256"},{"indexed":false,"name":"_resultSettingEndBlock","type":"uint256"}],"name":"TopicCreated","type":"event"}]
</textarea>
<button class="btn" data-clipboard-target="#eventfactory_abi">Copy ABI</button>
<span class="copied">Copied!</span>

# Function Signatures

d0613dce: createTopic(address,bytes32[10],bytes32[10],uint256,uint256)
fe782f51: doesTopicExist(bytes32[10],bytes32[10],uint256,uint256)
0f2fbeec: topics(bytes32)

# Event Hashes

event TopicCreated(address indexed _topicAddress, address indexed _creator, address indexed _oracle, bytes32[10] _name, bytes32[10] _resultNames, uint256 _bettingEndBlock, uint256 _resultSettingEndBlock):
b7fa6f4e0c226cf0645f9f983dbc0bb4bb971400b98fae2387487d6d810c9c56

# Creating TopicEvent
1. [Launch QT Wallet](../qtum/qt_wallet.md#launch-qt-wallet)
2. Click on `Smart Contract` tab
3. Click on `SendTo` sub tab
4. Set the [Contract Address](#deployed-contracts) and [Interface (ABI)](#interface-abi)
5. Set the `Function` to `createTopic(d0613dce)`
6. Set the [hash address](../qtum/qt_wallet.md#convert-qtum-address-to-hash) of the CentralizedOracle in `address _oracle` field
7. Set the TopicEvent name broken down by 32 byte blocks converted to hex in the `bytes32[10] _name` fields
8. Set the TopicEvent result names converted to hex in the `bytes32[10] _resultName` fields
9. Set the betting end block in the `uint256 _bettingEndBlock` field
10. Set the result setting end block in the `uint256 _resultSettingEndBlock` field
11. Set the `Gas Limit` to `4000000` (4 million gas just to be safe the transaction goes through, unused gas will be returned to you in the next coinstake transaction)
12. Set the `Sender Address`
13. Click `Send To Contract` button
14. Wait for transaction to get mined
15. Open up the `Debug window`
16. Run the command `gettransactionreceipt (transactionId)`:

[
{
"blockHash": "f2c4cb58f1b5d242fe5cc2f6ab1effeacc0448b5cce8f1ee4942217ac5c68cff",
"blockNumber": 44457,
"transactionHash": "05b35deb4f452bbbc053f0d47d3ec5560a6fc9d8837361a676a8d2dda42c80c7",
"transactionIndex": 2,
"from": "17e7888aa7412a735f336d2f6d784caefabb6fa3",
"to": "85d5a6870fb450a255603ba1a34e699f759eacfb",
"cumulativeGasUsed": 3155253,
"gasUsed": 3155253,
"contractAddress": "85d5a6870fb450a255603ba1a34e699f759eacfb",
"log": [
{
"address": "770106fed472af17ecbb10034b611ca159121782",
"topics": [
"c46e722c8158268af789d6a68206785f8d497869da236f87c2014c1c08fd3dec",
"000000000000000000000000a9716b4c11b5c3e9c76636967a68ccc4c1329622",
"00000000000000000000000017e7888aa7412a735f336d2f6d784caefabb6fa3",
"000000000000000000000000378b20ba8505a6b30b335b8d1bd243132535dfef"
],
"data": "57686f2077696c6c20626520746865206e65787420707265736964656e7420696e20746865203230323020656c656374696f6e3f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005472756d7000000000000000000000000000000000000000000000000000000048696c617279000000000000000000000000000000000000000000000000000054686520526f636b0000000000000000000000000000000000000000000000004b616e79652057657374000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000af0f000000000000000000000000000000000000000000000000000000000000b02f00000000000000000000000000000000000000000000000000000002540be400"
},
{
"address": "85d5a6870fb450a255603ba1a34e699f759eacfb",
"topics": [
"b7fa6f4e0c226cf0645f9f983dbc0bb4bb971400b98fae2387487d6d810c9c56",
"000000000000000000000000378b20ba8505a6b30b335b8d1bd243132535dfef",
"00000000000000000000000017e7888aa7412a735f336d2f6d784caefabb6fa3",
"00000000000000000000000017e7888aa7412a735f336d2f6d784caefabb6fa3"
],
"data": "57686f2077696c6c20626520746865206e65787420707265736964656e7420696e20746865203230323020656c656374696f6e3f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005472756d7000000000000000000000000000000000000000000000000000000048696c617279000000000000000000000000000000000000000000000000000054686520526f636b0000000000000000000000000000000000000000000000004b616e7965205765737400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000af0f000000000000000000000000000000000000000000000000000000000000b02f"
}
]
}
]
# "contractAddress": "85d5a6870fb450a255603ba1a34e699f759eacfb" is EventFactory
# The original contract called.

log event 1: `event CentralizedOracleCreated` in `OracleFactory`

{
"address": "770106fed472af17ecbb10034b611ca159121782",
"topics": [
"c46e722c8158268af789d6a68206785f8d497869da236f87c2014c1c08fd3dec",
"000000000000000000000000a9716b4c11b5c3e9c76636967a68ccc4c1329622",
"00000000000000000000000017e7888aa7412a735f336d2f6d784caefabb6fa3",
"000000000000000000000000378b20ba8505a6b30b335b8d1bd243132535dfef"
],
"data": "57686f2077696c6c20626520746865206e65787420707265736964656e7420696e20746865203230323020656c656374696f6e3f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005472756d7000000000000000000000000000000000000000000000000000000048696c617279000000000000000000000000000000000000000000000000000054686520526f636b0000000000000000000000000000000000000000000000004b616e79652057657374000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000af0f000000000000000000000000000000000000000000000000000000000000b02f00000000000000000000000000000000000000000000000000000002540be400"
}
# "address": "770106fed472af17ecbb10034b611ca159121782" is OracleFactory

log event 2: `event TopicCreated` in `EventFactory`

{
"address": "85d5a6870fb450a255603ba1a34e699f759eacfb",
"topics": [
"b7fa6f4e0c226cf0645f9f983dbc0bb4bb971400b98fae2387487d6d810c9c56",
"000000000000000000000000378b20ba8505a6b30b335b8d1bd243132535dfef",
"00000000000000000000000017e7888aa7412a735f336d2f6d784caefabb6fa3",
"00000000000000000000000017e7888aa7412a735f336d2f6d784caefabb6fa3"
],
"data": "57686f2077696c6c20626520746865206e65787420707265736964656e7420696e20746865203230323020656c656374696f6e3f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005472756d7000000000000000000000000000000000000000000000000000000048696c617279000000000000000000000000000000000000000000000000000054686520526f636b0000000000000000000000000000000000000000000000004b616e7965205765737400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000af0f000000000000000000000000000000000000000000000000000000000000b02f"
}
# "address": "85d5a6870fb450a255603ba1a34e699f759eacfb" is EventFactory
Loading

0 comments on commit 6e8ea19

Please sign in to comment.