-
Notifications
You must be signed in to change notification settings - Fork 0
/
notes.txt
40 lines (35 loc) · 2.05 KB
/
notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
reentrancy attacks
-Inherits our contract and reenters to our deposit fnc by creating a fallback fnc
2 ways to prevent that :
-before we deposit money in the fnc set msg.sender balance to 0,with that after we deposit
they cant pass the require state.
2-use mutex from openzeppelin,add require(!locked,"revert") in the beginning of the withdraw fnc!!!
require(!locked,"revert")
locked=true
...
...
...
...
... en sona
locked=false
also reentranceguard by openzeppelin will provide security
SUMMARY:
change your msg.senders balance before you execute external fnc
add safetransferfrom fnc in the bottom
--------------------------------------------------------------------------------------------------------
TESTING
xContract=await ethers.getContract("x")
x =await xContract.connect(player) --- player,deployer... kim baglancaksa
YA DA
xContract = await ethers.getContract("x",player)
-------------------------------------------------------------------------------------------
https://github.com/Fantom-foundation/Artion-Contracts/blob/5c90d2bc0401af6fb5abf35b860b762b31dfee02/contracts/FantomMarketplace.sol
Check this out later
-------------------------------------------------------------------------------------------------------------------
ARTIFACT ERROR HH702:
check artifacts=>contracts=> json file to ensure contract name and path are correct
also check deploy script to ensure the name of the contract
generally case sensitive names cause this
--------------------------------------------------------------------------------------------------
It is important that transactions are executed only if conditions for safety are satisfied. It the conditions dont meet the requirements, then we can restrict access for a smart contract fncs until predetermined delay with timelock
-A timelock is a mechanism for delaying the execution of functions in smart contract. timelock contracts implement modifiers that alther the behavior of functions such that those functions can not be called until a specified time!(for example in a bidding dapp where you cant vote in out of bidding time).