I've started a new white paper / cheat sheet on
a (secure) ruby to solidity (source-to-source) cross-compiler [1].
If anyone is interested in how to turn ruby into solidity (and
ethereum virtual machine (evm) bytecode) let us know!
Question or comments welcome. Yes, the ruby-talk mailing list
right here is the "official" sruby channel.
Cheers. Prost.
PS: Here's a first example:
```
···
############################
# My Token Contract
# @sig (uint256) public
def setup( initial_supply ) @balance_of = Mapping.of( Address => Money ) @balance_of[ msg.sender] = initial_supply
end
# @sig (address, uint256) public returns (bool)
def transfer( to, value )
assert @balance_of[ msg.sender ] >= value
assert @balance_of[ to ] + value >= @balance_of[ to ]
@balance_of[ msg.sender ] -= value @balance_of[ to ] += value
true
end
gets cross-compiled to:
contract MyToken {
mapping (address => uint256) public balanceOf;
constructor( uint256 _initialSupply ) public {
balanceOf[msg.sender] = _initialSupply;
}
function transfer(address _to, uint256 _value) public returns (bool) {
require(balanceOf[msg.sender] >= _value);
require(balanceOf[_to] + _value >= balanceOf[_to]);
This is very interesting - I have been lukewarm about learning solidity but this avenue might motivate me!
Regards,
Phil.
···
On 2019-02-20 03:59, Gerald Bauer wrote:
Hello,
I've started a new white paper / cheat sheet on
a (secure) ruby to solidity (source-to-source) cross-compiler [1].
If anyone is interested in how to turn ruby into solidity (and
ethereum virtual machine (evm) bytecode) let us know!
Question or comments welcome. Yes, the ruby-talk mailing list
right here is the "official" sruby channel.
Cheers. Prost.
PS: Here's a first example:
############################
# My Token Contract
# @sig (uint256) public
def setup( initial_supply )
@balance_of = Mapping.of( Address => Money )
@balance_of[ msg.sender] = initial_supply
end
# @sig (address, uint256) public returns (bool)
def transfer( to, value )
assert @balance_of[ msg.sender ] >= value
assert @balance_of[ to ] + value >= @balance_of[ to ]
@balance_of[ msg.sender ] -= value
@balance_of[ to ] += value
true
end
Thanks for your kind words. The "classic" starter guide for Solidity
is the CryptoZombies (free online) code school [1].
Another (great) alternative language for Solidity with Python
3-Compatible Syntax is the Vyper languague [2].
For secure ruby (sruby) I'm trying to put together a (free online)
programming crypto contracts step-by-step guide / booklet [3]. You can
run all ruby contract samples with "standard" ruby (only requires the
universum library / gem - no test network needed - it's kind of a
simulator / emulator).