Skip to content

Commit

Permalink
Merge pull request #65 from MoonSHRD/network/ropsten
Browse files Browse the repository at this point in the history
MST fix
  • Loading branch information
JackBekket committed Oct 12, 2021
2 parents 2898038 + 932a224 commit bfecd46
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Universal NFT Marketplace

### Currencies erc20
We use some stable-coins and other erc20 tokens as currencies
So users can set up and get paid in USDT,USDC,DAI, SNM or other custom currencies
So users can set up and get paid in USDT,USDC,DAI,MST or other custom currencies

For more info see `./contracts/721/singleton/CurrenciesERC20.sol`

Expand Down
10 changes: 5 additions & 5 deletions contracts/721/singleton/CurrenciesERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ contract CurrenciesERC20 is ReentrancyGuard, Ownable {
/**
* @dev Hardcoded (not-extetiable after deploy) erc20 currencies
*/
enum CurrencyERC20 {USDT, USDC, DAI, SNM, WETH}
enum CurrencyERC20 {USDT, USDC, DAI, MST, WETH}

struct CurrencyERC20_Custom {
address contract_address;
Expand Down Expand Up @@ -79,14 +79,14 @@ contract CurrenciesERC20 is ReentrancyGuard, Ownable {
}


constructor(address US_Tether, address US_Circle, address DAI, address W_Ethereum, address SONM) {
constructor(address US_Tether, address US_Circle, address DAI, address W_Ethereum, address MST) {


require(US_Tether != address(0), "USDT contract address is zero!");
require(US_Circle != address(0), "US_Circle contract address is zero!");
require(DAI != address(0), "DAI contract address is zero!");
require(W_Ethereum != address(0), "W_Ethereum contract address is zero!");
require(SONM != address(0), "SONM contract address is zero!");
require(MST != address(0), "MST contract address is zero!");



Expand All @@ -96,15 +96,15 @@ contract CurrenciesERC20 is ReentrancyGuard, Ownable {
_currencies_hardcoded[CurrencyERC20.USDC] = IERC20Metadata(US_Circle);
_currencies_hardcoded[CurrencyERC20.DAI] = IERC20Metadata(DAI);
_currencies_hardcoded[CurrencyERC20.WETH] = IERC20Metadata(W_Ethereum);
_currencies_hardcoded[CurrencyERC20.SNM] = IERC20Metadata(SONM);
_currencies_hardcoded[CurrencyERC20.MST] = IERC20Metadata(MST);



// AddCustomCurrency(US_Tether);
// AddCustomCurrency(US_Circle);
// AddCustomCurrency(DAI);
// AddCustomCurrency(W_Ethereum);
AddCustomCurrency(SONM);
AddCustomCurrency(MST);



Expand Down
2 changes: 1 addition & 1 deletion contracts/721/singleton/TokenSale721.sol
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ contract TokenSale721 is Context, ReentrancyGuard {


// Supported erc20 currencies: .. to be extended
//enum CurrencyERC20 {USDT, USDC, DAI, SNM, WETH}
//enum CurrencyERC20 {USDT, USDC, DAI, MST, WETH}
// CurrenciesERC20.CurrencyERC20 -- enum from above
// Alternativly use CurrenciesERC20.

Expand Down
3 changes: 1 addition & 2 deletions migrations/2_deploy_contracts.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ var MST = artifacts.require("./test_erc20_tokens/MST.sol");
var usdt_address = web3.utils.toChecksumAddress('0x3b00ef435fa4fcff5c209a37d1f3dcff37c705ad');
var usdc_address = web3.utils.toChecksumAddress('0xeb8f08a975ab53e34d8a0330e0d34de942c95926');
var dai_address = web3.utils.toChecksumAddress('0x95b58a6bff3d14b7db2f5cb5f0ad413dc2940658');
var weth_address = web3.utils.toChecksumAddress('0xc778417e063141139fce010982780140aa0cd5ab');
const snm_address = "0x98201f86F578154e01ec683E1962578855d8320C";
var weth_address = web3.utils.toChecksumAddress('0xc778417e063141139fce010982780140aa0cd5ab');

//var deposit_value = '50000'; // deposit INITIAL exchange market cup (turn capital)
//var deposit_value_wei = web3.utils.toWei(deposit_value,'ether');
Expand Down
20 changes: 20 additions & 0 deletions ropsten_addresses.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,24 @@ MSNFT
MasterFactory721
0x50112D712A5A96D9aEeD0583198417Bccdb9F8bC

After deploying (and releasing) new version do not forget to upd this doc and to create release with tag and attach ./build directory to it!


v0.0.3

MST(dummy) -- this is DUMMY contract, we own this contract and we can use it for mint, buy, transfer and other tests
0x95C828A9c342A235A99c2fa603D3cbEcd098AF9C

WETH -- this is wrapped ethereum contract. You can use this contract to wrap your test ether to test weth erc20 tokens. those tokens can be used to testing buy, transfer and other tests
0x98201f86F578154e01ec683E1962578855d8320C

CurrenciesERC20
0x2d2Db8737F54a06CB12Ad7527bf0987577798105

MSNFT
0x11001EBDBf11388d646CF7eAA3131a3cF5146778

MasterFactory721
0x2D25FcAf99f1ab5BC523c3f0AaAfA63c2dA6caB5

After deploying (and releasing) new version do not forget to upd this doc and to create release with tag and attach ./build directory to it!
30 changes: 15 additions & 15 deletions test/MasterFactory721.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const MSNFT = artifacts.require('MSNFT');
const USDTcontract = artifacts.require('TestUSDT');
const USDCcontract = artifacts.require('USDC');
const DAIcontract = artifacts.require('DAI');
const SNMcontract = artifacts.require('SNM');
const MSTcontract = artifacts.require('MST');
const WETHcontract = artifacts.require('WETH');
const TokenSale721 = artifacts.require('TokenSale721');

Expand All @@ -13,9 +13,9 @@ const {BN,expectEvent} = require('@openzeppelin/test-helpers');

contract('MasterFactory721', accounts => {
let factory;
let usdc;
let usdc, mst;
let tokenSale721;
const [USDT, USDC, DAI, SNM, WETH] = [0, 1, 2, 3, 4];
const [USDT, USDC, DAI, MST, WETH] = [0, 1, 2, 3, 4];
let tokensTotal = '50';
const admin = accounts[0];
const user = accounts[2];
Expand All @@ -36,7 +36,7 @@ contract('MasterFactory721', accounts => {
// usdc = await USDCcontract.deployed();
// dai = await DAIcontract.deployed();
// weth = await WETHcontract.deployed();
snm = await SNMcontract.deployed();
mst = await MSTcontract.deployed();
});

// it('should create master copy with no limit supply type', async () => {
Expand Down Expand Up @@ -364,20 +364,20 @@ contract('MasterFactory721', accounts => {

// });

it('should buy nft tokens by SNM', async () => {
let userTokenBalanceBefore = await snm.balanceOf('0x1b7C81DbAF6f34E878686CE6FA9463c48E2185C7', {from: '0xF87F1eaa6Fd9B65bF41F90afEdF8B64D6487F61E'});
assert.equal(userTokenBalanceBefore, 0, 'current admins token balance');
// it('should buy nft tokens by MST', async () => {
// let userTokenBalanceBefore = await snm.balanceOf('0x1b7C81DbAF6f34E878686CE6FA9463c48E2185C7', {from: '0xF87F1eaa6Fd9B65bF41F90afEdF8B64D6487F61E'});
// assert.equal(userTokenBalanceBefore, 0, 'current admins token balance');

let tokensToMint = web3.utils.toWei(web3.utils.toBN(tokensTotal));
// let tokensToMint = web3.utils.toWei(web3.utils.toBN(tokensTotal));

const receipt = await snm.MintERC20('0x1b7C81DbAF6f34E878686CE6FA9463c48E2185C7', tokensToMint, {from: '0xF87F1eaa6Fd9B65bF41F90afEdF8B64D6487F61E'});
assert.equal(receipt.logs.length, 1, 'triggers one event');
assert.equal(receipt.logs[0].event, 'Transfer', 'should be the Transfer event');
assert.equal(receipt.logs[0].address, snm.address, 'minted tokens are transferred from');
// const receipt = await snm.MintERC20('0x1b7C81DbAF6f34E878686CE6FA9463c48E2185C7', tokensToMint, {from: '0xF87F1eaa6Fd9B65bF41F90afEdF8B64D6487F61E'});
// assert.equal(receipt.logs.length, 1, 'triggers one event');
// assert.equal(receipt.logs[0].event, 'Transfer', 'should be the Transfer event');
// assert.equal(receipt.logs[0].address, snm.address, 'minted tokens are transferred from');

let userTokenBalanceAfter = await snm.balanceOf('0x1b7C81DbAF6f34E878686CE6FA9463c48E2185C7', {from: '0xF87F1eaa6Fd9B65bF41F90afEdF8B64D6487F61E'});
console.log('userTokenBalanceAfter');
console.log(userTokenBalanceAfter);
// let userTokenBalanceAfter = await snm.balanceOf('0x1b7C81DbAF6f34E878686CE6FA9463c48E2185C7', {from: '0xF87F1eaa6Fd9B65bF41F90afEdF8B64D6487F61E'});
// console.log('userTokenBalanceAfter');
// console.log(userTokenBalanceAfter);
// assert.equal(userTokenBalanceAfter.toString(), tokensToMint.toString(), 'admins token balance after mint');

// console.log(userTokenBalanceAfter.toString());
Expand Down
21 changes: 21 additions & 0 deletions test/ropsten/MasterFactory721.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const MasterFactory721 = artifacts.require('MasterFactory721');
const MSNFT = artifacts.require('MSNFT');
const USDTcontract = artifacts.require('TestUSDT');
const USDCcontract = artifacts.require('USDC');
const DAIcontract = artifacts.require('DAI');
const MSTcontract = artifacts.require('MST');
const WETHcontract = artifacts.require('WETH');
const TokenSale721 = artifacts.require('TokenSale721');

const IERC20Metadata = artifacts.require("../../../node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol");

const {BN,expectEvent} = require('@openzeppelin/test-helpers');

contract('MasterFactory721',function(accounts){
let tokenInstance;
it('sets the total supply upon deployment', function(){
return MasterFactory721.deployed().then(function(instance){
tokenInstance = instance;
});
});
});

0 comments on commit bfecd46

Please sign in to comment.