Skip to content

Instantly share code, notes, and snippets.

View snaketh4x0r's full-sized avatar
💭
move fast and break things

snaketh4x0r snaketh4x0r

💭
move fast and break things
View GitHub Profile
[
{
"inputs": [
{
"internalType": "contract IERC20",
"name": "_TokenAddress",
"type": "address"
},
{
"internalType": "contract IERC1620",
pragma solidity ^0.5.1;
import "https://github.com/snaketh4x0r/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20Detailed.sol";
import "https://github.com/snaketh4x0r/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol";
contract Token is ERC20, ERC20Detailed {
constructor () public ERC20Detailed("Vitalik", "VIK", 18) {
_mint(msg.sender, 1000000 * (10 ** uint256(decimals())));
}
1.First deploy NFT test contract
2.then mint test NFT token ->Token id keeps incrementing on succesful mint function call
3.then deploy NFT marketplace contract with mock ERC20 token address,NFT contract address created in previous step,currentprice
note:currentprice is in wei ,use https://eth-converter.com/ for appropriate calculations
4.then first call approve function of NFT contract with to as NFTmarketplace contract address and token id which you have previously minted
5.then call depositToken of NFT marketplace with token id which you have minted
6.now your NFT token is transferred to contract
7.call purchaseETH or purchaseMana with right arguments
Note:looks like metamask can't estimate Ether amount in purchaseETH function,so call getCurrentprice to get price and send appropriate amount of ether = current price
pragma solidity ^0.5.17;
import "https://github.com/snaketh4x0r/openzeppelin-contracts/blob/master/contracts/token/ERC721/ERC721Full.sol";
import "https://github.com/snaketh4x0r/openzeppelin-contracts/blob/master/contracts/drafts/Counters.sol";
contract NFTTest is ERC721Full {
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
constructor() ERC721Full("TestTok", "TOK") public {
pragma solidity ^0.5.17;
import "https://github.com/snaketh4x0r/openzeppelin-contracts/blob/master/contracts/ownership/Ownable.sol";
import "https://github.com/snaketh4x0r/openzeppelin-contracts/blob/master/contracts/token/ERC721/ERC721Full.sol";
import "https://github.com/snaketh4x0r/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol";
/**
* flow
* admin pass the address of nft token during deployment in Constructor
* admin use setCurrentPrice setter function to set price
C:\Users\lazypuppet\Matic-DEX-Aggregator\Kyber\SmartContracts>truffle migrate --network matic
Compiling your contracts...
===========================
> Compiling .\contracts\ConversionRatesInterface.sol
> Compiling .\contracts\ERC20Interface.sol
> Compiling .\contracts\ExpectedRate.sol
> Compiling .\contracts\ExpectedRateInterface.sol
> Compiling .\contracts\FeeBurner.sol
> Compiling .\contracts\FeeBurnerInterface.sol
/**
*Submitted for verification at Etherscan.io on 2019-11-12
*/
// File: @openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.5.2;
/**
* @title ERC20 interface
/**
*Submitted for verification at Etherscan.io on 2019-11-12
*/
// File: @openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.5.2;
/**
* @title ERC20 interface
#reputation calculation
def getRep(add):
part1="https://map-api-direct.foam.space:443/user"
part3='assets'
part2='/'.join((add,part3))
url='/'.join((part1,part2))
response=requests.get(url)
tempobj=response.json()
tempstake=int(tempobj['verifiedPOIs'])
rep=0
postgres=# CREATE DATABASE discourse2;
CREATE DATABASE
postgres=# \c
You are now connected to database "postgres" as user "postgres".
postgres=# \c discourse2
You are now connected to database "discourse2" as user "postgres".
discourse2=# CREATE TABLE accounts(id integer PRIMARY KEY NOT NULL,address TEXT,reputation integer NOT NULL);
CREATE TABLE
discourse2=# SELECT * FROM accounts;