-
Install
truffle
globally withnpm install -g truffle
. -
Run
git clone https://github.com/phDooY/cryptocards-solidity && cd cryptocards-solidity
-
Run
npm install
to install dependencies. -
Configure your
MNEMONIC
andENDPOINT
used for deployment in.env
or sourced in environment variables.You may acquire an endpoint URL from Infura
-
Run
truffle console --network ropsten
. -
Inside the console, run
compile
to compile the contracts. -
Run
migrate
to deploy the contracts to the Ropsten network.You can get free test Ether in order to deploy the contracts from Ropsten Ethereum Faucet.
Note: It is highly recommended to use
migrate --reset
instead of justmigrate
after making changes to the contracts. -
Use the cheatsheet below to interact with the contracts.
Get accounts array and a reference to the deployed contract.
a = await web3.eth.getAccounts()
c = await GiftCards.deployed()
Example calls:
// Call a function. Caller is account 0 by default.
await c.addMaintainer(a[0])
// Call payable function from account 3. Value is in wei.
await c.createCard("some hash", "eleni", "security code hash", {from: a[0], value: 200000000000000000})
// Get card data
d = await c.cards(web3.utils.sha3("some hash"))
// Activate card
await c.activateCard.call(web3.utils.sha3("some hash"), "security code hash", '0x0220A73D5113ED7a85A6B610056573b3FD4968Be')
Exchange wrappers: https://github.com/DecenterApps/cdpsaver-contracts/tree/9fdc6b2fc100a1b5df676840f8e2d748354f23bc/contracts/exchange/wrappers