Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ export const validateStabilityDepositChange = (
</ErrorDescription>
];
}

if(change && !bammAllowance) {
if(change && change.depositLUSD?.gt(Decimal.fromBigNumberString(bammAllowance.toString()))) {
return [
undefined,
<ErrorDescription>
Expand Down
4 changes: 2 additions & 2 deletions packages/lib-ethers/etc/lib-ethers.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class BlockPolledLiquityStore extends LiquityStore<BlockPolledLiquityStor
// @public
export interface BlockPolledLiquityStoreExtraState {
// (undocumented)
bammAllowance: boolean;
bammAllowance: any;
blockTag?: number;
blockTimestamp: number;
// @internal (undocumented)
Expand Down Expand Up @@ -469,7 +469,7 @@ export class ReadableEthersLiquity implements ReadableLiquity {
// @internal (undocumented)
_getActivePool(overrides?: EthersCallOverrides): Promise<Trove>;
// (undocumented)
getBammAllowance(overrides?: EthersCallOverrides): Promise<boolean>;
getBammAllowance(overrides?: EthersCallOverrides): Promise<any>;
// @internal (undocumented)
_getBlockTimestamp(blockTag?: BlockTag): Promise<number>;
// (undocumented)
Expand Down
2 changes: 1 addition & 1 deletion packages/lib-ethers/src/BlockPolledLiquityStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export interface BlockPolledLiquityStoreExtraState {
/** @internal */
_feesFactory: (blockTimestamp: number, recoveryMode: boolean) => Fees;

bammAllowance: boolean;
bammAllowance: any;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/lib-ethers/src/ReadableEthersLiquity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -610,14 +610,14 @@ export class ReadableEthersLiquity implements ReadableLiquity {
: { status: "unregistered" };
}

async getBammAllowance(overrides?: EthersCallOverrides): Promise<boolean> {
async getBammAllowance(overrides?: EthersCallOverrides): Promise<any> {
const { lusdToken, bamm } = _getContracts(this.connection);
const address = _requireAddress(this.connection);
const reallyLargeAllowance = BigNumber.from("0x8888888888888888888888888888888888888888888888888888888888888888")

const allowance = await lusdToken.allowance(address, bamm.address)
console.log({allowance})
const bammAllowance = allowance.gt(reallyLargeAllowance)
const bammAllowance = allowance
return bammAllowance;
}
}
Expand Down