Created
April 26, 2021 14:50
-
-
Save blakewest/72a05ca39cc9662591bb160d2bf54625 to your computer and use it in GitHub Desktop.
Solidity Blogpost #2: Config Contract
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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