3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# File 'lib/ether_dev/generators/project_templates.rb', line 3
def project_templates
templates = {}
templates["Gemfile"] = " gem \"etherdev\"\n gem \"ethereum.rb\", github: \"michiels/ethereum.rb\", branch: \"fixes-for-etherdev\"\n EOS\n\n templates[\"Rakefile\"] = <<~'EOS'\n spec = Gem::Specification.find_by_name 'etherdev'\n load \"\#{spec.gem_dir}/lib/ether_dev/test_task.rake\"\n EOS\n\n templates[\"blockchain.yml\"] = <<~'EOS'\n # You can use the Project Orca test Ethereum blockchain to easily\n # test and stage your contracts and interact with them in your team\n # or from other deployed apps.\n #\n # Sign up at https://projectorca.net and uncomment the following:\n #\n # development:\n # rpc: https://rpc.projectorca.net\n # # Put your private account key here:\n # account_key: c38dbe6e3725e012ec5e1d114ccc9061bb02946e5efdd1b2c7e0856897cfa0ef\n test:\n rpc: http://localhost:7545\n EOS\n\n templates[\"Greeter.sol\"] = <<~'EOS'\n contract mortal {\n /* Define variable owner of the type address */\n address owner;\n\n /* This function is executed at initialization and sets the owner of the contract */\n function mortal() { owner = msg.sender; }\n\n /* Function to recover the funds on the contract */\n function kill() { if (msg.sender == owner) selfdestruct(owner); }\n }\n\n contract greeter is mortal {\n /* Define variable greeting of the type string */\n string greeting;\n\n /* This runs when the contract is executed */\n function greeter(string _greeting) public {\n greeting = _greeting;\n }\n\n /* Main function */\n function greet() constant returns (string) {\n return greeting;\n }\n }\n EOS\n\n templates[\"test_helper.rb\"] = <<~'EOS'\n require \"ether_dev/test_helper\"\n EOS\n\n templates[\"greeter_test.rb\"] = <<~'EOS'\n require \"test_helper\"\n\n class GreeterTest < EtherDev::TestCase\n def test_greet\n @contract.deploy_and_wait(\"Hello, World!\")\n\n assert_equal \"Hello, World!\", @contract.call.greet()\n end\n end\n EOS\n\n templates\nend\n"
|