Last active
April 26, 2021 15:11
-
-
Save blakewest/d9d3b96fbc676a8b05082beb52967ded to your computer and use it in GitHub Desktop.
Solidity Blogpost #1: Config Contract, snippet 4
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 "./GoldfinchConfig.sol"; | |
import "./ICreditLineFactory.sol"; | |
contract CreditDesk { | |
GoldfinchConfig public config; | |
function createCreditLine(CreditLineParams params) public { | |
require(validParams(params), "invalid params!"); | |
uint256 maxCreditLineAmount = config.numbers(0); | |
require(params.amount <= maxCreditLineAmount, "Amount is above maximum"); | |
address clFactoryAddress = config.addresses(0); | |
ICreditLineFactory(clFactoryAddress).createCreditLine(params); | |
} | |
modifier onlyOwner() { | |
address protocolOwner = config.addresses(1); | |
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