diff --git a/docs/src/README.md b/docs/src/README.md index 3406c39..6ad3d61 100644 --- a/docs/src/README.md +++ b/docs/src/README.md @@ -74,6 +74,7 @@ A thunder swap pool factory is deployed on-chain, and users can interact with it Both normal swaps and flash swaps take place using the `ThunderSwapPool::flashSwapExactInput()` and `ThunderSwapPool::flashSwapExactOutput()` functions. In a normal swap, the `receiver` address is the user's wallet address; however, in a flash swap, a user sets the `receiver` address as the contract's address (which is `IThunderSwapReceiver` interface compliant). The contract that receives the token loan has to ensure that enough tokens are approved to the `ThunderSwapPool` when the control returns to it and the loan is paid back (along with fees). With flash swaps, contracts can also activate hooks before and after a swap to fine tune their swapping strategy. +Thunder Swap is marching towards a community-driven future with the introduction of the $THUD token, which is the key utility and governance token in the Thunder Swap ecosystem. Currently, the only way to obtain $THUD is via an airdrop conducted by the protocol team to reward loyal and regular users of the protocol. ### Built With @@ -115,10 +116,16 @@ That's it, you are good to go now! ## Roadmap - [x] Smart contract development -- [ ] Testing + - [x] Thunder Swap Core + - [x] Thunder Swap $THUD token + - [x] Thunder Swap Airdrop Manager +- [x] Testing - [x] Unit testing - - [ ] Fuzz testing -- [ ] UI development + - [x] Pool deployment tests + - [x] Liquidity tests + - [x] Flash swap tests + - [x] Airdrop tests + - [x] Miscellaneous tests See the [open issues](https://github.com/mgnfy-view/thunder-swap/issues) for a full list of proposed features (and known issues). diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index afd2b54..f748e07 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -17,3 +17,5 @@ - [ThunderSwapPoolFactory](src/core/ThunderSwapPoolFactory.sol/contract.ThunderSwapPoolFactory.md) - [❱ governance](src/governance/README.md) - [Thud](src/governance/Thud.sol/contract.Thud.md) + - [ThunderGovernor](src/governance/ThunderGovernor.sol/contract.ThunderGovernor.md) + - [ThunderTimeLock](src/governance/ThunderTimelock.sol/contract.ThunderTimeLock.md) diff --git a/docs/src/src/ThunderSwapReceiver/interfaces/IThunderSwapHooks.sol/interface.IThunderSwapHooks.md b/docs/src/src/ThunderSwapReceiver/interfaces/IThunderSwapHooks.sol/interface.IThunderSwapHooks.md index b9a2418..919f305 100644 --- a/docs/src/src/ThunderSwapReceiver/interfaces/IThunderSwapHooks.sol/interface.IThunderSwapHooks.md +++ b/docs/src/src/ThunderSwapReceiver/interfaces/IThunderSwapHooks.sol/interface.IThunderSwapHooks.md @@ -1,5 +1,5 @@ # IThunderSwapHooks -[Git Source](https://github.com/Sahil-Gujrati/thunder-swap/blob/538bce28778223301347f4273ff464e4ab8e7382/src/ThunderSwapReceiver/interfaces/IThunderSwapHooks.sol) +[Git Source](https://github.com/Sahil-Gujrati/thunder-swap/blob/48c2541b51225b6140f6383b56ab80046ea60c03/src/ThunderSwapReceiver/interfaces/IThunderSwapHooks.sol) ## Functions diff --git a/docs/src/src/ThunderSwapReceiver/interfaces/IThunderSwapReceiver.sol/interface.IThunderSwapReceiver.md b/docs/src/src/ThunderSwapReceiver/interfaces/IThunderSwapReceiver.sol/interface.IThunderSwapReceiver.md index 407cee8..619d0b3 100644 --- a/docs/src/src/ThunderSwapReceiver/interfaces/IThunderSwapReceiver.sol/interface.IThunderSwapReceiver.md +++ b/docs/src/src/ThunderSwapReceiver/interfaces/IThunderSwapReceiver.sol/interface.IThunderSwapReceiver.md @@ -1,5 +1,5 @@ # IThunderSwapReceiver -[Git Source](https://github.com/Sahil-Gujrati/thunder-swap/blob/538bce28778223301347f4273ff464e4ab8e7382/src/ThunderSwapReceiver/interfaces/IThunderSwapReceiver.sol) +[Git Source](https://github.com/Sahil-Gujrati/thunder-swap/blob/48c2541b51225b6140f6383b56ab80046ea60c03/src/ThunderSwapReceiver/interfaces/IThunderSwapReceiver.sol) **Inherits:** [IThunderSwapHooks](/src/ThunderSwapReceiver/interfaces/IThunderSwapHooks.sol/interface.IThunderSwapHooks.md) diff --git a/docs/src/src/auxiliary/AirdropManager.sol/contract.AirdropManager.md b/docs/src/src/auxiliary/AirdropManager.sol/contract.AirdropManager.md index 57d4272..28106a2 100644 --- a/docs/src/src/auxiliary/AirdropManager.sol/contract.AirdropManager.md +++ b/docs/src/src/auxiliary/AirdropManager.sol/contract.AirdropManager.md @@ -1,5 +1,5 @@ # AirdropManager -[Git Source](https://github.com/Sahil-Gujrati/thunder-swap/blob/538bce28778223301347f4273ff464e4ab8e7382/src/auxiliary/AirdropManager.sol) +[Git Source](https://github.com/Sahil-Gujrati/thunder-swap/blob/48c2541b51225b6140f6383b56ab80046ea60c03/src/auxiliary/AirdropManager.sol) **Inherits:** Ownable @@ -139,35 +139,48 @@ function getToken(uint256 _tokenIndex) external view returns (address); |`_tokenIndex`|`uint256`|The index of the token in the supported tokens list| +### getAirdropLimit + + +```solidity +function getAirdropLimit() external pure returns (uint256); +``` +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`uint256`|The max number of receiver's for a single airdrop session| + + ## Events -### AirdropManager__TokenSupported +### TokenSupported ```solidity -event AirdropManager__TokenSupported(address token); +event TokenSupported(address token); ``` -### AirdropManager__TokensAirdropped +### TokensAirdropped ```solidity -event AirdropManager__TokensAirdropped(address token, uint256 totalAmount); +event TokensAirdropped(address token, uint256 totalAmount); ``` ## Errors -### AirdropManager__LimitBreached +### LimitBreached ```solidity -error AirdropManager__LimitBreached(uint256 numberOfRecepients, uint256 allowedNumberOfRecepients); +error LimitBreached(uint256 numberOfRecepients, uint256 allowedNumberOfRecepients); ``` -### AirdropManager__TokenAlreadySupported +### TokenAlreadySupported ```solidity -error AirdropManager__TokenAlreadySupported(); +error TokenAlreadySupported(); ``` -### AirdropManager__InsufficientTokenBalance +### InsufficientTokenBalance ```solidity -error AirdropManager__InsufficientTokenBalance(); +error InsufficientTokenBalance(); ``` diff --git a/docs/src/src/core/LiquidityProviderToken.sol/contract.LiquidityProviderToken.md b/docs/src/src/core/LiquidityProviderToken.sol/contract.LiquidityProviderToken.md index 7756fc5..815f7c1 100644 --- a/docs/src/src/core/LiquidityProviderToken.sol/contract.LiquidityProviderToken.md +++ b/docs/src/src/core/LiquidityProviderToken.sol/contract.LiquidityProviderToken.md @@ -1,5 +1,5 @@ # LiquidityProviderToken -[Git Source](https://github.com/Sahil-Gujrati/thunder-swap/blob/538bce28778223301347f4273ff464e4ab8e7382/src/core/LiquidityProviderToken.sol) +[Git Source](https://github.com/Sahil-Gujrati/thunder-swap/blob/48c2541b51225b6140f6383b56ab80046ea60c03/src/core/LiquidityProviderToken.sol) **Inherits:** ERC20, Ownable diff --git a/docs/src/src/core/ThunderSwapPool.sol/contract.ThunderSwapPool.md b/docs/src/src/core/ThunderSwapPool.sol/contract.ThunderSwapPool.md index 4edc750..990e64a 100644 --- a/docs/src/src/core/ThunderSwapPool.sol/contract.ThunderSwapPool.md +++ b/docs/src/src/core/ThunderSwapPool.sol/contract.ThunderSwapPool.md @@ -1,5 +1,5 @@ # ThunderSwapPool -[Git Source](https://github.com/Sahil-Gujrati/thunder-swap/blob/538bce28778223301347f4273ff464e4ab8e7382/src/core/ThunderSwapPool.sol) +[Git Source](https://github.com/Sahil-Gujrati/thunder-swap/blob/48c2541b51225b6140f6383b56ab80046ea60c03/src/core/ThunderSwapPool.sol) **Inherits:** [IThunderSwapPool](/src/core/interfaces/IThunderSwapPool.sol/interface.IThunderSwapPool.md), ReentrancyGuard diff --git a/docs/src/src/core/ThunderSwapPoolFactory.sol/contract.ThunderSwapPoolFactory.md b/docs/src/src/core/ThunderSwapPoolFactory.sol/contract.ThunderSwapPoolFactory.md index b32170e..3856f3f 100644 --- a/docs/src/src/core/ThunderSwapPoolFactory.sol/contract.ThunderSwapPoolFactory.md +++ b/docs/src/src/core/ThunderSwapPoolFactory.sol/contract.ThunderSwapPoolFactory.md @@ -1,5 +1,5 @@ # ThunderSwapPoolFactory -[Git Source](https://github.com/Sahil-Gujrati/thunder-swap/blob/538bce28778223301347f4273ff464e4ab8e7382/src/core/ThunderSwapPoolFactory.sol) +[Git Source](https://github.com/Sahil-Gujrati/thunder-swap/blob/48c2541b51225b6140f6383b56ab80046ea60c03/src/core/ThunderSwapPoolFactory.sol) **Inherits:** Ownable diff --git a/docs/src/src/core/interfaces/IThunderSwapPool.sol/interface.IThunderSwapPool.md b/docs/src/src/core/interfaces/IThunderSwapPool.sol/interface.IThunderSwapPool.md index 3a80ef9..e988a81 100644 --- a/docs/src/src/core/interfaces/IThunderSwapPool.sol/interface.IThunderSwapPool.md +++ b/docs/src/src/core/interfaces/IThunderSwapPool.sol/interface.IThunderSwapPool.md @@ -1,5 +1,5 @@ # IThunderSwapPool -[Git Source](https://github.com/Sahil-Gujrati/thunder-swap/blob/538bce28778223301347f4273ff464e4ab8e7382/src/core/interfaces/IThunderSwapPool.sol) +[Git Source](https://github.com/Sahil-Gujrati/thunder-swap/blob/48c2541b51225b6140f6383b56ab80046ea60c03/src/core/interfaces/IThunderSwapPool.sol) ## Functions diff --git a/docs/src/src/core/lib/LiquiditySupplyAndSwapMath.sol/library.LiquiditySupplyAndSwapMath.md b/docs/src/src/core/lib/LiquiditySupplyAndSwapMath.sol/library.LiquiditySupplyAndSwapMath.md index c62ba42..12fe4ff 100644 --- a/docs/src/src/core/lib/LiquiditySupplyAndSwapMath.sol/library.LiquiditySupplyAndSwapMath.md +++ b/docs/src/src/core/lib/LiquiditySupplyAndSwapMath.sol/library.LiquiditySupplyAndSwapMath.md @@ -1,5 +1,5 @@ # LiquiditySupplyAndSwapMath -[Git Source](https://github.com/Sahil-Gujrati/thunder-swap/blob/538bce28778223301347f4273ff464e4ab8e7382/src/core/lib/LiquiditySupplyAndSwapMath.sol) +[Git Source](https://github.com/Sahil-Gujrati/thunder-swap/blob/48c2541b51225b6140f6383b56ab80046ea60c03/src/core/lib/LiquiditySupplyAndSwapMath.sol) ## Functions diff --git a/docs/src/src/governance/README.md b/docs/src/src/governance/README.md index 3d265fb..ee440f4 100644 --- a/docs/src/src/governance/README.md +++ b/docs/src/src/governance/README.md @@ -2,3 +2,5 @@ # Contents - [Thud](Thud.sol/contract.Thud.md) +- [ThunderGovernor](ThunderGovernor.sol/contract.ThunderGovernor.md) +- [ThunderTimeLock](ThunderTimelock.sol/contract.ThunderTimeLock.md) diff --git a/docs/src/src/governance/Thud.sol/contract.Thud.md b/docs/src/src/governance/Thud.sol/contract.Thud.md index 10ee32f..7ee2776 100644 --- a/docs/src/src/governance/Thud.sol/contract.Thud.md +++ b/docs/src/src/governance/Thud.sol/contract.Thud.md @@ -1,5 +1,5 @@ # Thud -[Git Source](https://github.com/Sahil-Gujrati/thunder-swap/blob/538bce28778223301347f4273ff464e4ab8e7382/src/governance/Thud.sol) +[Git Source](https://github.com/Sahil-Gujrati/thunder-swap/blob/48c2541b51225b6140f6383b56ab80046ea60c03/src/governance/Thud.sol) **Inherits:** ERC20, ERC20Permit, ERC20Votes, Ownable diff --git a/docs/src/src/governance/ThunderGovernor.sol/contract.ThunderGovernor.md b/docs/src/src/governance/ThunderGovernor.sol/contract.ThunderGovernor.md new file mode 100644 index 0000000..ce87e72 --- /dev/null +++ b/docs/src/src/governance/ThunderGovernor.sol/contract.ThunderGovernor.md @@ -0,0 +1,130 @@ +# ThunderGovernor +[Git Source](https://github.com/Sahil-Gujrati/thunder-swap/blob/48c2541b51225b6140f6383b56ab80046ea60c03/src/governance/ThunderGovernor.sol) + +**Inherits:** +Governor, GovernorSettings, GovernorCountingSimple, GovernorVotes, GovernorVotesQuorumFraction, GovernorTimelockControl + + +## Functions +### constructor + + +```solidity +constructor( + IVotes _token, + TimelockController _timelock +) + Governor("ThunderGovernor") + GovernorSettings(7200, 50400, 100e18) + GovernorVotes(_token) + GovernorVotesQuorumFraction(4) + GovernorTimelockControl(_timelock); +``` + +### votingDelay + + +```solidity +function votingDelay() public view override(Governor, GovernorSettings) returns (uint256); +``` + +### votingPeriod + + +```solidity +function votingPeriod() public view override(Governor, GovernorSettings) returns (uint256); +``` + +### quorum + + +```solidity +function quorum(uint256 blockNumber) + public + view + override(Governor, GovernorVotesQuorumFraction) + returns (uint256); +``` + +### state + + +```solidity +function state(uint256 proposalId) + public + view + override(Governor, GovernorTimelockControl) + returns (ProposalState); +``` + +### proposalNeedsQueuing + + +```solidity +function proposalNeedsQueuing(uint256 proposalId) + public + view + override(Governor, GovernorTimelockControl) + returns (bool); +``` + +### proposalThreshold + + +```solidity +function proposalThreshold() public view override(Governor, GovernorSettings) returns (uint256); +``` + +### _queueOperations + + +```solidity +function _queueOperations( + uint256 proposalId, + address[] memory targets, + uint256[] memory values, + bytes[] memory calldatas, + bytes32 descriptionHash +) + internal + override(Governor, GovernorTimelockControl) + returns (uint48); +``` + +### _executeOperations + + +```solidity +function _executeOperations( + uint256 proposalId, + address[] memory targets, + uint256[] memory values, + bytes[] memory calldatas, + bytes32 descriptionHash +) + internal + override(Governor, GovernorTimelockControl); +``` + +### _cancel + + +```solidity +function _cancel( + address[] memory targets, + uint256[] memory values, + bytes[] memory calldatas, + bytes32 descriptionHash +) + internal + override(Governor, GovernorTimelockControl) + returns (uint256); +``` + +### _executor + + +```solidity +function _executor() internal view override(Governor, GovernorTimelockControl) returns (address); +``` + diff --git a/docs/src/src/governance/ThunderTimelock.sol/contract.ThunderTimeLock.md b/docs/src/src/governance/ThunderTimelock.sol/contract.ThunderTimeLock.md new file mode 100644 index 0000000..57bbcfe --- /dev/null +++ b/docs/src/src/governance/ThunderTimelock.sol/contract.ThunderTimeLock.md @@ -0,0 +1,20 @@ +# ThunderTimeLock +[Git Source](https://github.com/Sahil-Gujrati/thunder-swap/blob/48c2541b51225b6140f6383b56ab80046ea60c03/src/governance/ThunderTimelock.sol) + +**Inherits:** +TimelockController + + +## Functions +### constructor + + +```solidity +constructor( + uint256 minDelay, + address[] memory proposers, + address[] memory executors +) + TimelockController(minDelay, proposers, executors, msg.sender); +``` +