Added Vault Transfer function

This commit is contained in:
Thrilok Kumar 2021-06-17 23:36:34 +05:30
parent 9dffaa5f6b
commit 395a98a640

View File

@ -5,7 +5,7 @@ pragma solidity ^0.7.0;
* @dev Collateralized Borrowing.
*/
import { TokenInterface } from "../../common/interfaces.sol";
import { TokenInterface, AccountInterface } from "../../common/interfaces.sol";
import { Helpers } from "./helpers.sol";
import { Events } from "./events.sol";
import { VatLike, TokenJoinInterface } from "./interface.sol";
@ -44,6 +44,29 @@ abstract contract MakerResolver is Helpers, Events {
_eventParam = abi.encode(_vault, ilk);
}
/**
* @dev Transfer Vault
* @notice Transfer a MakerDAO Vault to "nextOwner"
* @param vault Vault ID to close.
* @param nextOwner Address of the next owner of the vault.
*/
function transfer(
uint vault,
address nextOwner
) external payable returns (string memory _eventName, bytes memory _eventParam) {
require(AccountInterface(address(this)).isAuth(nextOwner), "nextOwner-is-not-auth");
uint256 _vault = getVault(vault);
(bytes32 ilk,) = getVaultData(_vault);
require(managerContract.owns(_vault) == address(this), "not-owner");
managerContract.give(_vault, nextOwner);
_eventName = "LogTransfer(uint256,bytes32,address)";
_eventParam = abi.encode(_vault, ilk, nextOwner);
}
/**
* @dev Deposit ETH/ERC20_Token Collateral.
* @notice Deposit collateral to a MakerDAO vault