UI-based smart contract code generator


This is a very basic PoC for a graphical no-code builder that generates solidity smart contract code from a given blockly block. Currently the only supported template is based on the DAICompoundBasic strategy from yearn. There is a custom blockly block that can be used to parametrize the strategy and switch between a depositor, a rewardor, the exchange and the token that is wanted and optimized by the strategy. However, the generator is only partially implemented as it can only output an equivalent of the existing yearn strategy and adjust certain values for now. This could be improved in the future quite easily. Basically I wanted to test how no-code smart contract programming could be achieved and I think by combining blockly with solidity or vyper this could be a very interesting tool for smart contract devs to avoid a lot of boilerplate code.

defi_blocks showcase

How it's made

The tool generates the smart contract solidity code by applying a configured block to a given template file which is provided. The logic is currently very limited, the idea was just if it's doable and how no-code programming of smart contracts could be used. I've created the blockly block for the yearn strategy by analyzing a smart contract from the yearn-starter-pack repo on github. I then created the block with the help of a blockfactory from google, which is basically an awesome way to create blockly blocks with blockly itself :-) The resulting XML file that represents the block is then parsed and regex-matched against a prepared template contract representing the mentioned yearn contract. I wouldn't call that programming but it's a way to do it quick&dirty and play with smart contracts and no-code development at the same time. I have to admit that I have started way too late and this was a massive experience for me. Fortunately, I can continue to code on the project after the hackathon as well :-)

Technologies used

SolidityYearn Vaults