I hope we didn't unleash a beast.
A decentralized social media web application based on Ethereum platform.
基于以太坊的去中心化社交程序。
pragma solidity ^0.4.0; | |
// pragma experimental ABIEncoderV2; | |
// https://medium.com/daox/three-methods-to-transfer-funds-in-ethereum-by-means-of-solidity-5719944ed6e9 | |
contract Decent { | |
mapping (bytes32 => mapping(bytes1 => uint256)) state; | |
mapping (address => bytes32) previousArticleTransactionHashMap; | |
mapping (bytes32 => bytes32) previousCommentTransactionHashMap; | |
mapping (bytes32 => bytes32) previousTagTransactionHashMap; | |
address owner; |
pragma solidity ^0.4.0; | |
// pragma experimental ABIEncoderV2; | |
// https://medium.com/daox/three-methods-to-transfer-funds-in-ethereum-by-means-of-solidity-5719944ed6e9 | |
contract Gua { | |
address owner; | |
address public previousContractAddress; | |
/** | |
* 0x0 => earnings | |
* 0x1 => likes |
// https://stackoverflow.com/questions/21647928/javascript-unicode-string-to-hex?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa | |
String.prototype.hexDecode = function(){ | |
var j; | |
var hexes = this.match(/.{1,4}/g) || []; | |
var back = ""; | |
for(j = 0; j<hexes.length; j++) { | |
back += String.fromCharCode(parseInt(hexes[j], 16)); | |
} |
// this file is an example of calling other contracts | |
pragma solidity ^0.4.0; | |
contract Test { | |
mapping (string => uint) data; | |
address public previousContractAddress; | |
Test previousContract; | |
constructor(address previousContractAddress_) public { |
iele_sendTransaction
and iele_call
:➜ mantis-1.0-daedalus-rc1 curl -XPOST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0", "method":"personal_unlockAccount", "params": ["654510a4a13393d9aed326c86bc84df2d5fcfbbf", "4rfv5tgB"], "id": 4}' localhost:8546
{"jsonrpc":"2.0","result":true,"id":4}%
➜ mantis-1.0-daedalus-rc1 curl -XPOST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0", "method":"iele_sendTransaction", "params": [{"from":"654510a4a13393d9aed326c86bc84df2d5fcfbbf", "gasPrice":5000000000, "gasLimit": 1000000, "contractCode": "0x0000004C6303690009666163746F7269616C6800010001618001100042650003026101036600006180011200446500020466000102001B610101030040640000660002F6000103660003FE6700000000", "arguments": []}], "id": 3}' localhost:8546
{"jsonrpc":"2.0","result":"0xb696754c82cc75b2d361b5180fc7f86846c1d54d48c907
const url = require("url"); | |
const BASE = "https://staging.iele.dev-mantis.iohkdev.io"; | |
function resolveApiUrl(relativeUrl) { | |
if (location.hostname.match(/localhost|127\.0\.0\.1/)) { | |
return url.resolve(BASE, relativeUrl); | |
} else { | |
return relativeUrl; | |
} | |
} |