Skip to content

PEG Conversions

Steven Masley edited this page Dec 3, 2019 · 1 revision

Peg Conversions

PEG conversions are unique. There is a fixed amount of PEG that can be generated per block by miners, and also by conversions. The amount of PEG that can be converted is currently set to 5K PEG per block. This restriction is described here.

But how does it work?

As a user of the system, if you want to acquire PEG, you can either go to an external exchange or convert inside the Pegnet. If you choose to make a conversion request from pUSD to PEG, the amount of PEG you receive is not necessarily deterministic. For 1, the price of the PEG depends on the current trading price of PEG. For simple example purposes, let's say the price is $0.001. This means $5 worth of PEG can be converted per block.

Situation 1 -- 1 Person wants 5K PEG

User A wants $5 of PEG, and is the only person on the Pegnet network making a conversion request. This is simple, as $5 worth of PEG can be created, so user A receives all 5,000 PEG.

Situation 2 -- 1 Person wants 7k PEG

User A wants $7 of PEG, and is the only person on the Pegnet network making a conversion request. Since there is a 5K PEG limit ($5), the user receives 5K PEG, and $2 USD as a refund.

Situation 3 -- 2 People wants over 5K PEG

If we have more than 1 request, we can handle those requests based on their proportions of the total requested. What this means, is that the more PEG you request, the more of the 5K PEG you will receive. If User A requests $9 of PEG, and User B $1. Then User A receives 90% of the 5K PEG, and User B receives 10%.

User A gets 4,500 PEG and a $4.50 refund, while User B gets 500 PEG and a $0.50 refund.

Technical documents

The above examples are a simple explanation of how the system works. If you are to implement this yourself, please consult the reference implementation here. The formulas can be found here if source code is difficult to follow.

It should be understood the implementation details are critical. There are design decisions that might differ the amount of PEG yielded to each conversion request by dust amounts (less than 0.000000010 PEG). These dust amounts, although small, matter in the balance accounting of the system.