Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
fix(fees): fix fees in devnet
Browse files Browse the repository at this point in the history
  • Loading branch information
dtfiedler committed Apr 24, 2024
1 parent 576b630 commit 7c44d0f
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/actions/write/evolveState.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BLOCKS_PER_DAY, NON_CONTRACT_OWNER_MESSAGE } from '../../constants';
import { ContractWriteResult, IOState, PstAction } from '../../types';
import { NON_CONTRACT_OWNER_MESSAGE } from '../../constants';
import { ContractWriteResult, Fees, IOState, PstAction } from '../../types';

// Updates this contract to new source code
export const evolveState = async (
Expand All @@ -12,16 +12,14 @@ export const evolveState = async (
throw new ContractError(NON_CONTRACT_OWNER_MESSAGE);
}

for (const [address, gateway] of Object.entries(state.gateways)) {
if (gateway.status === 'leaving') {
// fix the expiration to 21 days (was set at 90)
const currentEndFor90Days = gateway.end;
const correctEndFor21Days =
currentEndFor90Days - 69 * BLOCKS_PER_DAY + 4 * BLOCKS_PER_DAY; // add 4 days given the mistake
state.gateways[address].end = correctEndFor21Days;
state.gateways[address].vaults[address].end = correctEndFor21Days;
}
}
const updatedFees = Object.keys(state.fees).reduce((acc: Fees, key) => {
const existingFee = state.fees[key];
// convert the base fee to mIO
acc[key] = existingFee / 1_000_000;
return acc;
}, {});

state.fees = updatedFees;

return { state };
};

0 comments on commit 7c44d0f

Please sign in to comment.