Skip to content

BlockClusterApp/proxy-contract

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A minimal, beginner friendly boilerplate for writing dynamo proxy contracts in BlockCluster platform.

Proxy Contract

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.

Configuring

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:

Screen Shot 2018-09-06 at 12.52.48 AM

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:

Screen Shot 2018-09-06 at 12.54.43 AM

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:

Screen Shot 2018-09-06 at 12.58.39 AM

Now copy the Dynamo APIs URL and replace with the dummy one provided in the truffle.js file.

Testing

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

Auditing

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:

Screen Shot 2018-09-06 at 1.08.34 AM

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:

Screen Shot 2018-09-06 at 4.09.42 PM

Releases

No releases published

Packages

No packages published