Skip to content

Commit

Permalink
Truefi 2.0 deploy (#505)
Browse files Browse the repository at this point in the history
* rating agency v2 distributor

* truefi 2.0 deploy

* linter

* fix test

* add docs

* flatten

* linter

* documentation

Co-authored-by: Hal Hyatt <feewet@gmail.com>
  • Loading branch information
hal909 and feewet committed Feb 19, 2021
1 parent 0cfcd50 commit 14fed4d
Show file tree
Hide file tree
Showing 153 changed files with 10,881 additions and 1,288 deletions.
4 changes: 3 additions & 1 deletion contracts/truefi/LoanFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@ contract LoanFactory is ILoanFactory, Initializable {
currencyToken = _currencyToken;
}

/** @dev sets lender address **/
function setLender() external {
lender = 0x16d02Dc67EB237C387023339356b25d1D54b0922;
}

/** @dev sets liquidator address **/
function setLiquidator() external {
liquidator = address(0); // to be changed for deployment
liquidator = 0x76dd4921C99AC6b61b3a98f9fa6f181cA6D70c77;
}

/**
Expand Down
6 changes: 6 additions & 0 deletions contracts/truefi/TrueRatingAgencyV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -312,13 +312,19 @@ contract TrueRatingAgencyV2 is ITrueRatingAgencyV2, Ownable {
emit Rated(id, msg.sender, choice, stake);
}

/**
* @dev Internal function to help reset ratings
* @param id Loan ID
* @param choice Boolean representing choice
*/
function _resetCastRatings(address id, bool choice) internal {
loans[id].prediction[choice] = loans[id].prediction[choice].sub(loans[id].ratings[msg.sender][choice]);
loans[id].ratings[msg.sender][choice] = 0;
}

/**
* @dev Cancel ratings of msg.sender
* @param id ID to cancel ratings for
*/
function resetCastRatings(address id) public onlyPendingLoans(id) {
if (getYesRate(id, msg.sender) > 0) {
Expand Down
7 changes: 6 additions & 1 deletion contracts/truefi/distributors/ArbitraryDistributor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@ contract ArbitraryDistributor is IArbitraryDistributor, Ownable {
_;
}

function setBeneficiaryStatus(address _beneficiary, bool _status) public {
/**
* @dev Set beneficiary status
* @param _beneficiary Contract which can claim TRU
* @param _status Boolean to set whether beneficiary can claim TRU
*/
function setBeneficiaryStatus(address _beneficiary, bool _status) public onlyOwner {
beneficiaries[_beneficiary] = _status;
emit BeneficiaryStatusChanged(_beneficiary, _status);
}
Expand Down
14 changes: 7 additions & 7 deletions contracts/truefi/distributors/RatingAgencyV2Distributor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,8 @@ contract RatingAgencyV2Distributor is IArbitraryDistributor, Ownable {
* @dev Initialize distributor
* @param _beneficiary Address for distribution
* @param _trustToken TRU address
* @param _amount Amount to distribute
*/
function initialize(
address _beneficiary,
IERC20 _trustToken,
uint256 _amount
) public initializer {
function initialize(address _beneficiary, IERC20 _trustToken) public initializer {
Ownable.initialize();
trustToken = _trustToken;
beneficiary = _beneficiary;
Expand All @@ -64,7 +59,12 @@ contract RatingAgencyV2Distributor is IArbitraryDistributor, Ownable {
_;
}

function setBeneficiaryStatus(address _beneficiary, bool _status) public {
/**
* @dev Owner can set beneficiary status
* @param _beneficiary Contract which can claim TRU
* @param _status Boolean to set whether contract can claim TRU
*/
function setBeneficiaryStatus(address _beneficiary, bool _status) public onlyOwner {
beneficiaries[_beneficiary] = _status;
emit BeneficiaryStatusChanged(_beneficiary, _status);
}
Expand Down
Loading

0 comments on commit 14fed4d

Please sign in to comment.