Skip to main content

Borrower

Borrower

Deployment on Ethereum mainnet:

https://etherscan.io/address/0xE1635F4F0EEE83C5E24023Ac7f8B9F2079fdD7d6

These contracts represent the a convenient way for a borrower to interact with Goldfinch They are 100% optional. However, they let us add many sophisticated and convient features for borrowers while still keeping our core protocol small and secure. We therefore expect most borrowers will use them. This contract is the "official" borrower contract that will be maintained by Goldfinch governance. However, in theory, anyone can fork or create their own version, or not use any contract at all. The core functionality is completely agnostic to whether it is interacting with a contract or an externally owned account (EOA).

config

contract GoldfinchConfig config

USDT_ADDRESS

address USDT_ADDRESS

BUSD_ADDRESS

address BUSD_ADDRESS

GUSD_ADDRESS

address GUSD_ADDRESS

DAI_ADDRESS

address DAI_ADDRESS

initialize

function initialize(address owner, address _config) external

lockJuniorCapital

function lockJuniorCapital(address poolAddress) external

lockPool

function lockPool(address poolAddress) external

drawdown

function drawdown(address poolAddress, uint256 amount, address addressToSendTo) external

Drawdown on a loan

Parameters

NameTypeDescription
poolAddressaddressPool to drawdown from
amountuint256usdc amount to drawdown
addressToSendToaddressAddress to send the funds. Null address or address(this) will send funds back to the caller

drawdownWithSwapOnOneInch

function drawdownWithSwapOnOneInch(address poolAddress, uint256 amount, address addressToSendTo, address toToken, uint256 minTargetAmount, uint256[] exchangeDistribution) public

Drawdown on a v1 or v2 pool and swap the usdc to the desired token using OneInch

Parameters

NameTypeDescription
poolAddressaddress
amountuint256usdc amount to drawdown from the pool
addressToSendToaddressaddress to send the toToken to
toTokenaddressaddress of the ERC20 to swap to
minTargetAmountuint256min amount of toToken you're willing to accept from the swap (i.e. a slippage tolerance)
exchangeDistributionuint256[]

transferERC20

function transferERC20(address token, address to, uint256 amount) public

pay

function pay(address poolAddress, uint256 amount) external

Pay back a v1 or v2 tranched pool

Parameters

NameTypeDescription
poolAddressaddresspool address
amountuint256USDC amount to pay

payMultiple

function payMultiple(address[] pools, uint256[] amounts) external

Pay back multiple pools. Supports v0.1.0 and v1.0.0 pools

Parameters

NameTypeDescription
poolsaddress[]list of pool addresses for which the caller is the borrower
amountsuint256[]amounts to pay back

pay

function pay(address poolAddress, uint256 principalAmount, uint256 interestAmount) external

Pay back a v2.0.0 Tranched Pool

Parameters

NameTypeDescription
poolAddressaddressThe pool to be paid back
principalAmountuint256principal amount to pay
interestAmountuint256interest amount to pay

payInFull

function payInFull(address poolAddress, uint256 amount) external

payWithSwapOnOneInch

function payWithSwapOnOneInch(address poolAddress, uint256 originAmount, address fromToken, uint256 minTargetAmount, uint256[] exchangeDistribution) external

payMultipleWithSwapOnOneInch

function payMultipleWithSwapOnOneInch(address[] pools, uint256[] minAmounts, uint256 originAmount, address fromToken, uint256[] exchangeDistribution) external

_pay

function _pay(address poolAddress, uint256 amount) internal

_payV2Separate

function _payV2Separate(address poolAddress, uint256 principalAmount, uint256 interestAmount) internal returns (struct ILoan.PaymentAllocation)

transferFrom

function transferFrom(address erc20, address sender, address recipient, uint256 amount) internal

swapOnOneInch

function swapOnOneInch(address fromToken, address toToken, uint256 originAmount, uint256 minTargetAmount, uint256[] exchangeDistribution) internal

_invoke

function _invoke(address _target, bytes _data) internal returns (bytes)

Performs a generic transaction.

Parameters

NameTypeDescription
_targetaddressThe address for the transaction.
_databytesThe data of the transaction. Mostly copied from Argent: https://github.com/argentlabs/argent-contracts/blob/develop/contracts/wallet/BaseWallet.sol#L111

_toUint256

function _toUint256(bytes _bytes) internal pure returns (uint256 value)

_msgSender

function _msgSender() internal view returns (address payable)

_msgData

function _msgData() internal view returns (bytes ret)

versionRecipient

function versionRecipient() external view returns (string)