Skip to content

Commit

Permalink
Merge branch 'staging' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
shahthepro committed Jul 6, 2023
2 parents c1a7bd5 + ed5fd35 commit a433652
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions client/components/claim/claim/ClaimOgv.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,11 @@ const ClaimOgv: FunctionComponent<ClaimOgvProps> = () => {
maxLockupDurationInMonths
);
const [error, setError] = useState<string>(null);
if (!claim.loaded || !claim.optional.hasClaim) {
return <></>;
}

const isValidLockup = lockupDuration > 0;
const claimableOgv = claim.optional.isValid
const claimableOgv = claim?.optional?.isValid
? numeral(claim.optional.amount.div(decimal18Bn).toString()).value()
: 0;
// as specified here: https://github.com/OriginProtocol/ousd-governance/blob/master/contracts/OgvStaking.sol#L21
const votingDecayFactor = 1.8;

const veOgvFromOgvLockup =
claimableOgv * votingDecayFactor ** (lockupDuration / 12);

const { stakingAPY: ogvLockupRewardApy, loading: ogvLockupRewardLoading } =
useStakingAPY(claimableOgv, lockupDuration);
Expand All @@ -55,6 +47,16 @@ const ClaimOgv: FunctionComponent<ClaimOgvProps> = () => {
loading: maxOgvLockupRewardLoading,
} = useStakingAPY(claimableOgv, 48);

if (!claim.loaded || !claim.optional.hasClaim) {
return <></>;
}

// as specified here: https://github.com/OriginProtocol/ousd-governance/blob/master/contracts/OgvStaking.sol#L21
const votingDecayFactor = 1.8;

const veOgvFromOgvLockup =
claimableOgv * votingDecayFactor ** (lockupDuration / 12);

let claimButtonText = "";
if (isValidLockup && claim.optional.state === "ready") {
claimButtonText = "Claim & Stake OGV";
Expand Down

0 comments on commit a433652

Please sign in to comment.