Skip to content

Commit 80c4d31

Browse files
committed
Added redemptionPoolFee to agent creation form
1 parent 055d9da commit 80c4d31

File tree

4 files changed

+37
-4
lines changed

4 files changed

+37
-4
lines changed

src/components/forms/VaultForm.tsx

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ interface ICollateralTemplate {
3333
mintingPoolCollateralRatio: number;
3434
poolExitCollateralRatio: number;
3535
buyFAssetByAgentFactor: number;
36+
redemptionPoolFeeShare: string;
3637
}
3738
interface IFormValues {
3839
name: string | undefined;
@@ -46,6 +47,7 @@ interface IFormValues {
4647
mintingPoolCollateralRatio: number | undefined;
4748
poolExitCollateralRatio: number | undefined;
4849
buyFAssetByAgentFactor: number | undefined;
50+
redemptionPoolFeeShare: number | undefined;
4951
}
5052
export type FormRef = {
5153
form: () => UseFormReturnType<any>;
@@ -110,6 +112,16 @@ const VaultForm = forwardRef<FormRef, IForm>(({ vault, disabled }: IForm, ref) =
110112
});
111113
}
112114

115+
if (!vault) {
116+
schema = schema.shape({
117+
redemptionPoolFeeShare: yup
118+
.string()
119+
.required(
120+
t('validation.messages.required', { field: t('forms.vault.redemption_pool_fee_share_label') })
121+
),
122+
});
123+
}
124+
113125
return schema;
114126
}
115127

@@ -126,7 +138,8 @@ const VaultForm = forwardRef<FormRef, IForm>(({ vault, disabled }: IForm, ref) =
126138
mintingVaultCollateralRatio: undefined,
127139
mintingPoolCollateralRatio: undefined,
128140
poolExitCollateralRatio: undefined,
129-
buyFAssetByAgentFactor: undefined
141+
buyFAssetByAgentFactor: undefined,
142+
redemptionPoolFeeShare: undefined
130143
},
131144
//@ts-ignore
132145
validate: yupResolver(getSchema(vault)),
@@ -208,6 +221,7 @@ const VaultForm = forwardRef<FormRef, IForm>(({ vault, disabled }: IForm, ref) =
208221
mintingVaultCollateralRatio: Number(collateralTemplate.mintingVaultCollateralRatio),
209222
poolExitCollateralRatio: Number(collateralTemplate.poolExitCollateralRatio),
210223
buyFAssetByAgentFactor: Number(collateralTemplate.buyFAssetByAgentFactor),
224+
redemptionPoolFeeShare: Number(collateralTemplate.redemptionPoolFeeShare.replace('%', '')),
211225
});
212226
}, [collateralTemplate]);
213227

@@ -428,6 +442,23 @@ const VaultForm = forwardRef<FormRef, IForm>(({ vault, disabled }: IForm, ref) =
428442
className="mt-4"
429443
onKeyDownCapture={onKeyDownCapture}
430444
/>
445+
{vault == undefined &&
446+
<NumberInput
447+
{...form.getInputProps('redemptionPoolFeeShare')}
448+
//@ts-ignore
449+
key={form.key('redemptionPoolFeeShareBIPS')}
450+
label={t('forms.vault.redemption_pool_fee_share_label')}
451+
description={t('forms.vault.redemption_pool_fee_share_description_label')}
452+
disabled={isHiddenInputDisabled || disabled}
453+
placeholder={t('forms.vault.enter_placeholder')}
454+
withAsterisk
455+
allowNegative={false}
456+
step={1}
457+
suffix="%"
458+
className="mt-4"
459+
onKeyDownCapture={onKeyDownCapture}
460+
/>
461+
}
431462
</>
432463
}
433464
{minAmountDescriptionLabel &&

src/languages/en.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,8 +531,8 @@
531531
"cancel_underlying_withdrawal_label": "Cancel underlying withdrawal",
532532
"cancel_withdraw_from_core_vault_label": "Cancel withdraw from Core Vault",
533533
"claim_rewards_label": "Claim Rewards",
534-
"close_vault_label": "Close Vault (Exit)",
535-
"deactivate_vault_label": "Deactivate Vault",
534+
"close_vault_label": "Close Vault",
535+
"deactivate_vault_label": "Deactivate Vault (Exit)",
536536
"delegate_pool_collateral_label": "Delegate Pool Collateral",
537537
"deposit_collateral_lots_label": "Deposit Collateral (Lots)",
538538
"deposit_pool_collateral_label": "Deposit Pool Collateral",

src/pages/vault/add.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ export default function AddVault() {
8585
mintingVaultCollateralRatio: data.mintingVaultCollateralRatio,
8686
mintingPoolCollateralRatio: data.mintingPoolCollateralRatio,
8787
poolExitCollateralRatio: data.poolExitCollateralRatio,
88-
buyFAssetByAgentFactor: data.buyFAssetByAgentFactor
88+
buyFAssetByAgentFactor: data.buyFAssetByAgentFactor,
89+
redemptionPoolFeeShare: `${data.redemptionPoolFeeShare}%`,
8990
}
9091

9192
createVault.mutateAsync({

src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ export interface IAgentSettingsConfig {
107107
poolExitCollateralRatio: string;
108108
buyFAssetByAgentFactor: string;
109109
redemptionPoolFeeShareBIPS?: string;
110+
redemptionPoolFeeShare?: string;
110111
}
111112

112113
export interface IAgentVault {

0 commit comments

Comments
 (0)