before_code stringlengths 30 149k | reviewer_comment stringlengths 16 20.6k | after_code stringlengths 30 163k | diff_context stringlengths 0 22.4k | file_path stringlengths 6 155 | comment_line int64 0 26 | language stringclasses 19
values | quality_score float64 0.07 1 | comment_type stringclasses 9
values | comment_length int64 16 20.6k | before_lines int64 2 4.61k | after_lines int64 2 4.4k | is_negative bool 2
classes | pr_title stringlengths 7 140 | pr_number int64 18 61.2k | repo_name stringclasses 29
values | repo_stars int64 321 56k | repo_language stringclasses 14
values | reviewer_username stringclasses 378
values | author_username stringclasses 739
values | user stringlengths 361 200k | assistant stringlengths 16 20.6k | system stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
:value="currentCharacterId"
:showNftOptions="true"
@input="setCurrentCharacter"
/>
</div>
</div>
</div>
</b-tab>
<b-tab @click="garrisonTabActive = true" v-if="haveCharacters">
<template #title>
{{$... | I would prefer to use conditional translations in line, but I think it's very subjective
`isClaimingXp ? $t('plaza.claiming') : $t('plaza.claimXp')`
Notice I would also move "..." to the translation directly^
Example:
}}
+ {{claimGarrisonXpButtonText}} | frontend/src/views/Plaza.vue | 26 | Vue | 0.643 | suggestion | 339 | 51 | 51 | false | burn button fix, disable button while transaction's in progress, add … | 1,122 | CryptoBlades/cryptoblades | 321 | Vue | Chriserus | kcper | Review this pull request change.
Language: Vue
File: frontend/src/views/Plaza.vue
PR Title: burn button fix, disable button while transaction's in progress, add …
BEFORE CODE: :value="currentCharacterId"
:showNftOptions="true"
@input="setCurrentCharacter"
... | I would prefer to use conditional translations in line, but I think it's very subjective
`isClaimingXp ? $t('plaza.claiming') : $t('plaza.claimXp')`
Notice I would also move "..." to the translation directly^
Example:
;
}
isCharacterInArena[characterID] = false;
isWeaponInArena[weaponID] = false;
// setting characters, weapons and shield NFTVAR_BUSY to 0
characters.setNftVar(characterID, 1, 0);
weapons.setNftVar(weaponID... | i don't think the mul function is correct here.
ABDKMath64x64.sol says
/**
* Calculate x * y rounding down. Revert on overflow.
*
* @param x signed 64.64-bit fixed point number
* @param y signed 64.64-bit fixed point number
* @return signed 64.64-bit fixed point number
*/
function mul (int... | }
isCharacterInArena[characterID] = false;
isWeaponInArena[weaponID] = false;
// setting characters, weapons and shield NFTVAR_BUSY to 0
characters.setNftVar(characterID, 1, 0);
weapons.setNftVar(weaponID, 1, 0);
}
function _getCharacterPowerRoll(Duelist memory... | @@ -1010,7 +1017,7 @@ contract PvpArena is Initializable, AccessControlUpgradeable {
int128 bonusShieldStats;
if (fighter.useShield) {
- bonusShieldStats = _getShieldStats(character.ID);
+ bonusShieldStats = _getShieldStats(character.ID).mul(int128(_shieldFactor)).div(100); | contracts/PvpArena.sol | 26 | Solidity | 0.643 | bug | 729 | 51 | 51 | false | Feat/pvp shield factor | 1,124 | CryptoBlades/cryptoblades | 321 | Vue | poshdan | Jcalcaldev | Review this pull request change.
Language: Solidity
File: contracts/PvpArena.sol
PR Title: Feat/pvp shield factor
BEFORE CODE: _matchableCharactersByTier[tier].remove(characterID);
}
isCharacterInArena[characterID] = false;
isWeaponInArena[weaponID] = false;
// setting... | i don't think the mul function is correct here.
ABDKMath64x64.sol says
/**
* Calculate x * y rounding down. Revert on overflow.
*
* @param x signed 64.64-bit fixed point number
* @param y signed 64.64-bit fixed point number
* @return signed 64.64-bit fixed point number
*/
function mul (int... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
<template>
<div class="wrapper">
<div class="mainWrapper">
<div class="arenaSignup">
<h1 class="title">
{{$t('pvp.arenaSignUp')}}
</h1>
<p>
{{$t('pvp.enterAndWin')}}
($SKILL).</p>
<div class="buttonsWrapper">
<div class="buttonWrapper">... | Just so you know, if you have boolean props you can just add it without anything iirc
so, instead of `:secondary="true"` you should be able to use `secondary` | <template>
<div class="wrapper">
<div class="mainWrapper">
<div class="arenaSignup">
<h1 class="title">
{{$t('pvp.arenaSignUp')}}
</h1>
<p>
{{$t('pvp.enterAndWin')}}
($SKILL).</p>
<div class="buttonsWrapper">
<div class="buttonWrapper">... | @@ -8,13 +8,22 @@
<p>
{{$t('pvp.enterAndWin')}}
($SKILL).</p>
- <div></div>
- <div class="buttonWrapper">
- <pvp-button
- class="pvpButton"
- @click="handleEnterArenaClick()"
- :buttonText="$t('pvp.enterArena')"
- />
+ ... | frontend/src/components/smart/PvPArenaSummary.vue | 24 | Vue | 0.571 | suggestion | 159 | 49 | 49 | false | Feat/pvp leave arena button | 1,150 | CryptoBlades/cryptoblades | 321 | Vue | Chriserus | Jcalcaldev | Review this pull request change.
Language: Vue
File: frontend/src/components/smart/PvPArenaSummary.vue
PR Title: Feat/pvp leave arena button
BEFORE CODE: <template>
<div class="wrapper">
<div class="mainWrapper">
<div class="arenaSignup">
<h1 class="title">
{{$t('pvp.arenaSignUp')}}
... | Just so you know, if you have boolean props you can just add it without anything iirc
so, instead of `:secondary="true"` you should be able to use `secondary` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
rank: null,
element: null,
}
},
activeWeaponWithInformation: {
default: {
weaponId: null,
information: {}
}
},
activeShieldWithInformation: {
default: {
shieldId: null,
information: {}
}
},
duelHistory: {
default... | By default loadings often are initialized to `false`, then on the action start, switched to `true`, after the action (often in `finally` block for actions that may fail) switched back to `false` again | rank: null,
element: null,
}
},
activeWeaponWithInformation: {
default: {
weaponId: null,
information: {}
}
},
activeShieldWithInformation: {
default: {
shieldId: null,
information: {}
}
},
duelHistory: {
default... | @@ -135,7 +145,10 @@ export default {
data() {
return {
tab: 0,
- dayjs
+ dayjs,
+ loading: true, | frontend/src/components/smart/PvPArenaSummary.vue | 26 | Vue | 0.571 | bug | 200 | 51 | 51 | false | Feat/pvp leave arena button | 1,150 | CryptoBlades/cryptoblades | 321 | Vue | Chriserus | Jcalcaldev | Review this pull request change.
Language: Vue
File: frontend/src/components/smart/PvPArenaSummary.vue
PR Title: Feat/pvp leave arena button
BEFORE CODE: rank: null,
element: null,
}
},
activeWeaponWithInformation: {
default: {
weaponId: null,
information: {}
... | By default loadings often are initialized to `false`, then on the action start, switched to `true`, after the action (often in `finally` block for actions that may fail) switched back to `false` again | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
return 'There has been an error. Try again.';
},
async handleEnterArenaClick() {
this.$emit('enterMatchMaking');
},
async leaveArena() {
this.loading = true;
if (this.isCharacterInDuelQueue) {
alert(i18n.t('pvp.currentlyInDuel'));
this.loading = false;
... | Error messages are not translated, is there a reason for that? same on line 173 | }
return this.$dialog.notify.error(i18n.t('pvp.genericError'));
},
async handleEnterArenaClick() {
this.$emit('enterMatchMaking');
},
async leaveArena() {
this.loading = true;
if (this.isCharacterInDuelQueue) {
alert(i18n.t('pvp.currentlyInDuel'));
this.l... | @@ -144,14 +157,61 @@ export default {
},
methods: {
+ ...mapActions([
+ 'withdrawFromArena',
+ 'getDuelQueue'
+ ]),
+
setTab(tabNumber) {
this.tab = tabNumber;
},
+ handleErrorMessage(value, errorMessage, returnedMessage) {
+ if (value.includes(`reverted with reason s... | frontend/src/components/smart/PvPArenaSummary.vue | 26 | Vue | 0.357 | suggestion | 79 | 51 | 51 | false | Feat/pvp leave arena button | 1,150 | CryptoBlades/cryptoblades | 321 | Vue | Chriserus | Jcalcaldev | Review this pull request change.
Language: Vue
File: frontend/src/components/smart/PvPArenaSummary.vue
PR Title: Feat/pvp leave arena button
BEFORE CODE: }
return 'There has been an error. Try again.';
},
async handleEnterArenaClick() {
this.$emit('enterMatchMaking');
},
async l... | Error messages are not translated, is there a reason for that? same on line 173 | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
async handleEnterArenaClick() {
this.$emit('enterMatchMaking');
},
async leaveArena() {
this.loading = true;
if (this.isCharacterInDuelQueue) {
alert(i18n.t('pvp.currentlyInDuel'));
this.loading = false;
return;
}
try {
await this.withdrawFro... | I would place it in `finally` block, just for the sake of keeping it tidy, also, not sure if this gets called on try fail |
async handleEnterArenaClick() {
this.$emit('enterMatchMaking');
},
async leaveArena() {
this.loading = true;
if (this.isCharacterInDuelQueue) {
alert(i18n.t('pvp.currentlyInDuel'));
this.loading = false;
return;
}
try {
await this.withdrawFro... | @@ -144,14 +157,61 @@ export default {
},
methods: {
+ ...mapActions([
+ 'withdrawFromArena',
+ 'getDuelQueue'
+ ]),
+
setTab(tabNumber) {
this.tab = tabNumber;
},
+ handleErrorMessage(value, errorMessage, returnedMessage) {
+ if (value.includes(`reverted with reason s... | frontend/src/components/smart/PvPArenaSummary.vue | 26 | Vue | 0.5 | bug | 121 | 51 | 51 | false | Feat/pvp leave arena button | 1,150 | CryptoBlades/cryptoblades | 321 | Vue | Chriserus | Jcalcaldev | Review this pull request change.
Language: Vue
File: frontend/src/components/smart/PvPArenaSummary.vue
PR Title: Feat/pvp leave arena button
BEFORE CODE:
async handleEnterArenaClick() {
this.$emit('enterMatchMaking');
},
async leaveArena() {
this.loading = true;
if (this.isCharacte... | I would place it in `finally` block, just for the sake of keeping it tidy, also, not sure if this gets called on try fail | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
} catch (err) {
console.log('leave arena error: ', err.message);
this.handleErrorMessage(err.message, 'Char not in arena', 'The character is not in the arena');
this.handleErrorMessage(err.message, 'Defender duel in process', 'Duel already in process');
}
this.loading = false... | Same as before. In this function there's no `try...catch...finally` block, please add | } catch (err) {
console.log('leave arena error: ', err.message);
this.handleErrorMessage(err.message, 'Char not in arena', i18n.t('pvp.charNotInArena'));
this.handleErrorMessage(err.message, 'Defender duel in process', i18n.t('pvp.duelInProcess'));
} finally {
this.loading =... | @@ -144,14 +157,61 @@ export default {
},
methods: {
+ ...mapActions([
+ 'withdrawFromArena',
+ 'getDuelQueue'
+ ]),
+
setTab(tabNumber) {
this.tab = tabNumber;
},
+ handleErrorMessage(value, errorMessage, returnedMessage) {
+ if (value.includes(`reverted with reason s... | frontend/src/components/smart/PvPArenaSummary.vue | 26 | Vue | 0.357 | suggestion | 85 | 51 | 51 | false | Feat/pvp leave arena button | 1,150 | CryptoBlades/cryptoblades | 321 | Vue | Chriserus | Jcalcaldev | Review this pull request change.
Language: Vue
File: frontend/src/components/smart/PvPArenaSummary.vue
PR Title: Feat/pvp leave arena button
BEFORE CODE: } catch (err) {
console.log('leave arena error: ', err.message);
this.handleErrorMessage(err.message, 'Char not in arena', 'The character ... | Same as before. In this function there's no `try...catch...finally` block, please add | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
isCharacterInArena[characterID] = false;
isWeaponInArena[weaponID] = false;
// setting characters, weapons and shield NFTVAR_BUSY to 0
characters.setNftVar(characterID, 1, 0);
weapons.setNftVar(weaponID, 1, 0);
}
function _getCharacterPowerRoll(Duelist memory character... | These weapon/shield multiplier values are 1-based, meaning the stats will add onto 1, not 0.
Since we will be adding the shield multiplier on top of the weapon, we need to counteract the base value of 1 to only add the stats, otherwise shields will still be too powerful (even a 1star shield with a single stat of 4 wou... | }
isCharacterInArena[characterID] = false;
isWeaponInArena[weaponID] = false;
// setting characters, weapons and shield NFTVAR_BUSY to 0
characters.setNftVar(characterID, 1, 0);
weapons.setNftVar(weaponID, 1, 0);
}
function _getCharacterPowerRoll(Duelist memory... | @@ -1009,7 +1010,8 @@ contract PvpArena is Initializable, AccessControlUpgradeable {
int128 bonusShieldStats;
if (fighter.useShield) {
- bonusShieldStats = _getShieldStats(character.ID);
+ // we set bonus shield stats as 0.2
+ bonusShieldStats = _getShieldStats(chara... | contracts/PvpArena.sol | 26 | Solidity | 0.643 | suggestion | 507 | 51 | 51 | false | Feat/pvp base100 formula update | 1,189 | CryptoBlades/cryptoblades | 321 | Vue | poshdan | Dvidaurre | Review this pull request change.
Language: Solidity
File: contracts/PvpArena.sol
PR Title: Feat/pvp base100 formula update
BEFORE CODE:
isCharacterInArena[characterID] = false;
isWeaponInArena[weaponID] = false;
// setting characters, weapons and shield NFTVAR_BUSY to 0
characters... | These weapon/shield multiplier values are 1-based, meaning the stats will add onto 1, not 0.
Since we will be adding the shield multiplier on top of the weapon, we need to counteract the base value of 1 to only add the stats, otherwise shields will still be too powerful (even a 1star shield with a single stat of 4 wou... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
bytes32 public constant GAME_ADMIN = keccak256("GAME_ADMIN");
mapping(uint256 => uint256) vars;
uint256 public constant VAR_SHARDS_REWARD = 1;
SpecialWeaponsManager public specialWeaponsManager;
mapping(address => mapping(uint256 => bool)) public userClaimedAtGiveaway;
mapping(uint256 => ... | We could move it to the migration file, but it's just one call, so it doesn't matter I guess | bytes32 public constant GAME_ADMIN = keccak256("GAME_ADMIN");
mapping(uint256 => uint256) vars;
uint256 public constant VAR_SHARDS_REWARD = 1;
SpecialWeaponsManager public specialWeaponsManager;
mapping(address => mapping(uint256 => bool)) public userClaimedAtGiveaway;
mapping(uint256 => ... | @@ -0,0 +1,87 @@
+pragma solidity ^0.6.2;
+
+import "@openzeppelin/contracts/math/SafeMath.sol";
+import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
+import "../SpecialWeaponsManager.sol";
+
+contract PartnerGiveaways is Initializable, AccessControlUpgradeable {
+ using SafeMath for uint256;
+ using ABDKM... | contracts/partner-giveaways/PartnerGiveaways.sol | 26 | Solidity | 0.286 | suggestion | 92 | 51 | 51 | false | Heco giveaway | 1,258 | CryptoBlades/cryptoblades | 321 | Vue | Chriserus | kcper | Review this pull request change.
Language: Solidity
File: contracts/partner-giveaways/PartnerGiveaways.sol
PR Title: Heco giveaway
BEFORE CODE: bytes32 public constant GAME_ADMIN = keccak256("GAME_ADMIN");
mapping(uint256 => uint256) vars;
uint256 public constant VAR_SHARDS_REWARD = 1;
Special... | We could move it to the migration file, but it's just one call, so it doesn't matter I guess | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
mapping(uint256 => uint256) vars;
uint256 public constant VAR_SHARDS_REWARD = 1;
SpecialWeaponsManager public specialWeaponsManager;
mapping(address => mapping(uint256 => bool)) public userClaimedAtGiveaway;
mapping(uint256 => mapping(uint256 => bool)) public nftClaimedAtGiveaway;
mappin... | Do we want to start with 0 here? (we usually start with 1, as 0 is the default value) If 0 is intentional, this assignment is redundant (as it's the default) |
mapping(uint256 => uint256) vars;
uint256 public constant VAR_SHARDS_REWARD = 1;
SpecialWeaponsManager public specialWeaponsManager;
mapping(address => mapping(uint256 => bool)) public userClaimedAtGiveaway;
mapping(uint256 => mapping(uint256 => bool)) public nftClaimedAtGiveaway;
mappin... | @@ -0,0 +1,87 @@
+pragma solidity ^0.6.2;
+
+import "@openzeppelin/contracts/math/SafeMath.sol";
+import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
+import "../SpecialWeaponsManager.sol";
+
+contract PartnerGiveaways is Initializable, AccessControlUpgradeable {
+ using SafeMath for uint256;
+ using ABDKM... | contracts/partner-giveaways/PartnerGiveaways.sol | 26 | Solidity | 0.357 | question | 157 | 51 | 51 | false | Heco giveaway | 1,258 | CryptoBlades/cryptoblades | 321 | Vue | Chriserus | kcper | Review this pull request change.
Language: Solidity
File: contracts/partner-giveaways/PartnerGiveaways.sol
PR Title: Heco giveaway
BEFORE CODE:
mapping(uint256 => uint256) vars;
uint256 public constant VAR_SHARDS_REWARD = 1;
SpecialWeaponsManager public specialWeaponsManager;
mapping(address ... | Do we want to start with 0 here? (we usually start with 1, as 0 is the default value) If 0 is intentional, this assignment is redundant (as it's the default) | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
function getTotalSkillOwnedBy(address wallet) public view returns (uint256) {
return inGameOnlyFunds[wallet] + getTokenRewardsFor(wallet) + skillToken.balanceOf(wallet);
}
function _getRewardsClaimTax(address playerAddress) internal view returns (int128) {
assert(_rewardsClaimTaxTimerStart[... | Maybe worth setting in wei cents and dividing by 100*10e18 to allow for more precise floor price updates (same for VAR_MIN_CHARACTER_FEE). |
function getTotalSkillOwnedBy(address wallet) public view returns (uint256) {
return inGameOnlyFunds[wallet] + getTokenRewardsFor(wallet) + skillToken.balanceOf(wallet);
}
function _getRewardsClaimTax(address playerAddress) internal view returns (int128) {
assert(_rewardsClaimTaxTimerStart... | @@ -998,4 +1020,28 @@ contract CryptoBlades is Initializable, AccessControlUpgradeable {
return _getRewardsClaimTax(msg.sender);
}
+ function getMintWeaponFee() public view returns (int128) {
+ int128 decrease = ABDKMath64x64.divu(block.timestamp.sub(vars[VAR_WEAPON_MINT_TIMESTAMP]).mul(vars[V... | contracts/cryptoblades.sol | 26 | Solidity | 0.357 | suggestion | 138 | 48 | 49 | false | Dynamic mint prices | 1,292 | CryptoBlades/cryptoblades | 321 | Vue | kcper | kcper | Review this pull request change.
Language: Solidity
File: contracts/cryptoblades.sol
PR Title: Dynamic mint prices
BEFORE CODE: function getTotalSkillOwnedBy(address wallet) public view returns (uint256) {
return inGameOnlyFunds[wallet] + getTokenRewardsFor(wallet) + skillToken.balanceOf(wallet);
}
... | Maybe worth setting in wei cents and dividing by 100*10e18 to allow for more precise floor price updates (same for VAR_MIN_CHARACTER_FEE). | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
function getTotalSkillOwnedBy(address wallet) public view returns (uint256) {
return inGameOnlyFunds[wallet] + getTokenRewardsFor(wallet) + skillToken.balanceOf(wallet);
}
function _getRewardsClaimTax(address playerAddress) internal view returns (int128) {
assert(_rewardsClaimTaxTime... | Should we have one VAR_MINT_FEE_DECREASE_SPEED for both Weapons and Characters? Maybe it's a good idea to split it into two vars to make it more flexible | return tokenRewards[wallet];
}
function getTotalSkillOwnedBy(address wallet) public view returns (uint256) {
return inGameOnlyFunds[wallet] + getTokenRewardsFor(wallet) + skillToken.balanceOf(wallet);
}
function _getRewardsClaimTax(address playerAddress) internal view returns (int128) ... | @@ -998,4 +1020,28 @@ contract CryptoBlades is Initializable, AccessControlUpgradeable {
return _getRewardsClaimTax(msg.sender);
}
+ function getMintWeaponFee() public view returns (int128) {
+ int128 decrease = ABDKMath64x64.divu(block.timestamp.sub(vars[VAR_WEAPON_MINT_TIMESTAMP]).mul(vars[V... | contracts/cryptoblades.sol | 26 | Solidity | 0.429 | question | 153 | 50 | 51 | false | Dynamic mint prices | 1,292 | CryptoBlades/cryptoblades | 321 | Vue | Chriserus | kcper | Review this pull request change.
Language: Solidity
File: contracts/cryptoblades.sol
PR Title: Dynamic mint prices
BEFORE CODE: }
function getTotalSkillOwnedBy(address wallet) public view returns (uint256) {
return inGameOnlyFunds[wallet] + getTokenRewardsFor(wallet) + skillToken.balanceOf(wallet);... | Should we have one VAR_MINT_FEE_DECREASE_SPEED for both Weapons and Characters? Maybe it's a good idea to split it into two vars to make it more flexible | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
localStorage.setItem('currentChain', paramChain);
await this.configureMetaMask(+getConfigValue('VUE_APP_NETWORK_ID'));
}
this.updateCurrentChainSupportsMerchandise();
this.updateCurrentChainSupportsPvP();
this.updateCurrentChainSupportsQuests();
},
async updateCharacterSt... | We do not want two different size sidebars. Choose one size for all. I think you want the top one as default | if(currentChain === paramChain || !paramChain){
localStorage.setItem('currentChain', currentChain);
addChainToRouter(currentChain);
}
//set chain in localStorage & MM from query param; check if supported
else if (currentChain !== paramChain && supportedChains.includes(paramChain... | @@ -229,7 +231,11 @@ export default {
if(this.toggleSideBar){
toDisplay = 'can-show-app';
}else{
- toDisplay = 'col-xl-9 col-lg-8 col-md-8 col-sm-10 cols-11 set-normal';
+ if(this.currentPath === '/blacksmith'){
+ toDisplay = 'col-xl-10 col-lg-9 col-md-9 col-sm-... | frontend/src/App.vue | 26 | Vue | 0.357 | suggestion | 108 | 51 | 51 | false | New game UI blacksmith sidebar | 1,310 | CryptoBlades/cryptoblades | 321 | Vue | Sellie96 | Spintacle123 | Review this pull request change.
Language: Vue
File: frontend/src/App.vue
PR Title: New game UI blacksmith sidebar
BEFORE CODE: localStorage.setItem('currentChain', paramChain);
await this.configureMetaMask(+getConfigValue('VUE_APP_NETWORK_ID'));
}
this.updateCurrentChainSupportsMerchand... | We do not want two different size sidebars. Choose one size for all. I think you want the top one as default | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
</div>
</div>
<div class="element-frame-active">
<div>
<span
:id="`${setIdForElement(c.trait, c.isSelected)}`"
/>
</div>
... | s is too verbose can you make it clear what you are looping on at a glance it is not clear what it is. | </div>
</div>
<div class="element-frame-active">
<div>
<span
:id="`${setIdForElement(c.trait, c.isSelected)}`"
/>
</div>
... | @@ -4,41 +4,69 @@
<div class="btn-trigger" @click="hideSideBar(!toggled)">
<img :class="!toggled ? 'rotateLeft' : 'rotateRight'" src="../../assets/left-arrow.png" alt="">
</div>
- <b-col class="character-list"
+ <b-col class="character-list" v-if="currentPath != '/bl... | frontend/src/components/smart/CharacterDisplay.vue | 26 | Vue | 0.357 | suggestion | 102 | 51 | 51 | false | New game UI blacksmith sidebar | 1,310 | CryptoBlades/cryptoblades | 321 | Vue | Sellie96 | Spintacle123 | Review this pull request change.
Language: Vue
File: frontend/src/components/smart/CharacterDisplay.vue
PR Title: New game UI blacksmith sidebar
BEFORE CODE: </div>
</div>
<div class="element-frame-active">
<div>
... | s is too verbose can you make it clear what you are looping on at a glance it is not clear what it is. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
<template>
<div>
<div v-if="!hidden" class="banner">
<span class="text">{{text}}</span>
<a :href="link" class="link" target="_blank" rel="noopener noreferrer">
<button class="button" @click="hidden=true">{{linkText}}</button>
</a>
<svg @click="hidden=true" class="closeBtn... | I'm not sure what are the requirements in this task, but are we sure we want it always showing, even after user dismisses it (on component rerender, so, coming to the site for the second time), seems a bit aggressive. We could store the hidden in localStorage and save that user dismissed it, but as I mentioned before, ... | <template>
<div>
<div v-if="!hidden" class="banner">
<span class="text">{{text}}</span>
<a :href="link" class="link" target="_blank" rel="noopener noreferrer">
<button class="button">{{linkText}}</button>
</a>
<svg @click="hide" class="closeBtn" width="27.667" height="27.... | @@ -0,0 +1,103 @@
+<template>
+ <div>
+ <div v-if="!hidden" class="banner">
+ <span class="text">{{text}}</span>
+ <a :href="link" class="link" target="_blank" rel="noopener noreferrer">
+ <button class="button" @click="hidden=true">{{linkText}}</button>
+ </a>
+ <svg @click="hi... | frontend/src/components/Banner.vue | 8 | Vue | 0.5 | suggestion | 364 | 33 | 33 | false | +promo banner | 1,329 | CryptoBlades/cryptoblades | 321 | Vue | Chriserus | kevinunger | Review this pull request change.
Language: Vue
File: frontend/src/components/Banner.vue
PR Title: +promo banner
BEFORE CODE: <template>
<div>
<div v-if="!hidden" class="banner">
<span class="text">{{text}}</span>
<a :href="link" class="link" target="_blank" rel="noopener noreferrer">
... | I'm not sure what are the requirements in this task, but are we sure we want it always showing, even after user dismisses it (on component rerender, so, coming to the site for the second time), seems a bit aggressive. We could store the hidden in localStorage and save that user dismissed it, but as I mentioned before, ... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
uint16 xp = getXpGainForFight(playerFightPower, targetPower) * fightMultiplier;
uint256 tokens = getTokenGainForFight(targetPower, true) * fightMultiplier;
if (playerRoll < monsterRoll) {
tokens = 0;
xp = 0;
}
if(tokenRewards[tx.origin] == 0 && tokens >... | Additional 2 external calls here, that's a lot of gas increase.
BasicPriceOracle is not currently working and skill price is fixed at $62.
How about we track skill price (also update with a bot) in TokensPrices and get the price ratio with one external call to use here, like
```
return (tokens.mul(combatTokenCharge... | if (playerRoll < monsterRoll) {
tokens = 0;
xp = 0;
}
// this may seem dumb but we want to avoid guessing the outcome based on gas estimates!
tokenRewards[tx.origin] += tokens;
vars[VAR_UNCLAIMED_SKILL] += tokens;
vars[VAR_HOURLY_DISTRIBUTION] -= ... | @@ -343,25 +351,29 @@ contract CryptoBlades is Initializable, AccessControlUpgradeable {
uint16 xp = getXpGainForFight(playerFightPower, targetPower) * fightMultiplier;
uint256 tokens = getTokenGainForFight(targetPower, true) * fightMultiplier;
- if(playerRoll < monsterRoll) {
+
+ if (... | contracts/cryptoblades.sol | 26 | Solidity | 0.857 | suggestion | 382 | 51 | 51 | false | Charge native token fee on combat | 1,349 | CryptoBlades/cryptoblades | 321 | Vue | kcper | Jcalcaldev | Review this pull request change.
Language: Solidity
File: contracts/cryptoblades.sol
PR Title: Charge native token fee on combat
BEFORE CODE: uint16 xp = getXpGainForFight(playerFightPower, targetPower) * fightMultiplier;
uint256 tokens = getTokenGainForFight(targetPower, true) * fightMultiplier;
... | Additional 2 external calls here, that's a lot of gas increase.
BasicPriceOracle is not currently working and skill price is fixed at $62.
How about we track skill price (also update with a bot) in TokensPrices and get the price ratio with one external call to use here, like
```
return (tokens.mul(combatTokenCharge... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
const linkToken = '0x84b9B910527Ad5C03A9Ca831909E21e236EA7b06';
const vrfCoordinator = '0xa555fC018435bef5A13C6c6870a9d4C11DEC329C';
const keyHash = '0xcaf3c3727e033261d383b315559476f48034c13b18f8cafed4d871abe5049186';
const fee = web3.utils.toWei('0.1', 'ether');
await deployer.deploy(ChainlinkRan... | This will be used again when deploying to new networks so the reason provided here is not valid, I think it should be limited to development deployments only. | const vrfCoordinator = '0xa555fC018435bef5A13C6c6870a9d4C11DEC329C';
const keyHash = '0xcaf3c3727e033261d383b315559476f48034c13b18f8cafed4d871abe5049186';
const fee = web3.utils.toWei('0.1', 'ether');
await deployer.deploy(ChainlinkRandoms, vrfCoordinator, linkToken, keyHash, fee);
randoms = await ... | @@ -46,6 +47,14 @@ module.exports = async function (deployer, network) {
const priceOracle = await deployProxy(BasicPriceOracle, [], { deployer });
+ // === This is for development, migration already deployed in other networks === | migrations/8_main_game.js | 26 | JavaScript | 0.429 | suggestion | 158 | 51 | 47 | false | Charge native token fee on combat | 1,349 | CryptoBlades/cryptoblades | 321 | Vue | kcper | Jcalcaldev | Review this pull request change.
Language: JavaScript
File: migrations/8_main_game.js
PR Title: Charge native token fee on combat
BEFORE CODE: const linkToken = '0x84b9B910527Ad5C03A9Ca831909E21e236EA7b06';
const vrfCoordinator = '0xa555fC018435bef5A13C6c6870a9d4C11DEC329C';
const keyHash = '0xcaf3c3727... | This will be used again when deploying to new networks so the reason provided here is not valid, I think it should be limited to development deployments only. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
const { upgradeProxy } = require("@openzeppelin/truffle-upgrades");
const CryptoBlades = artifacts.require("CryptoBlades");
module.exports = async function (deployer, network) {
if (network === "development"
|| network === "development-fork"
|| network === 'bsctestnet'
|| network === 'bsctestnet-fork'
... | Migration 163 won't work, because game contract needs upgrading before `setTokensPricesAddress` can be called.
We should have this upgrade in migration 163. | const { upgradeProxy } = require("@openzeppelin/truffle-upgrades");
const CryptoBlades = artifacts.require("CryptoBlades");
const TokensManager = artifacts.require("TokensManager");
module.exports = async function (deployer, network) {
if (network === "development"
|| network === "development-fork"
|| netw... | @@ -0,0 +1,16 @@
+const { upgradeProxy } = require("@openzeppelin/truffle-upgrades"); | migrations/164_cb_upgrade.js | 1 | JavaScript | 0.571 | suggestion | 157 | 16 | 21 | false | Charge native token fee on combat | 1,349 | CryptoBlades/cryptoblades | 321 | Vue | kcper | Jcalcaldev | Review this pull request change.
Language: JavaScript
File: migrations/164_cb_upgrade.js
PR Title: Charge native token fee on combat
BEFORE CODE: const { upgradeProxy } = require("@openzeppelin/truffle-upgrades");
const CryptoBlades = artifacts.require("CryptoBlades");
module.exports = async function (deployer, ne... | Migration 163 won't work, because game contract needs upgrading before `setTokensPricesAddress` can be called.
We should have this upgrade in migration 163. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
if(!CryptoBlades || !state.defaultAccount) return;
return CryptoBlades.methods.getMintWeaponFee().call(defaultCallOptions(state));
},
async fetchMintCharacterFee({state}) {
const { CryptoBlades } = state.contracts();
if(!CryptoBlades || !state.defaultAccount) return;
... | Return immediately, no need to assign variable | import Vue from 'vue';
import Vuex from 'vuex';
import Web3 from 'web3';
import _, {isUndefined, values} from 'lodash';
import {bnMinimum, currentChainSupportsMerchandise, currentChainSupportsPvP, currentChainSupportsQuests, gasUsedToBnb, toBN} from '@/utils/common';
import {getConfigValue, setUpContracts} from '@/con... | @@ -4727,6 +4727,103 @@ export function createStore(web3: Web3) {
return CryptoBlades.methods.getMintCharacterFee().call(defaultCallOptions(state));
},
+
+ async getCurrentSkillPrice({ state }) {
+ const { BasicPriceOracle } = state.contracts();
+ if (!BasicPriceOracle || !state.def... | frontend/src/store/store.ts | 26 | TypeScript | 0.071 | suggestion | 46 | 51 | 4,397 | false | Charge native token fee on combat | 1,349 | CryptoBlades/cryptoblades | 321 | Vue | Chriserus | Jcalcaldev | Review this pull request change.
Language: TypeScript
File: frontend/src/store/store.ts
PR Title: Charge native token fee on combat
BEFORE CODE: if(!CryptoBlades || !state.defaultAccount) return;
return CryptoBlades.methods.getMintWeaponFee().call(defaultCallOptions(state));
},
async f... | Return immediately, no need to assign variable | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
uint24(charTrait | (uint24(weaponTrait) << 8) | (target & 0xFF000000) >> 8),
uint24(target & 0xFFFFFF),
fightMultiplier
);
return offset;
}
function performFight(
uint256 char,
uint256 wep,
uint24 playerFightPower,
uint24 trai... | Still 2 external calls here. You can make it only one by creating a function in tokensPrices that will return skillTokenPrice()/tokenPrice() ratio. | function performFight(
uint256 char,
uint256 wep,
uint24 playerFightPower,
uint24 traitsCWE, // could fit into uint8 since each trait is only stored on 2 bits (TODO)
uint24 targetPower,
uint8 fightMultiplier
) private returns (uint256 tokens, uint256 expectedToken... | @@ -343,25 +351,29 @@ contract CryptoBlades is Initializable, AccessControlUpgradeable {
uint16 xp = getXpGainForFight(playerFightPower, targetPower) * fightMultiplier;
uint256 tokens = getTokenGainForFight(targetPower, true) * fightMultiplier;
- if(playerRoll < monsterRoll) {
+ uint25... | contracts/cryptoblades.sol | 26 | Solidity | 0.357 | suggestion | 147 | 51 | 51 | false | Charge native token fee on combat | 1,349 | CryptoBlades/cryptoblades | 321 | Vue | kcper | Jcalcaldev | Review this pull request change.
Language: Solidity
File: contracts/cryptoblades.sol
PR Title: Charge native token fee on combat
BEFORE CODE: uint24(charTrait | (uint24(weaponTrait) << 8) | (target & 0xFF000000) >> 8),
uint24(target & 0xFFFFFF),
fightMultiplier
);
... | Still 2 external calls here. You can make it only one by creating a function in tokensPrices that will return skillTokenPrice()/tokenPrice() ratio. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
function getSkillNeededFromUserWallet(address playerAddress, uint256 skillNeeded, bool allowInGameOnlyFunds)
public
view
returns (uint256 skillNeededFromUserWallet) {
uint256 inGameOnlyFundsToUse = 0;
if (allowInGameOnlyFunds) {
inGameOnlyFundsToUse = inGameOnlyF... | the onlyNonContract modifier no longer makes sense here and users can bypass the fee by just calling this method directly. Should be a restricted check instead | if (allowInGameOnlyFunds) {
inGameOnlyFundsToUse = inGameOnlyFunds[playerAddress];
}
(,, skillNeededFromUserWallet) = getSkillToSubtract(
inGameOnlyFundsToUse,
tokenRewards[playerAddress],
skillNeeded
);
}
function unpackFightData(... | @@ -296,17 +302,17 @@ contract CryptoBlades is Initializable, AccessControlUpgradeable {
}
function fight(uint256 char, uint256 wep, uint32 target, uint8 fightMultiplier) external
- onlyNonContract() {
+ onlyNonContract() returns (uint256) { | contracts/cryptoblades.sol | 26 | Solidity | 0.429 | suggestion | 159 | 51 | 51 | false | Charge native token fee on combat | 1,349 | CryptoBlades/cryptoblades | 321 | Vue | poshdan | Jcalcaldev | Review this pull request change.
Language: Solidity
File: contracts/cryptoblades.sol
PR Title: Charge native token fee on combat
BEFORE CODE: function getSkillNeededFromUserWallet(address playerAddress, uint256 skillNeeded, bool allowInGameOnlyFunds)
public
view
returns (uint256 skillNee... | the onlyNonContract modifier no longer makes sense here and users can bypass the fee by just calling this method directly. Should be a restricted check instead | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
target = grabTarget(
Common.getPlayerPower(basePowerLevel, weaponMultTarget, weaponBonusPower),
timestamp,
target,
now / 1 hours
);
uint256 offset = performFight(
char,
wep,
Common.getPlayerPower(basePowerLevel, ... | What if we returned the tokens value instead of the offset and did the math on the tokensReceiver end?
This would allow to offload the entire contract size impact
You'd do
private returns (uint256 wouldBeTokens) {
and then after tokens is initialized:
wouldBeTokens = tokens,
No return statement necessary at t... | return performFight(
char,
wep,
Common.getPlayerPower(basePowerLevel, weaponMultFight, weaponBonusPower),
uint24(charTrait | (uint24(weaponTrait) << 8) | (target & 0xFF000000) >> 8),
uint24(target & 0xFFFFFF),
fightMultiplier
);
... | @@ -333,8 +341,8 @@ contract CryptoBlades is Initializable, AccessControlUpgradeable {
uint24 traitsCWE, // could fit into uint8 since each trait is only stored on 2 bits (TODO)
uint24 targetPower,
uint8 fightMultiplier
- ) private {
- uint256 seed = uint256(keccak256(abi.encodePack... | contracts/cryptoblades.sol | 26 | Solidity | 0.5 | question | 460 | 51 | 51 | false | Charge native token fee on combat | 1,349 | CryptoBlades/cryptoblades | 321 | Vue | poshdan | Jcalcaldev | Review this pull request change.
Language: Solidity
File: contracts/cryptoblades.sol
PR Title: Charge native token fee on combat
BEFORE CODE: target = grabTarget(
Common.getPlayerPower(basePowerLevel, weaponMultTarget, weaponBonusPower),
timestamp,
target,
now... | What if we returned the tokens value instead of the offset and did the math on the tokensReceiver end?
This would allow to offload the entire contract size impact
You'd do
private returns (uint256 wouldBeTokens) {
and then after tokens is initialized:
wouldBeTokens = tokens,
No return statement necessary at t... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
uint256 expectedTokens = game.fight(char, wep, target, fightMultiplier);
uint256 offset = ABDKMath64x64.mulu(getSkillToNativeRatio(), expectedTokens.mul(combatTokenChargePercent));
require(msg.value == offset, 'Offset error');
}
function retrieve(address addressToTransferTo, uint256 a... | A little sidebar here, not necessary to change anything now but, for the future:
The bot that updates the native token and skill token prices might want to send updates for both at once, in which case it would make sense for a function that takes parameters for both. This is only really relevant for cutting costs on e... | }
function fight(uint256 char, uint256 wep, uint32 target, uint8 fightMultiplier) external payable {
(uint256 tokens, uint256 expectedTokens) = game.fight(char, wep, target, fightMultiplier);
uint256 offset = ABDKMath64x64.mulu(getSkillToNativeRatio(), expectedTokens.mul(combatTokenChargePerce... | @@ -0,0 +1,67 @@
+pragma solidity ^0.6.0;
+import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
+import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
+import "@openzeppelin/contracts/math/SafeMath.sol";
+import "abdk-libraries-solidity/ABDKMath64x64.sol";
+import "./cryptob... | contracts/TokensManager.sol | 26 | Solidity | 0.5 | performance | 411 | 27 | 34 | false | Charge native token fee on combat | 1,349 | CryptoBlades/cryptoblades | 321 | Vue | poshdan | Jcalcaldev | Review this pull request change.
Language: Solidity
File: contracts/TokensManager.sol
PR Title: Charge native token fee on combat
BEFORE CODE: uint256 expectedTokens = game.fight(char, wep, target, fightMultiplier);
uint256 offset = ABDKMath64x64.mulu(getSkillToNativeRatio(), expectedTokens.mul(com... | A little sidebar here, not necessary to change anything now but, for the future:
The bot that updates the native token and skill token prices might want to send updates for both at once, in which case it would make sense for a function that takes parameters for both. This is only really relevant for cutting costs on e... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
basePowerLevel = uint24((playerData >> 8) & 0xFFFFFF);
timestamp = uint64((playerData >> 32) & 0xFFFFFFFFFFFFFFFF);
}
function fight(uint256 char, uint256 wep, uint32 target, uint8 fightMultiplier) external
restricted returns (uint256) {
require(fightMultiplier >= 1 && fightMult... | technically you could put the return clause here without the need for a variable initialization but this is fine too | basePowerLevel = uint24((playerData >> 8) & 0xFFFFFF);
timestamp = uint64((playerData >> 32) & 0xFFFFFFFFFFFFFFFF);
}
function fight(uint256 char, uint256 wep, uint32 target, uint8 fightMultiplier) external
restricted returns (uint256, uint256) {
require(fightMultiplier >= 1 && ... | @@ -322,7 +316,7 @@ contract CryptoBlades is Initializable, AccessControlUpgradeable {
target,
now / 1 hours
);
- uint256 offset = performFight(
+ uint256 expectedTokens = performFight( | contracts/cryptoblades.sol | 26 | Solidity | 0.429 | suggestion | 116 | 51 | 51 | false | Charge native token fee on combat | 1,349 | CryptoBlades/cryptoblades | 321 | Vue | poshdan | Jcalcaldev | Review this pull request change.
Language: Solidity
File: contracts/cryptoblades.sol
PR Title: Charge native token fee on combat
BEFORE CODE: basePowerLevel = uint24((playerData >> 8) & 0xFFFFFF);
timestamp = uint64((playerData >> 32) & 0xFFFFFFFFFFFFFFFF);
}
function fight(uint256 char, ui... | technically you could put the return clause here without the need for a variable initialization but this is fine too | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
}
function setTiersAllocationWeights(uint256[] calldata tierIds, uint256[] calldata tierWeights) external restricted {
require(tierIds.length <= vars[VAR_TIERS_AMOUNT], "Too many tiers");
require(tierIds.length == tierWeights.length, "Wrong input");
for (uint256 i = 0; i < tie... | Please add a check to validate second phase still not launched |
// PROJECT DETAILS
function addNewLaunch(
string calldata name,
string calldata tokenSymbol,
string calldata detailsJsonUri,
string calldata imageUrl,
address fundingTokenAddress
) external restricted {
launches[nextLaunchId] = Launch(
name,
... | @@ -0,0 +1,492 @@
+pragma solidity ^0.6.2;
+
+import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
+import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
+import "@openzeppelin/contracts/utils/EnumerableSet.sol";
+import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
+imp... | contracts/Launchpad.sol | 26 | Solidity | 0.214 | suggestion | 62 | 51 | 51 | false | Cb launchpad | 1,362 | CryptoBlades/cryptoblades | 321 | Vue | bilbolPrime | kcper | Review this pull request change.
Language: Solidity
File: contracts/Launchpad.sol
PR Title: Cb launchpad
BEFORE CODE: }
}
function setTiersAllocationWeights(uint256[] calldata tierIds, uint256[] calldata tierWeights) external restricted {
require(tierIds.length <= vars[VAR_TIERS_AMOUNT], "T... | Please add a check to validate second phase still not launched | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
_;
}
function _isTokenAddressSet(uint256 launchId) internal view {
require(launchTokenAddress[launchId] != address(0), "Token address not set");
}
// VIEWS
function getTierForStakedAmount(uint256 amount) public view returns (uint256 tier) {
for (uint256 i = 1; i <= vars[VA... | Wouldn't hurt to validate launch id > 0 and < next launch unless there's no merit in the check | _isTokenAddressSet(launchId);
_;
}
function _isTokenAddressSet(uint256 launchId) internal view {
require(launchTokenAddress[launchId] != address(0), "Token address not set");
}
// VIEWS
function getTierForStakedAmount(uint256 amount) public view returns (uint256 tier) {
... | @@ -0,0 +1,492 @@
+pragma solidity ^0.6.2;
+
+import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
+import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
+import "@openzeppelin/contracts/utils/EnumerableSet.sol";
+import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
+imp... | contracts/Launchpad.sol | 26 | Solidity | 0.214 | suggestion | 95 | 51 | 51 | false | Cb launchpad | 1,362 | CryptoBlades/cryptoblades | 321 | Vue | bilbolPrime | kcper | Review this pull request change.
Language: Solidity
File: contracts/Launchpad.sol
PR Title: Cb launchpad
BEFORE CODE: _;
}
function _isTokenAddressSet(uint256 launchId) internal view {
require(launchTokenAddress[launchId] != address(0), "Token address not set");
}
// VIEWS
fun... | Wouldn't hurt to validate launch id > 0 and < next launch unless there's no merit in the check | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
);
emit LaunchAdded(nextLaunchId, 1);
// nextLaunchId + 1 is reserved for Phase 2s
nextLaunchId += 2;
}
function addSecondPhaseForLaunch(uint256 launchId, uint256 startTime) external onlyPhase1(launchId) restricted {
Launch memory lp = launches[launchId];
requir... | There is no check that the launch id is valid (> 0 < next launch) but should be fine as these are dev only and data can be removed if set incorrectly | require(block.timestamp > launchStartTime[launchId] + vars[VAR_FUNDING_PERIOD_PHASE_1], "Phase 1 not finished");
require(launchFundsToRaise[launchId].sub(launchTotalRaised[launchId]) > 0, "Tokens sold out");
launches[launchId + 1] = Launch(
lp.name,
lp.tokenSymbol,
... | @@ -0,0 +1,492 @@
+pragma solidity ^0.6.2;
+
+import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
+import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
+import "@openzeppelin/contracts/utils/EnumerableSet.sol";
+import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
+imp... | contracts/Launchpad.sol | 26 | Solidity | 0.429 | bug | 149 | 51 | 51 | false | Cb launchpad | 1,362 | CryptoBlades/cryptoblades | 321 | Vue | bilbolPrime | kcper | Review this pull request change.
Language: Solidity
File: contracts/Launchpad.sol
PR Title: Cb launchpad
BEFORE CODE: );
emit LaunchAdded(nextLaunchId, 1);
// nextLaunchId + 1 is reserved for Phase 2s
nextLaunchId += 2;
}
function addSecondPhaseForLaunch(uint256 launchId, u... | There is no check that the launch id is valid (> 0 < next launch) but should be fine as these are dev only and data can be removed if set incorrectly | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
uint256 decimals = ERC20(launchTokenAddress[launchId]).decimals();
if(decimals > 18) {
contractBalance = contractBalance.mul(10**uint(decimals - 18));
} else {
contractBalance = contractBalance.div(10**uint(18 - decimals));
}
require(contractBalance >=
... | No check if user length is 0 (which leads to total weight 0).
Also what happens if all staked amounts have "0 tier"? shouldn't we reject certain amounts? | }
function enableLinearVesting(uint256 launchId, uint256 duration) external onlyPhase1(launchId) isTokenAddressSet(launchId) restricted {
require(duration > 0);
require(launchPeriodicVestingsPercentages[launchId].length == 0, "Periodic vesting enabled");
uint256 totalLaunchRaised = laun... | @@ -0,0 +1,492 @@
+pragma solidity ^0.6.2;
+
+import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
+import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
+import "@openzeppelin/contracts/utils/EnumerableSet.sol";
+import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
+imp... | contracts/Launchpad.sol | 26 | Solidity | 0.429 | question | 154 | 51 | 51 | false | Cb launchpad | 1,362 | CryptoBlades/cryptoblades | 321 | Vue | bilbolPrime | kcper | Review this pull request change.
Language: Solidity
File: contracts/Launchpad.sol
PR Title: Cb launchpad
BEFORE CODE: uint256 decimals = ERC20(launchTokenAddress[launchId]).decimals();
if(decimals > 18) {
contractBalance = contractBalance.mul(10**uint(decimals - 18));
} else {
... | No check if user length is 0 (which leads to total weight 0).
Also what happens if all staked amounts have "0 tier"? shouldn't we reject certain amounts? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
launchBaseAllocation[launchId] = launchFundsToRaise[launchId].div(totalWeight);
}
// WITHDRAW RAISED FUNDS
function withdrawRaisedFunds(uint256 launchId) external onlyPhase1(launchId) {
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Not owner");
require(
block.timest... | shouldn't the second one be block.timestamp < launchStartTime[launchId + 1]? | emit FundsWithdrawn(launchId, raisedFunds);
}
// VARS SETTERS
function setVar(uint256 varField, uint256 value) external restricted {
vars[varField] = value;
}
function setVars(uint256[] calldata varFields, uint256[] calldata values) external restricted {
for (uint256 i = 0... | @@ -0,0 +1,492 @@
+pragma solidity ^0.6.2;
+
+import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
+import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
+import "@openzeppelin/contracts/utils/EnumerableSet.sol";
+import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
+imp... | contracts/Launchpad.sol | 26 | Solidity | 0.286 | question | 76 | 51 | 51 | false | Cb launchpad | 1,362 | CryptoBlades/cryptoblades | 321 | Vue | bilbolPrime | kcper | Review this pull request change.
Language: Solidity
File: contracts/Launchpad.sol
PR Title: Cb launchpad
BEFORE CODE: launchBaseAllocation[launchId] = launchFundsToRaise[launchId].div(totalWeight);
}
// WITHDRAW RAISED FUNDS
function withdrawRaisedFunds(uint256 launchId) external onlyPhase1(la... | shouldn't the second one be block.timestamp < launchStartTime[launchId + 1]? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
require(duration > 0);
require(launchPeriodicVestingsPercentages[launchId].length == 0, "Periodic vesting enabled");
uint256 totalLaunchRaised = launchTotalRaised[launchId].add(launchTotalRaised[launchId + 1]);
uint256 contractBalance = IERC20(launchTokenAddress[launchId]).balanceOf(addr... | This needs to be assigned with `launchFundsToRaise[launchId].div(launchBaseAllocation[launchId])` to allow for calling this function in batches. I think thousands of entries per array in arguments can hit the gas limits. | }
// WHITELISTING
function setEligibleUsersData(uint256 launchId, address[] calldata users, uint256[] calldata stakedAmounts) external onlyPhase1(launchId) restricted {
require(nextLaunchId >= launchId, "Wrong ID");
require(users.length > 0 && users.length == stakedAmounts.length, "Bad inp... | @@ -0,0 +1,492 @@
+pragma solidity ^0.6.2;
+
+import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
+import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
+import "@openzeppelin/contracts/utils/EnumerableSet.sol";
+import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
+imp... | contracts/Launchpad.sol | 26 | Solidity | 0.571 | performance | 220 | 51 | 51 | false | Cb launchpad | 1,362 | CryptoBlades/cryptoblades | 321 | Vue | kcper | kcper | Review this pull request change.
Language: Solidity
File: contracts/Launchpad.sol
PR Title: Cb launchpad
BEFORE CODE: require(duration > 0);
require(launchPeriodicVestingsPercentages[launchId].length == 0, "Periodic vesting enabled");
uint256 totalLaunchRaised = launchTotalRaised[launchId].a... | This needs to be assigned with `launchFundsToRaise[launchId].div(launchBaseAllocation[launchId])` to allow for calling this function in batches. I think thousands of entries per array in arguments can hit the gas limits. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
launchTokenPrice[launchId] = tokenPrice;
}
function updateLaunchStartTime(uint256 launchId, uint256 startTime) external restricted {
require(launchTokenPrice[launchId] != 0 && launchFundsToRaise[launchId] != 0, "Set token price and funds to raise first");
launchStartTime[launchId] = sta... | Seems similar to the method you did in common.sol, maybe we can use it here as well? | }
function updateLaunchTokenAddress(uint256 launchId, address tokenAddress) external onlyPhase1(launchId) restricted {
launchTokenAddress[launchId] = tokenAddress;
launchTokenAddress[launchId + 1] = tokenAddress;
}
// VESTING
function enablePeriodicVesting(uint256 launchId, uint25... | @@ -0,0 +1,492 @@
+pragma solidity ^0.6.2;
+
+import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
+import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
+import "@openzeppelin/contracts/utils/EnumerableSet.sol";
+import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
+imp... | contracts/Launchpad.sol | 26 | Solidity | 0.286 | question | 84 | 51 | 51 | false | Cb launchpad | 1,362 | CryptoBlades/cryptoblades | 321 | Vue | Chriserus | kcper | Review this pull request change.
Language: Solidity
File: contracts/Launchpad.sol
PR Title: Cb launchpad
BEFORE CODE: launchTokenPrice[launchId] = tokenPrice;
}
function updateLaunchStartTime(uint256 launchId, uint256 startTime) external restricted {
require(launchTokenPrice[launchId] != 0 ... | Seems similar to the method you did in common.sol, maybe we can use it here as well? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
else {
maxAllocation = getLaunchAllocationForTier(launchId, getTierForStakedAmount(launchUserStakedAmountSnapshot[launchId][user]));
}
maxAllocation += launchUserUnclaimedSkillCommittedValue[launchId][user].mul(vars[VAR_UNCLAIMED_TO_ALLOCATION_MULTIPLIER]);
maxAllocation = ma... | I believe the launches mapping can be queried directly to return the struct as an array of values.
This can save contract space if needed, but there is no reason to change this otherwise (i think)
Example with quests struct:
frontend/src/store/quests/index.ts line 47
https://github.com/CryptoBlades/cryptoblades/b... | }
else {
maxAllocation = getLaunchAllocationForTier(launchId, getTierForStakedAmount(launchUserStakedAmountSnapshot[launchId][user]));
}
maxAllocation += launchUserUnclaimedSkillCommittedValue[launchId][user].mul(vars[VAR_UNCLAIMED_TO_ALLOCATION_MULTIPLIER]);
maxAlloc... | @@ -0,0 +1,492 @@
+pragma solidity ^0.6.2;
+
+import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
+import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
+import "@openzeppelin/contracts/utils/EnumerableSet.sol";
+import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
+imp... | contracts/Launchpad.sol | 26 | Solidity | 0.5 | suggestion | 502 | 51 | 51 | false | Cb launchpad | 1,362 | CryptoBlades/cryptoblades | 321 | Vue | poshdan | kcper | Review this pull request change.
Language: Solidity
File: contracts/Launchpad.sol
PR Title: Cb launchpad
BEFORE CODE: else {
maxAllocation = getLaunchAllocationForTier(launchId, getTierForStakedAmount(launchUserStakedAmountSnapshot[launchId][user]));
}
maxAllocation += launchUser... | I believe the launches mapping can be queried directly to return the struct as an array of values.
This can save contract space if needed, but there is no reason to change this otherwise (i think)
Example with quests struct:
frontend/src/store/quests/index.ts line 47
https://github.com/CryptoBlades/cryptoblades/b... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
const Raid1 = new web3.eth.Contract(raidAbi as Abi, raidContractAddr);
raidContracts.Raid1 = Raid1;
raidTrinketAddress = (raidTrinketNetworks as Networks)[networkId]!.address;
keyboxAddress = (keyboxNetworks as Networks)[networkId]!.address;
junkAddress = (junkNetworks as Networks)[networkId]!.addr... | This if is checking if partnerVault property is in SimpleQuests contract in order to get the address from there. Now it's not needed I think | const Raid1 = new web3.eth.Contract(raidAbi as Abi, raidContractAddr);
raidContracts.Raid1 = Raid1;
raidTrinketAddress = (raidTrinketNetworks as Networks)[networkId]!.address;
keyboxAddress = (keyboxNetworks as Networks)[networkId]!.address;
junkAddress = (junkNetworks as Networks)[networkId]!.addr... | @@ -351,7 +331,7 @@ export async function setUpContracts(web3: Web3): Promise<Contracts> {
const simpleQuests = new web3.eth.Contract(simpleQuestsAbi as Abi, simpleQuestsContractAddr);
questsContracts.SimpleQuests = simpleQuests;
if (simpleQuests.methods.partnerVault) { | frontend/src/contracts.ts | 26 | TypeScript | 0.357 | suggestion | 140 | 51 | 51 | false | Contract addresses from json | 1,364 | CryptoBlades/cryptoblades | 321 | Vue | Chriserus | kevinunger | Review this pull request change.
Language: TypeScript
File: frontend/src/contracts.ts
PR Title: Contract addresses from json
BEFORE CODE: const Raid1 = new web3.eth.Contract(raidAbi as Abi, raidContractAddr);
raidContracts.Raid1 = Raid1;
raidTrinketAddress = (raidTrinketNetworks as Networks)[networkId]... | This if is checking if partnerVault property is in SimpleQuests contract in order to get the address from there. Now it's not needed I think | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
<h5>{{fightResults.playerRoll}}</h5>
</b-col>
</b-row>
<b-row class="power-rolled">
<b-col cols="4" lg="5" sm="4" md="4" class="win-details">
<h5>{{$t('combatResults.enemyRolled')}}</h5>
</b-col>
<b-col cols="4" lg="2" sm="4" md="4" class=... | Is the case handled if IGO isn't returned after the event? I'd rather not have to delete this back out afterwards? | <h5>{{fightResults.playerRoll}}</h5>
</b-col>
</b-row>
<b-row class="power-rolled">
<b-col cols="4" lg="5" sm="4" md="4" class="win-details">
<h5>{{$t('combatResults.enemyRolled')}}</h5>
</b-col>
<b-col cols="4" lg="2" sm="4" md="4" class=... | @@ -39,7 +39,8 @@
<b-row>
<b-col class="earned">
<h4>
- {{formattedSkill}} {{formattedUsd}}
+ {{formattedSkillNoIGO}} {{formattedInUsd(calculateSkillPriceInUsd(calculateSkillRewardNoIGO()).toFixed(4))}} UNCLAIMED SKILL AND
+ {{formattedSkillIGORew... | frontend/src/components/CombatResults.vue | 26 | Vue | 0.5 | question | 114 | 51 | 51 | false | separate igo and unclaimed on fight rewards | 1,434 | CryptoBlades/cryptoblades | 321 | Vue | Sellie96 | byyyyyyyyy | Review this pull request change.
Language: Vue
File: frontend/src/components/CombatResults.vue
PR Title: separate igo and unclaimed on fight rewards
BEFORE CODE: <h5>{{fightResults.playerRoll}}</h5>
</b-col>
</b-row>
<b-row class="power-rolled">
<b-col cols="4" lg="5... | Is the case handled if IGO isn't returned after the event? I'd rather not have to delete this back out afterwards? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
if(powerful > 0){
this.powerful = this.powerful - Math.floor(powerful/2);
}
}
},
onShowForgeDetails() {
(this.$refs['forge-details-modal'] as BModal).show();
},
onClickForge(i: number) {
if(+this.specialWeaponEventId === 0 && this.activeSpecialWeap... | none descriptive variable names is my personal pet peeve! Can you rename it what it is storing for easy reading <3 | }
if(powerful > 0){
this.powerful = this.powerful - Math.floor(powerful/2);
}
}
},
onShowForgeDetails() {
(this.$refs['forge-details-modal'] as BModal).show();
},
onClickForge(i: number) {
if(+this.specialWeaponEventId === 0 && this.activeSpecialWeap... | @@ -996,7 +998,9 @@ export default Vue.extend({
},
setChosenElement(ele: any, i: number) {
- this.selectedElement = i;
+ if(i === this.selectedElement) this.selectedElement = null;
+ else this.selectedElement = i; | frontend/src/views/Blacksmith.vue | 26 | Vue | 0.429 | suggestion | 114 | 51 | 51 | false | Fixed Some issues in ui | 1,446 | CryptoBlades/cryptoblades | 321 | Vue | Sellie96 | Spintacle123 | Review this pull request change.
Language: Vue
File: frontend/src/views/Blacksmith.vue
PR Title: Fixed Some issues in ui
BEFORE CODE: }
if(powerful > 0){
this.powerful = this.powerful - Math.floor(powerful/2);
}
}
},
onShowForgeDetails() {
(this.$refs['forge-de... | none descriptive variable names is my personal pet peeve! Can you rename it what it is storing for easy reading <3 | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
rankingPointsByCharacter[characterID] = points;
}
function handleEnterArena(uint256 characterID, uint8 tier) external restricted {
bool isCharacterInTopRanks;
for (uint i = 0; i < _topRankingCharactersByTier[tier].length; i++) {
if (characterID == _topRankingCharactersB... | you must use tx.origin instead of msg.sender because msg.sender will be PvpCore | rankingPointsByCharacter[characterID] = points;
}
function handleEnterArena(uint256 characterID, uint8 tier) external restricted {
bool isCharacterInTopRanks;
for (uint i = 0; i < _topRankingCharactersByTier[tier].length; i++) {
if (characterID == _topRankingCharactersB... | @@ -422,13 +387,21 @@ contract PvpRankings is Initializable, AccessControlUpgradeable {
rankingPointsByCharacter[characterID] = 0;
seasonByCharacter[characterID] = currentRankedSeason;
}
+
+ if (_ownerByCharacter[characterID] != msg.sender) {
+ _ownerByCharacter[char... | contracts/PvpRankings.sol | 26 | Solidity | 0.286 | suggestion | 79 | 51 | 51 | false | remove forceRestartRankedSeason, add ownerByCharacter to pvp rankings | 1,453 | CryptoBlades/cryptoblades | 321 | Vue | poshdan | Jcalcaldev | Review this pull request change.
Language: Solidity
File: contracts/PvpRankings.sol
PR Title: remove forceRestartRankedSeason, add ownerByCharacter to pvp rankings
BEFORE CODE: rankingPointsByCharacter[characterID] = points;
}
function handleEnterArena(uint256 characterID, uint8 tier) external rest... | you must use tx.origin instead of msg.sender because msg.sender will be PvpCore | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
<template>
<b-tab :title="$t('Character.skins')" title-item-class="character-wrapper" title-link-class="character-tab" @click="$emit('loadCosmeticsCount')">
<div class="d-flex flex-wrap">
<div
class="col col-md-3 image-width p-1 text-white text-center mb-3"
role="button"
... | I know not this PR but translation please | <template>
<b-tab :title="$t('Character.skins')" title-item-class="character-wrapper" title-link-class="character-tab" @click="$emit('loadCosmeticsCount')">
<div class="d-flex flex-wrap">
<div
class="col col-md-3 image-width p-1 text-white text-center mb-3"
role="button"
... | @@ -14,7 +14,7 @@
}"
>
<template v-if="characterCosmetics[currentCharacterId] === cosmetic.id">
- <span>Equiped</span>
+ <span>Equipped</span> | frontend/src/components/smart/CharacterTabs/SkinsTab.vue | 17 | Vue | 0.071 | suggestion | 41 | 42 | 42 | false | New game UI soul transfer | 1,454 | CryptoBlades/cryptoblades | 321 | Vue | Sellie96 | byyyyyyyyy | Review this pull request change.
Language: Vue
File: frontend/src/components/smart/CharacterTabs/SkinsTab.vue
PR Title: New game UI soul transfer
BEFORE CODE: <template>
<b-tab :title="$t('Character.skins')" title-item-class="character-wrapper" title-link-class="character-tab" @click="$emit('loadCosmeticsCount'... | I know not this PR but translation please | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
</div>
<div>
<span>{{$t('raid.totalPower')}}</span>
<p>{{ totalPower.toLocaleString() }}</p>
</div>
<div>
<span>{{$t('raid.bossPower')}}</span>
... | This is a wild bit of logic. Can the logic be moved to a Method and the returned boolean be passed on a :disabled="" there should be a few examples around, you shouldn't need the css then either | </div>
<div>
<span>{{$t('raid.totalPower')}}</span>
<p>{{ totalPower.toLocaleString() }}</p>
</div>
<div>
<span>{{$t('raid.bossPower')}}</span>
... | @@ -173,10 +173,16 @@
</div>
</div>
<div class="col-lg-12 join-raid">
- <button class="claim-btn" @click="promptRewardClaim()" v-tooltip="'Rewards from Previous Raid'">
+ <button class="claim-btn" :class="rewardIndexes !=... | frontend/src/views/Raid.vue | 26 | Vue | 0.429 | suggestion | 195 | 51 | 51 | false | UI bug fixes 02 | 1,476 | CryptoBlades/cryptoblades | 321 | Vue | Sellie96 | Spintacle123 | Review this pull request change.
Language: Vue
File: frontend/src/views/Raid.vue
PR Title: UI bug fixes 02
BEFORE CODE: </div>
<div>
<span>{{$t('raid.totalPower')}}</span>
<p>{{ totalPower.toLocaleString() }}</p>
... | This is a wild bit of logic. Can the logic be moved to a Method and the returned boolean be passed on a :disabled="" there should be a few examples around, you shouldn't need the css then either | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
<p>{{ bossPower.toLocaleString() }}</p>
</div>
</div>
<div class="col-lg-12 drops none-mobile">
<span>{{$t('raid.chanceTo')}} {{$t('raid.drops')}}</span>
<div class="drops-icons">
... | I believe the same as above here | <p>{{ bossPower.toLocaleString() }}</p>
</div>
</div>
<div class="col-lg-12 drops none-mobile">
<span>{{$t('raid.chanceTo')}} {{$t('raid.drops')}}</span>
<div class="drops-icons">
... | @@ -173,10 +173,16 @@
</div>
</div>
<div class="col-lg-12 join-raid">
- <button class="claim-btn" @click="promptRewardClaim()" v-tooltip="'Rewards from Previous Raid'">
+ <button class="claim-btn" :class="rewardIndexes !=... | frontend/src/views/Raid.vue | 26 | Vue | 0.071 | suggestion | 32 | 51 | 51 | false | UI bug fixes 02 | 1,476 | CryptoBlades/cryptoblades | 321 | Vue | Sellie96 | Spintacle123 | Review this pull request change.
Language: Vue
File: frontend/src/views/Raid.vue
PR Title: UI bug fixes 02
BEFORE CODE: <p>{{ bossPower.toLocaleString() }}</p>
</div>
</div>
<div class="col-lg-12 drops none-mobile">
... | I believe the same as above here | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
'joinRaid',
'fetchRaidRewards',
'claimRaidRewards',
'fetchRaidingCharacters',
'fetchRaidingWeapons',
'fetchIsRaidStarted',
'fetchHaveEnoughEnergy',
'fetchIsCharacterRaiding',
'fetchIsWeaponRaiding',
'fetchCharacters',
'canUserAfford'
]) as RaidMapped... | There is a typing issue here. Check the build | 'joinRaid',
'fetchRaidRewards',
'claimRaidRewards',
'fetchRaidingCharacters',
'fetchRaidingWeapons',
'fetchIsRaidStarted',
'fetchHaveEnoughEnergy',
'fetchIsCharacterRaiding',
'fetchIsWeaponRaiding',
'fetchCharacters',
'canUserAfford'
]) as RaidMapped... | @@ -528,6 +530,10 @@ export default Vue.extend({
Events.$emit('weapon-inventory', true);
},
+ noRewards(){
+ return this.rewardIndexes === null && this.rewardIndexes.length === 0; | frontend/src/views/Raid.vue | 26 | Vue | 0.071 | suggestion | 45 | 51 | 51 | false | UI bug fixes 02 | 1,476 | CryptoBlades/cryptoblades | 321 | Vue | Sellie96 | Spintacle123 | Review this pull request change.
Language: Vue
File: frontend/src/views/Raid.vue
PR Title: UI bug fixes 02
BEFORE CODE: 'joinRaid',
'fetchRaidRewards',
'claimRaidRewards',
'fetchRaidingCharacters',
'fetchRaidingWeapons',
'fetchIsRaidStarted',
'fetchHaveEnoughEnergy',
... | There is a typing issue here. Check the build | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
});
this.burnWeaponIds = [];
return;
}
this.ownedWeaponIds.map(id => this.burnWeaponIds.push(id));
this.burnWeaponIds.forEach(id => {
this.ctr += 1;
const weaponDetails = this.ownWeapons.find(y => +y.id === +id);
this.computeDust('add',(weaponDetails.sta... | This select all doesn't account for filters or pagination. Select all should only select items visible at that time so should be done on the filtered list not the entire weapon list. | const currentFilteredForBuringIds = this.currentFilteredWeaponsIds.filter(id => this.burnWeaponIds.includes(id));
if(currentFilteredForBuringIds.length > 0){
currentFilteredForBuringIds.forEach(id => {
console.log(id);
this.ctr += 1;
const weaponDetails = this.ownWeapon... | @@ -1076,25 +1079,45 @@ export default Vue.extend({
}
},
+ selectAllForBurn(){
+ if(this.burnWeaponIds.length > 0){
+ this.burnWeaponIds.forEach(id => {
+ this.ctr += 1;
+ const weaponDetails = this.ownWeapons.find(y => {
+ if(y && +y.id === +id){
+ ... | frontend/src/views/Blacksmith.vue | 26 | Vue | 0.429 | suggestion | 182 | 51 | 51 | false | Selection interface from character burning to weapon burning | 1,481 | CryptoBlades/cryptoblades | 321 | Vue | Sellie96 | byyyyyyyyy | Review this pull request change.
Language: Vue
File: frontend/src/views/Blacksmith.vue
PR Title: Selection interface from character burning to weapon burning
BEFORE CODE: });
this.burnWeaponIds = [];
return;
}
this.ownedWeaponIds.map(id => this.burnWeaponIds.push(id));
this... | This select all doesn't account for filters or pagination. Select all should only select items visible at that time so should be done on the filtered list not the entire weapon list. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
<template>
<div>
<div class="filters flex-wrap px-4 pb-4" v-if="!newWeapon" @change="saveFilters()">
<div v-if="titleType!='combat'" class="d-flex flex-column align-items-start" style="flex-grow:0.6" >
<h3 v-if="!noTitle && titleType=='burn-weapon'">{{$t('nftList.selected')}} ({{ ignore.length }})... | Can all the x's here be replaces also please | <template>
<div>
<div class="filters flex-wrap px-4 pb-4 remove-flex-wrap-mobile" v-if="!newWeapon" @change="saveFilters()">
<div v-if="titleType!='combat'" class="d-flex flex-column align-items-start" style="flex-grow:0.6" >
<h3 v-if="!noTitle && titleType=='burn-weapon'">{{$t('nftList.selected')... | @@ -1,30 +1,39 @@
<template>
<div>
- <div class="filters" v-if="!newWeapon" @change="saveFilters()">
- <h3 class="ml-4" v-if="!noTitle && titleType=='weapon-list'">{{$t('weapons')}} ({{ ownWeapons }})</h3>
- <h3 class="ml-4" v-if="!noTitle && titleType=='burn-weapon'">{{$t('nftList.selected')}} ({{ ign... | frontend/src/components/smart/WeaponGridNew.vue | 10 | Vue | 0.143 | suggestion | 45 | 35 | 35 | false | Selection interface from character burning to weapon burning | 1,481 | CryptoBlades/cryptoblades | 321 | Vue | Sellie96 | byyyyyyyyy | Review this pull request change.
Language: Vue
File: frontend/src/components/smart/WeaponGridNew.vue
PR Title: Selection interface from character burning to weapon burning
BEFORE CODE: <template>
<div>
<div class="filters flex-wrap px-4 pb-4" v-if="!newWeapon" @change="saveFilters()">
<div v-if="titleTy... | Can all the x's here be replaces also please | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
.mul(ABDKMath64x64.fromUInt(chosenElementFee));
_payContractStakedOnly(msg.sender, usdToSkill(discountedMintWeaponFee));
_mintWeaponNLogic(num, chosenElement, eventId);
}
function mintWeaponUsingStakedSkill(uint8 chosenElement, uint256 eventId) external onlyNonContract oncePerB... | not public and unrestricted, please :D (same thing the equivalent function in blacksmith) | .mul(ABDKMath64x64.fromUInt(quantity))
.mul(ABDKMath64x64.fromUInt(chosenElementFee));
_payContractStakedOnly(msg.sender, usdToSkill(discountedMintWeaponFee));
_updateWeaponMintFee(quantity);
if (eventId > 0) {
specialWeaponsManager.addShards(msg.sende... | @@ -560,22 +563,39 @@ contract CryptoBlades is Initializable, AccessControlUpgradeable {
_mintWeaponLogic(chosenElement, eventId);
}
+ function setSafeRandoms(SafeRandoms _safeRandoms) public restricted {
+ safeRandoms = _safeRandoms;
+ }
+
+ function hasSeed(uint quantity) public view r... | contracts/cryptoblades.sol | 26 | Solidity | 0.214 | suggestion | 89 | 51 | 51 | false | SafeRandoms in shields and weapons minting | 1,578 | CryptoBlades/cryptoblades | 321 | Vue | poshdan | Chriserus | Review this pull request change.
Language: Solidity
File: contracts/cryptoblades.sol
PR Title: SafeRandoms in shields and weapons minting
BEFORE CODE: .mul(ABDKMath64x64.fromUInt(chosenElementFee));
_payContractStakedOnly(msg.sender, usdToSkill(discountedMintWeaponFee));
_mintWeapon... | not public and unrestricted, please :D (same thing the equivalent function in blacksmith) | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
.mul(PAYMENT_USING_STAKED_SKILL_COST_AFTER_DISCOUNT)
.mul(ABDKMath64x64.fromUInt(chosenElementFee));
_payContractStakedOnly(msg.sender, usdToSkill(discountedMintWeaponFee));
_mintWeaponLogic(chosenElement, eventId);
}
function setSafeRandoms(SafeRandoms _safeRan... | Generating a seed has to happen at the point of payment. This way the user cant generate a seed for free, see if the outcome is favorable, and only pay in the 2nd tx if they know the result will be good.
The minting logic needs to be split into two, one where it's paid for (& seed requested), another where it's claime... |
function mintWeapon() external onlyNonContract oncePerBlock(msg.sender) {
uint8 chosenElement = uint8((userVars[msg.sender][USERVAR_CLAIM_WEAPON_DATA]) & 0xFF);
uint32 quantity = uint32((userVars[msg.sender][USERVAR_CLAIM_WEAPON_DATA] >> 32) & 0xFFFFFFFF);
require(quantity > 0);
use... | @@ -560,22 +563,39 @@ contract CryptoBlades is Initializable, AccessControlUpgradeable {
_mintWeaponLogic(chosenElement, eventId);
}
+ function setSafeRandoms(SafeRandoms _safeRandoms) public restricted {
+ safeRandoms = _safeRandoms;
+ }
+
+ function hasSeed(uint quantity) public view r... | contracts/cryptoblades.sol | 26 | Solidity | 0.5 | suggestion | 438 | 51 | 51 | false | SafeRandoms in shields and weapons minting | 1,578 | CryptoBlades/cryptoblades | 321 | Vue | poshdan | Chriserus | Review this pull request change.
Language: Solidity
File: contracts/cryptoblades.sol
PR Title: SafeRandoms in shields and weapons minting
BEFORE CODE: .mul(PAYMENT_USING_STAKED_SKILL_COST_AFTER_DISCOUNT)
.mul(ABDKMath64x64.fromUInt(chosenElementFee));
_payContractStakedOnly(m... | Generating a seed has to happen at the point of payment. This way the user cant generate a seed for free, see if the outcome is favorable, and only pay in the 2nd tx if they know the result will be good.
The minting logic needs to be split into two, one where it's paid for (& seed requested), another where it's claime... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
//uint256 public constant CURRENCY_KING = 1; // not referenced atm
/* ========== STATE VARIABLES ========== */
Weapons public weapons;
IRandoms public randoms;
mapping(address => uint32) public tickets;
Shields public shields;
CryptoBlades public game;
// keys: ITEM_ constant
m... | Thoughts on trying the links mapping for saferandoms in both files? We can then avoid having the setSafeRandoms function and instead have a "setLink" with a link identifier constant, so we can set future references too without additional functions? | uint256 public constant CURRENCY_SKILL = 0;
//uint256 public constant CURRENCY_KING = 1; // not referenced atm
/* ========== STATE VARIABLES ========== */
Weapons public weapons;
IRandoms public randoms;
mapping(address => uint32) public tickets;
Shields public shields;
CryptoBlades ... | @@ -62,6 +63,7 @@ contract Blacksmith is Initializable, AccessControlUpgradeable {
mapping(uint256 => address) currencies;
mapping(uint256 => address) public links; | contracts/Blacksmith.sol | 26 | Solidity | 0.5 | question | 248 | 51 | 51 | false | SafeRandoms in shields and weapons minting | 1,578 | CryptoBlades/cryptoblades | 321 | Vue | poshdan | Chriserus | Review this pull request change.
Language: Solidity
File: contracts/Blacksmith.sol
PR Title: SafeRandoms in shields and weapons minting
BEFORE CODE: //uint256 public constant CURRENCY_KING = 1; // not referenced atm
/* ========== STATE VARIABLES ========== */
Weapons public weapons;
IRandoms publi... | Thoughts on trying the links mapping for saferandoms in both files? We can then avoid having the setSafeRandoms function and instead have a "setLink" with a link identifier constant, so we can set future references too without additional functions? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
itemFlatPrices[ITEM_CHARACTER_TRAITCHANGE_EARTH] = 0.2 ether;
itemFlatPrices[ITEM_CHARACTER_TRAITCHANGE_WATER] = 0.2 ether;
itemFlatPrices[ITEM_CHARACTER_TRAITCHANGE_LIGHTNING] = 0.2 ether;
}
function migrateTo_bcdf4c(CBKLandSale _cbkLandSale) external {
require(hasRole(DEFAULT_... | May be forward thinking to have a seed ID param on this function for frontend compatibility. Assuming we'll sell more seed-bound things in blacksmith in the future, so the ABI doesnt have to change. The frontend would have to know about the seed id constant though. | itemFlatPrices[ITEM_CHARACTER_TRAITCHANGE_EARTH] = 0.2 ether;
itemFlatPrices[ITEM_CHARACTER_TRAITCHANGE_WATER] = 0.2 ether;
itemFlatPrices[ITEM_CHARACTER_TRAITCHANGE_LIGHTNING] = 0.2 ether;
}
function migrateTo_bcdf4c(CBKLandSale _cbkLandSale) external {
require(hasRole(DEFAULT_... | @@ -129,17 +131,32 @@ contract Blacksmith is Initializable, AccessControlUpgradeable {
IERC20(tokenAddress).safeTransfer(msg.sender, amount);
}
+ function setSafeRandoms(SafeRandoms _safeRandoms) public isAdmin {
+ safeRandoms = _safeRandoms;
+ }
+
+ function hasSeed() public view return... | contracts/Blacksmith.sol | 26 | Solidity | 0.5 | suggestion | 265 | 51 | 51 | false | SafeRandoms in shields and weapons minting | 1,578 | CryptoBlades/cryptoblades | 321 | Vue | poshdan | Chriserus | Review this pull request change.
Language: Solidity
File: contracts/Blacksmith.sol
PR Title: SafeRandoms in shields and weapons minting
BEFORE CODE: itemFlatPrices[ITEM_CHARACTER_TRAITCHANGE_EARTH] = 0.2 ether;
itemFlatPrices[ITEM_CHARACTER_TRAITCHANGE_WATER] = 0.2 ether;
itemFlatPrices[ITEM... | May be forward thinking to have a seed ID param on this function for frontend compatibility. Assuming we'll sell more seed-bound things in blacksmith in the future, so the ABI doesnt have to change. The frontend would have to know about the seed id constant though. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
},
async getAccountWeapons({state}) {
if(!state.defaultAccount) return;
const numberOfWeapons = parseInt(await state.contracts().Weapons!.methods.balanceOf(state.defaultAccount).call(defaultCallOptions(state)), 10);
return await Promise.all(
[...Array(numberOfWeapons).keys()]
... | This will need updating to handle the pay first, pop second nature of the flow. Would like to note we will need some visual feedback for the player to know they have a weapon waiting if for whatever reason the payment succeeds but they cancel/fail the claim. This is made more complicated by the fact that the seeds are ... | await approveFee(
state.contracts().CryptoBlades!,
state.contracts().SkillToken,
state.defaultAccount,
state.skillRewards,
defaultCallOptions(state),
defaultCallOptions(state),
cryptoBladesMethods => cryptoBladesMethods.getMintCharacterFee(),
{ feeMu... | @@ -1456,6 +1456,10 @@ export default new Vuex.Store<IState>({
{ feeMultiplier: num * 4 * chosenElementFee * slippageMultiplier, allowInGameOnlyFunds: true }
);
| frontend/src/store/store.ts | 26 | TypeScript | 0.643 | bug | 681 | 51 | 51 | false | SafeRandoms in shields and weapons minting | 1,578 | CryptoBlades/cryptoblades | 321 | Vue | poshdan | Chriserus | Review this pull request change.
Language: TypeScript
File: frontend/src/store/store.ts
PR Title: SafeRandoms in shields and weapons minting
BEFORE CODE: },
async getAccountWeapons({state}) {
if(!state.defaultAccount) return;
const numberOfWeapons = parseInt(await state.contracts().Weapons!.meth... | This will need updating to handle the pay first, pop second nature of the flow. Would like to note we will need some visual feedback for the player to know they have a weapon waiting if for whatever reason the payment succeeds but they cancel/fail the claim. This is made more complicated by the fact that the seeds are ... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
defaultCallOptions(state),
defaultCallOptions(state),
cryptoBladesMethods => cryptoBladesMethods.getMintCharacterFee(),
{ feeMultiplier: slippageMultiplier, allowInGameOnlyFunds: false }
);
await state.contracts().CryptoBlades!.methods.mintCharacter().send(defaultCallOptions... | does it still work without the magic number? :-D | if (!CryptoBlades || !SkillToken || !state.defaultAccount) return;
const chosenElementFee = chosenElement === 100 ? 1 : 2;
const slippageMultiplier = mintSlippageApproved ? 1.05 : 1;
const USERVAR_CLAIM_WEAPON_DATA = await CryptoBlades.methods.USERVAR_CLAIM_WEAPON_DATA().call(defaultCallOptions... | @@ -1432,68 +1432,35 @@ export default new Vuex.Store<IState>({
]);
},
- async mintWeaponN({ state, dispatch }, { num, useStakedSkillOnly, chosenElement, eventId = 0, mintSlippageApproved }:
- { num: any, useStakedSkillOnly?: boolean, chosenElement: any, eventId: any, mintSlippageApproved: boolean }... | frontend/src/store/store.ts | 26 | TypeScript | 0.071 | suggestion | 48 | 51 | 51 | false | SafeRandoms in shields and weapons minting | 1,578 | CryptoBlades/cryptoblades | 321 | Vue | kevinunger | Chriserus | Review this pull request change.
Language: TypeScript
File: frontend/src/store/store.ts
PR Title: SafeRandoms in shields and weapons minting
BEFORE CODE: defaultCallOptions(state),
defaultCallOptions(state),
cryptoBladesMethods => cryptoBladesMethods.getMintCharacterFee(),
{ feeMulti... | does it still work without the magic number? :-D | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
itemFlatPrices[ITEM_WEAPON_RENAME] = 0.1 ether;
itemFlatPrices[ITEM_CHARACTER_RENAME] = 0.1 ether;
itemFlatPrices[ITEM_CHARACTER_TRAITCHANGE_FIRE] = 0.2 ether;
itemFlatPrices[ITEM_CHARACTER_TRAITCHANGE_EARTH] = 0.2 ether;
itemFlatPrices[ITEM_CHARACTER_TRAITCHANGE_WATER] = 0.2 eth... | Just realised, that we technically have the ability to offer different types of shield purchases (1 type at a time atm), so we ought to mix the type number into the seed too.
numberParameters[VAR_PURCHASE_SHIELD_TYPE]
Should be mixed into the seed generation. The currently used function takes two arguments, there a... | itemFlatPrices[ITEM_WEAPON_RENAME] = 0.1 ether;
itemFlatPrices[ITEM_CHARACTER_RENAME] = 0.1 ether;
itemFlatPrices[ITEM_CHARACTER_TRAITCHANGE_FIRE] = 0.2 ether;
itemFlatPrices[ITEM_CHARACTER_TRAITCHANGE_EARTH] = 0.2 ether;
itemFlatPrices[ITEM_CHARACTER_TRAITCHANGE_WATER] = 0.2 eth... | @@ -129,17 +131,28 @@ contract Blacksmith is Initializable, AccessControlUpgradeable {
IERC20(tokenAddress).safeTransfer(msg.sender, amount);
}
- function purchaseShield() public {
+ function getSeed(uint seedId) internal pure returns (uint256 seed) {
+ seed = RandomUtil.combineSeeds(seedId... | contracts/Blacksmith.sol | 26 | Solidity | 0.643 | suggestion | 1,535 | 51 | 51 | false | SafeRandoms in shields and weapons minting | 1,578 | CryptoBlades/cryptoblades | 321 | Vue | poshdan | Chriserus | Review this pull request change.
Language: Solidity
File: contracts/Blacksmith.sol
PR Title: SafeRandoms in shields and weapons minting
BEFORE CODE: itemFlatPrices[ITEM_WEAPON_RENAME] = 0.1 ether;
itemFlatPrices[ITEM_CHARACTER_RENAME] = 0.1 ether;
itemFlatPrices[ITEM_CHARACTER_TRAITCHANGE_FI... | Just realised, that we technically have the ability to offer different types of shield purchases (1 type at a time atm), so we ought to mix the type number into the seed too.
numberParameters[VAR_PURCHASE_SHIELD_TYPE]
Should be mixed into the seed generation. The currently used function takes two arguments, there a... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/* ========== VIEWS ========== */
/* ========== MUTATIVE FUNCTIONS ========== */
function recoverToken(address tokenAddress, uint256 amount) public {
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Not admin");
IERC20(tokenAddress).safeTransfer(msg.sender, amount);
}
function ... | Could help avoid confusion (esp for peopel working in frontend) if we were to name the two different steps 1. purchase and 2. mint/claim |
/* ========== VIEWS ========== */
/* ========== MUTATIVE FUNCTIONS ========== */
function recoverToken(address tokenAddress, uint256 amount) public {
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Not admin");
IERC20(tokenAddress).safeTransfer(msg.sender, amount);
}
function ... | @@ -129,17 +131,28 @@ contract Blacksmith is Initializable, AccessControlUpgradeable {
IERC20(tokenAddress).safeTransfer(msg.sender, amount);
}
- function purchaseShield() public {
+ function getSeed(uint seedId) internal pure returns (uint256 seed) {
+ seed = RandomUtil.combineSeeds(seedId... | contracts/Blacksmith.sol | 26 | Solidity | 0.429 | suggestion | 136 | 51 | 51 | false | SafeRandoms in shields and weapons minting | 1,578 | CryptoBlades/cryptoblades | 321 | Vue | poshdan | Chriserus | Review this pull request change.
Language: Solidity
File: contracts/Blacksmith.sol
PR Title: SafeRandoms in shields and weapons minting
BEFORE CODE:
/* ========== VIEWS ========== */
/* ========== MUTATIVE FUNCTIONS ========== */
function recoverToken(address tokenAddress, uint256 amount) public {
... | Could help avoid confusion (esp for peopel working in frontend) if we were to name the two different steps 1. purchase and 2. mint/claim | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
function migrateTo_bcdf4c(CBKLandSale _cbkLandSale) external {
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Not admin");
cbkLandSale = _cbkLandSale;
}
/* ========== VIEWS ========== */
/* ========== MUTATIVE FUNCTIONS ========== */
function recoverToken(address tokenAddress... | Worth mentioning that if we ever sell other items using safe randoms through blacksmith, the abi will have to change for these seed related functions, and need to be updated in frontend even for shields. Not a requirement at this time, but it's worth knowing we'll probably take an item ID and/or type, maybe amount as a... |
function migrateTo_bcdf4c(CBKLandSale _cbkLandSale) external {
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Not admin");
cbkLandSale = _cbkLandSale;
}
/* ========== VIEWS ========== */
/* ========== MUTATIVE FUNCTIONS ========== */
function recoverToken(address tokenAddress... | @@ -129,17 +131,28 @@ contract Blacksmith is Initializable, AccessControlUpgradeable {
IERC20(tokenAddress).safeTransfer(msg.sender, amount);
}
- function purchaseShield() public {
+ function getSeed(uint seedId) internal pure returns (uint256 seed) {
+ seed = RandomUtil.combineSeeds(seedId... | contracts/Blacksmith.sol | 26 | Solidity | 0.643 | suggestion | 357 | 51 | 51 | false | SafeRandoms in shields and weapons minting | 1,578 | CryptoBlades/cryptoblades | 321 | Vue | poshdan | Chriserus | Review this pull request change.
Language: Solidity
File: contracts/Blacksmith.sol
PR Title: SafeRandoms in shields and weapons minting
BEFORE CODE:
function migrateTo_bcdf4c(CBKLandSale _cbkLandSale) external {
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Not admin");
cbkLandSale = _cbkL... | Worth mentioning that if we ever sell other items using safe randoms through blacksmith, the abi will have to change for these seed related functions, and need to be updated in frontend even for shields. Not a requirement at this time, but it's worth knowing we'll probably take an item ID and/or type, maybe amount as a... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
function migrateTo_bcdf4c(CBKLandSale _cbkLandSale) external {
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Not admin");
cbkLandSale = _cbkLandSale;
}
/* ========== VIEWS ========== */
/* ========== MUTATIVE FUNCTIONS ========== */
function recoverToken(address tokenAddress,... | Use msg.sender if there's no reason to use tx.origin | function migrateTo_bcdf4c(CBKLandSale _cbkLandSale) external {
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Not admin");
cbkLandSale = _cbkLandSale;
}
/* ========== VIEWS ========== */
/* ========== MUTATIVE FUNCTIONS ========== */
function recoverToken(address tokenAddress,... | @@ -129,17 +131,33 @@ contract Blacksmith is Initializable, AccessControlUpgradeable {
IERC20(tokenAddress).safeTransfer(msg.sender, amount);
}
- function purchaseShield() public {
+ function getSeed(uint seedId, uint shieldType) internal pure returns (uint256 seed) {
+ uint[] memory seeds ... | contracts/Blacksmith.sol | 26 | Solidity | 0.286 | suggestion | 52 | 51 | 51 | false | SafeRandoms in shields and weapons minting | 1,578 | CryptoBlades/cryptoblades | 321 | Vue | kcper | Chriserus | Review this pull request change.
Language: Solidity
File: contracts/Blacksmith.sol
PR Title: SafeRandoms in shields and weapons minting
BEFORE CODE: function migrateTo_bcdf4c(CBKLandSale _cbkLandSale) external {
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Not admin");
cbkLandSale = _cbkLa... | Use msg.sender if there's no reason to use tx.origin | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/* ========== MUTATIVE FUNCTIONS ========== */
function recoverToken(address tokenAddress, uint256 amount) public {
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Not admin");
IERC20(tokenAddress).safeTransfer(msg.sender, amount);
}
function getSeed(uint seedId, uint shieldType) i... | Use msg.sender if there's no reason to use tx.origin |
/* ========== MUTATIVE FUNCTIONS ========== */
function recoverToken(address tokenAddress, uint256 amount) public {
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Not admin");
IERC20(tokenAddress).safeTransfer(msg.sender, amount);
}
function getSeed(uint seedId, uint shieldType) i... | @@ -129,17 +131,33 @@ contract Blacksmith is Initializable, AccessControlUpgradeable {
IERC20(tokenAddress).safeTransfer(msg.sender, amount);
}
- function purchaseShield() public {
+ function getSeed(uint seedId, uint shieldType) internal pure returns (uint256 seed) {
+ uint[] memory seeds ... | contracts/Blacksmith.sol | 26 | Solidity | 0.286 | suggestion | 52 | 51 | 51 | false | SafeRandoms in shields and weapons minting | 1,578 | CryptoBlades/cryptoblades | 321 | Vue | kcper | Chriserus | Review this pull request change.
Language: Solidity
File: contracts/Blacksmith.sol
PR Title: SafeRandoms in shields and weapons minting
BEFORE CODE:
/* ========== MUTATIVE FUNCTIONS ========== */
function recoverToken(address tokenAddress, uint256 amount) public {
require(hasRole(DEFAULT_ADMIN_ROL... | Use msg.sender if there's no reason to use tx.origin | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
function mintCharacter() public onlyNonContract oncePerBlock(msg.sender) {
uint256 skillAmount = usdToSkill(mintCharacterFee);
(,, uint256 fromUserWallet) =
getSkillToSubtract(
0,
tokenRewards[msg.sender],
skillAmount
);
... | We should `require(num > 0 && num <= 10)`. If they input anything > 10 they won't be able to mint anything from this seed. |
function mintCharacter() public onlyNonContract oncePerBlock(msg.sender) {
uint256 skillAmount = usdToSkill(mintCharacterFee);
(,, uint256 fromUserWallet) =
getSkillToSubtract(
0,
tokenRewards[msg.sender],
skillAmount
);
... | @@ -517,65 +521,48 @@ contract CryptoBlades is Initializable, AccessControlUpgradeable {
_updateCharacterMintFee();
}
- function mintWeaponN(uint32 num, uint8 chosenElement, uint256 eventId)
- external
- onlyNonContract
- oncePerBlock(msg.sender)
- {
- uint8 chosenEleme... | contracts/cryptoblades.sol | 26 | Solidity | 0.571 | suggestion | 122 | 51 | 51 | false | SafeRandoms in shields and weapons minting | 1,578 | CryptoBlades/cryptoblades | 321 | Vue | kcper | Chriserus | Review this pull request change.
Language: Solidity
File: contracts/cryptoblades.sol
PR Title: SafeRandoms in shields and weapons minting
BEFORE CODE: function mintCharacter() public onlyNonContract oncePerBlock(msg.sender) {
uint256 skillAmount = usdToSkill(mintCharacterFee);
(,, uint256 fromU... | We should `require(num > 0 && num <= 10)`. If they input anything > 10 they won't be able to mint anything from this seed. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
uint256 convertedAmount = usdToSkill(getMintCharacterFee());
_payContractTokenOnly(msg.sender, convertedAmount);
uint256 seed = randoms.getRandomSeed(msg.sender);
characters.mint(msg.sender, seed);
// first weapon free with a character mint, max 1 star
if(weapons.balanc... | We should `require(num > 0 && num <= 10)`. If they input anything > 10 they won't be able to mint anything from this seed. |
uint256 convertedAmount = usdToSkill(getMintCharacterFee());
_payContractTokenOnly(msg.sender, convertedAmount);
uint256 seed = randoms.getRandomSeed(msg.sender);
characters.mint(msg.sender, seed);
// first weapon free with a character mint, max 1 star
if(weapons.balan... | @@ -517,65 +521,48 @@ contract CryptoBlades is Initializable, AccessControlUpgradeable {
_updateCharacterMintFee();
}
- function mintWeaponN(uint32 num, uint8 chosenElement, uint256 eventId)
- external
- onlyNonContract
- oncePerBlock(msg.sender)
- {
- uint8 chosenEleme... | contracts/cryptoblades.sol | 26 | Solidity | 0.571 | suggestion | 122 | 51 | 51 | false | SafeRandoms in shields and weapons minting | 1,578 | CryptoBlades/cryptoblades | 321 | Vue | kcper | Chriserus | Review this pull request change.
Language: Solidity
File: contracts/cryptoblades.sol
PR Title: SafeRandoms in shields and weapons minting
BEFORE CODE: uint256 convertedAmount = usdToSkill(getMintCharacterFee());
_payContractTokenOnly(msg.sender, convertedAmount);
uint256 seed = randoms.getR... | We should `require(num > 0 && num <= 10)`. If they input anything > 10 they won't be able to mint anything from this seed. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
SafeRandoms(links[LINK_SAFE_RANDOMS]).requestSingleSeed(tx.origin, getSeed(uint(WEAPON_SEED), num, chosenElement));
}
function generateWeaponSeedUsingStakedSkill(uint32 num, uint8 chosenElement) external onlyNonContract oncePerBlock(msg.sender) {
uint8 chosenElementFee = chosenElement == 100 ? ... | Use msg.sender if there's no reason to use tx.origin | .mul(ABDKMath64x64.fromUInt(chosenElementFee));
_payContractConvertedSupportingStaked(msg.sender, usdToSkill(mintWeaponFee));
_updateWeaponMintFee(quantity);
if (eventId > 0) {
specialWeaponsManager.addShards(msg.sender, eventId, quantity);
}
SafeRando... | @@ -517,65 +521,48 @@ contract CryptoBlades is Initializable, AccessControlUpgradeable {
_updateCharacterMintFee();
}
- function mintWeaponN(uint32 num, uint8 chosenElement, uint256 eventId)
- external
- onlyNonContract
- oncePerBlock(msg.sender)
- {
- uint8 chosenEleme... | contracts/cryptoblades.sol | 26 | Solidity | 0.286 | suggestion | 52 | 51 | 51 | false | SafeRandoms in shields and weapons minting | 1,578 | CryptoBlades/cryptoblades | 321 | Vue | kcper | Chriserus | Review this pull request change.
Language: Solidity
File: contracts/cryptoblades.sol
PR Title: SafeRandoms in shields and weapons minting
BEFORE CODE: SafeRandoms(links[LINK_SAFE_RANDOMS]).requestSingleSeed(tx.origin, getSeed(uint(WEAPON_SEED), num, chosenElement));
}
function generateWeaponSeedUsi... | Use msg.sender if there's no reason to use tx.origin | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
_updateCharacterMintFee();
}
function generateWeaponSeed(uint32 num, uint8 chosenElement) external onlyNonContract oncePerBlock(msg.sender) {
uint8 chosenElementFee = chosenElement == 100 ? 1 : 2;
int128 mintWeaponFee =
getMintWeaponFee()
.mul(ABDK... | Use msg.sender if there's no reason to use tx.origin | weapons.mintWeaponWithStars(msg.sender, 0, uint256(keccak256(abi.encodePacked(blockhash(block.number - 1), msg.sender))), 100);
}
_updateCharacterMintFee();
}
function generateWeaponSeed(uint32 quantity, uint8 chosenElement, uint256 eventId) external onlyNonContract oncePerBlock(ms... | @@ -517,65 +521,48 @@ contract CryptoBlades is Initializable, AccessControlUpgradeable {
_updateCharacterMintFee();
}
- function mintWeaponN(uint32 num, uint8 chosenElement, uint256 eventId)
- external
- onlyNonContract
- oncePerBlock(msg.sender)
- {
- uint8 chosenEleme... | contracts/cryptoblades.sol | 26 | Solidity | 0.286 | suggestion | 52 | 51 | 51 | false | SafeRandoms in shields and weapons minting | 1,578 | CryptoBlades/cryptoblades | 321 | Vue | kcper | Chriserus | Review this pull request change.
Language: Solidity
File: contracts/cryptoblades.sol
PR Title: SafeRandoms in shields and weapons minting
BEFORE CODE: }
_updateCharacterMintFee();
}
function generateWeaponSeed(uint32 num, uint8 chosenElement) external onlyNonContract oncePerBlock(msg.sende... | Use msg.sender if there's no reason to use tx.origin | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
);
require(skillToken.balanceOf(msg.sender) >= fromUserWallet && promos.getBit(msg.sender, 4) == false);
uint256 convertedAmount = usdToSkill(getMintCharacterFee());
_payContractTokenOnly(msg.sender, convertedAmount);
uint256 seed = randoms.getRandomSeed(msg.sender);
... | Use msg.sender if there's no reason to use tx.origin | skillAmount
);
require(skillToken.balanceOf(msg.sender) >= fromUserWallet && promos.getBit(msg.sender, 4) == false);
uint256 convertedAmount = usdToSkill(getMintCharacterFee());
_payContractTokenOnly(msg.sender, convertedAmount);
uint256 seed = randoms.getRa... | @@ -517,65 +521,48 @@ contract CryptoBlades is Initializable, AccessControlUpgradeable {
_updateCharacterMintFee();
}
- function mintWeaponN(uint32 num, uint8 chosenElement, uint256 eventId)
- external
- onlyNonContract
- oncePerBlock(msg.sender)
- {
- uint8 chosenEleme... | contracts/cryptoblades.sol | 26 | Solidity | 0.286 | suggestion | 52 | 51 | 51 | false | SafeRandoms in shields and weapons minting | 1,578 | CryptoBlades/cryptoblades | 321 | Vue | kcper | Chriserus | Review this pull request change.
Language: Solidity
File: contracts/cryptoblades.sol
PR Title: SafeRandoms in shields and weapons minting
BEFORE CODE: );
require(skillToken.balanceOf(msg.sender) >= fromUserWallet && promos.getBit(msg.sender, 4) == false);
uint256 convertedAmount = usdTo... | Use msg.sender if there's no reason to use tx.origin | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
specialWeaponsManager.addShards(msg.sender, eventId, quantity);
}
SafeRandoms(links[LINK_SAFE_RANDOMS]).requestSingleSeed(msg.sender, getSeed(uint(WEAPON_SEED), quantity, chosenElement));
claimWeaponData[msg.sender] = uint256(uint256(chosenElement) | (uint256(quantity) << 32));
}... | I think we should require quantity > 0 here so the transaction fails with an error instead of passing and not minting anything while data is = 0. | if (eventId > 0) {
specialWeaponsManager.addShards(msg.sender, eventId, quantity);
}
SafeRandoms(links[LINK_SAFE_RANDOMS]).requestSingleSeed(msg.sender, getSeed(uint(WEAPON_SEED), quantity, chosenElement));
userVars[msg.sender][USERVAR_CLAIM_WEAPON_DATA] = uint256(uint256(cho... | @@ -543,22 +548,21 @@ contract CryptoBlades is Initializable, AccessControlUpgradeable {
.mul(ABDKMath64x64.fromUInt(chosenElementFee));
_payContractStakedOnly(msg.sender, usdToSkill(discountedMintWeaponFee));
_updateWeaponMintFee(quantity);
+ if (eventId > 0) {
+ sp... | contracts/cryptoblades.sol | 26 | Solidity | 0.571 | bug | 145 | 51 | 51 | false | SafeRandoms in shields and weapons minting | 1,578 | CryptoBlades/cryptoblades | 321 | Vue | kcper | Chriserus | Review this pull request change.
Language: Solidity
File: contracts/cryptoblades.sol
PR Title: SafeRandoms in shields and weapons minting
BEFORE CODE: specialWeaponsManager.addShards(msg.sender, eventId, quantity);
}
SafeRandoms(links[LINK_SAFE_RANDOMS]).requestSingleSeed(msg.sender, get... | I think we should require quantity > 0 here so the transaction fails with an error instead of passing and not minting anything while data is = 0. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
mapping(address => MintPayment) mintPayments;
struct MintPaymentSkillDeposited {
uint256 skillDepositedFromWallet;
uint256 skillDepositedFromRewards;
uint256 skillDepositedFromIgo;
uint256 skillRefundableFromWallet;
uint256 skillRefundableFromRewards;
uint256 sk... | I'd prefer not to introduce the claimWeaponData variable.
Technically we can call safeRandoms.hasSingleSeedRequested(msg.sender, seed) to check for that.
There's an external function called "encode" on safeRandoms that takes an array to assemble the seed from different pieces, this way we don't have to make the getSe... |
mapping(address => MintPayment) mintPayments;
struct MintPaymentSkillDeposited {
uint256 skillDepositedFromWallet;
uint256 skillDepositedFromRewards;
uint256 skillDepositedFromIgo;
uint256 skillRefundableFromWallet;
uint256 skillRefundableFromRewards;
uint256 s... | @@ -225,6 +228,8 @@ contract CryptoBlades is Initializable, AccessControlUpgradeable {
mapping(address => mapping(uint256 => uint256)) public userVars;
SpecialWeaponsManager public specialWeaponsManager;
+ mapping(uint256 => address) public links;
+ mapping(address => uint256) public claimWeaponData; | contracts/cryptoblades.sol | 26 | Solidity | 0.5 | suggestion | 396 | 51 | 51 | false | SafeRandoms in shields and weapons minting | 1,578 | CryptoBlades/cryptoblades | 321 | Vue | poshdan | Chriserus | Review this pull request change.
Language: Solidity
File: contracts/cryptoblades.sol
PR Title: SafeRandoms in shields and weapons minting
BEFORE CODE: mapping(address => MintPayment) mintPayments;
struct MintPaymentSkillDeposited {
uint256 skillDepositedFromWallet;
uint256 skillDepositedFro... | I'd prefer not to introduce the claimWeaponData variable.
Technically we can call safeRandoms.hasSingleSeedRequested(msg.sender, seed) to check for that.
There's an external function called "encode" on safeRandoms that takes an array to assemble the seed from different pieces, this way we don't have to make the getSe... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
uint256 skillAmount = usdToSkill(mintCharacterFee);
(,, uint256 fromUserWallet) =
getSkillToSubtract(
0,
tokenRewards[msg.sender],
skillAmount
);
require(skillToken.balanceOf(msg.sender) >= fromUserWallet && promos.getBit(m... | adding
userVars[msg.sender][USERVAR_CLAIM_WEAPON_DATA] == 0
to the require statement here and in the other generate statement would be user friendly, to prevent accidental loss of funds. But in any case this is fine. |
uint256 skillAmount = usdToSkill(mintCharacterFee);
(,, uint256 fromUserWallet) =
getSkillToSubtract(
0,
tokenRewards[msg.sender],
skillAmount
);
require(skillToken.balanceOf(msg.sender) >= fromUserWallet && promos.getBit(m... | @@ -517,65 +522,54 @@ contract CryptoBlades is Initializable, AccessControlUpgradeable {
_updateCharacterMintFee();
}
- function mintWeaponN(uint32 num, uint8 chosenElement, uint256 eventId)
- external
- onlyNonContract
- oncePerBlock(msg.sender)
- {
- uint8 chosenEleme... | contracts/cryptoblades.sol | 26 | Solidity | 0.5 | suggestion | 218 | 51 | 51 | false | SafeRandoms in shields and weapons minting | 1,578 | CryptoBlades/cryptoblades | 321 | Vue | poshdan | Chriserus | Review this pull request change.
Language: Solidity
File: contracts/cryptoblades.sol
PR Title: SafeRandoms in shields and weapons minting
BEFORE CODE:
uint256 skillAmount = usdToSkill(mintCharacterFee);
(,, uint256 fromUserWallet) =
getSkillToSubtract(
0,
... | adding
userVars[msg.sender][USERVAR_CLAIM_WEAPON_DATA] == 0
to the require statement here and in the other generate statement would be user friendly, to prevent accidental loss of funds. But in any case this is fine. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
reforgeWeaponId: {
type: String,
required: false,
default: null
},
},
});
</script>
<style scoped lang="scss">
*{
z-index: 1;
}
@media (max-width: 1185px) {
.blacksmith-nav{
justify-content: center !important;
}
}
@media (min-width: 1186px) {
.blacksmith-nav{
justify-conten... | Can we avoid the !important here?
In this specific case, you could remove the 2nd media query and just assign space-between as the **default.**
Also, we need some space between the lines. Maybe you can add some margins within the media query.
;
</script>
<style scoped lang="scss">
*{
z-index: 1;
}
.blacksmith-nav{
justify-content: space-between;
}
@media (max-width: 1185px) {
.blacksmith-nav{
justify-content: center !important;
}
.forge-buttons{
margin: 5px 0... | @@ -130,6 +134,16 @@ export default Vue.extend({
*{
z-index: 1;
}
+@media (max-width: 1185px) {
+ .blacksmith-nav{
+ justify-content: center !important;
+ }
+}
+@media (min-width: 1186px) {
+ .blacksmith-nav{
+ justify-content: space-between !important;
+ } | frontend/src/components/BlacksmithNav.vue | 26 | Vue | 0.5 | question | 360 | 51 | 51 | false | Background does not fit height | 1,607 | CryptoBlades/cryptoblades | 321 | Vue | kevinunger | jakehein | Review this pull request change.
Language: Vue
File: frontend/src/components/BlacksmithNav.vue
PR Title: Background does not fit height
BEFORE CODE: reforgeWeaponId: {
type: String,
required: false,
default: null
},
},
});
</script>
<style scoped lang="scss">
*{
z-index: 1;
}
@media ... | Can we avoid the !important here?
In this specific case, you could remove the 2nd media query and just assign space-between as the **default.**
Also, we need some space between the lines. Maybe you can add some margins within the media query.

This way we can avoid the media query, which will be invalid if any other component changes | font-family: 'Roboto';
font-size: .75rem;
color: #b4b0a7;
background-color: #151515;
border-color: transparent;
border-radius: 0.2rem;
width: 6rem;
}
.selectFilter:first-of-type {
width: 4rem
}
.noWeaponsOrShields {
display: flex;
margin: 0 auto;
font-family: 'Roboto';
color: #b4b0a7;
font-siz... | @@ -574,6 +574,14 @@ p, li, span {
margin: 0 auto;
justify-content: space-between;
}
+@media all and (max-width: 1057px) {
+ .mainWrapper{
+ flex-direction: column;
+ }
+ .arenaSignup .bottomList ul li{
+ white-space: inherit !important;
+ }
+} | frontend/src/components/smart/PvPArenaPreparation.vue | 26 | Vue | 0.5 | suggestion | 295 | 51 | 51 | false | Background does not fit height | 1,607 | CryptoBlades/cryptoblades | 321 | Vue | kevinunger | jakehein | Review this pull request change.
Language: Vue
File: frontend/src/components/smart/PvPArenaPreparation.vue
PR Title: Background does not fit height
BEFORE CODE: font-family: 'Roboto';
font-size: .75rem;
color: #b4b0a7;
background-color: #151515;
border-color: transparent;
border-radius: 0.2rem;
width:... | Can you try adding flex-wrap:wrap to .mainWrapper and setting a min-width / width to the character image? (currently the image just scales down when the screen gets smaller and the wrapper doesn't wrap)
This way we can avoid the media query, which will be invalid if any other component changes | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
#forge {
content: url("../assets/blacksmith/forge.png");
height: 50px;
width: 50px;
background: rgba(0, 0, 0, 0.076);
}
#salvage {
content: url("../assets/blacksmith/salvage.png");
height: 50px;
width: 50px;
background: rgba(0, 0, 0, 0.076);
}
/* STYLING FOR WEAPON REFORGE */
.content .row .set-norm... | Maybe cover is better here?

|
#forge {
content: url("../assets/blacksmith/forge.png");
height: 50px;
width: 50px;
background: rgba(0, 0, 0, 0.076);
}
#salvage {
content: url("../assets/blacksmith/salvage.png");
height: 50px;
width: 50px;
background: rgba(0, 0, 0, 0.076);
}
/* STYLING FOR WEAPON REFORGE */
.content .row .set-norm... | @@ -1680,10 +1681,10 @@ export default Vue.extend({
.blacksmith-page{
background-image: url('../assets/blacksmith/cb-reforge-bg.jpg');
- background-size: cover;
+ background-size: clamp(100%, 100%, 100%) auto;
background-repeat: no-repeat; | frontend/src/views/Blacksmith.vue | 26 | Vue | 0.429 | suggestion | 143 | 51 | 51 | false | Background does not fit height | 1,607 | CryptoBlades/cryptoblades | 321 | Vue | kevinunger | jakehein | Review this pull request change.
Language: Vue
File: frontend/src/views/Blacksmith.vue
PR Title: Background does not fit height
BEFORE CODE:
#forge {
content: url("../assets/blacksmith/forge.png");
height: 50px;
width: 50px;
background: rgba(0, 0, 0, 0.076);
}
#salvage {
content: url("../assets/blacksmi... | Maybe cover is better here?

| You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
content: url("../assets/blacksmith/forge.png");
height: 50px;
width: 50px;
background: rgba(0, 0, 0, 0.076);
}
#salvage {
content: url("../assets/blacksmith/salvage.png");
height: 50px;
width: 50px;
background: rgba(0, 0, 0, 0.076);
}
/* STYLING FOR WEAPON REFORGE */
.content .row .set-normal{
padd... | rm comment or remove attribute | content: url("../assets/blacksmith/forge.png");
height: 50px;
width: 50px;
background: rgba(0, 0, 0, 0.076);
}
#salvage {
content: url("../assets/blacksmith/salvage.png");
height: 50px;
width: 50px;
background: rgba(0, 0, 0, 0.076);
}
/* STYLING FOR WEAPON REFORGE */
.content .row .set-normal{
padd... | @@ -1680,10 +1681,10 @@ export default Vue.extend({
.blacksmith-page{
background-image: url('../assets/blacksmith/cb-reforge-bg.jpg');
- background-size: cover;
+ background-size: clamp(100%, 100%, 100%) auto;
background-repeat: no-repeat;
background-position: top right;
- min-height: calc(100vh - 120px)... | frontend/src/views/Blacksmith.vue | 26 | Vue | 0.143 | suggestion | 30 | 51 | 51 | false | Background does not fit height | 1,607 | CryptoBlades/cryptoblades | 321 | Vue | kevinunger | jakehein | Review this pull request change.
Language: Vue
File: frontend/src/views/Blacksmith.vue
PR Title: Background does not fit height
BEFORE CODE: content: url("../assets/blacksmith/forge.png");
height: 50px;
width: 50px;
background: rgba(0, 0, 0, 0.076);
}
#salvage {
content: url("../assets/blacksmith/salvage... | rm comment or remove attribute | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
<template>
<div>
<div class="row m-3 justify-content-center">
<h2>{{$t('bridge.bridgeForYourNfts')}}</h2>
</div>
<div class="row m-3 justify-content-center">
<h3>{{$t('bridge.transferNftsToAnotherChain')}}</h3>
</div>
<div class="bridge-transfer-fee row mt-3 justify-content-center">
... | (Optional) This would be a bit better here imo:
```suggestion
<div class="w-100 row mt-3 justify-content-center">
``` | <template>
<div>
<div class="row m-3 justify-content-center">
<h2>{{$t('bridge.bridgeForYourNfts')}}</h2>
</div>
<div class="row m-3 justify-content-center">
<h3>{{$t('bridge.transferNftsToAnotherChain')}}</h3>
</div>
<div class="w-100 row mt-3 justify-content-center">
<p v-if="b... | @@ -6,7 +6,7 @@
<div class="row m-3 justify-content-center">
<h3>{{$t('bridge.transferNftsToAnotherChain')}}</h3>
</div>
- <div class="row mt-3 justify-content-center">
+ <div class="bridge-transfer-fee row mt-3 justify-content-center"> | frontend/src/views/Bridge.vue | 9 | Vue | 0.786 | suggestion | 124 | 34 | 34 | false | Background does not fit height | 1,607 | CryptoBlades/cryptoblades | 321 | Vue | kevinunger | jakehein | Review this pull request change.
Language: Vue
File: frontend/src/views/Bridge.vue
PR Title: Background does not fit height
BEFORE CODE: <template>
<div>
<div class="row m-3 justify-content-center">
<h2>{{$t('bridge.bridgeForYourNfts')}}</h2>
</div>
<div class="row m-3 justify-content-center">
... | (Optional) This would be a bit better here imo:
```suggestion
<div class="w-100 row mt-3 justify-content-center">
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
return !this.currentCharacter;
},
currentTokenPrice(): number {
switch(this.gasToken) {
case 'BNB':
return this.bnbPrice;
case 'HT':
return this.htPrice;
case 'OKT':
return this.oktPrice;
case 'MATIC':
return this.maticPrice;
case 'AVAX'... | Magic numbers, please assign constants explaining what's going on here | return !this.currentCharacter;
},
currentTokenPrice(): number {
switch(this.gasToken) {
case 'BNB':
return this.bnbPrice;
case 'HT':
return this.htPrice;
case 'OKT':
return this.oktPrice;
case 'MATIC':
return this.maticPrice;
case 'AVAX'... | @@ -199,17 +221,28 @@ export default Vue.extend({
return this.oktPrice;
case 'MATIC':
return this.maticPrice;
+ case 'AVAX':
+ return this.avaxPrice;
+ case 'aETH':
+ return this.auroraPrice;
+ case 'SFUEL':
+ return this.skalePrice;
default:
... | frontend/src/components/smart/EarningsCalculator.vue | 26 | Vue | 0.214 | suggestion | 70 | 51 | 51 | false | Earnings calc | 1,612 | CryptoBlades/cryptoblades | 321 | Vue | Chriserus | kcper | Review this pull request change.
Language: Vue
File: frontend/src/components/smart/EarningsCalculator.vue
PR Title: Earnings calc
BEFORE CODE: return !this.currentCharacter;
},
currentTokenPrice(): number {
switch(this.gasToken) {
case 'BNB':
return this.bnbPrice;
case 'HT':... | Magic numbers, please assign constants explaining what's going on here | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
getMaxRoll(stars: number): number {
switch(stars) {
case 1: return 200;
case 2: return 300;
default: return 400;
}
},
async fetchPricesAndFees() {
await this.fetchPrices();
this.fightFeePercentage = +await this.getCombatTokenChargePercent();
this.currentMulti... | Same here, why isn't it a string as other values?
| },
getMaxRoll(stars: number): number {
switch(stars) {
case 1: return 200;
case 2: return 300;
default: return 400;
}
},
async fetchPricesAndFees() {
await this.fetchPrices();
this.fightFeePercentage = +await this.getCombatTokenChargePercent();
this.curr... | @@ -287,17 +334,26 @@ export default Vue.extend({
}
},
+ async fetchPricesAndFees() {
+ await this.fetchPrices();
+ this.fightFeePercentage = +await this.getCombatTokenChargePercent();
+ this.currentMultiplier = +(+(await this.getCurrentBestMultiplier()/1e18).toFixed(4));
+ },
+
... | frontend/src/components/smart/EarningsCalculator.vue | 26 | Vue | 0.071 | question | 51 | 51 | 51 | false | Earnings calc | 1,612 | CryptoBlades/cryptoblades | 321 | Vue | Chriserus | kcper | Review this pull request change.
Language: Vue
File: frontend/src/components/smart/EarningsCalculator.vue
PR Title: Earnings calc
BEFORE CODE: getMaxRoll(stars: number): number {
switch(stars) {
case 1: return 200;
case 2: return 300;
default: return 400;
}
},
async fetchP... | Same here, why isn't it a string as other values?
| You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
<template>
<div class="blank-slate" v-if="ownedCharacterIds.length <= 0">
<div v-if="ownedCharacterIds.length <= 0">
{{$t('quests.youNeedToHaveAtLeastOneCharacterRaid')}}<br>
{{ $t('combat.recruitAtPlaza') }}
</div>
</div>
<div v-else class="main-font">
<div style="display:inline-flex;">
... | https://html.spec.whatwg.org/multipage/syntax.html#elements-2 | <template>
<div class="blank-slate" v-if="ownedCharacterIds.length <= 0">
<div v-if="ownedCharacterIds.length <= 0">
{{$t('quests.youNeedToHaveAtLeastOneCharacterRaid')}}<br>
{{ $t('combat.recruitAtPlaza') }}
</div>
</div>
<div v-else class="main-font">
<div style="display:inline-flex;">
... | @@ -23,7 +23,7 @@
<div class="boss-name">
<div>
<div class="elements">
- <div class="frame-element">.</div>
+ <div class="frame-element"/> | frontend/src/views/Raid.vue | 26 | Vue | 0.214 | suggestion | 61 | 51 | 51 | false | Fix refreshes after joining raid, unselect weapon | 1,634 | CryptoBlades/cryptoblades | 321 | Vue | kevinunger | Chriserus | Review this pull request change.
Language: Vue
File: frontend/src/views/Raid.vue
PR Title: Fix refreshes after joining raid, unselect weapon
BEFORE CODE: <template>
<div class="blank-slate" v-if="ownedCharacterIds.length <= 0">
<div v-if="ownedCharacterIds.length <= 0">
{{$t('quests.youNeedToHaveAtLeast... | https://html.spec.whatwg.org/multipage/syntax.html#elements-2 | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
<template>
<div class="p-1">
<h2>{{ $t('admin.skill.transferSkill') }}</h2>
<div class="d-flex flex-column gap-2 m">
<div class="d-flex align-items-center gap-3">
<b-form-input v-model="transferModel.sourceWallet" :placeholder="$t('admin.skill.sourceWalletAddress')"/>
... | Some weird formatting happened here (indentation) | <template>
<div class="p-1">
<h2>{{ $t('admin.skill.transferSkill') }}</h2>
<div class="d-flex flex-column gap-2 m">
<div class="d-flex align-items-center gap-3">
<b-form-input v-model="transferModel.sourceWallet" :placeholder="$t('admin.skill.sourceWalletAddress')"/>
... | @@ -0,0 +1,103 @@
+<template>
+ <div class="p-1">
+ <h2>{{ $t('admin.skill.transferSkill') }}</h2>
+ <div class="d-flex flex-column gap-2 m">
+ <div class="d-flex align-items-center gap-3">
+ <b-form-input v-model="transferModel.sourceWallet" :placeholder="$t('admin.skill.sourceWall... | frontend/src/components/smart/AdminTabs/SkillAdmin.vue | 18 | Vue | 0.071 | style | 49 | 43 | 43 | false | Able to transfer skill from deployer wallet to skill | 1,890 | CryptoBlades/cryptoblades | 321 | Vue | Chriserus | jeffyzxc | Review this pull request change.
Language: Vue
File: frontend/src/components/smart/AdminTabs/SkillAdmin.vue
PR Title: Able to transfer skill from deployer wallet to skill
BEFORE CODE: <template>
<div class="p-1">
<h2>{{ $t('admin.skill.transferSkill') }}</h2>
<div class="d-flex flex-column gap-2... | Some weird formatting happened here (indentation) | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
|| !isValidWeb3Address(this.transferModel.sourceWallet || ''))
|| this.skillAllowance < this.transferModel.amount
|| this.transferModel.amount <= 0;
}
},
methods: {
...mapActions([
'approveSkillTransfer',
'transferSkill',
'getSkillAllowance',
'fetchSkillBalan... | Please move this to `finally` block, because this line won't be executed if an error occurs on line `79` or `82`, always disable loading state in `finally` block | return (!isValidWeb3Address(this.transferModel.receiverAddress || '')
|| !isValidWeb3Address(this.transferModel.sourceWallet || ''))
|| this.skillAllowance < this.transferModel.amount
|| this.transferModel.amount <= 0;
}
},
methods: {
...mapActions([
'approveSkillTransfer... | @@ -0,0 +1,103 @@
+<template>
+ <div class="p-1">
+ <h2>{{ $t('admin.skill.transferSkill') }}</h2>
+ <div class="d-flex flex-column gap-2 m">
+ <div class="d-flex align-items-center gap-3">
+ <b-form-input v-model="transferModel.sourceWallet" :placeholder="$t('admin.skill.sourceWall... | frontend/src/components/smart/AdminTabs/SkillAdmin.vue | 26 | Vue | 0.714 | refactor | 161 | 41 | 42 | false | Able to transfer skill from deployer wallet to skill | 1,890 | CryptoBlades/cryptoblades | 321 | Vue | Chriserus | jeffyzxc | Review this pull request change.
Language: Vue
File: frontend/src/components/smart/AdminTabs/SkillAdmin.vue
PR Title: Able to transfer skill from deployer wallet to skill
BEFORE CODE: || !isValidWeb3Address(this.transferModel.sourceWallet || ''))
|| this.skillAllowance < this.transferModel.amount
... | Please move this to `finally` block, because this line won't be executed if an error occurs on line `79` or `82`, always disable loading state in `finally` block | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
<div class="deposit-withdraw border-line-custom px-2" v-if="hasBnbAvailableToWithdraw">
<span>|</span>
</div>
<div>
<div class="mx-3" v-if="hasBnbAvailableToWithdraw">
<b-icon-diamond-half scale="1.2"
:class="canWithdrawBnb ? 'pointer' : null"
... | Please don't use inline styles whenever possible, best do a class and use a css class here. Also, did you check if it's responsive? Does it look ok on mobile? | <div class="deposit-withdraw border-line-custom px-2" v-if="hasBnbAvailableToWithdraw">
<span>|</span>
</div>
<div>
<div class="mx-3" v-if="hasBnbAvailableToWithdraw">
<b-icon-diamond-half scale="1.2"
:class="canWithdrawBnb ? 'pointer' : null"
... | @@ -109,6 +109,31 @@
</div>
</div>
</div>
+ <b-modal
+ class="centered-modal"
+ ref="minting-sfuel-modal"
+ hide-footer
+ hide-header
+ hide-header-close
+ no-close-on-backdrop
+ no-close-on-esc
+ centered
+ >
+ <div class="text-center">
+ <... | frontend/src/components/smart/SkillBalanceDisplay.vue | 26 | Vue | 0.429 | question | 158 | 51 | 51 | false | Added ability to mint sfuel | 1,897 | CryptoBlades/cryptoblades | 321 | Vue | Chriserus | jeffyzxc | Review this pull request change.
Language: Vue
File: frontend/src/components/smart/SkillBalanceDisplay.vue
PR Title: Added ability to mint sfuel
BEFORE CODE: <div class="deposit-withdraw border-line-custom px-2" v-if="hasBnbAvailableToWithdraw">
<span>|</span>
</div>
<div>
<div cla... | Please don't use inline styles whenever possible, best do a class and use a css class here. Also, did you check if it's responsive? Does it look ok on mobile? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
<span>|</span>
</div>
<div>
<div class="mx-3" v-if="hasBnbAvailableToWithdraw">
<b-icon-diamond-half scale="1.2"
:class="canWithdrawBnb ? 'pointer' : null"
:variant="canWithdrawBnb ? 'success' : 'warning'"
... | I think that `Loading...` is also in our translation keys | <span>|</span>
</div>
<div>
<div class="mx-3" v-if="hasBnbAvailableToWithdraw">
<b-icon-diamond-half scale="1.2"
:class="canWithdrawBnb ? 'pointer' : null"
:variant="canWithdrawBnb ? 'success' : 'warning'"
... | @@ -109,6 +109,31 @@
</div>
</div>
</div>
+ <b-modal
+ class="centered-modal"
+ ref="minting-sfuel-modal"
+ hide-footer
+ hide-header
+ hide-header-close
+ no-close-on-backdrop
+ no-close-on-esc
+ centered
+ >
+ <div class="text-center">
+ <... | frontend/src/components/smart/SkillBalanceDisplay.vue | 26 | Vue | 0.357 | suggestion | 57 | 51 | 51 | false | Added ability to mint sfuel | 1,897 | CryptoBlades/cryptoblades | 321 | Vue | Chriserus | jeffyzxc | Review this pull request change.
Language: Vue
File: frontend/src/components/smart/SkillBalanceDisplay.vue
PR Title: Added ability to mint sfuel
BEFORE CODE: <span>|</span>
</div>
<div>
<div class="mx-3" v-if="hasBnbAvailableToWithdraw">
<b-icon-diamond-half scale="1.2"
... | I think that `Loading...` is also in our translation keys | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
</div>
<div class="mobile">
<div class="active-tab"> <span class="forge-icons"></span></div>
<div> <span class="enchant-icons"></span></div>
<div> <span class="skin-icons"></span></div>
<div> <span class="upgrade-icons"></span><... | Imo it would be nice to extract these "magic numbers" to some constants, even in this file, just for the sake of clean code | </div>
<div class="mobile">
<div class="active-tab"> <span class="forge-icons"></span></div>
<div> <span class="enchant-icons"></span></div>
<div> <span class="skin-icons"></span></div>
<div> <span class="upgrade-icons"></span><... | @@ -372,11 +372,11 @@
</div>
</div>
<div>
- <input v-model="lesserDust" type="range" min="0" :max="getLesserDust()" value="0" steps="1">
+ <input v-model="lesserDust" type="range" min="0" :max="100" value="0" steps="1"> | frontend/src/views/Blacksmith.vue | 26 | Vue | 0.429 | refactor | 123 | 51 | 51 | false | Fix the LB/4B & 5B dusting reforge slider max values. | 1,903 | CryptoBlades/cryptoblades | 321 | Vue | Chriserus | Steart | Review this pull request change.
Language: Vue
File: frontend/src/views/Blacksmith.vue
PR Title: Fix the LB/4B & 5B dusting reforge slider max values.
BEFORE CODE: </div>
<div class="mobile">
<div class="active-tab"> <span class="forge-icons"></span></div>
... | Imo it would be nice to extract these "magic numbers" to some constants, even in this file, just for the sake of clean code | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
game = CryptoBlades(gameContract);
combatTokenChargePercent = 25;
offsetSlippage = 5;
}
receive() external payable restricted {}
function fight(
uint256 char,
uint32 target,
uint8 fightMultiplier
) external payable {
uint256 totalTokens;
... | I think this comment is outdated |
game = CryptoBlades(gameContract);
combatTokenChargePercent = 25;
offsetSlippage = 5;
}
receive() external payable restricted {}
function teamFight(
uint256[] calldata char,
uint32[] calldata target,
uint8[] calldata fightMultiplier
) external payable {... | @@ -39,25 +37,73 @@ contract TokensManager is Initializable, AccessControlUpgradeable {
offsetSlippage = 5;
}
- receive() external payable restricted {
- }
+ receive() external payable restricted {}
+
+ function fight(
+ uint256 char,
+ uint32 target,
+ uint8 fightMultip... | contracts/TokensManager.sol | 26 | Solidity | 0.071 | suggestion | 32 | 51 | 51 | false | Solving issue #1905: Aggregate Fights into a single txn to reduce gas… | 1,906 | CryptoBlades/cryptoblades | 321 | Vue | Chriserus | NindoK | Review this pull request change.
Language: Solidity
File: contracts/TokensManager.sol
PR Title: Solving issue #1905: Aggregate Fights into a single txn to reduce gas…
BEFORE CODE:
game = CryptoBlades(gameContract);
combatTokenChargePercent = 25;
offsetSlippage = 5;
}
receive() exte... | I think this comment is outdated | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
_;
}
function _restricted() internal view {
require(hasRole(GAME_ADMIN, msg.sender));
}
function initialize(address gameContract) public initializer {
__AccessControl_init_unchained();
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
game = CryptoBlades(gameContract... | `char.length`? was this ever compiled? `char` is a uint, so, a number | _;
}
function _restricted() internal view {
require(hasRole(GAME_ADMIN, msg.sender));
}
function initialize(address gameContract) public initializer {
__AccessControl_init_unchained();
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
game = CryptoBlades(gameContract... | @@ -39,25 +37,73 @@ contract TokensManager is Initializable, AccessControlUpgradeable {
offsetSlippage = 5;
}
- receive() external payable restricted {
- }
+ receive() external payable restricted {}
+
+ function fight(
+ uint256 char,
+ uint32 target,
+ uint8 fightMultip... | contracts/TokensManager.sol | 26 | Solidity | 0.357 | suggestion | 69 | 51 | 51 | false | Solving issue #1905: Aggregate Fights into a single txn to reduce gas… | 1,906 | CryptoBlades/cryptoblades | 321 | Vue | Chriserus | NindoK | Review this pull request change.
Language: Solidity
File: contracts/TokensManager.sol
PR Title: Solving issue #1905: Aggregate Fights into a single txn to reduce gas…
BEFORE CODE: _;
}
function _restricted() internal view {
require(hasRole(GAME_ADMIN, msg.sender));
}
function initi... | `char.length`? was this ever compiled? `char` is a uint, so, a number | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
const { upgradeProxy } = require('@openzeppelin/truffle-upgrades');
const Weapons = artifacts.require("Weapons");
module.exports = async function (deployer) {
await upgradeProxy(Weapons.address, Weapons, { deployer });
};
| No issues found. | const { upgradeProxy } = require('@openzeppelin/truffle-upgrades');
const Weapons = artifacts.require("Weapons");
module.exports = async function (deployer) {
await upgradeProxy(Weapons.address, Weapons, { deployer });
};
| @@ -0,0 +1,7 @@
+const { upgradeProxy } = require('@openzeppelin/truffle-upgrades');
+
+const Weapons = artifacts.require("Weapons");
+
+module.exports = async function (deployer) {
+ await upgradeProxy(Weapons.address, Weapons, { deployer });
+}; | migrations/39_TBD_bonus_on_reforging_reforged.js | 0 | JavaScript | 1 | none | 16 | 8 | 8 | true | reforging reforged items should give a reduced bonus to the new item | 145 | CryptoBlades/cryptoblades | 321 | Vue | kcper | Review this pull request change.
Language: JavaScript
File: migrations/39_TBD_bonus_on_reforging_reforged.js
PR Title: reforging reforged items should give a reduced bonus to the new item
BEFORE CODE: const { upgradeProxy } = require('@openzeppelin/truffle-upgrades');
const Weapons = artifacts.require("Weapons");
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
} as Data;
},
computed: {
...(mapState([
'defaultAccount', 'weapons', 'characters', 'ownedCharacterIds', 'ownedWeaponIds'
]) as Accessors<StoreMappedState>),
...(mapGetters([
'contracts'
]) as Accessors<StoreMappedGetters>),
...mapGetters(['transferCooldownOfWeaponId', 'transfer... | No issues found. | } as Data;
},
computed: {
...(mapState([
'defaultAccount', 'weapons', 'characters', 'ownedCharacterIds', 'ownedWeaponIds'
]) as Accessors<StoreMappedState>),
...(mapGetters([
'contracts'
]) as Accessors<StoreMappedGetters>),
...mapGetters(['transferCooldownOfWeaponId', 'transfer... | @@ -2,7 +2,7 @@
<div class="body main-font">
<b-tabs justified>
- <b-tab @click="clearData()">
+ <b-tab @click="clearData();browseTabActive = true">
<template #title>
Browse NFTs
<hint class="hint" text="NFT stands for Non Fungible Token.<br>Weapons and Characters are ... | frontend/src/views/Market.vue | 0 | Vue | 1 | none | 16 | 51 | 51 | true | market pagination | 155 | CryptoBlades/cryptoblades | 321 | Vue | kcper | Review this pull request change.
Language: Vue
File: frontend/src/views/Market.vue
PR Title: market pagination
BEFORE CODE: } as Data;
},
computed: {
...(mapState([
'defaultAccount', 'weapons', 'characters', 'ownedCharacterIds', 'ownedWeaponIds'
]) as Accessors<StoreMappedState>),
...(map... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
SkillToken,
state.defaultAccount,
state.skillRewards,
defaultCallOptions(state),
defaultCallOptions(state),
cryptoBladesMethods => cryptoBladesMethods.mintWeaponFee(),
{ feeMultiplier: num * 4 * chosenElementFee, allowInGameOnlyFunds: t... | No issues found. | SkillToken,
state.defaultAccount,
state.skillRewards,
defaultCallOptions(state),
defaultCallOptions(state),
cryptoBladesMethods => cryptoBladesMethods.mintWeaponFee(),
{ feeMultiplier: num * 4 * chosenElementFee, allowInGameOnlyFunds: t... | @@ -2089,6 +2089,19 @@ export function createStore(web3: Web3) {
.call(defaultCallOptions(state));
},
+ async fetchMarketNftTargetBuyer({ state }, { nftContractAddr, tokenId }) {
+ const { NFTMarket } = state.contracts();
+ if(!NFTMarket) return;
+
+ // returns the listing'... | frontend/src/store.ts | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | Allow private trades on market | 194 | CryptoBlades/cryptoblades | 321 | Vue | kcper | Review this pull request change.
Language: TypeScript
File: frontend/src/store.ts
PR Title: Allow private trades on market
BEFORE CODE: SkillToken,
state.defaultAccount,
state.skillRewards,
defaultCallOptions(state),
defaultCallOptions(state),
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
const { CryptoBlades } = state.contracts();
if(!CryptoBlades || !state.defaultAccount) return;
const inGameOnlyFunds = await CryptoBlades.methods
.inGameOnlyFunds(state.defaultAccount)
.call(defaultCallOptions(state));
const payload: Pick<IState, 'inGameOnlyFunds'> ... | No issues found. | const { CryptoBlades } = state.contracts();
if(!CryptoBlades || !state.defaultAccount) return;
const inGameOnlyFunds = await CryptoBlades.methods
.inGameOnlyFunds(state.defaultAccount)
.call(defaultCallOptions(state));
const payload: Pick<IState, 'inGameOnlyFunds'> ... | @@ -115,7 +115,6 @@ export function createStore(web3: Web3) {
targetsByCharacterIdAndWeaponId: {},
characterTransferCooldowns: {},
- weaponTransferCooldowns: {},
staking: {
skill: { ...defaultStakeState },
@@ -249,20 +248,6 @@ export function createStore(web3: Web3) {
};
... | frontend/src/store.ts | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | Remove transfer cooldown from weapons | 298 | CryptoBlades/cryptoblades | 321 | Vue | brian-man | Review this pull request change.
Language: TypeScript
File: frontend/src/store.ts
PR Title: Remove transfer cooldown from weapons
BEFORE CODE: const { CryptoBlades } = state.contracts();
if(!CryptoBlades || !state.defaultAccount) return;
const inGameOnlyFunds = await CryptoBlades.methods
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
return `${new BN(skillBalance).toFixed(4)} SKILL`;
},
formattedSkillBalance(): string {
const skillBalance = Web3.utils.fromWei(this.skillBalance, 'ether');
return `${new BN(skillBalance).toFixed(4)} SKILL`;
},
hasBnbAvailableToWithdraw(): boolean {
return new BN(this.waxBridge... | No issues found. | return `${new BN(skillBalance).toFixed(4)} SKILL`;
},
formattedSkillBalance(): string {
const skillBalance = Web3.utils.fromWei(this.skillBalance, 'ether');
return `${new BN(skillBalance).toFixed(4)} SKILL`;
},
hasBnbAvailableToWithdraw(): boolean {
return new BN(this.waxBridge... | @@ -6,8 +6,13 @@
</div>
<div class="balance-container">
- <strong class="mr-2 balance-text">Balance</strong>
- <span class="balance">{{ formattedSkillBalance }}</span>
+ <strong class="mr-2 balance-text">Total Balance</strong>
+ <span class="balance"
+ v-tooltip="{ content: totalS... | frontend/src/components/smart/SkillBalanceDisplay.vue | 0 | Vue | 1 | none | 16 | 51 | 51 | true | 236-navbar-clean-up | 304 | CryptoBlades/cryptoblades | 321 | Vue | bilbolPrime | Review this pull request change.
Language: Vue
File: frontend/src/components/smart/SkillBalanceDisplay.vue
PR Title: 236-navbar-clean-up
BEFORE CODE: return `${new BN(skillBalance).toFixed(4)} SKILL`;
},
formattedSkillBalance(): string {
const skillBalance = Web3.utils.fromWei(this.skillBalance... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
: this.Characters.options.address;
},
buyableNftSelected(): boolean {
return this.selectedNftId !== null
&& !this.searchResultsOwned;
},
ownListedNftSelected(): boolean {
return this.selectedNftId !== null
&& this.searchResultsOwned;
},
selectedNftOnCooldow... | No issues found. | : this.Characters.options.address;
},
buyableNftSelected(): boolean {
return this.selectedNftId !== null
&& !this.searchResultsOwned;
},
ownListedNftSelected(): boolean {
return this.selectedNftId !== null
&& this.searchResultsOwned;
},
selectedNftOnCooldow... | @@ -674,6 +674,7 @@ export default Vue.extend({
this.activeType = 'character';
this.marketOutcome = null;
this.waitingMarketOutcome = true;
+ this.currentPage = page + 1;
const url = new URL('https://api.cryptoblades.io/static/market/character');
const params = {
@@ -706,6 +707... | frontend/src/views/Market.vue | 0 | Vue | 1 | none | 16 | 51 | 51 | true | fix(selectors): pagination should work correctly for all cases | 364 | CryptoBlades/cryptoblades | 321 | Vue | pohika | Review this pull request change.
Language: Vue
File: frontend/src/views/Market.vue
PR Title: fix(selectors): pagination should work correctly for all cases
BEFORE CODE: : this.Characters.options.address;
},
buyableNftSelected(): boolean {
return this.selectedNftId !== null
&& !this.se... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
export const raid = ['1', 'true', 't'].includes((process.env.VUE_APP_FEATURE_FLAG_RAID + '').toLowerCase());
export const stakeOnly = ['1', 'true', 't'].includes((process.env.VUE_APP_STAKING_ONLY + '').toLowerCase());
export const reforging = ['1', 'true', 't'].includes((process.env.VUE_APP_FEATURE_FLAG_REFORGING + '... | No issues found. | export const raid = ['1', 'true', 't'].includes((process.env.VUE_APP_FEATURE_FLAG_RAID + '').toLowerCase());
export const stakeOnly = ['1', 'true', 't'].includes((process.env.VUE_APP_STAKING_ONLY + '').toLowerCase());
export const reforging = ['1', 'true', 't'].includes((process.env.VUE_APP_FEATURE_FLAG_REFORGING + '... | @@ -6,4 +6,6 @@ export const reforging = ['1', 'true', 't'].includes((process.env.VUE_APP_FEATUR
export const market = ['1', 'true', 't'].includes((process.env.VUE_APP_FEATURE_FLAG_MARKET + '').toLowerCase());
+export const market_blockchain = ['1', 'true', 't'].includes((process.env.VUE_APP_FEATURE_FLAG_MARKET_US... | frontend/src/feature-flags.ts | 0 | TypeScript | 1 | none | 16 | 11 | 11 | true | feat(localdevelopment): can now use blockchain for local dev market testing | 369 | CryptoBlades/cryptoblades | 321 | Vue | bilbolPrime | Review this pull request change.
Language: TypeScript
File: frontend/src/feature-flags.ts
PR Title: feat(localdevelopment): can now use blockchain for local dev market testing
BEFORE CODE: export const raid = ['1', 'true', 't'].includes((process.env.VUE_APP_FEATURE_FLAG_RAID + '').toLowerCase());
export const stak... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
const { upgradeProxy } = require('@openzeppelin/truffle-upgrades');
const CryptoBlades = artifacts.require("CryptoBlades");
const Characters = artifacts.require("Characters");
module.exports = async function (deployer, network, accounts) {
await upgradeProxy(CryptoBlades.address, CryptoBlades, { deployer });
con... | No issues found. | const { upgradeProxy } = require('@openzeppelin/truffle-upgrades');
const CryptoBlades = artifacts.require("CryptoBlades");
const Characters = artifacts.require("Characters");
module.exports = async function (deployer, network, accounts) {
await upgradeProxy(CryptoBlades.address, CryptoBlades, { deployer });
con... | @@ -0,0 +1,11 @@
+const { upgradeProxy } = require('@openzeppelin/truffle-upgrades');
+
+const CryptoBlades = artifacts.require("CryptoBlades");
+const Characters = artifacts.require("Characters");
+
+module.exports = async function (deployer, network, accounts) {
+ await upgradeProxy(CryptoBlades.address, CryptoBlade... | migrations/48_TBD_move_chara_limit.js | 0 | JavaScript | 1 | none | 16 | 12 | 12 | true | PVE008: Move characterLimit member from cryptoblades.sol to characters.sol | 389 | CryptoBlades/cryptoblades | 321 | Vue | brian-man | Review this pull request change.
Language: JavaScript
File: migrations/48_TBD_move_chara_limit.js
PR Title: PVE008: Move characterLimit member from cryptoblades.sol to characters.sol
BEFORE CODE: const { upgradeProxy } = require('@openzeppelin/truffle-upgrades');
const CryptoBlades = artifacts.require("CryptoBlade... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
// we drain ~12h of stamina from the character
// we may want to have a specific lockout in the future
characters.setStaminaTimestamp(characterID, uint64(now + (staminaDrain)));
// TODO fix raids
int128 traitMultiplier = 0;/*game.getPlayerTraitBonusAgainst(
characters... | No issues found. | // we drain ~12h of stamina from the character
// we may want to have a specific lockout in the future
characters.setStaminaTimestamp(characterID, uint64(now + (staminaDrain)));
// TODO fix raids
int128 traitMultiplier = 0;/*game.getPlayerTraitBonusAgainst(
characters... | @@ -68,7 +68,7 @@ contract RaidBasic is Initializable, Raid {
for(uint i = 0; i < weaponDrops.length; i++) {
Raider memory r = raiders[RandomUtil.randomSeededMinMax(0, raiders.length-1, RandomUtil.combineSeeds(seed,i))];
game.approveContractWeaponFor(weaponDrops[i], address(this));
- ... | contracts/raidBasic.sol | 0 | Solidity | 1 | none | 16 | 51 | 51 | true | PVE003: Use safeTransferFrom instead of transfer and transferFrom | 391 | CryptoBlades/cryptoblades | 321 | Vue | brian-man | Review this pull request change.
Language: Solidity
File: contracts/raidBasic.sol
PR Title: PVE003: Use safeTransferFrom instead of transfer and transferFrom
BEFORE CODE: // we drain ~12h of stamina from the character
// we may want to have a specific lockout in the future
characters.setStam... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
uint256 counter = 0;
uint8 tokenIterator = 0;
for (uint256 i = 0; i < set.length() && counter < pageEnd; i++) {
uint8 characterTrait = characters.getTrait(set.at(i));
uint8 characterLevel = characters.getLevel(set.at(i));
if((_trait == 255 || characterTrait =... | No issues found. | uint256 counter = 0;
uint8 tokenIterator = 0;
for (uint256 i = 0; i < set.length() && counter < pageEnd; i++) {
uint8 characterTrait = characters.getTrait(set.at(i));
uint8 characterLevel = characters.getLevel(set.at(i));
if((_trait == 255 || characterTrait =... | @@ -3,12 +3,12 @@ pragma solidity ^0.6.0;
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol";
-import "../node_modules/@openzep... | contracts/NFTMarket.sol | 0 | Solidity | 1 | none | 16 | 51 | 51 | true | Simplify imports in contrats\*.sol | 392 | CryptoBlades/cryptoblades | 321 | Vue | brian-man | Review this pull request change.
Language: Solidity
File: contracts/NFTMarket.sol
PR Title: Simplify imports in contrats\*.sol
BEFORE CODE: uint256 counter = 0;
uint8 tokenIterator = 0;
for (uint256 i = 0; i < set.length() && counter < pageEnd; i++) {
uint8 characterTrait = chara... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
const { upgradeProxy } = require('@openzeppelin/truffle-upgrades');
const SkillStakingRewardsUpgradeable = artifacts.require("SkillStakingRewardsUpgradeable");
const LPStakingRewardsUpgradeable = artifacts.require("LPStakingRewardsUpgradeable");
const LP2StakingRewardsUpgradeable = artifacts.require("LP2StakingRewards... | No issues found. | const { upgradeProxy } = require('@openzeppelin/truffle-upgrades');
const SkillStakingRewardsUpgradeable = artifacts.require("SkillStakingRewardsUpgradeable");
const LPStakingRewardsUpgradeable = artifacts.require("LPStakingRewardsUpgradeable");
const LP2StakingRewardsUpgradeable = artifacts.require("LP2StakingRewards... | @@ -0,0 +1,20 @@
+const { upgradeProxy } = require('@openzeppelin/truffle-upgrades');
+
+const SkillStakingRewardsUpgradeable = artifacts.require("SkillStakingRewardsUpgradeable");
+const LPStakingRewardsUpgradeable = artifacts.require("LPStakingRewardsUpgradeable");
+const LP2StakingRewardsUpgradeable = artifacts.requ... | migrations/48_TBD_minimum_stake_amount.js | 0 | JavaScript | 1 | none | 16 | 21 | 21 | true | PVE001: Add minimumStakeAmount to staking contracts | 396 | CryptoBlades/cryptoblades | 321 | Vue | brian-man | Review this pull request change.
Language: JavaScript
File: migrations/48_TBD_minimum_stake_amount.js
PR Title: PVE001: Add minimumStakeAmount to staking contracts
BEFORE CODE: const { upgradeProxy } = require('@openzeppelin/truffle-upgrades');
const SkillStakingRewardsUpgradeable = artifacts.require("SkillStaking... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
items = items.filter(x => x.traitName.includes(this.elementFilter));
}
if(this.levelFilter) {
items = items.filter(x => x.level >= this.levelFilter - 1 && x.level <= this.levelFilter + 8);
}
if(this.showLimit > 0 && items.length > this.showLimit) {
items =... | No issues found. | items = items.filter(x => x.traitName.includes(this.elementFilter));
}
if(this.levelFilter) {
items = items.filter(x => x.level >= this.levelFilter - 1 && x.level <= this.levelFilter + 8);
}
if(this.showLimit > 0 && items.length > this.showLimit) {
items =... | @@ -42,6 +42,7 @@
<div class="above-wrapper" v-if="$slots.above || $scopedSlots.above">
<slot name="above" :character="c"></slot>
</div>
+ <slot name="sold" :character="c"></slot>
<div class="art">
<CharacterArt :character="c" :isMarket="isMarket"/>
</div... | frontend/src/components/smart/CharacterList.vue | 0 | Vue | 1 | none | 16 | 51 | 51 | true | feat(market): show sold banners over items that are sold but not removed from the DB yet | 409 | CryptoBlades/cryptoblades | 321 | Vue | viruspowaa | Review this pull request change.
Language: Vue
File: frontend/src/components/smart/CharacterList.vue
PR Title: feat(market): show sold banners over items that are sold but not removed from the DB yet
BEFORE CODE: items = items.filter(x => x.traitName.includes(this.elementFilter));
}
if(th... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
/* ========== CONSTANTS ========== */
bytes32 public constant GAME = keccak256("GAME");
/* ========== STATE VARIABLES ========== */
Weapons public weapons;
IRandoms public randoms;
mapping(address => uint32) public tickets;
/* ========== INITIALIZERS AND MIGRATORS ========== */
fun... | No issues found. | /* ========== CONSTANTS ========== */
bytes32 public constant GAME = keccak256("GAME");
/* ========== STATE VARIABLES ========== */
Weapons public weapons;
IRandoms public randoms;
mapping(address => uint32) public tickets;
/* ========== INITIALIZERS AND MIGRATORS ========== */
fun... | @@ -0,0 +1,65 @@
+pragma solidity ^0.6.5;
+
+import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
+import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
+import "./interfaces/IRandoms.sol";
+import "./weapons.sol";
+
+contract Blacksmith is Initializable, AccessControlUpgrad... | contracts/Blacksmith.sol | 0 | Solidity | 1 | none | 16 | 51 | 51 | true | Get a free Weapon Forge if you win an Unlikely fight | 494 | CryptoBlades/cryptoblades | 321 | Vue | procart | Review this pull request change.
Language: Solidity
File: contracts/Blacksmith.sol
PR Title: Get a free Weapon Forge if you win an Unlikely fight
BEFORE CODE: /* ========== CONSTANTS ========== */
bytes32 public constant GAME = keccak256("GAME");
/* ========== STATE VARIABLES ========== */
Weapon... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
disableForge: false,
forgeMultiplier: 10,
newForged: [],
currentListofWeapons: [],
x10Forge: false,
x1Forge: false,
onError: false,
spin: false,
};
},
computed: {
...mapState(['defaultAccount','ownedWeaponIds']),
...mapGetters(['contracts', 'ownWeapons'])... | No issues found. | disableForge: false,
forgeMultiplier: 10,
newForged: [],
currentListofWeapons: [],
x10Forge: false,
x1Forge: false,
onError: false,
spin: false,
};
},
computed: {
...mapState(['defaultAccount','ownedWeaponIds']),
...mapGetters(['contracts', 'ownWeapons'])... | @@ -40,7 +40,22 @@
</span>
<span v-if="!disableForge" class="gtag-link-others" tagname="forge_weapon">
- Forge ({{ forgeCost }} SKILL) <i class="fas fa-plus"></i>
+ Forge x1 ({{ forgeCost }} SKILL) <i class="fas fa-plus"></i>
+ </span>
+ ... | frontend/src/views/Blacksmith.vue | 0 | Vue | 1 | none | 16 | 51 | 51 | true | Add fuction to mint N amount of weapons | 539 | CryptoBlades/cryptoblades | 321 | Vue | procart | Review this pull request change.
Language: Vue
File: frontend/src/views/Blacksmith.vue
PR Title: Add fuction to mint N amount of weapons
BEFORE CODE: disableForge: false,
forgeMultiplier: 10,
newForged: [],
currentListofWeapons: [],
x10Forge: false,
x1Forge: false,
onError:... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
showBlacksmith: true,
reforgeWeaponId: null,
burnWeaponId: null,
forgeCost: 0,
reforgeCost: 0,
disableForge: false,
forgeMultiplier: 10,
newForged: [],
currentListofWeapons: [],
x10Forge: false,
x1Forge: false,
onError: false,
spin: false,
... | No issues found. | showBlacksmith: true,
reforgeWeaponId: null,
burnWeaponId: null,
forgeCost: 0,
reforgeCost: 0,
disableForge: false,
forgeMultiplier: 10,
newForged: [],
currentListofWeapons: [],
x10Forge: false,
x1Forge: false,
onError: false,
spin: false,
... | @@ -18,12 +18,11 @@
<div class="col">
<div class="d-flex justify-content-space-between">
<h1>Weapons ({{ ownWeapons.length }})</h1>
-
<div class="d-flex justify-content-flex-end ml-auto">
<b-button
variant="primary"
v-if="reforgeWeaponId !... | frontend/src/views/Blacksmith.vue | 0 | Vue | 1 | none | 16 | 51 | 51 | true | feat(blacksmith): revamp reforge ui | 578 | CryptoBlades/cryptoblades | 321 | Vue | Sellie96 | Review this pull request change.
Language: Vue
File: frontend/src/views/Blacksmith.vue
PR Title: feat(blacksmith): revamp reforge ui
BEFORE CODE: showBlacksmith: true,
reforgeWeaponId: null,
burnWeaponId: null,
forgeCost: 0,
reforgeCost: 0,
disableForge: false,
forgeMultipl... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
},
async mintWeaponN({ state, dispatch }, { num, useStakedSkillOnly, chosenElement }: { num: any, useStakedSkillOnly?: boolean, chosenElement: any }) {
const { CryptoBlades, SkillToken, Weapons } = state.contracts();
if(!CryptoBlades || !SkillToken || !Weapons || !state.defaultAccount) retu... | No issues found. | },
async mintWeaponN({ state, dispatch }, { num, useStakedSkillOnly, chosenElement }: { num: any, useStakedSkillOnly?: boolean, chosenElement: any }) {
const { CryptoBlades, SkillToken, Weapons } = state.contracts();
if(!CryptoBlades || !SkillToken || !Weapons || !state.defaultAccount) retu... | @@ -1344,13 +1344,14 @@ export function createStore(web3: Web3) {
]);
},
- async mintWeaponN({ state, dispatch }, { num, useStakedSkillOnly }: { num: any, useStakedSkillOnly?: boolean }) {
+ async mintWeaponN({ state, dispatch }, { num, useStakedSkillOnly, chosenElement }: { num: any, useSta... | frontend/src/store.ts | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | feature choose weapon element on forge | 582 | CryptoBlades/cryptoblades | 321 | Vue | 0xroy | Review this pull request change.
Language: TypeScript
File: frontend/src/store.ts
PR Title: feature choose weapon element on forge
BEFORE CODE: },
async mintWeaponN({ state, dispatch }, { num, useStakedSkillOnly, chosenElement }: { num: any, useStakedSkillOnly?: boolean, chosenElement: any }) {
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
]);
},
async fetchCharacterTransferCooldownForOwnCharacters({ state, dispatch }) {
await Promise.all(
state.ownedCharacterIds.map(weaponId =>
dispatch('fetchCharacterTransferCooldown', weaponId)
)
);
},
async fetchCharacterTransferCooldow... | No issues found. | ]);
},
async fetchCharacterTransferCooldownForOwnCharacters({ state, dispatch }) {
await Promise.all(
state.ownedCharacterIds.map(weaponId =>
dispatch('fetchCharacterTransferCooldown', weaponId)
)
);
},
async fetchCharacterTransferCooldow... | @@ -1049,12 +1049,35 @@ export function createStore(web3: Web3) {
{ feeMultiplier: num }
);
- await CryptoBlades.methods
+ const hasPaidForMintBefore = await CryptoBlades.methods
+ .hasPaidForMint(num)
+ .call(defaultCallOptions(state));
+
+ if(!hasPaidForMin... | frontend/src/store.ts | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | Change seed handling for mintWeapon and mintWeaponN | 624 | CryptoBlades/cryptoblades | 321 | Vue | brian-man | Review this pull request change.
Language: TypeScript
File: frontend/src/store.ts
PR Title: Change seed handling for mintWeapon and mintWeaponN
BEFORE CODE: ]);
},
async fetchCharacterTransferCooldownForOwnCharacters({ state, dispatch }) {
await Promise.all(
state.ownedCharact... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
name: 'Fire Character Trait',
description: 'Changes character\'s trait to Fire.',
image: 'potion_09_te.png'
},
{
id: 1,
type: 'CharacterWaterTraitChange',
nftPrice: 0.2,
name: 'Water Character Trait',
description: 'Changes c... | No issues found. | name: 'Fire Character Trait',
description: 'Changes character\'s trait to Fire.',
image: 'potion_09_te.png'
},
{
id: 1,
type: 'CharacterWaterTraitChange',
nftPrice: 0.2,
name: 'Water Character Trait',
description: 'Changes c... | @@ -671,11 +671,10 @@ import { market_blockchain as useBlockchain } from './../feature-flags';
import { CharacterTransactionHistoryData, ICharacterHistory,
IWeaponHistory, WeaponTransactionHistoryData,
IShieldHistory, ShieldTransactionHistoryData } from '@/interfaces/History';
-import { getWeaponNameFromSeed } f... | frontend/src/views/Market.vue | 0 | Vue | 1 | none | 16 | 51 | 51 | true | fix(ui): run censor on names to filter profanity | 659 | CryptoBlades/cryptoblades | 321 | Vue | kcper | Review this pull request change.
Language: Vue
File: frontend/src/views/Market.vue
PR Title: fix(ui): run censor on names to filter profanity
BEFORE CODE: name: 'Fire Character Trait',
description: 'Changes character\'s trait to Fire.',
image: 'potion_09_te.png'
},
{
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
this.rewards = nfts;
this.spin = true;
this.$bvModal.show('rewardsModal');
setTimeout(() => {
this.spin = false;
}, 10000);
},
getBossName() {
return dragonNames[this.raidIndex % dragonNames.length];
},
getBossImage() {
return bossImages[this.raidIndex... | No issues found. | this.rewards = nfts;
this.spin = true;
this.$bvModal.show('rewardsModal');
setTimeout(() => {
this.spin = false;
}, 10000);
},
getBossName() {
return dragonNames[this.raidIndex % dragonNames.length];
},
getBossImage() {
return bossImages[this.raidIndex... | @@ -36,7 +36,10 @@
<nft-icon :isDefault="true" :nft="{ type: '5bdust' }"/>
</div>
<br />
- <span class="bold raid-title-section">XP reward</span> <span class="xp-reward ml-3 raid-details-text"> {{ xpReward }} </span>
+ <span class="bold raid-title... | frontend/src/views/Raid.vue | 0 | Vue | 1 | none | 16 | 51 | 51 | true | Raid UI patch | 694 | CryptoBlades/cryptoblades | 321 | Vue | kcper | Review this pull request change.
Language: Vue
File: frontend/src/views/Raid.vue
PR Title: Raid UI patch
BEFORE CODE: this.rewards = nfts;
this.spin = true;
this.$bvModal.show('rewardsModal');
setTimeout(() => {
this.spin = false;
}, 10000);
},
getBossName() {
re... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
export interface RaidRewards {
rewardsClaimed: any;
weapons: Weapon[];
junks: Junk[];
keyboxes: Keybox[];
bonusXp: BonusXp[];
dustLb: DustLb[];
dust4b: Dust4b[];
dust5b: Dust5b[];
}
export interface Weapon {
tokenID: number;
}
export interface Junk {
tokenID: number;
}
export interface Keybox {
... | No issues found. | export interface RaidRewards {
rewardsClaimed: any;
weapons: Weapon[];
junks: Junk[];
keyboxes: Keybox[];
bonusXp: BonusXp[];
dustLb: DustLb[];
dust4b: Dust4b[];
dust5b: Dust5b[];
}
export interface Weapon {
tokenID: number;
}
export interface Junk {
tokenID: number;
}
export interface Keybox {
... | @@ -0,0 +1,39 @@
+export interface RaidRewards {
+ rewardsClaimed: any;
+ weapons: Weapon[];
+ junks: Junk[];
+ keyboxes: Keybox[];
+ bonusXp: BonusXp[];
+ dustLb: DustLb[];
+ dust4b: Dust4b[];
+ dust5b: Dust5b[];
+}
+
+export interface Weapon {
+ tokenID: number;
+}
+
+export interface Junk {
+ tokenID: numb... | frontend/src/interfaces/RaidRewards.ts | 0 | TypeScript | 1 | none | 16 | 40 | 40 | true | Raid.vue rewrite to Typescript | 711 | CryptoBlades/cryptoblades | 321 | Vue | Chriserus | Review this pull request change.
Language: TypeScript
File: frontend/src/interfaces/RaidRewards.ts
PR Title: Raid.vue rewrite to Typescript
BEFORE CODE: export interface RaidRewards {
rewardsClaimed: any;
weapons: Weapon[];
junks: Junk[];
keyboxes: Keybox[];
bonusXp: BonusXp[];
dustLb: DustLb[];
dust4... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
interface StoreMappedActions {
claimTokenRewards(): Promise<void>;
}
interface Data {
showGraphics: boolean;
hideRewards: boolean;
hideWalletWarning: boolean;
showSkillInUsd: boolean;
}
interface StoreMappedGetters {
rewardsClaimTaxAsFactorBN: BigNumber;
maxRewardsClaimTaxAsFactorBN: BigNumber;
}
enum C... | No issues found. | interface StoreMappedActions {
claimTokenRewards(): Promise<void>;
}
interface Data {
showGraphics: boolean;
hideRewards: boolean;
hideWalletWarning: boolean;
showSkillInUsd: boolean;
}
interface StoreMappedGetters {
rewardsClaimTaxAsFactorBN: BigNumber;
maxRewardsClaimTaxAsFactorBN: BigNumber;
}
enum C... | @@ -20,6 +20,11 @@
<b-dropdown-item href="https://cryptoblades.gitbook.io/wiki/" target="_blank"><i class="fa fa-book mr-2"></i>Wiki <b-icon scale="0.8" icon="question-circle"/></b-dropdown-item>
+ <b-dropdown-item @click.native="$router.push('nft-display')">
+ <img src="https://seiyria.com... | frontend/src/components/Options.vue | 0 | Vue | 1 | none | 16 | 51 | 51 | true | NFT Display Page | 723 | CryptoBlades/cryptoblades | 321 | Vue | Chriserus | Review this pull request change.
Language: Vue
File: frontend/src/components/Options.vue
PR Title: NFT Display Page
BEFORE CODE: interface StoreMappedActions {
claimTokenRewards(): Promise<void>;
}
interface Data {
showGraphics: boolean;
hideRewards: boolean;
hideWalletWarning: boolean;
showSkillInUsd: bo... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
async claimRewardIndex(rewardIndex: string): Promise<void> {
this.bonuxXpCharacterNames = [];
this.bonuxXpAmounts = [];
const result = await this.claimRaidRewards({
rewardIndex
});
const nfts: NftIdType[] = [];
if(result.weapons) {
result.weapons.forEach((x: Weap... | No issues found. | async claimRewardIndex(rewardIndex: string): Promise<void> {
this.bonuxXpCharacterNames = [];
this.bonuxXpAmounts = [];
const result = await this.claimRaidRewards({
rewardIndex
});
const nfts: NftIdType[] = [];
if(result.weapons) {
result.weapons.forEach((x: Weap... | @@ -26,9 +26,9 @@
</div>
<div class="progress" style="width: 100%">
<div class="progress-bar progress-bar-striped progress-bar-animated players-progress-bar"
- role="progressbar" :style="[{'width': formattedWinChance, 'background-color': calculateP... | frontend/src/views/Raid.vue | 0 | Vue | 1 | none | 16 | 51 | 51 | true | NFT display page market integration | 727 | CryptoBlades/cryptoblades | 321 | Vue | Chriserus | Review this pull request change.
Language: Vue
File: frontend/src/views/Raid.vue
PR Title: NFT display page market integration
BEFORE CODE: async claimRewardIndex(rewardIndex: string): Promise<void> {
this.bonuxXpCharacterNames = [];
this.bonuxXpAmounts = [];
const result = await this.claimRai... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
SkillToken,
state.defaultAccount,
state.skillRewards,
defaultCallOptions(state),
defaultCallOptions(state),
cryptoBladesMethods => cryptoBladesMethods.burnWeaponFee()
);
await CryptoBlades.methods
.burnWeapon(
... | No issues found. | SkillToken,
state.defaultAccount,
state.skillRewards,
defaultCallOptions(state),
defaultCallOptions(state),
cryptoBladesMethods => cryptoBladesMethods.burnWeaponFee()
);
await CryptoBlades.methods
.burnWeapon(
... | @@ -27,6 +27,9 @@ import { Nft } from './interfaces/Nft';
import { getWeaponNameFromSeed } from '@/weapon-name';
import axios from 'axios';
+const transakAPIURL = process.env.VUE_APP_TRANSAK_API_URL || 'https://staging-global.transak.com';
+const transakAPIKey = process.env.VUE_APP_TRANSAK_API_KEY || '90167697-74a7... | frontend/src/store.ts | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | 490-transak-integration | 742 | CryptoBlades/cryptoblades | 321 | Vue | bilbolPrime | Review this pull request change.
Language: TypeScript
File: frontend/src/store.ts
PR Title: 490-transak-integration
BEFORE CODE: SkillToken,
state.defaultAccount,
state.skillRewards,
defaultCallOptions(state),
defaultCallOptions(state),
cryptoB... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
const { deployProxy, upgradeProxy } = require('@openzeppelin/truffle-upgrades');
const CBKLandSale = artifacts.require("CBKLandSale");
const CBKLand = artifacts.require("CBKLand");
module.exports = async function (deployer, network, accounts) {
await upgradeProxy(CBKLand.address, CBKLand, { deployer });
await up... | No issues found. | const { deployProxy, upgradeProxy } = require('@openzeppelin/truffle-upgrades');
const CBKLandSale = artifacts.require("CBKLandSale");
const CBKLand = artifacts.require("CBKLand");
module.exports = async function (deployer, network, accounts) {
await upgradeProxy(CBKLand.address, CBKLand, { deployer });
await up... | @@ -0,0 +1,10 @@
+const { deployProxy, upgradeProxy } = require('@openzeppelin/truffle-upgrades');
+
+
+const CBKLandSale = artifacts.require("CBKLandSale");
+const CBKLand = artifacts.require("CBKLand");
+module.exports = async function (deployer, network, accounts) {
+
+ await upgradeProxy(CBKLand.address, CBKLand, ... | migrations/92_cbkLandSale_reservedSales.js | 0 | JavaScript | 1 | none | 16 | 10 | 10 | true | 739-land-sale reserved sales | 800 | CryptoBlades/cryptoblades | 321 | Vue | bilbolPrime | Review this pull request change.
Language: JavaScript
File: migrations/92_cbkLandSale_reservedSales.js
PR Title: 739-land-sale reserved sales
BEFORE CODE: const { deployProxy, upgradeProxy } = require('@openzeppelin/truffle-upgrades');
const CBKLandSale = artifacts.require("CBKLandSale");
const CBKLand = artifact... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.