Skip to content

Commit

Permalink
Initial version of ink! contract interfacing
Browse files Browse the repository at this point in the history
  • Loading branch information
Arjan Zijderveld committed Dec 14, 2020
1 parent 414c373 commit 9b1a995
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ code = ContractCode.create_from_contract_files(
receipt = code.upload_wasm(keypair)

if receipt.is_succes:
print('* Contrat WASM Uploaded')
print('* Contract WASM Uploaded')

for event in receipt.triggered_events:
print(f'* {event.value}')
Expand All @@ -299,22 +299,22 @@ else:

```python
contract = ContractInstance.create_from_address(
contract_address="5FV9cnzFc2tDrWcDkmoup7VZWpH9HrTaw8STnWpAQqT7KvUK",
metadata_file=os.path.join(os.path.dirname(__file__), 'erc20.json'),
substrate=substrate
)
contract_address="5FV9cnzFc2tDrWcDkmoup7VZWpH9HrTaw8STnWpAQqT7KvUK",
metadata_file=os.path.join(os.path.dirname(__file__), 'erc20.json'),
substrate=substrate
)
```

#### Read data from a contract:

```python
result = contract.read(keypair, 'total_supply')

print('Total supply:', result.value)
# Total supply: {'success': {'data': 1000000000000000000, 'flags': 0, 'gas_consumed': 2616500000}}

result = contract.read(keypair, 'balance_of', args={'owner': '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY'})

print('Balance:', result.value)
# Balance: {'success': {'data': 994000000000000000, 'flags': 0, 'gas_consumed': 7251500000}}
```

#### Execute a contract call
Expand Down

0 comments on commit 9b1a995

Please sign in to comment.