Comments (8)
Your code looks ok but the onlyOwner
part means only the contract creator has the ability to burn. So only the contract creator can send this transaction.
from erc721.
Hi thank you! I am the contract owner, but also i did try it without the onlyOnwer and it still did not work!
from erc721.
Cam you give a link to the contract, the transaction you are making (you should get an error message that tells you what is wrong)
from erc721.
Sorry im not extremely competent in these things as i am still a student! When clicking on the transaction error this is the etherscan page it takes me to:
https://ropsten.etherscan.io/tx/0xc167b931eb62dda3cdb1ce1f7d2fcd4d9f562af399d03098802dfbd57901ba94
Its on a test network so im unsure of whether you can see it. Please let me know if i need to send screenshots!
from erc721.
This is the smart contract address:
0x0A5A3BFa844afa7bD4baC5B5EBf8C96c7719d48e
from erc721.
Hum. Can you post your full code?
from erc721.
No problem! I added some stuff as the token needs to represent a personal loan. Please let me know if that is the problem
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import "https://github.com/0xcert/ethereum-erc721/src/contracts/tokens/nf-token-metadata.sol";
import "https://github.com/0xcert/ethereum-erc721/src/contracts/ownership/ownable.sol";
contract newNFT is NFTokenMetadata, Ownable {
uint256 loanamount;
uint256 interestrate;
uint256 termmonths;
constructor() {
nftName = "Deloitte NFT";
nftSymbol = "DTN";
}
function mint(address _to, uint256 _tokenId, string calldata _uri, uint256 amount, uint256 rate,uint256 term) external onlyOwner {
super._mint(_to, _tokenId);
super._setTokenUri(_tokenId, _uri);
tokenidToloanamount[_tokenId] = amount;
tokenidTointerestrate[_tokenId] = rate;
tokenidTotermmonths[_tokenId] = term;
}
function burn (uint256 _tokenId) external onlyOwner {
super._burn(_tokenId);
}
function getLoanAmount (uint256 _tokenId) public view returns (uint256 amount) {
amount = tokenidToloanamount[_tokenId];
return amount;
}
function getRate (uint256 _tokenId) public view returns (uint256 rate) {
rate = tokenidTointerestrate[_tokenId];
return rate;
}
function getTerm (uint256 _tokenId) public view returns (uint256 term) {
term = tokenidTotermmonths[_tokenId];
return term;
}
mapping (uint256 => uint256) public tokenidToloanamount;
mapping (uint256 => uint256) public tokenidTointerestrate;
mapping (uint256 => uint256) public tokenidTotermmonths;
}
from erc721.
Your code works ok for me. Did you deploy the contract again after adding the burn functionality? Once the code is deployed it cannot be changed. So if you add functionality you need to redeploy it.
Also I would suggest adding:
delete tokenidToloanamount[_tokenId];
delete tokenidTointerestrate[_tokenId];
delete tokenidTotermmonths[_tokenId];
To the burn function.
from erc721.
Related Issues (20)
- Support latest Solidity
- Update list of supported Node.js versions
- import nf-token-metadata.sol and ownable.sol in the remix. But it says ‘not found’ HOT 1
- Support Solidity 0.8.4
- NatSpec style: use @notice before @dev HOT 1
- 721
- Warning: SPDX license identifier not provided in source file HOT 2
- Release new npm version HOT 1
- Created NFT has no creator HOT 4
- Help in displaying all minted tokens HOT 8
- Question about error constants HOT 2
- Make metadata tokenURI overridable. HOT 1
- Fix dependency status icon
- Update branding HOT 1
- Cannot find json under "@nibbstack/erc721/build/" HOT 4
- Cheaper ERC-165 implementation HOT 2
- No need for assembly for code hash
- What is the meaning behind the error constants?
- Metadata extension JSON schema
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from erc721.