MultiToken
Last updated
Last updated
MultiToken is a solidity library unifying , & transfers by wrapping them into a MultiToken Asset struct.
If you want to use the MultiToken library in your solidity project, you can install our NPM package.
Run: npm install @pwnfinance/multitoken
MultiToken.sol contract is written in Solidity version 0.8.0 but can be compiled with any Solidity compiler version 0.8.*
The library defines a token asset as a struct of token identifiers. It wraps transfer, allowance and balance check calls of the following token standards:
Unifying the function calls used within the PWN context so we don't have to worry about handling these token standards individually.
Each asset is defined by the Asset
struct and has the following properties:
category
Corresponding asset category
address
assetAddress
Address of the token contract defining the asset
uint256
id
TokenID of an NFT or 0
uint256
amount
Amount of fungible tokens or 0 -> 1
The MultiToken library does not define any events or custom errors.
Asset memory
asset
- struct defining all necessary context of a token
Asset memory
asset
- struct defining all necessary context of a token
Asset memory
asset
- struct defining all necessary context of a token
Asset memory
asset
- struct defining all necessary context of a token
Asset memory
asset
- struct defining all necessary context of a token
Wrapper function to allow grating approval using permit signature for ERC-20 (see ).
Asset memory
asset
- struct defining all necessary context of a token
bytes memory
permitData
- The Permit data itself. The data must include the permit deadline (uint256
) and permit signature. The signature can be standard (65 bytes
) or compact (64 bytes
) defined in . Lastly, the deadline and signature should be pack encoded together.
Asset memory
asset
- struct defining all necessary context of a token
Asset memory
asset
- struct defining all necessary context of a token
Asset memory
asset
- struct defining all necessary context of a token
Asset memory
asset
- struct defining the first token to compare
Asset memory
otherAsset
- struct defining the second token to compare