IGovUserKeeper
Interface Description
License: MIT
This contract is responsible for securely storing user's funds that are used during the voting. These are either ERC20 tokens or NFTs
Structs info
BalanceInfo
The struct holds information about user deposited tokens
Parameters:
tokens
uint256
the amount of deposited tokens
nfts
struct EnumerableSet.UintSet
the array of deposited nfts
UserInfo
The struct holds information about user balances
Parameters:
balances
mapping(enum IGovPool.VoteType => struct IGovUserKeeper.BalanceInfo)
matching vote types with balance infos
nftsPowers
mapping(enum IGovPool.VoteType => uint256)
matching vote types with cached nfts powers
delegatedBalances
mapping(address => struct IGovUserKeeper.BalanceInfo)
matching delegatees with balances infos
delegatedNftPowers
mapping(address => uint256)
matching delegatees with delegated nft powers
allDelegatedBalance
struct IGovUserKeeper.BalanceInfo
the balance info of all delegated assets
delegatees
struct EnumerableSet.AddressSet
the array of delegatees
maxTokensLocked
uint256
the upper bound of currently locked tokens
lockedInProposals
mapping(uint256 => uint256)
the amount of deposited tokens locked in proposals
NFTInfo
The struct holds information about nft contract
Parameters:
nftAddress
address
the address of the nft
isSupportPower
bool
boolean flag, if true then nft contract supports power
individualPower
uint256
the voting power an nft
totalSupply
uint256
the total supply of nfts that are not enumerable
nftMinPower
mapping(uint256 => uint256)
matching nft ids to their minimal powers
VotingPowerView
The struct that is used in view functions of contract as a return argument
Parameters:
power
uint256
the total vote power of a user
rawPower
uint256
the total deposited assets power of a user
nftPower
uint256
the total nft power of a user
rawNftPower
uint256
the total deposited nft power of a user
perNftPower
uint256[]
the power of every nft, bounded by index with nftIds
ownedBalance
uint256
the owned erc20 balance, decimals = 18
ownedLength
uint256
the amount of owned nfts
nftIds
uint256[]
the array of nft ids, bounded by index with perNftPower
DelegationInfoView
The struct that is used in view functions of contract as a return argument
Parameters:
delegatee
address
the address of delegatee (person who gets delegation)
delegatedTokens
uint256
the amount of delegated tokens
delegatedNfts
uint256[]
the array of delegated nfts, bounded by index with perNftPower
nftPower
uint256
the total power of delegated nfts
perNftPower
uint256[]
the array of nft power, bounded by index with delegatedNfts
Functions info
depositTokens (0x39dc5ef2)
The function for depositing tokens
Parameters:
payer
address
the address of depositor
receiver
address
the deposit receiver address
amount
uint256
the erc20 deposit amount
withdrawTokens (0x5e35359e)
The function for withdrawing tokens
Parameters:
payer
address
the address from whom to withdraw the tokens
receiver
address
the withdrawal receiver address
amount
uint256
the erc20 withdrawal amount
delegateTokens (0x9161babb)
The function for delegating tokens
Parameters:
delegator
address
the address of delegator
delegatee
address
the address of delegatee
amount
uint256
the erc20 delegation amount
delegateTokensTreasury (0x69b5330b)
The function for delegating tokens from Treasury
Parameters:
delegatee
address
the address of delegatee
amount
uint256
the erc20 delegation amount
undelegateTokens (0x0ae1398e)
The function for undelegating tokens
Parameters:
delegator
address
the address of delegator
delegatee
address
the address of delegatee
amount
uint256
the erc20 undelegation amount
undelegateTokensTreasury (0x86be8d2d)
The function for undelegating tokens from Treasury
Parameters:
delegatee
address
the address of delegatee
amount
uint256
the erc20 undelegation amount
depositNfts (0x9693caad)
The function for depositing nfts
Parameters:
payer
address
the address of depositor
receiver
address
the deposit receiver address
nftIds
uint256[]
the array of deposited nft ids
withdrawNfts (0x1f96f376)
The function for withdrawing nfts
Parameters:
payer
address
the address from whom to withdraw the nfts
receiver
address
the withdrawal receiver address
nftIds
uint256[]
the withdrawal nft ids
delegateNfts (0xbfb1a57d)
The function for delegating nfts
Parameters:
delegator
address
the address of delegator
delegatee
address
the address of delegatee
nftIds
uint256[]
the array of delegated nft ids
delegateNftsTreasury (0x6ad6d3c1)
The function for delegating nfts from Treasury
Parameters:
delegatee
address
the address of delegatee
nftIds
uint256[]
the array of delegated nft ids
undelegateNfts (0x37267d4c)
The function for undelegating nfts
Parameters:
delegator
address
the address of delegator
delegatee
address
the address of delegatee
nftIds
uint256[]
the array of undelegated nft ids
undelegateNftsTreasury (0x39be038b)
The function for undelegating nfts from Treasury
Parameters:
delegatee
address
the address of delegatee
nftIds
uint256[]
the array of undelegated nft ids
updateMaxTokenLockedAmount (0x5f884296)
The function for recalculating max token locked amount of a user
Parameters:
lockedProposals
uint256[]
the array of proposal ids for recalculation
voter
address
the address of voter
lockTokens (0x154b3db0)
The function for locking tokens in a proposal
Parameters:
proposalId
uint256
the id of proposal
voter
address
the address of voter
amount
uint256
the amount of tokens to lock
unlockTokens (0x7fde4424)
The function for unlocking tokens in proposal
Parameters:
proposalId
uint256
the id of proposal
voter
address
the address of voter
lockNfts (0x3b389164)
The function for locking nfts
Parameters:
voter
address
the address of voter
voteType
enum IGovPool.VoteType
the type of vote
nftIds
uint256[]
the array of nft ids to lock
unlockNfts (0x7be49fe3)
The function for unlocking nfts
Parameters:
nftIds
uint256[]
the array of nft ids to unlock
updateNftPowers (0x30132f5e)
The function for recalculating power of nfts
Parameters:
nftIds
uint256[]
the array of nft ids to recalculate the power for
setERC20Address (0x41bec0d2)
The function for setting erc20 address
Parameters:
_tokenAddress
address
the erc20 address
setERC721Address (0x37e5e863)
The function for setting erc721 address
Parameters:
_nftAddress
address
the erc721 address
individualPower
uint256
the voting power of an nft
nftsTotalSupply
uint256
the total supply of nft contract
tokenAddress (0x9d76ea58)
The function for getting erc20 address
Return values:
[0]
address
tokenAddress
the erc20 address
nftAddress (0x5bf8633a)
The function for getting erc721 address
Return values:
[0]
address
nftAddress
the erc721 address
getNftInfo (0x7ca5685f)
The function for getting nft info
Return values:
isSupportPower
bool
boolean flag, if true then nft contract supports power
individualPower
uint256
the voting power an nft
totalSupply
uint256
the total supply of nfts that are not enumerable
maxLockedAmount (0x3b3707a3)
The function for getting max locked amount of a user
Parameters:
voter
address
the address of voter
Return values:
[0]
uint256
max locked amount
tokenBalance (0xe94e3c67)
The function for getting token balance of a user
Parameters:
voter
address
the address of voter
voteType
enum IGovPool.VoteType
the type of vote
Return values:
balance
uint256
the total balance with delegations
ownedBalance
uint256
the user balance that is not deposited to the contract
nftBalance (0x26836340)
The function for getting nft balance of a user
Parameters:
voter
address
the address of voter
voteType
enum IGovPool.VoteType
the type of vote
Return values:
balance
uint256
the total balance with delegations
ownedBalance
uint256
the number of nfts that are not deposited to the contract
nftExactBalance (0x3bea071d)
The function for getting nft ids of a user
Parameters:
voter
address
the address of voter
voteType
enum IGovPool.VoteType
the type of vote
Return values:
nfts
uint256[]
the array of owned nft ids
ownedLength
uint256
the number of nfts that are not deposited to the contract
getTotalNftsPower (0x4a5f293c)
The function for getting total power of nfts by ids
Parameters:
nftIds
uint256[]
the array of nft ids
voteType
enum IGovPool.VoteType
the type of vote
voter
address
the address of user
perNftPowerArray
bool
should the nft raw powers array be returned
Return values:
nftPower
uint256
the total total power of nfts
perNftPower
uint256[]
the array of nft powers, bounded with nftIds by index
getTotalPower (0x53976a26)
The function for getting total voting power of the contract
Return values:
power
uint256
total power
canCreate (0x6f123e76)
The function to define if voter is able to create a proposal. Includes micropool balance
Parameters:
voter
address
the address of voter
voteType
enum IGovPool.VoteType
the type of vote
requiredVotes
uint256
the required voting power
Return values:
[0]
bool
true
- can participate, false
- can't participate
votingPower (0xae987229)
The function for getting voting power of users
Parameters:
users
address[]
the array of users addresses
voteTypes
enum IGovPool.VoteType[]
the array of vote types
perNftPowerArray
bool
should the nft powers array be calculated
Return values:
votingPowers
struct IGovUserKeeper.VotingPowerView[]
the array of VotingPowerView structs
transformedVotingPower (0x375b592e)
The function for getting voting power after the formula
Parameters:
voter
address
the address of the voter
amount
uint256
the amount of tokens
nftIds
uint256[]
the array of nft ids
Return values:
personalPower
uint256
the personal voting power after the formula
fullPower
uint256
the personal plus delegated voting power after the formula
delegations (0x4d123d7e)
The function for getting information about user's delegations
Parameters:
user
address
the address of user
perNftPowerArray
bool
should the nft powers array be calculated
Return values:
power
uint256
the total delegated power
delegationsInfo
struct IGovUserKeeper.DelegationInfoView[]
the array of DelegationInfoView structs
getWithdrawableAssets (0x221c0fd6)
The function for getting information about funds that can be withdrawn
Parameters:
voter
address
the address of voter
lockedProposals
uint256[]
the array of ids of locked proposals
unlockedNfts
uint256[]
the array of unlocked nfts
Return values:
withdrawableTokens
uint256
the tokens that can we withdrawn
withdrawableNfts
uint256[]
the array of nfts that can we withdrawn
getDelegatedAssetsPower (0x8a3ca923)
The function for getting the total delegated power by the delegator and the delegatee
Parameters:
delegator
address
the address of the delegator
delegatee
address
the address of the delegatee
Return values:
delegatedPower
uint256
the total delegated power