Created
April 26, 2021 15:00
-
-
Save blakewest/bd107dd5147e2f1d5488224c5e04213b to your computer and use it in GitHub Desktop.
Solidity Blogpost #1: Config Contract, snippet 6
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 "./ConfigHelper.sol"; | |
contract CreditDesk { | |
GoldfinchConfig public config; | |
// This line is what "adds" the library methods to the config. If you aren't | |
// familiar with this syntax, you can just Google how libraries work in Solidity | |
using ConfigHelper for config; | |
function createCreditLine(CreditLineParams params) public { | |
require(validParams(params), "invalid params!"); | |
require(params.amount <= config.maxCreditLineAmount(), "Amount is above maximum"); | |
config.getCreditLineFactory().createCreditLine(params); | |
} | |
modifier onlyOwner() { | |
require(msg.sender == config.protocolOwner(), "Must be owner!"); | |
_; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment