Skip to content

Commit

Permalink
feat: finished unit testing, all passing
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas committed Nov 25, 2021
1 parent 91400af commit 0c6321c
Show file tree
Hide file tree
Showing 7 changed files with 261 additions and 91 deletions.
2 changes: 1 addition & 1 deletion contracts/DebtLocker.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { IERC20Like, IMapleGlobalsLike, IMapleLoanLike, IPoolLike, IPoolFactoryL

import { DebtLockerStorage } from "./DebtLockerStorage.sol";

/// @title DebtLocker holds custody of LoanFDT tokens.
/// @title DebtLocker interacts with Loans on behalf of PoolV1
contract DebtLocker is IDebtLocker, DebtLockerStorage, MapleProxied {

/********************************/
Expand Down
14 changes: 3 additions & 11 deletions contracts/DebtLockerFactory.sol
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.7;

import { IMapleProxyFactory, MapleProxyFactory } from "../modules/maple-proxy-factory/contracts/MapleProxyFactory.sol";
import { MapleProxyFactory } from "../modules/maple-proxy-factory/contracts/MapleProxyFactory.sol";

import { IDebtLockerFactory } from "./interfaces/IDebtLockerFactory.sol";

/// @title Deploys DebtLocker proxy instances.
contract DebtLockerFactory is IDebtLockerFactory, MapleProxyFactory {

uint8 public constant override factoryType = uint8(1);

// mapping(address => uint256) public override nonceOf;

constructor(address mapleGlobals_) MapleProxyFactory(mapleGlobals_) {}

function newLocker(address loan_) external override returns (address debtLocker_) {
// TODO: consider making ProxyFactory.createInstance take in a memory arguments so we can do:
// `debtLocker_ = super.createInstance(abi.encode(loan_, msg.sender));`
uint8 public constant factoryType = uint8(1);

function newLocker(address loan_) external override returns (address debtLocker_) {
bytes memory arguments = abi.encode(loan_, msg.sender);

bool success_;
Expand All @@ -27,7 +22,4 @@ contract DebtLockerFactory is IDebtLockerFactory, MapleProxyFactory {
emit InstanceDeployed(defaultVersion, debtLocker_, arguments);
}

// TODO: Consider the implications of createInstance still being exposed. Block usage?
function createInstance(bytes calldata arguments_, bytes32 salt_) public override(IMapleProxyFactory, MapleProxyFactory) virtual returns (address instance_) {}

}
12 changes: 0 additions & 12 deletions contracts/interfaces/IDebtLockerFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,6 @@ import { IMapleProxyFactory } from "../../modules/maple-proxy-factory/contracts/
/// @title Deploys DebtLocker proxy instances.
interface IDebtLockerFactory is IMapleProxyFactory {

/**
* @dev The Maple factory type (to be deprecated).
*/
function factoryType() external view returns (uint8 factoryType_);

/**
* @dev The nonce of an account for CREATE2 salts.
* @param account_ The address of an account.
* @return nonce_ The nonce for an account.
*/
function nonceOf(address account_) external view returns (uint256 nonce_);

/**
* @dev Deploys a new DebtLocker proxy instance.
* @param loan_ Loan contract that corresponds to DebtLocker.
Expand Down
Loading

0 comments on commit 0c6321c

Please sign in to comment.