Skip to content

Instantly share code, notes, and snippets.

@blakewest
Created April 26, 2021 14:50
Show Gist options
  • Save blakewest/72a05ca39cc9662591bb160d2bf54625 to your computer and use it in GitHub Desktop.
Save blakewest/72a05ca39cc9662591bb160d2bf54625 to your computer and use it in GitHub Desktop.
Solidity Blogpost #2: Config Contract
import "./ICreditLineFactory.sol";
contract CreditDesk {
address public creditLineFactoryAddress;
uint256 public maxCreditLineAmount;
address public protocolOwner;
function createCreditLine(CreditLineParams params) public onlyOwner {
require(validParams(params), "invalid params!");
require(params.amount <= maxCreditLineAmount, "Amount is above maximum");
ICreditLineFactory(creditLineFactoryAddress).createCreditLine(params);
}
function setCreditLineMax(uint256 amount) public onlyOwner {
maxCreditLineAmount = amount;
}
function transferOwnership(address newOwner) public onlyOwner {
protocolOwner = newOwner;
}
modifier onlyOwner() {
require(msg.sender == protocolOwner, "Must be owner!");
_;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment