totleplatform / contracts Goto Github PK
View Code? Open in Web Editor NEWTotle Smart Contracts
Totle Smart Contracts
The upcoming Istanbul Ethereum hardfork contains the EIP-1884. EIP-1884 will, besides other things, raise the gas cost of the EVM SLOAD
instruction from 200 to 800 gas.
When the TotlePrimary
contract executes the performSwap
function, it might execute the minimumRateFailed
function, which internally calls getDecimals
on the target token contract. As part of this call, getDecimals
only passes 5000 gas:
contracts/contracts/lib/Utils.sol
Lines 49 to 57 in a7e1574
If this the target token is Augur's REP token, then the Delegator will be called. This call currently consumes 4511 gas and successfully returns 18.
However, this call also contains three invocations of SLOAD, so it will cost 6311 after the activation of the Istanbul hard fork. Then, the call will fail (as it is out-of-gas). TotlePrimary
will interpret the falling call as 0
decimals:
contracts/contracts/lib/Utils.sol
Lines 59 to 66 in a7e1574
As the decimals are used to calculate token quantities, incorrect token quantities will be computed. Hence, users would be as the security check for the minimum rate could be circumvented.
The scenario described above recently took place in the following transaction.
This trade converted 0.06978 Ether into 1.497 Reputation (REP) tokens.
ChainSecurity has conducted some analysis on the effects of EIP-1884. The intermediate results can be found here.
Martin Holst Swende has collected information on the effects of EIP-1884 here.
Feel free to contact [email protected] or @HRitzdorf
on Telegram in case of questions or comments.
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.