- Like MinimalToken, its constructor takes as parameter an amount that is given initially to the deployer.
- Create an event `Transfer(address, address, uint)` that returns the address from which the funds where transferred (the variable should be called `sender`), the address of the `recipient` and the `amount` of the transfer. Trigger the event within the transfer function
- Create an event `Minting(address, amount)` that returns the `address``recipient` to which token were minted and the `amount` of tokens created. Trigger the event when appropriate.
- Create a Smart Conctract named `EventfulToken`
- Like MinimalToken, its constructor takes as parameter an amount that is given initially to the deployer.
- Create an event `Transfer(address indexed , address indexed, uint)` that returns the address from which the funds where transferred (the variable should be called `sender`), the address of the `recipient` and the `amount` of the transfer. Trigger the event within the transfer function. N
- Create an event `Minting(address, amount)` that returns the `address``recipient` to which token were minted and the `amount` of tokens created. Trigger the event when appropriate.
### Hint
The `indexed` keyword will facilitate the filtering by this field of the event in later exercises.
Create a web page, `readSecret.html` that loads an ethereum library, connects to ethereum testnet `kovan` and displays a secret contained in a smart contract.
Create a web page, `read-secret.html` that loads an ethereum library, connects to ethereum testnet `Sepolia` and displays a secret contained in a smart contract.
The smart contract is available at the address `0x27c8dda37a22a29cb78320bf5e1c81ca087b2f8e` on Kovan testnet. It contains one function `getSecret()` that returns a string.
The smart contract is available at the address `0x467782A5ab90af6baA6f8af0b4E69A7Ddb197fF0` on Sepolia testnet. It contains one function `getSecret()` that returns a string.
You might use the following interface :
@ -12,6 +12,10 @@ You might use the following interface :
const abi = ["function getSecret() view returns (string)"];
```
⚠️ As the test does not reach the internet:
- Store in a hardcoded manner the result in an element with `storedSecret` as id.
- Detect when internet is not available and skip the connection to the provider.
- Create a JavaScript file `transfersHistory.js`that exports the function `transfersHistory(address, address)` that takes as parameters the address of a MinimalTokenEvent Smart Contract instance and the address of an user.
- Create a JavaScript file `transfersHistory.js`that exports the function `transfersHistory(address, address)` that takes as parameters the address of a `EventfulToken` Smart Contract instance and the address of an user.
It returns an array with all the transfers from that account, starting from the most recent, positive if it is toward the user, and negative if it is outside.
The function will connect to a local node and retrieve the events. It returns an array with all the transfers from that account, starting from the most recent, positive if it is toward the user, and negative if it is outside.
#### Structure
```js
const { ethers } = require("ethers");
async function transfersHistory(contractAddress, userAddress) {}
async function transfersHistory(contractAddress, userAddress) {...}