UserManager
Manages the Union members stake and vouches.
Vouch
Staker
Index
Vouchee
maxStakeAmount
@dev Max amount that can be staked of the staking token
stakingToken
@dev The staking token that is staked in the comptroller
unionToken
@dev Address of the UNION token contract
assetManager
@dev Address of the asset manager contract
uToken
@dev uToken contract
comptroller
@dev Comptroller contract
effectiveCount
Number of vouches needed to become a member
newMemberFee
@dev New member fee
totalStaked
@dev Total amount of staked staked token
totalFrozen
@dev Total amount of stake frozen
maxOverdueBlocks
@dev Max blocks can be overdue for
maxVouchers
Max voucher limit
stakers
@dev Union Stakers
vouchers
@dev Staker (borrower) mapped to recieved vouches (staker)
voucherIndexes
Borrower mapped to Staker mapped to index in vouchers array
vouchees
@dev Staker (staker) mapped to vouches given (borrower)
voucheeIndexes
Borrower mapped to Staker mapped to index in vochee array
memberFrozen
Stakers frozen amounts
AuthFailed
ErrorSelfVouching
TrustAmountLtLocked
NoExistingMember
NotEnoughStakers
StakeLimitReached
AssetManagerDepositFailed
AssetManagerWithdrawFailed
InsufficientBalance
LockedStakeNonZero
NotOverdue
ExceedsLocked
AmountZero
LockedRemaining
VoucherNotFound
VouchWhenOverdue
MaxVouchees
InvalidParams
LogAddMember
@dev Add new member event @param member New member address
LogUpdateTrust
@dev Update vouch for existing member event @param staker Trustee address @param borrower The address gets vouched for @param trustAmount Vouch amount
LogRegisterMember
@dev New member application event @param account New member's voucher address @param borrower New member address
LogCancelVouch
@dev Cancel vouching for other member event @param account New member's voucher address @param borrower The address gets vouched for
LogStake
@dev Stake event @param account The staker's address @param amount The amount of tokens to stake
LogUnstake
@dev Unstake event @param account The staker's address @param amount The amount of tokens to unstake
LogDebtWriteOff
@dev DebtWriteOff event @param staker The staker's address @param borrower The borrower's address @param amount The amount of write off
LogSetUToken
@dev set utoken address @param uToken new uToken address
LogSetNewMemberFee
@dev set new member fee @param oldMemberFee old member fee @param newMemberFee new member fee
LogSetMaxStakeAmount
@dev set max stake amount @param oldMaxStakeAmount Old amount @param newMaxStakeAmount New amount
LogSetMaxOverdueBlocks
@dev set max overdue blocks @param oldMaxOverdueBlocks Old value @param newMaxOverdueBlocks New value
LogSetEffectiveCount
@dev set effective count @param oldEffectiveCount Old value @param newEffectiveCount New value
LogSetMaxVouchers
Set max voucher
Parameters
__UserManager_init
onlyMember
onlyMarket
onlyComptroller
setMaxStakeAmount
Set the max amount that a user can stake Emits {LogSetMaxStakeAmount} event
Parameters
setUToken
set the UToken contract address Emits {LogSetUToken} event
Parameters
setNewMemberFee
set New Member fee The amount of UNION an account must burn to become a member Emits {LogSetNewMemberFee} event
Parameters
setMaxOverdueBlocks
set New max overdue blocks Emits {LogSetMaxOverdueBlocks} event
Parameters
setEffectiveCount
set New effective count this is the number of vouches an account needs in order to register as a member Emits {LogSetEffectiveCount} event
Parameters
setMaxVouchers
checkIsMember
@dev Check if the account is a valid member @param account Member address @return Address whether is member
getCreditLimit
@dev Get the member's available credit limit @dev IMPORTANT: This function can take up a tonne of gas as the vouchers[address] array grows in size. the maxVoucher limit will ensure this function can always run within a single block but it is intended only to be used as a view function called from a UI @param borrower Member address @return total Credit line amount
getVoucherCount
@dev Get the count of vouchers Vouchers are addresses that this borrower is recieving a vouch from. @param borrower Address of borrower
getVoucheeCount
@dev Get the count of vouchees Voucheers are addresses that this staker is vouching for @param staker Address of staker
getStakerBalance
@dev Get the user's deposited stake amount @param account Member address @return Deposited stake amount
getFrozenInfo
@dev Get frozen coin age @param staker Address of staker @param pastBlocks Number of blocks past to calculate coin age from coin age = min(block.number - lastUpdated, pastBlocks) * amount
getTotalLockedStake
@dev Get Total locked stake @param staker Staker address
getLockedStake
@dev Get staker locked stake for a borrower @param staker Staker address @param borrower Borrower address @return LockedStake
getVouchingAmount
@dev Get vouching amount @param _staker Staker address @param borrower Borrower address
addMember
@dev Manually add union members and bypass all the requirements of registerMember
Only accepts calls from the admin Emit {LogAddMember} event @param account Member address
updateTrust
@dev Update the trust amount for exisitng members. @dev Trust is the amount of the underlying token you would in theory be happy to lend to another member. Vouch is derived from trust and stake. Vouch is the minimum of trust and staked amount. Emits {LogUpdateTrust} event @param borrower Account address @param trustAmount Trust amount
cancelVouch
@dev Remove voucher for memeber Can be called by either the borrower or the staker. It will remove the voucher from the voucher array by replacing it with the last item of the array and reseting the array size to -1 by poping off the last item Only callable by a member when the contract is not paused Emit {LogCancelVouch} event @param staker Staker address @param borrower borrower address
registerMemberWithPermit
@notice Register a a member using a signed permit @dev See registerMember @param newMember New member address @param value Amount approved by permit @param deadline Timestamp for when the permit expires @param v secp256k1 signature part @param r secp256k1 signature part @param s secp256k1 signature part
registerMember
@notice Register a a member, and burn an application fees @dev In order to register as a member an address must be recieving x amount of vouches greater than 0 from stakers. x is defined by effectiveCount
Emits {LogRegisterMember} event @param newMember New member address
stake
@notice Stake staking tokens @dev Stake is used to underwrite loans and becomes locked if a member a staker has vouched for borrows against it. Stake also earns rewards from the comptroller Emits a {LogStake} event. @param amount Amount to stake
unstake
@notice Unstake staking token @dev Tokens can only be unstaked if they are not locked. ie a vouchee is not borrowing against them. Emits {LogUnstake} event @param amount Amount to unstake
withdrawRewards
@dev collect staker rewards from the comptroller
debtWriteOff
@notice Write off a borrowers debt @dev Used the stakers locked stake to write off the loan, transfering the Stake to the AssetManager and adjusting balances in the AssetManager and the UToken to repay the principal @dev Emits {LogDebtWriteOff} event @param borrower address of borrower @param amount amount to writeoff
updateLocked
@notice Borrowing from the market @dev Locks/Unlocks the borrowers stakers staked amounts in a first in First out order. Meaning the members that vouched for this borrower first will be the first members to get their stake locked or unlocked following a borrow or repayment. @param borrower The address of the borrower @param amount Lock/Unlock amount @param lock If the amount is being locked or unlocked
_updateFrozen
Update the frozen info for a single staker
Parameters
Return Values
updateFrozenInfo
Update the frozen info by the comptroller
Parameters
Return Values
batchUpdateFrozenInfo
Update the frozen info for external scripts
Parameters
_min
Last updated