nftx-project / nftx-protocol-v2 Goto Github PK
View Code? Open in Web Editor NEWThe new and improved NFTX v2 Protocol.
Home Page: https://nftx.io
The new and improved NFTX v2 Protocol.
Home Page: https://nftx.io
I am able to receive vault tokens via flashloan
& redeem
an NFT from the vault but I am unable to put the NFT back in the vault (to receive vault tokens) which I assumed was done by calling mint
on the vault token contract, due to reentrancy.
Here is a contrived example using some boilerplate from tests:
To reproduce:
First request a flashloan from the vault:
bytes memory data = abi.encode(Action.NORMAL);
nftx.flashLoan(address(this), SOME_ADDRESS, SOME_AMOUNT, data);
Then in the callback:
function onFlashLoan(
address user,
address token,
uint256 value,
uint256 fee,
bytes calldata data
) external returns (bytes32) {
uint256[] memory ids;
nftx.redeem(1, ids);
}
Then in onERC721Received:
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external override returns (bytes4) {
// try to immediately return the nft back to the vault
uint256[] memory tokenIds = new uint256[](1);
tokenIds[0] = tokenId;
IERC721(msg.sender).setApprovalForAll(address(nftx), true);
uint256[] memory amounts;
// Error: VM Exception while processing transaction: reverted with reason string �y� ReentrancyGuard: reentrant call'
nftx.mint(tokenIds, amounts);
return 0x150b7a02;
}
I run npx hardhat run scripts/deploy.js --network rinkeby
and got this error
Error: Contract NFTXLPStaking is not upgrade safe
contracts\solidity\util\Address.sol:167: Use of delegatecall is not allowed
What should I fix?
Hi all.
I want to help, but I want to know if this project is active. Is this project active?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.