Skip to content

Commit

Permalink
marketplace
Browse files Browse the repository at this point in the history
  • Loading branch information
MahithChigurupati committed Jan 9, 2023
1 parent 601a16b commit aa5c672
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
34 changes: 34 additions & 0 deletions marketplace.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//SPDX-License-Identifier: MIT

pragma solidity ^0.8.13;

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.0.0/contracts/token/ERC20/IERC20.sol";


contract marketplaceItem1{
mapping(address => bool) public alreadyBought;
uint public price = 10;
address public owner = payable(msg.sender);

IERC20 public usdcFToken = IERC20(0xd9145CCE52D386f254917e481eB44e9943F39138);
IERC20 public usdtFToken = IERC20(0xD7ACd2a9FD159E69Bb102A1ca21C9a3e3A5F771B);

function payInUSDC() public returns(bool){
require(alreadyBought[msg.sender]==false,"you already bought");
usdcFToken.transferFrom(msg.sender,owner,price);
alreadyBought[msg.sender] = true;
return alreadyBought[msg.sender];
}

function payInUSDT() public returns(bool){
require(alreadyBought[msg.sender]==false,"you already bought");
usdtFToken.transferFrom(msg.sender,owner,price);
alreadyBought[msg.sender] = true;
return alreadyBought[msg.sender];
}

function payInETH() public returns(bool){
//get chainlink data
return true;
}
}
11 changes: 11 additions & 0 deletions sampleUSDC.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//SPDX-License-Identifier: MIT

pragma solidity ^0.8.13;

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.0.0/contracts/token/ERC20/ERC20.sol";
contract usdc is ERC20("testUSDC","testUSDC"){

function mintTwenty() public{
_mint(msg.sender,20);
}
}
11 changes: 11 additions & 0 deletions sampleUSDT.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//SPDX-License-Identifier: MIT

pragma solidity ^0.8.13;

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.0.0/contracts/token/ERC20/ERC20.sol";
contract usdt is ERC20("testUSDT","testUSDT"){

function mintTwenty() public{
_mint(msg.sender,20);
}
}

0 comments on commit aa5c672

Please sign in to comment.