Skip to content

Instantly share code, notes, and snippets.

@sihoang
sihoang / TIIMToken-389cf69
Created April 1, 2019 18:16
Commit Id 389cf69
pragma solidity ^0.4.25;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/lifecycle/Pausable.sol";
import "./ERC677Receiver.sol";
contract TIIMToken is StandardToken, Pausable {
@sihoang
sihoang / TIIMToken-509b42f
Last active April 1, 2019 18:15
Commit Id 509b42f
pragma solidity ^0.4.25;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/lifecycle/Pausable.sol";
import "./Receiver.sol";
contract TIIMToken is StandardToken, Ownable, Pausable {
pragma solidity ^0.5.0;
// Market API used to interract with augur, we only need to describe the
// functions we'll be using.
// cf https://github.com/AugurProject/augur-core/blob/master/source/contracts/reporting/IMarket.sol
interface IMarket {
function isFinalized() external view returns (bool);
function isInvalid() external view returns (bool);
function getWinningPayoutNumerator(uint256 _outcome) external view returns (uint256);
function getEndTime() external view returns (uint256);
pragma solidity ^0.5.0;
// Market API used to interract with augur, we only need to describe the
// functions we'll be using.
// cf https://github.com/AugurProject/augur-core/blob/master/source/contracts/reporting/IMarket.sol
interface IMarket {
function isFinalized() external view returns (bool);
function isInvalid() external view returns (bool);
function getWinningPayoutNumerator(uint256 _outcome) external view returns (uint256);
function getEndTime() external view returns (uint256);
pragma solidity ^0.5.0;
contract ERC20 {
/// @return The total amount of tokens
function totalSupply() public view returns (uint256 supply);
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) public view returns (uint256 balance);
pragma solidity ^0.5.0;
/// https://eips.ethereum.org/EIPS/eip-165
interface ERC165 {
/// @notice Query if a contract implements an interface
/// @param interfaceID The interface identifier, as specified in ERC-165
/// @dev Interface identification is specified in ERC-165. This function
/// uses less than 30,000 gas.
/// @return `true` if the contract implements `interfaceID` and
/// `interfaceID` is not 0xffffffff, `false` otherwise
{
"abi": [
{
"constant": true,
"inputs": [
{
"name": "",
"type": "address"
}
],
@sihoang
sihoang / gist:18ff89e1050b32b99840ef9dcd56f3b6
Created January 18, 2019 21:45
PassiveForwarderFactory
pragma solidity ^0.4.24;
/// @title Smart contract for forwarding ETH to a pre-defined recipient in the passive mode i.e. someone has to trigger the transfer.
/// It also allows recipient to call any smart contracts. For example: Calling Trustcoin smart contract to transfer TRST.
/// @author WeTrustPlatform
contract PassiveForwarder {
/// @dev recipient must be a normal account or a smart contract with the standard payable fallback method.
/// Otherwise, fund will be stuck!
address public recipient;
@sihoang
sihoang / keys
Created December 21, 2018 08:10 — forked from miguelmota/ethereum_keys.sh
Generate Ethereum Private key, Public key, and Address using bash and openssl
# Generate the private and public keys
openssl ecparam -name secp256k1 -genkey -noout | openssl ec -text -noout > key
# Extract the public key and remove the EC prefix 0x04
cat key | grep pub -A 5 | tail -n +2 | tr -d '\n[:space:]:' | sed 's/^04//' > pub
# Extract the private key and remove the leading zero byte
cat key | grep priv -A 3 | tail -n +2 | tr -d '\n[:space:]:' | sed 's/^00//' > priv
# Generate the hash and take the address part
diff --git a/contracts/TimeLockedStaking.sol b/contracts/TimeLockedStaking.sol
index 550592e..9762678 100644
--- a/contracts/TimeLockedStaking.sol
+++ b/contracts/TimeLockedStaking.sol
@@ -59,14 +59,14 @@ contract TimeLockedStaking is ERC165, ISimpleStaking {
/// @dev msg.sender stakes for him/her self.
/// @param amount Number of ERC20 to be staked. Amount must be > 0.
/// @param data Used for signaling the unlocked time.
- function stake(uint256 amount, bytes data) external {
+ function stake(uint256 amount, bytes calldata data) external {