diff --git a/src/components/Delegations.js b/src/components/Delegations.js index ec5ae3be..839b721e 100644 --- a/src/components/Delegations.js +++ b/src/components/Delegations.js @@ -309,6 +309,10 @@ class Delegations extends React.Component { return this.props.network.authzSupport } + restakeSupport() { + return this.authzSupport() && this.props.network.restakeSupport + } + operatorGrants() { if (!this.state.operatorGrants) return {} return this.props.operators.reduce((sum, operator) => { @@ -328,7 +332,7 @@ class Delegations extends React.Component { } restakePossible() { - return this.props.address && this.state.walletAuthzSupport && this.authzSupport(); + return this.props.address && this.state.walletAuthzSupport && this.restakeSupport(); } totalRewards(validators) { @@ -412,6 +416,11 @@ class Delegations extends React.Component { const alerts = ( <> + {this.props.network.restakeAlert && ( + + {this.props.network.restakeAlert} + + )} {!this.authzSupport() && ( {this.props.network.prettyName} doesn't support Authz just yet. You can stake and compound manually, REStake will update automatically when support is added. diff --git a/src/components/NetworkChecks.js b/src/components/NetworkChecks.js index 03ad26af..d19655fb 100644 --- a/src/components/NetworkChecks.js +++ b/src/components/NetworkChecks.js @@ -41,9 +41,9 @@ function NetworkChecks(props) { failTitle: "No REStake operators", failDescription: "There are no operators for this network yet. You can stake and compound manually in the meantime." } - if(!network.authzSupport && network.operatorCount > 0){ + if(!network.restakeSupport && network.operatorCount > 0){ operatorCheck.failTitle = operatorCheck.title, - operatorCheck.failDescription = "Authz is disabled but there are operators ready when support is added." + operatorCheck.failDescription = `${network.authzSupport ? 'REStake' : 'Authz'} is disabled but there are operators ready when support is added.` } const testedCheck = { @@ -89,7 +89,7 @@ function NetworkChecks(props) { }), renderCheck({ ...operatorCheck, - state: network.authzSupport && network.operatorCount > 0, + state: network.restakeSupport && network.operatorCount > 0, identifier: 'operators' }), renderCheck({ diff --git a/src/components/NetworkSelect.js b/src/components/NetworkSelect.js index 4f7cec20..b82ffa5a 100644 --- a/src/components/NetworkSelect.js +++ b/src/components/NetworkSelect.js @@ -168,7 +168,7 @@ function NetworkSelect(props) { {network.label} {!network.online && (Offline)}
- {network.operatorCount > 0 && + {network.restakeSupport && network.operatorCount > 0 && {network.operatorCount} Operator{network.operatorCount > 1 ? 's' : ''} }
diff --git a/src/components/REStakeStatus.js b/src/components/REStakeStatus.js index 34ac7a8f..79b5b98d 100644 --- a/src/components/REStakeStatus.js +++ b/src/components/REStakeStatus.js @@ -78,7 +78,7 @@ function REStakeStatus(props) { ) }else{ content = - tooltip = 'This validator is not a REStake operator' + tooltip = !network.restakeSupport ? "REStake is not supported at this time" : "This validator is not a REStake operator" } return ( @@ -93,4 +93,4 @@ function REStakeStatus(props) { ) } -export default REStakeStatus \ No newline at end of file +export default REStakeStatus diff --git a/src/components/ValidatorProfile.js b/src/components/ValidatorProfile.js index bcf8660b..14f2fb33 100644 --- a/src/components/ValidatorProfile.js +++ b/src/components/ValidatorProfile.js @@ -91,7 +91,7 @@ function ValidatorProfile(props) { ) : - } identifier={validator.operator_address} tooltip="This validator is not a REStake operator" /> + } identifier={validator.operator_address} tooltip={!network.restakeSupport ? "REStake is not supported at this time" : "This validator is not a REStake operator"}/> } diff --git a/src/components/ValidatorStake.js b/src/components/ValidatorStake.js index 33c155a6..06b64d02 100644 --- a/src/components/ValidatorStake.js +++ b/src/components/ValidatorStake.js @@ -278,7 +278,7 @@ function ValidatorStake(props) { } identifier={validator.operator_address} - tooltip="This validator is not a REStake operator" + tooltip={!network.restakeSupport ? "REStake is not supported at this time" : "This validator is not a REStake operator"} /> )} diff --git a/src/networks.json b/src/networks.json index 60fc90a1..5e428097 100644 --- a/src/networks.json +++ b/src/networks.json @@ -315,7 +315,12 @@ }, { "name": "dydx", - "ownerAddress": "dydxvaloper15wphegl8esn7r2rgj9j3xf870v78lxg8yfjn95" + "ownerAddress": "dydxvaloper15wphegl8esn7r2rgj9j3xf870v78lxg8yfjn95", + "aminoPreventTypes": [ + "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission" + ], + "restakeEnabled": false, + "restakeAlert": "dYdX rewards are paid in USDC which cannot be automatically swapped to DYDX at this time. Auto-compounding is disabled for now." }, { "name": "celestia", diff --git a/src/utils/Chain.mjs b/src/utils/Chain.mjs index 415b92d8..34e718f1 100644 --- a/src/utils/Chain.mjs +++ b/src/utils/Chain.mjs @@ -19,6 +19,7 @@ const Chain = (data) => { gov: sdk46OrLater ? 'v1' : 'v1beta1', ...data.apiVersions || {} } + const restakeSupport = authzSupport && (data.restakeEnabled ?? true) return { ...data, @@ -35,6 +36,7 @@ const Chain = (data) => { authzAminoLiftedValues, authzAminoExecPreventTypes, apiVersions, + restakeSupport, denom: data.denom || baseAsset?.base?.denom, display: data.display || baseAsset?.display?.denom, symbol: data.symbol || baseAsset?.symbol, diff --git a/src/utils/Network.mjs b/src/utils/Network.mjs index fcf3172f..fe6f76e2 100644 --- a/src/utils/Network.mjs +++ b/src/utils/Network.mjs @@ -65,10 +65,15 @@ class Network { this.validators = (await this.directory.getValidators(this.name)).map(data => { return Validator(this, data) }) - this.operators = (this.data.operators || this.validators.filter(el => el.restake && this.allowOperator(el.operator_address))).map(data => { + const operators = (this.data.operators || this.validators.filter(el => el.restake && this.allowOperator(el.operator_address))).map(data => { return Operator(this, data) }) - this.operatorCount = this.operators.length + this.operatorCount = operators.length + if(this.restakeSupport){ + this.operators = operators + }else{ + this.operators = [] + } } async setChain(data){ @@ -94,6 +99,8 @@ class Network { this.authzAminoLiftedValues = this.chain.authzAminoLiftedValues this.authzAminoExecPreventTypes = this.chain.authzAminoExecPreventTypes this.aminoPreventTypes = this.chain.aminoPreventTypes + this.restakeSupport = this.chain.restakeSupport + this.restakeAlert = data.restakeAlert this.txTimeout = this.data.txTimeout || 60_000 this.keywords = this.buildKeywords()