daily pastebin goal
91%
SHARE
TWEET

Untitled

a guest Oct 20th, 2018 67 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
  1. // A very simple Money contract. It knows its name and territory.
  2.  
  3. contract Money {
  4.     string name;
  5.     string territory;
  6.  
  7.     constructor(string _name, string _territory) public {
  8.         name = _name;
  9.         territory = _territory;
  10.     }
  11.  
  12.     function moneyName() public constant returns (string){
  13.         return name;
  14.     }
  15. }
  16.    
  17. contract Banker {
  18.     string name;
  19.     address[] public contracts;
  20.  
  21.     constructor(string _name) public {
  22.         name = _name;
  23.     }
  24.  
  25.     function createMoney (string _name, string _territory) public{
  26.         Money m = new Money(_name, _territory);
  27.         contracts.push(m);
  28.     }
  29.  
  30.     function howMany() public constant returns (uint){
  31.         return contracts.length;
  32.     }
  33.  
  34.     function showMoney(uint index) public constant returns (address) {
  35.         assert (index < contracts.length);
  36.  
  37.         // You can use the address returned to fetch the money contract.
  38.         return contracts[index];
  39.     }
  40.  
  41. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top