Contracts handling Marble.cards collectibles and other stuff.
Truffle.js is expecting env variables for running correctly. Change out values in ~/src/sample.env and rename it to ~/src/.env.
WALLET_PASSWORDS = <ur psswds>
WALLET_MNEMONIC = <ur mnemonic>
INFURA_KEY = <ur infura key>
LOG = <true | false>
- Run
docker-compose build
in root directory of repository. docker-compose up
There is no exposed ports. All we need is located over linked volumes.
-
Follow docker instruction to have ready all dev tools you need.
-
To build the contracts get into builder image:
docker-compose exec builder bash
-
Use truffle to build it. Result will be in ~/build/contracts folder.
cd original npx truffle compile cd ../metatransactions npx truffle compile
- Ganache should be listening on 7545 if u did not change truffle configuration than just run
npx truffle migrate
To deploy contract over Ropsten network we have to set up account over geth node unlock it and call truffle
-
Run docker containers needed to deploy contracts
docker-compose -f docker-compose.yml -f docker-compose.ropsten.yml build docker-compose -f docker-compose.yml -f docker-compose.ropsten.yml up -d
-
Create delete.me file containing your private key
-
Get into geth image.
docker-compose -f ./docker-compose.yml -f ./docker-compose.ropsten.yml exec geth /bin/sh
-
Import account
geth --testnet account import /docker-entrypoint/delete.me
-
Open get console
geth attach ~/.ethereum/testnet/geth.ipc
-
Unlock account (geth console). if u don't see imported account, then restart geth container.
personal.unlockAccount(eth.accounts[0], undefined, 2200)
-
Go to console of image where is truffle installed
docker-compose -f docker-compose.yml -f docker-compose.ropsten.yml exec builder bash
-
Migrate script to Ropsten network via infrura
# npm run clean npx truffle migrate --network infuraRopsten
To deploy contract over Ropsten network we have to set up account over geth node unlock it and call truffle
-
Create .env add WALLET_MNEMONIC and INFURA_KEY
WALLET_MNEMONIC = ... INFURA_KEY = ...
-
Run docker containers needed to deploy contracts
docker-compose -f docker-compose.yml -f docker-compose.ropsten.yml build docker-compose -f docker-compose.yml -f docker-compose.ropsten.yml up -d docker-compose -f docker-compose.yml -f docker-compose.ropsten.yml exec builder bash
-
Migrate script to Ropsten network via infrura
# npm run clean npx truffle migrate --network infuraRopsten
-
Migrate script to Mainnet network via infrura
1-2. Steps same as above
- Migrate script to Mainnet network via infrura
# npm run clean npx truffle migrate --network mainnet
-
Create .env and add WALLET_MNEMONIC
WALLET_MNEMONIC = ...
-
Start docker containers
docker-compose up
-
Deploy mumbai contracts
docker-compose exec builder bash cd ./original npx truffle migrate --network mumbai cd ../metatransations npx truffle migrate --network mumbai
HINT: to deploy to Matic mainnet, use network mainnet instead of mumbai.
-
Enter builder container.
docker-compose exec builder bash
-
Run tests. Expecting 6 unlocked wallets. 1st wallet over node is consider as owner of contracts.
npx truffle test ./test/contracts/marbleIntegrityTest.js npx truffle test ./test/contracts/marbleCandidateTest.js npx truffle test ./test/contracts/marbleNFTTest.js npx truffle test ./test/contracts/marbleMintingAuctionTest.js npx truffle test ./test/contracts/marbleAuctionTest.js npx truffle test ./test/contracts/marbleNFTFactoryTest.js
-
Enter builder container.
docker-compose exec builder bash
-
Run tests. Expecting 6 unlocked wallets. Their PKs should be provided in ./src/.env !!! DO NOT COMMIT THEM :))) !!!
npx truffle test --network infuraRopstenTest ./test/contracts/marbleIntegrityTest.js npx truffle test --network infuraRopstenTest ./test/contracts/marbleCandidateTest.js npx truffle test --network infuraRopstenTest ./test/contracts/marbleNFTTest.js npx truffle test --network infuraRopstenTest ./test/contracts/marbleMintingAuctionTest.js npx truffle test --network infuraRopstenTest ./test/contracts/marbleAuctionTest.js npx truffle test --network infuraRopstenTest ./test/contracts/marbleNFTFactoryTest.js
Copy NFTs to newly deployed contracts it's neccessery to provide original factory contract
npx truffle-deploy --network infuraRopsten ./deployments/001_copy_marbles.js
Check deployed contracts (over Ropsten via infura)
npx truffle-deploy --network infuraRopsten ./deployments/002_show_deployed_contracts.js
Show all candidates (over Ropsten via infura)
npx truffle-deploy --network infuraRopsten ./deployments/003_show_candidates.js
Mint one NFT (over Ropsten via infura)
npx truffle-deploy --network infuraRopsten ./deployments/004_mint_one.js
Set new last minted ID (over Ropsten via infura)
npx truffle-deploy --network infuraRopsten ./deployments/005_set_last_minted_id.js
Temporary playground (over Ropsten via infura)
npx truffle-deploy --network infuraRopsten ./deployments/006_temp.js