Contract deployed in Alastria T Network, in the following address:
0x8F21Cf828d0e69152b80a02B50aC42Bb62A167Eb
The main function is: emitNewEvent
Which accepts 4 input parameters:
address origin,
string eventType,
string dataLocation,
string[] metadata
The function emitNewEvent
wil emit an event with the following properties:
event EventDOMEv1(
uint256 indexed index,
uint256 indexed timestamp,
address indexed origin,
string eventType,
string dataLocation,
string[] metadata
);
Events could be filtered by index, timestamp and origin.
The function transferOwnership
allow to the owner, to transfer the ownership of the contract, in order to be able to execute the function emitNewEvent
.
transferOwnership
only accepts one input parameter: A valid Ethereum address.
Prerequisites: NodeJS (tested with v18.17.0)
npm install
You can interact with Smart Contracts in localhost network which contains all the Alastria T Network state.
With this project, you can get a complete fork of the original network in localhost, thanks to hardhat network configuration in hardhat.config.ts
file.
npx hardhat clean
npx hardhat compile
npx hardhat run ./scripts/deploy.ts --network hardhat
.env file must be filled with the private key, and the IP of the network's node.
npx hardhat clean
npx hardhat compile
npx hardhat run ./scripts/deploy.ts --network t_alastria
npx hardhat clean
npx hardhat compile
npx hardhat run ./scripts/deploy.ts --network b_alastria
You can run the automated tests with the following command:
npx hardhat test
- ✓ Deployment should assign the deployer's address to the allowed address
- ✓ Allowed address should be able to emit an event
- ✓ NOT Allowed address should NOT be able to emit an event