Skip to content

Commit

Permalink
merge release hotfix branch (#1350)
Browse files Browse the repository at this point in the history
* hotfix: enabled zkEVM bridge for testnet (#1337)

* fix stake today card (#1339)

* fix stake today card 2 (#1340)

* hotfix: disabled bridge page for Astar zkEVM (#1341)

* disable layerzero bridge for zkEVM Maintenance  (#1342)

* disable layerzero bridge

* updates

* Re enable bridge (#1344)

* turn off the mainenance mode

* update zkEVM Api

* remove high traffic warning

* Bonus APR calculation fix (#1346)

* Bonus APR calculation fix

* Rename a variable

* hotfix: disabled XCM for Polkadot and relaychain (#1347)

* fix: disabled polkadot xcm (#1349)

* Inflation chart (#1351)

* Inflation chart quick fix

* Apply only on Astar

---------

Co-authored-by: Taegeon Alan Go <[email protected]>
Co-authored-by: Bobo <[email protected]>
  • Loading branch information
3 people authored Jul 9, 2024
1 parent 1bf340e commit 2539ac2
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 15 deletions.
7 changes: 5 additions & 2 deletions src/components/bridge/BridgeSelection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
</div>

<div class="column--selection">
<button :disabled="!isEnableLzBridge">
<button :disabled="!isEnableLzBridge || isBridgeMaintenanceMode">
<component
:is="isEnableLzBridge ? 'router-link' : 'div'"
:is="isEnableLzBridge && !isBridgeMaintenanceMode ? 'router-link' : 'div'"
:to="buildLzBridgePageLink()"
class="button--bridge"
>
Expand Down Expand Up @@ -78,6 +78,9 @@
<p v-if="!isEnableLzBridge" class="text--bridge-details">
{{ $t('bridge.astarBridge.text2') }}
</p>
<p v-if="isBridgeMaintenanceMode" class="text--bridge-details">
{{ $t('bridge.bridgeMaintenanceMode') }}
</p>
</div>
<div v-if="isZkyoto" class="column--selection">
<button :disabled="!isEnableEthBridge">
Expand Down
4 changes: 1 addition & 3 deletions src/components/bridge/ethereum/L1Bridge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,7 @@ export default defineComponent({
const isLoading = computed<boolean>(() => store.getters['general/isLoading']);
const isEnabledWithdrawal = computed<boolean>(() => true);
const isHighTrafficModalOpen = ref<boolean>(false);
const isWarningHighTraffic = computed<boolean>(
() => props.fromChainName === EthBridgeNetworkName.AstarZk
);
const isWarningHighTraffic = computed<boolean>(() => false);
const setHighTrafficModalOpen = (value: boolean): void => {
isHighTrafficModalOpen.value = value;
Expand Down
18 changes: 15 additions & 3 deletions src/components/bridge/layerzero/LzBridge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,27 @@
</ul>
</div>

<div v-if="isBridgeMaintenanceMode" class="row--box-error">
<span class="color--white">
{{ $t('bridge.underMaintenance') }}
</span>
</div>

<div class="row--buttons">
<astar-button
class="button--confirm"
:disabled="isApproved || isDisabledBridge || isHandling || isLoading"
:disabled="
isApproved || isDisabledBridge || isHandling || isLoading || isBridgeMaintenanceMode
"
@click="approve"
>
{{ $t('approve') }}
</astar-button>
<astar-button
class="button--confirm"
:disabled="!isApproved || isDisabledBridge || isHandling || isLoading"
:disabled="
!isApproved || isDisabledBridge || isHandling || isLoading || isBridgeMaintenanceMode
"
@click="bridge"
>
{{ $t('bridge.bridge') }}
Expand All @@ -162,7 +172,7 @@
import { truncate } from '@astar-network/astar-sdk-core';
import { isHex } from '@polkadot/util';
import TokenBalance from 'src/components/common/TokenBalance.vue';
import { useAccount } from 'src/hooks';
import { useAccount, useNetworkInfo } from 'src/hooks';
import { EthBridgeNetworkName, LayerZeroToken, lzBridgeIcon } from 'src/modules/zk-evm-bridge';
import { useStore } from 'src/store';
import { PropType, computed, defineComponent, ref, watch } from 'vue';
Expand Down Expand Up @@ -250,6 +260,7 @@ export default defineComponent({
},
setup(props) {
const { currentAccount } = useAccount();
const { isBridgeMaintenanceMode } = useNetworkInfo();
const nativeTokenSymbol = computed<string>(() => {
return props.fromChainName === LayerZeroNetworkName.AstarEvm ? 'ASTR' : 'ETH';
});
Expand Down Expand Up @@ -310,6 +321,7 @@ export default defineComponent({
truncate,
bridge,
approve,
isBridgeMaintenanceMode,
};
},
});
Expand Down
6 changes: 5 additions & 1 deletion src/hooks/useInflation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ export function useInflation(): UseInflation {
}

const balancesRepository = container.get<IBalancesRepository>(Symbols.BalancesRepository);
const initialTotalIssuance = await balancesRepository.getTotalIssuance(period1StartBlock - 1);
const initialTotalIssuance =
(await balancesRepository.getTotalIssuance(period1StartBlock - 1)) -
(networkNameSubstrate.value.toLowerCase() === 'astar'
? BigInt('350000000000000000000000000')
: BigInt(0)); // Quick fox for token burning event. TODO make a proper solution
const realizedTotalIssuance = await balancesRepository.getTotalIssuance();

const {
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useNetworkInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export function useNetworkInfo() {
});

const isBridgeMaintenanceMode = computed<boolean>(() => {
return isZkyoto.value;
return false;
});

return {
Expand Down
6 changes: 4 additions & 2 deletions src/hooks/xcm/useTransferRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export type TransferMode = 'local' | 'xcm';
export const astarNetworks = ['astar', 'shiden', 'shibuya'];
export const astarNativeTokens = ['sdn', 'astr', 'sby'];
// e.g.: endpointKey.SHIDEN;
const disabledXcmChain: endpointKey | undefined = endpointKey.SHIDEN;
const disabledXcmChains: endpointKey[] | undefined = [endpointKey.SHIDEN, endpointKey.ASTAR];

export interface NetworkFromTo {
from: string;
Expand Down Expand Up @@ -376,7 +376,9 @@ export function useTransferRouter() {
return false;
}

const isDisabledXcmChain = disabledXcmChain === currentNetworkIdx.value;
const isDisabledXcmChain = Boolean(
disabledXcmChains && disabledXcmChains.some((it) => it === currentNetworkIdx.value)
);
const originChain = token.value?.originChain || '';
return checkIsDisabledToken(originChain) || isDisabledXcmChain;
});
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/en-US/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1114,6 +1114,8 @@ export default {
warningHighTraffic:
'High bridge traffic may delay withdrawal transactions up to 5 hours. We appreciate your patience.',
warningHighTrafficMore: '(read more)',
underMaintenance:
'Astar zkEVM is currently under the maintenance. We apologize for any inconvenience.',
modals: {
highTraffic: {
text1:
Expand Down
4 changes: 2 additions & 2 deletions src/modules/zk-evm-bridge/l1-bridge/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ export * from './utils';
export const ZK_EVM_AGGREGATED_BRIDGE_ABI = ABI_ZK_EVM_AGGREGATED_BRIDGE;

export const zkEvmApi = {
testnet: 'https://bridge-api.zkyoto.gelato.digital',
mainnet: 'https://bridge-api.astar-zkevm.gelato.digital',
testnet: 'https://zkyoto-bridge-api.astar.network',
mainnet: 'https://bridge-api.mainnet-astar.com',
};

export enum EthBridgeNetworkName {
Expand Down
12 changes: 11 additions & 1 deletion src/staking-v3/logic/services/DappStakingService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ export class DappStakingService extends SignerService implements IDappStakingSer
const formattedBonusRewardsPoolPerPeriod = weiToToken(
inflationConfiguration.bonusRewardPoolPerPeriod
);
const voteAmount = this.getStakeAmount(protocolState, eraInfo);
const voteAmount = this.getVoteAmount(protocolState, eraInfo);
const bonusPercentPerPeriod = formattedBonusRewardsPoolPerPeriod / voteAmount;
const simulatedBonusPerPeriod = simulatedVoteAmount * bonusPercentPerPeriod;
const periodsPerYear = eraLengths.periodsPerCycle * cyclesPerYear;
Expand Down Expand Up @@ -839,4 +839,14 @@ export class DappStakingService extends SignerService implements IDappStakingSer

return currentStakeAmount;
}

private getVoteAmount(protocolState: ProtocolState, eraInfo: EraInfo): number {
const currentVoteAmount = weiToToken(
protocolState.periodInfo.subperiod === PeriodType.Voting
? eraInfo.nextStakeAmount?.voting ?? BigInt(0)
: eraInfo.currentStakeAmount.voting
);

return currentVoteAmount;
}
}

0 comments on commit 2539ac2

Please sign in to comment.