credmark.cmf.types.token_erc721.NonFungibleToken

DTO class NonFungibleToken(*, address)[source]

Bases: Contract

Non-fungible token.

This class is not yet implemented

Show JSON schema
{
   "title": "NonFungibleToken",
   "description": "Non-fungible token.\n\n`This class is not yet implemented`",
   "type": "object",
   "properties": {
      "address": {
         "title": "Address",
         "type": "string",
         "pattern": "^0x[a-fA-F0-9]{40}$",
         "format": "evm-address"
      }
   },
   "required": [
      "address"
   ],
   "examples": [
      {
         "address": "0x1F98431c8aD98523631AE4a59f267346ea31F984"
      },
      {
         "address": "0x1F98431c8aD98523631AE4a59f267346ea31F984",
         "abi": "(Optional) contract abi JSON string or list"
      }
   ]
}

Config
  • arbitrary_types_allowed: bool = True

  • schema_extra: dict = {‘examples’: [{‘address’: ‘0x1F98431c8aD98523631AE4a59f267346ea31F984’}, {‘address’: ‘0x1F98431c8aD98523631AE4a59f267346ea31F984’, ‘abi’: ‘(Optional) contract abi JSON string or list’}]}

  • underscore_attrs_are_private: bool = True

Fields
Parameters

address (Address) –

Return type

None

field address: Address [Required]
Constraints
  • type = string

  • pattern = ^0x[a-fA-F0-9]{40}$

  • format = evm-address

DTO class ContractMetaData(*, contract_name=None, deploy_tx_hash=None, constructor_args=None, abi_hash=None, abi=None, is_transparent_proxy=None, proxy_implementation=None, deployed_block_number=None)

Bases: BaseModel

Show JSON schema
{
   "title": "ContractMetaData",
   "type": "object",
   "properties": {
      "contract_name": {
         "title": "Contract Name",
         "type": "string"
      },
      "deploy_tx_hash": {
         "title": "Deploy Tx Hash",
         "type": "string"
      },
      "constructor_args": {
         "title": "Constructor Args",
         "type": "string"
      },
      "abi_hash": {
         "title": "Abi Hash",
         "type": "string"
      },
      "abi": {
         "title": "Abi",
         "type": "array",
         "items": {}
      },
      "is_transparent_proxy": {
         "title": "Is Transparent Proxy",
         "type": "boolean"
      },
      "proxy_implementation": {
         "title": "Proxy Implementation"
      },
      "deployed_block_number": {
         "title": "Deployed Block Number",
         "type": "integer"
      }
   }
}

Fields
  • abi (Optional[credmark.cmf.types.abi.ABI])

  • abi_hash (Optional[str])

  • constructor_args (Optional[str])

  • contract_name (Optional[str])

  • deploy_tx_hash (Optional[str])

  • deployed_block_number (Optional[credmark.cmf.types.block_number.BlockNumber])

  • is_transparent_proxy (Optional[bool])

  • proxy_implementation (Optional[Contract])

Parameters
Return type

None

field abi: Optional[ABI] = None
field abi_hash: Optional[str] = None
field constructor_args: Optional[str] = None
field contract_name: Optional[str] = None
field deploy_tx_hash: Optional[str] = None
field deployed_block_number: Optional[BlockNumber] = None
field is_transparent_proxy: Optional[bool] = None
field proxy_implementation: Optional[Contract] = None
fetch_events(event, argument_filters=None, from_block=None, to_block=None, address=None, topics=None, contract_address=None, argument_names=None, by_range=None, use_async=False, async_worker=10)

contract_address is by default set to the event’s address.

For proxy contract, the event could be from the proxy contract and contract_address could be overridden with the contract’s address.

For example,

tok = Token(‘AAVE’) list(tok.fetch_events(

tok.proxy_for.events.Transfer, from_block=16_000_000, to_block=16_010_000, contract_address=tok.address))

For non-proxy contract, we may use as following

tok = Token(‘CRV’) df = pd.DataFrame(tok.fetch_events(

tok.events.Transfer, from_block=16_000_000, to_block=16_001_000, topics=[‘0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef’]))

df.loc[:, [‘blockNumber’, ‘_from’, ‘_to’, ‘_value’]]

Parameters
set_abi(abi, set_loaded=False)

Set the ABI for the contract

Parameters

abi (Union[List, str]) –

to_accounts()
classmethod validate(value)
property abi

The ABI for the contract, if it’s available, otherwise None.

property constructor_args

Constructor args, if any, otherwise None.

property contract_name

Name of the contract, if available, otherwise None.

property deploy_tx_hash

The deploy transaction hash, if available, otherwise None.

property deployed_block_number
property events

A web3 ContractEvents instance for the contract.

property functions

A web3 ContractFunctions instance for the contract.

property info

A credmark.cmf.types.contract.ContractInfo instance for the contract.

property instance: Contract

A web3 Web3Contract instance or raises a ModelDataError if no ABI is available.

property is_transparent_proxy

True if is a transparent proxy. Otherwise False or None.

property ledger: None
property models
property proxy_for

A proxy implementation if available