Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // A very simple Money contract. It knows its name and territory.
- contract Money {
- string name;
- string territory;
- constructor(string _name, string _territory) public {
- name = _name;
- territory = _territory;
- }
- function moneyName() public constant returns (string){
- return name;
- }
- }
- contract Banker {
- string name;
- address[] public contracts;
- constructor(string _name) public {
- name = _name;
- }
- function createMoney (string _name, string _territory) public{
- Money m = new Money(_name, _territory);
- contracts.push(m);
- }
- function howMany() public constant returns (uint){
- return contracts.length;
- }
- function showMoney(uint index) public constant returns (address) {
- assert (index < contracts.length);
- // You can use the address returned to fetch the money contract.
- return contracts[index];
- }
- }
Add Comment
Please, Sign In to add comment