Skip to content

Instantly share code, notes, and snippets.

View ayinot's full-sized avatar

skygirl ayinot

  • Singapore
View GitHub Profile
pragma solidity ^0.4.23;
contract Number {
function test1() public returns(int n1, int n2, int n3,int n4,int n5,int n6,int n7,int n8,int n9,
int n10,int n11,int n12,int n13,int n14){
n1 = 1;
n2 = 1;
pragma solidity ^0.4.19;
contract Interchain {
bytes public selector;
bytes public destHash;
function withdrawal(bytes32 destHash) returns(bytes4){
return this.withdrawal.selector;
pragma solidity ^0.4.23;
contract Test {
bytes public result;
function saveArgs(uint arg1,bool arg2, string arg3, address arg4) public returns(bytes4){
return this.saveArgs.selector;
}
function encodeMe(bytes4 selector, uint arg1,bool arg2, string arg3, address arg4) returns(bytes){
@ayinot
ayinot / Parsing.sol
Created May 2, 2018 04:37
Parsing the TxnInput
contract Parsing {
function callNumber(uint256 number) public view returns(bytes32){
bytes32 hash = keccak256("callNumber(uint256)");
return hash;
}
function callAddress(address _addr) public view returns(bytes32){
bytes32 hash = keccak256("callAddress(address _addr)");
return hash;
import _ from 'lodash' // importing extend library from javascript
import { expect } from 'chai' // importing mocha chai library for unit testing
import { web3 } from './helpers/w3' // importing w3 script from helpers to import w3 functions
import expectRevert from './helpers/expectRevert'
const accounts = web3.eth.accounts
const KeyValueStorage = artifacts.require("KeyValueStorage"); //eternal storage contract
const NumberLogicV1 = artifacts.require("NumberLogicV1"); //Implementation v1
pragma solidity ^0.4.0;
import "./StorageStateful.sol";
contract NumberLogicV2 is StorageStateful{
function getNumber()public returns(uint){
return _storage.getUint("MyNumber");
}
}
pragma solidity ^0.4.0;
import "./StorageStateful.sol";
contract NumberLogicV1 is StorageStateful{
function setNumber(uint _number) public {
_storage.setUint("MyNumber", 20*_number);
}
pragma solidity ^0.4.18;
import "./KeyValueStorage.sol";
import "./StorageStateful.sol";
import "./KeyValueStorage.sol";
contract StorageConsumer is StorageStateful {
function StorageConsumer(KeyValueStorage storage_) public {
_storage = storage_;
}
pragma solidity ^0.4.18;
import "./Ownable.sol";
contract Proxy is Ownable {
event Upgraded(address indexed implementation);
address internal _implementation;
pragma solidity ^0.4.0;
import "./KeyValueStorage.sol";
import './StorageConsumer.sol';
import './Proxy.sol';
contract StoreNumber is StorageConsumer, Proxy {
function StoreNumber(KeyValueStorage storage_)
public
StorageConsumer(storage_)
{