Skip to content

Commit

Permalink
auction: identify locked up names
Browse files Browse the repository at this point in the history
  • Loading branch information
rithvikvibhu committed Feb 2, 2024
1 parent 2f771be commit 25ce9ca
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 9 deletions.
1 change: 1 addition & 0 deletions app/background/node/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ export class NodeService extends EventEmitter {
listen: this.networkName === 'regtest', // improves remote rpc dev/testing
chainMigrate: 3,
walletMigrate: 2,
walletIcannlockup: true,
maxOutbound: 4,
compactTreeOnInit: true,
});
Expand Down
28 changes: 25 additions & 3 deletions app/pages/Auction/BidActionPanel/Reserved.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,48 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { shell } from 'electron';
import {
AuctionPanel,
} from '../../../components/AuctionPanel';
import {I18nContext} from "../../../utils/i18n";
import { I18nContext } from "../../../utils/i18n";

const INFO_URL = 'https://heytx.substack.com/p/the-happening-event-for-handshake';

export default class Reserved extends Component {
static propTypes = {
domain: PropTypes.object.isRequired,
name: PropTypes.string.isRequired,
locked: PropTypes.bool.isRequired,
};

static contextType = I18nContext;

render() {
const { t } = this.context;
const { locked } = this.props;

return (
<AuctionPanel className="domains__action-panel__reserved">
<div className="domains__action-panel__reserved-text">
{this.context.t('reservedText')}
{locked ? t('lockedText') : t('reservedText')}
</div>
<div className="domains__action-panel__reserved-timestamp">
{this.context.t('reservedTimestamp')}
{locked ?
<>
<span>
{t('lockedDescription')}
</span>
<p>
<a
className="anchor"
onClick={() => shell.openExternal(INFO_URL)}
>
{t('learnMore')}
</a>
</p>
</>
: t('reservedTimestamp')
}
</div>
</AuctionPanel>
);
Expand Down
7 changes: 4 additions & 3 deletions app/pages/Auction/BidActionPanel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import { withRouter } from 'react-router';
import { connect } from 'react-redux';
import c from 'classnames';
import { isAvailable, isBidding, isClosed, isOpening, isReserved, isReveal } from '../../../utils/nameHelpers';
import { isAvailable, isBidding, isClosed, isOpening, isReserved, isLockedUp, isReveal } from '../../../utils/nameHelpers';
import * as watchingActions from '../../../ducks/watching';
import OpenBid from './OpenBid';
import BidNow from './BidNow';
Expand Down Expand Up @@ -81,9 +81,10 @@ class BidActionPanel extends Component {
renderActionPanel() {
const {domain} = this.props;
const name = this.props.match.params.name;
const locked = isLockedUp(domain);

if (isReserved(domain)) {
return <Reserved domain={domain} name={name} />;
if (isReserved(domain) || locked) {
return <Reserved domain={domain} name={name} locked={locked} />;
}

if (this.isOwned()) {
Expand Down
1 change: 1 addition & 0 deletions app/pages/Auction/domains.scss
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
font-size: 1.25rem;
font-weight: 600;
padding: .4rem 0 .2rem;
text-transform: capitalize;
}

&__description {
Expand Down
7 changes: 5 additions & 2 deletions app/pages/Auction/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
isComingSoon,
isOpening,
isReserved,
isLockedUp,
isReveal,
} from '../../utils/nameHelpers';
import BidActionPanel from './BidActionPanel';
Expand Down Expand Up @@ -138,7 +139,7 @@ export default class Auction extends Component {
renderAuctionRight = () => {
const {domain} = this.props;

if (isReserved(domain)) {
if (isReserved(domain) || isLockedUp(domain)) {
return <BidActionPanel domain={domain} />;
}

Expand Down Expand Up @@ -273,7 +274,7 @@ export default class Auction extends Component {
return (
<div className={className}>
<div className={`${className}__label`}>{title}:</div>
<div className={`${className}__status`}>{content}</div>
<div className={`${className}__status`}>{content?.toLowerCase?.()}</div>
<div className={`${className}__description`}>{description}</div>
</div>
);
Expand Down Expand Up @@ -313,6 +314,8 @@ export default class Auction extends Component {
{t('reservedCTAText')}
</button>
);
} else if (isLockedUp(domain)) {
status = t('locked');
} else if (isOpening(domain)) {
status = t('opening');
description = t('biddingSoon');
Expand Down
22 changes: 21 additions & 1 deletion app/utils/nameHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const isAvailable = name => {
return false;
}

if (start.reserved) {
if (start.reserved || start.locked) {
return false;
}

Expand Down Expand Up @@ -61,6 +61,26 @@ export const isReserved = name => {
return !!start.reserved;
};

export const isLockedUp = name => {
const {start} = name || {};
const {info} = name || {};

// Maybe already claimed
if (isClosed(name))
return false;

// Not available if start is undefined
if (!start) {
return false;
}

if (info) {
return false;
}

return !!start.locked;
}

export const isOpening = name => checkState(name, states.OPENING);
export const isBidding = name => checkState(name, states.BIDDING);
export const isReveal = name => checkState(name, states.REVEAL);
Expand Down
2 changes: 2 additions & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@
"loadingBalance": "Loading balance...",
"loadingNDomains": "Loading %s domains...",
"locked": "LOCKED",
"lockedDescription": "The Handshake network activated a soft fork in 2023 that locked a subset of the reserved names to remain locked up (unavailable for auction) till 2028.",
"lockedText": "Locked by the ICANN Soft Fork",
"locktime": "Locktime",
"lockup": "Lockup",
"logDownloadSuccess": "Log file saved to %s.",
Expand Down

0 comments on commit 25ce9ca

Please sign in to comment.