the-poolz / locked-pools Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
maybe: we can make a new pool for the new user, and make the amount 0
or we need to make sure the allowance is reset.
Locked-pools/contracts/LockedControl.sol
Lines 10 to 25 in a1616c8
problem:
When we create a new memory array, we must specify its length. But at this stage, we do not know how many elements will be required
Lets slit the Creating to other file
Locked-pools/contracts/LockedControl.sol
Lines 62 to 127 in e5f9d4a
let's find better file names (and the locations of the functions.)
if (AllPoolz[_PoolId].DebitedAmount == 0)
return true;
Please list all the commands and how to use them by category (admin, pool owner, user).
we can't pass a value without first initiating
uint256[] memory ids;
ids[index] = allIds[i]; // invalid opcode error
uint256[] memory ids = new uint256[](allIds.length);
ids[index] = allIds[i];
Seems like wrong logic
Locked-pools/contracts/LockedDealV2.sol
Line 26 in fbfb6e1
should be: pool.StartAmount - pool.DebitedAmount > 0
and format repo files.
update visibility of variables.
Locked-pools/contracts/LockedPoolz.sol
Lines 29 to 31 in 5d4bb33
GetPoolData(uint256 _id)
and GetAllMyPoolsId
functions, because the state of the visible variable automatically creates getter methods.Locked-pools/contracts/LockedPoolz.sol
Line 16 in b40e54a
not changing the debited amount, the user can withdraw tokens, then split pool, to double spend
Potential problem:
Using the CreateNewPool
function could potentially lead to a hack. When we pass a fake token that overwrites the transfer
logic or other functions.
Solution:
If Token is bad for our contract we can create a whitelist of tokens that can be only used to create a pool. This feature is disabled by default.
after withdrawing tokens, if the pool got 0
remove the id from the user list.
Locked-pools/contracts/LockedPoolz.sol
Line 32 in 2b7172c
Locked-pools/contracts/LockedControl.sol
Line 16 in a8af4c1
add a new view function that can get an input list of addresses, that will return only pools id that the token address is matching.
this will help the front to faster fetch all id's for a specific token
We already have a public Allowance
variable that returns the allocation amount.
Allowance
function signature: Allowance(uint256 _PoolId, address _Address) public view returns(uint256)
GetMyPoolDataByToken will looks like:
GetMyPoolDataByToken(address[] memory _tokens)
{
return GetPoolsData(GetMyPoolsIdByToken(_tokens));
}
If the pool has started and the debit amount is still zero, the owner can split the pool.
It will take an array of Id's and return all the data
Locked-pools/contracts/LockedPoolzData.sol
Lines 43 to 69 in 0a70a51
this function can be used as libery
Locked-pools/contracts/LockedPoolzData.sol
Lines 30 to 41 in 0a70a51
in current version, splitting after withdraw can lose tokens
Locked-pools/contracts/LockedPoolz.sol
Lines 74 to 82 in a1616c8
Instead, use the _UserAddress input parameter.
instead use Focal linux distribution
If the pool is created and the debit amount is still zero, the owner can call the PoolTransfer function. In other cases, no.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.