Skip to content
This repository has been archived by the owner on Jan 12, 2019. It is now read-only.

Rename of proof method names #19

Merged
merged 1 commit into from
Apr 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions contracts/tokens/ChainableXcert.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ contract ChainableXcert is Xcert {
Xcert(_name, _symbol)
public
{
supportedInterfaces[0xc1dcb551] = true; // ChainableXcert
supportedInterfaces[0x6ea3dd92] = true; // ChainableXcert
}

/*
Expand All @@ -41,7 +41,7 @@ contract ChainableXcert is Xcert {
* @param _tokenId Id of the Xcert we want to get proof of.
* @param _index Index of the proof we want to get.
*/
function getProofByIndex(uint256 _tokenId,
function tokenProofByIndex(uint256 _tokenId,
uint256 _index)
validNFToken(_tokenId)
external
Expand All @@ -56,7 +56,7 @@ contract ChainableXcert is Xcert {
* @dev Gets the count of all proofs for a Xcert.
* @param _tokenId Id of the Xcert we want to get proof of.
*/
function getProofCount(uint256 _tokenId)
function tokenProofCount(uint256 _tokenId)
validNFToken(_tokenId)
external
view
Expand Down
4 changes: 2 additions & 2 deletions contracts/tokens/Xcert.sol
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ contract Xcert is Ownable, ERC721, ERC721Metadata, ERC165 {
supportedInterfaces[0x01ffc9a7] = true; // ERC165
supportedInterfaces[0x80ac58cd] = true; // ERC721
supportedInterfaces[0x5b5e139f] = true; // ERC721Metadata
supportedInterfaces[0x58c66b9f] = true; // Xcert
supportedInterfaces[0x355d09e9] = true; // Xcert
}

/*
Expand Down Expand Up @@ -396,7 +396,7 @@ contract Xcert is Ownable, ERC721, ERC721Metadata, ERC165 {
* @dev Gets proof for _tokenId.
* @param _tokenId Id of the NFToken we want to get proof of.
*/
function getProof(uint256 _tokenId)
function tokenProof(uint256 _tokenId)
validNFToken(_tokenId)
external
view
Expand Down
6 changes: 3 additions & 3 deletions contracts/utils/Selector.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ contract Selector {
function calculateXcertSelector() public pure returns (bytes4) {
Xcert i;
return i.mint.selector
^ i.getProof.selector
^ i.tokenProof.selector
^ i.setMintAuthorizedAddress.selector
^ i.isMintAuthorizedAddress.selector;
}
Expand All @@ -31,8 +31,8 @@ contract Selector {
function calculateChainableXcertSelector() public pure returns (bytes4) {
ChainableXcert i;
return i.chain.selector
^ i.getProofByIndex.selector
^ i.getProofCount.selector;
^ i.tokenProofByIndex.selector
^ i.tokenProofCount.selector;
}

function calculateMinterSelector() public pure returns (bytes4) {
Expand Down
10 changes: 5 additions & 5 deletions test/tokens/ChainableXcert.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ contract('ChainableXcert', (accounts) => {

it('correctly chains additional proof', async () => {
await xcert.chain(id1, mockProof2);
var proof = await xcert.getProof(id1);
var proof = await xcert.tokenProof(id1);
assert.equal(proof, mockProof2);
});

Expand All @@ -25,20 +25,20 @@ contract('ChainableXcert', (accounts) => {

it('correctly gets proof by index', async () => {
await xcert.chain(id1, mockProof2);
var proof = await xcert.getProofByIndex(id1, 1);
var proof = await xcert.tokenProofByIndex(id1, 1);
assert.equal(proof, mockProof2);
});

it('reverts trying to get proof for none existant index', async () => {
await assertRevert(xcert.getProofByIndex(id1, 1));
await assertRevert(xcert.tokenProofByIndex(id1, 1));
});

it('returns correct proof count', async () => {
var proofCount = await xcert.getProofCount(id1);
var proofCount = await xcert.tokenProofCount(id1);
assert.equal(proofCount, 1);

await xcert.chain(id1, mockProof2);
proofCount = await xcert.getProofCount(id1);
proofCount = await xcert.tokenProofCount(id1);
assert.equal(proofCount, 2);
});
});
8 changes: 4 additions & 4 deletions test/tokens/Xcert.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ contract('Xcert', (accounts) => {
var recipient = accounts[2];

await xcert.mint(sender, id2, mockProof, 'url2');
var { logs } = await xcert.safeTransferFrom(sender, recipient, id2, {from: sender});
var { logs } = await xcert.safeTransferFrom(sender, recipient, id2, "", {from: sender});
let transferEvent = logs.find(e => e.event === 'Transfer');
assert.notEqual(transferEvent, undefined);

Expand All @@ -252,7 +252,7 @@ contract('Xcert', (accounts) => {
var recipient = xcert.address;

await xcert.mint(sender, id2, mockProof, 'url2');
await assertRevert(xcert.safeTransferFrom(sender, recipient, id2, {from: sender}));
await assertRevert(xcert.safeTransferFrom(sender, recipient, id2, "", {from: sender}));
});

it('corectly safe transfers NFToken from owner to smart contract that can recieve NFTokens', async () => {
Expand All @@ -261,7 +261,7 @@ contract('Xcert', (accounts) => {
var recipient = tokenReceiverMock.address;

await xcert.mint(sender, id2, mockProof, 'url2');
var { logs } = await xcert.safeTransferFrom(sender, recipient, id2, {from: sender});
var { logs } = await xcert.safeTransferFrom(sender, recipient, id2, "", {from: sender});
let transferEvent = logs.find(e => e.event === 'Transfer');
assert.notEqual(transferEvent, undefined);

Expand All @@ -286,7 +286,7 @@ contract('Xcert', (accounts) => {

it('returns the correct proof for NFToken id', async () => {
await xcert.mint(accounts[1], id2, mockProof, 'url2');
var proof = await xcert.getProof(id2);
var proof = await xcert.tokenProof(id2);
assert.equal(proof, mockProof);
});

Expand Down
2 changes: 1 addition & 1 deletion test/tokens/XcertMock.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ contract('XcertMock', (accounts) => {

it('correctly chains additional proof', async () => {
await xcert.chain(id1, mockProof2);
var proof = await xcert.getProof(id1);
var proof = await xcert.tokenProof(id1);
assert.equal(proof, mockProof2);
});

Expand Down