Create an Object

Create an Object via bepro-js in 6 simple steps

Become a super hero in bepro-js development

The example below shows an Object X considering it uses an ERC20Contract

1 - Create your X.sol object/objects at contracts/X.sol

pragma solidity >=0.6.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

/**
 * @title X Contract
 * @dev A Contract that stores 3 variables
 */
contract X{
    
    string public variable1;
    string public variable2;
    ERC20 public erc20Token;

    constructor(       
        string memory _variable1, 
        string memory _variable2,
        ERC20 _tokenAddress) public {
        
        //constructor info
        variable1 = _variable1;
        variable2 = _variable2;
        erc20Token = _tokenAddress;
    }

}

2 - Export the interface x at src/interfaces/index.js

3 - Create the javascript wrapper at src/models/X.js

A default version is shown below on how to use the system - you can use it to start your Javascript Wrapper

4 - Export the Object at src/models/index.js

5 - Create Unit tests tests/x.js

The Template below should be used to start the object of unit tests

6 - Import them at tests/index.js

7 - To test open 2 terminals

Last updated

Was this helpful?