Skip to content

Instantly share code, notes, and snippets.

@bgits
Created September 10, 2018 22:04
Show Gist options
  • Save bgits/ab30dc9826492febab3d67e8b72c1632 to your computer and use it in GitHub Desktop.
Save bgits/ab30dc9826492febab3d67e8b72c1632 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Lets import ManticoreEVM and create an instance and import the source code. Note that imports are flattened into one file."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from manticore.ethereum import ManticoreEVM\n",
"\n",
"m = ManticoreEVM()\n",
"m.verbosity(3)\n",
"source = open('UsernameRegistrar_flat.sol').read()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Create the user_account and create the ens_registry using our source"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2018-09-10 17:56:41,787: [91728] m.c.executor:INFO: load state 0\n",
"2018-09-10 17:56:41,993: [91728] m.p.evm:INFO: Found a concrete SHA3 example b'\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00' -> ad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5\n",
"1132955520487750317591237580814923263216852905492\n"
]
}
],
"source": [
"user_account = m.create_account(balance=1000)\n",
"ens_registry = m.solidity_create_contract(\n",
" source, \n",
" owner=user_account,\n",
" contract_name=\"ENSRegistry\"\n",
")\n",
"print(ens_registry.address)\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Deploy TestToken which will be used as a proxy for SNT "
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2018-09-10 17:56:45,304: [91750] m.c.executor:INFO: load state 2\n",
"snt_token 1154020442637612825834106454889215287898575349970\n"
]
}
],
"source": [
"snt_token = m.solidity_create_contract(\n",
" source,\n",
" owner=user_account,\n",
" contract_name=\"TestToken\"\n",
")\n",
"print('snt_token', snt_token.address)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Lets deploy our public resolver which requires the ens_registry as an argument - (hangs here on OSX)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2018-09-10 17:56:52,317: [91772] m.c.executor:INFO: load state 4\n"
]
}
],
"source": [
"public_resolver = m.solidity_create_contract(\n",
" source,\n",
" contract_name=\"PublicResolver\",\n",
" owner=user_account,\n",
" args=[ens_registry]\n",
")\n",
"print(public_resolver)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment