Skip to content

Latest commit

 

History

History

abidoc

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Application Binary Inteface (ABI) Documentation Generator For Ethereum & Co.

abidoc - application binary interface (abi) documentation generator for Ethereum & Co. (blockchain) contracts

Usage

Let's try to generate the contract abi docs for punks v1 (anno 2017):

require 'abidoc'

punks_v1    = '0x6ba6f2207e343923ba692e5cae646fb0f566db8d'

abi = ABI.read( "./abis/#{punks_v1}.json" )
buf = abi.generate_doc( title: 'Contract ABI for Punks V1' )
write_text( "./o/punks_v1.md", buf )

resulting in:


Contract ABI for Punks V1

Constructor

  • constructor()

1 Payable Function(s)

  • function buyPunk(uint256 punkIndex) payable

7 Transact Functions(s)

  • function reservePunksForOwner(uint256 maxForThisRun)
  • function withdraw()
  • function transferPunk(address to, uint256 punkIndex)
  • function offerPunkForSaleToAddress(uint256 punkIndex, uint256 minSalePriceInWei, address toAddress)
  • function offerPunkForSale(uint256 punkIndex, uint256 minSalePriceInWei)
  • function getPunk(uint256 punkIndex)
  • function punkNoLongerForSale(uint256 punkIndex)

14 Query Functions(s)

  • function name() ⇒ (string _) readonly
  • function punksOfferedForSale(uint256 _) ⇒ (bool isForSale, uint256 punkIndex, address seller, uint256 minValue, address onlySellTo) readonly
  • function totalSupply() ⇒ (uint256 _) readonly
  • function decimals() ⇒ (uint8 _) readonly
  • function imageHash() ⇒ (string _) readonly
  • function nextPunkIndexToAssign() ⇒ (uint256 _) readonly
  • function punkIndexToAddress(uint256 _) ⇒ (address _) readonly
  • function standard() ⇒ (string _) readonly
  • function balanceOf(address _) ⇒ (uint256 _) readonly
  • function symbol() ⇒ (string _) readonly
  • function numberOfPunksToReserve() ⇒ (uint256 _) readonly
  • function numberOfPunksReserved() ⇒ (uint256 _) readonly
  • function punksRemainingToAssign() ⇒ (uint256 _) readonly
  • function pendingWithdrawals(address _) ⇒ (uint256 _) readonly

Let's try to generate the contract abi docs for punk blocks (anno 2022):

punk_blocks = '0x58e90596c2065befd3060767736c829c18f3474c'

abi = ABI.read( "./address/#{punk_blocks}.json" )

buf =  abi.generate_doc( title: 'Contract ABI for Punk Blocks' )
write_text( "./punk_blocks.md", buf )

resulting in:


Contract ABI for Punk Blocks

Constructor

  • constructor()

1 Transact Functions(s)

  • function registerBlock(bytes _dataMale, bytes _dataFemale, uint8 _layer, string _name)

8 Query Functions(s)

  • function blocks(bytes32 _) ⇒ (uint8 layer, bytes dataMale, bytes dataFemale) readonly
  • function getBlocks(uint256 _fromID, uint256 _count) ⇒ (tuple[] _, uint256 _) readonly
  • function index(uint256 _) ⇒ (bytes32 _) readonly
  • function nextId() ⇒ (uint256 _) readonly
  • function svgFromIDs(uint256[] _ids) ⇒ (string _) readonly
  • function svgFromKeys(bytes32[] _attributeKeys) ⇒ (string _) readonly
  • function svgFromNames(string[] _attributeNames) ⇒ (string _) readonly
  • function svgFromPunkID(uint256 _tokenID) ⇒ (string _) readonly

and so on.

Bonus - Awesome Contracts

See the Awesome (Ethereum) Contracts / Blockchain Services @ Open Blockchains repo. that is a cache of (ethereum) contract ABIs (application binary interfaces) and open source code (if verified / available) with auto-generated docs via abidoc & friends.

License

The scripts are dedicated to the public domain. Use it as you please with no restrictions whatsoever.

Questions? Comments?

Post them on the D.I.Y. Punk (Pixel) Art reddit. Thanks.