Skip to content

Commit

Permalink
feat: fix trigger update fn
Browse files Browse the repository at this point in the history
  • Loading branch information
alter-eggo committed Jun 30, 2023
1 parent eb7426a commit 5e0b41e
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ withDefaults(defineProps<Props>(), {
isVisible: false,
});
const emit = defineEmits(['close']);
const emit = defineEmits(['close', 'success']);
const { poolGauges } = usePoolStaking();
const { triggerGaugeUpdate } = useCrossChainSync();
const { addTransaction } = useTransactions();
const showCloseBtn = ref(false);
async function triggerUpdate() {
try {
const id = poolGauges.value?.pool.preferentialGauge.id;
Expand All @@ -32,6 +34,8 @@ async function triggerUpdate() {
action: 'userGaugeCheckpoint',
summary: '',
});
emit('success');
return tx;
} catch (e) {
console.error(e);
Expand All @@ -42,7 +46,7 @@ async function triggerUpdate() {
const actions = [
{
label: 'Confirm pool gauge update',
loadingLabel: '',
loadingLabel: 'Confirming pool gauge update',
confirmingLabel: 'Confirming pool gauge update',
action: async () => {
return triggerUpdate();
Expand All @@ -67,7 +71,17 @@ const actions = [
you can also trigger the update by claiming any BAL incentives.
</span>

<BalActionSteps :actions="actions" />
<BalActionSteps :actions="actions" @success="showCloseBtn = true" />

<BalBtn
v-if="showCloseBtn"
color="gray"
outline
block
@click="$emit('close')"
>
{{ $t('close') }}
</BalBtn>
</div>
</BalModal>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type Props = {
defineProps<Props>();
const shouldShowWarningAlert = ref(false);
const shouldShowWarningAlert = ref(true);
const showCheckpointModal = ref(false);
const { networksSyncState, getGaugeWorkingBalance } = useCrossChainSync();
Expand Down Expand Up @@ -120,6 +120,7 @@ onBeforeMount(() => {
<CheckpointGaugeModal
:isVisible="showCheckpointModal"
@close="showCheckpointModal = false"
@success="shouldShowWarningAlert = false"
/>
</div>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ defineEmits(['close']);
class="mb-8"
>
<div>
{{ $t('crossChainBoost.syncInitiatedModal.warningDescription') }}.
{{ $t('crossChainBoost.syncInitiatedModal.warningDescription') }}
</div>
</BalAlert>

Expand Down
5 changes: 4 additions & 1 deletion src/providers/cross-chain-sync.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,10 @@ export const crossChainSyncProvider = () => {
const gaugeContract = new LiquidityGauge(gaugeAddress);

const signer = getSigner();
const tx = await gaugeContract.checkpointUser({ signer, gaugeAddress });
const tx = await gaugeContract.checkpointUser({
signer,
userAddress: account.value,
});

return tx;
}
Expand Down
6 changes: 3 additions & 3 deletions src/services/balancer/contracts/contracts/liquidity-gauge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,17 @@ export class LiquidityGauge {
}

async checkpointUser(payload: {
gaugeAddress: string;
userAddress: string;
signer: JsonRpcSigner;
}): Promise<TransactionResponse> {
const { gaugeAddress, signer } = payload;
const { userAddress, signer } = payload;
const txBuilder = new TransactionBuilder(signer);

return await txBuilder.contract.sendTransaction({
contractAddress: this.address,
abi: this.abi,
action: 'user_checkpoint',
params: [gaugeAddress],
params: [userAddress],
});
}

Expand Down

0 comments on commit 5e0b41e

Please sign in to comment.