Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
fix test @openzeppelin/contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
clbrge committed Sep 20, 2020
1 parent fbd3dc8 commit 2cfc30e
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 43 deletions.
41 changes: 22 additions & 19 deletions migrations/2_deploy_contracts.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,7 @@ const RougeBridge = artifacts.require("./RougeBridge.sol")

module.exports = async function(deployer, network) {

const rgeAddress = {
sokol: '0x5475300766433dd082a7340fc48a445c483df68f'
}

if (network && rgeAddress[network]) {

const rge = await RGETokenInterface.at(rgeAddress[network])

await deployer.deploy(RougeFactory)
const factory = await RougeFactory.deployed()

const results = await Promise.all([
rge.setFactory(factory.address),
factory.setParams(rge.address, 100000)
]);

console.log('results', results)

} else if (false) {
if (['test'].includes(network)) {

await Promise.all([
deployer.deploy(TestRGEToken),
Expand All @@ -48,6 +30,27 @@ module.exports = async function(deployer, network) {
factory.setParams(rge.address, 100000)
]);

return
}

const rgeAddress = {
sokol: '0x5475300766433dd082a7340fc48a445c483df68f'
}

if (network && rgeAddress[network]) {

const rge = await RGETokenInterface.at(rgeAddress[network])

await deployer.deploy(RougeFactory)
const factory = await RougeFactory.deployed()

const results = await Promise.all([
rge.setFactory(factory.address),
factory.setParams(rge.address, 100000)
]);

console.log('results', results)

}

};
82 changes: 65 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions test/Attachments.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
const { newTestCampaign, getBalanceInFinney, authHash, protocolSig } = require('./utils.js');

const truffleContract = require("@truffle/contract")
const EIP20 = require("@openzeppelin/contracts/build/contracts/ERC20.json");
const EIP721 = require("@openzeppelin/contracts/build/contracts/ERC721.json");
const EIP20 = require("@openzeppelin/contracts/build/contracts/ERC20Mintable.json");
const EIP721 = require("@openzeppelin/contracts/build/contracts/ERC721Mintable.json");

const RGEToken = artifacts.require("./TestRGEToken.sol");
const Factory = artifacts.require("./RougeFactory.sol");
Expand Down Expand Up @@ -74,7 +74,8 @@ contract('SimpleRougeCampaign(Attachments)', function(accounts) {

const ERC20 = truffleContract(EIP20)
ERC20.setProvider(web3.currentProvider);
const erc20 = await ERC20.new(issuer, erc20_attachment * 10, {from: issuer});
const erc20 = await ERC20.new({from: issuer});
const tx_mint = await erc20.mint(issuer, erc20_attachment * 10, {from: issuer});

await erc20.approve(campaign.address, erc20_attachment, {from: issuer});

Expand Down Expand Up @@ -131,7 +132,7 @@ contract('SimpleRougeCampaign(Attachments)', function(accounts) {

const ERC721 = truffleContract(EIP721)
ERC721.setProvider(web3.currentProvider);
const erc721 = await ERC721.new({from: issuer});
const erc721 = await ERC721.new( {from: issuer});

const campaignBalance_before = await erc721.balanceOf.call(campaign.address);
assert.equal(campaignBalance_before, 0, "no erc721 transfered yet");
Expand Down
5 changes: 2 additions & 3 deletions truffle.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

const PrivateKeyProvider = require("truffle-privatekey-provider");
const privateKey = process.env.PKEY || '';

module.exports = {
solc: {
Expand All @@ -16,14 +15,14 @@ module.exports = {
network_id: "*" // Match any network id
},
// rinkeby: {
// provider: new PrivateKeyProvider(privateKey, "https://rinkeby.infura.io/"),
// provider: () => new PrivateKeyProvider(privateKey, "https://rinkeby.infura.io/"),
// network_id: 4
// },
sokol: {
//host: "https://sokol-trace.poa.network", //https://sokol.poa.network",
host: "https://sokol.poa.network",
port: 443,
provider: new PrivateKeyProvider(privateKey, "https://sokol.poa.network"),
provider: () => new PrivateKeyProvider(process.env.PKEY, "https://sokol.poa.network"),
network_id: 77,
}
}
Expand Down

0 comments on commit 2cfc30e

Please sign in to comment.