Skip to content

Commit

Permalink
update code - linking SchemaRegistry and Attestation contract, revoke…
Browse files Browse the repository at this point in the history
… function
  • Loading branch information
KohliSuraj committed Jun 25, 2024
1 parent 9415544 commit 438231e
Show file tree
Hide file tree
Showing 5 changed files with 246 additions and 110 deletions.
2 changes: 2 additions & 0 deletions SolasPresentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ data: {

- Ability to refer other attestations
- Allow delegated attestations (Contract receives a signed attestation and attests onchain on behalf of user)
- Implement Revoke
- Implement option to refer an attestation
232 changes: 164 additions & 68 deletions packages/nextjs/contracts/deployedContracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@

const deployedContracts = {
devnet: {
AttestationRegistry: {
SchemaRegistry: {
address:
"0x07c59f28a693a4d629f0b0358ae52649ca3e6743e111bedc0c822ee76ece3387",
"0x00417a5d2dc2fe77a06f1b7efe316e789cf9fbfb2630c502d9907ed16994af67",
abi: [
{
type: "impl",
name: "AttestationRegistryImpl",
interface_name:
"contracts::AttestationRegistry::IAttestationRegistry",
name: "SchemaRegistryImpl",
interface_name: "contracts::SchemaRegistry::ISchemaRegistry",
},
{
type: "struct",
Expand Down Expand Up @@ -49,22 +48,14 @@ const deployedContracts = {
},
{
type: "interface",
name: "contracts::AttestationRegistry::IAttestationRegistry",
name: "contracts::SchemaRegistry::ISchemaRegistry",
items: [
{
type: "function",
name: "attest",
name: "register",
inputs: [
{
name: "schema_uid",
type: "core::integer::u128",
},
{
name: "recipient",
type: "core::starknet::contract_address::ContractAddress",
},
{
name: "data",
name: "schema",
type: "core::byte_array::ByteArray",
},
{
Expand All @@ -79,69 +70,63 @@ const deployedContracts = {
],
state_mutability: "external",
},
],
},
{
type: "constructor",
name: "constructor",
inputs: [
{
name: "schema_registry_address",
type: "core::starknet::contract_address::ContractAddress",
type: "function",
name: "get_schema",
inputs: [
{
name: "uid",
type: "core::integer::u128",
},
],
outputs: [
{
type: "(core::integer::u128, core::bool, core::byte_array::ByteArray)",
},
],
state_mutability: "view",
},
],
},
{
type: "event",
name: "contracts::AttestationRegistry::AttestationRegistry::Attested",
name: "contracts::SchemaRegistry::SchemaRegistry::Registered",
kind: "struct",
members: [
{
name: "recipient",
type: "core::starknet::contract_address::ContractAddress",
name: "uid",
type: "core::integer::u128",
kind: "key",
},
{
name: "attester",
name: "caller",
type: "core::starknet::contract_address::ContractAddress",
kind: "key",
},
{
name: "uid",
type: "core::integer::u128",
kind: "data",
},
{
name: "schema_uid",
type: "core::integer::u128",
kind: "key",
},
{
name: "timestamp",
type: "core::integer::u64",
name: "schema_record",
type: "core::byte_array::ByteArray",
kind: "data",
},
],
},
{
type: "event",
name: "contracts::AttestationRegistry::AttestationRegistry::Event",
name: "contracts::SchemaRegistry::SchemaRegistry::Event",
kind: "enum",
variants: [
{
name: "Attested",
type: "contracts::AttestationRegistry::AttestationRegistry::Attested",
name: "Registered",
type: "contracts::SchemaRegistry::SchemaRegistry::Registered",
kind: "nested",
},
],
},
],
},
},
sepolia: {
AttestationRegistry: {
AttestationRegistry: {
address:
"0x077cf1b7bb4ce74559dbbab85714f1d69e520657670639ff77c9e99eedeb13f6",
"0x0415e94910dadd0a9be94dff4e5c762c4ccc034a66ebf424cb011ef885af0f41",
abi: [
{
type: "impl",
Expand Down Expand Up @@ -213,6 +198,22 @@ const deployedContracts = {
],
state_mutability: "external",
},
{
type: "function",
name: "revoke",
inputs: [
{
name: "schema_uid",
type: "core::integer::u128",
},
{
name: "attestation_uid",
type: "core::integer::u128",
},
],
outputs: [],
state_mutability: "external",
},
],
},
{
Expand Down Expand Up @@ -257,6 +258,33 @@ const deployedContracts = {
},
],
},
{
type: "event",
name: "contracts::AttestationRegistry::AttestationRegistry::Revoked",
kind: "struct",
members: [
{
name: "recipient",
type: "core::starknet::contract_address::ContractAddress",
kind: "key",
},
{
name: "attester",
type: "core::starknet::contract_address::ContractAddress",
kind: "key",
},
{
name: "schema_uid",
type: "core::integer::u128",
kind: "key",
},
{
name: "attestation_uid",
type: "core::integer::u128",
kind: "data",
},
],
},
{
type: "event",
name: "contracts::AttestationRegistry::AttestationRegistry::Event",
Expand All @@ -267,18 +295,26 @@ const deployedContracts = {
type: "contracts::AttestationRegistry::AttestationRegistry::Attested",
kind: "nested",
},
{
name: "Revoked",
type: "contracts::AttestationRegistry::AttestationRegistry::Revoked",
kind: "nested",
},
],
},
],
},
SchemaRegistry: {
},
sepolia: {
AttestationRegistry: {
address:
"0x067bdf6bf6f1b72315c541abdc443cdd55992ea29546933ddfec19cb200fce87",
"0x077cf1b7bb4ce74559dbbab85714f1d69e520657670639ff77c9e99eedeb13f6",
abi: [
{
type: "impl",
name: "SchemaRegistryImpl",
interface_name: "contracts::SchemaRegistry::ISchemaRegistry",
name: "AttestationRegistryImpl",
interface_name:
"contracts::AttestationRegistry::IAttestationRegistry",
},
{
type: "struct",
Expand Down Expand Up @@ -314,14 +350,22 @@ const deployedContracts = {
},
{
type: "interface",
name: "contracts::SchemaRegistry::ISchemaRegistry",
name: "contracts::AttestationRegistry::IAttestationRegistry",
items: [
{
type: "function",
name: "register",
name: "attest",
inputs: [
{
name: "schema",
name: "schema_uid",
type: "core::integer::u128",
},
{
name: "recipient",
type: "core::starknet::contract_address::ContractAddress",
},
{
name: "data",
type: "core::byte_array::ByteArray",
},
{
Expand All @@ -338,52 +382,104 @@ const deployedContracts = {
},
{
type: "function",
name: "get_schema",
name: "revoke",
inputs: [
{
name: "uid",
name: "schema_uid",
type: "core::integer::u128",
},
],
outputs: [
{
type: "(core::integer::u128, core::bool, core::byte_array::ByteArray)",
name: "attestation_uid",
type: "core::integer::u128",
},
],
state_mutability: "view",
outputs: [],
state_mutability: "external",
},
],
},
{
type: "constructor",
name: "constructor",
inputs: [
{
name: "schema_registry_address",
type: "core::starknet::contract_address::ContractAddress",
},
],
},
{
type: "event",
name: "contracts::SchemaRegistry::SchemaRegistry::Registered",
name: "contracts::AttestationRegistry::AttestationRegistry::Attested",
kind: "struct",
members: [
{
name: "recipient",
type: "core::starknet::contract_address::ContractAddress",
kind: "key",
},
{
name: "attester",
type: "core::starknet::contract_address::ContractAddress",
kind: "key",
},
{
name: "uid",
type: "core::integer::u128",
kind: "data",
},
{
name: "schema_uid",
type: "core::integer::u128",
kind: "key",
},
{
name: "caller",
type: "core::starknet::contract_address::ContractAddress",
name: "timestamp",
type: "core::integer::u64",
kind: "data",
},
],
},
{
type: "event",
name: "contracts::AttestationRegistry::AttestationRegistry::Revoked",
kind: "struct",
members: [
{
name: "schema_record",
type: "core::byte_array::ByteArray",
name: "recipient",
type: "core::starknet::contract_address::ContractAddress",
kind: "key",
},
{
name: "attester",
type: "core::starknet::contract_address::ContractAddress",
kind: "key",
},
{
name: "schema_uid",
type: "core::integer::u128",
kind: "key",
},
{
name: "attestation_uid",
type: "core::integer::u128",
kind: "data",
},
],
},
{
type: "event",
name: "contracts::SchemaRegistry::SchemaRegistry::Event",
name: "contracts::AttestationRegistry::AttestationRegistry::Event",
kind: "enum",
variants: [
{
name: "Registered",
type: "contracts::SchemaRegistry::SchemaRegistry::Registered",
name: "Attested",
type: "contracts::AttestationRegistry::AttestationRegistry::Attested",
kind: "nested",
},
{
name: "Revoked",
type: "contracts::AttestationRegistry::AttestationRegistry::Revoked",
kind: "nested",
},
],
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/scaffold.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export type ScaffoldConfig = {
};

const scaffoldConfig = {
targetNetworks: [chains.sepolia],
targetNetworks: [chains.devnet],
// Only show the Burner Wallet when running on devnet
onlyLocalBurnerWallet: false,
rpcProviderUrl: process.env.NEXT_PUBLIC_PROVIDER_URL || "",
Expand Down
Loading

0 comments on commit 438231e

Please sign in to comment.