Skip to content

Commit

Permalink
Merge pull request #92 from DarkFlorist/immutable-star
Browse files Browse the repository at this point in the history
almost immutable
  • Loading branch information
KillariDev authored Dec 9, 2024
2 parents 041075f + 22fe33c commit 819d452
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 16 deletions.
6 changes: 1 addition & 5 deletions app/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
border-radius: 25px;
margin-inline: auto;
justify-content: center;
margin-bottom: 0px;
}
div {
display: flex;
Expand Down Expand Up @@ -162,11 +163,6 @@ body {
flex-direction: column;
}

a {
color: inherit;
text-decoration: inherit;
}

.text-white:hover {
text-decoration: underline;
}
Expand Down
11 changes: 9 additions & 2 deletions app/ts/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface WalletComponentProps {
}

const WalletComponent = ({ maybeAccountAddress, loadingAccount, isWindowEthereum }: WalletComponentProps) => {
if (!isWindowEthereum.value) return <p class = 'paragraph'> An Ethereum enabled wallet is required to make immutable domains.</p>
if (!isWindowEthereum.value) return <p class = 'paragraph'> An Ethereum enabled wallet is required to make almost* immutable domains.</p>
if (loadingAccount.value) return <></>
const connect = async () => {
maybeAccountAddress.deepValue = await requestAccounts()
Expand Down Expand Up @@ -207,7 +207,7 @@ export function App() {
<div class = 'petal-lock'>
<img src = 'favicon.svg' alt = 'Icon' style ='width: 60px;'/> PetalLock
</div>
<p class = 'sub-title'>Make immutable ENS domains and subdomains</p>
<p class = 'sub-title'>Make almost* immutable ENS domains and subdomains</p>
</div>

<input
Expand Down Expand Up @@ -242,6 +242,13 @@ export function App() {
extending = { extending }
/>
</div>
<div class = 'text-white/50 text-center'>
<p style = 'max-width: 700px;'>*)
There are two bugs in the Ethereum Name Service (ENS) that allow the ENS DAO to seize ENS names. These flaws make it impossible to create truly immutable names.
<br/>
<a href = 'https://discuss.ens.domains/t/temp-check-executable-revoke-the-daos-ability-to-upgrade-the-name-wrapper/19920/8'>https://discuss.ens.domains/t/temp-check-executable-revoke-the-daos-ability-to-upgrade-the-name-wrapper/19920/8</a>
</p>
</div>
<div class = 'text-white/50 text-center'>
<div class = 'mt-8'>
PetalLock by&nbsp;
Expand Down
40 changes: 31 additions & 9 deletions app/ts/components/requirements.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,36 @@ export const ParentRequirements = ( { checkBoxes, fuses } : { checkBoxes: Parent
</>
}

export const EnsRequirements = () => {
return <>
<p class = 'subdomain-header'> Ethereum Name Service </p>
<div class = 'grid-container'>
<div class = 'grid-item' style = 'justify-self: start'>
<div style = 'display: grid; grid-template-rows: auto auto;'>
<label class = 'form-control'>
<input type = 'checkbox' name = 'switch' class = 'check' checked = { false } disabled = { true }/>
<p class = 'paragraph checkbox-text requirement'>
Convince ENS DAO to fix the bug reported in <a href = 'https://discuss.ens.domains/t/temp-check-executable-revoke-the-daos-ability-to-upgrade-the-name-wrapper/19920/8'>the-daos-ability-to-upgrade-the-name-wrapper</a> so they cannot rug you.
</p>
</label>
</div>
</div>
</div>
</>
}


export const Requirements = ({ checkBoxesArray } : { checkBoxesArray: OptionalSignal<CheckBoxes> }) => {
const allCheckBoxes = checkBoxesArray.deepValue
if (allCheckBoxes === undefined) return <></>
return <div class = 'grid-container-bordered'> { [...allCheckBoxes].reverse().map((check, index) => {
const fuses = getRequiredFusesWithoutApproval(allCheckBoxes.length - index - 1, allCheckBoxes.map((c) => c.domainInfo))
if (check.type === 'parent') return <ParentRequirements checkBoxes = { check } fuses = { fuses }/>
return <ChildRequirements checkBoxes = { check } fuses = { fuses }/>
}) } </div>
return <div class = 'grid-container-bordered'>
{ [...allCheckBoxes].reverse().map((check, index) => {
const fuses = getRequiredFusesWithoutApproval(allCheckBoxes.length - index - 1, allCheckBoxes.map((c) => c.domainInfo))
if (check.type === 'parent') return <ParentRequirements checkBoxes = { check } fuses = { fuses }/>
return <ChildRequirements checkBoxes = { check } fuses = { fuses }/>
}) }
<EnsRequirements/>
</div>
}

interface RequirementProps {
Expand Down Expand Up @@ -123,7 +145,7 @@ export const Immutable = ( { checkBoxesArray } : { checkBoxesArray: OptionalSign
<div style = 'padding-top: 30px; padding-bottom: 30px; align-items: center; display: grid; width: 100%'>
{ checkBoxes.immutable ? <>
<p class = 'status-green'>
{`IMMUTABLE for about ${ dateDiff } (until ${ dateString })` }
{`Almost* IMMUTABLE for about ${ dateDiff } (until ${ dateString })` }
</p>
</>: <p class = 'status-red'> NOT IMMUTABLE </p> }
</div>
Expand Down Expand Up @@ -287,7 +309,7 @@ const NonImmutableDomain = ({ checkBoxes, maybeAccountAddress, updateInfos, crea
const domainExistIssue = useComputed(() => {
const first = checkBoxes.deepValue?.at(0)
if (first === undefined || first.exists) return undefined
return ` - The domain ${ first.domainInfo.subDomain } need to be created before you can use PetalLock to create immutable subdomains under it`
return ` - The domain ${ first.domainInfo.subDomain } need to be created before you can use PetalLock to create almost* immutable subdomains under it`
})
const contentSetProperly = useComputed(() => {
if (resolutionAddressInput.value.length === 0 && validContenthash.value) return true
Expand All @@ -298,7 +320,7 @@ const NonImmutableDomain = ({ checkBoxes, maybeAccountAddress, updateInfos, crea

return <div key = 'dialog' style = 'width: 100%'>
<div style = 'padding: 10px; width: 100%'>
<p style = 'margin: 0; font-size: 24px; padding-bottom: 10px'> Make the domain immutable! </p>
<p style = 'margin: 0; font-size: 24px; padding-bottom: 10px'> Make the domain almost* immutable! </p>
<div style = 'display: grid; width: 100%; gap: 10px; padding-bottom: 10px;'>
<p style = 'margin: 0;'>{ `Content hash:` }</p>
<input
Expand Down Expand Up @@ -333,7 +355,7 @@ const NonImmutableDomain = ({ checkBoxes, maybeAccountAddress, updateInfos, crea
<DisplayError message = { ownershipIssues } />
<SwitchAddress requirementsMet = { loadingInfos.value } maybeAccountAddress = { maybeAccountAddress } maybeSigningAddress = { maybeSigningAddress }/>
</div>
<button style = 'font-size: 3em;' class = 'button is-primary' disabled = { ownershipIssues.value !== undefined || wrappedIssues.value !== undefined || areContractsDeployed.value !== true || !contentSetProperly.value || !rightAddress.value || checkBoxes.deepValue === undefined || loadingInfos.value || creating.value } onClick = { makeImmutable }> Make immutable { creating.value ? <Spinner/> : <></> }</button>
<button style = 'font-size: 3em;' class = 'button is-primary' disabled = { ownershipIssues.value !== undefined || wrappedIssues.value !== undefined || areContractsDeployed.value !== true || !contentSetProperly.value || !rightAddress.value || checkBoxes.deepValue === undefined || loadingInfos.value || creating.value } onClick = { makeImmutable }> Make almost* immutable { creating.value ? <Spinner/> : <></> }</button>
</div>
}

Expand Down

0 comments on commit 819d452

Please sign in to comment.