Buying / Selling New Puts
Functions to open put contracts, either buying or selling a newAsk or newBid
After a short has put up a newAsk for purchase on the smart contract, another peer may come along and purchase that put from them. In this case, the buyer must confirm that all the details match with the appropriate index of the new ask put they are looking to purchase. Assuming everything matches and the buyer has sufficient funds to pay for it, then the premium price is transferred from the buyer to the seller (fees taken from seller's gross premium). The put is now open, and the put Long position is assigned to the buyer. The put is also immediately turned off from trading, to prevent unwanted sales of the put without consent.
On the opposite side, if a put writer finds a sufficiently attractive newBid, they can sell this put to the potential long. Similarly, they must confirm all of the same parameters and details match what they are aiming to sell. The smart contract checks that the short has sufficient balance (total purchase) and then pulls the cash into the smart contract for escrow. Because the puts are dealing with cash for both the premium and the total purchase currency, the put pulls only the net amount into escrow (rather than delivering in the total purchase and delivering out the price). This saves slightly on gas, but allows the put seller to sell puts at a discount instead of putting up the total purchase price. Thus the put is now open, and the put.Short is assigned to the new put short (msg.sender), and similarly it is no longer tradeable.
Copy link