Skip to content

Commit

Permalink
add: audit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sirpy committed Oct 15, 2024
1 parent 3b89ff3 commit e76b3f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion contracts/governance/CompoundVotingMachine.sol
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ contract CompoundVotingMachine is ContextUpgradeable, DAOUpgradeableContract {

require(
address(guardian) == address(0) || proposals[proposalId].guardianApproved,
"CompoundVotingMachine: proposal not approved by guardians"
"CompoundVotingMachine: proposal not approved"
);

proposals[proposalId].executed = true;
Expand Down
6 changes: 4 additions & 2 deletions contracts/utils/ReserveRestore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ import "hardhat/console.sol";
contract ReserveRestore {
NameService ns;
uint256 public constant LOCKED_HACKED_FUNDS = 971921364208;
bool public executed;

constructor(NameService _ns) {
ns = _ns;
}

function upgrade() external {
require(executed == false, "already upgraded");
executed = true;
address avatar = ns.dao().avatar();

GoodReserveCDai reserve = GoodReserveCDai(ns.getAddress("RESERVE"));
Expand All @@ -35,7 +38,7 @@ contract ReserveRestore {
uint256 gdSupply = ERC20(ns.getAddress("GOODDOLLAR")).totalSupply() -
LOCKED_HACKED_FUNDS;
console.log("supply: %s", gdSupply);
// get 0.00001 dai price in cdai
// get 0.0001 dai price in cdai
uint256 initialPriceCdai = (0.0001 * 1e8 * 1e28) /
cdai.exchangeRateStored(); //excghange rate is at 1e28 precision rate/1e28=1 cdai price in dai mul by 1e8 to get in cdai precision
console.log("initialPriceCdai: %s", initialPriceCdai);
Expand Down Expand Up @@ -89,6 +92,5 @@ contract ReserveRestore {

// prevent executing again
require(ctrl.unregisterSelf(avatar), "unregistering failed");
selfdestruct(payable(msg.sender));
}
}

0 comments on commit e76b3f2

Please sign in to comment.