Skip to content

Commit

Permalink
Add final cache limit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alsco77 committed Dec 23, 2020
1 parent dc7c865 commit e17a814
Show file tree
Hide file tree
Showing 5 changed files with 312 additions and 61 deletions.
1 change: 0 additions & 1 deletion contracts/masset/Masset.sol
Expand Up @@ -290,7 +290,6 @@ contract Masset is
// 2.2 - Else Deposit X if Cache > %
else {
// This check is in place to ensure that any token with a txFee is rejected
// Audit notes: Assumption made that if no fee is collected here then there is no txfee
require(transferred == _quantity, "Asset not fully transferred");

quantityDeposited = transferred;
Expand Down
8 changes: 8 additions & 0 deletions test-utils/machines/massetMachine.ts
Expand Up @@ -591,6 +591,14 @@ export class MassetMachine {
integratorBalBefore: number | BN,
bAsset: Basset,
): Promise<ActionDetails> {
const hasTxFee = bAsset.isTransferFeeCharged;
if (hasTxFee) {
return {
expectInteraction: true,
amount,
rawBalance: new BN(0),
};
}
const totalSupply = await mAsset.totalSupply();
const surplus = await mAsset.surplus();
const cacheSize = await mAsset.cacheSize();
Expand Down
2 changes: 1 addition & 1 deletion test-utils/math.ts
Expand Up @@ -74,7 +74,7 @@ export const applyRatioMassetToBasset = (input: BN, ratio: BN | string): BN => {
};

// How many mAssets is this bAsset worth
export const applyRatio = (bAssetQ: BN | string, ratio: BN | string): BN => {
export const applyRatio = (bAssetQ: BN | string | number, ratio: BN | string): BN => {
return new BN(bAssetQ).mul(new BN(ratio)).div(ratioScale);
};

Expand Down

0 comments on commit e17a814

Please sign in to comment.