quarkchain / quarkchain-contracts Goto Github PK
View Code? Open in Web Editor NEWsystem contracts, reference impl, etc
system contracts, reference impl, etc
Looks like the amount parameter can be one of the following:
1, the native token amount, i.e., gasPrice * gasUsed (or start)
2, the native token gasPrice.
If it works for both, I think we need to at least add one comment to clarify.
It is better to use nonReentrant modifier for withdrawStakes, withdrawMinerReward, and
transferMaintainerFee
We add OVERTIME constant if there is a bid that is close to the end. E.g., there are 2 mins left, then it will add 2 + 5 mins to 7 mins. However, I think it may better if there are < 5 mins left for a bid, we just set the end time so that only 5 mins left.
Looks like the previous auction's owner will be overridden to address(0).
Sometimes it is converted to uint64 while sometimes uint128
If an attacker intentionally withdraw a 0 balance stake where the stake's address is not in the array, I think an unexpected result will happen
because of PoSW lockup, it's possible that malicious miner will keep mining and not release stakers' funds. having a pool admin who can adjust the fee rate can mitigate this problem:
The logic is the same and we should reuse the logic.
We use uint16 to enumerate all stakers, which is up to 65535, while maximum stakers is uint128
One is > while another is >=.
instead of explicitly calling start and end, we want to have a more autonomous approach
bid
) will automatically start the auction process, until duration
is reachedend
the auction will finalize the results of last round of auctionafter merging #9, unit tests are needed
After the expiration time, the miner would get no profits. He must stop mining and let stakers withdraw their coins.
The endTime calculation is repeatedly used in several places, and they should be either replaced by an internal function or a field in auction directly.
Such as 10%.
This prevents a bidder submitting a bid and then refund most of the QKC via a large gas transaction with a negligible cost.
since we can use the default paused
variable to disallow other shards' auction, we don't need a separate allowMint
parameter
The minimum increment should be the factor * current_price, e.g., at least 5% greater than the current price.
non-reserved tokens are generated from the auction, and we may want to limit of the length of those token IDs
Since we stopping withdrawing the balance of the highest bidder, we internally will make sure that the equation is true and thus "require" should be replaced by "assert" (require will be only used to check the inputs are valid, while assert is used to check whether the internal data structure is correct).
SafeMath already has an overflow check so we don't need the require's manually.
The owner may give up its ownership by setting the owner as 0x0, which means it can be bid again given this line.
I would suggest adding a field in the map to indicate whether the token is taken or not.
To avoid malicious attacks.
...such that the a certain portion of miner rewards should go to the pool
unit tests should be under test
folder
for auctioning new tokens:
for gas reserves:
for how to write contract tests, this is a working example
feel free to add other test cases
cc @qizhou
I see a lot of conversion from uint256 to uint128. Although it should be generally safe to convert as we have up to 1e28 tokens (about 2**93), but the conversion will succeed even such conversion may result in data loss.
Notice that changing to uint256 will add extra gas cost to adding and withdrawing stakes (I think it is about 5000 or 20000).
To help stakers to contact the miner or admin when they need to withdraw or arbitrate.
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.