Python library for interacting with Autonity
Project description
autonity.py
Autonity is a protocol that provides smart contract and settlement infrastructure specialized for developing new risk markets. It is a fork of the Ethereum protocol. See the Autonity documentation for further information.
This package provides typed wrappers around the Autonity-specific extensions of Ethereum, using the Web3.py framework, for convenient and statically checked interactions with the Autonity network.
Installation
pip install autonity
Usage
The primary utility of this library is the typed wrappers around the Autonity protocol contract, which provides access to Autonity-specific functionality.
from autonity.utils.web3 import create_web3_for_endpoint
from autonity import Autonity, Validator
w3 = create_web3_for_endpoint("<RPC_ENDPOINT>")
# Create the typed wrapper around the Autonity contract.
autonity = Autonity(w3)
# Get total supply of Newton
ntn_supply = autonity.total_supply()
# Get the current validator list
validator_ids = autonity.get_validators()
# Get descriptor for the 0-th validator. Print LNTN contract address.
validator_desc_0 = autonity.get_validator(validator_ids[0])
print(f"LNTN contract addr: {validator_desc_0['liquid_contract']}")
# Typed validator Liquid Newton contract. Query unclaimed fees for <ADDRESS>.
validator_0 = Validator(w3, validator_desc_0)
unclaimed_atn, unclaimed_ntn = validator_0.unclaimed_rewards("<ADDRESS>")
print(f"unclaimed rewards: {unclaimed_atn} ATN, {unclaimed_ntn} NTN")
Where<RPC_ENDPOINT>
is the name of the Autonity network being connected to.
See https://docs.autonity.org/networks/ for information about specific
networks.
Development
The project uses hatch as the build tool. To launch the tests, run:
hatch run test:all
For linting use the command:
hatch run lint:check
Updating the Contract ABIs
The script script/update_abi.sh [AUTONITY_COMMIT]
builds the contract ABIs
using AGC at the specified Git commit ID or tag. Keys are ordered via the jq
tool, in order to produce deterministic output, and the results written to the
autonity/abi
directory. Further, it normalizes the commit ID that was used.
After executing the script against a new version of the code, the diffs can be reviewed to determine which methods have been modified, removed or added.
Reporting a Vulnerability
Please do not file a public ticket mentioning the vulnerability.
Instead, please send an email to security@autonity.org to report a security issue.
The following PGP key may be used to communicate sensitive information to developers:
Fingerprint: 6006 CCC3 DD11 7885 1A23 4290 7486 F832 6320 219E
-----BEGIN PGP PUBLIC KEY BLOCK-----
xs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ugJAMmhCm3ALehcx0RuaIkSF5jP57eTLAo83/AJ2dikZvYZmh5OHdirTo
iZnjRt3uIL3SshrFz44poKrfHYr7X+ePAUEIAQeM9lDngdxemVEF0pI9uMcqqhdB
uA9h+hmjldAcdsvpBV8AEQEAAcLBfAQYAQgAJhYhBGAGzMPdEXiFGiNCkHSG+DJj
ICGeBQJi+3qfBQkFo5qAAhsMAAoJEHSG+DJjICGe17MQAKjw0EJar0BTEwTYraKq
ed2m6fhbSmyhV+UXtxtoinkEU2cxVe6IoK+x/uP0nfmCoH7ZlWapIOgKSDKsb/Ze
czVTmHt23O9/Tq7C2aCvK3UFcAWNEQFR6pWGgiPonxSaTN4Cw2f1vKekhxAYXrbm
7sqEKZl+59D8uzHA0QSORP8FKpextccCtiL2L5b3ttGmrjGiXeL1wm1iWHxuOksm
OpGFz6WgVZS1MYuomyBb/tm8MOsPabODmW3kJDUd1DcxO99ZFP72IERBTKqonKLW
VCTV8Evv2agpTwTiP7TxGnl9ep5ZxkXAnQUXMwfVBYg0uGmmMhdcQ2n8wh6f1aR2
GksOuLSMQTC/RNNHOnS0xTKrlh0uQ5fF0WZJaUpUXjHxCjiBAXUdlwXJET+S2t7H
jLXA1MdBmJp7ymBVRqQQguaH5G2dciSEG/iqMLH76u7c+L1w+esGpwbSu1OH+wd7
7ys9vJxxJIqch8mzKlRTun+M/CCXWX5uvxeVGrwmvrARfnyOpyR9W0MzJ5xi7n5I
B1LUp7ycX/NeWHviWALjz1ObHeipvErh2n2iD/8swWez6eho1BDJ9sf8hz/gVJbR
dNvOgvIvgW1Bcibq3uqiigQnFYo15bmfIDRCJCBCmqf4Xb8Ip+m/QrLf92KIcDRc
VtiVUMzKBEpmz4LdeSy73Qfr
=12PL
-----END PGP PUBLIC KEY BLOCK-----
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file autonity-4.0.0.tar.gz
.
File metadata
- Download URL: autonity-4.0.0.tar.gz
- Upload date:
- Size: 33.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b04e581f8c21b438c4e05d6da44db4a2df86d621dd1d6b42eee9007b8a5e4e35 |
|
MD5 | 9a6572e6e10ce4c76d728991c6e1fa63 |
|
BLAKE2b-256 | 2621c5dd7ef8d89f1bbf937826f4fd416c2f9868bb8598314eb16c62f670dc4d |
File details
Details for the file autonity-4.0.0-py3-none-any.whl
.
File metadata
- Download URL: autonity-4.0.0-py3-none-any.whl
- Upload date:
- Size: 51.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae2c849a973f0160853de0eadb209896ed8af325a7444c7f3d014e490b46ef92 |
|
MD5 | aec5de631ed4006a591bb7af2ab51809 |
|
BLAKE2b-256 | 1ae708ea907f993b596674618105597fde752fb7c463f7245cf1d5ec3dbeb4d6 |