Skip to content

Commit

Permalink
fix: audit build
Browse files Browse the repository at this point in the history
  • Loading branch information
Krishnakumarskr committed Aug 14, 2024
1 parent adfbd62 commit 84cb894
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 14 deletions.
4 changes: 2 additions & 2 deletions packages/api/src/modules/vaults/vaults.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class VaultsService {
private createVaultParams(
params: VaultParamsDto,
upside: boolean = false,
collateralPercentage?: number,
upsidePercentage?: number,
): FixedYieldVault.FixedYieldVaultParamsStruct | UpsideVault.UpsideVaultParamsStruct {
const vaultParams = {
asset: params.asset,
Expand Down Expand Up @@ -172,7 +172,7 @@ export class VaultsService {
const upsideVaultParams: UpsideVault.UpsideVaultParamsStruct = {
fixedYieldVault: fixedYieldVaultParams,
cblToken: params.token,
collateralPercentage: collateralPercentage as unknown as BigNumber,
upsidePercentage: upsidePercentage as unknown as BigNumber,
};

return upsideVaultParams;
Expand Down
2 changes: 1 addition & 1 deletion packages/ops/src/create-vault.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export async function createVault(

if (isMatured) {
const vault = CredbullFixedYieldVault__factory.connect(created.address, adminSigner);
const toggleTx = await vault.toggleWindowCheck(false);
const toggleTx = await vault.toggleWindowCheck();
await toggleTx.wait();
console.log(' Toggled Window Check OFF for Vault: ', created.address);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/ops/src/deposit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export async function deposit(config: any) {
await approveTx.wait();
console.log(" Bob approves transfers of the Vault's USDC.");

const toggleTx = await vault.connect(userAdmin.signer).toggleWindowCheck(false);
const toggleTx = await vault.connect(userAdmin.signer).toggleWindowCheck();
await toggleTx.wait();
console.log(' Admin disables the Vault Window Check');

Expand Down
4 changes: 2 additions & 2 deletions packages/ops/src/redeem-with-upside.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ export async function redeemWithUpside(config: any): Promise<void> {
config.secret.ADMIN_PRIVATE_KEY,
);
const adminVault = vault.connect(userAdmin.signer);
const windowCheckTx = await adminVault.toggleWindowCheck(false);
const windowCheckTx = await adminVault.toggleWindowCheck();
await windowCheckTx.wait();
const maturityCheckTx = await adminVault.toggleMaturityCheck(false);
const maturityCheckTx = await adminVault.setMaturityCheck(false);
await maturityCheckTx.wait();
console.log(' Admin disables the Vault Maturity and Window Checks');

Expand Down
4 changes: 2 additions & 2 deletions packages/ops/src/redeem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ export async function redeem(config: any): Promise<void> {
config.secret.ADMIN_PRIVATE_KEY,
);
const adminVault = vault.connect(userAdmin.signer);
const windowCheckTx = await adminVault.toggleWindowCheck(false);
const windowCheckTx = await adminVault.toggleWindowCheck();
await windowCheckTx.wait();
const maturityCheckTx = await adminVault.toggleMaturityCheck(false);
const maturityCheckTx = await adminVault.setMaturityCheck(false);
await maturityCheckTx.wait();
console.log(' Admin disables the Vault Maturity and Window Checks');

Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/test/src/multi-user-deposit.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ test.describe('Multi user Interaction - Fixed', async () => {
const usdcBalanceBeofreRedeemB = await usdc.balanceOf(bob.address);

await vault.connect(testSigners.operator.getDelegate()).mature();
await toggleWindowCheck(admin, vault, false);
await toggleWindowCheck(admin, vault);

const redeemPreviewA = await vault.previewRedeem(shares);

Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/test/src/multi-user-upside-deposit.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ test.describe.skip('Multi user Interaction - Upside', async () => {

//Skip checks
await vault.connect(testSigners.operator.getDelegate()).mature();
await toggleWindowCheck(admin, vault, false);
await toggleWindowCheck(admin, vault);

const redeemPreviewA = await vault.previewRedeem(shares);
await alice.sdk.redeem(vaultAddress, shares, alice.address);
Expand Down
10 changes: 6 additions & 4 deletions packages/sdk/test/src/utils/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ export async function toggleMaturityCheck(
vault: CredbullFixedYieldVault | CredbullFixedYieldVaultWithUpside,
value: boolean,
): Promise<ContractTransaction> {
return vault.connect(admin.testSigner.getDelegate()).toggleMaturityCheck(value);
return vault.connect(admin.testSigner.getDelegate()).setMaturityCheck(value);
}

export async function toggleWindowCheck(
admin: User,
vault: CredbullFixedYieldVault | CredbullFixedYieldVaultWithUpside,
value: boolean,
): Promise<ContractTransaction> {
return vault.connect(admin.testSigner.getDelegate()).toggleWindowCheck(value);
) {
const previousValue = await vault.checkWindow();
if (previousValue) {
return vault.connect(admin.testSigner.getDelegate()).toggleWindowCheck();
}
}

0 comments on commit 84cb894

Please sign in to comment.