-
Notifications
You must be signed in to change notification settings - Fork 6
AddressProxy contract
Gustavo Rios de Sousa e Silva edited this page Nov 28, 2018
·
22 revisions
- Add a new contract address
- Create or update a contract address.
- Get contract address
- Get the latest contract address.
- Initiate the AddressPorxy
- Call the method addAddress.
const AddressProxy = artifacts.require("./AddressProxy.sol");
const web3 = require('web3');
module.exports = function(callback) {
var instance = AddressProxy.at('0xE112a13984c2eF19DBeE98E3eDa79e90DB51f0e6');
instance.addAddress('appcoins', '0x1a7a8bd9106f2b8d977e08582dc7d24c723ab0db').then(console.log)
};
If you want to change the main addresses (AppCoins, Advertisemtn, Abi) at the same time, you can follow these steps:
- copy the file .env.example to .env
$ cd /path/of/the/project
$ cd deploy
$ cp .env.example .env
-
Edit the .env file
-
Use the the command for the following networks:
A. Development network
npm run addressB. Ropsten network
npm run address:ropstemC. Mainnet network
npm run address:main
- Initiate the Web3
- Initiate the AddressProxy
- Call the method getAddreddById
if (typeof web3 !== 'undefined') {
// Use Mist/MetaMask's provider
window.web3 = new Web3(web3.currentProvider);
} else {
const infuraKey = 'your infura key...';
window.web3 = new Web3(new Web3.providers.HttpProvider(https://mainnet.infura.io/infuraKey));
}
const addressProxyAbi = ['AddressProxyAbi...'];
const addressProxyAddress = '0xE112a13984c2eF19DBeE98E3eDa79e90DB51f0e6';
const contractAddressProxy = new web3.eth.Contract(addressProxyAbi, addressProxyAddress);
contractAddressProxy.methods.getContractAddressById(web3.utils.fromAscii('appcoins')).call(function(err, address) {
if(!err) {
resolve(address);
} else {
reject();
}
})
As of today the available contract addresses are:
- mainnet
- appcoins
- appcoinsiab
- advertisement
- advertisementFinance
- advertisementStorage
- appcoinscreditsbalance
- ropsten
- appcoins
- appcoinsiab
- advertisement
- advertisementFinance
- advertisementStorage
- appcoinstimelock
- extendedAdvertisement
- extendedAdvertisementFinance
- extendedAdvertisementStorage
- appcoinscreditsbalance
Contracts
- Address Proxy
- Advertisement
- Advertisement Storage
- Advertisement Finance
- AppCoins IAB
- AppCoins Timelock
- AppCoins Credits Balance
Extended Contracts
Development
Other