This project feeds carbon intensity data from the National Grid official Carbon Intensity API to a carbon intensity consumer contract which exposes its state to be used as part of a composed stack enabling other contracts to limit compute to times of low carbon generation, in other words, services can run in eco-mode.
Contract | Address |
---|---|
Operator | 0xd3e4028bC6b50091112641b565bE049f535D6299 |
Carbon Layer | 0x1749456Bd2Fe5D37AFBD73Bb59995e89F97aDce4 |
Carbon Assert | 0xA3A6C7865706E5E9cc594c3FC5ef534C50316Ab5 |
Carbon Query | 0x82c2F109A7979909Da4894f5EeF8085Ed90686dd |
Upkeep | 0xFe7B5DB07b96Dff57A200cB8a34aAbc654C6aD66 |
Oracle Node | 0x44A1542d44df86f7AC5Fed208cc77D39E6F18eC0 |
-
Configure & launch a node either:
-
Access the node dashboard http://localhost:6688
-
Fund your node address with ETH
-
Add the intensity.toml and mix.toml from jobs
-
NOTE: don't forget to set up a view role docs
-
Deploy an instance of the operator and save the address.
-
Set the node address as an authorised sender on the Operator
-
Deploy an instance of CarbonLayer
-
Fund CarbonLayer with Link. Each update costs 0.2 Link
-
NOTE: TODO: investigate access control modifier on fulfillOracleResponse functions ???
-
Deploy and fund a new upkeep on Chainlink Automation
-
Create a time interval based upkeep that points to Carbon Layer. The upkeep should call the
update
function with the Operator address and the job id's forGet UK Carbon Intensity Index
&Get UK Carbon Intensity Mix
. -
Copy the Upkeep address from the Chainlink Automation dashboard and call
setAutomation
on Carbon Layer to authenticate the upkeep. -
NOTE: gas limit should be >= 250,000
-
NOTE: api update interval = 30min
-
TODO: look into replicating state across chains. What effect will the CCIP delay have on the service.
-
NOTE: don't forget the deployer nonce needs to be the same one all chains
npx hardhat help
npx hardhat test
REPORT_GAS=true npx hardhat test
npx hardhat node
npx hardhat run scripts/deploy.ts