Skip to content

Commit

Permalink
feat: add badge for UP Grave in list of controllers 😊 (#100)
Browse files Browse the repository at this point in the history
* feat: add badge for UP Grave 😊

* add: useEffect + state for LSP1 Grave Forwarder

---------

Co-authored-by: Felix Hildebrandt <[email protected]>
  • Loading branch information
CJ42 and fhildeb authored Apr 8, 2024
1 parent 9580faf commit bec914c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
13 changes: 12 additions & 1 deletion components/AddressInfos/AddressInfos.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import useWeb3 from '../../hooks/useWeb3';
import {
EXPLORER_BASE_URL,
LSP1_DELEGATE_VERSIONS,
LSP1_GRAVE_FORWARDER,
UP_RECOVERY_ADDRESSES,
} from '../../globals';
import { checkInterface, getData } from '../../utils/web3';
Expand Down Expand Up @@ -80,6 +81,7 @@ const AddressInfos: React.FC<Props> = ({ address }) => {
const [isLSP8, setIsLSP8] = useState(false);
const [assetName, setAssetName] = useState('');
const [assetSymbol, setAssetSymbol] = useState('');
const [isLSP1GraveForwarder, setIsLSP1GraveForwarder] = useState(false);

const checkAddressInterface = async (_address: string) => {
if (!web3 || !_address) {
Expand Down Expand Up @@ -125,6 +127,7 @@ const AddressInfos: React.FC<Props> = ({ address }) => {
useEffect(() => {
if (!address) return;
setIsLoading(true);
setIsLSP1GraveForwarder(address === LSP1_GRAVE_FORWARDER);

checkAddressInterface(address)
.then(() => setIsLoading(false))
Expand All @@ -133,7 +136,6 @@ const AddressInfos: React.FC<Props> = ({ address }) => {

const isUPRecovery = recoveryAddresses.includes(address);
const isLSP1Delegate = Object.keys(LSP1_DELEGATE_VERSIONS).includes(address);

const addressTypeText = isEOA ? 'πŸ”‘ EOA' : 'πŸ“„ Contract';

const explorerLink = `${EXPLORER_BASE_URL[network.name]}/address/${address}`;
Expand Down Expand Up @@ -162,6 +164,15 @@ const AddressInfos: React.FC<Props> = ({ address }) => {
/>
)}

{isLSP1GraveForwarder && (
<AddressTypeBadge
text="πŸ‘» - LSP1 Grave Forwarder"
colorClass="is-danger"
isLight={true}
contractVersion="0.14.0"
/>
)}

{isLSP7 && (
<>
<AddressTypeBadge
Expand Down
4 changes: 4 additions & 0 deletions globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,7 @@ export const LSP1_DELEGATE_VERSIONS = {
'0xA5467dfe7019bF2C7C5F7A707711B9d4cAD118c8': '0.12.1',
'0x7870C5B8BC9572A8001C3f96f7ff59961B23500D': '0.14.0',
};

// Mainnet
export const LSP1_GRAVE_FORWARDER =
'0x42562196ee7AaC3E8501db777B25ffc976ed8463';

0 comments on commit bec914c

Please sign in to comment.