Skip to content

Instantly share code, notes, and snippets.

@abdulowork
Created May 7, 2018 12:42
Show Gist options
  • Save abdulowork/17c508bd92c0f167f47564e00ad30e65 to your computer and use it in GitHub Desktop.
Save abdulowork/17c508bd92c0f167f47564e00ad30e65 to your computer and use it in GitHub Desktop.
//: Playground - noun: a place where people can play
import UIKit
@testable import Web3Swift
print(
try Keccak256Bytes(
origin: EthContractCreationBytes(
networkID: BigEndianCompactNumber(
hex: "0x2a"
),
transactionsCount: BigEndianCompactNumber(
hex: "0x15"
),
gasPrice: BigEndianCompactNumber(
hex: "0x04A817C800"
),
gasEstimate: BigEndianCompactNumber(
hex: "0x0F4240"
),
senderKey: EthPrivateKey(
bytes: BytesFromHexString(
hex: "0x1636e10756e62baabddd4364010444205f1216bdb1644ff8f776f6e2982aa9f5"
)
),
weiAmount: BigEndianCompactNumber(
hex: "0x00"
),
contractCall: BytesFromHexString(
hex: "0x60806040523480156200001157600080fd5b5060405162000992380380620009928339810180604052620000379190810190620002b6565b80600090805190602001906200004f92919062000057565b505062000385565b828054828255906000526020600020908101928215620000ab579160200282015b82811115620000aa57825182908051906020019062000099929190620000be565b509160200191906001019062000078565b5b509050620000ba919062000116565b5090565b82805482825590600052602060002090810192821562000103579160200282015b8281111562000102578251829060001916905591602001919060010190620000df565b5b50905062000112919062000147565b5090565b6200014491905b808211156200014057600081816200013691906200016f565b506001016200011d565b5090565b90565b6200016c91905b80821115620001685760008160009055506001016200014e565b5090565b90565b50805460008255906000526020600020908101906200018f919062000147565b50565b600082601f8301121515620001a657600080fd5b8151620001bd620001b78262000329565b620002fb565b9150818183526020840193506020810190508360005b83811015620002075781518601620001ec888262000211565b845260208401935060208301925050600181019050620001d3565b5050505092915050565b600082601f83011215156200022557600080fd5b81516200023c620002368262000352565b620002fb565b915081818352602084019350602081019050838560208402820111156200026257600080fd5b60005b838110156200029657816200027b8882620002a0565b84526020840193506020830192505060018101905062000265565b5050505092915050565b6000620002ae82516200037b565b905092915050565b600060208284031215620002c957600080fd5b600082015167ffffffffffffffff811115620002e457600080fd5b620002f28482850162000192565b91505092915050565b6000604051905081810181811067ffffffffffffffff821117156200031f57600080fd5b8060405250919050565b600067ffffffffffffffff8211156200034157600080fd5b602082029050602081019050919050565b600067ffffffffffffffff8211156200036a57600080fd5b602082029050602081019050919050565b6000819050919050565b6105fd80620003956000396000f30060806040526004361061006c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168062dad317146100715780632424ebe71461009c57806373d4a13a146100d957806381fda31614610104578063da33465514610141575b600080fd5b34801561007d57600080fd5b5061008661017e565b604051610093919061051b565b60405180910390f35b3480156100a857600080fd5b506100c360048036036100be9190810190610315565b61018a565b6040516100d0919061051b565b60405180910390f35b3480156100e557600080fd5b506100ee6101af565b6040516100fb91906104bc565b60405180910390f35b34801561011057600080fd5b5061012b6004803603610126919081019061033e565b610252565b6040516101389190610500565b60405180910390f35b34801561014d57600080fd5b5061016860048036036101639190810190610315565b61028c565b60405161017591906104de565b60405180910390f35b60008080549050905090565b6000808281548110151561019a57fe5b90600052602060002001805490509050919050565b60606000805480602002602001604051908101604052809291908181526020016000905b828210156102495783829060005260206000200180548060200260200160405190810160405280929190818152602001828054801561023557602002820191906000526020600020905b8154600019168152602001906001019080831161021d575b5050505050815260200190600101906101d3565b50505050905090565b6000808381548110151561026257fe5b906000526020600020018281548110151561027957fe5b9060005260206000200154905092915050565b606060008281548110151561029d57fe5b906000526020600020018054806020026020016040519081016040528092919081815260200182805480156102f557602002820191906000526020600020905b815460001916815260200190600101908083116102dd575b50505050509050919050565b600061030d82356105b9565b905092915050565b60006020828403121561032757600080fd5b600061033584828501610301565b91505092915050565b6000806040838503121561035157600080fd5b600061035f85828601610301565b925050602061037085828601610301565b9150509250929050565b60006103858261055d565b8084526020840193508360208202850161039e85610536565b60005b848110156103d75783830388526103b9838351610443565b92506103c48261057e565b91506020880197506001810190506103a1565b508196508694505050505092915050565b60006103f382610573565b80845260208401935061040583610550565b60005b828110156104375761041b86835161049e565b61042482610598565b9150602086019550600181019050610408565b50849250505092915050565b600061044e82610568565b80845260208401935061046083610543565b60005b828110156104925761047686835161049e565b61047f8261058b565b9150602086019550600181019050610463565b50849250505092915050565b6104a7816105a5565b82525050565b6104b6816105af565b82525050565b600060208201905081810360008301526104d6818461037a565b905092915050565b600060208201905081810360008301526104f881846103e8565b905092915050565b6000602082019050610515600083018461049e565b92915050565b600060208201905061053060008301846104ad565b92915050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b6000819050919050565b6000819050919050565b60008190509190505600a265627a7a72305820e4eba7dab74878c23493b48feb97733749dbd3d9a238fbdaee586052f5ab435d6c6578706572696d656e74616cf5003700000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002120000000000000000000000000000000000000000000000000000000000000034000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003780000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000004200000000000000000000000000000000000000000000000000000000000000"
)
)
).value().toHexString()
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment