diff --git a/.docs/gen-docs.sh b/.docs/gen-docs.sh deleted file mode 100755 index e44f2a46e..000000000 --- a/.docs/gen-docs.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -rm -rf generated-markups - -npm run generate-markups - -echo "Markups have been generated. Moving..." - -mkdir -p docs -rsync -av --delete generated-markups/contracts/interfaces/ docs - -rm -r generated-markups diff --git a/.husky/pre-commit b/.husky/pre-commit index 1e3080492..fb2ed4e4a 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" -npm run lint-fix && npm run generate-docs && git add -u +npm run lint-fix && git add -u diff --git a/docs/core/IContractsRegistry.md b/docs/core/IContractsRegistry.md deleted file mode 100644 index abed88e72..000000000 --- a/docs/core/IContractsRegistry.md +++ /dev/null @@ -1,197 +0,0 @@ -# IContractsRegistry - -## Interface Description - - -License: MIT - -## - -```solidity -interface IContractsRegistry -``` - -This is the registry contract of DEXE platform that stores information about -the other contracts used by the protocol. Its purpose is to keep track of the propotol's -contracts, provide upgradeability mechanism and dependency injection mechanism. -## Functions info - -### getUserRegistryContract (0x435403b4) - -```solidity -function getUserRegistryContract() external view returns (address) -``` - -Used in dependency injection mechanism - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :---------------------------- | -| [0] | address | UserRegistry contract address | - -### getPoolFactoryContract (0x475c5bc6) - -```solidity -function getPoolFactoryContract() external view returns (address) -``` - -Used in dependency injection mechanism - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :--------------------------- | -| [0] | address | PoolFactory contract address | - -### getPoolRegistryContract (0x892dd52a) - -```solidity -function getPoolRegistryContract() external view returns (address) -``` - -Used in dependency injection mechanism - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :---------------------------- | -| [0] | address | PoolRegistry contract address | - -### getDEXEContract (0x9fc64f57) - -```solidity -function getDEXEContract() external view returns (address) -``` - -Used in dependency injection mechanism - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :-------------------------- | -| [0] | address | DEXE token contract address | - -### getUSDContract (0xa5bac943) - -```solidity -function getUSDContract() external view returns (address) -``` - -Used in dependency injection mechanism - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :------------------------------------------------------------------------------- | -| [0] | address | Platform's native USD token contract address. This may be USDT/BUSD/USDC/DAI/FEI | - -### getPriceFeedContract (0x9bc0c5d2) - -```solidity -function getPriceFeedContract() external view returns (address) -``` - -Used in dependency injection mechanism - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :------------------------- | -| [0] | address | PriceFeed contract address | - -### getTreasuryContract (0x26c74fc3) - -```solidity -function getTreasuryContract() external view returns (address) -``` - -Used in dependency injection mechanism - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :------------------------------- | -| [0] | address | Treasury contract/wallet address | - -### getCorePropertiesContract (0xc1ff8103) - -```solidity -function getCorePropertiesContract() external view returns (address) -``` - -Used in dependency injection mechanism - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :------------------------------ | -| [0] | address | CoreProperties contract address | - -### getBABTContract (0x05a1b626) - -```solidity -function getBABTContract() external view returns (address) -``` - -Used in dependency injection mechanism - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :-------------------- | -| [0] | address | BABT contract address | - -### getDexeExpertNftContract (0x029f708b) - -```solidity -function getDexeExpertNftContract() external view returns (address) -``` - -Used in dependency injection mechanism - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :----------------------------- | -| [0] | address | DexeExpertNft contract address | - -### getPoolSphereXEngineContract (0x93446644) - -```solidity -function getPoolSphereXEngineContract() external view returns (address) -``` - -Used in dependency injection mechanism - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :---------------------- | -| [0] | address | SphereX engine for DAOs | - -### getSphereXEngineContract (0xb5ec48a4) - -```solidity -function getSphereXEngineContract() external view returns (address) -``` - -Used in dependency injection mechanism - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :--------------------------------- | -| [0] | address | SphereX engine for global entities | diff --git a/docs/core/ICoreProperties.md b/docs/core/ICoreProperties.md deleted file mode 100644 index 9fffb0477..000000000 --- a/docs/core/ICoreProperties.md +++ /dev/null @@ -1,194 +0,0 @@ -# ICoreProperties - -## Interface Description - - -License: MIT - -## - -```solidity -interface ICoreProperties -``` - -This is the central contract of the protocol which stores the parameters that may be modified by the DAO. -These are commissions percentages and pools parameters -## Structs info - -### CoreParameters - -```solidity -struct CoreParameters { - uint128 govVotesLimit; - uint128 govCommissionPercentage; - uint128 tokenSaleProposalCommissionPercentage; - uint128 micropoolVoteRewardsPercentage; - uint128 treasuryVoteRewardsPercentage; -} -``` - -The struct that stores vital platform's parameters that may be modified by the OWNER -The struct that stores GovPool parameters - - -Parameters: - -| Name | Type | Description | -| :------------------------------------ | :------ | :------------------------------------------------------ | -| govVotesLimit | uint128 | the maximum number of simultaneous votes of the voter | -| tokenSaleProposalCommissionPercentage | uint128 | the commission percentage for the token sale proposal | -| micropoolVoteRewardsPercentage | uint128 | the percentage of the rewards for the micropool voters | -| treasuryVoteRewardsPercentage | uint128 | the percentage of the rewards for the treasury voters | - -## Functions info - -### setCoreParameters (0xc4b85e4c) - -```solidity -function setCoreParameters( - ICoreProperties.CoreParameters calldata _coreParameters -) external -``` - -The function to set CoreParameters - - -Parameters: - -| Name | Type | Description | -| :-------------- | :------------------------------------ | :------------- | -| _coreParameters | struct ICoreProperties.CoreParameters | the parameters | - -### setDEXECommissionPercentages (0x7f5070fa) - -```solidity -function setDEXECommissionPercentages(uint128 govCommission) external -``` - -The function to modify the platform's commission percentages - - -Parameters: - -| Name | Type | Description | -| :------------ | :------ | :------------------------------------------------------------ | -| govCommission | uint128 | the gov percentage commission. Should be multiplied by 10**25 | - -### setTokenSaleProposalCommissionPercentage (0x07914c59) - -```solidity -function setTokenSaleProposalCommissionPercentage( - uint128 tokenSaleProposalCommissionPercentage -) external -``` - -The function to set new token sale proposal commission percentage - - -Parameters: - -| Name | Type | Description | -| :------------------------------------ | :------ | :---------------------------- | -| tokenSaleProposalCommissionPercentage | uint128 | the new commission percentage | - -### setVoteRewardsPercentages (0x2bc88373) - -```solidity -function setVoteRewardsPercentages( - uint128 micropoolVoteRewardsPercentage, - uint128 treasuryVoteRewardsPercentage -) external -``` - -The function to set new vote rewards percentages - - -Parameters: - -| Name | Type | Description | -| :----------------------------- | :------ | :------------------------------------------------------ | -| micropoolVoteRewardsPercentage | uint128 | the percentage of the rewards for the micropool voters | -| treasuryVoteRewardsPercentage | uint128 | the percentage of the rewards for the treasury voters | - -### setGovVotesLimit (0xd4a4bea5) - -```solidity -function setGovVotesLimit(uint128 newVotesLimit) external -``` - -The function to set new gov votes limit - - -Parameters: - -| Name | Type | Description | -| :------------ | :------ | :------------------ | -| newVotesLimit | uint128 | new gov votes limit | - -### getDEXECommissionPercentages (0x9834ceac) - -```solidity -function getDEXECommissionPercentages() - external - view - returns (uint128 govPercentage, address treasuryAddress) -``` - -The function to get commission percentage and receiver - - -Return values: - -| Name | Type | Description | -| :-------------- | :------ | :------------------------------------- | -| govPercentage | uint128 | the overall gov commission percentage | -| treasuryAddress | address | the address of the treasury commission | - -### getTokenSaleProposalCommissionPercentage (0xdcce18e7) - -```solidity -function getTokenSaleProposalCommissionPercentage() - external - view - returns (uint128) -``` - -The function to get the token sale proposal commission percentage - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :------------------------ | -| [0] | uint128 | the commission percentage | - -### getVoteRewardsPercentages (0x43570d3a) - -```solidity -function getVoteRewardsPercentages() external view returns (uint128, uint128) -``` - -The function to get the vote rewards percentages - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :------------------------------------------------------------------------------------- | -| [0] | uint128 | micropoolVoteRewardsPercentage the percentage of the rewards for the micropool voters | -| [1] | uint128 | treasuryVoteRewardsPercentage the percentage of the rewards for the treasury voters | - -### getGovVotesLimit (0x47dd039f) - -```solidity -function getGovVotesLimit() external view returns (uint128 votesLimit) -``` - -The function to get max votes limit of the gov pool - - -Return values: - -| Name | Type | Description | -| :--------- | :------ | :-------------- | -| votesLimit | uint128 | the votes limit | diff --git a/docs/core/IPriceFeed.md b/docs/core/IPriceFeed.md deleted file mode 100644 index 897f0b7f1..000000000 --- a/docs/core/IPriceFeed.md +++ /dev/null @@ -1,564 +0,0 @@ -# IPriceFeed - -## Interface Description - - -License: MIT - -## - -```solidity -interface IPriceFeed -``` - -This is the price feed contract which is used to fetch the spot prices from the UniswapV2 protocol. There also is a pathfinder -built into the contract to find the optimal* path between the pairs -## Enums info - -### PoolInterfaceType - -```solidity -enum PoolInterfaceType { - UniswapV2Interface, - UniswapV3Interface -} -``` - -The enum that holds information about the router type - - -Parameters: - -| Name | Description | -| :----------------- | :----------------------------- | -| UniswapV2Interface | the Uniswap V2 router V2 type | -| UniswapV3Interface | the Uniswap V3 quouter V2 type | - -## Structs info - -### PoolType - -```solidity -struct PoolType { - IPriceFeed.PoolInterfaceType poolType; - address router; - uint24 fee; -} -``` - -A struct describing single swapping pool parameters - - -Parameters: - -| Name | Type | Description | -| :------- | :-------------------------------- | :----------------------------------- | -| poolType | enum IPriceFeed.PoolInterfaceType | the interface type of the router | -| router | address | the address of the router or quoter | -| fee | uint24 | the pool fee (in case of V3 pools) | - -### SwapPath - -```solidity -struct SwapPath { - address[] path; - uint8[] poolTypes; -} -``` - -A struct describing a swap path - - -Parameters: - -| Name | Type | Description | -| :-------- | :-------- | :-------------------------------------- | -| path | address[] | the tokens swapped alongside the path | -| poolTypes | uint8[] | the v2/v3 pool types alongside the path | - -## Functions info - -### addPathTokens (0xf973dc01) - -```solidity -function addPathTokens(address[] calldata pathTokens) external -``` - -This function sets path tokens that will be used in the pathfinder - - -Parameters: - -| Name | Type | Description | -| :--------- | :-------- | :--------------------------------------------------- | -| pathTokens | address[] | the array of tokens to be added into the path finder | - -### removePathTokens (0x5de49e39) - -```solidity -function removePathTokens(address[] calldata pathTokens) external -``` - -This function removes path tokens from the pathfinder - - -Parameters: - -| Name | Type | Description | -| :--------- | :-------- | :---------------------------------------------------- | -| pathTokens | address[] | the array of tokens to be removed from the pathfinder | - -### setPoolTypes (0x3cbc6757) - -```solidity -function setPoolTypes(IPriceFeed.PoolType[] calldata poolTypes) external -``` - -This function sets pool types that will be used in the pathfinder - - -Parameters: - -| Name | Type | Description | -| :-------- | :--------------------------- | :---------------------- | -| poolTypes | struct IPriceFeed.PoolType[] | the array of pool types | - -### getPriceOut (0x70e48e96) - -```solidity -function getPriceOut( - address inToken, - address outToken, - uint256 amountIn -) external returns (uint256 amountOut, IPriceFeed.SwapPath memory path) -``` - -Shares the same functionality as "getExtendedPriceOut" function with an empty optionalPath. -It accepts and returns amounts with 18 decimals regardless of the inToken and outToken decimals - - -Parameters: - -| Name | Type | Description | -| :------- | :------ | :-------------------------------------------------------- | -| inToken | address | the token to exchange from | -| outToken | address | the token to exchange to | -| amountIn | uint256 | the amount of inToken to be exchanged (with 18 decimals) | - - -Return values: - -| Name | Type | Description | -| :-------- | :------------------------- | :----------------------------------------------------------------- | -| amountOut | uint256 | the received amount of outToken after the swap (with 18 decimals) | -| path | struct IPriceFeed.SwapPath | the tokens and pools path that will be used during the swap | - -### getPriceIn (0xd48c3202) - -```solidity -function getPriceIn( - address inToken, - address outToken, - uint256 amountOut -) external returns (uint256 amountIn, IPriceFeed.SwapPath memory path) -``` - -Shares the same functionality as "getExtendedPriceIn" function with with an empty optionalPath. -It accepts and returns amounts with 18 decimals regardless of the inToken and outToken decimals - - -Parameters: - -| Name | Type | Description | -| :-------- | :------ | :-------------------------------------------------------- | -| inToken | address | the token to exchange from | -| outToken | address | the token to exchange to | -| amountOut | uint256 | the amount of outToken to be received (with 18 decimals) | - - -Return values: - -| Name | Type | Description | -| :------- | :------------------------- | :----------------------------------------------------------------- | -| amountIn | uint256 | required amount of inToken to execute the swap (with 18 decimals) | -| path | struct IPriceFeed.SwapPath | the tokens path that will be used during the swap | - -### getNormalizedPriceOutUSD (0xb4c05b8c) - -```solidity -function getNormalizedPriceOutUSD( - address inToken, - uint256 amountIn -) external returns (uint256 amountOut, IPriceFeed.SwapPath memory path) -``` - -The same as "getPriceOut" with "outToken" being native USD token - - -Parameters: - -| Name | Type | Description | -| :------- | :------ | :---------------------------------------------------- | -| inToken | address | the token to be exchanged from | -| amountIn | uint256 | the amount of inToken to exchange (with 18 decimals) | - - -Return values: - -| Name | Type | Description | -| :-------- | :------------------------- | :-------------------------------------------------------------------------- | -| amountOut | uint256 | the received amount of native USD tokens after the swap (with 18 decimals) | -| path | struct IPriceFeed.SwapPath | the tokens path that will be used during the swap | - -### getNormalizedPriceInUSD (0x715c6baf) - -```solidity -function getNormalizedPriceInUSD( - address inToken, - uint256 amountOut -) external returns (uint256 amountIn, IPriceFeed.SwapPath memory path) -``` - -The same as "getPriceIn" with "outToken" being USD token - - -Parameters: - -| Name | Type | Description | -| :-------- | :------ | :--------------------------------------------------- | -| inToken | address | the token to get the price of | -| amountOut | uint256 | the amount of USD to be received (with 18 decimals) | - - -Return values: - -| Name | Type | Description | -| :------- | :------------------------- | :--------------------------------------------------------------------- | -| amountIn | uint256 | the required amount of inToken to execute the swap (with 18 decimals) | -| path | struct IPriceFeed.SwapPath | the tokens path that will be used during the swap | - -### getNormalizedPriceOutDEXE (0x291bcd52) - -```solidity -function getNormalizedPriceOutDEXE( - address inToken, - uint256 amountIn -) external returns (uint256 amountOut, IPriceFeed.SwapPath memory path) -``` - -The same as "getPriceOut" with "outToken" being DEXE token - - -Parameters: - -| Name | Type | Description | -| :------- | :------ | :---------------------------------------------------- | -| inToken | address | the token to be exchanged from | -| amountIn | uint256 | the amount of inToken to exchange (with 18 decimals) | - - -Return values: - -| Name | Type | Description | -| :-------- | :------------------------- | :-------------------------------------------------------------------- | -| amountOut | uint256 | the received amount of DEXE tokens after the swap (with 18 decimals) | -| path | struct IPriceFeed.SwapPath | the tokens path that will be used during the swap | - -### getNormalizedPriceInDEXE (0x9180f690) - -```solidity -function getNormalizedPriceInDEXE( - address inToken, - uint256 amountOut -) external returns (uint256 amountIn, IPriceFeed.SwapPath memory path) -``` - -The same as "getPriceIn" with "outToken" being DEXE token - - -Parameters: - -| Name | Type | Description | -| :-------- | :------ | :---------------------------------------------------- | -| inToken | address | the token to get the price of | -| amountOut | uint256 | the amount of DEXE to be received (with 18 decimals) | - - -Return values: - -| Name | Type | Description | -| :------- | :------------------------- | :--------------------------------------------------------------------- | -| amountIn | uint256 | the required amount of inToken to execute the swap (with 18 decimals) | -| path | struct IPriceFeed.SwapPath | the tokens path that will be used during the swap | - -### totalPathTokens (0x9f2f8ce1) - -```solidity -function totalPathTokens() external view returns (uint256) -``` - -The function that returns the total number of path tokens (tokens used in the pathfinder) - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :------------------------ | -| [0] | uint256 | the number of path tokens | - -### getPathTokens (0x547c176b) - -```solidity -function getPathTokens() external view returns (address[] memory) -``` - -The function to get the list of path tokens - - -Return values: - -| Name | Type | Description | -| :--- | :-------- | :---------------------- | -| [0] | address[] | the list of path tokens | - -### getPoolTypesLength (0x14980a8d) - -```solidity -function getPoolTypesLength() external view returns (uint256) -``` - -The function that returns the total number of pool types used in the pathfinder - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :----------------------- | -| [0] | uint256 | the number of pool types | - -### getPoolTypes (0x2fbc3b93) - -```solidity -function getPoolTypes() external view returns (IPriceFeed.PoolType[] memory) -``` - -The function to return the list of pool types used in the pathfinder - - -Return values: - -| Name | Type | Description | -| :--- | :--------------------------- | :--------------------- | -| [0] | struct IPriceFeed.PoolType[] | the list of pool types | - -### isSupportedPathToken (0xa5b0de41) - -```solidity -function isSupportedPathToken(address token) external view returns (bool) -``` - -This function checks if the provided token is used by the pathfinder - - -Parameters: - -| Name | Type | Description | -| :---- | :------ | :----------------------- | -| token | address | the token to be checked | - - -Return values: - -| Name | Type | Description | -| :--- | :--- | :----------------------------------------------------------- | -| [0] | bool | true if the token is used by the pathfinder, false otherwise | - -### getExtendedPriceOut (0x054889da) - -```solidity -function getExtendedPriceOut( - address inToken, - address outToken, - uint256 amountIn, - IPriceFeed.SwapPath memory optionalPath -) external returns (uint256 amountOut, IPriceFeed.SwapPath memory path) -``` - -This function tries to find the optimal exchange rate (the price) between "inToken" and "outToken" using -custom pathfinder and optional specified path. The optimality is reached when the amount of -outTokens is maximal - - -Parameters: - -| Name | Type | Description | -| :----------- | :------------------------- | :---------------------------------------------------------------------------------- | -| inToken | address | the token to exchange from | -| outToken | address | the received token | -| amountIn | uint256 | the amount of inToken to be exchanged (in inToken decimals) | -| optionalPath | struct IPriceFeed.SwapPath | the optional path between inToken and outToken that will be used in the pathfinder | - - -Return values: - -| Name | Type | Description | -| :-------- | :------------------------- | :-------------------------------------------------------- | -| amountOut | uint256 | amount of outToken after the swap (in outToken decimals) | -| path | struct IPriceFeed.SwapPath | the tokens path that will be used during the swap | - -### getExtendedPriceIn (0x76707b6b) - -```solidity -function getExtendedPriceIn( - address inToken, - address outToken, - uint256 amountOut, - IPriceFeed.SwapPath memory optionalPath -) external returns (uint256 amountIn, IPriceFeed.SwapPath memory path) -``` - -This function tries to find the optimal exchange rate (the price) between "inToken" and "outToken" using -custom pathfinder and optional specified path. The optimality is reached when the amount of -inTokens is minimal - - -Parameters: - -| Name | Type | Description | -| :----------- | :------------------------- | :---------------------------------------------------------------------------------- | -| inToken | address | the token to exchange from | -| outToken | address | the received token | -| amountOut | uint256 | the amount of outToken to be received (in inToken decimals) | -| optionalPath | struct IPriceFeed.SwapPath | the optional path between inToken and outToken that will be used in the pathfinder | - - -Return values: - -| Name | Type | Description | -| :------- | :------------------------- | :---------------------------------------------------------- | -| amountIn | uint256 | amount of inToken to execute a swap (in outToken decimals) | -| path | struct IPriceFeed.SwapPath | the tokens path that will be used during the swap | - -### getNormalizedExtendedPriceOut (0x62d78340) - -```solidity -function getNormalizedExtendedPriceOut( - address inToken, - address outToken, - uint256 amountIn, - IPriceFeed.SwapPath memory optionalPath -) external returns (uint256 amountOut, IPriceFeed.SwapPath memory path) -``` - -Shares the same functionality as "getExtendedPriceOut" function. -It accepts and returns amounts with 18 decimals regardless of the inToken and outToken decimals - - -Parameters: - -| Name | Type | Description | -| :----------- | :------------------------- | :---------------------------------------------------------------------------------- | -| inToken | address | the token to exchange from | -| outToken | address | the token to exchange to | -| amountIn | uint256 | the amount of inToken to be exchanged (with 18 decimals) | -| optionalPath | struct IPriceFeed.SwapPath | the optional path between inToken and outToken that will be used in the pathfinder | - - -Return values: - -| Name | Type | Description | -| :-------- | :------------------------- | :----------------------------------------------------------------- | -| amountOut | uint256 | the received amount of outToken after the swap (with 18 decimals) | -| path | struct IPriceFeed.SwapPath | the tokens path that will be used during the swap | - -### getNormalizedExtendedPriceIn (0x9ebb6389) - -```solidity -function getNormalizedExtendedPriceIn( - address inToken, - address outToken, - uint256 amountOut, - IPriceFeed.SwapPath memory optionalPath -) external returns (uint256 amountIn, IPriceFeed.SwapPath memory path) -``` - -Shares the same functionality as "getExtendedPriceIn" function. -It accepts and returns amounts with 18 decimals regardless of the inToken and outToken decimals - - -Parameters: - -| Name | Type | Description | -| :----------- | :------------------------- | :---------------------------------------------------------------------------------- | -| inToken | address | the token to exchange from | -| outToken | address | the token to exchange to | -| amountOut | uint256 | the amount of outToken to be received (with 18 decimals) | -| optionalPath | struct IPriceFeed.SwapPath | the optional path between inToken and outToken that will be used in the pathfinder | - - -Return values: - -| Name | Type | Description | -| :------- | :------------------------- | :--------------------------------------------------------------------- | -| amountIn | uint256 | the required amount of inToken to execute the swap (with 18 decimals) | -| path | struct IPriceFeed.SwapPath | the tokens path that will be used during the swap | - -### getNormalizedPriceOut (0xb6ccb44d) - -```solidity -function getNormalizedPriceOut( - address inToken, - address outToken, - uint256 amountIn -) external returns (uint256 amountOut, IPriceFeed.SwapPath memory path) -``` - -Shares the same functionality as "getExtendedPriceOut" function with an empty optionalPath. -It accepts and returns amounts with 18 decimals regardless of the inToken and outToken decimals - - -Parameters: - -| Name | Type | Description | -| :------- | :------ | :-------------------------------------------------------- | -| inToken | address | the token to exchange from | -| outToken | address | the token to exchange to | -| amountIn | uint256 | the amount of inToken to be exchanged (with 18 decimals) | - - -Return values: - -| Name | Type | Description | -| :-------- | :------------------------- | :----------------------------------------------------------------- | -| amountOut | uint256 | the received amount of outToken after the swap (with 18 decimals) | -| path | struct IPriceFeed.SwapPath | the tokens path that will be used during the swap | - -### getNormalizedPriceIn (0x2bcbc598) - -```solidity -function getNormalizedPriceIn( - address inToken, - address outToken, - uint256 amountOut -) external returns (uint256 amountIn, IPriceFeed.SwapPath memory path) -``` - -Shares the same functionality as "getExtendedPriceIn" function with an empty optionalPath. -It accepts and returns amounts with 18 decimals regardless of the inToken and outToken decimals - - -Parameters: - -| Name | Type | Description | -| :-------- | :------ | :-------------------------------------------------------- | -| inToken | address | the token to exchange from | -| outToken | address | the token to exchange to | -| amountOut | uint256 | the amount of outToken to be received (with 18 decimals) | - - -Return values: - -| Name | Type | Description | -| :------- | :------------------------- | :----------------------------------------------------------------- | -| amountIn | uint256 | required amount of inToken to execute the swap (with 18 decimals) | -| path | struct IPriceFeed.SwapPath | the tokens path that will be used during the swap | diff --git a/docs/core/ISBT721.md b/docs/core/ISBT721.md deleted file mode 100644 index d2f3c2543..000000000 --- a/docs/core/ISBT721.md +++ /dev/null @@ -1,179 +0,0 @@ -# ISBT721 - -## Interface Description - - -License: MIT - -## - -```solidity -interface ISBT721 -``` - - -## Events info - -### Attest - -```solidity -event Attest(address indexed to, uint256 indexed tokenId) -``` - -This emits when a new token is created and bound to an account by -any mechanism. -Note: For a reliable `to` parameter, retrieve the transaction's -authenticated `to` field. -### Revoke - -```solidity -event Revoke(address indexed from, uint256 indexed tokenId) -``` - -This emits when an existing SBT is revoked from an account and -destroyed by any mechanism. -Note: For a reliable `from` parameter, retrieve the transaction's -authenticated `from` field. -### Burn - -```solidity -event Burn(address indexed from, uint256 indexed tokenId) -``` - -This emits when an existing SBT is burned by an account -### Transfer - -```solidity -event Transfer(address indexed from, address indexed to, uint256 indexed tokenId) -``` - -Emitted when `tokenId` token is transferred from `from` to `to`. -## Functions info - -### attest (0xeb31403f) - -```solidity -function attest(address to) external returns (uint256) -``` - -Mints SBT - -Requirements: - -- `to` must be valid. -- `to` must not exist. - -Emits a {Attest} event. -Emits a {Transfer} event. - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :---------------------------- | -| [0] | uint256 | The tokenId of the minted SBT | - -### revoke (0x74a8f103) - -```solidity -function revoke(address from) external -``` - -Revokes SBT - -Requirements: - -- `from` must exist. - -Emits a {Revoke} event. -Emits a {Transfer} event. -### burn (0x44df8e70) - -```solidity -function burn() external -``` - -At any time, an SBT receiver must be able to -disassociate themselves from an SBT publicly through calling this -function. - -Emits a {Burn} event. -Emits a {Transfer} event. -### balanceOf (0x70a08231) - -```solidity -function balanceOf(address owner) external view returns (uint256) -``` - -Count all SBTs assigned to an owner - -SBTs assigned to the zero address is considered invalid, and this -function throws for queries about the zero address. - - -Parameters: - -| Name | Type | Description | -| :---- | :------ | :---------------------------------------- | -| owner | address | An address for whom to query the balance | - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :------------------------------------------------- | -| [0] | uint256 | The number of SBTs owned by `owner`, possibly zero | - -### tokenIdOf (0x773c02d4) - -```solidity -function tokenIdOf(address from) external view returns (uint256) -``` - - - -Parameters: - -| Name | Type | Description | -| :--- | :------ | :---------------------------- | -| from | address | The address of the SBT owner | - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :------------------------------------------------------------------------------------------------- | -| [0] | uint256 | The tokenId of the owner's SBT, and throw an error if there is no SBT belongs to the given address | - -### ownerOf (0x6352211e) - -```solidity -function ownerOf(uint256 tokenId) external view returns (address) -``` - -Find the address bound to a SBT - -SBTs assigned to zero address are considered invalid, and queries -about them do throw. - - -Parameters: - -| Name | Type | Description | -| :------ | :------ | :------------------------- | -| tokenId | uint256 | The identifier for an SBT | - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :---------------------------------------- | -| [0] | address | The address of the owner bound to the SBT | - -### totalSupply (0x18160ddd) - -```solidity -function totalSupply() external view returns (uint256) -``` - -Returns the amount of tokens in existence. \ No newline at end of file diff --git a/docs/factory/IPoolFactory.md b/docs/factory/IPoolFactory.md deleted file mode 100644 index 8972f4894..000000000 --- a/docs/factory/IPoolFactory.md +++ /dev/null @@ -1,233 +0,0 @@ -# IPoolFactory - -## Interface Description - - -License: MIT - -## - -```solidity -interface IPoolFactory -``` - -This is the Factory contract for the gov pools. Anyone can create a pool for themselves to become -a governance owner (GovPool) -## Enums info - -### VotePowerType - -```solidity -enum VotePowerType { - LINEAR_VOTES, - POLYNOMIAL_VOTES, - CUSTOM_VOTES -} -``` - -The enum that holds information about calculating vote power - - -Parameters: - -| Name | Description | -| :--------------- | :------------------------------------------------- | -| LINEAR_VOTES | the vote power = number of tokens | -| POLYNOMIAL_VOTES | the vote power calculated with polynomial formula | -| CUSTOM_VOTES | the vote type defined by a customer | - -## Structs info - -### SettingsDeployParams - -```solidity -struct SettingsDeployParams { - IGovSettings.ProposalSettings[] proposalSettings; - address[] additionalProposalExecutors; -} -``` - -General settings of the pool - - -Parameters: - -| Name | Type | Description | -| :-------------------------- | :------------------------------------- | :----------------------------------------------- | -| proposalSettings | struct IGovSettings.ProposalSettings[] | list of infos about settings for proposal types | -| additionalProposalExecutors | address[] | list of additional proposal executors | - -### ValidatorsDeployParams - -```solidity -struct ValidatorsDeployParams { - string name; - string symbol; - IGovValidators.ProposalSettings proposalSettings; - address[] validators; - uint256[] balances; -} -``` - -Parameters of validators - - -Parameters: - -| Name | Type | Description | -| :--------------- | :------------------------------------- | :----------------------------------------------- | -| name | string | the name of a token used by validators | -| symbol | string | the symbol of a token used by validators | -| proposalSettings | struct IGovValidators.ProposalSettings | struct with settings for proposals | -| validators | address[] | list of the validator addresses | -| balances | uint256[] | list of initial token balances of the validators | - -### UserKeeperDeployParams - -```solidity -struct UserKeeperDeployParams { - address tokenAddress; - address nftAddress; - uint256 individualPower; - uint256 nftsTotalSupply; -} -``` - -Parameters of the user keeper - - -Parameters: - -| Name | Type | Description | -| :-------------- | :------ | :------------------------------------- | -| tokenAddress | address | address of the tokens used for voting | -| nftAddress | address | address of the NFT used for voting | -| individualPower | uint256 | the voting power of an NFT | -| nftsTotalSupply | uint256 | the NFT collection size | - -### VotePowerDeployParams - -```solidity -struct VotePowerDeployParams { - IPoolFactory.VotePowerType voteType; - bytes initData; - address presetAddress; -} -``` - -The voting power parameters - - -Parameters: - -| Name | Type | Description | -| :------------ | :------------------------------ | :------------------------------------------------------------- | -| voteType | enum IPoolFactory.VotePowerType | type of algorythm to calculate votes number from token number | -| initData | bytes | initialization data for standard contract types | -| presetAddress | address | address of custom contract (for custom voteType) | - -### GovPoolDeployParams - -```solidity -struct GovPoolDeployParams { - IPoolFactory.SettingsDeployParams settingsParams; - IPoolFactory.ValidatorsDeployParams validatorsParams; - IPoolFactory.UserKeeperDeployParams userKeeperParams; - IERC20Gov.ConstructorParams tokenParams; - IPoolFactory.VotePowerDeployParams votePowerParams; - address verifier; - bool onlyBABTHolders; - string descriptionURL; - string name; -} -``` - -The pool deploy parameters - - -Parameters: - -| Name | Type | Description | -| :--------------- | :----------------------------------------- | :------------------------------------------------------------------- | -| settingsParams | struct IPoolFactory.SettingsDeployParams | general settings of the pool | -| validatorsParams | struct IPoolFactory.ValidatorsDeployParams | parameters of validators | -| userKeeperParams | struct IPoolFactory.UserKeeperDeployParams | parameters of the user keeper | -| tokenParams | struct IERC20Gov.ConstructorParams | the gov token parameters | -| votePowerParams | struct IPoolFactory.VotePowerDeployParams | vote power parameters | -| verifier | address | the address of the verifier | -| onlyBABTHolders | bool | if true, only KYCed users will be allowed to interact with the pool | -| descriptionURL | string | the description of the pool | -| name | string | the name of the pool | - -### GovPoolPredictedAddresses - -```solidity -struct GovPoolPredictedAddresses { - address govPool; - address govTokenSale; - address govToken; - address distributionProposal; - address expertNft; - address nftMultiplier; -} -``` - -The predicted pool addresses given tx.origin and GovPool name - - -Parameters: - -| Name | Type | Description | -| :------------------- | :------ | :------------------------------------------ | -| govPool | address | the predicted govPool address | -| govTokenSale | address | the predicted govTokenSale address | -| govToken | address | the predicted govToken address | -| distributionProposal | address | the predicted distributionProposal address | -| expertNft | address | the predicted expertNft address | -| nftMultiplier | address | the predicted nftMultiplier address | - -## Functions info - -### deployGovPool (0x0cc3c11c) - -```solidity -function deployGovPool( - IPoolFactory.GovPoolDeployParams calldata parameters -) external -``` - -This function is used to deploy DAO Pool with TokenSale proposal - - -Parameters: - -| Name | Type | Description | -| :--------- | :-------------------------------------- | :------------------------- | -| parameters | struct IPoolFactory.GovPoolDeployParams | the pool deploy parameters | - -### predictGovAddresses (0x17278f74) - -```solidity -function predictGovAddresses( - address deployer, - string calldata poolName -) external view returns (IPoolFactory.GovPoolPredictedAddresses memory) -``` - -The view function that predicts the addresses where -the gov pool proxy, the gov token sale proxy and the gov token will be stored - - -Parameters: - -| Name | Type | Description | -| :------- | :------ | :---------------------------------------------- | -| deployer | address | the user that deploys the gov pool (tx.origin) | -| poolName | string | the name of the pool which is part of the salt | - - -Return values: - -| Name | Type | Description | -| :--- | :-------------------------------------------- | :---------------------- | -| [0] | struct IPoolFactory.GovPoolPredictedAddresses | the predicted addresses | diff --git a/docs/factory/IPoolRegistry.md b/docs/factory/IPoolRegistry.md deleted file mode 100644 index 3885ce571..000000000 --- a/docs/factory/IPoolRegistry.md +++ /dev/null @@ -1,55 +0,0 @@ -# IPoolRegistry - -## Interface Description - - -License: MIT - -## - -```solidity -interface IPoolRegistry -``` - -This is the PoolRegistry contract, a tuned ContractsRegistry contract. Its purpose is the management of -proposal pools, GovPools and contracts related to GovPools. -The owner of this contract is capable of upgrading pools' implementation via the ProxyBeacon pattern -## Functions info - -### addProxyPool (0x09ae152b) - -```solidity -function addProxyPool(string calldata name, address poolAddress) external -``` - -The function to add the pool proxy to the registry (called by the PoolFactory) - - -Parameters: - -| Name | Type | Description | -| :---------- | :------ | :----------------------------- | -| name | string | the type of the pool | -| poolAddress | address | the address of the pool to add | - -### isGovPool (0x9e475551) - -```solidity -function isGovPool(address potentialPool) external view returns (bool) -``` - -The function to check if the given address is a valid GovPool - - -Parameters: - -| Name | Type | Description | -| :------------ | :------ | :---------------------- | -| potentialPool | address | the address to inspect | - - -Return values: - -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------ | -| [0] | bool | true if the address is a GovPool, false otherwise | diff --git a/docs/gov/ERC20/IERC20Gov.md b/docs/gov/ERC20/IERC20Gov.md deleted file mode 100644 index 778ae0f68..000000000 --- a/docs/gov/ERC20/IERC20Gov.md +++ /dev/null @@ -1,123 +0,0 @@ -# IERC20Gov - -## Interface Description - - -License: MIT - -## - -```solidity -interface IERC20Gov -``` - -DAO pools could issue their own ERC20 token and sell it to investors with custom sale logic -## Structs info - -### ConstructorParams - -```solidity -struct ConstructorParams { - string name; - string symbol; - address[] users; - uint256 cap; - uint256 mintedTotal; - uint256[] amounts; -} -``` - -Initial ERC20Gov parameters. This struct is used as an input argument in the contract constructor - - -Parameters: - -| Name | Type | Description | -| :---------- | :-------- | :----------------------------------------------------------------------- | -| name | string | the name of the token | -| symbol | string | the symbol of the token | -| users | address[] | the list of users for which tokens are needed to be minted | -| cap | uint256 | cap on the token's total supply | -| mintedTotal | uint256 | the total amount of tokens to be minted with the contract creation | -| amounts | uint256[] | the list of token amounts which should be minted to the respective users | - -## Functions info - -### mint (0x40c10f19) - -```solidity -function mint(address account, uint256 amount) external -``` - -This function is used to mint tokens - - -Parameters: - -| Name | Type | Description | -| :------ | :------ | :-------------------------------------------- | -| account | address | the address to which tokens should be minted | -| amount | uint256 | the token amount to be minted | - -### pause (0x8456cb59) - -```solidity -function pause() external -``` - -This function is used to trigger stopped contract state -### unpause (0x3f4ba83a) - -```solidity -function unpause() external -``` - -This function is used to return default contract state -### blacklist (0xc997eb8d) - -```solidity -function blacklist(address[] calldata accounts, bool value) external -``` - -This function is used to blacklist the addresses - - -Parameters: - -| Name | Type | Description | -| :------- | :-------- | :------------------------------- | -| accounts | address[] | the addresses to be blacklisted | -| value | bool | the blacklist status | - -### totalBlacklistAccounts (0xa33556f1) - -```solidity -function totalBlacklistAccounts() external view returns (uint256) -``` - -This function is used to get the total amount of blacklisted accounts -### getBlacklistAccounts (0x59f017ed) - -```solidity -function getBlacklistAccounts( - uint256 offset, - uint256 limit -) external view returns (address[] memory) -``` - -The paginated function to get addresses of blacklisted accounts - - -Parameters: - -| Name | Type | Description | -| :----- | :------ | :---------------------------------------- | -| offset | uint256 | the starting index of the accounts array | -| limit | uint256 | the length of the array to observe | - - -Return values: - -| Name | Type | Description | -| :--- | :-------- | :------------------------ | -| [0] | address[] | requested blacklist array | diff --git a/docs/gov/ERC721/experts/IERC721Expert.md b/docs/gov/ERC721/experts/IERC721Expert.md deleted file mode 100644 index 7244d0289..000000000 --- a/docs/gov/ERC721/experts/IERC721Expert.md +++ /dev/null @@ -1,148 +0,0 @@ -# IERC721Expert - -## Interface Description - - -License: MIT - -## - -```solidity -interface IERC721Expert is IERC721Upgradeable -``` - -The ERC721 token that implements experts functionality, follows EIP-5484 -## Enums info - -### BurnAuth - -```solidity -enum BurnAuth { - IssuerOnly, - OwnerOnly, - Both, - Neither -} -``` - - -## Events info - -### Issued - -```solidity -event Issued(address indexed from, address indexed to, uint256 indexed tokenId, IERC721Expert.BurnAuth burnAuth) -``` - -Emitted when a soulbound token is issued. - - -Parameters: - -| Name | Type | Description | -| :------- | :-------------------------- | :-------------------------- | -| from | address | The issuer | -| to | address | The receiver | -| tokenId | uint256 | The id of the issued token | -| burnAuth | enum IERC721Expert.BurnAuth | the BurnAuth struct | - -### TagsAdded - -```solidity -event TagsAdded(uint256 indexed tokenId, string[] tags) -``` - -Emitted when tags are added to the SBT - - -Parameters: - -| Name | Type | Description | -| :------ | :------- | :---------------------------------- | -| tokenId | uint256 | the token where the tags are added | -| tags | string[] | the list of tags | - -## Functions info - -### burn (0x89afcb44) - -```solidity -function burn(address from) external -``` - -The function to burn the token - - -Parameters: - -| Name | Type | Description | -| :--- | :------ | :----------------------------------------- | -| from | address | the address to burn from (1 to 1 relation) | - -### isExpert (0x76c535ae) - -```solidity -function isExpert(address expert) external view returns (bool) -``` - -The function to check of a user is an expert - - -Parameters: - -| Name | Type | Description | -| :----- | :------ | :----------------- | -| expert | address | the user to check | - - -Return values: - -| Name | Type | Description | -| :--- | :--- | :------------------------ | -| [0] | bool | true if user is an expert | - -### getIdByExpert (0x6047fb89) - -```solidity -function getIdByExpert(address expert) external view returns (uint256) -``` - -The function to get the SBT id of an expert - - -Parameters: - -| Name | Type | Description | -| :----- | :------ | :----------------------------- | -| expert | address | the user to get the SBT id of | - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :----------------- | -| [0] | uint256 | SBT id of the user | - -### burnAuth (0x0489b56f) - -```solidity -function burnAuth( - uint256 tokenId -) external view returns (IERC721Expert.BurnAuth) -``` - -provides burn authorization of the token id - - -Parameters: - -| Name | Type | Description | -| :------ | :------ | :-------------------------- | -| tokenId | uint256 | The identifier for a token | - - -Return values: - -| Name | Type | Description | -| :--- | :-------------------------- | :---------- | -| [0] | enum IERC721Expert.BurnAuth | the auth | diff --git a/docs/gov/ERC721/multipliers/IAbstractERC721Multiplier.md b/docs/gov/ERC721/multipliers/IAbstractERC721Multiplier.md deleted file mode 100644 index f76b5ee98..000000000 --- a/docs/gov/ERC721/multipliers/IAbstractERC721Multiplier.md +++ /dev/null @@ -1,110 +0,0 @@ -# IAbstractERC721Multiplier - -## Interface Description - - -License: MIT - -## - -```solidity -interface IAbstractERC721Multiplier is IERC721EnumerableUpgradeable -``` - -This is the special NFT contract which behaves like a coupon that can be locked to receive -certain extra rewards proportional to the rewards in the Governance pool contract -## Structs info - -### NftInfo - -```solidity -struct NftInfo { - uint256 multiplier; - uint64 duration; - uint64 mintedAt; -} -``` - -This struct holds NFT Multiplier parameters - - -Parameters: - -| Name | Type | Description | -| :--------- | :------ | :--------------------------------------- | -| multiplier | uint256 | the basic rewards multiplier | -| duration | uint64 | the time for which an nft can be locked | -| mintedAt | uint64 | the time nft was minter | - -## Functions info - -### lock (0xdd467064) - -```solidity -function lock(uint256 tokenId) external -``` - -This function is used to lock an nft (enable corresponding basic rewards multiplier). -Only one NFT for each address can be locked at the same time - - -Parameters: - -| Name | Type | Description | -| :------ | :------ | :----------------------------- | -| tokenId | uint256 | the id of the nft to be locked | - -### unlock (0xa69df4b5) - -```solidity -function unlock() external -``` - -This function is used to unlock an nft (disable corresponding basic rewards multiplier) -### getExtraRewards (0x1429683b) - -```solidity -function getExtraRewards( - address whose, - uint256 rewards -) external view returns (uint256) -``` - -This function is used to calculate extra rewards - - -Parameters: - -| Name | Type | Description | -| :------ | :------ | :------------------------------------------------------- | -| whose | address | the address of the user who is to receive extra rewards | -| rewards | uint256 | basic rewards to be multiplied | - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :------------ | -| [0] | uint256 | extra rewards | - -### isLocked (0xf6aacfb1) - -```solidity -function isLocked(uint256 tokenId) external view returns (bool) -``` - -This function is used to check whether the passed nft id is locked - - -Parameters: - -| Name | Type | Description | -| :------ | :------ | :----------------- | -| tokenId | uint256 | the id of the nft | - - -Return values: - -| Name | Type | Description | -| :--- | :--- | :----------------------------------------------------------------- | -| [0] | bool | false if nft has expired or hasn't yet been locked, otherwise true | diff --git a/docs/gov/ERC721/multipliers/IDexeERC721Multiplier.md b/docs/gov/ERC721/multipliers/IDexeERC721Multiplier.md deleted file mode 100644 index 68e3b5a64..000000000 --- a/docs/gov/ERC721/multipliers/IDexeERC721Multiplier.md +++ /dev/null @@ -1,65 +0,0 @@ -# IDexeERC721Multiplier - -## Interface Description - - -License: MIT - -## - -```solidity -interface IDexeERC721Multiplier is IAbstractERC721Multiplier -``` - - -## Functions info - -### changeToken (0xa0545331) - -```solidity -function changeToken( - uint256 tokenId, - uint256 multiplier, - uint64 duration, - uint256 averageBalance -) external -``` - -This function is used to change the basic rewards multiplier and the time for which the current nft will be locked - - -Parameters: - -| Name | Type | Description | -| :------------- | :------ | :--------------------------------------- | -| tokenId | uint256 | the id of the nft to be changed | -| multiplier | uint256 | the basic rewards multiplier | -| duration | uint64 | the time for which an nft can be locked | -| averageBalance | uint256 | the average balance of the user's tokens | - -### getCurrentMultiplier (0xc914c789) - -```solidity -function getCurrentMultiplier( - address whose, - uint256 rewards -) external view returns (uint256 multiplier, uint256 timeLeft) -``` - -This function is used to get the current rewards multiplier and the time for which the current nft will be locked - - -Parameters: - -| Name | Type | Description | -| :------ | :------ | :------------------------------------- | -| whose | address | the address of the user to be checked | -| rewards | uint256 | basic rewards to be multiplied | - - -Return values: - -| Name | Type | Description | -| :--------- | :------ | :------------------------------------------------------ | -| multiplier | uint256 | the rewards multiplier | -| timeLeft | uint256 | seconds remaining before the current locked nft expires | diff --git a/docs/gov/ERC721/multipliers/IERC721Multiplier.md b/docs/gov/ERC721/multipliers/IERC721Multiplier.md deleted file mode 100644 index d6e9daacf..000000000 --- a/docs/gov/ERC721/multipliers/IERC721Multiplier.md +++ /dev/null @@ -1,61 +0,0 @@ -# IERC721Multiplier - -## Interface Description - - -License: MIT - -## - -```solidity -interface IERC721Multiplier is IAbstractERC721Multiplier -``` - - -## Functions info - -### changeToken (0x4ccc2757) - -```solidity -function changeToken( - uint256 tokenId, - uint256 multiplier, - uint64 duration -) external -``` - -This function is used to change the basic rewards multiplier and the time for which the current nft will be locked - - -Parameters: - -| Name | Type | Description | -| :--------- | :------ | :-------------------------------------- | -| tokenId | uint256 | the id of the nft to be changed | -| multiplier | uint256 | the basic rewards multiplier | -| duration | uint64 | the time for which an nft can be locked | - -### getCurrentMultiplier (0x0aebf7d2) - -```solidity -function getCurrentMultiplier( - address whose -) external view returns (uint256 multiplier, uint256 timeLeft) -``` - -This function is used to get the current basic rewards multiplier and the time for which the current nft will be locked - - -Parameters: - -| Name | Type | Description | -| :---- | :------ | :------------------------------------- | -| whose | address | the address of the user to be checked | - - -Return values: - -| Name | Type | Description | -| :--------- | :------ | :------------------------------------------------------ | -| multiplier | uint256 | the basic rewards multiplier | -| timeLeft | uint256 | seconds remaining before the current locked nft expires | diff --git a/docs/gov/ERC721/powers/IERC721Power.md b/docs/gov/ERC721/powers/IERC721Power.md deleted file mode 100644 index 787a89b8c..000000000 --- a/docs/gov/ERC721/powers/IERC721Power.md +++ /dev/null @@ -1,217 +0,0 @@ -# IERC721Power - -## Interface Description - - -License: MIT - -## - -```solidity -interface IERC721Power is IERC721EnumerableUpgradeable -``` - -This is the custom NFT contract with voting power -## Structs info - -### NftInfo - -```solidity -struct NftInfo { - uint64 lastUpdate; - uint256 maxRawPower; - uint256 currentRawPower; - uint256 requiredCollateral; - uint256 currentCollateral; -} -``` - -This struct holds NFT Power parameters. These parameters are used to recalculate nft power - - -Parameters: - -| Name | Type | Description | -| :----------------- | :------ | :--------------------------------------------- | -| lastUpdate | uint64 | the last time when the power was recalculated | -| maxRawPower | uint256 | the maximum raw nft power limit | -| currentRawPower | uint256 | the current raw nft power | -| requiredCollateral | uint256 | the required collateral amount | -| currentCollateral | uint256 | the current nft collateral | - -### NftInfoView - -```solidity -struct NftInfoView { - IERC721Power.NftInfo rawInfo; - uint256 maxPower; - uint256 minPower; - uint256 currentPower; -} -``` - -The struct to get info about the NFT - - -Parameters: - -| Name | Type | Description | -| :----------- | :-------------------------- | :------------------ | -| rawInfo | struct IERC721Power.NftInfo | the raw NFT info | -| maxPower | uint256 | real max nft power | -| minPower | uint256 | real min nft power | -| currentPower | uint256 | real nft power | - -## Functions info - -### addCollateral (0xa8f35adf) - -```solidity -function addCollateral(uint256 amount, uint256 tokenId) external -``` - -Add collateral amount to certain nft - - -Parameters: - -| Name | Type | Description | -| :------ | :------ | :---------- | -| amount | uint256 | Wei | -| tokenId | uint256 | Nft number | - -### removeCollateral (0x6a9b1891) - -```solidity -function removeCollateral(uint256 amount, uint256 tokenId) external -``` - -Remove collateral amount from certain nft - - -Parameters: - -| Name | Type | Description | -| :------ | :------ | :---------- | -| amount | uint256 | Wei | -| tokenId | uint256 | Nft number | - -### recalculateNftPowers (0xa79b53d5) - -```solidity -function recalculateNftPowers(uint256[] calldata tokenIds) external -``` - -Recalculate nft power (coefficient) - - -Parameters: - -| Name | Type | Description | -| :------- | :-------- | :---------- | -| tokenIds | uint256[] | Nft numbers | - -### totalPower (0xdb3ad22c) - -```solidity -function totalPower() external view returns (uint256) -``` - -Get total power - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :---------- | -| [0] | uint256 | totalPower | - -### getNftMaxPower (0x6c889f41) - -```solidity -function getNftMaxPower(uint256 tokenId) external view returns (uint256) -``` - -Return max possible power (coefficient) for nft - - -Parameters: - -| Name | Type | Description | -| :------ | :------ | :---------- | -| tokenId | uint256 | Nft number | - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :---------------- | -| [0] | uint256 | max power for Nft | - -### getNftMinPower (0x7c24b33a) - -```solidity -function getNftMinPower(uint256 tokenId) external view returns (uint256) -``` - -Return min possible power (coefficient) for nft - - -Parameters: - -| Name | Type | Description | -| :------ | :------ | :---------- | -| tokenId | uint256 | Nft number | - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :---------------- | -| [0] | uint256 | min power for Nft | - -### getNftPower (0x412e8a29) - -```solidity -function getNftPower(uint256 tokenId) external view returns (uint256) -``` - -The function to get current NFT power - - -Parameters: - -| Name | Type | Description | -| :------ | :------ | :-------------- | -| tokenId | uint256 | the Nft number | - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :----------------------- | -| [0] | uint256 | current power of the Nft | - -### getNftRequiredCollateral (0xcbf208a7) - -```solidity -function getNftRequiredCollateral( - uint256 tokenId -) external view returns (uint256) -``` - -Return required collateral amount for nft - - -Parameters: - -| Name | Type | Description | -| :------ | :------ | :---------- | -| tokenId | uint256 | Nft number | - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :-------------------------- | -| [0] | uint256 | required collateral for Nft | diff --git a/docs/gov/IGovPool.md b/docs/gov/IGovPool.md deleted file mode 100644 index 0517c5543..000000000 --- a/docs/gov/IGovPool.md +++ /dev/null @@ -1,1322 +0,0 @@ -# IGovPool - -## Interface Description - - -License: MIT - -## - -```solidity -interface IGovPool -``` - -This is the Governance pool contract. This contract is the third contract the user can deploy through -the factory. The users can participate in proposal's creation, voting and execution processes -## Enums info - -### ProposalState - -```solidity -enum ProposalState { - Voting, - WaitingForVotingTransfer, - ValidatorVoting, - Defeated, - SucceededFor, - SucceededAgainst, - Locked, - ExecutedFor, - ExecutedAgainst, - Undefined -} -``` - -The enum that holds information about proposal state - - -Parameters: - -| Name | Description | -| :----------------------- | :------------------------------------------------------------------------ | -| Voting | the proposal is in voting state | -| WaitingForVotingTransfer | the proposal is approved and waiting for transfer to validators contract | -| ValidatorVoting | the proposal is in validators voting state | -| Defeated | the proposal is defeated | -| SucceededFor | the proposal is succeeded on for step | -| SucceededAgainst | the proposal is succeeded on against step | -| Locked | the proposal is locked | -| ExecutedFor | the proposal is executed on for step | -| ExecutedAgainst | the proposal is executed on against step | -| Undefined | the proposal is undefined | - -### RewardType - -```solidity -enum RewardType { - Create, - Vote, - Execute, - SaveOffchainResults -} -``` - -The enum that holds information about reward type - - -Parameters: - -| Name | Description | -| :------------------ | :------------------------------------------- | -| Create | the reward type for proposal creation | -| Vote | the reward type for voting for proposal | -| Execute | the reward type for proposal execution | -| SaveOffchainResults | the reward type for saving off-chain results | - -### VoteType - -```solidity -enum VoteType { - PersonalVote, - MicropoolVote, - DelegatedVote, - TreasuryVote -} -``` - -The enum that holds information about vote type - - -Parameters: - -| Name | Description | -| :------------ | :---------------------------------- | -| PersonalVote | the vote type for personal voting | -| MicropoolVote | the vote type for micropool voting | -| DelegatedVote | the vote type for delegated voting | -| TreasuryVote | the vote type for treasury voting | - -## Structs info - -### Dependencies - -```solidity -struct Dependencies { - address settingsAddress; - address userKeeperAddress; - address payable validatorsAddress; - address expertNftAddress; - address nftMultiplierAddress; - address votePowerAddress; -} -``` - -The struct that holds information about dependencies - - -Parameters: - -| Name | Type | Description | -| :------------------- | :-------------- | :-------------------------------------- | -| settingsAddress | address | the address of settings contract | -| userKeeperAddress | address | the address of user keeper contract | -| validatorsAddress | address payable | the address of validators contract | -| expertNftAddress | address | the address of expert nft contract | -| nftMultiplierAddress | address | the address of nft multiplier contract | -| votePowerAddress | address | the address of vote power contract | - -### ProposalCore - -```solidity -struct ProposalCore { - IGovSettings.ProposalSettings settings; - uint64 voteEnd; - uint64 executeAfter; - bool executed; - uint256 votesFor; - uint256 votesAgainst; - uint256 rawVotesFor; - uint256 rawVotesAgainst; - uint256 givenRewards; -} -``` - -The struct holds core properties of proposal - - -Parameters: - -| Name | Type | Description | -| :-------------- | :----------------------------------- | :--------------------------------------------------------------------------------- | -| settings | struct IGovSettings.ProposalSettings | the struct that holds information about settings of the proposal | -| voteEnd | uint64 | the timestamp of voting end for the proposal | -| executeAfter | uint64 | the timestamp of execution in seconds after voting end | -| executed | bool | the boolean indicating whether the proposal has been executed | -| votesFor | uint256 | the total number of votes for the proposal from all voters | -| votesAgainst | uint256 | the total number of votes against the proposal from all voters | -| rawVotesFor | uint256 | the total number of votes for the proposal from all voters before the formula | -| rawVotesAgainst | uint256 | the total number of votes against the proposal from all voters before the formula | -| givenRewards | uint256 | the amount of rewards payable after the proposal execution | - -### ProposalAction - -```solidity -struct ProposalAction { - address executor; - uint256 value; - bytes data; -} -``` - -The struct holds information about proposal action - - -Parameters: - -| Name | Type | Description | -| :------- | :------ | :---------------------------------------------------------------------- | -| executor | address | the address of call's target, bounded by index with `value` and `data` | -| value | uint256 | the eth value for call, bounded by index with `executor` and `data` | -| data | bytes | the of call data, bounded by index with `executor` and `value` | - -### Proposal - -```solidity -struct Proposal { - IGovPool.ProposalCore core; - string descriptionURL; - IGovPool.ProposalAction[] actionsOnFor; - IGovPool.ProposalAction[] actionsOnAgainst; -} -``` - -The struct holds all information about proposal - - -Parameters: - -| Name | Type | Description | -| :--------------- | :------------------------------- | :------------------------------------------------------------------- | -| core | struct IGovPool.ProposalCore | the struct that holds information about core properties of proposal | -| descriptionURL | string | the string with link to IPFS doc with proposal description | -| actionsOnFor | struct IGovPool.ProposalAction[] | the array of structs with information about actions on for step | -| actionsOnAgainst | struct IGovPool.ProposalAction[] | the array of structs with information about actions on against step | - -### ProposalView - -```solidity -struct ProposalView { - IGovPool.Proposal proposal; - IGovValidators.ExternalProposal validatorProposal; - IGovPool.ProposalState proposalState; - uint256 requiredQuorum; - uint256 requiredValidatorsQuorum; -} -``` - -The struct that is used in view functions of contract as a return argument - - -Parameters: - -| Name | Type | Description | -| :----------------------- | :------------------------------------- | :------------------------------------------------------------------------------ | -| proposal | struct IGovPool.Proposal | the `Proposal` struct | -| validatorProposal | struct IGovValidators.ExternalProposal | the `ExternalProposal` struct | -| proposalState | enum IGovPool.ProposalState | the value from enum `ProposalState`, that shows proposal state at current time | -| requiredQuorum | uint256 | the required votes amount to confirm the proposal | -| requiredValidatorsQuorum | uint256 | the the required validator votes to confirm the proposal | - -### RawVote - -```solidity -struct RawVote { - uint256 tokensVoted; - uint256 totalVoted; - uint256 nftsAmount; - EnumerableSet.UintSet nftsVoted; -} -``` - -The struct that holds information about the typed vote (only for internal needs) - - -Parameters: - -| Name | Type | Description | -| :---------- | :--------------------------- | :-------------------------------------------------------------------------------- | -| tokensVoted | uint256 | the total erc20 amount voted from one user for the proposal before the formula | -| totalVoted | uint256 | the total power of typed votes from one user for the proposal before the formula | -| nftsAmount | uint256 | the amount of nfts participating in the vote | -| nftsVoted | struct EnumerableSet.UintSet | the set of ids of nfts voted from one user for the proposal | - -### VoteInfo - -```solidity -struct VoteInfo { - mapping(IGovPool.VoteType => struct IGovPool.RawVote) rawVotes; - bool isVoteFor; - uint256 totalVoted; - uint256 totalRawVoted; -} -``` - -The struct that holds information about the global vote properties (only for internal needs) - - -Parameters: - -| Name | Type | Description | -| :------------ | :--------------------------------------------------------- | :------------------------------------------------------------------------- | -| rawVotes | mapping(enum IGovPool.VoteType => struct IGovPool.RawVote) | matching vote types with their infos | -| isVoteFor | bool | the boolean flag that indicates whether the vote is "for" the proposal | -| totalVoted | uint256 | the total power of votes from one user for the proposal after the formula | -| totalRawVoted | uint256 | the total power of votes from one user for the proposal before the formula | - -### VoteInfoView - -```solidity -struct VoteInfoView { - bool isVoteFor; - uint256 totalVoted; - uint256 tokensVoted; - uint256 totalRawVoted; - uint256[] nftsVoted; -} -``` - -The struct that is used in view functions of contract as a return argument - - -Parameters: - -| Name | Type | Description | -| :------------ | :-------- | :-------------------------------------------------------------------------------- | -| isVoteFor | bool | the boolean flag that indicates whether the vote is "for" the proposal | -| totalVoted | uint256 | the total power of votes from one user for the proposal after the formula | -| tokensVoted | uint256 | the total erc20 amount voted from one user for the proposal before the formula | -| totalRawVoted | uint256 | the total power of typed votes from one user for the proposal before the formula | -| nftsVoted | uint256[] | the set of ids of nfts voted from one user for the proposal | - -### DelegatorRewards - -```solidity -struct DelegatorRewards { - address[] rewardTokens; - bool[] isVoteFor; - bool[] isClaimed; - uint256[] expectedRewards; -} -``` - -The struct that is used in view functions of contract as a return argument - - -Parameters: - -| Name | Type | Description | -| :-------------- | :-------- | :------------------------------------------------------------------- | -| rewardTokens | address[] | the list of reward tokens | -| isVoteFor | bool[] | the list of flags indicating whether the vote is "for" the proposal | -| isClaimed | bool[] | the list of flags indicating whether the rewards have been claimed | -| expectedRewards | uint256[] | the list of expected rewards to be claimed | - -### DelegatorInfo - -```solidity -struct DelegatorInfo { - uint256[] delegationTimes; - uint256[] delegationPowers; - mapping(uint256 => bool) isClaimed; -} -``` - -The struct that holds information about the delegator (only for internal needs) - - -Parameters: - -| Name | Type | Description | -| :--------------- | :----------------------- | :----------------------------------------------------------------------------- | -| delegationTimes | uint256[] | the list of timestamps when delegated amount was changed | -| delegationPowers | uint256[] | the list of delegated assets powers | -| isClaimed | mapping(uint256 => bool) | matching proposals ids with flags indicating whether rewards have been claimed | - -### PendingRewards - -```solidity -struct PendingRewards { - mapping(uint256 => bool) areVotingRewardsSet; - mapping(uint256 => uint256) staticRewards; - mapping(uint256 => IGovPool.VotingRewards) votingRewards; - mapping(address => uint256) offchainRewards; - EnumerableSet.AddressSet offchainTokens; -} -``` - -The struct that holds reward properties (only for internal needs) - - -Parameters: - -| Name | Type | Description | -| :------------------ | :------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------ | -| areVotingRewardsSet | mapping(uint256 => bool) | matching proposals ids with flags indicating whether voting rewards have been set during the personal or micropool claim | -| staticRewards | mapping(uint256 => uint256) | matching proposal ids to their static rewards | -| votingRewards | mapping(uint256 => struct IGovPool.VotingRewards) | matching proposal ids to their voting rewards | -| offchainRewards | mapping(address => uint256) | matching off-chain token addresses to their rewards | -| offchainTokens | struct EnumerableSet.AddressSet | the list of off-chain token addresses | - -### UserInfo - -```solidity -struct UserInfo { - mapping(uint256 => IGovPool.VoteInfo) voteInfos; - IGovPool.PendingRewards pendingRewards; - mapping(address => IGovPool.DelegatorInfo) delegatorInfos; - EnumerableSet.UintSet votedInProposals; - EnumerableSet.UintSet treasuryExemptProposals; -} -``` - -The struct that holds the user info (only for internal needs) - - -Parameters: - -| Name | Type | Description | -| :---------------------- | :------------------------------------------------ | :----------------------------------------------------- | -| voteInfos | mapping(uint256 => struct IGovPool.VoteInfo) | matching proposal ids to their infos | -| pendingRewards | struct IGovPool.PendingRewards | user's pending rewards | -| delegatorInfos | mapping(address => struct IGovPool.DelegatorInfo) | matching delegators to their infos | -| votedInProposals | struct EnumerableSet.UintSet | the list of active proposals user voted in | -| treasuryExemptProposals | struct EnumerableSet.UintSet | the list of proposals user's treasury is exempted from | - -### VotingRewards - -```solidity -struct VotingRewards { - uint256 personal; - uint256 micropool; - uint256 treasury; -} -``` - -The struct that is used in view functions of contract as a return argument - - -Parameters: - -| Name | Type | Description | -| :-------- | :------ | :-------------------------------- | -| personal | uint256 | rewards for the personal voting | -| micropool | uint256 | rewards for the micropool voting | -| treasury | uint256 | rewards for the treasury voting | - -### PendingRewardsView - -```solidity -struct PendingRewardsView { - address[] onchainTokens; - uint256[] staticRewards; - IGovPool.VotingRewards[] votingRewards; - uint256[] offchainRewards; - address[] offchainTokens; -} -``` - -The struct that is used in view functions of contract as a return argument - - -Parameters: - -| Name | Type | Description | -| :-------------- | :------------------------------ | :------------------------------------ | -| onchainTokens | address[] | the list of on-chain token addresses | -| staticRewards | uint256[] | the list of static rewards | -| votingRewards | struct IGovPool.VotingRewards[] | the list of voting rewards | -| offchainRewards | uint256[] | the list of off-chain rewards | -| offchainTokens | address[] | the list of off-chain token addresses | - -### CreditInfo - -```solidity -struct CreditInfo { - address[] tokenList; - mapping(address => IGovPool.TokenCreditInfo) tokenInfo; -} -``` - -The struct is used to hold info about validators monthly withdrawal credit - - -Parameters: - -| Name | Type | Description | -| :-------- | :-------------------------------------------------- | :-------------------------------------------------- | -| tokenList | address[] | the list of token allowed to withdraw | -| tokenInfo | mapping(address => struct IGovPool.TokenCreditInfo) | the mapping token => withdrawals history and limits | - -### TokenCreditInfo - -```solidity -struct TokenCreditInfo { - uint256 monthLimit; - uint256[] cumulativeAmounts; - uint256[] timestamps; -} -``` - -The struct is used to hold info about limits and withdrawals history - - -Parameters: - -| Name | Type | Description | -| :---------------- | :-------- | :---------------------------------------- | -| monthLimit | uint256 | the monthly withdraw limit for the token | -| cumulativeAmounts | uint256[] | the list of amounts withdrawn | -| timestamps | uint256[] | the list of timestamps of withdraws | - -### CreditInfoView - -```solidity -struct CreditInfoView { - address token; - uint256 monthLimit; - uint256 currentWithdrawLimit; -} -``` - -The struct is used to return info about current credit state - - -Parameters: - -| Name | Type | Description | -| :------------------- | :------ | :------------------------------------------------ | -| token | address | the token address | -| monthLimit | uint256 | the amount that validator could withdraw monthly | -| currentWithdrawLimit | uint256 | the amount that validators could withdraw now | - -### OffChain - -```solidity -struct OffChain { - address verifier; - string resultsHash; - mapping(bytes32 => bool) usedHashes; -} -``` - -The struct that holds off-chain properties (only for internal needs) - - -Parameters: - -| Name | Type | Description | -| :---------- | :----------------------- | :----------------------------------- | -| verifier | address | the off-chain verifier address | -| resultsHash | string | the ipfs results hash | -| usedHashes | mapping(bytes32 => bool) | matching hashes to their usage state | - -## Functions info - -### getHelperContracts (0x485f4044) - -```solidity -function getHelperContracts() - external - view - returns ( - address settings, - address userKeeper, - address validators, - address poolRegistry, - address votePower - ) -``` - -The function to get helper contract of this pool - - -Return values: - -| Name | Type | Description | -| :----------- | :------ | :--------------------- | -| settings | address | settings address | -| userKeeper | address | user keeper address | -| validators | address | validators address | -| poolRegistry | address | pool registry address | -| votePower | address | vote power address | - -### getNftContracts (0x80326e95) - -```solidity -function getNftContracts() - external - view - returns ( - address nftMultiplier, - address expertNft, - address dexeExpertNft, - address babt - ) -``` - -The function to get the nft contracts of this pool - - -Return values: - -| Name | Type | Description | -| :------------ | :------ | :------------------------------- | -| nftMultiplier | address | rewards multiplier nft contract | -| expertNft | address | local expert nft contract | -| dexeExpertNft | address | global expert nft contract | -| babt | address | binance bound token | - -### createProposal (0xda1c6cfa) - -```solidity -function createProposal( - string calldata descriptionURL, - IGovPool.ProposalAction[] calldata actionsOnFor, - IGovPool.ProposalAction[] calldata actionsOnAgainst -) external -``` - -Create proposal - - -Parameters: - -| Name | Type | Description | -| :--------------- | :------------------------------- | :------------------------------------------------------------------ | -| descriptionURL | string | IPFS url to the proposal's description | -| actionsOnFor | struct IGovPool.ProposalAction[] | the array of structs with information about actions on for step | -| actionsOnAgainst | struct IGovPool.ProposalAction[] | the array of structs with information about actions on against step | - -### createProposalAndVote (0xee0e5215) - -```solidity -function createProposalAndVote( - string calldata descriptionURL, - IGovPool.ProposalAction[] calldata actionsOnFor, - IGovPool.ProposalAction[] calldata actionsOnAgainst, - uint256 voteAmount, - uint256[] calldata voteNftIds -) external -``` - -Create and vote for on the proposal - - -Parameters: - -| Name | Type | Description | -| :--------------- | :------------------------------- | :------------------------------------------------------------------- | -| descriptionURL | string | IPFS url to the proposal's description | -| actionsOnFor | struct IGovPool.ProposalAction[] | the array of structs with information about actions on for step | -| actionsOnAgainst | struct IGovPool.ProposalAction[] | the array of structs with information about actions on against step | -| voteAmount | uint256 | the erc20 vote amount | -| voteNftIds | uint256[] | the nft ids that will be used in voting | - -### moveProposalToValidators (0x2db47bdd) - -```solidity -function moveProposalToValidators(uint256 proposalId) external -``` - -Move proposal from internal voting to `Validators` contract - - -Parameters: - -| Name | Type | Description | -| :--------- | :------ | :---------- | -| proposalId | uint256 | Proposal ID | - -### vote (0x544df02c) - -```solidity -function vote( - uint256 proposalId, - bool isVoteFor, - uint256 voteAmount, - uint256[] calldata voteNftIds -) external -``` - -The function for voting for proposal with own tokens - - -Parameters: - -| Name | Type | Description | -| :--------- | :-------- | :---------------------------------------------------- | -| proposalId | uint256 | the id of the proposal | -| isVoteFor | bool | the bool flag for voting for or against the proposal | -| voteAmount | uint256 | the erc20 vote amount | -| voteNftIds | uint256[] | the nft ids that will be used in voting | - -### cancelVote (0xbacbe2da) - -```solidity -function cancelVote(uint256 proposalId) external -``` - -The function for canceling vote - - -Parameters: - -| Name | Type | Description | -| :--------- | :------ | :---------------------------------------------------- | -| proposalId | uint256 | the id of the proposal to cancel all votes from which | - -### deposit (0xde3ab781) - -```solidity -function deposit(uint256 amount, uint256[] calldata nftIds) external -``` - -The function for depositing tokens to the pool - - -Parameters: - -| Name | Type | Description | -| :----- | :-------- | :------------------------------ | -| amount | uint256 | the erc20 deposit amount | -| nftIds | uint256[] | the array of nft ids to deposit | - -### withdraw (0xfb8c5ef0) - -```solidity -function withdraw( - address receiver, - uint256 amount, - uint256[] calldata nftIds -) external -``` - -The function for withdrawing deposited tokens - - -Parameters: - -| Name | Type | Description | -| :------- | :-------- | :------------------------------- | -| receiver | address | the withdrawal receiver address | -| amount | uint256 | the erc20 withdrawal amount | -| nftIds | uint256[] | the array of nft ids to withdraw | - -### delegate (0x46d0b0b9) - -```solidity -function delegate( - address delegatee, - uint256 amount, - uint256[] calldata nftIds -) external -``` - -The function for delegating tokens - - -Parameters: - -| Name | Type | Description | -| :-------- | :-------- | :-------------------------------------------------------------------------- | -| delegatee | address | the target address for delegation (person who will receive the delegation) | -| amount | uint256 | the erc20 delegation amount | -| nftIds | uint256[] | the array of nft ids to delegate | - -### delegateTreasury (0x39588f1e) - -```solidity -function delegateTreasury( - address delegatee, - uint256 amount, - uint256[] calldata nftIds -) external -``` - -The function for delegating tokens from treasury - - -Parameters: - -| Name | Type | Description | -| :-------- | :-------- | :-------------------------------------------------------------------------- | -| delegatee | address | the target address for delegation (person who will receive the delegation) | -| amount | uint256 | the erc20 delegation amount | -| nftIds | uint256[] | the array of nft ids to delegate | - -### undelegate (0x7810436a) - -```solidity -function undelegate( - address delegatee, - uint256 amount, - uint256[] calldata nftIds -) external -``` - -The function for undelegating delegated tokens - - -Parameters: - -| Name | Type | Description | -| :-------- | :-------- | :---------------------------------------------------------------- | -| delegatee | address | the undelegation target address (person who will be undelegated) | -| amount | uint256 | the erc20 undelegation amount | -| nftIds | uint256[] | the array of nft ids to undelegate | - -### undelegateTreasury (0xb6b90df4) - -```solidity -function undelegateTreasury( - address delegatee, - uint256 amount, - uint256[] calldata nftIds -) external -``` - -The function for undelegating delegated tokens from treasury - - -Parameters: - -| Name | Type | Description | -| :-------- | :-------- | :---------------------------------------------------------------- | -| delegatee | address | the undelegation target address (person who will be undelegated) | -| amount | uint256 | the erc20 undelegation amount | -| nftIds | uint256[] | the array of nft ids to undelegate | - -### unlock (0x2f6c493c) - -```solidity -function unlock(address user) external -``` - -The function that unlocks user funds in completed proposals - - -Parameters: - -| Name | Type | Description | -| :--- | :------ | :----------------------------- | -| user | address | the user whose funds to unlock | - -### execute (0xfe0d94c1) - -```solidity -function execute(uint256 proposalId) external -``` - -Execute proposal - - -Parameters: - -| Name | Type | Description | -| :--------- | :------ | :---------- | -| proposalId | uint256 | Proposal ID | - -### claimRewards (0x0520537f) - -```solidity -function claimRewards(uint256[] calldata proposalIds, address user) external -``` - -The function for claiming rewards from executed proposals - - -Parameters: - -| Name | Type | Description | -| :---------- | :-------- | :------------------------- | -| proposalIds | uint256[] | the array of proposal ids | -| user | address | the address of the user | - -### claimMicropoolRewards (0x7b0e1203) - -```solidity -function claimMicropoolRewards( - uint256[] calldata proposalIds, - address delegator, - address delegatee -) external -``` - -The function for claiming micropool rewards from executed proposals - - -Parameters: - -| Name | Type | Description | -| :---------- | :-------- | :---------------------------- | -| proposalIds | uint256[] | the array of proposal ids | -| delegator | address | the address of the delegator | -| delegatee | address | the address of the delegatee | - -### changeVotePower (0xcfd9c3c3) - -```solidity -function changeVotePower(address votePower) external -``` - -The function to change vote power contract - - -Parameters: - -| Name | Type | Description | -| :-------- | :------ | :---------------------------------------- | -| votePower | address | new contract for the voting power formula | - -### editDescriptionURL (0x0dbf1c47) - -```solidity -function editDescriptionURL(string calldata newDescriptionURL) external -``` - -The function for changing description url - - -Parameters: - -| Name | Type | Description | -| :---------------- | :----- | :---------------------- | -| newDescriptionURL | string | the string with new url | - -### changeVerifier (0xcf04fb94) - -```solidity -function changeVerifier(address newVerifier) external -``` - -The function for changing verifier address - - -Parameters: - -| Name | Type | Description | -| :---------- | :------ | :---------------------- | -| newVerifier | address | the address of verifier | - -### setCreditInfo (0xbaa7652f) - -```solidity -function setCreditInfo( - address[] calldata tokens, - uint256[] calldata amounts -) external -``` - -The function for setting validators credit limit - - -Parameters: - -| Name | Type | Description | -| :------ | :-------- | :-------------------------------------- | -| tokens | address[] | the list of tokens to credit | -| amounts | uint256[] | the list of amounts to credit per month | - -### transferCreditAmount (0xc1e09f97) - -```solidity -function transferCreditAmount( - address[] memory tokens, - uint256[] memory amounts, - address destination -) external -``` - -The function for fulfilling transfer request from validators - - -Parameters: - -| Name | Type | Description | -| :---------- | :-------- | :--------------------------- | -| tokens | address[] | the list of tokens to send | -| amounts | uint256[] | the list of amounts to send | -| destination | address | the address to send tokens | - -### changeBABTRestriction (0x2050a31b) - -```solidity -function changeBABTRestriction(bool onlyBABT) external -``` - -The function for changing the KYC restriction - - -Parameters: - -| Name | Type | Description | -| :------- | :--- | :---------------------------- | -| onlyBABT | bool | true id restriction is needed | - -### setNftMultiplierAddress (0xa43040eb) - -```solidity -function setNftMultiplierAddress(address nftMultiplierAddress) external -``` - -The function for setting address of nft multiplier contract - - -Parameters: - -| Name | Type | Description | -| :------------------- | :------ | :---------------------------- | -| nftMultiplierAddress | address | the address of nft multiplier | - -### saveOffchainResults (0x41c47e3e) - -```solidity -function saveOffchainResults( - string calldata resultsHash, - bytes calldata signature -) external -``` - -The function for saving ipfs hash of off-chain proposal results - - -Parameters: - -| Name | Type | Description | -| :---------- | :----- | :-------------------------- | -| resultsHash | string | the ipfs results hash | -| signature | bytes | the signature from verifier | - -### getProposals (0x5e3b4365) - -```solidity -function getProposals( - uint256 offset, - uint256 limit -) external view returns (IGovPool.ProposalView[] memory) -``` - -The paginated function for getting proposal info list - - -Parameters: - -| Name | Type | Description | -| :----- | :------ | :---------------------------------- | -| offset | uint256 | the proposal starting index | -| limit | uint256 | the number of proposals to observe | - - -Return values: - -| Name | Type | Description | -| :--- | :----------------------------- | :------------------- | -| [0] | struct IGovPool.ProposalView[] | `ProposalView` array | - -### getProposalState (0x9080936f) - -```solidity -function getProposalState( - uint256 proposalId -) external view returns (IGovPool.ProposalState) -``` - - - -Parameters: - -| Name | Type | Description | -| :--------- | :------ | :----------- | -| proposalId | uint256 | Proposal ID | - - -Return values: - -| Name | Type | Description | -| :--- | :-------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [0] | enum IGovPool.ProposalState | `ProposalState`: 0 -`Voting`, proposal where addresses can vote 1 -`WaitingForVotingTransfer`, approved proposal that waiting `moveProposalToValidators()` call 2 -`ValidatorVoting`, validators voting 3 -`Defeated`, proposal where voting time is over and proposal defeated on first or second step 4 -`SucceededFor`, successful proposal with votes for but not executed yet 5 -`SucceededAgainst`, successful proposal with votes against but not executed yet 6 -`Locked`, successful proposal but temporarily locked for execution 7 -`ExecutedFor`, executed proposal with the required number of votes on for step 8 -`ExecutedAgainst`, executed proposal with the required number of votes on against step 9 -`Undefined`, nonexistent proposal | - -### getUserActiveProposalsCount (0x38fa211c) - -```solidity -function getUserActiveProposalsCount( - address user -) external view returns (uint256) -``` - -The function for getting user's active proposals count - - -Parameters: - -| Name | Type | Description | -| :--- | :------ | :------------------- | -| user | address | the address of user | - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :----------------------------- | -| [0] | uint256 | the number of active proposals | - -### getTotalVotes (0x6545ea83) - -```solidity -function getTotalVotes( - uint256 proposalId, - address voter, - IGovPool.VoteType voteType -) external view returns (uint256, uint256, uint256, bool) -``` - -The function for getting total raw votes in the proposal by one voter - - -Parameters: - -| Name | Type | Description | -| :--------- | :--------------------- | :-------------------- | -| proposalId | uint256 | the id of proposal | -| voter | address | the address of voter | -| voteType | enum IGovPool.VoteType | the type of vote | - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :--------------------------------------------------------------------------------------------------- | -| [0] | uint256 | `Arguments`: core raw votes for, core raw votes against, user typed raw votes, is vote for indicator | - -### getProposalRequiredQuorum (0xda437f37) - -```solidity -function getProposalRequiredQuorum( - uint256 proposalId -) external view returns (uint256) -``` - -The function to get required quorum of proposal - - -Parameters: - -| Name | Type | Description | -| :--------- | :------ | :------------------ | -| proposalId | uint256 | the id of proposal | - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :------------------------------------------------ | -| [0] | uint256 | the required number for votes to reach the quorum | - -### getUserVotes (0x466d7af2) - -```solidity -function getUserVotes( - uint256 proposalId, - address voter, - IGovPool.VoteType voteType -) external view returns (IGovPool.VoteInfoView memory) -``` - -The function to get information about user's votes - - -Parameters: - -| Name | Type | Description | -| :--------- | :--------------------- | :-------------------- | -| proposalId | uint256 | the id of proposal | -| voter | address | the address of voter | -| voteType | enum IGovPool.VoteType | the type of vote | - - -Return values: - -| Name | Type | Description | -| :--- | :--------------------------- | :------------------- | -| [0] | struct IGovPool.VoteInfoView | `VoteInfoView` array | - -### getWithdrawableAssets (0x7ecd20bb) - -```solidity -function getWithdrawableAssets( - address delegator -) external view returns (uint256, uint256[] memory) -``` - -The function to get withdrawable assets - - -Parameters: - -| Name | Type | Description | -| :-------- | :------ | :--------------------- | -| delegator | address | the delegator address | - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :--------------------------------------- | -| [0] | uint256 | `Arguments`: erc20 amount, array nft ids | - -### getPendingRewards (0x566aff6a) - -```solidity -function getPendingRewards( - address user, - uint256[] calldata proposalIds -) external view returns (IGovPool.PendingRewardsView memory) -``` - -The function to get on-chain and off-chain rewards - - -Parameters: - -| Name | Type | Description | -| :---------- | :-------- | :-------------------------------------------------- | -| user | address | the address of the user whose rewards are required | -| proposalIds | uint256[] | the list of proposal ids | - - -Return values: - -| Name | Type | Description | -| :--- | :--------------------------------- | :------------------ | -| [0] | struct IGovPool.PendingRewardsView | the list of rewards | - -### getDelegatorRewards (0x529285af) - -```solidity -function getDelegatorRewards( - uint256[] calldata proposalIds, - address delegator, - address delegatee -) external view returns (IGovPool.DelegatorRewards memory) -``` - -The function to get delegator staking rewards from all micropools - - -Parameters: - -| Name | Type | Description | -| :---------- | :-------- | :---------------------------- | -| proposalIds | uint256[] | the list of proposal ids | -| delegator | address | the address of the delegator | -| delegatee | address | the address of the delegatee | - - -Return values: - -| Name | Type | Description | -| :--- | :------------------------------- | :------------------------ | -| [0] | struct IGovPool.DelegatorRewards | rewards delegator rewards | - -### getCreditInfo (0xf06817cf) - -```solidity -function getCreditInfo() - external - view - returns (IGovPool.CreditInfoView[] memory) -``` - -The function to get info about validators credit limit - - -Return values: - -| Name | Type | Description | -| :--- | :------------------------------- | :----------------------- | -| [0] | struct IGovPool.CreditInfoView[] | the list of credit infos | - -### getOffchainInfo (0xb3a72fc4) - -```solidity -function getOffchainInfo() - external - view - returns (address validator, string memory resultsHash) -``` - -The function to get off-chain info - - -Return values: - -| Name | Type | Description | -| :---------- | :------ | :-------------------- | -| validator | address | the verifier address | -| resultsHash | string | the ipfs hash | - -### getOffchainSignHash (0x8e19ade9) - -```solidity -function getOffchainSignHash( - string calldata resultsHash, - address user -) external view returns (bytes32) -``` - -The function to get the sign hash from string resultsHash, chainid, govPool address - - -Parameters: - -| Name | Type | Description | -| :---------- | :------ | :----------------------------------- | -| resultsHash | string | the ipfs hash | -| user | address | the user who requests the signature | - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :----------- | -| [0] | bytes32 | bytes32 hash | - -### getExpertStatus (0x0660b478) - -```solidity -function getExpertStatus(address user) external view returns (bool) -``` - -The function to get expert status of a voter - - -Return values: - -| Name | Type | Description | -| :--- | :--- | :----------------------------- | -| [0] | bool | address of a person, who votes | - -### coreProperties (0xe9bbc80c) - -```solidity -function coreProperties() external view returns (ICoreProperties) -``` - -The function to get core properties - - -Return values: - -| Name | Type | Description | -| :--- | :----------------------- | :-------------------------- | -| [0] | contract ICoreProperties | `ICoreProperties` interface | diff --git a/docs/gov/proposals/IDistributionProposal.md b/docs/gov/proposals/IDistributionProposal.md deleted file mode 100644 index 76b8ca742..000000000 --- a/docs/gov/proposals/IDistributionProposal.md +++ /dev/null @@ -1,121 +0,0 @@ -# IDistributionProposal - -## Interface Description - - -License: MIT - -## - -```solidity -interface IDistributionProposal -``` - -This is the contract the governance can execute in order to distribute rewards proportionally among -all the voters who participated in the certain proposal -## Structs info - -### DPInfo - -```solidity -struct DPInfo { - address rewardAddress; - uint256 rewardAmount; - mapping(address => bool) claimed; -} -``` - -The struct holds information about distribution proposal - - -Parameters: - -| Name | Type | Description | -| :------------ | :----------------------- | :--------------------------------------------------------------- | -| rewardAddress | address | the address of reward token | -| rewardAmount | uint256 | the total amount of rewards | -| claimed | mapping(address => bool) | mapping, that indicates whether the user has claimed the rewards | - -## Functions info - -### execute (0xc45e0ae6) - -```solidity -function execute( - uint256 proposalId, - address token, - uint256 amount -) external payable -``` - -Executed by `Gov` contract, creates a DP - - -Parameters: - -| Name | Type | Description | -| :--------- | :------ | :------------------------------------------- | -| proposalId | uint256 | the id of distribution proposal in Gov pool | -| token | address | the rewards token address | -| amount | uint256 | the total amount of rewards | - -### claim (0x45718278) - -```solidity -function claim(address voter, uint256[] calldata proposalIds) external -``` - -Claims distribution proposal rewards - - -Parameters: - -| Name | Type | Description | -| :---------- | :-------- | :------------------------ | -| voter | address | Voter address | -| proposalIds | uint256[] | the array of proposal ids | - -### isClaimed (0xd2ef0795) - -```solidity -function isClaimed( - uint256 proposalId, - address voter -) external view returns (bool) -``` - -Function to check if voter claimed their reward - - -Parameters: - -| Name | Type | Description | -| :--------- | :------ | :---------------------------- | -| proposalId | uint256 | the distribution proposal id | -| voter | address | the user to check | - - -Return values: - -| Name | Type | Description | -| :--- | :--- | :------------------------ | -| [0] | bool | true if reward is claimed | - -### getPotentialReward (0xfe32b0ba) - -```solidity -function getPotentialReward( - uint256 proposalId, - address voter -) external view returns (uint256) -``` - -Return potential reward. If user hasn't voted, or `getTotalVotesWeight` is zero, return zero - - -Parameters: - -| Name | Type | Description | -| :--------- | :------ | :--------------- | -| proposalId | uint256 | the proposal id | -| voter | address | Voter address | diff --git a/docs/gov/proposals/IProposalValidator.md b/docs/gov/proposals/IProposalValidator.md deleted file mode 100644 index ceed50a51..000000000 --- a/docs/gov/proposals/IProposalValidator.md +++ /dev/null @@ -1,39 +0,0 @@ -# IProposalValidator - -## Interface Description - - -License: MIT - -## - -```solidity -interface IProposalValidator -``` - -The hook contract that proposals may inherit in order to implement extra validation -## Functions info - -### validate (0x4216fc04) - -```solidity -function validate( - IGovPool.ProposalAction[] calldata actions -) external view returns (bool valid) -``` - -The hook function - - -Parameters: - -| Name | Type | Description | -| :------ | :------------------------------- | :-------------------------- | -| actions | struct IGovPool.ProposalAction[] | the proposal "for" actions | - - -Return values: - -| Name | Type | Description | -| :---- | :--- | :------------------------------------------------------------------ | -| valid | bool | "true" if everything is ok, "false" to revert the proposal creation | diff --git a/docs/gov/proposals/ITokenSaleProposal.md b/docs/gov/proposals/ITokenSaleProposal.md deleted file mode 100644 index aae4d2fc8..000000000 --- a/docs/gov/proposals/ITokenSaleProposal.md +++ /dev/null @@ -1,803 +0,0 @@ -# ITokenSaleProposal - -## Interface Description - - -License: MIT - -## - -```solidity -interface ITokenSaleProposal -``` - -The contract for the additional proposal with custom settings. -This contract acts as a marketplace to provide DAO pools with the ability to sell their own ERC20 tokens. -## Enums info - -### ParticipationType - -```solidity -enum ParticipationType { - DAOVotes, - Whitelist, - BABT, - TokenLock, - NftLock -} -``` - -The enum that represents the type of requirements to participate in the tier - - -Parameters: - -| Name | Description | -| :-------- | :------------------------------------------------------------------------- | -| DAOVotes | indicates that the user must have the required voting power | -| Whitelist | indicates that the user must be included in the whitelist of the tier | -| BABT | indicates that the user must own the BABT token | -| TokenLock | indicates that the user must lock a specific amount of tokens in the tier | -| NftLock | indicates that the user must lock an nft in the tier | - -## Structs info - -### TierMetadata - -```solidity -struct TierMetadata { - string name; - string description; -} -``` - -Metadata of the tier that is part of the initial tier parameters - - -Parameters: - -| Name | Type | Description | -| :---------- | :----- | :-------------------------- | -| name | string | the name of the tier | -| description | string | the description of the tier | - -### VestingSettings - -```solidity -struct VestingSettings { - uint256 vestingPercentage; - uint64 vestingDuration; - uint64 cliffPeriod; - uint64 unlockStep; -} -``` - -Vesting parameters that are part of the initial tier parameters - - -Parameters: - -| Name | Type | Description | -| :---------------- | :------ | :-------------------------------------------------------------------------------------- | -| vestingPercentage | uint256 | percentage of the purchased token amount that goes to vesting | -| vestingDuration | uint64 | how long vesting lasts from the time of the token purchase | -| cliffPeriod | uint64 | how long the user cannot make a vesting withdrawal from the time of the token purchase | -| unlockStep | uint64 | the tick step with which funds from the vesting are given to the buyer | - -### ParticipationDetails - -```solidity -struct ParticipationDetails { - ITokenSaleProposal.ParticipationType participationType; - bytes data; -} -``` - -Participation details that are part of the initial tier parameters - - -Parameters: - -| Name | Type | Description | -| :---------------- | :---------------------------------------- | :----------------------------------------------------------------- | -| participationType | enum ITokenSaleProposal.ParticipationType | the type of requirements to participate in the tier | -| data | bytes | the additional data associated with the participation requirements | - -### TierInitParams - -```solidity -struct TierInitParams { - ITokenSaleProposal.TierMetadata metadata; - uint256 totalTokenProvided; - uint64 saleStartTime; - uint64 saleEndTime; - uint64 claimLockDuration; - address saleTokenAddress; - address[] purchaseTokenAddresses; - uint256[] exchangeRates; - uint256 minAllocationPerUser; - uint256 maxAllocationPerUser; - ITokenSaleProposal.VestingSettings vestingSettings; - ITokenSaleProposal.ParticipationDetails[] participationDetails; -} -``` - -Initial tier parameters - - -Parameters: - -| Name | Type | Description | -| :--------------------- | :----------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| metadata | struct ITokenSaleProposal.TierMetadata | metadata of the tier (see TierMetadata) | -| totalTokenProvided | uint256 | total supply of tokens provided for the tier | -| saleStartTime | uint64 | start time of token sales | -| saleEndTime | uint64 | end time of token sales | -| claimLockDuration | uint64 | the period of time between the end of the token sale and the non-vesting tokens claiming | -| saleTokenAddress | address | address of the token being sold | -| purchaseTokenAddresses | address[] | tokens, that can be used for purchasing token of the proposal | -| exchangeRates | uint256[] | exchange rates of other tokens to the token of TokenSaleProposal. Must disregard tokens decimals. If you want to sell 1 BTC for 1 ETH, exchangeRate has to be 10**25 | -| minAllocationPerUser | uint256 | minimal allocation of tokens per one user | -| maxAllocationPerUser | uint256 | maximal allocation of tokens per one user | -| vestingSettings | struct ITokenSaleProposal.VestingSettings | settings for managing tokens vesting (unlocking). While tokens are locked investors won`t be able to withdraw them | -| participationDetails | struct ITokenSaleProposal.ParticipationDetails[] | the list of participation requirement parameters | - -### VestingTierInfo - -```solidity -struct VestingTierInfo { - uint64 vestingStartTime; - uint64 vestingEndTime; -} -``` - -Vesting tier-related parameters - - -Parameters: - -| Name | Type | Description | -| :--------------- | :----- | :-------------------------------------------------------- | -| vestingStartTime | uint64 | the start time of the vesting when the cliff period ends | -| vestingEndTime | uint64 | the end time of the vesting | - -### TierInfo - -```solidity -struct TierInfo { - bool isOff; - uint256 totalSold; - string uri; - ITokenSaleProposal.VestingTierInfo vestingTierInfo; -} -``` - -Dynamic tier parameters - - -Parameters: - -| Name | Type | Description | -| :-------------- | :---------------------------------------- | :-------------------------- | -| isOff | bool | whether the tier is off | -| totalSold | uint256 | how many tokens were sold | -| uri | string | whitelist uri | -| vestingTierInfo | struct ITokenSaleProposal.VestingTierInfo | vesting tier-related params | - -### PurchaseInfo - -```solidity -struct PurchaseInfo { - EnumerableMap.AddressToUintMap spentAmounts; - uint256 claimTotalAmount; - bool isClaimed; - EnumerableMap.AddressToUintMap lockedTokens; - EnumerableSet.AddressSet lockedNftAddresses; - mapping(address => EnumerableSet.UintSet) lockedNfts; -} -``` - -Purchase parameters - - -Parameters: - -| Name | Type | Description | -| :----------------- | :----------------------------------------------- | :------------------------------------------------------------------- | -| spentAmounts | struct EnumerableMap.AddressToUintMap | matching purchase token addresses with spent amounts | -| claimTotalAmount | uint256 | the total amount to be claimed | -| isClaimed | bool | the boolean indicating whether the purchase has been claimed or not | -| lockedTokens | struct EnumerableMap.AddressToUintMap | matching user locked tokens to locked amounts | -| lockedNftAddresses | struct EnumerableSet.AddressSet | the list of nft addresses locked by the user | -| lockedNfts | mapping(address => struct EnumerableSet.UintSet) | the list of nft ids locked by the user | - -### PurchaseView - -```solidity -struct PurchaseView { - bool isClaimed; - bool canClaim; - uint64 claimUnlockTime; - uint256 claimTotalAmount; - uint256 boughtTotalAmount; - address[] lockedTokenAddresses; - uint256[] lockedTokenAmounts; - address[] lockedNftAddresses; - uint256[][] lockedNftIds; - address[] purchaseTokenAddresses; - uint256[] purchaseTokenAmounts; -} -``` - -Purchase parameters. This struct is used in view functions as part of a return argument - - -Parameters: - -| Name | Type | Description | -| :--------------------- | :---------- | :------------------------------------------------------------------------------- | -| isClaimed | bool | the boolean indicating whether non-vesting tokens have been claimed or not | -| canClaim | bool | the boolean indication whether the user can claim non-vesting tokens | -| claimUnlockTime | uint64 | the time the user can claim its non-vesting tokens | -| claimTotalAmount | uint256 | the total amount of tokens to be claimed | -| boughtTotalAmount | uint256 | the total amount of tokens user bought including vesting and non-vesting tokens | -| lockedTokenAddresses | address[] | the list of locked token addresses | -| lockedTokenAmounts | uint256[] | the list of locked token amounts | -| lockedNftAddresses | address[] | the list of locked nft addresses | -| lockedNftIds | uint256[][] | the list of locked nft ids | -| purchaseTokenAddresses | address[] | the list of purchase token addresses | -| purchaseTokenAmounts | uint256[] | the list of purchase token amounts | - -### VestingUserInfo - -```solidity -struct VestingUserInfo { - uint64 latestVestingWithdraw; - uint256 vestingTotalAmount; - uint256 vestingWithdrawnAmount; -} -``` - -Vesting user-related parameters - - -Parameters: - -| Name | Type | Description | -| :--------------------- | :------ | :--------------------------------------------------------- | -| latestVestingWithdraw | uint64 | the latest timestamp of the vesting withdrawal | -| vestingTotalAmount | uint256 | the total amount of user vesting tokens | -| vestingWithdrawnAmount | uint256 | the total amount of tokens user has withdrawn from vesting | - -### VestingUserView - -```solidity -struct VestingUserView { - uint64 latestVestingWithdraw; - uint64 nextUnlockTime; - uint256 nextUnlockAmount; - uint256 vestingTotalAmount; - uint256 vestingWithdrawnAmount; - uint256 amountToWithdraw; - uint256 lockedAmount; -} -``` - -Vesting user-related parameters. This struct is used in view functions as part of a return argument - - -Parameters: - -| Name | Type | Description | -| :--------------------- | :------ | :------------------------------------------------------------------------------------------------ | -| latestVestingWithdraw | uint64 | the latest timestamp of the vesting withdrawal | -| nextUnlockTime | uint64 | the next time the user will receive vesting funds. It is zero if there are no more locked tokens | -| nextUnlockAmount | uint256 | the token amount which will be unlocked in the next unlock time | -| vestingTotalAmount | uint256 | the total amount of user vesting tokens | -| vestingWithdrawnAmount | uint256 | the total amount of tokens user has withdrawn from vesting | -| amountToWithdraw | uint256 | the vesting token amount which can be withdrawn in the current time | -| lockedAmount | uint256 | the vesting token amount which is locked in the current time | - -### ParticipationInfo - -```solidity -struct ParticipationInfo { - bool isWhitelisted; - bool isBABTed; - uint256 requiredDaoVotes; - EnumerableMap.AddressToUintMap requiredTokenLock; - EnumerableMap.AddressToUintMap requiredNftLock; -} -``` - -Participation parameters. Users should meet all the requirements in order to participate in the tier - - -Parameters: - -| Name | Type | Description | -| :---------------- | :------------------------------------ | :----------------------------------------------------------- | -| isWhitelisted | bool | the boolean indicating whether the tier requires whitelist | -| isBABTed | bool | the boolean indicating whether the tier requires BABT token | -| requiredDaoVotes | uint256 | the required amount of DAO votes | -| requiredTokenLock | struct EnumerableMap.AddressToUintMap | matching token address to required lock amounts | -| requiredNftLock | struct EnumerableMap.AddressToUintMap | matching nft address to required lock amounts | - -### UserInfo - -```solidity -struct UserInfo { - ITokenSaleProposal.PurchaseInfo purchaseInfo; - ITokenSaleProposal.VestingUserInfo vestingUserInfo; -} -``` - -User parameters - - -Parameters: - -| Name | Type | Description | -| :-------------- | :---------------------------------------- | :--------------------------------------- | -| purchaseInfo | struct ITokenSaleProposal.PurchaseInfo | the information about the user purchase | -| vestingUserInfo | struct ITokenSaleProposal.VestingUserInfo | the information about the user vesting | - -### UserView - -```solidity -struct UserView { - bool canParticipate; - ITokenSaleProposal.PurchaseView purchaseView; - ITokenSaleProposal.VestingUserView vestingUserView; -} -``` - -User parameters. This struct is used in view functions as a return argument - - -Parameters: - -| Name | Type | Description | -| :-------------- | :---------------------------------------- | :-------------------------------------------------------------------------------- | -| canParticipate | bool | the boolean indicating whether the user is whitelisted in the corresponding tier | -| purchaseView | struct ITokenSaleProposal.PurchaseView | the information about the user purchase | -| vestingUserView | struct ITokenSaleProposal.VestingUserView | the information about the user vesting | - -### Tier - -```solidity -struct Tier { - ITokenSaleProposal.TierInitParams tierInitParams; - ITokenSaleProposal.TierInfo tierInfo; - ITokenSaleProposal.ParticipationInfo participationInfo; - mapping(address => uint256) rates; - mapping(address => ITokenSaleProposal.UserInfo) users; -} -``` - -Tier parameters - - -Parameters: - -| Name | Type | Description | -| :---------------- | :----------------------------------------------------- | :------------------------------------------------------ | -| tierInitParams | struct ITokenSaleProposal.TierInitParams | the initial tier parameters | -| tierInfo | struct ITokenSaleProposal.TierInfo | the information about the tier | -| participationInfo | struct ITokenSaleProposal.ParticipationInfo | the information about participation requirements | -| rates | mapping(address => uint256) | the mapping of token addresses to their exchange rates | -| users | mapping(address => struct ITokenSaleProposal.UserInfo) | the mapping of user addresses to their infos | - -### TierView - -```solidity -struct TierView { - ITokenSaleProposal.TierInitParams tierInitParams; - ITokenSaleProposal.TierInfo tierInfo; -} -``` - -Tier parameters. This struct is used in view functions as a return argument - - -Parameters: - -| Name | Type | Description | -| :------------- | :--------------------------------------- | :----------------------------- | -| tierInitParams | struct ITokenSaleProposal.TierInitParams | the initial tier parameters | -| tierInfo | struct ITokenSaleProposal.TierInfo | the information about the tier | - -### WhitelistingRequest - -```solidity -struct WhitelistingRequest { - uint256 tierId; - address[] users; - string uri; -} -``` - -Whitelisting request parameters. This struct is used as an input parameter to the whitelist update function - - -Parameters: - -| Name | Type | Description | -| :----- | :-------- | :--------------------------------------- | -| tierId | uint256 | the id of the tier | -| users | address[] | the list of the users to be whitelisted | -| uri | string | tokens metadata uri | - -## Functions info - -### latestTierId (0x83d36375) - -```solidity -function latestTierId() external view returns (uint256) -``` - -This function is used to get id (index) of the latest tier of the token sale - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :------------------------ | -| [0] | uint256 | the id of the latest tier | - -### createTiers (0x6a6effda) - -```solidity -function createTiers( - ITokenSaleProposal.TierInitParams[] calldata tiers -) external -``` - -This function is used for tiers creation - - -Parameters: - -| Name | Type | Description | -| :---- | :----------------------------------------- | :------------------ | -| tiers | struct ITokenSaleProposal.TierInitParams[] | parameters of tiers | - -### addToWhitelist (0xce6c2d91) - -```solidity -function addToWhitelist( - ITokenSaleProposal.WhitelistingRequest[] calldata requests -) external -``` - -This function is used to add users to the whitelist of tier - - -Parameters: - -| Name | Type | Description | -| :------- | :---------------------------------------------- | :----------------------------------------- | -| requests | struct ITokenSaleProposal.WhitelistingRequest[] | requests for adding users to the whitelist | - -### offTiers (0x20274396) - -```solidity -function offTiers(uint256[] calldata tierIds) external -``` - -This function is used to set given tiers inactive - - -Parameters: - -| Name | Type | Description | -| :------ | :-------- | :----------------------- | -| tierIds | uint256[] | tier ids to set inactive | - -### recover (0xc59b695a) - -```solidity -function recover(uint256[] calldata tierIds) external -``` - -This function is used to return to the DAO treasury tokens that have not been purchased during sale - - -Parameters: - -| Name | Type | Description | -| :------ | :-------- | :----------------------- | -| tierIds | uint256[] | tier ids to recover from | - -### claim (0x6ba4c138) - -```solidity -function claim(uint256[] calldata tierIds) external -``` - -This function is used to withdraw non-vesting tokens from given tiers - - -Parameters: - -| Name | Type | Description | -| :------ | :-------- | :-------------------------------- | -| tierIds | uint256[] | tier ids to make withdrawals from | - -### vestingWithdraw (0xe2bdc496) - -```solidity -function vestingWithdraw(uint256[] calldata tierIds) external -``` - -This function is used to withdraw vesting tokens from given tiers - - -Parameters: - -| Name | Type | Description | -| :------ | :-------- | :-------------------------------- | -| tierIds | uint256[] | tier ids to make withdrawals from | - -### buy (0x2afaca20) - -```solidity -function buy( - uint256 tierId, - address tokenToBuyWith, - uint256 amount -) external payable -``` - -This function is used to purchase tokens in the given tier - - -Parameters: - -| Name | Type | Description | -| :------------- | :------ | :--------------------------------------------------------------------------- | -| tierId | uint256 | the id of the tier where tokens will be purchased | -| tokenToBuyWith | address | the token that will be used (exchanged) to purchase token on the token sale | -| amount | uint256 | the amount of the token to be used for this exchange | - -### lockParticipationTokens (0x66813a3b) - -```solidity -function lockParticipationTokens( - uint256 tierId, - address tokenToLock, - uint256 amountToLock -) external payable -``` - -This function is used to lock the specified amount of tokens to participate in the given tier - - -Parameters: - -| Name | Type | Description | -| :----------- | :------ | :----------------------------------------- | -| tierId | uint256 | the id of the tier to lock the tokens for | -| tokenToLock | address | the address of the token to be locked | -| amountToLock | uint256 | the number of tokens to be locked | - -### lockParticipationNft (0x1ec3f9b7) - -```solidity -function lockParticipationNft( - uint256 tierId, - address nftToLock, - uint256[] calldata nftIdsToLock -) external -``` - -This function is used to lock the specified nft to participate in the given tier - - -Parameters: - -| Name | Type | Description | -| :----------- | :-------- | :-------------------------------------- | -| tierId | uint256 | the id of the tier to lock the nft for | -| nftToLock | address | the address of nft to be locked | -| nftIdsToLock | uint256[] | the list of nft ids to be locked | - -### unlockParticipationTokens (0x78ee27d7) - -```solidity -function unlockParticipationTokens( - uint256 tierId, - address tokenToUnlock, - uint256 amountToUnlock -) external -``` - -This function is used to unlock participation tokens - - -Parameters: - -| Name | Type | Description | -| :------------- | :------ | :------------------------------------------- | -| tierId | uint256 | the id of the tier to unlock the tokens for | -| tokenToUnlock | address | the address of the token to be unlocked | -| amountToUnlock | uint256 | the number of tokens to be unlocked | - -### unlockParticipationNft (0x9471f309) - -```solidity -function unlockParticipationNft( - uint256 tierId, - address nftToUnlock, - uint256[] calldata nftIdsToUnlock -) external -``` - -This function is used to unlock the participation nft - - -Parameters: - -| Name | Type | Description | -| :------------- | :-------- | :---------------------------------------- | -| tierId | uint256 | the id of the tier to unlock the nft for | -| nftToUnlock | address | the address of nft to be unlocked | -| nftIdsToUnlock | uint256[] | the list of nft ids to be unlocked | - -### getSaleTokenAmount (0xceded63c) - -```solidity -function getSaleTokenAmount( - address user, - uint256 tierId, - address tokenToBuyWith, - uint256 amount -) external view returns (uint256) -``` - -This function is used to get amount of `TokenSaleProposal` tokens that can be purchased - - -Parameters: - -| Name | Type | Description | -| :------------- | :------ | :------------------------------------------------ | -| user | address | the address of the user that purchases tokens | -| tierId | uint256 | the id of the tier in which tokens are purchased | -| tokenToBuyWith | address | the token which is used for exchange | -| amount | uint256 | the token amount used for exchange | - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :------------------------- | -| [0] | uint256 | expected sale token amount | - -### getClaimAmounts (0xd6e93fb2) - -```solidity -function getClaimAmounts( - address user, - uint256[] calldata tierIds -) external view returns (uint256[] memory claimAmounts) -``` - -This function is used to get information about the amount of non-vesting tokens that user can withdraw (that are unlocked) from given tiers - - -Parameters: - -| Name | Type | Description | -| :------ | :-------- | :----------------------- | -| user | address | the address of the user | -| tierIds | uint256[] | the array of tier ids | - - -Return values: - -| Name | Type | Description | -| :----------- | :-------- | :-------------------------------------------------------------- | -| claimAmounts | uint256[] | the array of token amounts that can be withdrawn from each tier | - -### getVestingWithdrawAmounts (0x47d436f7) - -```solidity -function getVestingWithdrawAmounts( - address user, - uint256[] calldata tierIds -) external view returns (uint256[] memory vestingWithdrawAmounts) -``` - -This function is used to get information about the amount of vesting tokens that user can withdraw (that are unlocked) from given tiers - - -Parameters: - -| Name | Type | Description | -| :------ | :-------- | :----------------------- | -| user | address | the address of the user | -| tierIds | uint256[] | the array of tier ids | - - -Return values: - -| Name | Type | Description | -| :--------------------- | :-------- | :-------------------------------------------------------------- | -| vestingWithdrawAmounts | uint256[] | the array of token amounts that can be withdrawn from each tier | - -### getRecoverAmounts (0x69bc02d5) - -```solidity -function getRecoverAmounts( - uint256[] calldata tierIds -) external view returns (uint256[] memory recoveringAmounts) -``` - -This function is used to get amount of tokens that have not been purchased during sale in given tiers and can be returned to DAO treasury - - -Parameters: - -| Name | Type | Description | -| :------ | :-------- | :--------------------- | -| tierIds | uint256[] | the array of tier ids | - - -Return values: - -| Name | Type | Description | -| :---------------- | :-------- | :--------------------------------------------------------------------------- | -| recoveringAmounts | uint256[] | the array of token amounts that can be returned to DAO treasury in each tier | - -### getTierViews (0x884ce0bd) - -```solidity -function getTierViews( - uint256 offset, - uint256 limit -) external view returns (ITokenSaleProposal.TierView[] memory tierViews) -``` - -This function is used to get a list of tiers - - -Parameters: - -| Name | Type | Description | -| :----- | :------ | :-------------------------------------------- | -| offset | uint256 | the offset of the list | -| limit | uint256 | the limit for amount of elements in the list | - - -Return values: - -| Name | Type | Description | -| :-------- | :----------------------------------- | :--------------------- | -| tierViews | struct ITokenSaleProposal.TierView[] | the list of tier views | - -### getUserViews (0xb27f37a2) - -```solidity -function getUserViews( - address user, - uint256[] calldata tierIds -) external view returns (ITokenSaleProposal.UserView[] memory userViews) -``` - -This function is used to get user's infos from tiers - - -Parameters: - -| Name | Type | Description | -| :------ | :-------- | :------------------------------------------------ | -| user | address | the address of the user whose infos are required | -| tierIds | uint256[] | the list of tier ids to get infos from | - - -Return values: - -| Name | Type | Description | -| :-------- | :----------------------------------- | :--------------------- | -| userViews | struct ITokenSaleProposal.UserView[] | the list of user views | diff --git a/docs/gov/settings/IGovSettings.md b/docs/gov/settings/IGovSettings.md deleted file mode 100644 index e0e6ef49b..000000000 --- a/docs/gov/settings/IGovSettings.md +++ /dev/null @@ -1,229 +0,0 @@ -# IGovSettings - -## Interface Description - - -License: MIT - -## - -```solidity -interface IGovSettings -``` - -This is the contract that stores proposal settings that will be used by the governance pool -## Enums info - -### ExecutorType - -```solidity -enum ExecutorType { - DEFAULT, - INTERNAL, - VALIDATORS -} -``` - - -## Structs info - -### ProposalSettings - -```solidity -struct ProposalSettings { - bool earlyCompletion; - bool delegatedVotingAllowed; - bool validatorsVote; - uint64 duration; - uint64 durationValidators; - uint64 executionDelay; - uint128 quorum; - uint128 quorumValidators; - uint256 minVotesForVoting; - uint256 minVotesForCreating; - IGovSettings.RewardsInfo rewardsInfo; - string executorDescription; -} -``` - -The struct holds information about settings for proposal type - - -Parameters: - -| Name | Type | Description | -| :--------------------- | :------------------------------ | :--------------------------------------------------------------------------------------------------------------- | -| earlyCompletion | bool | the boolean flag, if true the voting completes as soon as the quorum is reached | -| delegatedVotingAllowed | bool | the boolean flag, if true then delegators can vote with their own delegated tokens, else micropool vote allowed | -| validatorsVote | bool | the boolean flag, if true then voting will have an additional validators step | -| duration | uint64 | the duration of voting in seconds | -| durationValidators | uint64 | the duration of validators voting in seconds | -| executionDelay | uint64 | the delay in seconds before the proposal can be executed | -| quorum | uint128 | the percentage of total votes supply (erc20 + nft) to confirm the proposal | -| quorumValidators | uint128 | the percentage of total validator token supply to confirm the proposal | -| minVotesForVoting | uint256 | the minimal needed voting power to vote for the proposal | -| minVotesForCreating | uint256 | the minimal needed voting power to create the proposal | -| rewardsInfo | struct IGovSettings.RewardsInfo | the reward info for proposal creation and execution | -| executorDescription | string | the settings description string | - -### RewardsInfo - -```solidity -struct RewardsInfo { - address rewardToken; - uint256 creationReward; - uint256 executionReward; - uint256 voteRewardsCoefficient; -} -``` - -The struct holds information about rewards for proposals - - -Parameters: - -| Name | Type | Description | -| :--------------------- | :------ | :------------------------------------------------ | -| rewardToken | address | the reward token address | -| creationReward | uint256 | the amount of reward for proposal creation | -| executionReward | uint256 | the amount of reward for proposal execution | -| voteRewardsCoefficient | uint256 | the reward multiplier for voting for the proposal | - -## Functions info - -### executorToSettings (0x793e1468) - -```solidity -function executorToSettings(address executor) external view returns (uint256) -``` - -The function to get settings of this executor - - -Parameters: - -| Name | Type | Description | -| :------- | :------ | :------------ | -| executor | address | the executor | - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :------------------------- | -| [0] | uint256 | setting id of the executor | - -### addSettings (0x6a11e769) - -```solidity -function addSettings( - IGovSettings.ProposalSettings[] calldata _settings -) external -``` - -Add new types to contract - - -Parameters: - -| Name | Type | Description | -| :-------- | :------------------------------------- | :----------- | -| _settings | struct IGovSettings.ProposalSettings[] | New settings | - -### editSettings (0x2d141cdd) - -```solidity -function editSettings( - uint256[] calldata settingsIds, - IGovSettings.ProposalSettings[] calldata _settings -) external -``` - -Edit existed type - - -Parameters: - -| Name | Type | Description | -| :---------- | :------------------------------------- | :-------------------- | -| settingsIds | uint256[] | Existed settings IDs | -| _settings | struct IGovSettings.ProposalSettings[] | New settings | - -### changeExecutors (0xf7e1ef01) - -```solidity -function changeExecutors( - address[] calldata executors, - uint256[] calldata settingsIds -) external -``` - -Change executors association - - -Parameters: - -| Name | Type | Description | -| :---------- | :-------- | :---------- | -| executors | address[] | Addresses | -| settingsIds | uint256[] | New types | - -### getDefaultSettings (0x00d04976) - -```solidity -function getDefaultSettings() - external - view - returns (IGovSettings.ProposalSettings memory) -``` - -The function to get default settings - - -Return values: - -| Name | Type | Description | -| :--- | :----------------------------------- | :-------------- | -| [0] | struct IGovSettings.ProposalSettings | default setting | - -### getInternalSettings (0x79dcff40) - -```solidity -function getInternalSettings() - external - view - returns (IGovSettings.ProposalSettings memory) -``` - -The function to get internal settings - - -Return values: - -| Name | Type | Description | -| :--- | :----------------------------------- | :--------------- | -| [0] | struct IGovSettings.ProposalSettings | internal setting | - -### getExecutorSettings (0x57404769) - -```solidity -function getExecutorSettings( - address executor -) external view returns (IGovSettings.ProposalSettings memory) -``` - -The function the get the settings of the executor - - -Parameters: - -| Name | Type | Description | -| :------- | :------ | :---------------- | -| executor | address | Executor address | - - -Return values: - -| Name | Type | Description | -| :--- | :----------------------------------- | :--------------------------------------- | -| [0] | struct IGovSettings.ProposalSettings | `ProposalSettings` by `executor` address | diff --git a/docs/gov/user-keeper/IGovUserKeeper.md b/docs/gov/user-keeper/IGovUserKeeper.md deleted file mode 100644 index 268273b1c..000000000 --- a/docs/gov/user-keeper/IGovUserKeeper.md +++ /dev/null @@ -1,901 +0,0 @@ -# IGovUserKeeper - -## Interface Description - - -License: MIT - -## - -```solidity -interface IGovUserKeeper -``` - -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 - -```solidity -struct BalanceInfo { - uint256 tokens; - EnumerableSet.UintSet nfts; -} -``` - -The struct holds information about user deposited tokens - - -Parameters: - -| Name | Type | Description | -| :----- | :--------------------------- | :------------------------------ | -| tokens | uint256 | the amount of deposited tokens | -| nfts | struct EnumerableSet.UintSet | the array of deposited nfts | - -### UserInfo - -```solidity -struct UserInfo { - mapping(IGovPool.VoteType => struct IGovUserKeeper.BalanceInfo) balances; - mapping(IGovPool.VoteType => uint256) nftsPowers; - mapping(address => IGovUserKeeper.BalanceInfo) delegatedBalances; - mapping(address => uint256) delegatedNftPowers; - IGovUserKeeper.BalanceInfo allDelegatedBalance; - EnumerableSet.AddressSet delegatees; - uint256 maxTokensLocked; - mapping(uint256 => uint256) lockedInProposals; -} -``` - -The struct holds information about user balances - - -Parameters: - -| Name | Type | Description | -| :------------------ | :------------------------------------------------------------------- | :------------------------------------------------- | -| 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 - -```solidity -struct NFTInfo { - address nftAddress; - bool isSupportPower; - uint256 individualPower; - uint256 totalSupply; - mapping(uint256 => uint256) nftMinPower; -} -``` - -The struct holds information about nft contract - - -Parameters: - -| Name | Type | Description | -| :-------------- | :-------------------------- | :------------------------------------------------------ | -| 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 - -```solidity -struct VotingPowerView { - uint256 power; - uint256 rawPower; - uint256 nftPower; - uint256 rawNftPower; - uint256[] perNftPower; - uint256 ownedBalance; - uint256 ownedLength; - uint256[] nftIds; -} -``` - -The struct that is used in view functions of contract as a return argument - - -Parameters: - -| Name | Type | Description | -| :----------- | :-------- | :------------------------------------------------------ | -| 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 - -```solidity -struct DelegationInfoView { - address delegatee; - uint256 delegatedTokens; - uint256[] delegatedNfts; - uint256 nftPower; - uint256[] perNftPower; -} -``` - -The struct that is used in view functions of contract as a return argument - - -Parameters: - -| Name | Type | Description | -| :-------------- | :-------- | :-------------------------------------------------------------- | -| 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) - -```solidity -function depositTokens( - address payer, - address receiver, - uint256 amount -) external -``` - -The function for depositing tokens - - -Parameters: - -| Name | Type | Description | -| :------- | :------ | :---------------------------- | -| payer | address | the address of depositor | -| receiver | address | the deposit receiver address | -| amount | uint256 | the erc20 deposit amount | - -### withdrawTokens (0x5e35359e) - -```solidity -function withdrawTokens( - address payer, - address receiver, - uint256 amount -) external -``` - -The function for withdrawing tokens - - -Parameters: - -| Name | Type | Description | -| :------- | :------ | :-------------------------------------------- | -| payer | address | the address from whom to withdraw the tokens | -| receiver | address | the withdrawal receiver address | -| amount | uint256 | the erc20 withdrawal amount | - -### delegateTokens (0x9161babb) - -```solidity -function delegateTokens( - address delegator, - address delegatee, - uint256 amount -) external -``` - -The function for delegating tokens - - -Parameters: - -| Name | Type | Description | -| :-------- | :------ | :-------------------------- | -| delegator | address | the address of delegator | -| delegatee | address | the address of delegatee | -| amount | uint256 | the erc20 delegation amount | - -### delegateTokensTreasury (0x69b5330b) - -```solidity -function delegateTokensTreasury(address delegatee, uint256 amount) external -``` - -The function for delegating tokens from Treasury - - -Parameters: - -| Name | Type | Description | -| :-------- | :------ | :-------------------------- | -| delegatee | address | the address of delegatee | -| amount | uint256 | the erc20 delegation amount | - -### undelegateTokens (0x0ae1398e) - -```solidity -function undelegateTokens( - address delegator, - address delegatee, - uint256 amount -) external -``` - -The function for undelegating tokens - - -Parameters: - -| Name | Type | Description | -| :-------- | :------ | :---------------------------- | -| delegator | address | the address of delegator | -| delegatee | address | the address of delegatee | -| amount | uint256 | the erc20 undelegation amount | - -### undelegateTokensTreasury (0x86be8d2d) - -```solidity -function undelegateTokensTreasury(address delegatee, uint256 amount) external -``` - -The function for undelegating tokens from Treasury - - -Parameters: - -| Name | Type | Description | -| :-------- | :------ | :---------------------------- | -| delegatee | address | the address of delegatee | -| amount | uint256 | the erc20 undelegation amount | - -### depositNfts (0x9693caad) - -```solidity -function depositNfts( - address payer, - address receiver, - uint256[] calldata nftIds -) external -``` - -The function for depositing nfts - - -Parameters: - -| Name | Type | Description | -| :------- | :-------- | :----------------------------- | -| payer | address | the address of depositor | -| receiver | address | the deposit receiver address | -| nftIds | uint256[] | the array of deposited nft ids | - -### withdrawNfts (0x1f96f376) - -```solidity -function withdrawNfts( - address payer, - address receiver, - uint256[] calldata nftIds -) external -``` - -The function for withdrawing nfts - - -Parameters: - -| Name | Type | Description | -| :------- | :-------- | :------------------------------------------ | -| payer | address | the address from whom to withdraw the nfts | -| receiver | address | the withdrawal receiver address | -| nftIds | uint256[] | the withdrawal nft ids | - -### delegateNfts (0xbfb1a57d) - -```solidity -function delegateNfts( - address delegator, - address delegatee, - uint256[] calldata nftIds -) external -``` - -The function for delegating nfts - - -Parameters: - -| Name | Type | Description | -| :-------- | :-------- | :----------------------------- | -| delegator | address | the address of delegator | -| delegatee | address | the address of delegatee | -| nftIds | uint256[] | the array of delegated nft ids | - -### delegateNftsTreasury (0x6ad6d3c1) - -```solidity -function delegateNftsTreasury( - address delegatee, - uint256[] calldata nftIds -) external -``` - -The function for delegating nfts from Treasury - - -Parameters: - -| Name | Type | Description | -| :-------- | :-------- | :----------------------------- | -| delegatee | address | the address of delegatee | -| nftIds | uint256[] | the array of delegated nft ids | - -### undelegateNfts (0x37267d4c) - -```solidity -function undelegateNfts( - address delegator, - address delegatee, - uint256[] calldata nftIds -) external -``` - -The function for undelegating nfts - - -Parameters: - -| Name | Type | Description | -| :-------- | :-------- | :------------------------------- | -| delegator | address | the address of delegator | -| delegatee | address | the address of delegatee | -| nftIds | uint256[] | the array of undelegated nft ids | - -### undelegateNftsTreasury (0x39be038b) - -```solidity -function undelegateNftsTreasury( - address delegatee, - uint256[] calldata nftIds -) external -``` - -The function for undelegating nfts from Treasury - - -Parameters: - -| Name | Type | Description | -| :-------- | :-------- | :------------------------------- | -| delegatee | address | the address of delegatee | -| nftIds | uint256[] | the array of undelegated nft ids | - -### updateMaxTokenLockedAmount (0x5f884296) - -```solidity -function updateMaxTokenLockedAmount( - uint256[] calldata lockedProposals, - address voter -) external -``` - -The function for recalculating max token locked amount of a user - - -Parameters: - -| Name | Type | Description | -| :-------------- | :-------- | :------------------------------------------- | -| lockedProposals | uint256[] | the array of proposal ids for recalculation | -| voter | address | the address of voter | - -### lockTokens (0x154b3db0) - -```solidity -function lockTokens(uint256 proposalId, address voter, uint256 amount) external -``` - -The function for locking tokens in a proposal - - -Parameters: - -| Name | Type | Description | -| :--------- | :------ | :--------------------------- | -| proposalId | uint256 | the id of proposal | -| voter | address | the address of voter | -| amount | uint256 | the amount of tokens to lock | - -### unlockTokens (0x7fde4424) - -```solidity -function unlockTokens(uint256 proposalId, address voter) external -``` - -The function for unlocking tokens in proposal - - -Parameters: - -| Name | Type | Description | -| :--------- | :------ | :------------------- | -| proposalId | uint256 | the id of proposal | -| voter | address | the address of voter | - -### lockNfts (0x3b389164) - -```solidity -function lockNfts( - address voter, - IGovPool.VoteType voteType, - uint256[] calldata nftIds -) external -``` - -The function for locking nfts - - -Parameters: - -| Name | Type | Description | -| :------- | :--------------------- | :--------------------------- | -| 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) - -```solidity -function unlockNfts(uint256[] calldata nftIds) external -``` - -The function for unlocking nfts - - -Parameters: - -| Name | Type | Description | -| :----- | :-------- | :----------------------------- | -| nftIds | uint256[] | the array of nft ids to unlock | - -### updateNftPowers (0x30132f5e) - -```solidity -function updateNftPowers(uint256[] calldata nftIds) external -``` - -The function for recalculating power of nfts - - -Parameters: - -| Name | Type | Description | -| :----- | :-------- | :------------------------------------------------ | -| nftIds | uint256[] | the array of nft ids to recalculate the power for | - -### setERC20Address (0x41bec0d2) - -```solidity -function setERC20Address(address _tokenAddress) external -``` - -The function for setting erc20 address - - -Parameters: - -| Name | Type | Description | -| :------------ | :------ | :---------------- | -| _tokenAddress | address | the erc20 address | - -### setERC721Address (0x37e5e863) - -```solidity -function setERC721Address( - address _nftAddress, - uint256 individualPower, - uint256 nftsTotalSupply -) external -``` - -The function for setting erc721 address - - -Parameters: - -| Name | Type | Description | -| :-------------- | :------ | :------------------------------- | -| _nftAddress | address | the erc721 address | -| individualPower | uint256 | the voting power of an nft | -| nftsTotalSupply | uint256 | the total supply of nft contract | - -### tokenAddress (0x9d76ea58) - -```solidity -function tokenAddress() external view returns (address) -``` - -The function for getting erc20 address - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :------------------------------- | -| [0] | address | `tokenAddress` the erc20 address | - -### nftAddress (0x5bf8633a) - -```solidity -function nftAddress() external view returns (address) -``` - -The function for getting erc721 address - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :------------------------------ | -| [0] | address | `nftAddress` the erc721 address | - -### getNftInfo (0x7ca5685f) - -```solidity -function getNftInfo() - external - view - returns (bool isSupportPower, uint256 individualPower, uint256 totalSupply) -``` - -The function for getting nft info - - -Return values: - -| Name | Type | Description | -| :-------------- | :------ | :------------------------------------------------------ | -| 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) - -```solidity -function maxLockedAmount(address voter) external view returns (uint256) -``` - -The function for getting max locked amount of a user - - -Parameters: - -| Name | Type | Description | -| :---- | :------ | :-------------------- | -| voter | address | the address of voter | - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :------------------ | -| [0] | uint256 | `max locked amount` | - -### tokenBalance (0xe94e3c67) - -```solidity -function tokenBalance( - address voter, - IGovPool.VoteType voteType -) external view returns (uint256 balance, uint256 ownedBalance) -``` - -The function for getting token balance of a user - - -Parameters: - -| Name | Type | Description | -| :------- | :--------------------- | :-------------------- | -| voter | address | the address of voter | -| voteType | enum IGovPool.VoteType | the type of vote | - - -Return values: - -| Name | Type | Description | -| :----------- | :------ | :----------------------------------------------------- | -| balance | uint256 | the total balance with delegations | -| ownedBalance | uint256 | the user balance that is not deposited to the contract | - -### nftBalance (0x26836340) - -```solidity -function nftBalance( - address voter, - IGovPool.VoteType voteType -) external view returns (uint256 balance, uint256 ownedBalance) -``` - -The function for getting nft balance of a user - - -Parameters: - -| Name | Type | Description | -| :------- | :--------------------- | :-------------------- | -| voter | address | the address of voter | -| voteType | enum IGovPool.VoteType | the type of vote | - - -Return values: - -| Name | Type | Description | -| :----------- | :------ | :-------------------------------------------------------- | -| balance | uint256 | the total balance with delegations | -| ownedBalance | uint256 | the number of nfts that are not deposited to the contract | - -### nftExactBalance (0x3bea071d) - -```solidity -function nftExactBalance( - address voter, - IGovPool.VoteType voteType -) external view returns (uint256[] memory nfts, uint256 ownedLength) -``` - -The function for getting nft ids of a user - - -Parameters: - -| Name | Type | Description | -| :------- | :--------------------- | :-------------------- | -| voter | address | the address of voter | -| voteType | enum IGovPool.VoteType | the type of vote | - - -Return values: - -| Name | Type | Description | -| :---------- | :-------- | :-------------------------------------------------------- | -| nfts | uint256[] | the array of owned nft ids | -| ownedLength | uint256 | the number of nfts that are not deposited to the contract | - -### getTotalNftsPower (0x4a5f293c) - -```solidity -function getTotalNftsPower( - uint256[] memory nftIds, - IGovPool.VoteType voteType, - address voter, - bool perNftPowerArray -) external view returns (uint256 nftPower, uint256[] memory perNftPower) -``` - -The function for getting total power of nfts by ids - - -Parameters: - -| Name | Type | Description | -| :--------------- | :--------------------- | :------------------------------------------- | -| 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: - -| Name | Type | Description | -| :---------- | :-------- | :---------------------------------------------------- | -| nftPower | uint256 | the total total power of nfts | -| perNftPower | uint256[] | the array of nft powers, bounded with nftIds by index | - -### getTotalPower (0x53976a26) - -```solidity -function getTotalPower() external view returns (uint256 power) -``` - -The function for getting total voting power of the contract - - -Return values: - -| Name | Type | Description | -| :---- | :------ | :---------- | -| power | uint256 | total power | - -### canCreate (0x6f123e76) - -```solidity -function canCreate( - address voter, - IGovPool.VoteType voteType, - uint256 requiredVotes -) external view returns (bool) -``` - -The function to define if voter is able to create a proposal. Includes micropool balance - - -Parameters: - -| Name | Type | Description | -| :------------ | :--------------------- | :------------------------- | -| voter | address | the address of voter | -| voteType | enum IGovPool.VoteType | the type of vote | -| requiredVotes | uint256 | the required voting power | - - -Return values: - -| Name | Type | Description | -| :--- | :--- | :---------------------------------------------------- | -| [0] | bool | `true` - can participate, `false` - can't participate | - -### votingPower (0xae987229) - -```solidity -function votingPower( - address[] calldata users, - IGovPool.VoteType[] calldata voteTypes, - bool perNftPowerArray -) external view returns (IGovUserKeeper.VotingPowerView[] memory votingPowers) -``` - -The function for getting voting power of users - - -Parameters: - -| Name | Type | Description | -| :--------------- | :----------------------- | :----------------------------------------- | -| 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: - -| Name | Type | Description | -| :----------- | :-------------------------------------- | :----------------------------------- | -| votingPowers | struct IGovUserKeeper.VotingPowerView[] | the array of VotingPowerView structs | - -### transformedVotingPower (0x375b592e) - -```solidity -function transformedVotingPower( - address voter, - uint256 amount, - uint256[] calldata nftIds -) external view returns (uint256 personalPower, uint256 fullPower) -``` - -The function for getting voting power after the formula - - -Parameters: - -| Name | Type | Description | -| :----- | :-------- | :------------------------ | -| voter | address | the address of the voter | -| amount | uint256 | the amount of tokens | -| nftIds | uint256[] | the array of nft ids | - - -Return values: - -| Name | Type | Description | -| :------------ | :------ | :--------------------------------------------------------- | -| personalPower | uint256 | the personal voting power after the formula | -| fullPower | uint256 | the personal plus delegated voting power after the formula | - -### delegations (0x4d123d7e) - -```solidity -function delegations( - address user, - bool perNftPowerArray -) - external - view - returns ( - uint256 power, - IGovUserKeeper.DelegationInfoView[] memory delegationsInfo - ) -``` - -The function for getting information about user's delegations - - -Parameters: - -| Name | Type | Description | -| :--------------- | :------ | :----------------------------------------- | -| user | address | the address of user | -| perNftPowerArray | bool | should the nft powers array be calculated | - - -Return values: - -| Name | Type | Description | -| :-------------- | :----------------------------------------- | :-------------------------------------- | -| power | uint256 | the total delegated power | -| delegationsInfo | struct IGovUserKeeper.DelegationInfoView[] | the array of DelegationInfoView structs | - -### getWithdrawableAssets (0x221c0fd6) - -```solidity -function getWithdrawableAssets( - address voter, - uint256[] calldata lockedProposals, - uint256[] calldata unlockedNfts -) - external - view - returns (uint256 withdrawableTokens, uint256[] memory withdrawableNfts) -``` - -The function for getting information about funds that can be withdrawn - - -Parameters: - -| Name | Type | Description | -| :-------------- | :-------- | :------------------------------------ | -| voter | address | the address of voter | -| lockedProposals | uint256[] | the array of ids of locked proposals | -| unlockedNfts | uint256[] | the array of unlocked nfts | - - -Return values: - -| Name | Type | Description | -| :----------------- | :-------- | :-------------------------------------- | -| withdrawableTokens | uint256 | the tokens that can we withdrawn | -| withdrawableNfts | uint256[] | the array of nfts that can we withdrawn | - -### getDelegatedAssetsPower (0x8a3ca923) - -```solidity -function getDelegatedAssetsPower( - address delegator, - address delegatee -) external view returns (uint256 delegatedPower) -``` - -The function for getting the total delegated power by the delegator and the delegatee - - -Parameters: - -| Name | Type | Description | -| :-------- | :------ | :---------------------------- | -| delegator | address | the address of the delegator | -| delegatee | address | the address of the delegatee | - - -Return values: - -| Name | Type | Description | -| :------------- | :------ | :------------------------ | -| delegatedPower | uint256 | the total delegated power | diff --git a/docs/gov/validators/IGovValidators.md b/docs/gov/validators/IGovValidators.md deleted file mode 100644 index 5f473ea03..000000000 --- a/docs/gov/validators/IGovValidators.md +++ /dev/null @@ -1,432 +0,0 @@ -# IGovValidators - -## Interface Description - - -License: MIT - -## - -```solidity -interface IGovValidators -``` - -This is the voting contract that is queried on the proposal's second voting stage -## Enums info - -### ProposalState - -```solidity -enum ProposalState { - Voting, - Defeated, - Succeeded, - Locked, - Executed, - Undefined -} -``` - - -### ProposalType - -```solidity -enum ProposalType { - ChangeSettings, - ChangeBalances, - MonthlyWithdraw, - OffchainProposal -} -``` - - -## Structs info - -### ProposalSettings - -```solidity -struct ProposalSettings { - uint64 duration; - uint64 executionDelay; - uint128 quorum; -} -``` - -The struct holds information about settings for validators proposal - - -Parameters: - -| Name | Type | Description | -| :------------- | :------ | :---------------------------------------------------------------- | -| duration | uint64 | the duration of voting | -| executionDelay | uint64 | the delay in seconds after voting end | -| quorum | uint128 | the percentage of validators token supply to confirm the proposal | - -### ProposalCore - -```solidity -struct ProposalCore { - bool executed; - uint56 snapshotId; - uint64 voteEnd; - uint64 executeAfter; - uint128 quorum; - uint256 votesFor; - uint256 votesAgainst; -} -``` - -The struct holds core properties of a proposal - - -Parameters: - -| Name | Type | Description | -| :----------- | :------ | :----------------------------------------------------------------------- | -| executed | bool | the boolean flag that indicates whether the proposal is executed or not | -| snapshotId | uint56 | the id of snapshot | -| voteEnd | uint64 | the timestamp of voting end of the proposal | -| executeAfter | uint64 | the timestamp of execution in seconds after voting end | -| quorum | uint128 | the percentage of validators token supply to confirm the proposal | -| votesFor | uint256 | the total number of votes in proposal from all voters | -| votesAgainst | uint256 | the total number of votes against proposal from all voters | - -### InternalProposal - -```solidity -struct InternalProposal { - IGovValidators.ProposalType proposalType; - IGovValidators.ProposalCore core; - string descriptionURL; - bytes data; -} -``` - -The struct holds information about the internal proposal - - -Parameters: - -| Name | Type | Description | -| :------------- | :--------------------------------- | :----------------------------------------------------------------------- | -| proposalType | enum IGovValidators.ProposalType | the `ProposalType` enum | -| core | struct IGovValidators.ProposalCore | the struct that holds information about core properties of the proposal | -| descriptionURL | string | the string with link to IPFS doc with proposal description | -| data | bytes | the data to be executed | - -### ExternalProposal - -```solidity -struct ExternalProposal { - IGovValidators.ProposalCore core; -} -``` - -The struct holds information about the external proposal - - -Parameters: - -| Name | Type | Description | -| :--- | :--------------------------------- | :-------------------------------------------------------------------- | -| core | struct IGovValidators.ProposalCore | the struct that holds information about core properties of a proposal | - -### InternalProposalView - -```solidity -struct InternalProposalView { - IGovValidators.InternalProposal proposal; - IGovValidators.ProposalState proposalState; - uint256 requiredQuorum; -} -``` - -The struct that is used in view functions of contract as a return argument - - -Parameters: - -| Name | Type | Description | -| :------------- | :------------------------------------- | :---------------------------------------------------------------- | -| proposal | struct IGovValidators.InternalProposal | the `InternalProposal` struct | -| proposalState | enum IGovValidators.ProposalState | the `ProposalState` enum | -| requiredQuorum | uint256 | the percentage of validators token supply to confirm the proposal | - -## Functions info - -### validatorsCount (0xed612f8c) - -```solidity -function validatorsCount() external view returns (uint256) -``` - -The function for getting current number of validators - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :--------------------- | -| [0] | uint256 | `number` of validators | - -### createInternalProposal (0x9661803d) - -```solidity -function createInternalProposal( - IGovValidators.ProposalType proposalType, - string calldata descriptionURL, - bytes calldata data -) external -``` - -Create internal proposal for changing validators balances, base quorum, base duration - - -Parameters: - -| Name | Type | Description | -| :----------- | :------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| proposalType | enum IGovValidators.ProposalType | `ProposalType` 0 - `ChangeInternalDurationAndQuorum`, change base duration and quorum 1 - `ChangeBalances`, change address balance 2 - `MonthlyWithdraw`, monthly token withdraw 3 - `OffchainProposal`, offchain action | -| data | bytes | New packed data, depending on proposal type | - -### createExternalProposal (0xdc2a7714) - -```solidity -function createExternalProposal( - uint256 proposalId, - IGovValidators.ProposalSettings calldata proposalSettings -) external -``` - -Create external proposal. This function can call only `Gov` contract - - -Parameters: - -| Name | Type | Description | -| :--------------- | :------------------------------------- | :------------------------------- | -| proposalId | uint256 | Proposal ID from `Gov` contract | -| proposalSettings | struct IGovValidators.ProposalSettings | `ProposalSettings` struct | - -### voteInternalProposal (0x5a34c7e1) - -```solidity -function voteInternalProposal( - uint256 proposalId, - uint256 amount, - bool isVoteFor -) external -``` - - -### voteExternalProposal (0xba877b80) - -```solidity -function voteExternalProposal( - uint256 proposalId, - uint256 amount, - bool isVoteFor -) external -``` - - -### cancelVoteInternalProposal (0x5478197e) - -```solidity -function cancelVoteInternalProposal(uint256 proposalId) external -``` - - -### cancelVoteExternalProposal (0xea1941d0) - -```solidity -function cancelVoteExternalProposal(uint256 proposalId) external -``` - - -### executeInternalProposal (0x65f3f23f) - -```solidity -function executeInternalProposal(uint256 proposalId) external -``` - -Only for internal proposals. External proposals should be executed from governance. - - -Parameters: - -| Name | Type | Description | -| :--------- | :------ | :------------------- | -| proposalId | uint256 | Internal proposal ID | - -### executeExternalProposal (0x430c885a) - -```solidity -function executeExternalProposal(uint256 proposalId) external -``` - -The function called by governance that marks the external proposal as executed - - -Parameters: - -| Name | Type | Description | -| :--------- | :------ | :------------------- | -| proposalId | uint256 | External proposal ID | - -### changeSettings (0xb395fec0) - -```solidity -function changeSettings( - uint64 duration, - uint64 executionDelay, - uint128 quorum -) external -``` - - -### changeBalances (0x62a4107d) - -```solidity -function changeBalances( - uint256[] calldata newValues, - address[] calldata userAddresses -) external -``` - -The function for changing validators balances - - -Parameters: - -| Name | Type | Description | -| :------------ | :-------- | :----------------------------- | -| newValues | uint256[] | the array of new balances | -| userAddresses | address[] | the array validators addresses | - -### monthlyWithdraw (0x3271f009) - -```solidity -function monthlyWithdraw( - address[] calldata tokens, - uint256[] calldata amounts, - address destination -) external -``` - - -### getExternalProposal (0xe14ea231) - -```solidity -function getExternalProposal( - uint256 index -) external view returns (IGovValidators.ExternalProposal memory) -``` - -The function for getting information about the external proposals - - -Parameters: - -| Name | Type | Description | -| :---- | :------ | :--------------------- | -| index | uint256 | the index of proposal | - - -Return values: - -| Name | Type | Description | -| :--- | :------------------------------------- | :------------------------ | -| [0] | struct IGovValidators.ExternalProposal | `ExternalProposal` struct | - -### getInternalProposals (0x8a847ae4) - -```solidity -function getInternalProposals( - uint256 offset, - uint256 limit -) external view returns (IGovValidators.InternalProposalView[] memory) -``` - -The function for getting information about internal proposals - - -Parameters: - -| Name | Type | Description | -| :----- | :------ | :------------------------------------ | -| offset | uint256 | the starting proposal index | -| limit | uint256 | the length of the observed proposals | - - -Return values: - -| Name | Type | Description | -| :--- | :------------------------------------------- | :---------------------------------- | -| [0] | struct IGovValidators.InternalProposalView[] | `InternalProposalView` struct array | - -### getProposalState (0x7b839d93) - -```solidity -function getProposalState( - uint256 proposalId, - bool isInternal -) external view returns (IGovValidators.ProposalState) -``` - -Return proposal state - -Options: -`Voting` - proposal where addresses can vote. -`Defeated` - proposal where voting time is over and proposal defeated. -`Succeeded` - proposal with the required number of votes. -`Executed` - executed proposal (only for internal proposal). -`Undefined` - nonexistent proposal. -### getProposalRequiredQuorum (0xbd7782fc) - -```solidity -function getProposalRequiredQuorum( - uint256 proposalId, - bool isInternal -) external view returns (uint256) -``` - -The function for getting proposal required quorum - - -Parameters: - -| Name | Type | Description | -| :--------- | :------ | :--------------------------------------------------- | -| proposalId | uint256 | the id of proposal | -| isInternal | bool | the boolean flag, if true then proposal is internal | - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :-------------------------------------- | -| [0] | uint256 | the number of votes to reach the quorum | - -### isValidator (0xfacd743b) - -```solidity -function isValidator(address user) external view returns (bool) -``` - -The function that checks if a user is a validator - - -Parameters: - -| Name | Type | Description | -| :--- | :------ | :--------------------- | -| user | address | the address of a user | - - -Return values: - -| Name | Type | Description | -| :--- | :--- | :---------------------------------------- | -| [0] | bool | `flag`, if true, than user is a validator | diff --git a/docs/gov/validators/IGovValidatorsToken.md b/docs/gov/validators/IGovValidatorsToken.md deleted file mode 100644 index 7c045d454..000000000 --- a/docs/gov/validators/IGovValidatorsToken.md +++ /dev/null @@ -1,62 +0,0 @@ -# IGovValidatorsToken - -## Interface Description - - -License: MIT - -## - -```solidity -interface IGovValidatorsToken is IERC20 -``` - -This is the contract that determines the validators -## Functions info - -### mint (0x40c10f19) - -```solidity -function mint(address account, uint256 amount) external -``` - -Mint new tokens, available only from `Validators` contract - - -Parameters: - -| Name | Type | Description | -| :------ | :------ | :------------------------ | -| account | address | Address | -| amount | uint256 | Token amount to mint. Wei | - -### burn (0x9dc29fac) - -```solidity -function burn(address account, uint256 amount) external -``` - -Burn tokens, available only from `Validators` contract - - -Parameters: - -| Name | Type | Description | -| :------ | :------ | :------------------------ | -| account | address | Address | -| amount | uint256 | Token amount to burn. Wei | - -### snapshot (0x9711715a) - -```solidity -function snapshot() external returns (uint256) -``` - -Create tokens snapshot - - -Return values: - -| Name | Type | Description | -| :--- | :------ | :---------- | -| [0] | uint256 | Snapshot ID | diff --git a/docs/gov/voting/IVotePower.md b/docs/gov/voting/IVotePower.md deleted file mode 100644 index bfd5a7b13..000000000 --- a/docs/gov/voting/IVotePower.md +++ /dev/null @@ -1,97 +0,0 @@ -# IVotePower - -## Interface Description - - -License: MIT - -## - -```solidity -interface IVotePower -``` - - -## Functions info - -### transformVotes (0x41cb09cc) - -```solidity -function transformVotes( - address voter, - uint256 votes -) external view returns (uint256 resultingVotes) -``` - -The function for transforming token and nft power to voting power - - -Parameters: - -| Name | Type | Description | -| :---- | :------ | :----------------------------- | -| voter | address | the voter address | -| votes | uint256 | the total token and nft power | - - -Return values: - -| Name | Type | Description | -| :------------- | :------ | :----------- | -| resultingVotes | uint256 | voting power | - -### transformVotesFull (0x13f60dc5) - -```solidity -function transformVotesFull( - address voter, - uint256 votes, - uint256 personalPower, - uint256 micropoolPower, - uint256 treasuryPower -) external view returns (uint256 resultingVotes) -``` - -The function for transforming token and nft power to voting power - - -Parameters: - -| Name | Type | Description | -| :------------- | :------ | :-------------------------------- | -| voter | address | the voter address | -| votes | uint256 | the total token and nft power | -| personalPower | uint256 | the user's total personal power | -| micropoolPower | uint256 | the user's total micropool power | -| treasuryPower | uint256 | the user's total treasury power | - - -Return values: - -| Name | Type | Description | -| :------------- | :------ | :----------- | -| resultingVotes | uint256 | voting power | - -### getVotesRatio (0xf5ca7490) - -```solidity -function getVotesRatio( - address voter -) external view returns (uint256 votesRatio) -``` - -The function for getting voting coefficient - - -Parameters: - -| Name | Type | Description | -| :---- | :------ | :------------------------ | -| voter | address | the address of the voter | - - -Return values: - -| Name | Type | Description | -| :--------- | :------ | :------------------------------------ | -| votesRatio | uint256 | the ration with 25 decimals precision | diff --git a/docs/user/IUserRegistry.md b/docs/user/IUserRegistry.md deleted file mode 100644 index bdc846a4d..000000000 --- a/docs/user/IUserRegistry.md +++ /dev/null @@ -1,123 +0,0 @@ -# IUserRegistry - -## Interface Description - - -License: MIT - -## - -```solidity -interface IUserRegistry -``` - -This is the contract that stores user profile settings + his privacy policy agreement EIP712 signature -## Structs info - -### UserInfo - -```solidity -struct UserInfo { - string profileURL; - bytes32 signatureHash; -} -``` - -The structure that stores info about the user - - -Parameters: - -| Name | Type | Description | -| :------------ | :------ | :----------------------------------------- | -| profileURL | string | is an IPFS URL to the user's profile data | -| signatureHash | bytes32 | is a hash of a privacy policy signature | - -## Functions info - -### changeProfile (0x482b390f) - -```solidity -function changeProfile(string calldata url) external -``` - -The function to change the user profile - - -Parameters: - -| Name | Type | Description | -| :--- | :----- | :--------------------------------------- | -| url | string | the IPFS URL to the new profile settings | - -### agreeToPrivacyPolicy (0xd9ee212a) - -```solidity -function agreeToPrivacyPolicy(bytes calldata signature) external -``` - -The function to agree to the privacy policy of the DEXE platform. -The user has to sign the hash of the privacy policy document - - -Parameters: - -| Name | Type | Description | -| :-------- | :---- | :----------------------------------------------- | -| signature | bytes | the VRS packed parameters of the ECDSA signature | - -### changeProfileAndAgreeToPrivacyPolicy (0x2cb83257) - -```solidity -function changeProfileAndAgreeToPrivacyPolicy( - string calldata url, - bytes calldata signature -) external -``` - -The function to change the profile and sign the privacy policy in a single transaction - - -Parameters: - -| Name | Type | Description | -| :-------- | :----- | :----------------------------------------------- | -| url | string | the IPFS URL to the new profile settings | -| signature | bytes | the VRS packed parameters of the ECDSA signature | - -### agreed (0xa5b8f210) - -```solidity -function agreed(address user) external view returns (bool) -``` - -The function to check whether the user signed the privacy policy - - -Parameters: - -| Name | Type | Description | -| :--- | :------ | :----------------- | -| user | address | the user to check | - - -Return values: - -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------- | -| [0] | bool | true is the user has signed to privacy policy, false otherwise | - -### setPrivacyPolicyDocumentHash (0xc1bbeefe) - -```solidity -function setPrivacyPolicyDocumentHash(bytes32 hash) external -``` - -The function to set the hash of the document the user has to sign - - -Parameters: - -| Name | Type | Description | -| :--- | :------ | :------------------------------------------- | -| hash | bytes32 | the has of the document the user has to sign | diff --git a/package.json b/package.json index a9ae6a5ca..562e8672a 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,6 @@ "deploy-bsc": "npx hardhat migrate --network bsc --verify", "generate-types": "TYPECHAIN_FORCE=true npx hardhat typechain", "generate-gobinds": "npx hardhat gobind", - "generate-docs": "bash .docs/gen-docs.sh", "generate-markups": "npx hardhat markup", "lint-fix": "npm run lint-sol-fix && npm run lint-js-fix && npm run lint-json-fix", "lint-json-fix": "prettier --write \"./[a-zA-Z0-9.]+(?!-lock).json\"",