DeveryOwned

DeveryOwned

Main class to deal with the owned smart contract interface and related operations, you can use it to check the current contract owner and listen to ownership change related events. Take care when you call right functions on this class, because unless you are the contract owner you will get an exception and lose your gas.

Constructor

new DeveryOwned(options)

Creates a new DeveryOwned instance.

Usage example:

// creates a deverOwnedClient with the default params
let deveryOwnedClient = new DeveryOwned();

// creates a deveryOwnedClient pointing to a custom address
let deveryOwnedClient = new DeveryOwned({address:'0xf17f52151EbEF6C7334FAD080c5704DAAA16b732'});
Parameters:
Name Type Description
options ClientOptions

network connection options

Version:
  • 2
Source:

Extends

Methods

(async) acceptOwnership() → {Promise.<transaction>}

If for any reason the current contract owner start an onwnership transfer you can make a call to this method to accept it. Beware that if you are are not receiving the contract ownership, you will get an exception and lose your gass.

Usage example:

// first you need to get a DeveryOwned instance
let deveryOwnedClient = new DeveryOwned();

// then you can use it
deveryOwnedClient.acceptOwnership().then(function(transaction) {
     // congrats you are the new owner
}).catch(function(err) {
     // sorry mate I told you not to call this function unless you were about to receive the
     // ownership
})

// optionally you can can use the async syntax

async function foo() {
     try {
         let transactionResult = await deveryOwnedClient.acceptOwnership();
         // congrats you are the new owner
     }
     catch(err) {
         // sorry mate I told you not to call this function unless you were about to receive the
         // ownership
     }
}

for more info about how to get a DeveryOwned instance click here

Source:

(async) transferOwnership(newOwnerAddress) → {Promise.<transaction>}

If you are the current contract owner (I bet you are not) you can call this method to transfer it to someone else by passing the new account owner address as param. The ownership transfer will only be concluded once the new contract owner do a call to acceptOwnership.

Beware that if you are are not the contract owner you will get an exception and lose your gas.

Usage example:

// first you need to get a DeveryOwned instance
let deveryOwnedClient = new DeveryOwned();

// then you can use it
deveryOwnedClient.transferOwnership('0xf17f52151EbEF6C7334FAD080c5704DAAA16b732').then(function(transaction) {
     // you just started the contract transfer
}).catch(function(err) {
     // sorry mate I told you not to call this function unless you were the contract onwer
})

// optionally you can can use the async syntax


async function foo() {
     try{
         let transactionResult = await deveryOwnedClient.transferOwnership('0xf17f52151EbEF6C7334FAD080c5704DAAA16b732');
         // congrats you are the new owner
     }
     catch(err) {
         // sorry mate I told you not to call this function unless you were the contract owner
     }
}

for more info about how to get a DeveryOwned instance click here

Parameters:
Name Type Description
newOwnerAddress string

The new contract owner address.

Source:

setOwnershipTransferredListener(callback)

Listener to OwnershipTransferred events, this event triggers whenever the smart contract ownership changes. Please note that OwnershipTransferredListeners do not stack, this means that whenever you set one you are removing the last one. If you want to remove a OwnershipTransferredListener, just call this function passing undefined as param.

Usage example:

// first you need to get a DeveryOwned instance
let deveryOwnedClient = new DeveryOwned();
// now you can use it

deveryOwnedClient.setOwnershipTransferredListener((fromAddress,toAddress) => {
     // whenever an admin is removed we will log it to the console
     console.log(`the ownership is being transferred from ${fromAddress} to ${toAddress}`);
})

// if you want to remove the listener you can simply pass undefined as parameter

deveryOwnedClient.setOwnershipTransferredListener(undefined)

// or that is equivalent to the above call

deveryOwnedClient.setOwnershipTransferredListener()


for more info about how to get a DeveryOwned instance click here

Parameters:
Name Type Description
callback OwnershipEventCallback

the callback that will be executed whenever and OwnershipTransferred event is triggered

Source:

(async) getOwner() → {Promise.<string>}

Get the current contract owner's address.

Usage example:

// first you need to get a DeveryOwned instance
let deveryOwnedClient = new DeveryOwned();

// then you can use it
deveryOwnedClient.getOwner().then(function(contractOwnerAddress) {
     console.log(contractOwnerAddress)
     //... do stuff
})

// optionally you can use the async syntax


async function foo() {
      let contractOwnerAddress = await deveryOwnedClient.getOwner();
      console.log(contractOwnerAddress)
      //... do stuff
}

for more info about how to get a DeveryOwned instance click here

Source:

(async) getNewOwner() → {Promise.<string>}

Get the address of the newOwner account. A value will be returned only if the account transfer is pending otherwise you will get 0x00000000000000...

Usage example:

// first you need to get a DeveryOwned instance
let deveryOwnedClient = new DeveryOwned();

// then you can use it
deveryOwnedClient.getNewOwner().then(function(newOwnerAddress) {
     console.log(newOwnerAddress)
     //... do stuff
})

// optionally you can use the async syntax


async function foo() {
      let newOwnerAddress = await deveryOwnedClient.getNewOwner();
      console.log(newOwnerAddress)
      //... do stuff
}

for more info about how to get a DeveryOwned instance click here

Source:

getSignerAddress() → {*}

You can use this method to check the current signer wallet address.

Inherited From:
Source:

getProvider() → {*}

Returns the internal signer or provider, this method needs to be used with caution as it exposes internals. So unless you know what you are doing it's better to avoid using it.

Inherited From:
Source: