Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2445 enable onchain passport push to arbitrum #57

Merged
merged 9 commits into from
May 22, 2024
Prev Previous commit
Next Next commit
fix: fix failing tests, also updated hardhat config
  • Loading branch information
nutrina committed May 22, 2024
commit 2e2fb81d62ec18317aecf46700d567d487f0920e
27 changes: 15 additions & 12 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -75,6 +75,14 @@ let config: HardhatUserConfig = {
apiURL: "https://api.arbiscan.io/api",
browserURL: "https://arbiscan.io/"
}
},
{
network: "arbitrum-sepolia",
chainId: 421614,
urls: {
apiURL: "https://api-sepolia.arbiscan.io/api",
browserURL: "https://sepolia.arbiscan.io/"
}
}
]
},
@@ -85,10 +93,10 @@ let config: HardhatUserConfig = {
solidity: {
settings: {
optimizer: {
enabled: true,
runs: 200
enabled: false,
runs: 2
},
viaIR: true
viaIR: false
},

compilers: [
@@ -137,36 +145,31 @@ if (process.env.DEPLOYER_PRIVATE_KEY && process.env.DEPLOYER_ADDRESS) {
};
}
if (process.env.OP_SEPOLIA_PROVIDER_URL) {
console.log("process.env.OP_SEPOLIA_PROVIDER_URL: ", process.env.OP_SEPOLIA_PROVIDER_URL);
config.networks["optimism-sepolia"] = {
url: process.env.OP_SEPOLIA_PROVIDER_URL as string,
accounts: [process.env.DEPLOYER_PRIVATE_KEY as string],
chainId: 0xaa37dc,
from: process.env.DEPLOYER_ADDRESS as string,
from: process.env.DEPLOYER_ADDRESS as string
// gasPrice: 280000000,
// gasPrice: 9068663
};
}
if (process.env.ARBITRUM_PROVIDER_URL) {
console.log("process.env.ARBITRUM_PROVIDER_URL: ", process.env.ARBITRUM_PROVIDER_URL);
console.log("process.env.DEPLOYER_ADDRESS: ", process.env.DEPLOYER_ADDRESS);
config.networks["arbitrum"] = {
url: process.env.ARBITRUM_PROVIDER_URL as string,
accounts: [process.env.DEPLOYER_PRIVATE_KEY as string],
chainId: 42161,
from: process.env.DEPLOYER_ADDRESS as string,
from: process.env.DEPLOYER_ADDRESS as string
// gasPrice: 280000000,
// gasPrice: 9068663
};
}
if (process.env.ARBITRUM_SEPOLIA_PROVIDER_URL) {
console.log("process.env.ARBITRUM_PROVIDER_URL: ", process.env.ARBITRUM_SEPOLIA_PROVIDER_URL);
console.log("process.env.DEPLOYER_ADDRESS: ", process.env.DEPLOYER_ADDRESS);
config.networks["arbitrum"] = {
config.networks["arbitrum-sepolia"] = {
url: process.env.ARBITRUM_SEPOLIA_PROVIDER_URL as string,
accounts: [process.env.DEPLOYER_PRIVATE_KEY as string],
chainId: 421614,
from: process.env.DEPLOYER_ADDRESS as string,
from: process.env.DEPLOYER_ADDRESS as string
// gasPrice: 280000000,
// gasPrice: 9068663
};
14 changes: 2 additions & 12 deletions test/GitcoinAttester.ts
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ import {
} from "@ethereum-attestation-service/eas-sdk";

import { multiAttestationRequest } from "./helpers/mockAttestations";
import { EAS_CONTRACT_ADDRESS } from "./helpers/verifierTests";

describe("GitcoinAttester", function () {
let gitcoinAttester: any,
@@ -24,18 +25,7 @@ describe("GitcoinAttester", function () {
// We use loadFixture to run this setup once, snapshot that state,
// and reset Hardhat Network to that snapshot in every test.
async function deployGitcoinAttester() {
// Deployment and ABI: SchemaRegistry.json
// Sepolia

// v0.26

// EAS:
// Contract: 0xC2679fBD37d54388Ce493F1DB75320D236e1815e
// Deployment and ABI: EAS.json
// SchemaRegistry:
// Contract: 0x0a7E2Ff54e76B8E6659aedc9103FB21c038050D0
// Deployment and ABI: SchemaRegistry.json
EASContractAddress = "0xC2679fBD37d54388Ce493F1DB75320D236e1815e"; // Sepolia v0.26
EASContractAddress = EAS_CONTRACT_ADDRESS;

// Contracts are deployed using the first signer/account by default
const [
13 changes: 8 additions & 5 deletions test/GitcoinPassportDecoder.ts
Original file line number Diff line number Diff line change
@@ -30,6 +30,8 @@ import { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers";

const providers = [BigInt("111")];

const dayInSeconds = 3600 * 24;

const issuanceDates = [1694628559, 1695047108, 1693498086];
const expirationDates = [1702404559, 1702823108, 1701274086];
const hashes = [
@@ -274,9 +276,8 @@ describe("GitcoinPassportDecoder", function () {

const currentVersion = await gitcoinPassportDecoder.currentVersion();

const savedProviders = await gitcoinPassportDecoder.getProviders(
currentVersion
);
const savedProviders =
await gitcoinPassportDecoder.getProviders(currentVersion);

expect(savedProviders.length === providers.length);
expect(savedProviders).to.eql(providers);
@@ -381,7 +382,8 @@ describe("GitcoinPassportDecoder", function () {
data: [
{
recipient: recipientAccount.address,
expirationTime: 1708741995,
expirationTime:
Math.floor(new Date().getTime() / 1000) + 10 * dayInSeconds,
revocable: true,
refUID: ZERO_BYTES32,
data: easEncodePassport(),
@@ -401,7 +403,8 @@ describe("GitcoinPassportDecoder", function () {
data: [
{
recipient: recipientAccount.address,
expirationTime: 1708741995,
expirationTime:
Math.floor(new Date().getTime() / 1000) + 10 * dayInSeconds,
revocable: true,
refUID: ZERO_BYTES32,
data: easEncodeInvalidStamp(),
5 changes: 2 additions & 3 deletions test/GitcoinResolver.ts
Original file line number Diff line number Diff line change
@@ -9,10 +9,9 @@ import { encodedData, getScoreAttestation } from "./helpers/mockAttestations";
import { SCHEMA_REGISTRY_ABI } from "./abi/SCHEMA_REGISTRY_ABI";
import { AttestationStruct } from "../typechain-types/contracts/GitcoinResolver";
import { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers";
import { EAS_SCHEMA_REGISTRY_ADDRESS } from "./helpers/verifierTests";

export const schemaRegistryContractAddress =
process.env.SEPOLIA_SCHEMA_REGISTRY_ADDRESS ||
"0x0a7E2Ff54e76B8E6659aedc9103FB21c038050D0";
export const schemaRegistryContractAddress = EAS_SCHEMA_REGISTRY_ADDRESS;

async function registerSchema(
owner: any,
Loading