diff --git a/projects/subgraph-basin/src/utils/Well.ts b/projects/subgraph-basin/src/utils/Well.ts
index bc7d5c276b..6dd907913b 100644
--- a/projects/subgraph-basin/src/utils/Well.ts
+++ b/projects/subgraph-basin/src/utils/Well.ts
@@ -197,7 +197,9 @@ export function incrementWellWithdraw(wellAddress: Address): void {
export function checkForSnapshot(wellAddress: Address, timestamp: BigInt, blockNumber: BigInt): void {
// We check for the prior period snapshot and then take one if needed
- let dayID = dayFromTimestamp(timestamp) - 1;
+ // Schedule the "day" to begin at 9am PT/12pm ET.
+ // Future work could include properly adjusting this when DST occurs.
+ let dayID = dayFromTimestamp(timestamp, 8 * 60 * 60) - 1;
let hourID = hourFromTimestamp(timestamp) - 1;
let well = loadWell(wellAddress);
diff --git a/projects/subgraph-core/utils/Dates.ts b/projects/subgraph-core/utils/Dates.ts
index fbc08e918d..b298406b11 100644
--- a/projects/subgraph-core/utils/Dates.ts
+++ b/projects/subgraph-core/utils/Dates.ts
@@ -1,7 +1,14 @@
import { BigInt } from "@graphprotocol/graph-ts";
-export function dayFromTimestamp(timestamp: BigInt): i32 {
- let day_ts = timestamp.toI32() - (timestamp.toI32() % 86400);
+/**
+ * Optionally accepts an offset, which adjusts the start of the day from UTC 00:00.
+ * @param timestamp - the timestamp to extract the day from
+ * @param offset - how much sooner the day should roll over (relative to UTC)
+ * for example, for PST (UTC-7), an appropriate offset would be -7 * 60 * 60.
+ * This would make the day roll over 7 hours later.
+ */
+export function dayFromTimestamp(timestamp: BigInt, offset: i32 = 0): i32 {
+ let day_ts = timestamp.toI32() + offset - ((timestamp.toI32() + offset) % 86400);
return day_ts / 86400;
}
diff --git a/projects/ui/src/components/Balances/SiloBalances.tsx b/projects/ui/src/components/Balances/SiloBalances.tsx
index e6a6e139fc..07d886a8ad 100644
--- a/projects/ui/src/components/Balances/SiloBalances.tsx
+++ b/projects/ui/src/components/Balances/SiloBalances.tsx
@@ -20,17 +20,17 @@ import {
UNRIPE_BEAN_WETH,
} from '~/constants/tokens';
import useWhitelist from '~/hooks/beanstalk/useWhitelist';
-import { BeanstalkPalette, IconSize } from '../App/muiTheme';
import Fiat from '~/components/Common/Fiat';
-import Row from '../Common/Row';
import { displayFullBN, displayTokenAmount } from '~/util';
-import TokenIcon from '../Common/TokenIcon';
import { AppState } from '~/state';
import { ONE_BN, ZERO_BN } from '~/constants';
import useFarmerStalkByToken from '~/hooks/farmer/useFarmerStalkByToken';
import useGetChainToken from '~/hooks/chain/useGetChainToken';
import useUnripeUnderlyingMap from '~/hooks/beanstalk/useUnripeUnderlying';
+import TokenIcon from '../Common/TokenIcon';
+import Row from '../Common/Row';
+import { BeanstalkPalette, IconSize } from '../App/muiTheme';
import Stat from '../Common/Stat';
const ARROW_CONTAINER_WIDTH = 20;
@@ -243,7 +243,9 @@ const SiloBalances: React.FC<{}> = () => {
)}
- {token.symbol}
+
+ {token.symbol}
+
{/**
diff --git a/projects/ui/src/components/Barn/Actions/Transfer.tsx b/projects/ui/src/components/Barn/Actions/Transfer.tsx
index f33b5921c2..270787cdb2 100644
--- a/projects/ui/src/components/Barn/Actions/Transfer.tsx
+++ b/projects/ui/src/components/Barn/Actions/Transfer.tsx
@@ -27,19 +27,19 @@ import { useFetchFarmerBarn } from '~/state/farmer/barn/updater';
import { FertilizerBalance } from '~/state/farmer/barn';
export type TransferFormValues = {
- fertilizerIds: number[];
- amounts: number[];
- to: string | null;
- totalSelected: number;
+ fertilizerIds: number[];
+ amounts: number[];
+ to: string | null;
+ totalSelected: number;
};
export type FullFertilizerBalance = FertilizerBalance & {
- pctRepaid: BigNumber,
- status: string,
- humidity: BigNumber,
- debt: BigNumber,
- sprouts: BigNumber,
- rinsableSprouts: BigNumber
+ pctRepaid: BigNumber;
+ status: string;
+ humidity: BigNumber;
+ debt: BigNumber;
+ sprouts: BigNumber;
+ rinsableSprouts: BigNumber;
};
const TransferForm: FC> = ({
@@ -48,7 +48,7 @@ const TransferForm: FC> = ({
isSubmitting,
}) => {
const sdk = useSdk();
-
+
/// Data
const beanstalkBarn = useSelector(
(state) => state._beanstalk.barn
@@ -70,8 +70,12 @@ const TransferForm: FC> = ({
);
/// Derived
- const isReady = values.fertilizerIds && values.to && values.amounts && isValid;
- const totalFertAmount = values.amounts.reduce((total, current) => (current || 0) + total, 0);
+ const isReady =
+ values.fertilizerIds && values.to && values.amounts && isValid;
+ const totalFertAmount = values.amounts.reduce(
+ (total, current) => (current || 0) + total,
+ 0
+ );
const fertilizers = useMemo(() => {
const output: FullFertilizerBalance[] = [];
@@ -79,9 +83,7 @@ const TransferForm: FC> = ({
const pct = pctRepaid(balance);
const status = pct.eq(1) ? 'used' : 'active';
const humidity = balance.token.humidity;
- const debt = balance.amount.multipliedBy(
- humidity.div(100).plus(1)
- );
+ const debt = balance.amount.multipliedBy(humidity.div(100).plus(1));
const sprouts = debt.multipliedBy(ONE_BN.minus(pct));
const rinsableSprouts = debt.multipliedBy(pct);
@@ -92,7 +94,7 @@ const TransferForm: FC> = ({
humidity: humidity,
debt: debt,
sprouts: sprouts,
- rinsableSprouts: rinsableSprouts
+ rinsableSprouts: rinsableSprouts,
};
output.push(fullBalance);
@@ -102,11 +104,16 @@ const TransferForm: FC> = ({
const sproutAmounts = [];
for (let i = 0; i < fertilizers.length; i += 1) {
- const pctRatio = BigNumber(values.amounts[i] || 0).div(fertilizers[i].amount);
+ const pctRatio = BigNumber(values.amounts[i] || 0).div(
+ fertilizers[i].amount
+ );
const sprouts = fertilizers[i].sprouts.multipliedBy(pctRatio);
sproutAmounts.push(sprouts);
- };
- const totalSprouts = sproutAmounts.reduce((total: BigNumber, current: BigNumber) => total.plus(current), BigNumber(0));
+ }
+ const totalSprouts = sproutAmounts.reduce(
+ (total: BigNumber, current: BigNumber) => total.plus(current),
+ BigNumber(0)
+ );
return (