In case contract A
allows token holders to burn their tokens, you just need to call corresponding method of contract A
from contract B
like this:
contract B is ERC721 {
uint nextDogID = 0;
A a = ...;
function catToDog (uint _catID) public (returns _dogID) {
_dogID = nextDogID++;
_mint (msg.sender, _dogID);
copyGene (_catID, _dogID);
require (a.transferFrom (msg.sender, address (this), _catID));
require (a.burn (_catID)); // Here we burn the cat token!
}
}
If A
does not allow burning, just send "burned" tokens to some dead address:
contract B is ERC721 {
uint nextDogID = 0;
IERC721 a = ...;
function catToDog (uint _catID) public (returns _dogID) {
_dogID = nextDogID++;
_mint (msg.sender, _dogID);
copyGene (_catID, _dogID);
// Here we send the cat token to dead address effectively burning it
require (a.transferFrom (
msg.sender,
0x000000000000000000000000000000000000dead,
_catID));
}
}