Skip to content

Commit

Permalink
deploy process is working better, but still needs work. adding gh act…
Browse files Browse the repository at this point in the history
…ions
  • Loading branch information
fleischr committed May 28, 2024
1 parent 898883c commit c218fe0
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 33 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Compile Contracts

on:
push:
branches:
- main

jobs:
compile:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20' # You can specify the Node.js version you need

- name: Install dependencies
run: npm install

- name: Compile contracts
run: npx hardhat compile
35 changes: 19 additions & 16 deletions contracts/emissionsNFT.sol
Original file line number Diff line number Diff line change
Expand Up @@ -202,17 +202,18 @@ contract emissionsNFT is ERC721, iEmissionsNFT {
return allPedsByTokenID[_tokenID];
}

function requestScope3EmissionsDataVerification(address _destinationContract, string memory _myghgOrgID, string memory _yourghgOrgID, uint32 _myTokenID, uint32 _yourTokenID) external returns(uint256){
/*function requestScope3EmissionsDataVerification(address _destinationContract, string memory _myghgOrgID, string memory _yourghgOrgID, uint32 _myTokenID, uint32 _yourTokenID) external returns(uint256){
// get the remote contract instance
iEmissionsNFT remoteContract = iEmissionsNFT(_destinationContract);
uint256 scope3DVTicket = 0;
try remoteContract.logScope3VerificationRequests(address(this), _myghgOrgID, _yourghgOrgID, _myTokenID, _yourTokenID) {
//todo add event
return scope3DVTicket;
} catch {
//to do add event
return scope3DVTicket;
}
}
}*/

function logScope3VerificationRequests(address _originContract, string calldata _scope3GHGOrgID, string calldata _scope1GHGOrgID, uint32 _scope3TokenID, uint32 _scope1TokenID) external returns (scope3VerificationRequest memory){
/*function logScope3VerificationRequests(address _originContract, string calldata _scope3GHGOrgID, string calldata _scope1GHGOrgID, uint32 _scope3TokenID, uint32 _scope1TokenID) external returns (scope3VerificationRequest memory){
scope3VerificationRequest memory inboundRequest;
inboundRequest.scope1Contract = address(this);
inboundRequest.scope3Contract = _originContract;
Expand All @@ -223,34 +224,36 @@ contract emissionsNFT is ERC721, iEmissionsNFT {
inboundRequest.scope3vreqStatus = scope3vreqStatusEnum.CREATED;
scope3vreqs.push(inboundRequest);
return inboundRequest;
}
}*/

function getScope3VerificationRequest(address _originContract, string calldata _scope3GHGOrgID, string calldata _scope1GHGOrgID, uint32 _scope3TokenID, uint32 _scope1TokenID) external returns (scope3VerificationRequest memory){
/*function getScope3VerificationRequest(address _originContract, string calldata _scope3GHGOrgID, string calldata _scope1GHGOrgID, uint32 _scope3TokenID, uint32 _scope1TokenID) external returns (scope3VerificationRequest memory){
scope3VerificationRequest memory myScope3Request;
iEmissionsNFT remoteContract = iEmissionsNFT(_originContract);
//myScope3Request = iEmissionsNFT.getScope3VerificationRequest(_originContract, _scope3GHGOrgID, _scope1GHGOrgID, _scope3TokenID, _scope1TokenID);
return myScope3Request;
}
}*/

function sendScope3Verification(address _originContract, string calldata _scope3GHGOrgID, string calldata _scope1GHGOrgID, uint32 _scope3TokenID, uint32 _scope1TokenID, uint256 _tokenVerificationID) external returns (scope3VerificationRequest memory) {
/*function sendScope3Verification(address _originContract, string calldata _scope3GHGOrgID, string calldata _scope1GHGOrgID, uint32 _scope3TokenID, uint32 _scope1TokenID, uint256 _tokenVerificationID) external returns (scope3VerificationRequest memory) {
iEmissionsNFT remoteContract = iEmissionsNFT(_originContract);
//remoteContract.createScope3Verification(_scope3TokenID, _tokenVerificationID, _verifierDID, _message, _verifierSignature, _verifiedOn, _currentAdjustmentID);
scope3VerificationRequest memory returnedRequest;
address myContractAddress = address(this);
//returnedRequest = iEmissionsNFT.getScope3VerificationRequest(myContractAddress, _scope3GHGOrgID, _scope1GHGOrgID, _scope3TokenID, _scope1TokenID);
//remoteContract.createScope3Verification(_targetToken, _tokenVerificationID, _verifierDID, _message, _verifierSignature, _verifiedOn, _currentAdjustmentID);
return returnedRequest;
}
}*/

function createScope3Verification(uint32 _targetToken, uint256 _tokenVerificationID, address _verifierDID, string memory _message, bytes calldata _verifierSignature, uint256 _verifiedOn, uint16 _currentAdjustmentID) external returns (emissionsVerification memory) {
/*function createScope3Verification(uint32 _targetToken, uint256 _tokenVerificationID, address _verifierDID, string memory _message, bytes calldata _verifierSignature, uint256 _verifiedOn, uint16 _currentAdjustmentID) external returns (emissionsVerification memory) {
addEmissionsVerification(_targetToken, _tokenVerificationID, _verifierDID, _message, _verifierSignature, _verifiedOn, _currentAdjustmentID);
}
}*/

function pushScope3Verifiers(address _scope3contract, string calldata _scope1GHGOrgID, string calldata _scope3GHGOrgID) external returns (emissionsVerifier memory) {
/*function pushScope3Verifiers(address _scope3contract, string calldata _scope1GHGOrgID, string calldata _scope3GHGOrgID) external returns (emissionsVerifier memory) {
//get the verifiers for the scope 1 token
}
}*/

function shareAddress() external view returns(address) {
/*function shareAddress() external view returns(address) {
return address(this);
}
}*/

//Role-based modifiers
modifier onlyEmissionsVerifier() {
Expand Down
3 changes: 1 addition & 2 deletions contracts/emissionsNFTFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
pragma solidity ^0.8.19;

import "./emissionsNFT.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

contract emissionsNFTFactory {
emissionsNFT[] public deployedNFTs;
IERC20 public paymentToken;
//IERC20 public paymentToken;
uint256 public creationFee;

mapping(address => emissionsNFT) public emissionsNFTByDeployer;
Expand Down
14 changes: 7 additions & 7 deletions contracts/iEmissionsNFT.sol
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,19 @@ interface iEmissionsNFT {

function getTokenVerifications(uint32 _tokenID) external view returns(emissionsVerification[] memory);

function requestScope3EmissionsDataVerification(address _destinationContract, string memory _myghgOrgID, string memory _yourghgOrgID, uint32 _myTokenID, uint32 _yourTokenID) external returns(uint256);
//function requestScope3EmissionsDataVerification(address _destinationContract, string memory _myghgOrgID, string memory _yourghgOrgID, uint32 _myTokenID, uint32 _yourTokenID) external returns(uint256);

function logScope3VerificationRequests(address _originContract, string calldata _scope3GHGOrgID, string calldata _scope1GHGOrgID, uint32 _scope3TokenID, uint32 _scope1TokenID) external returns (scope3VerificationRequest memory);
//function logScope3VerificationRequests(address _originContract, string calldata _scope3GHGOrgID, string calldata _scope1GHGOrgID, uint32 _scope3TokenID, uint32 _scope1TokenID) external returns (scope3VerificationRequest memory);

function getScope3VerificationRequest(address _originContract, string calldata _scope3GHGOrgID, string calldata _scope1GHGOrgID, uint32 _scope3TokenID, uint32 _scope1TokenID) external returns (scope3VerificationRequest memory);
//function getScope3VerificationRequest(address _originContract, string calldata _scope3GHGOrgID, string calldata _scope1GHGOrgID, uint32 _scope3TokenID, uint32 _scope1TokenID) external returns (scope3VerificationRequest memory);

function sendScope3Verification(address _originContract, string calldata _scope3GHGOrgID, string calldata _scope1GHGOrgID, uint32 _scope3TokenID, uint32 _scope1TokenID, uint256 _tokenVerificationID) external returns (scope3VerificationRequest memory);
//function sendScope3Verification(address _originContract, string calldata _scope3GHGOrgID, string calldata _scope1GHGOrgID, uint32 _scope3TokenID, uint32 _scope1TokenID, uint256 _tokenVerificationID) external returns (scope3VerificationRequest memory);

function createScope3Verification(uint32 _targetToken, uint256 _tokenVerificationID, address _verifierDID, string memory _message, bytes calldata _verifierSignature, uint256 _verifiedOn, uint16 _currentAdjustmentID) external returns (emissionsVerification memory);
//function createScope3Verification(uint32 _targetToken, uint256 _tokenVerificationID, address _verifierDID, string memory _message, bytes calldata _verifierSignature, uint256 _verifiedOn, uint16 _currentAdjustmentID) external returns (emissionsVerification memory);

function pushScope3Verifiers(address _scope3contract, string calldata _scope1GHGOrgID, string calldata _scope3GHGOrgID) external returns (emissionsVerifier memory);
//function pushScope3Verifiers(address _scope3contract, string calldata _scope1GHGOrgID, string calldata _scope3GHGOrgID) external returns (emissionsVerifier memory);

function shareAddress() external view returns(address);
//function shareAddress() external view returns(address);


}
8 changes: 8 additions & 0 deletions contracts/vechainco2nft.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"folders": [
{
"name": "emissionsdatalist",
"path": "../../../ghg_cds/app/emissionsdatalist"
}
]
}
36 changes: 36 additions & 0 deletions deploy/00_deploy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
const { ethers, getNamedAccounts } = require("hardhat");

async function main() {
//const emissionsNFTFactory = await hre.ethers.deployContract("emissionsNFTFactory", [], {});
//await emissionsNFTFactory.waitForDeployment();

console.log("deploying emissionsNFT contract...");

const { deployer } = await getNamedAccounts();
const deployerSigner = await ethers.getSigner(deployer);

const MyContract = await ethers.getContractFactory("emissionsNFT", deployerSigner);
const myContract = await MyContract.deploy();

await myContract.deployed();

console.log("emissionsNFT deployed to:", myContract.address);

/* const emissionsNFT = await hre.deployments.deploy('emissionsNFT', { from: deployer});
console.log(
`EmissionsNFT Contract deployed to ${emissionsNFT.target}`
);*/
}

main.id = "emissionsNFT";
main.tags = ['regular'];

//export default main;

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
16 changes: 8 additions & 8 deletions scripts/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ const main = async function(hre) {
//const emissionsNFTFactory = await hre.ethers.deployContract("emissionsNFTFactory", [], {});
//await emissionsNFTFactory.waitForDeployment();

await hre.deployments.deploy('emissionsNFTFactory', { from: deployer});
const emissionsNFT = await hre.deployments.deploy('emissionsNFT', { from: deployer});

console.log(
`EmissionsNFT Factory Contract deployed to ${emissionsNFTFactory.target}`
`EmissionsNFT Contract deployed to ${emissionsNFT.target}`
);
}

main.id = "emissionsNFTFactory";
main.id = "emissionsNFT";
main.tags = ['regular'];

export default main;
//export default main;

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
//main().catch((error) => {
// console.error(error);
// process.exitCode = 1;
//});
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});

0 comments on commit c218fe0

Please sign in to comment.