Skip to content

Commit

Permalink
fix migration
Browse files Browse the repository at this point in the history
  • Loading branch information
ridev6 committed Aug 8, 2023
1 parent ca2e8ef commit 9eb8c77
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions migrations/wxdefi-435-release/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ const keyLockParamsRecordOld = (userAddress) =>
const keyLockParamsRecord = (userAddress, txId) =>
`%s%s__lock__${userAddress}__${txId}`;

const keyUserGwxAmountTotal = (userAddress) =>
`%s%s__gwxAmountTotal__${userAddress}`;

const lockParamsRecord = ({
amount,
start,
Expand All @@ -58,7 +61,7 @@ const lockParamsRecord = ({

const lockParamsData = await api.addresses.data(boostingAddress, {
matches: encodeURIComponent(
`%s%s__lock__.+`
`%s%s__lock__[^_]+`
),
});

Expand Down Expand Up @@ -86,11 +89,18 @@ for (const { key, value } of lockParamsData) {
if (amount <= 0) continue;

gwxAmountTotal += parseInt(gwxAmount);
actions.push({
key: keyLockParamsRecord(userAddress, 'legacy'),
type: 'string',
value: lockParamsRecord({ amount, start, duration, timestamp, gwxAmount, wxClaimed: 0 }),
});
actions.push(
{
key: keyLockParamsRecord(userAddress, 'legacy'),
type: 'string',
value: lockParamsRecord({ amount, start, duration, timestamp, gwxAmount, wxClaimed: 0 }),
},
{
key: keyUserGwxAmountTotal(userAddress),
type: 'integer',
value: parseInt(gwxAmount),
},
);
}
const chunkSize = 100;
const actionsChunks = Array.from(
Expand Down

0 comments on commit 9eb8c77

Please sign in to comment.