menu

Aragon

Aragon is the most powerful and modular way to run DAOs

Channels
# All channels
view-forward
# Announcements
view-forward
# App development
view-forward
# Aragon Agent
view-forward
# Aragon Client
view-forward
# Aragon Connect
view-forward
# aragonOS
view-forward
# aragonUI
view-forward
# Feature requests
view-forward
Team

How do I get the appId / namehash of an app in open.aragonpm.eth?

May 28, 2020 at 1:34pm

How do I get the appId / namehash of an app in open.aragonpm.eth?

May 28, 2020 at 1:34pm
I am trying to connect some apps that I have deployed on open.aragonpm.eth. To find the contract address I need to have the appId which is the namehash of the app (in my case myapp.openaragonpm.eth). What is the easiest way to get that appId in a contract?
I thought I could do something like:
function getContract(bytes32 app) public view returns (address) {
IKernel k = IKernel(kernel());
return k.getApp(KERNEL_APP_ADDR_NAMESPACE, app);
}

May 28, 2020 at 4:32pm
Hi Michael, you can generate the appId with the following logic:
For aragonpm.eth: apmNamehash("myapp"); For open.aragonpm.eth: keccak256(abi.encodePacked(apmNamehash("open"), keccak256("myapp")));
And apmNamehash() can be imported from /os/contracts/apm/APMNamehash.sol
  • reply
  • like
However, the Kernel's getApp() function only returns the implementation contract of an app and not the proxy itself(which I assume is what you want).
  • reply
  • like
The best way to get the app's proxy address is to filter through the NewAppProxy events. A good example of this can be found here.
  • reply
  • like
Hi Mathew, thanks a lot for your reply!
I was actually trying to call another "app contact" of the same DAO. Is the best pattern to pass in the address of the other proxy contracts through the initialize function?
basically this:
contact Contribution is AragonApp {
function claim(id) {
IKernel k = IKernel(kernel());
address tokenAddress = k.getApp(KERNEL_APP_ADDR_NAMESPACE, tokenAppId);
IToken token = IToken(tokenAddress);
IToken(token).mintFor(recipient, amount);
}
}
vs.
contact Contribution is AragonApp {
function initialize(tokenAddress) public onlyInit {
token = IToken(tokenAddress)
initialized()
}
function claim(id) {
token.mintFor(recipient, amount);
}
}
I thought as the DAO knows all the apps I should be able to retrieve the other contract addresses from there and do not need to manually pass those in.
Edited
  • reply
  • like

May 29, 2020 at 12:40pm
I thought as the DAO knows all the apps I should be able to retrieve the other contract addresses from there and do not need to manually pass those in.
Ah, this is an incorrect assumption. You should declare to your app whichever dependencies it needs, whether that's an installed app contract or external contract.
  • reply
  • like