Skip to content

Commit 0be26c4

Browse files
committed
Added ground truth for SmartAxe manually-labeled bridges
1 parent 887776c commit 0be26c4

File tree

24 files changed

+498
-480
lines changed

24 files changed

+498
-480
lines changed

datasets/cross-chain/smartaxe/manually-labeled/EvoDeFi20220607/source-code/MasterChef_label.sol

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ interface IGenNFT is IERC721 {
2727
contract MasterChef is Ownable, ERC721Holder {
2828
using SafeERC20 for IERC20;
2929
using SafeMath for uint;
30-
30+
3131
// Info of each user.
3232
struct UserInfo {
3333
uint256 amount; // How many LP tokens the user has provided.
@@ -36,7 +36,7 @@ contract MasterChef is Ownable, ERC721Holder {
3636
uint lastPoweredBlock; // last powered Block
3737
uint lastClaimedBlock; // last powered Block
3838
}
39-
39+
4040
IProxy proxy;
4141

4242
// Info of each pool.
@@ -62,15 +62,15 @@ contract MasterChef is Ownable, ERC721Holder {
6262

6363
// Info of each pool.
6464
PoolInfo[] public poolInfo;
65-
65+
6666
// Info of each user that stakes LP tokens.
6767
mapping (uint256 => mapping (address => UserInfo)) public userInfo;
68-
68+
6969
// Total allocation points. Must be the sum of all allocation points in all pools.
7070
uint256 public totalAllocPoint = 0;
7171
// The block number when Gen mining starts.
7272
uint256 public startBlock;
73-
73+
7474
uint public topPrice = 100; // 10$
7575
uint public bottomPrice = 10; //100$
7676
uint public lastBlockUpdate = 0;
@@ -93,7 +93,7 @@ contract MasterChef is Ownable, ERC721Holder {
9393
) public {
9494
require(_devaddr != address(0), "address can't be 0");
9595
require(_feeAddress != address(0), "address can't be 0");
96-
96+
9797
gen = _gen;
9898
busd = _busd;
9999
nft = _nft;
@@ -116,7 +116,7 @@ contract MasterChef is Ownable, ERC721Holder {
116116
if (_withUpdate) {
117117
massUpdatePools();
118118
}
119-
119+
120120
uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock;
121121
totalAllocPoint = totalAllocPoint.add(_allocPoint);
122122
poolInfo.push(PoolInfo({
@@ -172,13 +172,13 @@ contract MasterChef is Ownable, ERC721Holder {
172172
}
173173

174174
// Deposit LP tokens to MasterChef for GEN allocation.
175-
//1.lack of check for uodate power
175+
// CCV lack of check for update power
176176
function deposit(uint256 _pid, uint256 _amount) public {
177177
PoolInfo storage pool = poolInfo[_pid];
178178
UserInfo storage user = userInfo[_pid][msg.sender];
179179
updatePool(_pid);
180180
claim(_pid);
181-
181+
182182
if(_amount > 0) {
183183
pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount);
184184
if(pool.depositFeeBP > 0){
@@ -189,9 +189,9 @@ contract MasterChef is Ownable, ERC721Holder {
189189
user.amount = user.amount.add(_amount);
190190
}
191191
}
192-
//1.lack of check for uodate power
192+
// CCV lack of check for update power
193193
updatePower(_pid);
194-
194+
195195
user.rewardDebt = user.power.mul(pool.accGenPerPower).div(1e12);
196196
emit Deposit(msg.sender, _pid, _amount);
197197
}
@@ -201,70 +201,70 @@ contract MasterChef is Ownable, ERC721Holder {
201201
PoolInfo storage pool = poolInfo[_pid];
202202
UserInfo storage user = userInfo[_pid][msg.sender];
203203
require(user.amount >= _amount, "withdraw: not good");
204-
204+
205205
updatePool(_pid);
206206
claim(_pid);
207-
207+
208208
if (_amount > 0) {
209209
user.amount = user.amount.sub(_amount);
210210
pool.lpToken.safeTransfer(address(msg.sender), _amount);
211211
}
212-
212+
213213
updatePower(_pid);
214-
214+
215215
user.rewardDebt = user.power.mul(pool.accGenPerPower).div(1e12);
216216
emit Withdraw(msg.sender, _pid, _amount);
217217
}
218-
218+
219219
function powerUpWithNFTs(uint256 _pid, uint[] memory _nftIds) public {
220220
PoolInfo storage pool = poolInfo[_pid];
221221
UserInfo storage user = userInfo[_pid][msg.sender];
222-
222+
223223
updatePool(_pid);
224224
claim(_pid);
225-
225+
226226
for (uint i =0; i < _nftIds.length; i++) {
227227
uint nftId = _nftIds[i];
228228
if (nft.ownerOf(nftId) == msg.sender) {
229229
if (user.lastPoweredBlock >= block.number) {
230230
user.lastPoweredBlock += proxy.getNFTPowerBonusBlocks(nftId);
231231
} else {
232-
user.lastPoweredBlock = block.number + proxy.getNFTPowerBonusBlocks(nftId);
232+
user.lastPoweredBlock = block.number + proxy.getNFTPowerBonusBlocks(nftId);
233233
}
234-
234+
235235
nft.changeType(nftId,0);
236236
}
237237
}
238-
239-
238+
239+
240240
updatePower(_pid);
241-
241+
242242
user.rewardDebt = user.power.mul(pool.accGenPerPower).div(1e12);
243243
emit Deposit(msg.sender, _pid, 1);
244244
}
245245
// CCV vulnerabilities functions
246246
function updatePower(uint256 _pid) public {
247247
PoolInfo storage pool = poolInfo[_pid];
248248
UserInfo storage user = userInfo[_pid][msg.sender];
249-
249+
250250
uint256 currentPower = user.power;
251251
uint powerBonus = 100;
252-
252+
253253
if (user.lastPoweredBlock >= block.number) {
254254
powerBonus += proxy.getNFTPowerBonus();
255255
}
256256
powerBonus += proxy.bonus(msg.sender);
257-
257+
258258
user.power = user.amount.mul(powerBonus).div(100);
259-
259+
260260
pool.totalPower = pool.totalPower.add(user.power).sub(currentPower);
261261
}
262-
262+
263263
// Withdraw without caring about rewards. EMERGENCY ONLY.
264264
function emergencyWithdraw(uint256 _pid) public {
265265
PoolInfo storage pool = poolInfo[_pid];
266266
UserInfo storage user = userInfo[_pid][msg.sender];
267-
267+
268268
pool.totalPower = pool.totalPower.sub(user.power);
269269
uint256 amount = user.amount;
270270
user.power = 0;
@@ -274,45 +274,45 @@ contract MasterChef is Ownable, ERC721Holder {
274274
pool.lpToken.safeTransfer(address(msg.sender), amount);
275275
emit EmergencyWithdraw(msg.sender, _pid, amount);
276276
}
277-
277+
278278
function claim(uint256 _pid) internal {
279279
UserInfo storage user = userInfo[_pid][msg.sender];
280-
280+
281281
user.lastClaimedBlock = block.number;
282-
282+
283283
if (user.amount > 0) {
284284
uint256 pending = _pendingGen(_pid, msg.sender);
285-
285+
286286
if (pending > 0) {
287287
safeGenTransfer(msg.sender, pending);
288288
}
289289
}
290290
updateEmissionIfNeeded();
291291
}
292-
292+
293293
function _pendingGen(uint256 _pid, address _user) internal view returns (uint256) {
294294
PoolInfo storage pool = poolInfo[_pid];
295295
UserInfo storage user = userInfo[_pid][_user];
296296
uint256 accGenPerPower = pool.accGenPerPower;
297-
298-
297+
298+
299299
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
300300
if (block.number > pool.lastRewardBlock && lpSupply != 0 && pool.totalPower != 0) {
301301
uint256 blockAmount = block.number.sub(pool.lastRewardBlock);
302302
uint256 genReward = blockAmount.mul(genPerBlock).mul(pool.allocPoint).div(totalAllocPoint);
303303
accGenPerPower = accGenPerPower.add(genReward.mul(1e12).div(pool.totalPower));
304304
}
305-
305+
306306
if ((user.lastClaimedBlock < user.lastPoweredBlock) && (block.number > user.lastPoweredBlock) && (user.power > 0)) {
307307
uint powerBonus = 100;
308-
308+
309309
powerBonus += proxy.getNFTPowerBonus() * (user.lastPoweredBlock - user.lastClaimedBlock) / (block.number - user.lastClaimedBlock);
310310
powerBonus += proxy.bonus(msg.sender);
311-
311+
312312
uint truePower = user.amount.mul(powerBonus).div(100);
313313
return user.power.mul(accGenPerPower).div(1e12).sub(user.rewardDebt) * truePower / user.power;
314314
}
315-
315+
316316
return user.power.mul(accGenPerPower).div(1e12).sub(user.rewardDebt);
317317
}
318318

@@ -325,7 +325,7 @@ contract MasterChef is Ownable, ERC721Holder {
325325
gen.transfer(_to, _amount);
326326
}
327327
}
328-
328+
329329
// Update dev address by the previous dev.
330330
function dev(address _devaddr) public {
331331
require(msg.sender == devaddr, "dev: wut?");
@@ -346,12 +346,12 @@ contract MasterChef is Ownable, ERC721Holder {
346346
function updateEmissionIfNeeded() public {
347347
if (block.number - lastBlockUpdate > emissionUpdateInterval) { //every 3 hours
348348
lastBlockUpdate = block.number;
349-
349+
350350
uint genBalance = gen.balanceOf(busdGenLP);
351351
uint priceCents = bottomPrice * 100;
352352
if (genBalance > 0) {
353353
massUpdatePools();
354-
priceCents = busd.balanceOf(busdGenLP).mul(100).div(genBalance);
354+
priceCents = busd.balanceOf(busdGenLP).mul(100).div(genBalance);
355355
}
356356

357357
if (priceCents < bottomPrice * 100) {
@@ -367,13 +367,13 @@ contract MasterChef is Ownable, ERC721Holder {
367367
}
368368
}
369369
}
370-
370+
371371
function updateEmissionParameters(uint _topPrice, uint _bottomPrice, uint _emissionUpdateInterval) public onlyOwner {
372372
topPrice = _topPrice;
373373
bottomPrice = _bottomPrice;
374374
emissionUpdateInterval = _emissionUpdateInterval;
375375
}
376-
376+
377377
function setProxy(IProxy _proxy) public onlyOwner {
378378
proxy = _proxy;
379379
}

datasets/cross-chain/smartaxe/manually-labeled/LiFinance20220320/source-code/AmarokFacet_label.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ contract AmarokFacet is ILiFi, ReentrancyGuard, SwapperV2, Validatable {
7272
/// @param _bridgeData The core information needed for bridging
7373
/// @param _swapData An array of swap related data for performing swaps before bridging
7474
/// @param _amarokData Data specific to Amarok
75-
//1. lack of check on argument by msg
75+
// CCV lack of check on argument by msg
7676
function swapAndStartBridgeTokensViaAmarok(
7777
BridgeData memory _bridgeData,
7878
LibSwap.SwapData[] calldata _swapData,

datasets/cross-chain/smartaxe/manually-labeled/Multichain20230215/source-code/AnyswapV4ERC20_label.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,13 +333,13 @@ contract AnyswapV4ERC20 is IAnyswapV3ERC20 {
333333
function totalSupply() external view override returns (uint256) {
334334
return _totalSupply;
335335
}
336-
//1. semantic inconsistency
336+
// CCV semantic inconsistency
337337
function depositWithPermit(address target, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) external returns (uint) {
338338
IERC20(underlying).permit(target, address(this), value, deadline, v, r, s);
339339
IERC20(underlying).safeTransferFrom(target, address(this), value);
340340
return _deposit(value, to);
341341
}
342-
342+
343343
function depositWithTransferPermit(address target, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) external returns (uint) {
344344
IERC20(underlying).transferWithPermit(target, address(this), value, deadline, v, r, s);
345345
return _deposit(value, to);

datasets/cross-chain/smartaxe/manually-labeled/Multichain20230215/source-code/AnyswapV5ERC20_label.sol

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -333,20 +333,20 @@ contract AnyswapV5ERC20 is IAnyswapV3ERC20 {
333333
function totalSupply() external view override returns (uint256) {
334334
return _totalSupply;
335335
}
336-
//1.lack of check on underlying permit
337-
//2.access control inconsistency between paths
336+
// CCV lack of check on underlying permit
337+
// CCV access control inconsistency between paths
338338
function depositWithPermit(address target, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) external returns (uint) {
339339
IERC20(underlying).permit(target, address(this), value, deadline, v, r, s);
340340
IERC20(underlying).safeTransferFrom(target, address(this), value);
341341
return _deposit(value, to);
342342
}
343-
//1.lack of check on underlying permit
344-
//2.access control inconsistency between paths
343+
// CCV lack of check on underlying permit
344+
// CCV access control inconsistency between paths
345345
function depositWithTransferPermit(address target, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) external returns (uint) {
346346
IERC20(underlying).transferWithPermit(target, address(this), value, deadline, v, r, s);
347347
return _deposit(value, to);
348348
}
349-
//2.access control inconsistency between paths
349+
// CCV access control inconsistency between paths
350350
function deposit() external returns (uint) {
351351
uint _amount = IERC20(underlying).balanceOf(msg.sender);
352352
IERC20(underlying).safeTransferFrom(msg.sender, address(this), _amount);

datasets/cross-chain/smartaxe/manually-labeled/Multichain20230215/source-code/AnyswapV5ERC20_label_1.sol

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -333,20 +333,20 @@ contract AnyswapV5ERC20 is IAnyswapV3ERC20 {
333333
function totalSupply() external view override returns (uint256) {
334334
return _totalSupply;
335335
}
336-
//1.lack of check on underlying permit
337-
//2.access control inconsistency between paths
336+
// CCV lack of check on underlying permit
337+
// CCV access control inconsistency between paths
338338
function depositWithPermit(address target, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) external returns (uint) {
339339
IERC20(underlying).permit(target, address(this), value, deadline, v, r, s);
340340
IERC20(underlying).safeTransferFrom(target, address(this), value);
341341
return _deposit(value, to);
342342
}
343-
//1.lack of check on underlying permit
344-
//2.access control inconsistency between paths
343+
// CCV lack of check on underlying permit
344+
// CCV access control inconsistency between paths
345345
function depositWithTransferPermit(address target, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) external returns (uint) {
346346
IERC20(underlying).transferWithPermit(target, address(this), value, deadline, v, r, s);
347347
return _deposit(value, to);
348348
}
349-
//2.access control inconsistency between paths
349+
// CCV access control inconsistency between paths
350350
function deposit() external returns (uint) {
351351
uint _amount = IERC20(underlying).balanceOf(msg.sender);
352352
IERC20(underlying).safeTransferFrom(msg.sender, address(this), _amount);

datasets/cross-chain/smartaxe/manually-labeled/Multichain20230215/source-code/AnyswapV6ERC20_label.sol

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ contract AnyswapV6ERC20 is IERC20 {
182182
_mint(to, amount);
183183
return true;
184184
}
185-
//1.Access control inconcsistency between paths
185+
// CCV Access control inconsistency between paths
186186
function burn(address from, uint256 amount) external onlyAuth returns (bool) {
187187
//2.semantic inconsistency
188188
_burn(from, amount);
@@ -246,7 +246,7 @@ contract AnyswapV6ERC20 is IERC20 {
246246
IERC20(underlying).safeTransferFrom(msg.sender, address(this), _amount);
247247
return _deposit(_amount, msg.sender);
248248
}
249-
//3.
249+
250250
function deposit(uint amount) external returns (uint) {
251251
IERC20(underlying).safeTransferFrom(msg.sender, address(this), amount);
252252
return _deposit(amount, msg.sender);
@@ -283,12 +283,12 @@ contract AnyswapV6ERC20 is IERC20 {
283283
function withdrawVault(address from, uint amount, address to) external onlyVault returns (uint) {
284284
return _withdraw(from, amount, to);
285285
}
286-
//1.Access control inconcsistency between paths
287-
//3.lack of chcek on repetiveness
286+
// CCV Access control inconsistency between paths
287+
// CCV Lack of check on repetitiveness
288288
function _withdraw(address from, uint amount, address to) internal returns (uint) {
289289
require(!underlyingIsMinted);
290290
require(underlying != address(0) && underlying != address(this));
291-
//2.semantic inconsistency
291+
// CCV Semantic inconsistency
292292
_burn(from, amount);
293293
IERC20(underlying).safeTransfer(to, amount);
294294
return amount;

datasets/cross-chain/smartaxe/manually-labeled/Multichain20230215/source-code/AnyswapV6Router_label.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ contract AnyswapV6Router {
323323
IERC20(AnyswapV1ERC20(token).underlying()).safeTransferFrom(msg.sender, token, amount);
324324
emit LogAnySwapOut(token, msg.sender, to, amount, cID(), toChainID);
325325
}
326-
//1.access control inconsistency between paths
326+
// CCV Access control inconsistency between paths
327327
function anySwapOutNative(address token, address to, uint toChainID) external payable {
328328
require(AnyswapV1ERC20(token).underlying() == wNATIVE, "AnyswapV3Router: underlying is not wNATIVE");
329329
IwNATIVE(wNATIVE).deposit{value: msg.value}();

datasets/cross-chain/smartaxe/manually-labeled/Multichain20230215/source-code/Erc20SwapAsset_label.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ contract ERC20 is Context, IERC20 {
465465
* - `account` cannot be the zero address.
466466
* - `account` must have at least `amount` tokens.
467467
*/
468-
//1.access control inconcsistency between paths
468+
// CCV Access control inconsistency between paths
469469
function _burn(address account, uint256 amount) internal {
470470
require(account != address(0), "ERC20: burn from the zero address");
471471

0 commit comments

Comments
 (0)