Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KUSD mint cap #346

Merged
merged 9 commits into from
May 23, 2023
Merged

KUSD mint cap #346

merged 9 commits into from
May 23, 2023

Conversation

arthurka-o
Copy link
Contributor

No description provided.

@arthurka-o arthurka-o linked an issue Apr 25, 2023 that may be closed by this pull request
@@ -684,6 +685,10 @@ contract BorrowerOperations is KumoBase, CheckContract, IBorrowerOperations {
_kusdToken.burn(_account, _KUSD);
}

function KUSDMintRemainder(address _asset) external view returns (uint256) {
return kumoParams.KUSDMintCap(_asset) - kusdToken.totalSupply();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arthurka-o - do we need to check for a negative return value? My concerns are if fees could play in here. What do you think?

# Conflicts:
#	packages/contracts/contracts/BorrowerOperations.sol
#	packages/contracts/contracts/Interfaces/IKumoParameters.sol
#	packages/lib-ethers/abi/KumoParameters.json
#	packages/lib-ethers/test/MultiAssetHintsAdjustTrove.test.ts
#	packages/lib-ethers/types/index.ts
Copy link
Contributor

@udosson udosson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, @arthurka-o.
Before I approve, can you please list all test cases in bullet points that you covered for the mint cap here?
e.g.: - KUSD > mintCap --> Does not mint new KUSD and sends error message EXY

@arthurka-o
Copy link
Contributor Author

BorrowerOperations > withdrawKUSD --> not minting new KUSDToken if the mint cap is reached
BorrowerOperations > adjustTrove --> not minting new KUSDToken if the mint cap is reached
BorrowerOperations > openTrove --> not minting new KUSDToken if the mint cap is reached
BorrowerOperations > KUSDMintRemainder --> returns the correct value

@udosson

@udosson
Copy link
Contributor

udosson commented May 22, 2023

Thanks, @arthurka-o
Can you please add the following test cases for the mint cap:

  • Check that the mint remainder value is returned correctly (Check first, adjust mint cap & check again, mint KUSD and check again, repay KUSD and check again)
  • Check that the mint cap includes the borrowing fee
  • Check that adjusting of the mint cap is working: (Set mint cap to initial value, mint KUSD, decrease the mint cap to below the minted KUSD per asset --> minting should fail, increase mint cap again --> minting should work again)

@arthurka-o
Copy link
Contributor Author

@udosson

  • Added a test
  • Already in tests
  • Added a test

Copy link
Contributor

@udosson udosson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@arthurka-o arthurka-o merged commit dbcd2c8 into dev May 23, 2023
11 checks passed
@arthurka-o arthurka-o deleted the KUSD-mint-cap branch May 23, 2023 13:32
@arthurka-o arthurka-o mentioned this pull request May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement mint cap of KUSD in smart contracts
3 participants