Read a Token Contract

You can view a token's contract by sending a GET request to the /contract path of the/token endpoint.

Read a token contract.

GET https://api.playfix.io/token/<token_name>/contract

Path Parameters

Name
Type
Description

token_name*

String

An automatically generated token name. This will start with a prefix of "tokens/" followed by a ULID.

Example: tokens/01gfrf15n9hqw3v08sqearsgh9

Headers

Name
Type
Description

Authorization*

String

Bearer <your_access_token>

{
  "contract": {
    "source": {
      "main": "//...",
      "imports": {
      @opengsn/contracts/src/BaseRelayRecipient.sol: "..."
      @opengsn/contracts/src/interfaces/IRelayRecipient.sol: "..."
      @openzeppelin/contracts/access/AccessControl.sol: "..."
      @openzeppelin/contracts/access/IAccessControl.sol: "..."
      @openzeppelin/contracts/governance/utils/IVotes.sol: "..."
      @openzeppelin/contracts/governance/utils/IVotes.sol: "..."
      @openzeppelin/contracts/interfaces/IERC3156FlashBorrower.sol: "..."
      @openzeppelin/contracts/interfaces/IERC3156FlashLender.sol: "..."
      @openzeppelin/contracts/security/Pausable.sol: "..."
      @openzeppelin/contracts/token/ERC20/IERC20.sol: "..."
      @openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol: "..."
      @openzeppelin/contracts/token/ERC20/extensions/ERC20FlashMint.sol: "..."
      @openzeppelin/contracts/token/ERC20/extensions/ERC20Snapshot.sol: "..."
      @openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol: "..."
      @openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol: "..."
      @openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol: "...
      }
    },
    "abi": "[{...}, {...}, {...}, ...]",
    "bytecode": "0x...",
  }
}

Example cURL API Call

curl --request GET \
  --url https://api.playfix.io/token/<token_name>/contract \
  --header 'Authorization: Bearer <your_access_token>'

Example Python API Call

import requests

r = requests.get(
    "https://api.playfix.io/token/<token_name>/contract",
    headers = {
        "Authorization": "Bearer <your_access_token>"
        }
    )

print(r.text)

Response

{
  "contract": {
    "source": {
      "main": "//...",
      "imports": {
      @opengsn/contracts/src/BaseRelayRecipient.sol: "..."
      @opengsn/contracts/src/interfaces/IRelayRecipient.sol: "..."
      @openzeppelin/contracts/access/AccessControl.sol: "..."
      @openzeppelin/contracts/access/IAccessControl.sol: "..."
      @openzeppelin/contracts/governance/utils/IVotes.sol: "..."
      @openzeppelin/contracts/governance/utils/IVotes.sol: "..."
      @openzeppelin/contracts/interfaces/IERC3156FlashBorrower.sol: "..."
      @openzeppelin/contracts/interfaces/IERC3156FlashLender.sol: "..."
      @openzeppelin/contracts/security/Pausable.sol: "..."
      @openzeppelin/contracts/token/ERC20/IERC20.sol: "..."
      @openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol: "..."
      @openzeppelin/contracts/token/ERC20/extensions/ERC20FlashMint.sol: "..."
      @openzeppelin/contracts/token/ERC20/extensions/ERC20Snapshot.sol: "..."
      @openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol: "..."
      @openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol: "..."
      @openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol: "...
      }
    },
    "abi": "[{...}, {...}, {...}, ...]",
    "bytecode": "0x...",
  }
}

This sample response is compressed.

Last updated