Skip to content

Commit

Permalink
style: adapt imports so that etherscan can verify the contracts (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xrusowsky authored Sep 26, 2023
1 parent ceedf82 commit 5ee7a89
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/out
/cache
.env
.env
/broadcast
16 changes: 11 additions & 5 deletions src/Cooler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ import {SafeTransferLib} from "solmate/utils/SafeTransferLib.sol";
import {ERC20} from "solmate/tokens/ERC20.sol";
import {Clone} from "clones/Clone.sol";

import {IDelegate} from "src/interfaces/IDelegate.sol";
import {CoolerFactory} from "src/CoolerFactory.sol";
import {CoolerCallback} from "src/CoolerCallback.sol";
import {CoolerFactory} from "./CoolerFactory.sol";
import {CoolerCallback} from "./CoolerCallback.sol";

// Function sig taken from gOHM contract
interface IDelegate { function delegate(address to_) external; }


/// @title Cooler Loans.
/// @notice A Cooler is a smart contract escrow that facilitates fixed-duration, peer-to-peer
Expand Down Expand Up @@ -189,7 +192,9 @@ contract Cooler is Clone {
factory().logRepayLoan(loanID_, repayment_);

// If necessary, trigger lender callback.
if (loan.callback) CoolerCallback(loan.lender).onRepay(loanID_, remainder, interestPaid);
if (loan.callback) {
CoolerCallback(loan.lender).onRepay(loanID_, remainder, interestPaid);
}

return decollateralized;
}
Expand Down Expand Up @@ -297,8 +302,9 @@ contract Cooler is Clone {
factory().logDefaultLoan(loanID_, loan.collateral);

// If necessary, trigger lender callback.
if (loan.callback)
if (loan.callback) {
CoolerCallback(loan.lender).onDefault(loanID_, loan.principal, loan.interestDue, loan.collateral);
}

return (loan.principal, loan.interestDue, loan.collateral, block.timestamp - loan.expiry);
}
Expand Down
21 changes: 21 additions & 0 deletions src/scripts/Deploy.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.15;

import {Script, console2} from "forge-std/Script.sol";

// Cooler Loans
import {CoolerFactory, Cooler} from "src/CoolerFactory.sol";

/// @notice Script to deploy and initialize the Olympus system
/// @dev The address that this script is broadcast from must have write access to the contracts being configured
contract Deploy is Script {
// Cooler Loan contracts
CoolerFactory public coolerFactory;

function deploy() external {
// Deploy a new Cooler Factory implementation
vm.broadcast();
coolerFactory = new CoolerFactory();
console2.log("Cooler Factory deployed at:", address(coolerFactory));
}
}
9 changes: 9 additions & 0 deletions src/scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

# Load environment variables
source .env

# Deploy using script
forge script ./src/scripts/Deploy.sol:Deploy --sig "deploy()()" $CHAIN \
--rpc-url $RPC_URL --private-key $PRIVATE_KEY --froms $DEPLOYER --slow -vvv \
--broadcast --verify --etherscan-api-key $ETHERSCAN_KEY # uncomment to broadcast to the network

0 comments on commit 5ee7a89

Please sign in to comment.