0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Level 5. Token(The Ethernaut)

Last updated at Posted at 2018-04-25

「The Ethernaut by Zeppelin Level 5. Token」を翻訳してみました(CryptoZombiesのように?)

原文はこちら

https://ethernaut.zeppelin.solutions
5. Tokenをクリック

5. Token

難易度 3/6
下記の基本的なトークンコントラクトをハッキングすることがこのレベルのクリア条件だ。
始めに20のトークン量が与えられ、何らかの方法で追加トークンが手に入れば(トークンが20以上になれば)このレベルはクリアとなる。できれば一度大量のトークンを手に入れるのだ。

回答の助けになるヒント

-「距離計」とはどのようなものか考えよ。

ソースコード

pragma solidity ^0.4.18;

contract Token {

  mapping(address => uint) balances;
  uint public totalSupply;

  function Token(uint _initialSupply) public {
    balances[msg.sender] = totalSupply = _initialSupply;
  }

  function transfer(address _to, uint _value) public returns (bool) {
    require(balances[msg.sender] - _value >= 0);
    balances[msg.sender] -= _value;
    balances[_to] += _value;
    return true;
  }

  function balanceOf(address _owner) public view returns (uint balance) {
    return balances[_owner];
  }
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?