This repository contains smart contracts for the reference implementation of the OpenVASP standard
You can use smart contract Vasp Facade (0xb838ef6121b8093f425fdc336d59e1142c2e289) to create new instance of CASP smart contract.
After call method build
you can see in transaction event VaspCreated
where in first parameter you can see newVaspAddress.
The address that broadcast transaction with build
is automatically set as the owner and administrator.
- open page https://ropsten.etherscan.io/address/0xb838ef6121b8093f425fdc336d59e1142c2e289c#writeContract
- call metod
build
and fill 5 params - check event
VaspCreated
in transaction
- Execute
npm install -g truffle
to install Truffle - Create
.env
file. Specify (see.env.template
):
PRIVATE_KEY
private key for broadcast deployment transaction.ROPSTEN_NODE_URL
json rpc node url for Ropsten network.ETHEREUM_NODE_URL
json rpc node url for Ethereum network.ETHERSCAN_API_KEY
API key from Etherscan account in a case to verify smart contract on Etherscan
- Execite
npm install
to install dependencies - Run local ganache node to test smart contract:
ganache-cli
. - Execite
truffle compile
to compile smart contracts - Execite
truffle test
to run tests - Execite
truffle migrate
to deploy smart contract into local ganache node - Execite
truffle migrate --network ropsten
to deploy smart contract into Ropsten network - Execite
truffle migrate --network ethereum
to deploy smart contract into Ethereum network - Verify smart contract on Etherscan
- Execite
truffle run verify VASP --network ropsten
- Execite
truffle run verify VaspFactory --network ropsten
Execute npm run test
command.
- Create
.env
file. SpecifyROPSTEN_PRIVATE_KEY
andROPSTEN_NODE_URL
with correct values in it (see.env.template
). - Execute
npx oz create VASP --network ropsten
- Agree to initialize the instance after creating it
- Choose
initialize(owner: address, initialAdministrators: address[])
option - Provide an owner's address
- Provide administrators' addresses
- Specify administrator's private key in the
.env
file - Execute
npx oz send-tx <VASP instance address> --method setPostalAddress --args "address line", "post code", "town", "country" --network ropsten
to set postal address. - Execute
npx oz send-tx <VASP instance address> --method setName --args "VASP name" --network ropsten
to set VASP name. - Execute
npx oz send-tx <VASP instance address> --method setEmail --args "VASP e-mail" --network ropsten
to set VASP e-mail. - Execute
npx oz send-tx <VASP instance address> --method setWebsite --args "VASP website url" --network ropsten
to set VASP website url. - Preserve
./openzeppelin/ropsten.json
file for future use.
In some smart contracts you can find a ______gap
variable.
Since OpenZeppelin contracts are used by inheritance, user-defined variables will be placed by the compiler after OpenZeppelin’s ones. If, in a newer version, new variables are added by the library, the storage layouts would be incompatible, and an upgrade would not be possible.
The gap is a workaround to that issue: by leaving a 50-slot gap, we’re able to increase the contract’s storage by that amount (provided we also remove the same slots from the gap) with no clashing issues.