All Projects → pawurb → SmartHold-contracts

pawurb / SmartHold-contracts

Licence: MIT license
Ethereum Smart Contracts for locking your Ether and ERC20 tokens based on time and price conditions

Programming Languages

typescript
32286 projects
solidity
1140 projects

Projects that are alternatives of or similar to SmartHold-contracts

ethtoken.py
Ethereum ERC20 Token Interface, in Python
Stars: ✭ 40 (+73.91%)
Mutual labels:  erc20, ether
tokensale
Blockport tokensale
Stars: ✭ 20 (-13.04%)
Mutual labels:  erc20
Multisender
Token Multisender Dapp smart contract. Airdrop tokens. Batch sending ERC20, ETH, Ethereum tokens. Send thousands of transfers in a few transactions. It can help user to save more tx fee and time than sending one by one
Stars: ✭ 185 (+704.35%)
Mutual labels:  erc20
Erc20 Explorer
An explorer for ERC20 based Ethereum tokens
Stars: ✭ 248 (+978.26%)
Mutual labels:  erc20
Eth Hot Wallet
Ethereum wallet with erc20 support / web wallet - built using react, web3, eth-lightwallet
Stars: ✭ 205 (+791.3%)
Mutual labels:  erc20
QWallet
Blockchain Wallet for Coin & ERC20 Tokens
Stars: ✭ 11 (-52.17%)
Mutual labels:  erc20
Trust Ray
☁️ API for the Trust Wallet. Project no longer supported and current version used as source of transactions and address tokens in Blockatlas https://github.com/trustwallet/blockatlas/blob/master/config.yml#L64
Stars: ✭ 172 (+647.83%)
Mutual labels:  erc20
gas-reporting
Reference documentation on every gas price API and all the different formats
Stars: ✭ 85 (+269.57%)
Mutual labels:  erc20
ethereum-ingest
JavaFX and commandline application to import events from the Ethereum blockchain into ElasticSearch, MongoDB, Hazelcast, CQEngine and SQLite.
Stars: ✭ 34 (+47.83%)
Mutual labels:  ether
Awesome Blockchain Kor
<블록체인의 정석>, <하이퍼레저 블록체인 개발> 소스코드 및 참고자료 저장소
Stars: ✭ 243 (+956.52%)
Mutual labels:  erc20
Yieldfarming
🧑‍🌾 It ain't much, but it's an honest work
Stars: ✭ 235 (+921.74%)
Mutual labels:  erc20
Tokensale
DOCK Tokensale Web App
Stars: ✭ 208 (+804.35%)
Mutual labels:  erc20
koinos-miner
The Koinos Miner (CLI) provides a functional command line interface that allows users to mine the KOIN ERC-20 which will be used to deliver an equitable initial token distribution on the Koinos blockchain.
Stars: ✭ 15 (-34.78%)
Mutual labels:  erc20
Erc20 Generator
Create an ERC20 Token for FREE in less than a minute with the most used Smart Contract Generator for ERC20 Token. No login. No setup. No coding required.
Stars: ✭ 202 (+778.26%)
Mutual labels:  erc20
nft-swap-sdk
Ethereum's missing p2p NFT and token swap library for web3 developers. Written in TypeScript. Powered by 0x.
Stars: ✭ 200 (+769.57%)
Mutual labels:  erc20
Universaltoken
Implementation of Universal Token for Assets and Payments
Stars: ✭ 176 (+665.22%)
Mutual labels:  erc20
Awesome Buggy Erc20 Tokens
A Collection of Vulnerabilities in ERC20 Smart Contracts With Tokens Affected
Stars: ✭ 251 (+991.3%)
Mutual labels:  erc20
contracts
Off-the-shelf Solidity smart contracts
Stars: ✭ 100 (+334.78%)
Mutual labels:  erc20
Optino
Fully collateralised vanilla and bounded (capped call and floored put) crypto options
Stars: ✭ 16 (-30.43%)
Mutual labels:  erc20
Protocol
Loopring Protocol Smart Contract on Ethereum
Stars: ✭ 220 (+856.52%)
Mutual labels:  erc20

SmartHold - a simple way to lock and hold your ETH or ERC20 in a smart contract CircleCI

This is a BETA software that has not been audited for security. USE AT YOUR OWN RISK!

Disclaimer: The information provided in the readme is for educational purposes only and should not be treated as investment advice.

Story of the project

SmartHoldPublic

The SmartHoldPublic contract can be used to lock your Ether for a predefined period of time. Optionally, you can configure an ETH/USD price value that will release the Ether. Compared to other contracts it can be intereacted with by everyone not only the account that deployed it.

SmartHoldETH

The SmartHoldETH contract can be used to lock your Ether for a predefined period of time. Optionally, you can configure an ETH/USD price value that will release the Ether. You need to initialize the contract with the following arguments:

const deposit = await SmartHoldETH.new(
  0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419,
  750,
  10000
)

API

constructor(address _priceFeed, uint256 _lockForDays, int256 _minimumPrice)

  • _priceFeedAddress - [address] address of the price feed oracle contract
  • _lockForDays - [uint256] number of days that you want to lock your funds for (max 4000)
  • _minimumPrice - [int256] minimum price (in USD) that would release the funds (setting it to 0 disables this condition)

canWithdraw() returns (bool) - check if funds can be withdrawn

withdraw() - withdraw funds to the contract maker address

You can send more Ether to the contract after it has been initialized. Only maker of the contract can withdraw the funds. Don't send ERC20 tokens to this contract because they will be stuck forever.

SmartHoldERC20

This contract can hold both ERC20 and ETH tokens. You can use the contract in the following way:

const deposit = await SmartHoldERC20.new()
await deposit.configureToken(
  0x0d8775f648430679a709e98d2b0cb6250d2887ef,
  750,
  0x9441D7556e7820B5ca42082cfa99487D56AcA958,
  5,
  10e7
)

API

configureToken(address _tokenAddress, uint256 _lockForDays, address _feedAddress, int256 _minExpectedPrice, int256 _pricePrecision)

  • _tokenAddress - [address] address of an ERC20 or ETH token, i.e. BAT or ETH
  • _lockForDays - [uint256] how many days you want to lock the token for, counted since contract creation
  • _priceFeedAddress - [address] address of a ChainLink price feed contract, e.g., ETH/USD on Mainnet. Provide a zero address if you don't want to withdraw based on price conditions
  • _minExpectedPrice - [int256] minimum price (in units corresponding to configured _pricePrecision) that would release the funds (setting it to 0 disables this condition)
  • _pricePrecision - [int256] inversed precision of price returned by a price feed, i.e. 10e7 for dollars and 10e5 for cents

Before configuring the token you can validate the price feed address and precision using the following method:

checkPriceFeed(address _feedAddress, int256 _precision) returns (int256)

  • _feedAddress -[address] address of a ChainLink price feed oracle
  • _precision - [int256] precision of returned price values, e.g., 10e7for dollars and10e5` for cents

You can only configure each token once. After it is configured, you can increase the expected minimum price and lock for days duration. Using the following methods:

increaseMinExpectedPrice(address _tokenAddress, int256 _newMinExpectedPrice)

  • _tokenAddress - [address] address of a token
  • _newMinExpectedPrice - [int256] new value of a minimum expected price

increaseLockForDays(address _tokenAddress, uint256 _newLockForDays)

  • _tokenAddress - [address] address of a token
  • _newLockForDays - [uint256] new number of days that you want to lock the funds for

You can check if a given token can be withdrawn by using:

canWithdraw(address _tokenAddress) returns (bool)

  • _tokenAddress - [address] address of a token

If the above method returns true, you can withdraw a selected token using:

withdraw(address _tokenAddress)

  • _tokenAddress - [address] address of a token

Tokens will be returned to the address of a contract maker.

Price feeds

ETH/USD price oracles powered by ChainLink:

More price feeds.

Please be aware that ChainLink price feeds are not guaranteed always to return the correct data. In case they stop responding, you'll only be able to withdraw your funds once the lock period has expired.

Setup

asdf install
npm install
npx hardhat node
npx hardhat test

Security scan

docker pull trailofbits/eth-security-toolbox
docker run -it -v ~/SmartHold-contracts/:/share trailofbits/eth-security-toolbox
cd /share/SmartHold-contracts
slither .
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].