Skip to content

Instantly share code, notes, and snippets.

@blakewest
Created April 26, 2021 15:00
Show Gist options
  • Save blakewest/bd107dd5147e2f1d5488224c5e04213b to your computer and use it in GitHub Desktop.
Save blakewest/bd107dd5147e2f1d5488224c5e04213b to your computer and use it in GitHub Desktop.
Solidity Blogpost #1: Config Contract, snippet 6
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