Skip to content

Commit

Permalink
Merge branch 'contracts' of https://github.com/Spencer-Sch/CCIP-Payroll
Browse files Browse the repository at this point in the history
… into contracts
  • Loading branch information
Spencer-Sch committed Dec 8, 2023
2 parents ff2e6ac + 786e319 commit 8de07eb
Show file tree
Hide file tree
Showing 14 changed files with 333 additions and 80 deletions.
33 changes: 33 additions & 0 deletions NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
PayrollFactory deployed to: 0xfe44aB0B966E57F126130BE6401546c7351484ad --mumbai
TokenTransferor deployed to: 0x21d762ab159676d3bd05e12A95699C1d0b043A48 --mumbai
Payroll deployed to: 0xDBAbe75848c608bDA3382f0D68219542032B3fEa --mumbai
All deployed from 0x9768818565ED5968fAACC6F66ca02CBf2785dB84

https://api-testnet.polygonscan.com/IEWN9BX92EIKVXR22UKQQ9A4UWEF5J9IRG

There is no log out / wallet modal on Register Deploy
Need a rundown of how to log in with wallet and connect to mumbai chain without AA

I shouldnt need to change the web3auth client id correct?

deploy contract in register flow is stuck at getting account address...

## 12/7
Funkornaut@gmail -- 0xBB65877a1207572321dE0ad64A2e196545904a09
trevfost503@gmail -- 0xfd330177602f092b72a3b65893602067Ab69cE2c
sign in with funkornaut through gmail -- 0x1aD394b0c57dbC57f16A5A54b4ccee436b678287

deployed new payroll 0xAB34603b0A8c54f9F9Fe9207b98da8ac354dB68e
- added function isOwner returns bool, owner() func on ownable works but since we then needed to look for bool on front end thought that would simplify from end logic / routing
- think that the LogIn flow is a little better

Login.tsx
Web3 modal pops up when you hit login button - should only pop up if there is a contract address in the form

Now logOut if funky
Cant log in with Metamask

DeployForm
- just using useContractWrite was able to click button and make action got this error in browser console
next-dev.js:20 ConnectorNotFoundError: Connector not found at writeContract (chunk-TSH6VVF4.js:2348:1)

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,8 @@
},
"resolutions": {
"usehooks-ts@^2.7.2": "patch:usehooks-ts@npm:^2.7.2#./.yarn/patches/usehooks-ts-npm-2.7.2-fceffe0e43.patch"
},
"dependencies": {
"@web3auth/web3auth-wagmi-connector": "^5.0.1"
}
}
4 changes: 2 additions & 2 deletions packages/hardhat/contracts/Payroll.sol
Original file line number Diff line number Diff line change
Expand Up @@ -527,8 +527,8 @@ ITokenTransferor public ccip;
}
}

function getOwner() public view returns (address){
return owner();
function isOwner(address _address) public view returns (bool){
return _address == owner();
}

function getEmployeePaymentSplits(address _employeeAddress) public view returns (PaymentSplit memory){
Expand Down
2 changes: 1 addition & 1 deletion packages/hardhat/deploy/03_deploy_payroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ async function main() {
console.log("Deploying contracts with the account:", deployer.address);

// Add the addresses of the dependencies of your Payroll contract
const ccipTokenTransferorAddress = "0xFFc15127eB60C4Ab1a2e5e0319615ca0982952f2"; // deployed via script
const ccipTokenTransferorAddress = "0x21d762ab159676d3bd05e12A95699C1d0b043A48"; // deployed via script
const bnmTokenAddress = "0xf1E3A5842EeEF51F2967b3F05D45DD4f4205FF40"; //BnM Mumbai

// Deploy the Payroll contract
Expand Down
8 changes: 8 additions & 0 deletions packages/nextjs/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
NEXT_PUBLIC_ALCHEMY_API_KEY=NcFZk9kYsJT0zbvxp1BvXdk9PmgJFypJ
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID=67c39fba49c2101d141cb637137aa160
# # Polygon Mumbai
NEXT_PUBLIC_FACTORY_CONTRACT_ADDRESS=0xfe44aB0B966E57F126130BE6401546c7351484ad
# # Polygon Mumbai
NEXT_PUBLIC_PAYROLL_CONTRACT_ADDRESS=0xAB34603b0A8c54f9F9Fe9207b98da8ac354dB68e
NEXT_PUBLIC_LOCAL_CHAIN_ID=0 # REPLACE WITH LOCAL DEV CHAIN
NEXT_PUBLIC_TESTNET_CHAIN_ID=80001 # Polygon Mumbaiyar
17 changes: 17 additions & 0 deletions packages/nextjs/auth/web3auth.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
// import { useEffect, useState } from "react";
import { Web3Auth } from "@web3auth/modal";

//import { Web3AuthConnector } from "@web3auth/web3auth-wagmi-connector";

// import { createWalletClient, custom } from "viem";
// import { polygonMumbai } from "viem/chains";
// import { AuthProvider, setAuthProvider, setIsConnected } from "~~/auth/authSlice";
// import { MyState, useMyDispatch, useMySelector } from "~~/components/dash-wind/app/store";

// set up your web3auth instance with all the features you want
// const web3AuthInstance = new Web3Auth({
// clientId: "BM0SLNkhMCfIygw0Xi79dG6qbWGMN0o0mEeDjRT0dxlP3BEok9pnu5aqxCNfj2TZ9XT7sQaXm0ltuWbCQ1tsRNI",
// chainConfig: {
// chainNamespace: "eip155",
// chainId: "0x13881", // Mumbai
// rpcTarget: "https://rpc.ankr.com/polygon_mumbai",
// displayName: "Mumbai Testnet",
// blockExplorer: "https://mumbai.polygonscan.com/",
// ticker: "MATIC",
// tickerName: "Polygon",
// },
// web3AuthNetwork: "sapphire_mainnet",
// });

export const web3auth = new Web3Auth({
clientId: "BM0SLNkhMCfIygw0Xi79dG6qbWGMN0o0mEeDjRT0dxlP3BEok9pnu5aqxCNfj2TZ9XT7sQaXm0ltuWbCQ1tsRNI", // Get your Client ID from the Web3Auth Dashboard
web3AuthNetwork: "sapphire_devnet", // Web3Auth Network
Expand Down
1 change: 1 addition & 0 deletions packages/nextjs/components/dash-wind/containers/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ function Header() {

// Get user's public address
const [address] = await client.getAddresses();
//console.log("user address: ", address);
return address as Address;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ import { openModal } from "../common/modalSlice";
/*-------------------------------------*/
// Kaz & Trevor
// uncomment
// import { useContractRead } from "wagmi";
//import { useContractRead } from "wagmi";

/*-------------------------------------*/

import TrashIcon from "@heroicons/react/24/outline/TrashIcon";
import {
/*MyState,*/
Expand Down
Loading

0 comments on commit 8de07eb

Please sign in to comment.