https://github.com/masaun/time-based-energy-payment
This is the smart-contract for realizing the time based energy payment.
https://github.com/masaun/time-based-energy-payment
matic-network solidity truffle
Last synced: 3 months ago
JSON representation
This is the smart-contract for realizing the time based energy payment.
- Host: GitHub
- URL: https://github.com/masaun/time-based-energy-payment
- Owner: masaun
- Created: 2020-08-11T23:34:34.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-09-06T15:14:33.000Z (almost 5 years ago)
- Last Synced: 2025-02-02T10:43:12.606Z (4 months ago)
- Topics: matic-network, solidity, truffle
- Language: JavaScript
- Homepage:
- Size: 163 KB
- Stars: 0
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Time based energy payment ⚡️
***
## 【Introduction of the time based energy payment ⚡️】
- This is the smart-contract for realizing the time based energy payment.
- Payment: using the Matic Network of layer 2 solution for avoiding expensive gas fee when payment tokens (ERC20) are transferred.
- Matic Energy Token (ERC20. Symbol: MET) is used as a payment token.
- Stack
- Solidity-v0.6.12
- @openzeppelin/contracts-v3.1.0
## 【User Flow】
① User register as a `"prosumer"` (Both of producer and consumer)
② Measured values of the smart-meter are measured at the end of every month by instruction of smart-contract.
(measured smart-meter are both that from production and from consumption)
③ Measured values from production and measured value from consumption are compared.
④ Transfer
・If the measured value from production is greater than measured value from consumption, the smart-contract transfer payment tokens into the prosumer's wallet.
・If the measured value from consumption is greater than measured value from production, the prosumer transfer payment tokens into the smart-contract.
⑤ Invoices of monthly result are sent to each prosumers. (at the end of every month)
***
## 【Setup】
### Setup smart-contract
- Compile
```
cd smart-contractganache-cli -d
npm run compile: local
```### Setup backend
### Setup frontend
***
## 【References】
- Matic (Document)
- Getting started
https://docs.matic.network/docs/develop/maticjs/getting-started
- @openzeppelin/contract
- Doc (From @openzeppelin/contract v0.3.x)
https://docs.openzeppelin.com/contracts/3.x/erc20
- Access Control
- Doc for Access Control.sol
https://docs.openzeppelin.com/contracts/3.x/access-control
- How to Use OpenZeppelin’s New AccessControl Contract
https://medium.com/better-programming/how-to-use-openzeppelins-new-accesscontrol-contract-5b49a4bcd160
- Article of energy market
- How to Build an Energy Market on a Blockchain
https://medium.com/coinmonks/how-to-build-an-energy-market-on-a-blockchain-c43b0cfc2d12?source=linkShare-8b51f748f36a-1595734355&_branch_match_id=716987589328688022