Skip to content

Commit

Permalink
import new docs
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbertoCentonze committed Nov 26, 2024
1 parent f2c883b commit afc828a
Show file tree
Hide file tree
Showing 89 changed files with 3,725 additions and 1,224 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: ci
on:
push:

permissions:
contents: write

jobs:
deploy:
runs-on: ubuntu-latest
env:
PUBLISH: ${{ contains(fromJSON('["master", "main"]'), github.ref_name) && 'true' || 'false' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
cache: 'pip'
- uses: actions/cache@v4
with:
key: ${{ github.ref }} # cache by branch
path: .cache
- run: pip install -r requirements.txt

- run: mkdocs build
if: env.PUBLISH == 'false'

- uses: actions/upload-artifact@v4
if: env.PUBLISH == 'false'
with:
name: site
path: site

- run: mkdocs gh-deploy --force
if: env.PUBLISH == 'true'
20 changes: 0 additions & 20 deletions docs/Makefile

This file was deleted.

Empty file.
29 changes: 29 additions & 0 deletions docs/api/cache.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Cache

## `set_cache_dir`

!!! function "`boa.interpret.set_cache_dir()`"
<a href="https://github.com/vyperlang/titanoboa/blob/v0.2.4/boa/interpret.py#L53-L59" class="source-code-link" target="_blank" rel="noopener"></a>

**Description**

Set the cache directory for the Vyper compilation results.
By default, this is set to `~/.cache/titanoboa`.
In case the directory is `None`, the cache will be disabled.

---

**Parameters**

- `cache_dir`: The directory to store the cache files.

---

## `disable_cache`

!!! function "`boa.interpret.disable_cache()`"
<a href="https://github.com/vyperlang/titanoboa/blob/v0.2.4/boa/interpret.py#L62-L63" class="source-code-link" target="_blank" rel="noopener"></a>

**Description**

Set the cache directory for the Vyper compilation results.
30 changes: 30 additions & 0 deletions docs/api/common_classes/_BaseEVMContract.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# `_BaseEVMContract`

### Description

The `_BaseEVMContract` class provides the base functionality for EVM contracts. It includes methods for handling contract deployment, execution, and interaction.

### Methods

- [stack_trace](stack_trace.md)
- [call_trace](call_trace.md)
- [handle_error](handle_error.md)

### Properties

- [address](address.md)

### Examples

```python
>>> import boa
>>> src = """
... @external
... def main():
... pass
... """
>>> deployer = boa.loads_partial(src, name="Foo")
>>> contract = deployer.deploy()
>>> type(contract)
<class 'boa.vyper.contract.VyperContract'>
```
26 changes: 26 additions & 0 deletions docs/api/common_classes/_BaseVyperContract.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# `_BaseVyperContract`

### Description

The `_BaseVyperContract` class extends `_BaseEVMContract` and provides additional functionality specific to Vyper contracts. It includes methods for handling Vyper-specific features such as ABI encoding/decoding, event handling, and more.

### Methods

- [deployer](deployer.md)
- [abi](abi.md)
- [_constants](_constants.md)

### Examples

```python
>>> import boa
>>> src = """
... @external
... def main():
... pass
... """
>>> deployer = boa.loads_partial(src, name="Foo")
>>> contract = deployer.deploy()
>>> type(contract)
<class 'boa.vyper.contract.VyperContract'>
```
27 changes: 27 additions & 0 deletions docs/api/common_classes/_constants.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# `_constants`

### Property

```python
@property
_constants: ConstantsModel
```

### Description

Provides access to the constants defined in the Vyper contract.

- Returns: A `ConstantsModel` instance.

### Examples

```python
>>> import boa
>>> src = """
... x: constant(uint256) = 123
... """
>>> deployer = boa.loads_partial(src, name="Foo")
>>> contract = deployer.deploy()
>>> contract._constants.x
123
```
30 changes: 30 additions & 0 deletions docs/api/common_classes/abi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# `abi`

### Property

```python
@property
abi: dict
```

### Description

Returns the ABI (Application Binary Interface) of the Vyper contract.

- Returns: A dictionary representing the ABI of the contract.

### Examples

```python
>>> import boa
>>> src = """
... @external
... def main():
... pass
... """
>>> deployer = boa.loads_partial(src, name="Foo")
>>> contract = deployer.deploy()
>>> contract_abi = contract.abi
>>> type(contract_abi)
<class 'dict'>
```
Empty file.
33 changes: 33 additions & 0 deletions docs/api/common_classes/call_trace.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# `call_trace`

<!-- TODO: Format this with !!!function syntax -->

### Signature

```python
call_trace() -> TraceFrame
```

### Description

Returns the call trace of the computation.

- Returns: A `TraceFrame` instance.

### Examples

!!! python

```python
>>> import boa
>>> src = """
... @external
... def main():
... pass
... """
>>> deployer = boa.loads_partial(src, name="Foo")
>>> contract = deployer.deploy()
>>> contract.main()
>>> contract.call_trace()
<TraceFrame ...>
```
Empty file.
1 change: 1 addition & 0 deletions docs/api/common_classes/handle_error.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO
33 changes: 33 additions & 0 deletions docs/api/common_classes/stack_trace.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# `stack_trace`

### Signature

```python
stack_trace(computation: ComputationAPI) -> StackTrace
```

### Description

Returns the stack trace of the computation.

- `computation`: The computation to get the stack trace for.
- Returns: A `StackTrace` instance.

### Examples

```python
>>> import boa
>>> src = """
... @external
... def main():
... assert False, "error"
... """
>>> deployer = boa.loads_partial(src, name="Foo")
>>> contract = deployer.deploy()
>>> try:
... contract.main()
... except:
... pass
>>> contract.stack_trace(contract._computation)
<StackTrace ...>
```
6 changes: 6 additions & 0 deletions docs/api/env/browser_env.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# BrowserEnv

Inherits: [`NetworkEnv`](network_env.md)

<!-- TODO: Document BrowserEnv API -->

Loading

0 comments on commit afc828a

Please sign in to comment.