37
Step 22: Call deregisterPPABuyer(buyer)
Step 23: Set buyer ID to 0 in ppaBuyers mapping
Step 24: Emit buyerDeregistered event
Step 25: End_if
Step 26: End_if
Step 27: End_RegistryManagement
5.2.3 Contract Creation Functions
The smart contracts include two primary functions for creating energy agreements:
corporatePPA
and
createPPA
. These two functions provide different methods of entering energy agreements,
depending on the nature of the relationship between producers and buyers:
corporatePPA: This function is used for agreements that have predefined terms between a producer
and a buyer, particularly suited for large companies. Both parties benefit from long-term price
guarantees, which protect them from the volatility of energy markets. This setup is ideal for
established companies that have already agreed on energy pricing and contract terms, seeking stability
in their energy procurement.
createPPA: This function allows producers to create ad-hoc energy contracts without pre-agreed
terms. The energy producer can offer energy on the marketplace, allowing smaller buyers to bid on
energy contracts. The buyer automatically selects the lowest-priced PPA using the
claimAuctionPPA
function. This type of PPA is typically used by smaller entities or energy
producers who seek to secure buyers early in the project development phase, thus facilitating
investment in new green energy projects.
Algorithm for creating PPAs:
Step 1: Algorithm CreatePPA
Step 2: If producer wants to create a PPA then:
Step 3: Call createPPA(kwhPrice, startDay, endDay)
Step 4: Generate unique contract ID using Counters
Step 5: Validate startDay >= current timestamp
Step 6: Validate endDay > startDay
Step 7: Validate kwhPrice >= 1 cent
Step 8: Add new PPA to listOfPPAs
Step 9: Emit createdPPA event
Step 10: End_if
Step 11: End_CreatePPA
Step 12: Algorithm CreateCorporatePPA
Step 13: If producer wants to create a corporate PPA then:
Step 14: Call corporatePPA(buyer, agreedKwhPrice, startDay, endDay,
id)
Step 15: Validate agreed terms: startDay, endDay, agreedKwhPrice
Step 16: Add new corporate PPA to corporatePPAList
Step 17: Issue PPA via Registry contract
Step 18: Emit createdCorpPPA event
Step 19: End_if
Step 20: End_CreateCorporatePPA
Step 21: Algorithm ClaimPPA
Step 22: If buyer wants to claim a PPA then: