Skip to content

Commit

Permalink
feat: Added Balancer, Solhint, Slither, OpenZeppelin ERC20, OpenZeppe…
Browse files Browse the repository at this point in the history
…lin Access Snippets (#3)
  • Loading branch information
RyanHolanda authored May 29, 2024
1 parent 301676c commit 2384671
Show file tree
Hide file tree
Showing 15 changed files with 919 additions and 32 deletions.
129 changes: 125 additions & 4 deletions CHANGELOG.md

Large diffs are not rendered by default.

199 changes: 174 additions & 25 deletions README.md

Large diffs are not rendered by default.

52 changes: 51 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "awesome-solidity-snippets",
"displayName": "Awesome Solidity Snippets",
"description": "Snippets for Smart Contract Development with Solidity",
"version": "1.1.0",
"version": "1.2.0",
"icon": "logo.png",
"publisher": "RyanHolanda",
"galleryBanner": {
Expand Down Expand Up @@ -765,6 +765,56 @@
"title": "OpenZeppelin Ownable Upgradeable snippets",
"language": "solidity",
"path": "./snippets/openzeppelin-upgradeable/ownable.code-snippets"
},
{
"title": "Solhint snippets",
"language": "solidity",
"path": "./snippets/solhint.code-snippets"
},
{
"title": "Slither Snippets",
"language": "solidity",
"path": "./snippets/slither.code-snippets"
},
{
"title": "Balancer V2 Distributors snippets",
"language": "solidity",
"path": "./snippets/balancer/v2/distributors.code-snippets"
},
{
"title": "Balancer V2 Liquidity Mining snippets",
"language": "solidity",
"path": "./snippets/balancer/v2/liquidity-mining.code-snippets"
},
{
"title": "Balancer V2 Pool Linear snippets",
"language": "solidity",
"path": "./snippets/balancer/v2/pool-linear.code-snippets"
},
{
"title": "Balancer V2 Pool Stable snippets",
"language": "solidity",
"path": "./snippets/balancer/v2/pool-stable.code-snippets"
},
{
"title": "Balancer V2 Pool Utils snippets",
"language": "solidity",
"path": "./snippets/balancer/v2/pool-utils.code-snippets"
},
{
"title": "Balancer V2 Pool Weighted snippets",
"language": "solidity",
"path": "./snippets/balancer/v2/pool-weighted.code-snippets"
},
{
"title": "Balancer V2 Standalone Utils snippets",
"language": "solidity",
"path": "./snippets/balancer/v2/standalone-utils.code-snippets"
},
{
"title": "Balancer V2 Vault snippets",
"language": "solidity",
"path": "./snippets/balancer/v2/vault.code-snippets"
}
]
}
Expand Down
8 changes: 8 additions & 0 deletions snippets/balancer/v2/distributors.code-snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Import Distribuitor Callback Interface": {
"scope": "solidity",
"prefix": "importDistributorCallbackI",
"body": "import {IDistributorCallback} from \"@balancer-labs/v2-interfaces/contracts/distributors/IDistributorCallback.sol\";",
"description": "Import Distributor Callback Interface from @balancer-labs/v2-interfaces"
},
}
146 changes: 146 additions & 0 deletions snippets/balancer/v2/liquidity-mining.code-snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
{
"Import Arbitrum Fee Provider Interface": {
"scope": "solidity",
"prefix": "importArbitrumFeeProviderI",
"body": "import {IArbitrumFeeProvider} from \"@balancer-labs/v2-interfaces/contracts/liquidity-mining/IArbitrumFeeProvider.sol\";",
"description": "Import Arbitrum Fee Provider Interface from @balancer-labs/v2-interfaces"
},
"Import Authorizer Adaptor Interface": {
"scope": "solidity",
"prefix": "importAuthorizerAdaptorI",
"body": "import {IAuthorizerAdaptor} from \"@balancer-labs/v2-interfaces/contracts/liquidity-mining/IAuthorizerAdaptor.sol\";",
"description": "Import Authorizer Adaptor Interface from @balancer-labs/v2-interfaces"
},
"Import Authorizer Adaptor Entrypoint Interface": {
"scope": "solidity",
"prefix": "importAuthorizerAdaptorEntrypointI",
"body": "import {IAuthorizerAdaptorEntrypoint} from \"@balancer-labs/v2-interfaces/contracts/liquidity-mining/IAuthorizerAdaptorEntrypoint.sol\";",
"description": "Import Authorizer Adaptor Entrypoint Interface from @balancer-labs/v2-interfaces"
},
"Import Balancer Minter Interface": {
"scope": "solidity",
"prefix": "importBalancerMinterI",
"body": "import {IBalancerMinter} from \"@balancer-labs/v2-interfaces/contracts/liquidity-mining/IBalancerMinter.sol\";",
"description": "Import Balancer Minter Interface from @balancer-labs/v2-interfaces"
},
"Import Balancer Token Interface": {
"scope": "solidity",
"prefix": "importBalancerTokenI",
"body": "import {IBalancerToken} from \"@balancer-labs/v2-interfaces/contracts/liquidity-mining/IBalancerToken.sol\";",
"description": "Import Balancer Token Interface from @balancer-labs/v2-interfaces"
},
"Import Balancer Token Admin Interface": {
"scope": "solidity",
"prefix": "importBalancerTokenAdminI",
"body": "import {IBalancerTokenAdmin} from \"@balancer-labs/v2-interfaces/contracts/liquidity-mining/IBalancerTokenAdmin.sol\";",
"description": "Import Balancer Token Admin Interface from @balancer-labs/v2-interfaces"
},
"Import Child Chain Gauge Interface": {
"scope": "solidity",
"prefix": "importChildChainGaugeI",
"body": "import {IChildChainGauge} from \"@balancer-labs/v2-interfaces/contracts/liquidity-mining/IChildChainGauge.sol\";",
"description": "Import Child Chain Gauge Interface from @balancer-labs/v2-interfaces"
},
"Import Child Chain Liquidity Gauge Factory Interface": {
"scope": "solidity",
"prefix": "importChildChainLiquidityGaugeFactoryI",
"body": "import {IChildChainLiquidityGaugeFactory} from \"@balancer-labs/v2-interfaces/contracts/liquidity-mining/IChildChainLiquidityGaugeFactory.sol\";",
"description": "Import Child Chain Liquidity Gauge Factory Interface from @balancer-labs/v2-interfaces"
},
"Import Child Chain Streamer Interface": {
"scope": "solidity",
"prefix": "importChildChainStreamerI",
"body": "import {IChildChainStreamer} from \"@balancer-labs/v2-interfaces/contracts/liquidity-mining/IChildChainStreamer.sol\";",
"description": "Import Child Chain Streamer Interface from @balancer-labs/v2-interfaces"
},
"Import Fee Distributor Interface": {
"scope": "solidity",
"prefix": "importFeeDistributorI",
"body": "import {IFeeDistributor} from \"@balancer-labs/v2-interfaces/contracts/liquidity-mining/IFeeDistributor.sol\";",
"description": "Import Fee Distributor Interface from @balancer-labs/v2-interfaces"
},
"Import Gauge Adder Interface": {
"scope": "solidity",
"prefix": "importGaugeAdderI",
"body": "import {IGaugeAdder} from \"@balancer-labs/v2-interfaces/contracts/liquidity-mining/IGaugeAdder.sol\";",
"description": "Import Gauge Adder Interface from @balancer-labs/v2-interfaces"
},
"Import Gauge Controller Interface": {
"scope": "solidity",
"prefix": "importGaugeControllerI",
"body": "import {IGaugeController} from \"@balancer-labs/v2-interfaces/contracts/liquidity-mining/IGaugeController.sol\";",
"description": "Import Gauge Controller Interface from @balancer-labs/v2-interfaces"
},
"Import LM Getters Interface": {
"scope": "solidity",
"prefix": "importLMGettersI",
"body": "import {ILMGetters} from \"@balancer-labs/v2-interfaces/contracts/liquidity-mining/ILMGetters.sol\";",
"description": "Import LM Getters Interface from @balancer-labs/v2-interfaces"
},
"Import Liquidity Gauge Interface": {
"scope": "solidity",
"prefix": "importLiquidityGaugeI",
"body": "import {ILiquidityGauge} from \"@balancer-labs/v2-interfaces/contracts/liquidity-mining/ILiquidityGauge.sol\";",
"description": "Import Liquidity Gauge Interface from @balancer-labs/v2-interfaces"
},
"Import Liquidity Gauge Factory Interface": {
"scope": "solidity",
"prefix": "importLiquidityGaugeFactoryI",
"body": "import {ILiquidityGaugeFactory} from \"@balancer-labs/v2-interfaces/contracts/liquidity-mining/ILiquidityGaugeFactory.sol\";",
"description": "Import Liquidity Gauge Factory Interface from @balancer-labs/v2-interfaces"
},
"Import Mainnet Balancer Minter Interface": {
"scope": "solidity",
"prefix": "importMainnetBalancerMinterI",
"body": "import {IMainnetBalancerMinter} from \"@balancer-labs/v2-interfaces/contracts/liquidity-mining/IMainnetBalancerMinter.sol\";",
"description": "Import Mainnet Balancer Minter Interface from @balancer-labs/v2-interfaces"
},
"Import Optimism Gas Limit Provider Interface": {
"scope": "solidity",
"prefix": "importOptimismGasLimitProviderI",
"body": "import {IOptimismGasLimitProvider} from \"@balancer-labs/v2-interfaces/contracts/liquidity-mining/IOptimismGasLimitProvider.sol\";",
"description": "Import Optimism Gas Limit Provider Interface from @balancer-labs/v2-interfaces"
},
"Import Reward Token Distributor Interface": {
"scope": "solidity",
"prefix": "importRewardTokenDistributorI",
"body": "import {IRewardTokenDistributor} from \"@balancer-labs/v2-interfaces/contracts/liquidity-mining/IRewardTokenDistributor.sol\";",
"description": "Import Reward Token Distributor Interface from @balancer-labs/v2-interfaces"
},
"Import Rewards Only Gauge Interface": {
"scope": "solidity",
"prefix": "importRewardsOnlyGaugeI",
"body": "import {IRewardsOnlyGauge} from \"@balancer-labs/v2-interfaces/contracts/liquidity-mining/IRewardsOnlyGauge.sol\";",
"description": "Import Rewards Only Gauge Interface from @balancer-labs/v2-interfaces"
},
"Import Smart Wallet Checker Interface": {
"scope": "solidity",
"prefix": "importSmartWalletCheckerI",
"body": "import {ISmartWalletChecker} from \"@balancer-labs/v2-interfaces/contracts/liquidity-mining/ISmartWalletChecker.sol\";",
"description": "Import Smart Wallet Checker Interface from @balancer-labs/v2-interfaces"
},
"Import Stakeless Gauge Interface": {
"scope": "solidity",
"prefix": "importStakelessGaugeI",
"body": "import {IStakelessGauge} from \"@balancer-labs/v2-interfaces/contracts/liquidity-mining/IStakelessGauge.sol\";",
"description": "Import Stakeless Gauge Interface from @balancer-labs/v2-interfaces"
},
"Import Staking Liquidity Gauge Interface": {
"scope": "solidity",
"prefix": "importStakingLiquidityGaugeI",
"body": "import {IStakingLiquidityGauge} from \"@balancer-labs/v2-interfaces/contracts/liquidity-mining/IStakingLiquidityGauge.sol\";",
"description": "Import Staking Liquidity Gauge Interface from @balancer-labs/v2-interfaces"
},
"Import ve Delegation Interface": {
"scope": "solidity",
"prefix": "importVeDelegationI",
"body": "import {IVeDelegation} from \"@balancer-labs/v2-interfaces/contracts/liquidity-mining/IVeDelegation.sol\";",
"description": "Import ve Delegation Interface from @balancer-labs/v2-interfaces"
},
"Import Voting Escrow Interface": {
"scope": "solidity",
"prefix": "importVotingEscrowI",
"body": "import {IVotingEscrow} from \"@balancer-labs/v2-interfaces/contracts/liquidity-mining/IVotingEscrow.sol\";",
"description": "Import Voting Escrow Interface from @balancer-labs/v2-interfaces"
},
}
14 changes: 14 additions & 0 deletions snippets/balancer/v2/pool-linear.code-snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"Import IERC4626 Interface": {
"scope": "solidity",
"prefix": "importERC4626I",
"body": "import {IERC4626} from \"@balancer-labs/v2-interfaces/contracts/pool-linear/IERC4626.sol\";",
"description": "Import IERC4626 Interface from @balancer-labs/v2-interfaces"
},
"Import Linear Pool Interface": {
"scope": "solidity",
"prefix": "importLinearPoolI",
"body": "import {ILinearPool} from \"@balancer-labs/v2-interfaces/contracts/pool-linear/ILinearPool.sol\";",
"description": "Import Linear Pool Interface from @balancer-labs/v2-interfaces"
}
}
14 changes: 14 additions & 0 deletions snippets/balancer/v2/pool-stable.code-snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"Import Composable Stable Pool Rates Interface": {
"scope": "solidity",
"prefix": "importComposableStablePoolRatesI",
"body": "import {IComposableStablePoolRates} from \"@balancer-labs/v2-interfaces/contracts/pool-stable/IComposableStablePoolRates.sol\";",
"description": "Import Composable Stable Pool Rates Interface from @balancer-labs/v2-interfaces"
},
"Import Stable Pool User Data Library": {
"scope": "solidity",
"prefix": "importStablePoolUserData",
"body": "import {StablePoolUserData} from \"@balancer-labs/v2-interfaces/contracts/pool-stable/StablePoolUserData.sol\";",
"description": "Import Stable Pool User Data Library from @balancer-labs/v2-interfaces"
}
}
86 changes: 86 additions & 0 deletions snippets/balancer/v2/pool-utils.code-snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"Import Base Pool User Data Library": {
"scope": "solidity",
"prefix": "importBasePoolUserData",
"body": "import {BasePoolUserData} from \"@balancer-labs/v2-interfaces/contracts/pool-utils/BasePoolUserData.sol\";",
"description": "Import Base Pool User Data Library from @balancer-labs/v2-interfaces"
},
"Import Base Pool Controller Interface": {
"scope": "solidity",
"prefix": "importBasePoolControllerI",
"body": "import {IBasePoolController} from \"@balancer-labs/v2-interfaces/contracts/pool-utils/IBasePoolController.sol\";",
"description": "Import Base Pool Controller Interface from @balancer-labs/v2-interfaces"
},
"Import Base Pool Factory Interface": {
"scope": "solidity",
"prefix": "importBasePoolFactoryI",
"body": "import {IBasePoolFactory} from \"@balancer-labs/v2-interfaces/contracts/pool-utils/IBasePoolFactory.sol\";",
"description": "Import Base Pool Factory Interface from @balancer-labs/v2-interfaces"
},
"Import Controlled Pool Interface": {
"scope": "solidity",
"prefix": "importControlledPoolI",
"body": "import {IControlledPool} from \"@balancer-labs/v2-interfaces/contracts/pool-utils/IControlledPool.sol\";",
"description": "Import Controlled Pool Interface from @balancer-labs/v2-interfaces"
},
"Import Factory Created Pool Version Interface": {
"scope": "solidity",
"prefix": "importFactoryCreatedPoolVersionI",
"body": "import {IFactoryCreatedPoolVersion} from \"@balancer-labs/v2-interfaces/contracts/pool-utils/IFactoryCreatedPoolVersion.sol\";",
"description": "Import Factory Created Pool Version Interface from @balancer-labs/v2-interfaces"
},
"Import Last Created Pool Factory Interface": {
"scope": "solidity",
"prefix": "importLastCreatedPoolFactoryI",
"body": "import {ILastCreatedPoolFactory} from \"@balancer-labs/v2-interfaces/contracts/pool-utils/ILastCreatedPoolFactory.sol\";",
"description": "Import Last Created Pool Factory Interface from @balancer-labs/v2-interfaces"
},
"Import Managed Pool Interface": {
"scope": "solidity",
"prefix": "importManagedPoolI",
"body": "import {IManagedPool} from \"@balancer-labs/v2-interfaces/contracts/pool-utils/IManagedPool.sol\";",
"description": "Import Managed Pool Interface from @balancer-labs/v2-interfaces"
},
"Import Pool Version Interface": {
"scope": "solidity",
"prefix": "importPoolVersionI",
"body": "import {IPoolVersion} from \"@balancer-labs/v2-interfaces/contracts/pool-utils/IPoolVersion.sol\";",
"description": "Import Pool Version Interface from @balancer-labs/v2-interfaces"
},
"Import Protocol Fee Cache Interface": {
"scope": "solidity",
"prefix": "importProtocolFeeCacheI",
"body": "import {IProtocolFeeCache} from \"@balancer-labs/v2-interfaces/contracts/pool-utils/IProtocolFeeCache.sol\";",
"description": "Import Protocol Fee Cache Interface from @balancer-labs/v2-interfaces"
},
"Import Rate Provider Interface": {
"scope": "solidity",
"prefix": "importRateProviderI",
"body": "import {IRateProvider} from \"@balancer-labs/v2-interfaces/contracts/pool-utils/IRateProvider.sol\";",
"description": "Import Rate Provider Interface from @balancer-labs/v2-interfaces"
},
"Import Rate Provider Pool Interface": {
"scope": "solidity",
"prefix": "importRateProviderPoolI",
"body": "import {IRateProviderPool} from \"@balancer-labs/v2-interfaces/contracts/pool-utils/IRateProviderPool.sol\";",
"description": "Import Rate Provider Pool Interface from @balancer-labs/v2-interfaces"
},
"Import Recovery Mode Interface": {
"scope": "solidity",
"prefix": "importRecoveryModeI",
"body": "import {IRecoveryMode} from \"@balancer-labs/v2-interfaces/contracts/pool-utils/IRecoveryMode.sol\";",
"description": "Import Recovery Mode Interface from @balancer-labs/v2-interfaces"
},
"Import Recovery Mode Helper Interface": {
"scope": "solidity",
"prefix": "importRecoveryModeHelperI",
"body": "import {IRecoveryModeHelper} from \"@balancer-labs/v2-interfaces/contracts/pool-utils/IRecoveryModeHelper.sol\";",
"description": "Import Recovery Mode Helper Interface from @balancer-labs/v2-interfaces"
},
"Import Version Interface": {
"scope": "solidity",
"prefix": "importVersionI",
"body": "import {IVersion} from \"@balancer-labs/v2-interfaces/contracts/pool-utils/IVersion.sol\";",
"description": "Import Version Interface from @balancer-labs/v2-interfaces"
}
}
14 changes: 14 additions & 0 deletions snippets/balancer/v2/pool-weighted.code-snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"Import External Weighted Math Interface": {
"scope": "solidity",
"prefix": "importExternalWeightedMathI",
"body": "import {IExternalWeightedMath} from \"@balancer-labs/v2-interfaces/contracts/pool-weighted/IExternalWeightedMath.sol\";",
"description": "Import External Weighted Math Interface from @balancer-labs/v2-interfaces"
},
"Import Weighted Pool User Data Library": {
"scope": "solidity",
"prefix": "importWeightedPoolUserData",
"body": "import {WeightedPoolUserData} from \"@balancer-labs/v2-interfaces/contracts/pool-weighted/WeightedPoolUserData.sol\";",
"description": "Import Weighted Pool User Data Library from @balancer-labs/v2-interfaces"
}
}
Loading

0 comments on commit 2384671

Please sign in to comment.