Comments (4)
Example:
block_number deposit_size referral
99 1eth 0xb8baa0e4287890a5f79863ab62b7f175cecbd433
100 10eth 0x2cffa6e8b85028952be77c0ae2c2c319499c6eff
101 70eth 0xb8baa0e4287890a5f79863ab62b7f175cecbd433
101 10eth 0x2cffa6e8b85028952be77c0ae2c2c319499c6eff
199 20eth 0x0
200 10eth 0xb8baa0e4287890a5f79863ab62b7f175cecbd433
201 100eth 0xb8baa0e4287890a5f79863ab62b7f175cecbd433
there's been 120eth worth of deposits between blocks 100 and 200 but only 100 with referral
count referrals (100,200) will output
0xb8baa0e4287890a5f79863ab62b7f175cecbd433 80eth 80%
0x2cffa6e8b85028952be77c0ae2c2c319499c6eff 20eth 20%
total 100eth 100%
from lido-dao.
Neither caller address nor EOA who sent the transaction doesn't matter for referrals
from lido-dao.
Contract
add referral's address to existing method submit as optional argument
https://github.com/depools/depool-dao/blob/274f7b857d37399501c1c08aa92ddf1de3fd9a0b/apps/depool/contracts/DePool.sol#L96
submit(uint256 referral) payable
If referral missing, it would be called by the client with 0x00 value (zero cost)
the event Submitted
should include referral address (0x00 if not set)
https://github.com/depools/depool-dao/blob/274f7b857d37399501c1c08aa92ddf1de3fd9a0b/apps/depool/contracts/DePool.sol#L488
emit Submitted(_sender, _value, _referral);
Scanner
pure python3 stateless script running from CLI with block range passed via ARGV
python3 count_referrals.py <start block> <end block>
The algorithm:
1. connects to given web3 endpoint
2. polls the blocks by number (sequentially, synchronously, incrementally)
3. filters receipts with destination (DEPOOL_CONTRACT) AND event Submitted
4. parse event fields, group by referrals and summarize deposited amounts
5. calculate the referral percentages
5. print the result to stdout
File location: depool-dao/apps/depool/scripts/count_referrals.py
from lido-dao.
count_referrals.py scanner and test helper are to be implemented in pythonic repo https://github.com/depools/py-oracle. See lidofinance/lido-oracle#1
from lido-dao.
Related Issues (20)
- Account's `stETH` balance getting lower on 1 or 2 wei due to rounding down integer math HOT 4
- `SelfOwnedStETHBurner::recoverERC721` may allow moving ERC20s HOT 4
- localhost deploy issue HOT 1
- Error when deploy lido apm on goerli HOT 1
- how to upgrade lido app and nos app HOT 1
- Add a view method in NOR to get a range of keys HOT 2
- Unproven keys can be used for the deposit if a node operator has stopped validators HOT 2
- Alternating transactions of oracle committee members HOT 5
- Volatile `gasLimit` for `_submit()` method HOT 3
- Tune up CI checks for readability HOT 1
- Make _submit() cheaper by removing _getTotalPooledEther() != 0 check HOT 3
- No check for report in submitReportData HOT 1
- Slippage control upon withdrawals HOT 7
- LegacyOracle.finalizeUpgrade_V4 can be called multiple times HOT 1
- Prevent possible `pauseStaking` and `resumeStaking` repetitive calls
- Steal of shares using `transferSharesFrom` due to math rounding issues HOT 2
- Potential withdrawal request griefing vector via `permit` front-running HOT 3
- Incorrect unstETH full name on Holesky
- Incompatible Solidity Version and Unresolved Import Issues with lido-dao Contract HOT 1
- Don't assign MANAGE_NODE_OPERATOR_ROLE to voting upon scratch deploy HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lido-dao.