Code Monkey home page Code Monkey logo

solidity-experiments's Introduction

solidity-experiments

My test-driven experiments to learn solidity.

Requirements

npm install

Run the tests

npx truffe test

Experiments

What happens when you cast to a contract passing the wrong address?

If the contract has the same ABI, or even extra state variables, the cast will work. If the contract is missing a state variable, it will fail. If the address is an externally owned account, it will fail.

When is the parent constructor implicitly called?

When the constructor of the parent has no arguments. If the constructor of the parent has arguments and it is not explicitly called on the child, an error is raised: The contract code couldn't be stored, please check your gas amount.

How to use a modifier from another contract?

Inherit from the other contract.

Is it possible to use a modifier from a library?

No, this is not implemented on solidity. See ethereum/solidity#2467

What happens if you access the element after the last one? It fails with invalid opcode.

What happens if you increase the length of an array? It fills the new elements with zero values, even if there were other values in those positions before.

What happens if you try to add an element to an index out of bounds? It fails with invalid opcode.

solidity-experiments's People

Contributors

come-maiz avatar

Watchers

James Cloos avatar

Forkers

dowlandaiello

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.