Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend/.astro/types.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/// <reference types="astro/client" />
/// <reference path="content.d.ts" />
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export function AddAttestationDialog({
children: React.ReactElement;
}) {
const [open, setOpen] = useState(false);
const [errorDisplayText, setErrorDisplayText] = useState<string | null>(null);
const {
createAttestation,
isPending,
Expand All @@ -66,11 +67,27 @@ export function AddAttestationDialog({
});

const onSubmit = async (values: FormValues) => {
await createAttestation(
recipient as `0x${string}`,
values.badgeName,
values.justification
);
try {
setErrorDisplayText(null);
await createAttestation(
recipient as `0x${string}`,
values.badgeName,
values.justification
);
} catch (e) {
const message = (e as Error)?.message || String(e);
const isRpcRevert =
message.includes("Internal JSON-RPC error") ||
message.includes('Contract function "attest" reverted') ||
message.toLowerCase().includes("revert");
if (isRpcRevert) {
setErrorDisplayText(
"The network temporarily rejected this request. Please try again later."
);
} else {
setErrorDisplayText(message);
}
}
};

useEffect(() => {
Expand All @@ -80,6 +97,7 @@ export function AddAttestationDialog({
setOpen(false);
form.reset();
reset();
setErrorDisplayText(null);
}
}, [
isConfirmed,
Expand Down Expand Up @@ -168,7 +186,9 @@ export function AddAttestationDialog({
Waiting for confirmations…
</p>
) : null}
{error ? (
{errorDisplayText ? (
<p className="text-sm text-red-600">{errorDisplayText}</p>
) : error ? (
<p className="text-sm text-red-600">{(error as Error).message}</p>
) : null}
</form>
Expand Down
3 changes: 2 additions & 1 deletion the-guild-smart-contracts/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ CREATE2_SALT=1
# Generic fallback for any other network (used if chain isn't matched)
EAS_ADDRESS=

# AMOY URL
# RPC URLS
AMOY_RPC_URL=https://polygon-amoy.drpc.org
BASE_SEPOLIA_URL=https://base-sepolia.therpc.io

# ETHERSCAN KEY
ETHERSCAN_API_KEY=
1 change: 1 addition & 0 deletions the-guild-smart-contracts/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ out/
!/broadcast
/broadcast/*/31337/
/broadcast/*/80002/
/broadcast/*/84532/
/broadcast/**/dry-run/

# Docs
Expand Down
24 changes: 24 additions & 0 deletions the-guild-smart-contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,30 @@ https://amoy.polygonscan.com/address/0xc142ab6b4688b7b81cb4cc8b305f517bba3bfd25
EAS Schema ID:
0xb167f07504166f717f2a2710dbcfbfdf8fad6e8c6128c1a7fa80768f61b1d0b2

### Amoy for dev
Salt: "theguild_v_0.1.1_dev"

TheGuildActivityToken
https://amoy.polygonscan.com/address/0x82eba5400b4e914a9b5e4573867b9a73c488c1ed

TheGuildBadgeRegistry
https://amoy.polygonscan.com/address/0x8ac95734e778322684f1d318fb7633777baa8427

EAS Schema ID:
0x8ef2fdb896e42534302cc992c2b2daf614ccabf3fc6d78ce15dc35534b8fa481

### Base Sepolia
Salt: "theguild_v_0.1.1"

TheGuildActivityToken
https://amoy.polygonscan.com/address/0xba838e90ca2a84aed0de2119e7e6f53b9174ce42

TheGuildBadgeRegistry
https://amoy.polygonscan.com/address/0xc142ab6b4688b7b81cb4cc8b305f517bba3bfd25

EAS Schema ID:
0x7d76e8bb0a26aa015c4adff8564d236d53689e99c3f4b4e2802d99f0144bce8e

## Foundry Usage

https://book.getfoundry.sh/
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions the-guild-smart-contracts/deployBaseSepolia.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
source .env
forge script --chain base-sepolia script/FullDeploymentScript.s.sol:FullDeploymentScript --rpc-url $BASE_SEPOLIA_URL --broadcast --verify -vvvv --interactives 1
4 changes: 3 additions & 1 deletion the-guild-smart-contracts/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ remappings = [

[rpc_endpoints]
amoy = "${AMOY_RPC_URL}"
base-sepolia="${BASE_SEPOLIA_URL}"

[etherscan]
amoy = { key = "${ETHERSCAN_API_KEY}" }
amoy = { key = "${ETHERSCAN_API_KEY}" }
base-sepolia = { key = "${ETHERSCAN_API_KEY}" }
7 changes: 2 additions & 5 deletions the-guild-smart-contracts/script/FullDeploymentScript.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ contract FullDeploymentScript is Script {
}

// Register TheGuild Schema
string memory schema = "bytes32 badgeName, bytes32 justification";
string memory schema = "bytes32 badgeName, bytes justification";
SchemaRegistry schemaRegistry = SchemaRegistry(
EASUtils.getSchemaRegistryAddress(vm)
);
Expand Down Expand Up @@ -78,10 +78,7 @@ contract FullDeploymentScript is Script {
expirationTime: 0,
revocable: true,
refUID: bytes32(0),
data: abi.encode(
bytes32("Rust"),
bytes32("Saw them coding in Rust")
),
data: abi.encode(bytes32("Rust"), bytes("Saw them coding in Rust")),
value: 0
});

Expand Down
1 change: 1 addition & 0 deletions the-guild-smart-contracts/script/utils/EASUtils.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pragma solidity ^0.8.13;

import "forge-std/Vm.sol";

// https://github.com/ethereum-attestation-service/eas-contracts
library EASUtils {
function getEASAddress(Vm vm) internal view returns (address) {
// Base and Optimism chains use canonical predeploy
Expand Down
Loading