A minimal, beginner friendly boilerplate for writing dynamo proxy contracts in BlockCluster platform.
A proxy contract in dynamo is used to implement custom logic such as advanced permissions, implementing new actors, calculating or conditioning assets metadata and so on.
It's useful when you need more customized and advanced operations over Dynamo's native assets and streams protocol. For example: if you have an asset and want to give two different members the ability to modify the asset then you would require to write a proxy contract as native set of operations over assets doesn't provide this feature.
To run this truffle project you need to configure your networks smart contract addresses and replace the node URL with your's node URL.
First of all create a new network on app.blockcluster.io. The you will see this control panel for your network:
Then click on Node Info and Settings option to view your dynamo node's network and contracts information. You would see a screen similar to this:
Now copy the assets, streams and atomic swap contracts addresses and replace with the dummy ones provided in the contracts/Example.sol file.
The next step is to go to the API option on the control panel page. You will see a screen similar to this:
Now copy the Dynamo APIs URL and replace with the dummy one provided in the truffle.js file.
Just like testing any other truffle project you need to first compile smart contracts, then deploy the contracts and finally run Mocha tests.
Let's first install the dependencies:
npm install
Then compile the contracts:
truffle compile
Then deploy the contracts:
truffle migrate --reset --network development
Finally, run the mocha tests:
truffle test
To convert the transactions related to the proxy contract into readable format in Audit explorer you would need to add the proxy contract's bytecode and ABI in dynamo.
To do this, click on Add Smart Contracts option in control panel. You will see a screen similar to this:
Now copy the bytecode and ABI from your projects build/contracts/Example.json file and paste it in the form. Then submit the form. Now you will be able to audit all Example
contracts transactions in the explorer.
Here is how a transaction will look when viewed in explorer: