daily pastebin goal
4%
SHARE
TWEET

Untitled

a guest Nov 18th, 2018 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. contract ScoreStorage {
  2.  
  3.     mapping(bytes32 => uint256) uints;
  4.  
  5.     function setUint(bytes32 _key , uint256 _newScore) external {
  6.         uints[_key] = _newScore;
  7.     }
  8.  
  9.     function getUint(bytes32 _key) external returns(uint256) {
  10.         return uints[_key];
  11.     }
  12.  
  13. }
  14.  
  15. contract Score {
  16.  
  17.     ScoreStorage ss;
  18.     bytes32 public constant SCORE = keccak256("score");
  19.  
  20.     constructor(address scoreStorage) {
  21.         ss = ScoreStorage(scoreStorage);
  22.     }
  23.  
  24.     function setScore(uint256 _score) external {
  25.         ss.setUint(SCORE,_score);
  26.     }
  27.  
  28. }
  29.  
  30.  
  31.  
  32. contract ScoreV2 {
  33.  
  34.     ScoreStorage ss;
  35.     bytes32 public constant SCORE = keccak256("score");
  36.  
  37.     constructor(address scoreStorage) {
  38.         ss = ScoreStorage(scoreStorage);
  39.     }
  40.  
  41.     function setScore(uint256 _score) external {
  42.         ss.setUint(SCORE,_score + 1);
  43.     }
  44.  
  45. }
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