Tokens: ERC-20 and NFTs
How to make an ERC-20 or ERC-721 token contract that will work with onchain governance.
Last updated
Was this helpful?
How to make an ERC-20 or ERC-721 token contract that will work with onchain governance.
Last updated
Was this helpful?
Tally expects tokens to implement the relevant standard, like or . Also, Tally needs the token contract to implement the for delegation and voting power checkpointing.
Specifically, Tally needs the following methods and event signatures for indexing and web3 calls:
Tally's API listens to event logs from token contracts when indexing them. Your token contract will need to maintain the same event signatures:
Your contract will need to support transfer events, too. Tally works with both ERC20 transfer events and ERC721 events.
The Tally frontend helps users make these function calls to delegate their votes:
The token contract must implement the name()
function, so that Tally knows what to call the token.
The token contract must implement a symbol()
function, so that Tally knows the short name of the token.
ERC20 token contracts must implement a decimals()
function, so that Tally can correctly render token balances:
Your token contract also needs to implement voting and delegation functions. If you are using an ERC20 token, you can use the or the extensions from the OpenZeppelin token contracts library.
If you're using an ERC71 token, you can use OpenZeppelin's draft extension.