From 0c406fb4a5f66d42c78090350b1450ee6d48a43f Mon Sep 17 00:00:00 2001 From: PatrickAlphaC Date: Sun, 15 Sep 2024 03:09:36 +0000 Subject: [PATCH] deploy: efb8a1ed6e862ae47b3c1a4c32ce0a8578566e44 --- .buildinfo | 4 + .nojekyll | 0 _images/docs-logo.png | Bin 0 -> 12602 bytes _sources/all_moccasin_toml_parameters.rst.txt | 39 + _sources/cli_commands.rst.txt | 8 + _sources/common-errors.rst.txt | 7 + _sources/console.rst.txt | 10 + _sources/dependencies.rst.txt | 103 ++ _sources/index.rst.txt | 36 + _sources/installing-moccasin.rst.txt | 118 +++ _sources/moccasin_toml.rst.txt | 45 + _sources/networks.rst.txt | 37 + _sources/project.rst.txt | 35 + _sources/quickstart.rst.txt | 123 +++ _sources/script.rst.txt | 93 ++ _sources/testing.rst.txt | 33 + _sources/toctree.rst.txt | 41 + _sources/wallet.rst.txt | 86 ++ _static/basic.css | 925 +++++++++++++++++ _static/check-solid.svg | 4 + _static/clipboard.min.js | 7 + _static/copy-button.svg | 5 + _static/copybutton.css | 94 ++ _static/copybutton.js | 248 +++++ _static/copybutton_funcs.js | 73 ++ _static/docs-logo.png | Bin 0 -> 12602 bytes _static/doctools.js | 156 +++ _static/documentation_options.js | 13 + _static/file.png | Bin 0 -> 286 bytes _static/language_data.js | 199 ++++ _static/minus.png | Bin 0 -> 90 bytes _static/plus.png | Bin 0 -> 90 bytes _static/print.css | 42 + _static/pygments.css | 1 + _static/searchtools.js | 620 +++++++++++ _static/shibuya.css | 1 + _static/shibuya.js | 16 + _static/sphinx_highlight.js | 154 +++ all_moccasin_toml_parameters.html | 243 +++++ cli_commands.html | 977 ++++++++++++++++++ common-errors.html | 206 ++++ console.html | 212 ++++ dependencies.html | 285 +++++ genindex.html | 101 ++ index.html | 245 +++++ installing-moccasin.html | 296 ++++++ moccasin_toml.html | 244 +++++ networks.html | 235 +++++ objects.inv | Bin 0 -> 577 bytes project.html | 237 +++++ quickstart.html | 310 ++++++ script.html | 287 +++++ search.html | 125 +++ searchindex.js | 1 + testing.html | 234 +++++ toctree.html | 239 +++++ wallet.html | 283 +++++ 57 files changed, 8136 insertions(+) create mode 100644 .buildinfo create mode 100644 .nojekyll create mode 100644 _images/docs-logo.png create mode 100644 _sources/all_moccasin_toml_parameters.rst.txt create mode 100644 _sources/cli_commands.rst.txt create mode 100644 _sources/common-errors.rst.txt create mode 100644 _sources/console.rst.txt create mode 100644 _sources/dependencies.rst.txt create mode 100644 _sources/index.rst.txt create mode 100644 _sources/installing-moccasin.rst.txt create mode 100644 _sources/moccasin_toml.rst.txt create mode 100644 _sources/networks.rst.txt create mode 100644 _sources/project.rst.txt create mode 100644 _sources/quickstart.rst.txt create mode 100644 _sources/script.rst.txt create mode 100644 _sources/testing.rst.txt create mode 100644 _sources/toctree.rst.txt create mode 100644 _sources/wallet.rst.txt create mode 100644 _static/basic.css create mode 100644 _static/check-solid.svg create mode 100644 _static/clipboard.min.js create mode 100644 _static/copy-button.svg create mode 100644 _static/copybutton.css create mode 100644 _static/copybutton.js create mode 100644 _static/copybutton_funcs.js create mode 100644 _static/docs-logo.png create mode 100644 _static/doctools.js create mode 100644 _static/documentation_options.js create mode 100644 _static/file.png create mode 100644 _static/language_data.js create mode 100644 _static/minus.png create mode 100644 _static/plus.png create mode 100644 _static/print.css create mode 100644 _static/pygments.css create mode 100644 _static/searchtools.js create mode 100644 _static/shibuya.css create mode 100644 _static/shibuya.js create mode 100644 _static/sphinx_highlight.js create mode 100644 all_moccasin_toml_parameters.html create mode 100644 cli_commands.html create mode 100644 common-errors.html create mode 100644 console.html create mode 100644 dependencies.html create mode 100644 genindex.html create mode 100644 index.html create mode 100644 installing-moccasin.html create mode 100644 moccasin_toml.html create mode 100644 networks.html create mode 100644 objects.inv create mode 100644 project.html create mode 100644 quickstart.html create mode 100644 script.html create mode 100644 search.html create mode 100644 searchindex.js create mode 100644 testing.html create mode 100644 toctree.html create mode 100644 wallet.html diff --git a/.buildinfo b/.buildinfo new file mode 100644 index 0000000..1690419 --- /dev/null +++ b/.buildinfo @@ -0,0 +1,4 @@ +# Sphinx build info version 1 +# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. +config: 44002d3c86e6c237a7943c4af682f5c2 +tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/_images/docs-logo.png b/_images/docs-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..e7f96c8749e9325f4f4715dc021f6f6ff9c5db39 GIT binary patch literal 12602 zcmeHubyQXR_AeHKAc&;2o0jedK~fq)8r-lcrP*{Tf|4R2ASfW6lG3F#f&wN;D-h1vn=f3y;_`NsYcyEk*#^4;->$}$a#+>sLbDwZ+P35y^sL$Zw;G9)eQP9P~ zIktiP;Nik2y`Lr`;6L~-Dn{-&I7IEp&#?qfA{rc=lWX>RhFC)lbqOnHM;t&7x1)oTyM(ti+wTz)@H_G`FPqF6#=rj~<%Y45&{a_S`%w5x zn#~T2b&=rZ_44xK@e<^5cC+Q>7Z(@jCcZ+uy(g{ zvvaKN(3s5{#_GwR8!Fmf~UOYtHz zbFlxHTYrD@=cn=h58nBE*uO0CzqxujEY{85@{b*Ga_2$+{=@^>HXb-pUNi>T1HM1) z!QbwZki)qD%fykDT(frl%O|i4$ORX)o4d81kBhZ5o36FHvxl3N^}ind-ye9z%^Hoh z#>fcp2?%lXiF5PwN%8*W(jTWM_4f;k-dI(*L!3`Y%t}a%+e(HqxfpTqwr$NcB*`o~iLysiI-4%+2k(g```-+79hFI<5075vlr!eH!V{`aF1ip8Ho@sCM*qh0smWutlg~LIHY+0I^usd-+xr0zl?!;^e+L;`$s*K$#b){51ugYZ}4^DVZhZCk_%*ZsykH2v^-> z>_q9i$3CN`zL<+rcocFHXaZ{IU@E7@&#&^cjQFr$di>IQVAF0_(=F@gbJN{EZ^!+f z+wy0Sl8}7IA(bE@i6!Fu&maG-J$NMSg_G;MF;BAl>j&HL_zU}MQ8c2OZDC>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- + +This is the most common error you'll run into, and it means you'll need to add an account to your `moccasin.toml`. You can do this by following the :doc:`wallet ` guide. \ No newline at end of file diff --git a/_sources/console.rst.txt b/_sources/console.rst.txt new file mode 100644 index 0000000..f1326e9 --- /dev/null +++ b/_sources/console.rst.txt @@ -0,0 +1,10 @@ +Console +####### + +You can enter a python shell with the `console` command. This will start a python shell with the `moccasin` module loaded, so you can interact with your contracts directly. + +.. code-block:: bash + + mox console + +Press `q` and hit `ENTER` to exit the console. \ No newline at end of file diff --git a/_sources/dependencies.rst.txt b/_sources/dependencies.rst.txt new file mode 100644 index 0000000..605f11c --- /dev/null +++ b/_sources/dependencies.rst.txt @@ -0,0 +1,103 @@ +Dependencies +############ + + +Moccasin allows for working with either: + +- :ref:`Installing from GitHub repositories ` + +- :ref:`Installing Python PyPI packages ` (these are your "normal" pip packages) + + +.. _installing_github_dependencies: + +Installing GitHub Dependencies +============================== + +To install a package from GitHub, you can run the following: + +.. code-block:: bash + + mox install ORG/REPO[@VERSION] + +For example: + +.. code-block:: bash + + # Without a version + mox install pcaversaccio/snekmate + # With a version + mox install pcaversaccio/snekmate@0.1.0 + +This will create an entry in your `moccasin.toml` file that looks like this: + +.. code-block:: toml + + [project] + dependencies = [ + "pcaversaccio/snekmate@0.1.0", + ] + +Which follows the same syntax that `pip` and `uv` to do installs from GitHub repositories. This will also download the GitHub repository into your `lib` folder. + +You can then use these packages in your vyper contracts, for example in an miniaml ERC20 vyper contract: + +.. code-block:: python + + from lib.snekmate.auth import ownable as ow + initializes: ow + + from lib.snekmate.tokens import erc20 + initializes: erc20[ownable := ow] + exports: erc20.__interface__ + + @deploy + @payable + def __init__(): + erc20.__init__("my_token", "MT", 18, "my_token_dapp", "0x02") + ow.__init__() + + +.. _installing_pip_dependencies: + + +Installing pip/PyPI Dependencies +================================ + +Moccasin let's you directly install and work with PyPI packages as you would any other python package. PyPi dependencies in moccasin are by default powered by the `uv `_ tool. In order to use this, you need to have the `uv` tool installed. However, you can change this setting to `pip` in your `moccasin.tom`. + +.. code-block:: toml + + [project] + installer = "pip" # change/add this setting + +As of today, `moccasin` supports: + +- `pip` + +- `uv` + +You can also directly install and work with PyPI packages as you would any other python package. To install a package from PyPI, you can run the following: + +.. code-block:: bash + + mox install PACKAGE + +For example: + +.. code-block:: bash + + mox install snekmate + +.. note:: + + Snekmate is both a `pypi `_ and a GitHub package. + +This will create an entry in your `moccasin.toml` file that looks like this: + +.. code-block:: toml + + [project] + dependencies = [ + "snekmate==0.1.0", + ] diff --git a/_sources/index.rst.txt b/_sources/index.rst.txt new file mode 100644 index 0000000..9781708 --- /dev/null +++ b/_sources/index.rst.txt @@ -0,0 +1,36 @@ +.. image:: _static/docs-logo.png + :width: 140px + :alt: Moccasin logo + :align: center + + +Moccasin +###### + +Moccasin is a fast, pythonic smart contract development framework heavily powered by `titanoboa `_. + + +.. note:: + + This project is under active development. + +How to read the documentation +============================= + +The moccasin documentation is written in a way that assumes you are on a MacOS or Linux-like system. If you are using windows, we recommend you watch the first `10 minutes of this WSL tutorial `_ and work with WSL. WSL stands for "Windows Subsystem for Linux" and it allows you to run a Linux commands on Windows machine. + +Why Moccasin? +=========== + +We think web3 needs the following: + +1. A python smart contract development framework. + a. We need this because python is the 2nd most popular language on earth, and is the number one choice for artificial intelligence and new computer engineers! +2. An easy way to run devops on contracts. + a. Running scripts to interact with contracts needs to be easy in a language that humans can understand. +3. And finally... it needs to be fast! + +Then, we have some fun plans for AI, formal verification, fuzzing, and more in the future of moccasin, so stay tuned! + + +Head over to :doc:`installing moccasin ` to get started. \ No newline at end of file diff --git a/_sources/installing-moccasin.rst.txt b/_sources/installing-moccasin.rst.txt new file mode 100644 index 0000000..80209f1 --- /dev/null +++ b/_sources/installing-moccasin.rst.txt @@ -0,0 +1,118 @@ +.. _install: + +Installing Moccasin +################# + +There are a few things you'll need on your machine before you can install Moccasin. Please install the appropriate tools from the `Prerequisites`_ section. Once you have those, the recommended way to :ref:`install Moccasin is via uv `. + +Prerequisites +============= + +1. Python 3.11 or later + +.. _installation-with-uv: + +Installation with uv +-------------------- + +For those unfamiliar, `uv `_ is a fast python package manager, and that helps us install moccasin into it's own isolated virtual environment, so we don't get any weird dependency conflicts with other python packages. It's similar to `pip` and `pipx` if you've used them before. It even comes with some `pip` compatibility, will tools like `uv pip install`. + +It's highly recommended you understand how `virtual environments `_ work as well. + +The easiest way to install `uv` is: + +.. code-block:: bash + + curl -LsSf https://astral.sh/uv/install.sh | sh + +But you can head over to the `uv installation instructions `_ for more options. If you don't have at least Python 3.11 installed, you'll need to install that first. + +.. code-block:: bash + + uv python install 3.11 + +Then, to install moccasin with `uv`, run: + +.. code-block:: bash + + uv tool install moccasin + +Once installed, to verify that Moccasin is installed, you can run: + +.. code-block:: bash + + mox --version + +And see an output like: + +.. code-block:: bash + + Moccasin CLI v0.1.0 + +.. _installation-with-pipx: + +Installation with pipx +---------------------- + +Pipx is a tool to help you install and run end-user applications written in Python. It's roughly similar to macOS's ``brew``, JavaScript's ``npx``, and Linux's ``apt``. + +``pipx`` installs Moccasin into a virtual environment and makes it available directly from the commandline. Once installed, you will never have to activate a virtual environment prior to using Moccasin. + +``pipx`` does not ship with Python. If you have not used it before you will probably need to install it. + +You can either head over to the `pipx installation instructions `_ or follow along below. + +To install ``pipx``: + +.. code-block:: bash + + python -m pip install --user pipx + python -m pipx ensurepath + +.. note:: + + You may need to restart your terminal after installing `pipx`. + +To install moccasin then with `pipx`: + +.. code-block:: bash + + pipx install moccasin + +Once installed, you can run the following command to verify that Moccasin is installed: + +.. code-block:: bash + + mox --version + +And see an output like: + +.. code-block:: bash + + Moccasin CLI v0.1.0 + +Installation with pip +--------------------- + +You can install with `pip`, and if you do so, it's highly recommended you understand how `virtual environments `_ work. + +To install with `pip`: + +.. code-block:: bash + + pip install moccasin + +From source +----------- + +To install from source, you'll need the `uv tool installed `_. Once installed, you can run: + +.. code-block:: bash + + git clone https://github.com/cyfrin/moccasin + cd moccasin + uv sync + source .venv/bin/activate + uv pip install -e . + +And you will have `mox` in your virtual environment created from the `uv` tool. It's highly recommended you understand how `virtual environments `_ work. diff --git a/_sources/moccasin_toml.rst.txt b/_sources/moccasin_toml.rst.txt new file mode 100644 index 0000000..728c1d2 --- /dev/null +++ b/_sources/moccasin_toml.rst.txt @@ -0,0 +1,45 @@ +moccasin.toml +############## + +The `moccasin.toml` file created is our configuration file. In this file we can have: + +- project and layout settings + +- network settings + +- dependencies settings + +- extra data + +A `moccasin.toml` file can look like this: + +.. code-block:: toml + + [project] + src = "contracts" + + [networks.sepolia] + url = "https://ethereum-sepolia-rpc.publicnode.com" + chain_id = 11155111 + + [extra_data] + my_key = "{$ETHERSCAN_API_KEY}" + + +You can learn more about each of the sections of the `moccasin.toml` file in their respective documentation. + +- `Project `_ +- `Network `_ +- `Dependencies `_ + +You can also see a full example of a `moccasin.toml` in the :doc:`all moccasin toml parameters ` documentation. + +Extra Data +========== + +Extra data is a dictionary of data where you can put whatever you'd like. You can access it from your scripts with: + +.. code-block:: python + + from moccasin import config + print(config.get_config().extra_data["my_key"]) \ No newline at end of file diff --git a/_sources/networks.rst.txt b/_sources/networks.rst.txt new file mode 100644 index 0000000..419ea74 --- /dev/null +++ b/_sources/networks.rst.txt @@ -0,0 +1,37 @@ +Networks +======== + +Networks in `moccasin` are identified in your `moccasin.toml`. The complete list of options you can set for your network can be identified in the example here: + +.. code-block:: toml + + [networks.sepolia] + url = "https://ethereum-sepolia-rpc.publicnode.com" + chain_id = 11155111 + is_fork = false + is_zksync = false + default_account_name = "anvil" + unsafe_password_file = "~/.moccasin/password" + extra_data = { "my_key" = "{$ETHERSCAN_API_KEY}" } + +Let's walk through what each of these options mean. + +- `url`: The URL of the network you are connecting to. +- `chain_id`: The chain ID of the network you are connecting to. +- `is_fork`: If you are forking a network, set this to `true`. +- `is_zksync`: If you are connecting to a zkSync network, set this to `true`. +- `default_account_name`: The default account name to use when deploying contracts. This will be the name of your account you created with your :doc:`wallet ` command. +- `unsafe_password_file`: The location of the password file for your account. This is a file that contains the password for your account. BE SURE TO NEVER PUSH THIS PASSWORD TO GITHUB IF YOU USE THIS. +- extra-data: This is a dictionary of extra data you can use in your contracts. + +You'll notice there is no `private-key`. We highly discourage having private keys in plain text. + +When working with a network from the command line, for example to :doc:`run a script + + + + + + + + + + + + +
+
+
+ + + + moccasin + +
+ +
+
+
+
+
+
+
+ + + + +
+
+
+
+

All moccasin toml parameters

+
# Changes the names and locations of specific directories in your project
+[project]
+src = "contracts"
+out = "build"
+script = "scripts"
+lib = "dependencies"
+# You can have pip-style dependencies and also github-style dependencies
+# These are going to be dependencies for your vyper contracts
+dependencies = ["snekmate==0.1.0", "pcaversaccio/snekmate@0.1.0"]
+installer = "uv"
+
+# Add network settings to easily interact with networks
+[networks.sepolia]
+url = "https://ethereum-sepolia-rpc.publicnode.com"
+chain_id = 11155111
+is_fork = false
+is_zksync = false
+# This is the name of the account that will be unlocked when running on this network
+default_account_name = "anvil"
+# If you don't provide a password or private key, moccasin will prompt you to unlock it
+# If you do, it will unlock it automatically
+# But be careful about storing passwords and private keys! NEVER store them in plain text
+unsafe_password_file = "/home/user/.moccasin/password"  # Replace with actual path
+
+[networks.sepolia.extra_data]
+my_key = "{$ETHERSCAN_API_KEY}"
+
+# It might be a good idea to place addresses in here!
+[networks.mainnet.extra_data]
+usdc = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
+
+# Put whatever else you want in here
+[extra_data]
+hi = "hello"
+
+
+
+ +
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/cli_commands.html b/cli_commands.html new file mode 100644 index 0000000..e75d48f --- /dev/null +++ b/cli_commands.html @@ -0,0 +1,977 @@ + + + + + mox - moccasin documentation + + + + + + + + + + + + +
+
+
+ + + + moccasin + +
+ +
+
+
+
+
+
+
+ + + + +
+
+
+
+

mox

+

🐍 Pythonic Smart Contract Development Framework

+

+
usage: mox [-h] [-d] [-q]
+           {init,compile,build,test,run,script,deploy,wallet,console,install,purge,config,explorer}
+           ...
+
+
+
+

Positional Arguments

+
+
command
+

Possible choices: init, compile, build, test, run, script, deploy, wallet, console, install, purge, config, explorer

+
+
+
+
+

Named Arguments

+
+
-d, --debug
+

Run in debug mode

+

Default: False

+
+
-q, --quiet
+

Suppress all output except errors

+

Default: False

+
+
+
+
+

Sub-commands

+
+

init

+

This will create a basic directory structure at the path you specific, which looks like: +. +├── README.md +├── moccasin.toml +├── script +│ └── deploy.py +├── src +│ └── Counter.vy +└── tests

+
+

├── conftest.py +└── test_counter.py

+
+
mox init [-h] [-d] [-q] [-f] [--vscode] [path]
+
+
+
+

Positional Arguments

+
+
path
+

Path of the new project, defaults to current directory.

+

Default: .

+
+
+
+
+

Named Arguments

+
+
-d, --debug
+

Run in debug mode

+

Default: False

+
+
-q, --quiet
+

Suppress all output except errors

+

Default: False

+
+
-f, --force
+

Overwrite existing project.

+

Default: False

+
+
--vscode
+

Add a .vscode/settings.json file.

+

Default: False

+
+
+
+
+
+

compile (build)

+

Compiles all Vyper contracts in the project.

+

This command will: +1. Find all .vy files in the src/ directory +2. Compile each file using the Vyper compiler +3. Output the compiled artifacts to the out/ directory

+

Use this command to prepare your contracts for deployment or testing.

+
mox compile [-h] [-d] [-q]
+
+
+
+

Named Arguments

+
+
-d, --debug
+

Run in debug mode

+

Default: False

+
+
-q, --quiet
+

Suppress all output except errors

+

Default: False

+
+
+
+
+
+

test

+

Runs pytest with boa context.

+
mox test [-h] [-d] [-q] [--fork] [--network NETWORK | --url URL] [-k [K]]
+         [--coverage COVERAGE] [-m [M]] [-x] [-s] [--capture  [CAPTURE]]
+         [--lf] [--cache-clear] [--disable-warnings] [--full-trace] [--pdb]
+         [file_or_dir]
+
+
+
+

Positional Arguments

+
+
file_or_dir
+

Name of the test or folder to run tests on, or the path to your script.

+
+
+
+
+

Named Arguments

+
+
-d, --debug
+

Run in debug mode

+

Default: False

+
+
-q, --quiet
+

Suppress all output except errors

+

Default: False

+
+
--fork
+

If you want to fork the RPC.

+

Default: False

+
+
--network
+

Alias of the network (from the moccasin.toml).

+
+
--url, --rpc
+

RPC URL to run the script on.

+
+
-k
+
+
Only run tests which match the given substring expression. An expression is a Python evaluable expression where all names are

substring-matched against test names and their parent classes. Example: -k ‘test_method or test_other’ matches all test functions and +classes whose name contains ‘test_method’ or ‘test_other’, while -k ‘not test_method’ matches those that don’t contain ‘test_method’ in +their names. -k ‘not test_method and not test_other’ will eliminate the matches. Additionally keywords are matched to classes and +functions containing extra names in their ‘extra_keyword_matches’ set, as well as functions which have names assigned directly to them. +The matching is case-insensitive.

+
+
+
+
--coverage
+

Run tests with coverage

+
+
-m
+

Only run tests matching given mark expression. For example: -m ‘mark1 and not mark2’.

+
+
-x, --exitfirst
+

Exit instantly on first error or failed test.

+

Default: False

+
+
-s
+

Shortcut for –capture=no

+

Default: False

+
+
--capture
+

Per-test capturing method: one of fd|sys|no|tee-sys

+
+
--lf, --last-failed
+

Rerun only the tests that failed at the last run (or all if none failed).

+

Default: False

+
+
--cache-clear
+

Remove all cache contents at start of test run.

+

Default: False

+
+
--disable-warnings, --disable-pytest-warnings
+

Disable warnings summary.

+

Default: False

+
+
--full-trace
+

Don’t cut any tracebacks (default is to cut)

+

Default: False

+
+
--pdb
+

Start the debugger for each test that fails.

+

Default: False

+
+
+
+
+
+

run (script)

+

Runs a script with the project’s context.

+
mox run [-h] [-d] [-q] [--fork] [--network NETWORK | --url URL]
+        [--account ACCOUNT | --private-key PRIVATE_KEY]
+        [--password PASSWORD | --password-file-path PASSWORD_FILE_PATH]
+        script_name_or_path
+
+
+
+

Positional Arguments

+
+
script_name_or_path
+

Name of the script in the script folder, or the path to your script.

+

Default: './script/deploy.py'

+
+
+
+
+

Named Arguments

+
+
-d, --debug
+

Run in debug mode

+

Default: False

+
+
-q, --quiet
+

Suppress all output except errors

+

Default: False

+
+
--fork
+

If you want to fork the RPC.

+

Default: False

+
+
--network
+

Alias of the network (from the moccasin.toml).

+
+
--url, --rpc
+

RPC URL to run the script on.

+
+
--account
+

Keystore account you want to use.

+
+
--private-key
+

Private key you want to use to get an unlocked account.

+
+
--password
+

Password for the keystore account.

+
+
--password-file-path
+

Path to the file containing the password for the keystore account.

+
+
+
+
+
+

deploy

+

Deploys a contract named in the config with a deploy script.

+
mox deploy [-h] [-d] [-q] [--fork] [--network NETWORK | --url URL]
+           [--account ACCOUNT | --private-key PRIVATE_KEY]
+           [--password PASSWORD | --password-file-path PASSWORD_FILE_PATH]
+           contract_name
+
+
+
+

Positional Arguments

+
+
contract_name
+

Name of contract in your moccasin.toml to deploy.

+
+
+
+
+

Named Arguments

+
+
-d, --debug
+

Run in debug mode

+

Default: False

+
+
-q, --quiet
+

Suppress all output except errors

+

Default: False

+
+
--fork
+

If you want to fork the RPC.

+

Default: False

+
+
--network
+

Alias of the network (from the moccasin.toml).

+
+
--url, --rpc
+

RPC URL to run the script on.

+
+
--account
+

Keystore account you want to use.

+
+
--private-key
+

Private key you want to use to get an unlocked account.

+
+
--password
+

Password for the keystore account.

+
+
--password-file-path
+

Path to the file containing the password for the keystore account.

+
+
+
+
+
+

wallet

+

Wallet management utilities.

+
mox wallet [-h] [-d] [-q]
+           {list,ls,generate,g,new,import,i,add,inspect,decrypt,dk,delete,d}
+           ...
+
+
+
+

Positional Arguments

+
+
wallet_command
+

Possible choices: list, ls, generate, g, new, import, i, add, inspect, decrypt, dk, delete, d

+
+
+
+
+

Named Arguments

+
+
-d, --debug
+

Run in debug mode

+

Default: False

+
+
-q, --quiet
+

Suppress all output except errors

+

Default: False

+
+
+
+
+

Sub-commands

+
+
list (ls)
+

List all the accounts in the keystore default directory

+
mox wallet list [-h]
+
+
+
+
+
generate (g, new)
+

Create a new account with a random private key

+
mox wallet generate [-h] [--save]
+                    [--password PASSWORD | --password-file PASSWORD_FILE]
+                    name
+
+
+
+
Positional Arguments
+
+
name
+

Name of account

+
+
+
+
+
Named Arguments
+
+
--save
+

Save to keystore

+

Default: False

+
+
--password
+

Password for the keystore

+
+
--password-file
+

File containing the password for the keystore

+
+
+
+
+
+
import (i, add)
+

Import a private key into an encrypted keystore

+
mox wallet import [-h] name
+
+
+
+
Positional Arguments
+
+
name
+

Name of account to import

+
+
+
+
+
+
inspect
+

View the JSON of a keystore file

+
mox wallet inspect [-h] keystore_file_name
+
+
+
+
Positional Arguments
+
+
keystore_file_name
+

Name of keystore file

+
+
+
+
+
+
decrypt (dk)
+

Decrypt a keystore file to get the private key

+
mox wallet decrypt [-h]
+                   [--password PASSWORD | --password-file-path PASSWORD_FILE_PATH]
+                   [--print-key]
+                   keystore_file_name
+
+
+
+
Positional Arguments
+
+
keystore_file_name
+

Name of the keystore file to decrypt

+
+
+
+
+
Named Arguments
+
+
--password
+

Password for the keystore account.

+
+
--password-file-path
+

Path to the file containing the password for the keystore account.

+
+
--print-key, -p
+

Print the private key to the console

+

Default: False

+
+
+
+
+
+
delete (d)
+

Delete a keystore file

+
mox wallet delete [-h] keystore_file_name
+
+
+
+
Positional Arguments
+
+
keystore_file_name
+

Name of keystore file

+
+
+
+
+
+
+
+

console

+

BETA, USE AT YOUR OWN RISK: Interact with the network in a python shell.

+
mox console [-h] [-d] [-q] [--fork] [--network NETWORK | --url URL]
+
+
+
+

Named Arguments

+
+
-d, --debug
+

Run in debug mode

+

Default: False

+
+
-q, --quiet
+

Suppress all output except errors

+

Default: False

+
+
--fork
+

If you want to fork the RPC.

+

Default: False

+
+
--network
+

Alias of the network (from the moccasin.toml).

+
+
--url, --rpc
+

RPC URL to run the script on.

+
+
+
+
+
+

install

+

Installs the project’s dependencies. The first argument is the requirements, given as a pip-compatible strings and/or moccasin github formatted dependencies. +- Pip-compatible strings download dependencies as regular python packages from PyPI. +- Moccasin github formatted dependencies download dependencies from the Moccasin github repository.

+

Moccasin github formatted dependencies are formatted as:

+

GITHUB_ORG/GITHUB_REPO@[@VERSION]

+

Where: +- GITHUB_ORG is the github organization or user that owns the repository. +- GITHUB_REPO is the name of the repository. +- VERSION is the optional version of the repository to download. If not provided, the latest version is downloaded.

+

Examples: +- pcaversaccio/snekmate@0.1.0 # Moccasin GitHub formatted dependency +- snekmate==0.1.0 # Pip-compatible string

+
mox install [-h] [-d] [-q] [requirements ...]
+
+
+
+

Positional Arguments

+
+
requirements
+

Requirements, given as a pip-compatible strings and/or moccasin github formatted dependencies.

+
+
+
+
+

Named Arguments

+
+
-d, --debug
+

Run in debug mode

+

Default: False

+
+
-q, --quiet
+

Suppress all output except errors

+

Default: False

+
+
+
+
+
+

purge

+

Purge the given dependency.

+
mox purge [-h] [-d] [-q] packages [packages ...]
+
+
+
+

Positional Arguments

+
+
packages
+

Package name, given as a pip-compatible string and/or moccasin github formatted dependency.

+
+
+
+
+

Named Arguments

+
+
-d, --debug
+

Run in debug mode

+

Default: False

+
+
-q, --quiet
+

Suppress all output except errors

+

Default: False

+
+
+
+
+
+

config

+

View the Moccasin configuration.

+
mox config [-h] [-d] [-q]
+
+
+
+

Named Arguments

+
+
-d, --debug
+

Run in debug mode

+

Default: False

+
+
-q, --quiet
+

Suppress all output except errors

+

Default: False

+
+
+
+
+
+

explorer

+

Work with block explorers to get data.

+
mox explorer [-h] [-d] [-q] {fetch,get,list} ...
+
+
+
+

Positional Arguments

+
+
explorer_command
+

Possible choices: fetch, get, list

+
+
+
+
+

Named Arguments

+
+
-d, --debug
+

Run in debug mode

+

Default: False

+
+
-q, --quiet
+

Suppress all output except errors

+

Default: False

+
+
+
+
+

Sub-commands

+
+
fetch (get)
+

Retreive the ABI of a contract from a block explorer.

+

This command will attempt to use the environment variable ETHERSCAN_API_KEY as the API key for Etherscan. If this environment variable is not set, you can provide the API key as an argument to the command.

+
mox explorer fetch [-h] [-d] [-q] [--name NAME] [--api-key API_KEY]
+                   [--ignore-config] [--save-abi-path SAVE_ABI_PATH] [--save]
+                   [--uri URI | --network NETWORK]
+                   address
+
+
+
+
Positional Arguments
+
+
address
+

The address you want to pull from.

+
+
+
+
+
Named Arguments
+
+
-d, --debug
+

Run in debug mode

+

Default: False

+
+
-q, --quiet
+

Suppress all output except errors

+

Default: False

+
+
--name
+

Optional name for the contract.

+
+
--api-key, --explorer-api-key
+

API key for the block explorer.

+
+
--ignore-config, -i
+

Don’t pull values from the config.

+

Default: False

+
+
--save-abi-path
+

Location to save the returned abi. This will only be applied if you also add the ‘–save’ flag.

+
+
--save
+

If added, the ABI will be saved to the ‘save-abi-path’ given in the command line or config.

+

Default: False

+
+
--uri
+

API URI endpoint for explorer.

+
+
--network
+

Name/alias of the network (from the moccasin.toml). If chain_id is set in the config, you may also use that.

+
+
+
+
+
+
list
+

List all natively supported block explorers and chains.

+
mox explorer list [-h] [--by-id] [--json]
+
+
+
+
Named Arguments
+
+
--by-id
+

List by chain id.

+

Default: False

+
+
--json
+

Format as json.

+

Default: False

+
+
+
+
+
+
+
+
+ +
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/common-errors.html b/common-errors.html new file mode 100644 index 0000000..28a56d1 --- /dev/null +++ b/common-errors.html @@ -0,0 +1,206 @@ + + + + + Common Errors - moccasin documentation + + + + + + + + + + + + +
+
+
+ + + + moccasin + +
+ +
+
+
+
+
+
+
+ + + + +
+
+
+
+

Common Errors

+
+

ValueError: <boa.network.NetworkEnv object at 0xXXXXXXXXX>.eoa not defined!

+

This is the most common error you’ll run into, and it means you’ll need to add an account to your moccasin.toml. You can do this by following the wallet guide.

+
+
+ +
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/console.html b/console.html new file mode 100644 index 0000000..d9d98ff --- /dev/null +++ b/console.html @@ -0,0 +1,212 @@ + + + + + Console - moccasin documentation + + + + + + + + + + + + +
+
+
+ + + + moccasin + +
+ +
+
+
+
+
+
+
+ + + + +
+
+
+
+

Console

+

You can enter a python shell with the console command. This will start a python shell with the moccasin module loaded, so you can interact with your contracts directly.

+
mox console
+
+
+

Press q and hit ENTER to exit the console.

+
+ +
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/dependencies.html b/dependencies.html new file mode 100644 index 0000000..4a4f0b6 --- /dev/null +++ b/dependencies.html @@ -0,0 +1,285 @@ + + + + + Dependencies - moccasin documentation + + + + + + + + + + + + +
+
+
+ + + + moccasin + +
+ +
+
+
+
+
+
+
+ + + + +
+
+
+
+

Dependencies

+

Moccasin allows for working with either:

+ +
+

Installing GitHub Dependencies

+

To install a package from GitHub, you can run the following:

+
mox install ORG/REPO[@VERSION]
+
+
+

For example:

+
# Without a version
+mox install pcaversaccio/snekmate
+# With a version
+mox install pcaversaccio/snekmate@0.1.0
+
+
+

This will create an entry in your moccasin.toml file that looks like this:

+
[project]
+dependencies = [
+    "pcaversaccio/snekmate@0.1.0",
+]
+
+
+

Which follows the same syntax that pip and uv to do installs from GitHub repositories. This will also download the GitHub repository into your lib folder.

+

You can then use these packages in your vyper contracts, for example in an miniaml ERC20 vyper contract:

+
from lib.snekmate.auth import ownable as ow
+initializes: ow
+
+from lib.snekmate.tokens import erc20
+initializes: erc20[ownable := ow]
+exports: erc20.__interface__
+
+@deploy
+@payable
+def __init__():
+    erc20.__init__("my_token", "MT", 18, "my_token_dapp", "0x02")
+    ow.__init__()
+
+
+
+
+

Installing pip/PyPI Dependencies

+

Moccasin let’s you directly install and work with PyPI packages as you would any other python package. PyPi dependencies in moccasin are by default powered by the uv tool. In order to use this, you need to have the uv tool installed. However, you can change this setting to pip in your moccasin.tom.

+
[project]
+installer = "pip" # change/add this setting
+
+
+

As of today, moccasin supports:

+
    +
  • pip

  • +
  • uv

  • +
+

You can also directly install and work with PyPI packages as you would any other python package. To install a package from PyPI, you can run the following:

+
mox install PACKAGE
+
+
+

For example:

+
mox install snekmate
+
+
+
+

Note

+

Snekmate is both a pypi and a GitHub package.

+
+

This will create an entry in your moccasin.toml file that looks like this:

+
[project]
+dependencies = [
+    "snekmate==0.1.0",
+]
+
+
+
+
+ +
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/genindex.html b/genindex.html new file mode 100644 index 0000000..14356d1 --- /dev/null +++ b/genindex.html @@ -0,0 +1,101 @@ + + + + + Index - moccasin documentation + + + + + + + + +
+
+
+ + + + moccasin + +
+ +
+
+
+
+
+
+
+
+ + +

Index

+ +
+ +
+ + +
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..2a043db --- /dev/null +++ b/index.html @@ -0,0 +1,245 @@ + + + + + Moccasin - moccasin documentation + + + + + + + + + + + + +
+
+
+ + + + moccasin + +
+ +
+
+
+
+
+
+
+ + + + +
+
+
+ Moccasin logo + +
+

Moccasin

+

Moccasin is a fast, pythonic smart contract development framework heavily powered by titanoboa.

+
+

Note

+

This project is under active development.

+
+
+

How to read the documentation

+

The moccasin documentation is written in a way that assumes you are on a MacOS or Linux-like system. If you are using windows, we recommend you watch the first 10 minutes of this WSL tutorial and work with WSL. WSL stands for “Windows Subsystem for Linux” and it allows you to run a Linux commands on Windows machine.

+
+
+

Why Moccasin?

+

We think web3 needs the following:

+
    +
  1. +
    A python smart contract development framework.
      +
    1. We need this because python is the 2nd most popular language on earth, and is the number one choice for artificial intelligence and new computer engineers!

    2. +
    +
    +
    +
  2. +
  3. +
    An easy way to run devops on contracts.
      +
    1. Running scripts to interact with contracts needs to be easy in a language that humans can understand.

    2. +
    +
    +
    +
  4. +
  5. And finally… it needs to be fast!

  6. +
+

Then, we have some fun plans for AI, formal verification, fuzzing, and more in the future of moccasin, so stay tuned!

+

Head over to installing moccasin to get started.

+
+
+ +
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/installing-moccasin.html b/installing-moccasin.html new file mode 100644 index 0000000..c0bff99 --- /dev/null +++ b/installing-moccasin.html @@ -0,0 +1,296 @@ + + + + + Installing Moccasin - moccasin documentation + + + + + + + + + + + + +
+
+
+ + + + moccasin + +
+ +
+
+
+
+
+
+
+ + + + +
+
+
+
+

Installing Moccasin

+

There are a few things you’ll need on your machine before you can install Moccasin. Please install the appropriate tools from the Prerequisites section. Once you have those, the recommended way to install Moccasin is via uv.

+
+

Prerequisites

+
    +
  1. Python 3.11 or later

  2. +
+
+

Installation with uv

+

For those unfamiliar, uv is a fast python package manager, and that helps us install moccasin into it’s own isolated virtual environment, so we don’t get any weird dependency conflicts with other python packages. It’s similar to pip and pipx if you’ve used them before. It even comes with some pip compatibility, will tools like uv pip install.

+

It’s highly recommended you understand how virtual environments work as well.

+

The easiest way to install uv is:

+
curl -LsSf https://astral.sh/uv/install.sh | sh
+
+
+

But you can head over to the uv installation instructions for more options. If you don’t have at least Python 3.11 installed, you’ll need to install that first.

+
uv python install 3.11
+
+
+

Then, to install moccasin with uv, run:

+
uv tool install moccasin
+
+
+

Once installed, to verify that Moccasin is installed, you can run:

+
mox --version
+
+
+

And see an output like:

+
Moccasin CLI v0.1.0
+
+
+
+
+

Installation with pipx

+

Pipx is a tool to help you install and run end-user applications written in Python. It’s roughly similar to macOS’s brew, JavaScript’s npx, and Linux’s apt.

+

pipx installs Moccasin into a virtual environment and makes it available directly from the commandline. Once installed, you will never have to activate a virtual environment prior to using Moccasin.

+

pipx does not ship with Python. If you have not used it before you will probably need to install it.

+

You can either head over to the pipx installation instructions or follow along below.

+

To install pipx:

+
python -m pip install --user pipx
+python -m pipx ensurepath
+
+
+
+

Note

+

You may need to restart your terminal after installing pipx.

+
+

To install moccasin then with pipx:

+
pipx install moccasin
+
+
+

Once installed, you can run the following command to verify that Moccasin is installed:

+
mox --version
+
+
+

And see an output like:

+
Moccasin CLI v0.1.0
+
+
+
+
+

Installation with pip

+

You can install with pip, and if you do so, it’s highly recommended you understand how virtual environments work.

+

To install with pip:

+
pip install moccasin
+
+
+
+
+

From source

+

To install from source, you’ll need the uv tool installed. Once installed, you can run:

+
git clone https://github.com/cyfrin/moccasin
+cd moccasin
+uv sync
+source .venv/bin/activate
+uv pip install -e .
+
+
+

And you will have mox in your virtual environment created from the uv tool. It’s highly recommended you understand how virtual environments work.

+
+
+
+ +
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/moccasin_toml.html b/moccasin_toml.html new file mode 100644 index 0000000..6e71d4c --- /dev/null +++ b/moccasin_toml.html @@ -0,0 +1,244 @@ + + + + + moccasin.toml - moccasin documentation + + + + + + + + + + + + +
+
+
+ + + + moccasin + +
+ +
+
+
+
+
+
+
+ + + + +
+
+
+
+

moccasin.toml

+

The moccasin.toml file created is our configuration file. In this file we can have:

+
    +
  • project and layout settings

  • +
  • network settings

  • +
  • dependencies settings

  • +
  • extra data

  • +
+

A moccasin.toml file can look like this:

+
[project]
+src = "contracts"
+
+[networks.sepolia]
+url = "https://ethereum-sepolia-rpc.publicnode.com"
+chain_id = 11155111
+
+[extra_data]
+my_key = "{$ETHERSCAN_API_KEY}"
+
+
+

You can learn more about each of the sections of the moccasin.toml file in their respective documentation.

+ +

You can also see a full example of a moccasin.toml in the all moccasin toml parameters documentation.

+
+

Extra Data

+

Extra data is a dictionary of data where you can put whatever you’d like. You can access it from your scripts with:

+
from moccasin import config
+print(config.get_config().extra_data["my_key"])
+
+
+
+
+ +
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/networks.html b/networks.html new file mode 100644 index 0000000..a99239a --- /dev/null +++ b/networks.html @@ -0,0 +1,235 @@ + + + + + Networks - moccasin documentation + + + + + + + + + + + + +
+
+
+ + + + moccasin + +
+ +
+
+
+
+
+
+
+ + + + +
+
+
+
+

Networks

+

Networks in moccasin are identified in your moccasin.toml. The complete list of options you can set for your network can be identified in the example here:

+
[networks.sepolia]
+url = "https://ethereum-sepolia-rpc.publicnode.com"
+chain_id = 11155111
+is_fork = false
+is_zksync = false
+default_account_name = "anvil"
+unsafe_password_file = "~/.moccasin/password"
+extra_data = { "my_key" = "{$ETHERSCAN_API_KEY}" }
+
+
+

Let’s walk through what each of these options mean.

+
    +
  • url: The URL of the network you are connecting to.

  • +
  • chain_id: The chain ID of the network you are connecting to.

  • +
  • is_fork: If you are forking a network, set this to true.

  • +
  • is_zksync: If you are connecting to a zkSync network, set this to true.

  • +
  • default_account_name: The default account name to use when deploying contracts. This will be the name of your account you created with your wallet command.

  • +
  • unsafe_password_file: The location of the password file for your account. This is a file that contains the password for your account. BE SURE TO NEVER PUSH THIS PASSWORD TO GITHUB IF YOU USE THIS.

  • +
  • extra-data: This is a dictionary of extra data you can use in your contracts.

  • +
+

You’ll notice there is no private-key. We highly discourage having private keys in plain text.

+

When working with a network from the command line, for example to run a script you can pass the –network flag via the command line, and it will load the data from the network in your moccasin.toml.

+

For example, if you wanted to run a script on the sepolia network, you would run:

+
moccasin run my_script --network sepolia
+
+
+

Since in our example we passed both a default_account_name and a unsafe_password_file, moccasin will automatically unlock the account for you. If you don’t pass a default_account_name or a unsafe_password_file, moccasin will error saying it cannot find your account.

+
+ +
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/objects.inv b/objects.inv new file mode 100644 index 0000000000000000000000000000000000000000..a3d8f5ab6b44d4d21e3f13b9c0f69e4851249cf5 GIT binary patch literal 577 zcmV-H0>1qtAX9K?X>NERX>N99Zgg*Qc_4OWa&u{KZXhxWBOp+6Z)#;@bUGkyZ)0O& zb7^i0BOq2~a&u{KZaN@MZ)0O&b7^iMLrh5^b}%k7E-(rsAXI2&AaZ4GVQFq;WpW^I zW*~HEX>%ZEX>4U6X>%ZBZ*6dLWpi_7WFU2OX>MmAdTeQ8E(&bkc(OOv;a$(3LLuhL{?T10Rp4rwo*$jRs7R0*- zLh$?)tU&xv36ggSLZzF$1+Ga@VW*AgVFcHM(*{^Tjg#WGLc|)J!Obp7tXhFxL!!3b$*$g^bt#>BsA#Y;TN5|UXvW?DS|+(%RjpYd7t_edM|9@ztGUh4O}S2NwvH{e__&_f093sqANbIW)cw;?{>J_BIMe^sjj* z#^8T}jx{qwL~L{Yv)cPPiYoUX2Wt0mg9F6Q^?Nq@2|E>7-Vr6`x5NHaa7a6m;M7*4 zNe45s1VYIDds^d7i3wED8*WTkW>URXYY-8pMN^w*h`2v!Bcj(a0Q-Yw=;Y_I#c=_4 PNJ5DAGp)rR76vCGvD^s% literal 0 HcmV?d00001 diff --git a/project.html b/project.html new file mode 100644 index 0000000..5de5a42 --- /dev/null +++ b/project.html @@ -0,0 +1,237 @@ + + + + + Project Layout - moccasin documentation + + + + + + + + + + + + +
+
+
+ + + + moccasin + +
+ +
+
+
+
+
+
+
+ + + + +
+
+
+
+

Project Layout

+

A typical moccasin project is structured as follows:

+
.
+├── README.md
+├── moccasin.toml
+├── script/
+├── src/
+├── tests/
+└── out/
+
+
+

Where:

+
    +
  • README.md is a markdown file that you can use to describe your project.

  • +
  • moccasin.toml is a configuration file that moccasin uses to manage the project.

  • +
  • script is a directory that contains python scripts that you can use to deploy your project.

  • +
  • src is a directory that contains your vyper smart contracts.

  • +
  • tests is a directory that contains your tests.

  • +
  • out is an optional directory that contains the compiled contracts. In moccasin and titanoboa, contracts are compiled on the fly!

  • +
+
+

Changing your layout

+

If you wanted to adjust your contracts location, for example, have your smart contracts folder be named contracts instead of src, you’d update your moccasin.toml file to reflect this change:

+
[project]
+src = "contracts"
+
+
+
+
+ +
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/quickstart.html b/quickstart.html new file mode 100644 index 0000000..f18ef5e --- /dev/null +++ b/quickstart.html @@ -0,0 +1,310 @@ + + + + + Quickstart - moccasin documentation + + + + + + + + + + + + +
+
+
+ + + + moccasin + +
+ +
+
+
+
+
+
+
+ + + + +
+
+
+
+

Quickstart

+
+

Creating a new project

+

To create a new project, you can run the following command:

+
mox init my_project
+
+
+

And this will create a new project in a new my_project directory. If you want to create a project in a directory that already has files/folders in it, run:

+
mox init my_project --force
+
+
+

Let’s check out the files and folders moccasin has created:

+
+

Note

+

MacOS users may need to install tree with brew install tree.

+
+

Run the following commands:

+
cd my_project
+tree .
+
+
+

You’ll get an output like:

+
.
+├── README.md
+├── moccasin.toml
+├── script
+│   ├── __init__.py
+│   └── deploy.py
+├── src
+│   └── Counter.vy
+└── tests
+    ├── conftest.py
+    └── test_counter.py
+
+
+

This is a minimal project structure that moccasin creates.

+
    +
  • README.md is a markdown file that you can use to describe your project.

  • +
  • moccasin.toml is a configuration file that moccasin uses to manage the project.

  • +
  • script is a directory that contains scripts that you can use to deploy your project.

  • +
  • src is a directory that contains your vyper smart contracts.

  • +
  • tests is a directory that contains your tests.

  • +
+
+
+

Deploying a contract

+

Now, unlike other frameworks, with moccasin, we never need to compile! Moccasin uses titanoboa under the hood to compile contracts quickly on the fly. Let’s open our deploy.py file and look inside.

+
from src import Counter
+
+def deploy():
+    counter = Counter.deploy()
+    print("Starting count: ", counter.number())
+    counter.increment()
+    print("Ending count: ", counter.number())
+    return counter
+
+def moccasin_main():
+    return deploy()
+
+
+

We can see a python script that will:

+
    +
  1. Deploy our Counter contract.

  2. +
  3. Print the starting count inside the contract.

  4. +
  5. Increment the count.

  6. +
  7. Print the ending count inside the contract.

  8. +
+

We can run this script to the titanoboa pyevm (a local network that simulates ethereum) by running:

+
mox run deploy
+
+
+

And we’ll get an output like:

+
Running run command...
+Starting count:  0
+Ending count:  1
+
+
+

Awesome! This is how easy it is to run scripts with your smart contracts.

+
+
+

Running tests

+

Under the hood, moccasin uses pytest, and you can use a lot of your favorite pytest command line commands. If you just run:

+
mox test
+
+
+

You’ll get an output like:

+
Running test command...
+=================================== test session starts ===================================
+platform darwin -- Python 3.11.9, pytest-8.3.2, pluggy-1.5.0
+rootdir: /your/path/my_project
+plugins: cov-5.0.0, hypothesis-6.108.5, titanoboa-0.2.1
+collected 1 item
+
+tests/test_counter.py .                                                             [100%]
+
+==================================== 1 passed in 0.01s ====================================
+
+
+
+
+ +
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/script.html b/script.html new file mode 100644 index 0000000..8afa973 --- /dev/null +++ b/script.html @@ -0,0 +1,287 @@ + + + + + Scripting - moccasin documentation + + + + + + + + + + + + +
+
+
+ + + + moccasin + +
+ +
+
+
+
+
+
+
+ + + + +
+
+
+
+

Scripting

+

Scripts are ways to deploy and work with contracts. You can either reference them by path or by name. For example, if your directory looks like this:

+
.
+├── README.md
+├── moccasin.toml
+├── script
+   └── deploy.py
+├── src
+   └── Counter.vy
+└── tests
+    ├── conftest.py
+    └── test_counter.py
+
+
+

You can run the deploy.py script with either:

+
mox run deploy
+
+
+

or

+
mox run ./script/deploy.py
+
+
+
+

Importing from src

+

You can directly import contracts from the src folder into your scripts, and interact with them! Let’s say you have a Counter contract in your src folder:

+
from src import Counter
+
+def deploy():
+    counter = Counter.deploy()
+    print("Starting count: ", counter.number())
+    counter.increment()
+    print("Ending count: ", counter.number())
+    return counter
+
+deploy()
+
+
+
+
+

Networking

+

If you have networks defined in your moccasin.toml, you can directly work with the network in your scripts. For example, if you have a sepolia network defined in your moccasin.toml:

+
mox run deploy --network sepolia
+
+
+
+
+

moccasin_main

+

In your scripts, the moccasin_main function is special, if you have a function with this name in your script, moccasin will run this function by default after running the script like a regular python file. For example, you could also do this:

+
from src import Counter
+
+def deploy():
+    counter = Counter.deploy()
+    print("Starting count: ", counter.number())
+    counter.increment()
+    print("Ending count: ", counter.number())
+    return counter
+
+deploy()
+
+
+

And it would do the same as the following.

+
from src import Counter
+
+def deploy():
+    counter = Counter.deploy()
+    print("Starting count: ", counter.number())
+    counter.increment()
+    print("Ending count: ", counter.number())
+    return counter
+
+def moccasin_main():
+    deploy()
+
+
+

You can see a list of arguments in the moccasin reference documentation that you can run with your scripts.

+
+
+ +
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/search.html b/search.html new file mode 100644 index 0000000..bbae07d --- /dev/null +++ b/search.html @@ -0,0 +1,125 @@ + + + + + Search - moccasin documentation + + + + + + + + + + + + +
+
+
+ + + + moccasin + +
+ + +
+
+
+
+
+
+
+ +

Search

+ + + + +

+ Searching for multiple words only shows matches that contain + all words. +

+ + +
+ + +
+

+ + +
+ + +
+ +
+
+ + + + + + + + + + \ No newline at end of file diff --git a/searchindex.js b/searchindex.js new file mode 100644 index 0000000..9ecd505 --- /dev/null +++ b/searchindex.js @@ -0,0 +1 @@ +Search.setIndex({"alltitles": {"All moccasin toml parameters": [[0, null]], "Changing your layout": [[9, "changing-your-layout"]], "Common Errors": [[2, null]], "Console": [[3, null]], "Creating a new project": [[10, "creating-a-new-project"]], "Dependencies": [[4, null]], "Deploying a contract": [[10, "deploying-a-contract"]], "Encrypting a private key": [[14, "encrypting-a-private-key"]], "Extra Data": [[7, "extra-data"]], "From source": [[6, "from-source"]], "Getting Started": [[13, null]], "How to read the documentation": [[5, "how-to-read-the-documentation"]], "Importing from src": [[11, "importing-from-src"]], "Installation with pip": [[6, "installation-with-pip"]], "Installation with pipx": [[6, "installation-with-pipx"]], "Installation with uv": [[6, "installation-with-uv"]], "Installing GitHub Dependencies": [[4, "installing-github-dependencies"]], "Installing Moccasin": [[6, null]], "Installing pip/PyPI Dependencies": [[4, "installing-pip-pypi-dependencies"]], "Major Commands": [[13, null]], "Moccasin": [[5, null], [13, null]], "Named Arguments": [[1, "moccasin_wrapper_for_docs-get_main_parser-named-arguments"], [1, "named-arguments"], [1, "named-arguments_repeat1"], [1, "named-arguments_repeat2"], [1, "named-arguments_repeat3"], [1, "named-arguments_repeat4"], [1, "named-arguments_repeat5"], [1, "named-arguments_repeat6"], [1, "named-arguments_repeat7"], [1, "named-arguments_repeat8"], [1, "named-arguments_repeat9"], [1, "named-arguments_repeat10"], [1, "named-arguments_repeat11"], [1, "named-arguments_repeat12"], [1, "named-arguments_repeat13"], [1, "named-arguments_repeat14"]], "Networking": [[11, "networking"]], "Networks": [[8, null]], "Positional Arguments": [[1, "moccasin_wrapper_for_docs-get_main_parser-positional-arguments"], [1, "positional-arguments"], [1, "positional-arguments_repeat1"], [1, "positional-arguments_repeat2"], [1, "positional-arguments_repeat3"], [1, "positional-arguments_repeat4"], [1, "positional-arguments_repeat5"], [1, "positional-arguments_repeat6"], [1, "positional-arguments_repeat7"], [1, "positional-arguments_repeat8"], [1, "positional-arguments_repeat9"], [1, "positional-arguments_repeat10"], [1, "positional-arguments_repeat11"], [1, "positional-arguments_repeat12"], [1, "positional-arguments_repeat13"]], "Prerequisites": [[6, "prerequisites"]], "Project Layout": [[9, null]], "Project Overview": [[13, null]], "Quickstart": [[10, null]], "Reference": [[13, null]], "Running tests": [[10, "running-tests"]], "Scripting": [[11, null]], "Sub-commands": [[1, "Sub-commands"], [1, "Sub-commands_repeat1"], [1, "Sub-commands_repeat2"]], "Testing": [[12, null]], "ValueError: .eoa not defined!": [[2, "valueerror-boa-network-networkenv-object-at-0xxxxxxxxxx-eoa-not-defined"]], "Wallet": [[14, null]], "Why Moccasin?": [[5, "why-moccasin"]], "compile (build)": [[1, "compile (build)"]], "config": [[1, "config"]], "console": [[1, "console"]], "decrypt (dk)": [[1, "decrypt (dk)"]], "delete (d)": [[1, "delete (d)"]], "deploy": [[1, "deploy"]], "explorer": [[1, "explorer"]], "fetch (get)": [[1, "fetch (get)"]], "generate (g, new)": [[1, "generate (g, new)"]], "import (i, add)": [[1, "import (i, add)"]], "init": [[1, "init"]], "inspect": [[1, "inspect"]], "install": [[1, "install"]], "list": [[1, "list"]], "list (ls)": [[1, "list (ls)"]], "moccasin.toml": [[7, null]], "moccasin_main": [[11, "moccasin-main"]], "mox": [[1, null]], "purge": [[1, "purge"]], "run (script)": [[1, "run (script)"]], "test": [[1, "test"]], "wallet": [[1, "wallet"]]}, "docnames": ["all_moccasin_toml_parameters", "cli_commands", "common-errors", "console", "dependencies", "index", "installing-moccasin", "moccasin_toml", "networks", "project", "quickstart", "script", "testing", "toctree", "wallet"], "envversion": {"sphinx": 63, "sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2}, "filenames": ["all_moccasin_toml_parameters.rst", "cli_commands.rst", "common-errors.rst", "console.rst", "dependencies.rst", "index.rst", "installing-moccasin.rst", "moccasin_toml.rst", "networks.rst", "project.rst", "quickstart.rst", "script.rst", "testing.rst", "toctree.rst", "wallet.rst"], "indexentries": {}, "objects": {}, "objnames": {}, "objtypes": {}, "terms": {"": [1, 4, 6, 8, 10, 11], "0": [0, 1, 4, 6, 10, 12], "01": [10, 12], "04ea": 14, "0x02": 4, "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48": 0, "1": [0, 1, 4, 6, 10, 12, 14], "10": 5, "100": [10, 12], "108": 10, "11": [6, 10, 12], "11155111": [0, 7, 8], "112": 12, "128": 14, "18": 4, "2": [1, 10, 12], "262144": 14, "2nd": 5, "3": [1, 6, 10, 12, 14], "32": 14, "4120": 14, "5": [10, 12], "6": [10, 12], "62dbc22cce0e270a71a5ac1a8c57b04eafa215839abcbdb9f349d63b6b9e5e9f": 14, "66": 12, "71326ecf78c3a2f2087366e4516d44f1": 14, "8": [10, 12, 14], "9": 10, "A": [5, 7, 9], "AT": 1, "And": [5, 6, 10, 11, 12, 14], "As": 4, "BE": 8, "But": [0, 6], "By": 14, "For": [1, 4, 6, 8, 11], "IF": 8, "If": [0, 1, 5, 6, 8, 9, 10, 11], "In": [4, 7, 9, 11], "It": [0, 6, 14], "TO": 8, "The": [1, 5, 6, 7, 8], "Then": [5, 6], "There": 6, "These": 0, "To": [4, 6, 10], "With": 4, "__init__": [4, 10], "__interface__": 4, "abi": 1, "about": [0, 7], "access": 7, "account": [0, 1, 2, 8, 14], "account_nam": 14, "activ": [5, 6], "actual": 0, "ad": 1, "add": [0, 2, 4, 14], "addition": 1, "address": [0, 1, 14], "adjust": 9, "ae": 14, "after": [6, 11], "against": 1, "ai": 5, "alia": 1, "all": [1, 7, 12, 13, 14], "allow": [4, 5], "along": 6, "alreadi": 10, "also": [0, 1, 4, 7, 11], "an": [1, 2, 4, 5, 6, 9, 10, 12, 14], "ani": [1, 4, 6], "anvil": [0, 8], "api": 1, "api_kei": 1, "appli": 1, "applic": 6, "appropri": 6, "apt": 6, "ar": [0, 1, 4, 5, 6, 8, 9, 11], "argument": [11, 14], "artifact": 1, "artifici": 5, "ask": 14, "assert": 12, "assign": 1, "assum": 5, "astral": 6, "attempt": 1, "auth": 4, "automat": [0, 8], "avail": 6, "awesom": 10, "b55fbb0baad": 14, "b6a4": 14, "base": 12, "basic": 1, "becaus": 5, "befor": 6, "below": 6, "beta": 1, "bin": 6, "block": 1, "boa": 1, "both": [4, 8], "brew": [6, 10], "build": 0, "cach": 1, "can": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14], "cannot": 8, "captur": 1, "care": 0, "case": 1, "cd": [6, 10], "chain": [1, 8], "chain_id": [0, 1, 7, 8], "chang": [0, 4], "check": 10, "choic": [1, 5], "cipher": 14, "cipherparam": 14, "ciphertext": 14, "class": 1, "clear": 1, "cli": [6, 14], "clone": 6, "code": 12, "collect": [10, 12], "com": [0, 6, 7, 8], "come": 6, "command": [3, 5, 6, 8, 10, 12, 14], "commandlin": 6, "common": 13, "compat": [1, 6], "compil": [9, 10], "complet": 8, "comput": 5, "config": 7, "configfil": 12, "configur": [1, 7, 9, 10], "conflict": 6, "conftest": [1, 10, 11], "connect": 8, "consol": 13, "contain": [1, 8, 9, 10], "content": [1, 14], "context": 1, "contract": [0, 1, 3, 4, 5, 7, 8, 9, 11], "contract_nam": 1, "could": 11, "count": [10, 11], "counter": [1, 10, 11], "counter_contract": 12, "cov": [10, 12], "coverag": 1, "creat": [1, 4, 6, 7, 8, 14], "crypto": 14, "ctr": 14, "curl": 6, "current": 1, "cut": 1, "cyfrin": 6, "d": [7, 9, 14], "darwin": [10, 12], "data": [1, 8], "debug": [1, 14], "debugg": 1, "decc1fbd482a171578028bfb2563362b9f4857765d6247900bde22e0cd6c2c13": 14, "decrypt": 14, "def": [4, 10, 11, 12], "default": [1, 4, 8, 11, 14], "default_account_nam": [0, 8], "defin": 11, "delet": 14, "depend": [0, 1, 6, 7, 13], "deploi": [4, 8, 9, 11, 14], "deploy": 1, "describ": [9, 10], "develop": [1, 5], "devop": 5, "dictionari": [7, 8], "directli": [1, 3, 4, 6, 11], "directori": [0, 1, 9, 10, 11, 14], "disabl": 1, "discourag": 8, "dk": 14, "dklen": 14, "do": [0, 2, 4, 6, 11], "document": [7, 11], "doe": 6, "don": [0, 1, 6, 8, 14], "download": [1, 4], "e": 6, "e6966dcf6d5384f050052f71ed7bfc02": 14, "ea0a89c0": 14, "each": [1, 7, 8], "earth": 5, "easi": [5, 10], "easiest": 6, "easili": 0, "either": [4, 6, 11], "elimin": 1, "els": 0, "encrypt": 1, "end": [6, 10, 11], "endpoint": 1, "engin": 5, "ensurepath": 6, "enter": [3, 14], "entri": 4, "environ": [1, 6], "erc20": 4, "error": [1, 8, 13, 14], "ethereum": [0, 7, 8, 10], "etherscan": 1, "etherscan_api_kei": [0, 1, 7, 8], "evalu": 1, "even": 6, "ever": 14, "exampl": [1, 4, 7, 8, 9, 11], "except": [1, 14], "exist": 1, "exit": [1, 3, 14], "exitfirst": 1, "explorer_command": 1, "export": 4, "expos": 14, "express": 1, "extra": [1, 8], "extra_data": [0, 7, 8], "extra_keyword_match": 1, "f": 1, "f39fd6e51aad88f6f4ce6ab8827279cfffb92266": 14, "fail": 1, "fals": [0, 1, 8], "fast": [5, 6], "favorit": 10, "fd": 1, "few": 6, "file": [1, 4, 7, 8, 9, 10, 11, 14], "file_or_dir": 1, "final": 5, "find": [1, 8], "first": [1, 5, 6], "flag": [1, 8], "fly": [9, 10], "folder": [1, 4, 9, 10, 11], "follow": [2, 4, 5, 6, 9, 10, 11], "forc": [1, 10], "fork": [1, 8], "formal": 5, "format": 1, "found": 14, "framework": [1, 5, 10], "from": [1, 4, 7, 8, 10], "full": [1, 7], "fun": 5, "function": [1, 11], "futur": 5, "fuzz": 5, "g": 14, "gener": 14, "get": [5, 6, 10, 12, 14], "get_config": 7, "git": 6, "github": [0, 1, 6, 8], "github_org": 1, "github_repo": 1, "given": 1, "go": 0, "good": 0, "guid": 2, "h": [1, 14], "ha": 10, "have": [0, 1, 4, 5, 6, 7, 8, 9, 11, 14], "head": [5, 6], "heavili": 5, "hello": 0, "help": [6, 14], "here": [0, 8], "hi": 0, "highli": [6, 8], "hit": 3, "home": 0, "hood": [10, 12], "how": [6, 10], "howev": 4, "http": [0, 6, 7, 8], "human": 5, "hypothesi": [10, 12], "i": [0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 14], "id": [1, 8, 14], "idea": 0, "identifi": 8, "ignor": 1, "import": [4, 7, 10, 14], "increment": [10, 11, 12], "init": 10, "initi": 4, "insensit": 1, "insid": 10, "inspect": 14, "instal": [0, 5, 10, 13], "instantli": 1, "instead": 9, "instruct": 6, "intellig": 5, "interact": [0, 1, 3, 5, 11], "is_fork": [0, 8], "is_zksync": [0, 8], "isol": 6, "item": [10, 12], "iv": 14, "javascript": 6, "json": [1, 14], "just": 10, "k": 1, "kdf": 14, "kdfparam": 14, "kei": [0, 1, 8], "keystor": [1, 14], "keystore_file_nam": 1, "keyword": 1, "l": 14, "languag": 5, "last": 1, "later": 6, "latest": 1, "layout": [7, 13], "learn": 7, "least": 6, "let": [4, 8, 10, 11], "lf": 1, "lib": [0, 4], "like": [1, 4, 5, 6, 7, 10, 11, 12], "line": [1, 8, 10], "linux": [5, 6], "list": [8, 11, 14], "ll": [2, 6, 8, 10], "load": [3, 8], "local": 10, "locat": [0, 1, 8, 9], "look": [1, 4, 7, 10, 11], "lot": 10, "lssf": 6, "m": [1, 6], "mac": 14, "machin": [5, 6], "maco": [5, 6, 10], "mai": [1, 6, 10], "mainnet": 0, "make": 6, "manag": [1, 6, 9, 10, 14], "mark": 1, "mark1": 1, "mark2": 1, "markdown": [9, 10], "match": 1, "md": [1, 9, 10, 11], "mean": [2, 8], "messag": 14, "method": 1, "might": 0, "miniaml": 4, "minim": 10, "minut": 5, "moccasin": [1, 2, 3, 4, 8, 9, 10, 11, 12, 14], "moccasin_main": 10, "mode": [1, 14], "modul": 3, "more": [5, 6, 7], "most": [2, 5], "mox": [3, 4, 6, 10, 11, 12, 13, 14], "mt": 4, "my_account": 14, "my_kei": [0, 7, 8], "my_project": 10, "my_script": 8, "my_token": 4, "my_token_dapp": 4, "n": 14, "name": [0, 8, 9, 11], "nativ": 1, "need": [2, 4, 5, 6, 10], "network": [0, 1, 7, 10, 13], "never": [0, 6, 8, 10], "new": [5, 14], "none": 1, "normal": 4, "notic": 8, "now": 10, "npx": 6, "number": [5, 10, 11, 12], "onc": [6, 14], "one": [1, 5], "onli": 1, "open": 10, "option": [1, 6, 8, 9, 14], "order": 4, "org": 4, "organ": 1, "other": [4, 6, 10], "our": [7, 8, 10], "out": [0, 1, 9, 10], "output": [1, 6, 10, 12, 14], "over": [5, 6], "overwrit": 1, "ow": 4, "own": [1, 6], "ownabl": 4, "p": [1, 14], "packag": [1, 4, 6], "paramet": [7, 13], "parent": 1, "pass": [8, 10, 12], "password": [0, 1, 8, 14], "password_fil": 1, "password_file_path": 1, "path": [0, 1, 10, 11], "patrick": 12, "payabl": 4, "pcaversaccio": [0, 1, 4], "pdb": 1, "per": 1, "pip": [0, 1], "place": 0, "plain": [0, 8], "plan": 5, "platform": [10, 12], "pleas": 6, "pluggi": [10, 12], "plugin": [10, 12], "popular": 5, "posit": 14, "possibl": 1, "power": [4, 5], "prepar": 1, "press": 3, "print": [1, 7, 10, 11], "prior": 6, "privat": [0, 1, 8], "private_kei": 1, "probabl": 6, "project": [0, 1, 4, 5, 7], "prompt": [0, 14], "provid": [0, 1], "publicnod": [0, 7, 8], "pull": 1, "push": 8, "put": [0, 7], "py": [1, 10, 11, 12], "pyevm": 10, "pypi": 1, "pyproject": 12, "pytest": [1, 10, 12], "python": [1, 3, 4, 5, 6, 9, 10, 11, 12], "q": [1, 3, 14], "quickli": 10, "quickstart": 13, "quiet": [1, 14], "r": 14, "random": [1, 14], "readm": [1, 9, 10, 11], "recommend": [5, 6], "refer": 11, "reflect": 9, "regular": [1, 11, 12], "remov": 1, "replac": 0, "repo": 4, "repositori": [1, 4], "requir": 1, "rerun": 1, "respect": 7, "restart": 6, "retreiv": 1, "return": [1, 10, 11], "risk": 1, "rootdir": [10, 12], "roughli": 6, "rpc": [0, 1, 7, 8], "run": [0, 2, 4, 5, 6, 8, 11, 12, 13, 14], "sai": [8, 11], "salt": 14, "same": [4, 11], "save": 1, "save_abi_path": 1, "script": [0, 5, 7, 8, 9, 10, 14], "script_name_or_path": 1, "scrypt": 14, "section": [6, 7], "see": [6, 7, 10, 11], "sepolia": [0, 7, 8, 11], "session": [10, 12], "set": [0, 1, 4, 7, 8], "setup": 12, "sh": 6, "shell": [1, 3], "ship": 6, "shortcut": 1, "show": 14, "similar": 6, "simul": 10, "sinc": 8, "smart": [1, 5, 9, 10], "snekmat": [0, 1, 4], "so": [3, 5, 6, 12], "some": [5, 6], "special": 11, "specif": [0, 1], "src": [0, 1, 7, 9, 10], "stai": 5, "stand": 5, "start": [1, 3, 5, 10, 11, 12], "store": [0, 14], "string": 1, "structur": [1, 9, 10], "style": 0, "substr": 1, "subsystem": 5, "summari": 1, "support": [1, 4], "suppress": [1, 14], "sure": 8, "sy": 1, "sync": 6, "syntax": 4, "system": 5, "t": [0, 1, 6, 8, 14], "tee": 1, "termin": 6, "test": [9, 11, 13], "test_count": [1, 10, 11, 12], "test_fork_usdc": 12, "test_increment_on": 12, "test_increment_two": 12, "test_method": 1, "test_oth": 1, "text": [0, 8], "them": [0, 1, 6, 11], "thi": [0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 14], "thing": 6, "think": 5, "those": [1, 6], "through": 8, "titanoboa": [5, 9, 10, 12], "todai": 4, "token": 4, "tom": 4, "toml": [1, 2, 4, 8, 9, 10, 11, 12, 13], "tool": [4, 6], "trace": 1, "traceback": 1, "tree": 10, "true": 8, "tune": 5, "tutori": 5, "typic": 9, "u": 6, "under": [5, 10, 12], "understand": [5, 6], "unfamiliar": 6, "unlik": 10, "unlock": [0, 1, 8], "unsafe_password_fil": [0, 8], "updat": 9, "uri": 1, "url": [0, 1, 7, 8], "us": [1, 4, 5, 6, 8, 9, 10, 12, 14], "usag": [1, 14], "usdc": 0, "user": [0, 1, 6, 10, 12], "util": [1, 14], "uv": [0, 4], "v0": 6, "valu": 1, "variabl": 1, "ve": 6, "venv": 6, "verif": 5, "verifi": 6, "version": [1, 4, 6, 14], "via": [6, 8], "view": [1, 14], "virtual": 6, "vscode": 1, "vy": [1, 10, 11], "vyper": [0, 1, 4, 9, 10], "wai": [5, 6, 11], "walk": 8, "wallet": [2, 8, 13], "wallet_command": 1, "want": [0, 1, 8, 9, 10, 14], "warn": 1, "watch": 5, "we": [5, 6, 7, 8, 10], "web3": 5, "weird": 6, "well": [1, 6], "what": 8, "whatev": [0, 7], "when": [0, 8], "where": [1, 7, 9], "which": [1, 4], "while": 1, "whose": 1, "window": 5, "without": 4, "work": [1, 4, 5, 6, 8, 11], "would": [4, 8, 11], "written": [5, 6], "wsl": 5, "x": 1, "you": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14], "your": [0, 1, 2, 3, 4, 6, 7, 8, 10, 11, 12, 14], "zksync": 8}, "titles": ["All moccasin toml parameters", "mox", "Common Errors", "Console", "Dependencies", "Moccasin", "Installing Moccasin", "moccasin.toml", "Networks", "Project Layout", "Quickstart", "Scripting", "Testing", "Moccasin", "Wallet"], "titleterms": {"0xxxxxxxxxx": 2, "add": 1, "all": 0, "argument": 1, "boa": 2, "build": 1, "chang": 9, "command": [1, 13], "common": 2, "compil": 1, "config": 1, "consol": [1, 3], "contract": 10, "creat": 10, "d": 1, "data": 7, "decrypt": 1, "defin": 2, "delet": 1, "depend": 4, "deploi": [1, 10], "dk": 1, "document": 5, "encrypt": 14, "eoa": 2, "error": 2, "explor": 1, "extra": 7, "fetch": 1, "from": [6, 11], "g": 1, "gener": 1, "get": [1, 13], "github": 4, "how": 5, "i": 1, "import": [1, 11], "init": 1, "inspect": 1, "instal": [1, 4, 6], "kei": 14, "l": 1, "layout": 9, "list": 1, "major": 13, "moccasin": [0, 5, 6, 7, 13], "moccasin_main": 11, "mox": 1, "name": 1, "network": [2, 8, 11], "networkenv": 2, "new": [1, 10], "object": 2, "overview": 13, "paramet": 0, "pip": [4, 6], "pipx": 6, "posit": 1, "prerequisit": 6, "privat": 14, "project": [9, 10, 13], "purg": 1, "pypi": 4, "quickstart": 10, "read": 5, "refer": 13, "run": [1, 10], "script": [1, 11], "sourc": 6, "src": 11, "start": 13, "sub": 1, "test": [1, 10, 12], "toml": [0, 7], "uv": 6, "valueerror": 2, "wallet": [1, 14], "why": 5, "your": 9}}) \ No newline at end of file diff --git a/testing.html b/testing.html new file mode 100644 index 0000000..e86e90e --- /dev/null +++ b/testing.html @@ -0,0 +1,234 @@ + + + + + Testing - moccasin documentation + + + + + + + + + + + + +
+
+
+ + + + moccasin + +
+ +
+
+
+
+
+
+
+ + + + +
+
+
+
+

Testing

+

moccasin uses pytest under the hood, so you can setup your tests like regular titanoboa based python tests.

+
def test_increment_one(counter_contract):
+    counter_contract.increment()
+    assert counter_contract.number() == 2
+
+
+def test_increment_two(counter_contract):
+    counter_contract.increment()
+    counter_contract.increment()
+    assert counter_contract.number() == 3
+
+
+

And run all your tests with mox test, to get an output like:

+
Running test command...
+====================================== test session starts =======================================
+platform darwin -- Python 3.11.6, pytest-8.3.3, pluggy-1.5.0
+rootdir: /Users/patrick/code/moccasin
+configfile: pyproject.toml
+plugins: cov-5.0.0, titanoboa-0.2.2, hypothesis-6.112.0
+collected 3 items
+
+tests/test_counter.py ..                                                                   [ 66%]
+tests/test_fork_usdc.py .                                                                  [100%]
+
+======================================= 3 passed in 0.01s ========================================
+
+
+
+ +
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/toctree.html b/toctree.html new file mode 100644 index 0000000..180c4ec --- /dev/null +++ b/toctree.html @@ -0,0 +1,239 @@ + + + + + moccasin documentation + + + + + + + + + + + + +
+
+
+ + + + moccasin + +
+ +
+
+
+
+
+
+
+ + + + +
+
+
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/wallet.html b/wallet.html new file mode 100644 index 0000000..f0e4df7 --- /dev/null +++ b/wallet.html @@ -0,0 +1,283 @@ + + + + + Wallet - moccasin documentation + + + + + + + + + + + + +
+
+
+ + + + moccasin + +
+ +
+
+
+
+
+
+
+ + + + +
+
+
+
+

Wallet

+

By default, you don’t want to ever expose your private key in your scripts. You can use the wallet commands to manage your private keys and accounts.

+
$ mox wallet
+
+usage: Moccasin CLI wallet [-h] [-d] [-q] {list,ls,generate,g,new,import,i,add,inspect,decrypt,dk,delete,d} ...
+
+Wallet management utilities.
+
+positional arguments:
+{list,ls,generate,g,new,import,i,add,inspect,decrypt,dk,delete,d}
+    list (ls)           List all the accounts in the keystore default directory
+    generate (g, new)   Create a new account with a random private key
+    import (i, add)     Import a private key into an encrypted keystore
+    inspect             View the JSON of a keystore file
+    decrypt (dk)        Decrypt a keystore file to get the private key
+    delete (d)          Delete a keystore file
+
+options:
+-h, --help            show this help message and exit
+-d, --debug           Run in debug mode
+-q, --quiet           Suppress all output except errors
+
+
+
+

Encrypting a private key

+

You can encrypt a private key using the wallet import ACCOUNT_NAME command. This will create a keystore file in the default keystore directory. It will prompt you to enter your private key and password.

+
$ mox wallet import my_account
+
+Running wallet command...
+Importing private key...
+Enter your private key:  ...
+
+
+

Once you have an account, you can view it with the wallet list command.

+
$ mox wallet list
+
+Running wallet command...
+Found 1 accounts:
+my_account
+
+
+

This will encrypt your key and store it at ~/.moccasin/keystore/my_account.json. You can view the contents of the keystore file with the wallet inspect command.

+
$ mox wallet inspect my_account
+Running wallet command...
+Keystore JSON for account my_account:
+{
+    "address": "f39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
+    "crypto": {
+        "cipher": "aes-128-ctr",
+        "cipherparams": {
+            "iv": "e6966dcf6d5384f050052f71ed7bfc02"
+        },
+        "ciphertext": "decc1fbd482a171578028bfb2563362b9f4857765d6247900bde22e0cd6c2c13",
+        "kdf": "scrypt",
+        "kdfparams": {
+            "dklen": 32,
+            "n": 262144,
+            "r": 8,
+            "p": 1,
+            "salt": "71326ecf78c3a2f2087366e4516d44f1"
+        },
+        "mac": "62dbc22cce0e270a71a5ac1a8c57b04eafa215839abcbdb9f349d63b6b9e5e9f"
+    },
+    "id": "ea0a89c0-04ea-4120-b6a4-b55fbb0baade",
+    "version": 3
+}
+
+
+

You can then use these in scripts!

+
mox run deploy --account my_account
+
+
+

And it will ask you for the password to decrypt your private key.

+
+
+ +
+
+
+
+ + + + + + + + \ No newline at end of file