Tests
Here you can find some scenarios that you should have in mind when interacting and building on top of Ohmydefi. Initially, you have two main phases: before expiration of an option, and after.
The source code for tests can be found here.
If you need development support, join the #developers channel on our Pods community Discord server.
The example below is the test for the pohETH
contract:
Before Expiration
1) General checks
✓ Should have 18 fixed decimals before expiration
2) Can't withdraw can mint options by locking strike tokens (integer values)
✓ Should mint if allowed to spend underlying tokens
✓ Should be some locked strike asset after exchange
3) Can mint options by locking strike asset (decimal values)
✓ Should mint if allowed to spend underlying tokens
✓ Should be some locked strike asset after exchange
4) Can burn options to get back my assets
✓ Should be able to burn all my options for all my locked assets
✓ Should not be able to burn more options than the amount of my locked tokens
5) Can sell my underlying tokens for the strike tokens at the strike price
✓ Should be able to exchange my options
After Expiration
6) Can't mint, burn or exchange options anymore
✓ Should not allow mint() must allow transfers because of how uniswap liquidity pools work
✓ Should allow transfer()
✓ Should allow transferFrom()
7) Should allow withdraw
✓ Should allow withdraw with no balance
✓ Should allow withdraw locked asset with no holding options
✓ Should allow withdraw locked asset with was exercised by another user
✓ Should allow withdraw a mix of locked strike asset and asset with was exercised by another user
Last updated