Giter VIP home page Giter VIP logo

Comments (8)

MoMannn avatar MoMannn commented on May 28, 2024

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.

erectilereptiles avatar erectilereptiles commented on May 28, 2024

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.

MoMannn avatar MoMannn commented on May 28, 2024

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.

erectilereptiles avatar erectilereptiles commented on May 28, 2024

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.

erectilereptiles avatar erectilereptiles commented on May 28, 2024

This is the smart contract address:
0x0A5A3BFa844afa7bD4baC5B5EBf8C96c7719d48e

from erc721.

MoMannn avatar MoMannn commented on May 28, 2024

Hum. Can you post your full code?

from erc721.

erectilereptiles avatar erectilereptiles commented on May 28, 2024

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.

MoMannn avatar MoMannn commented on May 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.