Skip to content

Commit bfea294

Browse files
authored
Merge pull request #28 from SpringRole/no-token-vanity
removing token transfer
2 parents a97c305 + ff3e26c commit bfea294

File tree

3 files changed

+3
-91
lines changed

3 files changed

+3
-91
lines changed

contracts/VanityURL.sol

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ pragma solidity ^0.4.19;
55
* Go to beta.springrole.com to try this out!
66
*/
77

8-
contract Token{
9-
10-
function doTransfer(address _from, address _to, uint256 _value) public returns (bool);
11-
12-
}
13-
148
/**
159
* @title Ownable
1610
* @dev The Ownable contract has an owner address, and provides basic authorization control
@@ -108,45 +102,20 @@ contract Pausable is Ownable {
108102

109103
contract VanityURL is Ownable,Pausable {
110104

111-
// This declares a state variable that would store the contract address
112-
Token public tokenAddress;
113105
// This declares a state variable that mapping for vanityURL to address
114106
mapping (string => address) vanity_address_mapping;
115107
// This declares a state variable that mapping for address to vanityURL
116108
mapping (address => string ) address_vanity_mapping;
117-
// This declares a state variable that stores pricing
118-
uint256 public reservePricing;
119-
// This declares a state variable address to which token to be transfered
120-
address public transferTokenTo;
121-
122109
/*
123110
constructor function to set token address & Pricing for reserving and token transfer address
124111
*/
125-
function VanityURL(address _tokenAddress, uint256 _reservePricing, address _transferTokenTo){
126-
tokenAddress = Token(_tokenAddress);
127-
reservePricing = _reservePricing;
128-
transferTokenTo = _transferTokenTo;
112+
function VanityURL(){
129113
}
130114

131115
event VanityReserved(address _to, string _vanity_url);
132116
event VanityTransfered(address _to,address _from, string _vanity_url);
133117
event VanityReleased(string _vanity_url);
134118

135-
/* function to update Token address */
136-
function updateTokenAddress (address _tokenAddress) onlyOwner public {
137-
tokenAddress = Token(_tokenAddress);
138-
}
139-
140-
/* function to update transferTokenTo */
141-
function updateTokenTransferAddress (address _transferTokenTo) onlyOwner public {
142-
transferTokenTo = _transferTokenTo;
143-
}
144-
145-
/* function to set reserve pricing */
146-
function setReservePricing (uint256 _reservePricing) onlyOwner public {
147-
reservePricing = _reservePricing;
148-
}
149-
150119
/* function to retrive wallet address from vanity url */
151120
function retrieveWalletForVanity(string _vanity_url) constant public returns (address) {
152121
return vanity_address_mapping[_vanity_url];
@@ -171,7 +140,6 @@ contract VanityURL is Ownable,Pausable {
171140
require(checkForValidity(_vanity_url));
172141
require(vanity_address_mapping[_vanity_url] == address(0x0));
173142
require(bytes(address_vanity_mapping[msg.sender]).length == 0);
174-
require(tokenAddress.doTransfer(msg.sender,transferTokenTo,reservePricing));
175143
vanity_address_mapping[_vanity_url] = msg.sender;
176144
address_vanity_mapping[msg.sender] = _vanity_url;
177145
VanityReserved(msg.sender, _vanity_url);

migrations/2_deploy_contracts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module.exports = function(deployer,network,accounts) {
77
deployer.deploy(InviteToken,1000000).then(function() {
88
return deployer.deploy(AirDrop, InviteToken.address);
99
}).then(function() {
10-
return deployer.deploy(VanityURL, InviteToken.address,1,accounts[2]);
10+
return deployer.deploy(VanityURL);
1111
}).then(function() {
1212
return deployer.deploy(SpringToken,1000000);
1313
});

test/2_vanity.js

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,22 @@
1-
var InviteToken = artifacts.require("./InviteToken.sol");
21
var VanityURL = artifacts.require("./VanityURL.sol");
32

43
contract('VanityURL', function(accounts) {
54
var vanityInstance;
6-
var tokenInstance;
75

86
before(function () {
97
return VanityURL.deployed().then(function(instance) {
108
vanityInstance = instance;
11-
return InviteToken.deployed();
12-
}).then(function(token) {
13-
tokenInstance = token;
14-
// mint 1000 tokens
15-
return tokenInstance.mint(1000);
16-
}).then(function(minted) {
17-
return tokenInstance.transfer(accounts[1],10);
18-
}).then(function(transfer) {
19-
// add vanity contract to whitelist
20-
return tokenInstance.addWhiteListedContracts(vanityInstance.address);
21-
}).then(function(result) {
22-
assert.isDefined(result,"Vanity Contract should get added to whitelisted contracts")
23-
}).catch(function(error){
24-
assert.isUndefined(error,"Vanity Contract should get added to whitelisted contracts")
25-
})
26-
});
27-
28-
it("should have token defined", function() {
29-
return vanityInstance.tokenAddress.call().then(function(instance){
30-
assert.isDefined(instance, "Token address should be defined");
31-
assert.equal(instance,tokenInstance.address ,"Token address should be same as SRPMT");
32-
});
33-
});
34-
35-
it("should have reservePricing defined", function() {
36-
return vanityInstance.reservePricing.call().then(function(instance){
37-
assert.isDefined(instance, "Token reservePricing should be defined");
389
});
3910
});
4011

4112
it("should be able to reserve a url", function() {
42-
43-
var amount = 1; //reserve fees
44-
// Get initial balances of first and second account.
45-
var account_one = accounts[1];
46-
var account_two = accounts[2];
47-
48-
var account_one_starting_balance;
49-
var account_two_starting_balance;
50-
var account_one_ending_balance;
51-
var account_two_ending_balance;
52-
53-
tokenInstance.balanceOf.call(account_one).then(function(balance){
54-
account_one_starting_balance = balance.toNumber();
55-
// check balance for account 2
56-
return tokenInstance.balanceOf.call(account_two);
57-
}).then(function(balance){
58-
account_two_starting_balance = balance.toNumber();
59-
return vanityInstance.reserve('vinay_035',{from:accounts[1]});
60-
}).then(function(instance){
13+
return vanityInstance.reserve('vinay_035',{from:accounts[1]}).then(function(instance){
6114
return vanityInstance.retrieveWalletForVanity.call('vinay_035');
6215
}).then(function(result) {
6316
assert.equal(result,accounts[1],"Should be able to retrive the same wallet address");
6417
return vanityInstance.retrieveVanityForWallet.call(accounts[1]);
6518
}).then(function(result) {
6619
assert.equal(result,'vinay_035',"Should be able to retrive the same vanity");
67-
}).then(function() {
68-
return tokenInstance.balanceOf.call(account_one);
69-
}).then(function(balance) {
70-
account_one_ending_balance = balance.toNumber();
71-
return tokenInstance.balanceOf.call(account_two);
72-
}).then(function(balance) {
73-
account_two_ending_balance = balance.toNumber();
74-
assert.equal(account_one_ending_balance, account_one_starting_balance - amount, "Amount wasn't correctly taken from the sender");
75-
assert.equal(account_two_ending_balance, account_two_starting_balance + amount, "Amount wasn't correctly sent to tokenAddress");
7620
}).catch(function(error){
7721
assert.isUndefined(error,"should be able to reserve a url")
7822
})

0 commit comments

Comments
 (0)