Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add auto publish script #417

Merged
merged 1 commit into from
Jun 25, 2024
Merged

add auto publish script #417

merged 1 commit into from
Jun 25, 2024

Conversation

YouStillAlive
Copy link
Member

closes #416

Copy link

Methods

Symbol Meaning
Execution gas for this method does not include intrinsic gas overhead
Cost was non-zero but below the precision setting for the currency display (see options)
Min Max Avg Calls usd avg
DealProvider
       createNewPool(address[],uint256[],bytes) 259,823 290,623 271,387 65 0.78
ERC20Token
       approve(address,uint256) - - 46,235 1 0.13
LockDealNFT
       approvePoolTransfers(bool) 22,065 43,977 33,021 8 0.09
       renounceOwnership() - - 23,317 1 0.07
       safeTransferFrom(address,address,uint256,bytes) 304,633 424,093 367,425 13 1.05
       safeTransferFrom(address,address,uint256) 118,951 174,782 143,528 11 0.41
       setApprovedContract(address,bool) 30,672 50,572 46,841 16 0.13
       setBaseURI(string) 51,127 79,666 70,153 3 0.20
       transferFrom(address,address,uint256) 101,348 119,798 110,573 2 0.32
       transferOwnership(address) - - 28,694 1 0.08
       updateAllMetadata() - - 24,534 2 0.07
LockDealProvider
       createNewPool(address[],uint256[],bytes) 295,128 306,328 305,528 14 0.87
MockProvider
       createNewPool(address[],uint256[],bytes) - - 378,647 5 1.08
       createNewPoolWithTransfer(address[],uint256[]) - - 346,764 1 0.99
       withdraw(uint256,uint256) 68,012 72,800 70,406 2 0.20
MockTransfer
       createNewPool(address[],uint256[],bytes) - - 271,112 1 0.78
MockVaultManager
       setTransferStatus(bool) 21,703 43,615 32,659 2 0.09
TimedDealProvider
       createNewPool(address[],uint256[],bytes) 355,449 384,184 367,475 32 1.05

Deployments

Min Max Avg Block % usd avg
DealProvider 1,987,259 1,987,271 1,987,268 1.5 % 5.68
ERC20Token - - 790,882 0.6 % 2.26
LockDealNFT - - 5,460,030 4.2 % 15.61
LockDealProvider 2,127,083 2,127,095 2,127,091 1.6 % 6.08
MockProvider - - 1,102,276 0.8 % 3.15
MockTransfer - - 2,031,978 1.6 % 5.81
MockVaultManager - - 431,304 0.3 % 1.23
TimedDealProvider - - 2,370,488 1.8 % 6.78

Solidity and Network Config

Settings Value
Solidity: version 0.8.25
Solidity: optimized true
Solidity: runs 200
Solidity: viaIR false
Block Limit 130,000,000
L1 Gas Price 5 gwei
Token Price 571.73 usd/bnb
Network BINANCE
Toolchain hardhat

Copy link

codecov bot commented Jun 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.93%. Comparing base (13f36ce) to head (153b350).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #417   +/-   ##
=======================================
  Coverage   85.93%   85.93%           
=======================================
  Files          13       13           
  Lines         384      384           
  Branches       68       94   +26     
=======================================
  Hits          330      330           
  Misses         53       53           
  Partials        1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

Slither report

THIS CHECKLIST IS NOT COMPLETE. Use --show-ignored-findings to show all the results.
Summary

uninitialized-local

Impact: Medium
Confidence: Medium

unused-return

Impact: Medium
Confidence: Medium

function mintAndTransfer(
address owner,
address token,
uint256 amount,
IProvider provider
)
external
firewallProtected
onlyApprovedContract(address(provider))
notZeroAddress(owner)
notZeroAddress(token)
notZeroAmount(amount)
returns (uint256 poolId)
{
poolId = _mint(owner, provider);
IERC20(token).approve(address(vaultManager), amount);
poolIdToVaultId[poolId] = vaultManager.depositByToken(token, amount);
}

calls-loop

Impact: Low
Confidence: Medium

function _getData(uint256 poolId) internal view returns (BasePoolInfo memory poolInfo) {
IProvider provider = poolIdToProvider[poolId];
poolInfo = BasePoolInfo(
provider,
provider.name(),
poolId,
poolIdToVaultId[poolId],
ownerOf(poolId),
tokenOf(poolId),
provider.getParams(poolId)
);
}

function tokenOf(uint256 poolId) public view returns (address token) {
token = vaultManager.vaultIdToTokenAddress(poolIdToVaultId[poolId]);
}

timestamp

Impact: Low
Confidence: Medium

function _transfer(address from, address to, uint256 poolId)
internal
override
firewallProtectedSig(0x30e0789e)
{
if (
from != address(0) &&
ERC165Checker.supportsInterface(address(poolIdToProvider[poolId]), type(IBeforeTransfer).interfaceId)
) {
IBeforeTransfer(address(poolIdToProvider[poolId])).beforeTransfer(from, to, poolId);
}
// check for split and withdraw transfers
if (!(approvedContracts[to] || approvedContracts[from])) {
require(approvedPoolUserTransfers[from], "Pool transfer not approved by user");
require(
vaultManager.vaultIdToTradeStartTime(poolIdToVaultId[poolId]) < block.timestamp,
"Can't transfer before trade start time"
);
}
super._transfer(from, to, poolId);
}

function _registerPool(uint256 poolId, uint256[] calldata params) internal override firewallProtectedSig(0xfe3627e9) {
require(block.timestamp <= params[1], "Invalid start time");
poolIdToTime[poolId] = params[1];
provider.registerPool(poolId, params);
}

function getWithdrawableAmount(uint256 poolId) public view override returns (uint256) {
uint256[] memory params = getParams(poolId);
uint256 leftAmount = params[0];
uint256 startTime = params[1];
uint256 finishTime = params[2];
uint256 startAmount = params[3];
if (block.timestamp < startTime) return 0;
if (finishTime <= block.timestamp) return leftAmount;
uint256 totalPoolDuration = finishTime - startTime;
uint256 timePassed = block.timestamp - startTime;
uint256 debitableAmount = (startAmount * timePassed) / totalPoolDuration;
return debitableAmount - (startAmount - leftAmount);
}

function getWithdrawableAmount(uint256 poolId) public view override returns (uint256) {
return poolIdToTime[poolId] <= block.timestamp ? provider.getWithdrawableAmount(poolId) : 0;
}

dead-code

Impact: Informational
Confidence: Medium

function _validProvider(uint256 poolId, IProvider provider) internal view {
require(lockDealNFT.poolIdToProvider(poolId) == provider, "Invalid provider poolId");
}

function _validProviderInterface(IProvider provider, bytes4 interfaceId) internal view {
require(ERC165Checker.supportsInterface(address(provider), interfaceId), "invalid provider type");
}

function _withdraw(
uint256 poolId,
uint256 amount
) internal virtual returns (uint256 withdrawnAmount, bool isFinal) {}

naming-convention

Impact: Informational
Confidence: High

https://github.com/The-Poolz/LockDealNFT/blob/ab1008a83fb3e9ed607ce578a24e4498c3c07707/node_modules/@poolzfinance/poolz-helper-v2/contracts/token/ERC20Token.sol#L19-L21

https://github.com/The-Poolz/LockDealNFT/blob/ab1008a83fb3e9ed607ce578a24e4498c3c07707/node_modules/@poolzfinance/poolz-helper-v2/contracts/Array.sol#L8

https://github.com/The-Poolz/LockDealNFT/blob/ab1008a83fb3e9ed607ce578a24e4498c3c07707/node_modules/@poolzfinance/poolz-helper-v2/contracts/Array.sol#L22

https://github.com/The-Poolz/LockDealNFT/blob/ab1008a83fb3e9ed607ce578a24e4498c3c07707/node_modules/@poolzfinance/poolz-helper-v2/contracts/Array.sol#L78

https://github.com/The-Poolz/LockDealNFT/blob/ab1008a83fb3e9ed607ce578a24e4498c3c07707/node_modules/@poolzfinance/poolz-helper-v2/contracts/Array.sol#L78

https://github.com/The-Poolz/LockDealNFT/blob/ab1008a83fb3e9ed607ce578a24e4498c3c07707/node_modules/@poolzfinance/poolz-helper-v2/contracts/Array.sol#L22-L34

https://github.com/The-Poolz/LockDealNFT/blob/ab1008a83fb3e9ed607ce578a24e4498c3c07707/node_modules/@poolzfinance/poolz-helper-v2/contracts/Array.sol#L8-L20

https://github.com/The-Poolz/LockDealNFT/blob/ab1008a83fb3e9ed607ce578a24e4498c3c07707/node_modules/@poolzfinance/poolz-helper-v2/contracts/Array.sol#L22

https://github.com/The-Poolz/LockDealNFT/blob/ab1008a83fb3e9ed607ce578a24e4498c3c07707/node_modules/@poolzfinance/poolz-helper-v2/contracts/Array.sol#L67

https://github.com/The-Poolz/LockDealNFT/blob/ab1008a83fb3e9ed607ce578a24e4498c3c07707/node_modules/@poolzfinance/poolz-helper-v2/contracts/Array.sol#L8

https://github.com/The-Poolz/LockDealNFT/blob/ab1008a83fb3e9ed607ce578a24e4498c3c07707/node_modules/@poolzfinance/poolz-helper-v2/contracts/Array.sol#L54

https://github.com/The-Poolz/LockDealNFT/blob/ab1008a83fb3e9ed607ce578a24e4498c3c07707/node_modules/@poolzfinance/poolz-helper-v2/contracts/Array.sol#L37

https://github.com/The-Poolz/LockDealNFT/blob/ab1008a83fb3e9ed607ce578a24e4498c3c07707/node_modules/@poolzfinance/poolz-helper-v2/contracts/Array.sol#L67

unused-import

Impact: Informational
Confidence: High

  • ID-24
    The following unused import(s) in contracts/LockDealNFT/ILockDealNFTEvents.sol should be removed:
    -import "@poolzfinance/poolz-helper-v2/contracts/interfaces/IProvider.sol"; (contracts/LockDealNFT/ILockDealNFTEvents.sol#4)

  • ID-25
    The following unused import(s) in contracts/SimpleProviders/Provider/BasicProvider.sol should be removed:
    -import "@poolzfinance/poolz-helper-v2/contracts/interfaces/IProvider.sol"; (contracts/SimpleProviders/Provider/BasicProvider.sol#5)

immutable-states

Impact: Optimization
Confidence: High

IVaultManager public vaultManager;

@Lomet Lomet merged commit a3bb8b4 into master Jun 25, 2024
7 checks passed
@Lomet Lomet deleted the issue-416 branch June 25, 2024 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add publish npm when version is released
2 participants