Skip to content
This repository was archived by the owner on Dec 3, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
61 changes: 61 additions & 0 deletions contracts/Annonymous.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@


contract SomeToken {

mapping(bytes32 => uint) balances;
mapping(bytes32 => uint) nonces;

function transfer (bytes32 r, bytes32 s, uint8 v, bytes32 hash, bytes32 to, uint256 value, uint256 nonce, uint256 reward, address contractAddress, string chainId) payable public {

address publicAddress = verifyHash(hash, v,r,s);
require(balances[keccak256(publicAddress)] >= value);
bytes32 h = keccak256(publicAddress, to, value, nonce, reward, contractAddress, chainId);

require(hash == h, "hashes didnt match");

++nonces[keccak256(publicAddress)];

// can make the transfer

// TODO use safemath lib here
balances[keccak256(publicAddress)] -= value;
balances[to] += value;

}

function verifyHash(bytes32 hash, uint8 v, bytes32 r, bytes32 s) public pure
returns (address signer) {

bytes32 messageDigest = keccak256("\x19Ethereum Signed Message:\n32", hash);

return ecrecover(messageDigest, v, r, s);
}

function nonce(bytes32 addr) public returns(uint) {
return nonces[addr];
}

function balance(bytes32 addr) public returns (uint) {
return balances[addr];
}


function mint(bytes32 addr) payable public {
require(msg.value > 0, "please send some eth");
balances[addr] += msg.value;

}


function transferUTXO(bytes32[] r, bytes32[] s, uint8[] v, bytes32[] hashes, bytes32[] to, uint[] values, uint[] nonces, uint reward, address contractAddress, string chainId ) public {
require(r.length == s.length && s.length == v.length && v.length == to.length);
require(contractAddress == address(this), "Not intended for this contract");
require(keccak256(chainId) == keccak256("0x01"));

for(uint i = 0; i < r.length; ++i) {
transfer(r[i], s[i],v[i],hashes[i], to[i], values[i], nonces[i], reward, contractAddress, chainId);
}
msg.sender.transfer(reward);

}
}
23 changes: 23 additions & 0 deletions contracts/Migrations.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
pragma solidity ^0.4.23;

contract Migrations {
address public owner;
uint public last_completed_migration;

constructor() public {
owner = msg.sender;
}

modifier restricted() {
if (msg.sender == owner) _;
}

function setCompleted(uint completed) public restricted {
last_completed_migration = completed;
}

function upgrade(address new_address) public restricted {
Migrations upgraded = Migrations(new_address);
upgraded.setCompleted(last_completed_migration);
}
}
5 changes: 5 additions & 0 deletions migrations/1_initial_migration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var Migrations = artifacts.require("./Migrations.sol");

module.exports = function(deployer) {
deployer.deploy(Migrations);
};
1 change: 1 addition & 0 deletions node_modules/.bin/miller-rabin

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/mime

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/mkdirp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/rimraf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/seek-bunzip

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/seek-table

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/sha.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/sshpk-conv

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/sshpk-sign

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/sshpk-verify

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/targz

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/uuid

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions node_modules/@types/node/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions node_modules/@types/node/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading