-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/struct pixel #24
base: feat/webservice-land
Are you sure you want to change the base?
Conversation
contracts/src/LandBank.sol
Outdated
function sellLandToBank(uint256[] memory _tokenIds) external nonReentrant { | ||
uint256 numberOfPx = _tokenIds.length; | ||
uint256 amountToSend; | ||
uint256 i; | ||
unchecked { | ||
amountToSend = | ||
ILandNFT(landNft).totalTileNum() * | ||
ILandNFT(landNft).getLength(_tokenId); | ||
amountToSend = getPrice() * numberOfPx; | ||
} | ||
IERC20(RIO_TOKEN).transfer( | ||
_seller, | ||
(IERC20(RIO_TOKEN).balanceOf(address(this)) / amountToSend) | ||
); | ||
|
||
for (i; i < numberOfPx; i++) { | ||
ILandNFT(landNft).transferFrom( | ||
msg.sender, | ||
address(this), | ||
_tokenIds[i] | ||
); | ||
timelapse[_tokenIds[i]] = block.timestamp; | ||
} | ||
IERC20(RIO_TOKEN).transfer(msg.sender, amountToSend); | ||
emit LandSold(msg.sender, _tokenIds, amountToSend, block.timestamp); | ||
} |
Check notice
Code scanning / Slither
Calls inside a loop
contracts/src/LandBank.sol
Outdated
function sellLandToBank(uint256[] memory _tokenIds) external nonReentrant { | ||
uint256 numberOfPx = _tokenIds.length; | ||
uint256 amountToSend; | ||
uint256 i; | ||
unchecked { | ||
amountToSend = | ||
ILandNFT(landNft).totalTileNum() * | ||
ILandNFT(landNft).getLength(_tokenId); | ||
amountToSend = getPrice() * numberOfPx; | ||
} | ||
IERC20(RIO_TOKEN).transfer( | ||
_seller, | ||
(IERC20(RIO_TOKEN).balanceOf(address(this)) / amountToSend) | ||
); | ||
|
||
for (i; i < numberOfPx; i++) { | ||
ILandNFT(landNft).transferFrom( | ||
msg.sender, | ||
address(this), | ||
_tokenIds[i] | ||
); | ||
timelapse[_tokenIds[i]] = block.timestamp; | ||
} | ||
IERC20(RIO_TOKEN).transfer(msg.sender, amountToSend); | ||
emit LandSold(msg.sender, _tokenIds, amountToSend, block.timestamp); | ||
} |
Check notice
Code scanning / Slither
Reentrancy vulnerabilities
contracts/src/LandBank.sol
Outdated
function sellLandToBank(uint256[] memory _tokenIds) external nonReentrant { | ||
uint256 numberOfPx = _tokenIds.length; | ||
uint256 amountToSend; | ||
uint256 i; | ||
unchecked { | ||
amountToSend = | ||
ILandNFT(landNft).totalTileNum() * | ||
ILandNFT(landNft).getLength(_tokenId); | ||
amountToSend = getPrice() * numberOfPx; | ||
} | ||
IERC20(RIO_TOKEN).transfer( | ||
_seller, | ||
(IERC20(RIO_TOKEN).balanceOf(address(this)) / amountToSend) | ||
); | ||
|
||
for (i; i < numberOfPx; i++) { | ||
ILandNFT(landNft).transferFrom( | ||
msg.sender, | ||
address(this), | ||
_tokenIds[i] | ||
); | ||
timelapse[_tokenIds[i]] = block.timestamp; | ||
} | ||
IERC20(RIO_TOKEN).transfer(msg.sender, amountToSend); | ||
emit LandSold(msg.sender, _tokenIds, amountToSend, block.timestamp); | ||
} |
Check notice
Code scanning / Slither
Reentrancy vulnerabilities
* api balanceOf, owner * owner * service owner * update cargo * fix url * totalsupply * init mint * mint tx issue * mint tx issue * region struct * feat: adds mint route * connect wallet * fix: provider instatition * feat: Json field * approve logic * sign tx * tx request * send_tx option * chore: signer middleware * chore: mint * fix: unwrap over ? * fix: unwrap over ? * mint * error some string * migrate to service * fix: approval call * await approval * chore: refactor for tests * set bank, dev * feat: adds docker build * chore: fix env var * test balance * provider refactoring * fix dotenv * comment mint debug * appstate * refactor: split provider out * Docker service * fix: lint * clippy fix * cargo fmt * update * check env * delete foundry step * slither ci * exclude lib * exclude lib * exclude lib * anvil test * reduce time * feat: deploymnent script * feat: test update, script * Feat/deployments testnet (#27) * feat: init landbank logic * feat: function buyFromBank * feat: test buy from bank * add getTokenPrice * feat: update getTokenPrice * feat: landBank contract + test * add select struct logic * feat: remove unnecessary comment * deployment * erros packed * slither redondant fix * remove unused * import format * remove double toml * toml file * delete unused toml * fix binding * feat: fix binding compile process * update src * path landbank * path tests * path nft test * remove working directory * remove absolue path * fix case-sensitive * bindings * add package * bindings Co-authored-by: joshualyguessennd <joshualyguessennd@icloud.com> Co-authored-by: joshualyguessennd <75019812+joshualyguessennd@users.noreply.github.com>
558627e
to
030d573
Compare
mapping(uint256 => ILandNFT.Pixel) pixelsId; | ||
mapping(uint256 => ILandNFT.Pixel) private pixelsId; | ||
mapping(bytes32 => bool) private isSpecialArea; | ||
mapping(bytes32 => bool) private areaClaimed; |
Check failure
Code scanning / Slither
Uninitialized state variables
No description provided.