[DO NOT MERGE] change naming of two functions in subdomain registry (#6)
* change naming of two functions in subdomain registry * rename function calls in tests and UI
This commit is contained in:
parent
7cbd9496f1
commit
8bcc29f35c
|
@ -66,7 +66,7 @@ const AddDomain = withFormik({
|
|||
},
|
||||
async handleSubmit(values, { setSubmitting }) {
|
||||
const { domainName, domainPrice } = values
|
||||
const { methods: { domains, addDomain, setDomainPrice } } = ENSSubdomainRegistry
|
||||
const { methods: { domains, setDomainPrice, updateDomainPrice } } = ENSSubdomainRegistry
|
||||
const { sha3 } = window.web3.utils
|
||||
const hashedDomain = hash(domainName)
|
||||
const debugTable = await ['eth', 'stateofus', 'stateofus.eth', 'freedomain', 'freedomain.eth', domainName]
|
||||
|
@ -86,7 +86,7 @@ const AddDomain = withFormik({
|
|||
Promise.all(debugTable).then(v => { console.table(v) });
|
||||
const { state } = await getDomain(hashedDomain, domains);
|
||||
setPrice(
|
||||
!!Number(state) ? setDomainPrice : addDomain,
|
||||
!!Number(state) ? updateDomainPrice : setDomainPrice,
|
||||
hashedDomain,
|
||||
domainPrice
|
||||
)
|
||||
|
|
|
@ -255,7 +255,7 @@ contract ENSSubdomainRegistry is Controlled {
|
|||
* @param _domain domain owned by user registry being activated
|
||||
* @param _price cost to register subnode from this node
|
||||
*/
|
||||
function addDomain(
|
||||
function setDomainPrice(
|
||||
bytes32 _domain,
|
||||
uint256 _price
|
||||
)
|
||||
|
@ -273,7 +273,7 @@ contract ENSSubdomainRegistry is Controlled {
|
|||
* @param _domain active domain being defined price
|
||||
* @param _price new price
|
||||
*/
|
||||
function setDomainPrice(
|
||||
function updateDomainPrice(
|
||||
bytes32 _domain,
|
||||
uint256 _price
|
||||
)
|
||||
|
|
|
@ -66,7 +66,7 @@ contract('ENSSubdomainRegistry', function () {
|
|||
});
|
||||
|
||||
it('should add free domain', async () => {
|
||||
let result = await ENSSubdomainRegistry.methods.addDomain(domains.free.namehash, 0).send({from: accountsArr[0]});
|
||||
let result = await ENSSubdomainRegistry.methods.setDomainPrice(domains.free.namehash, 0).send({from: accountsArr[0]});
|
||||
assert.equal(result.events.DomainPrice.returnValues.price, domains.free.price);
|
||||
assert.equal(result.events.DomainPrice.returnValues.namehash, domains.free.namehash);
|
||||
result = await ENSSubdomainRegistry.methods.getPrice(domains.free.namehash).call()
|
||||
|
@ -79,7 +79,7 @@ contract('ENSSubdomainRegistry', function () {
|
|||
|
||||
it('should add paid domain', async () => {
|
||||
let initialPrice = 100
|
||||
let result = await ENSSubdomainRegistry.methods.addDomain(domains.paid.namehash, initialPrice).send({from: accountsArr[0]});
|
||||
let result = await ENSSubdomainRegistry.methods.setDomainPrice(domains.paid.namehash, initialPrice).send({from: accountsArr[0]});
|
||||
assert.equal(result.events.DomainPrice.returnValues.price, initialPrice);
|
||||
assert.equal(result.events.DomainPrice.returnValues.namehash, domains.paid.namehash);
|
||||
result = await ENSSubdomainRegistry.methods.getPrice(domains.paid.namehash).call()
|
||||
|
@ -91,7 +91,7 @@ contract('ENSSubdomainRegistry', function () {
|
|||
|
||||
it('should change paid domain price', async () => {
|
||||
let newPrice = domains.paid.price;
|
||||
let result = await ENSSubdomainRegistry.methods.setDomainPrice(domains.paid.namehash, newPrice).send({from: accountsArr[0]});
|
||||
let result = await ENSSubdomainRegistry.methods.updateDomainPrice(domains.paid.namehash, newPrice).send({from: accountsArr[0]});
|
||||
assert.equal(result.events.DomainPrice.returnValues.price, newPrice, "Wrong price at event");
|
||||
assert.equal(result.events.DomainPrice.returnValues.namehash, domains.paid.namehash, "Wrong namehash at event");
|
||||
result = await ENSSubdomainRegistry.methods.getPrice(domains.paid.namehash).call()
|
||||
|
|
Loading…
Reference in New Issue