Skip to content

Commit

Permalink
#86dtu8yuk - Include how to use NEP17Contract to Calling contracts do…
Browse files Browse the repository at this point in the history
…cumentation
  • Loading branch information
jplippi committed Jun 18, 2024
1 parent 8c6f9ae commit fc6fd89
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docs/source/calling-smart-contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,22 @@ def calling_other_contract() -> str:
return neo_symbol
```

### Calling NEP-17 Contracts
In addition, Neo3-Boa has an interface for contracts that adhere to the NEP-17 standard.
```python
# calling_nep17_contract.py
from boa3.sc.compiletime import public
from boa3.sc.contracts import ContractManagement
from boa3.sc.types import Nep17Contract


@public
def calling_other_contract(my_contract_hash: str) -> str:
nep_17_contract: Nep17Contract = ContractManagement.get_contract(my_contract_hash)
return nep_17_contract.symbol()
```
> Note: The compiler cannot validate if the provided contract hash corresponds to a NEP-17 contract. If the corresponding smart contract does not implement a required NEP-17 method and such method is called, it will cause a runtime error.
### Automate with CPM
Instead of manually writing the smart contract interface, you can use [CPM](https://github.com/CityOfZion/cpm/tree/master#readme)
to generate it automatically. After installing Neo3-Boa, you can install CPM by typing `install_cpm` on CLI (without the
Expand Down

0 comments on commit fc6fd89

Please sign in to comment.