Skip to content

Instantly share code, notes, and snippets.

@e00dan
Created June 24, 2021 21:36
Show Gist options
  • Save e00dan/831df3a5a7e3f169caaec90f5d253374 to your computer and use it in GitHub Desktop.
Save e00dan/831df3a5a7e3f169caaec90f5d253374 to your computer and use it in GitHub Desktop.
➜ blockchain-workshop git:(godwoken) ✗ yarn start
yarn run v1.22.10
$ ts-node src/HeadTail.ts
web3-shh package will be deprecated in version 1.3.5 and will no longer be supported.
web3-bzz package will be deprecated in version 1.3.5 and will no longer be supported.
web3-shh package will be deprecated in version 1.3.5 and will no longer be supported.
web3-bzz package will be deprecated in version 1.3.5 and will no longer be supported.
{
userOneEthAddress: '0xD173313A51f8fc37BcF67569b463abd89d81844f',
choice: true,
secret: 'THIS_IS_SECRET',
betRequiredDeposit: '10 CKB'
}
Deploying contract...
Deployed contract: 0x8777e673A0aE4E0bA5400Fce7a28cF7E3497E469
{
"from_id": "0x4",
"to_id": "0x18",
"args": "0xffffff504f4c5900404b4c00000000000000000000000000000000000000000000000000000000000000000000000000040000003408e470",
"nonce": "0x18"
}
chain id: 3
{
"from_id": "0x4",
"to_id": "0x18",
"args": "0xffffff504f4c5900404b4c0000000000000000000000000000000000000000000000000000000000000000000000000004000000f698da25",
"nonce": "0x18"
}
ERC712 (typed signing) info {
domainSeparatorFromContract: '0x7af2f26d0d08b55cc25f13fbed960e7cc71e86f3a0bf191a3cd5c268d6f89a8b',
domainSeparatorFromJS: '0x7af2f26d0d08b55cc25f13fbed960e7cc71e86f3a0bf191a3cd5c268d6f89a8b'
}
user balances before bet:
1 = 380 CKB
2 = 380 CKB
{
"from_id": "0x4",
"to_id": "0x18",
"args": "0xffffff504f4c5900404b4c0000000000000000000000000000000000000000000000000000000000000000000000000004000000711aa39b",
"nonce": "0x19"
}
deposit user one worked (choice=true), user one Polyjuice address: 0xE5d1d328E2A48568C8A671685B2Ed08190BB5253
{
"from_id": "0x4",
"to_id": "0x18",
"args": "0xffffff504f4c5900404b4c00000000000000000000000000000000000000000000000000000000000000000000000000040000007fb1d0dd",
"nonce": "0x19"
}
deposit user two worked (choice=false), user two Polyjuice address: 0xBEe1AfaaC4aA1e18d0ecFe3Cb5b41A3aC51960B8
{
"from_id": "0x4",
"to_id": "0x18",
"args": "0xffffff504f4c5900404b4c00000000000000000000000000000000000000000000000000000000000000000000000000440100006707494d000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000e544849535f49535f534543524554000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004129a4e661ecd7e52e40e893d96026cc8ac9689681b407157bca9ddfe872dcface4b6d05686d54becad1ed66e9fd0b592a0b6952de324d54bb98df6210abcdcdc01c00000000000000000000000000000000000000000000000000000000000000",
"nonce": "0x19"
}
{
signedChoiceHash: '0x29a4e661ecd7e52e40e893d96026cc8ac9689681b407157bca9ddfe872dcface4b6d05686d54becad1ed66e9fd0b592a0b6952de324d54bb98df6210abcdcdc01c',
addressRecoveredInJS: '0xD173313A51f8fc37BcF67569b463abd89d81844f'
}
Settling the bet...
Bet settled successfully.
user balances after bet:
1 = 390 CKB
2 = 370 CKB
Done in 160.27s.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment