Skip to content

Commit

Permalink
fix: Minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
UrAvgDeveloper committed Jan 13, 2023
1 parent 8a29a34 commit 6156cea
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions contracts/RiskFund/RiskFund.sol
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ contract RiskFund is Ownable2StepUpgradeable, ExponentialNoError, ReserveHelpers

/**
* @dev Auction contract address setter
* @param _auctionContractAddress Address of the auction contract.
* @param _shortfallContractAddress Address of the auction contract.
*/
function setAuctionContractAddress(address _auctionContractAddress) external onlyOwner {
require(_auctionContractAddress != address(0), "Risk Fund: Auction contract address invalid");
function setShortfallContractAddress(address _shortfallContractAddress) external onlyOwner {
require(_shortfallContractAddress != address(0), "Risk Fund: Auction contract address invalid");
address oldAuctionContractAddress = shortfall;
shortfall = _auctionContractAddress;
emit AuctionContractUpdated(oldAuctionContractAddress, _auctionContractAddress);
shortfall = _shortfallContractAddress;
emit AuctionContractUpdated(oldAuctionContractAddress, _shortfallContractAddress);
}

/**
Expand Down
16 changes: 8 additions & 8 deletions tests/hardhat/Fork/RiskFund.ts
Original file line number Diff line number Diff line change
Expand Up @@ -525,21 +525,21 @@ describe("Risk Fund: Tests", function () {
});
});

describe("setAuctionContractAddress", async function () {
describe("setShortfallContractAddress", async function () {
it("Reverts on invalid Auction contract address", async function () {
await expect(riskFund.setAuctionContractAddress(constants.AddressZero)).to.be.rejectedWith(
await expect(riskFund.setShortfallContractAddress(constants.AddressZero)).to.be.rejectedWith(
"Risk Fund: Auction contract address invalid",
);
});

it("fails if called by a non-owner", async function () {
await expect(riskFund.connect(usdcUser).setAuctionContractAddress(someNonzeroAddress)).to.be.rejectedWith(
await expect(riskFund.connect(usdcUser).setShortfallContractAddress(someNonzeroAddress)).to.be.rejectedWith(
"Ownable: caller is not the owner",
);
});

it("emits AuctionContractUpdated event", async function () {
const tx = riskFund.setAuctionContractAddress(someNonzeroAddress);
const tx = riskFund.setShortfallContractAddress(someNonzeroAddress);
await expect(tx).to.emit(riskFund, "AuctionContractUpdated").withArgs(shortfall.address, someNonzeroAddress);
});
});
Expand Down Expand Up @@ -738,7 +738,7 @@ describe("Risk Fund: Tests", function () {
).to.be.rejectedWith("Risk fund: Only callable by Shortfall contract");

const auctionContract = shortfall.address;
await riskFund.setAuctionContractAddress(auctionContract);
await riskFund.setShortfallContractAddress(auctionContract);

await expect(
riskFund.connect(shortfall.wallet).transferReserveForAuction(comptroller1Proxy.address, convertToUnit(100, 18)),
Expand All @@ -747,7 +747,7 @@ describe("Risk Fund: Tests", function () {

it("Transfer funds to auction contact", async function () {
// const auctionContract = "0x0000000000000000000000000000000000000001";
await riskFund.setAuctionContractAddress(shortfall.address);
await riskFund.setShortfallContractAddress(shortfall.address);

await USDC.connect(usdcUser).approve(cUSDC.address, convertToUnit(1000, 18));

Expand Down Expand Up @@ -794,7 +794,7 @@ describe("Risk Fund: Tests", function () {
it("Should revert the transfer to auction transaction", async function () {
const [admin] = await ethers.getSigners();
const auctionContract = "0x0000000000000000000000000000000000000001";
await riskFund.setAuctionContractAddress(auctionContract);
await riskFund.setShortfallContractAddress(auctionContract);

await USDC.connect(usdcUser).approve(cUSDC.address, convertToUnit(1000, 18));

Expand Down Expand Up @@ -838,7 +838,7 @@ describe("Risk Fund: Tests", function () {

it("Transfer single asset from multiple pools to riskFund.", async function () {
const auctionContract = "0x0000000000000000000000000000000000000001";
await riskFund.setAuctionContractAddress(auctionContract);
await riskFund.setShortfallContractAddress(auctionContract);

await USDC.connect(usdcUser).approve(cUSDC.address, convertToUnit(1000, 18));

Expand Down

0 comments on commit 6156cea

Please sign in to comment.