A simple contract allowing one to vend a token for a set rate against another token.
Three variants of the vending machine contract are provided:
- Mint: mints the vended token on demand; requires the vending machine contract to have minting privileges on the token to be vended.
- Transfer: transfers vended tokens from the vending machine contract; requires the vending machine contract to hold a sufficient balance of the token to be vended.
- TransferFrom: transfers vended tokens from a third-party vendor; requires the vending machine contract to have a sufficient allowance of the token to be vended.
The vending machine contracts also include a sweepTokens()
function, allowing the owner
to sweep any ERC20 tokens
accidentally sent directly to the vending machine.
A vendable token contract is also provided, code for this was generated using wizard.openzeppelin.com.
All contracts are WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
This project is licensed under LGPLv3.