PRE-MADE CODE AND TUTORIAL

Information on this page is not yet updated according to the changes in Equivalence Protocol V2
The code below can be used as a base of your own smart contract, however keep in mind that it's made for previous version of the Equivalence Protocol and not directly compatible.
Updated version is expected by the end of 2023

Code of Asset-Referenced Token

The code of this smart contract is ready to be deployed, you need to adjust only a few details, to do so, please follow the tutorial below.

1) Preparing the Environment

Open https://remix.ethereum.org and create new file in the folder "contracts" as shown on the picture, you can name it as you like.

2) Getting the Code

Click on the button "OPEN THE CODE" at the top of this page. The code should open in a new tab.
Select all the text of the code (CTRL + A on windows PCs) and copy it (CTRL + C).

Open the file you created in part 1) by double-clicking it and paste the code (CTRL + V).

3) Editing the Code

Go to the end of the code you pasted in part 2) and find the part shown on the image below.
Change the name contract from TokenExample to however you want to name your smart-contract, avoid using special characters or spaces.
Change "Name of Token" and "TOKEN" to whatever you like (quotes must remain, the text you enter instead of "TOKEN" can have 5 letters at most).
You can set fee as you see fit, but keep in mind that high fees will probably make your token less popular, by default the fee is 0.3%.
The asset used in the example is gold, denominated in USD. To use different asset, open the Chainlink documentation and find the asset you would like to use. Make sure the asset of your choice is not marked as deprecating and preferably use some popular asset to make sure it will be supported by Chainlink in the long term.
Once you have found the asset you want to use, copy it's address and paste it instead of the address of the gold (0x214eD9Da11D2fbe465a6fc601a91E62EbEc1a0D6).

4) Setting up the Compiler

Once you are done with the edits, open the section "Solidity compiler" and set it the same way as you see in the picture below.
Set the Compiler to the version 0.8.18 and check the field "Enable optimization"
Make sure there are no errors and you see a green check-mark next to the "Solidity compiler" icon. In some cases, the code may not get recompiled automatically, just in case press the blue button "Compile" below the "Advanced Configurations" and wait till the green check-mark appear.

5) Deployment of Your Smart-contract

Select the "Deploy & run transactions" icon.
In the top part, select "Injected Provider" and connect your wallet. Make sure your wallet is set to the correct blockchain.
Press the orange button "Deploy" and confirm the transactions in your wallet. Please be aware that deploying a smart-contract requires a high amount of gas - which mean it will cost some ETH. This gas cost is charged by the blockchain, not by us.

After a successful deployment, your smart contract will appear in the section "Deployed Contracts".
Copy the address of this smart contract and store it somewhere safe - this address is the unique identification of your smart-contract, you will need it in the next steps.

6) Verification of the Contract on Etherscan

Open https://etherscan.io/ and input the address of your smart-contract into the search field.
On the page of your smart-contract, select the "Contract" tab and click on "Verify and Publish".

Fill the table as on the picture below and click "Continue".

On the next screen, copy and paste the code of the contract from the Remix (the version you have edited) into the large text field in the middle.
Make sure the other settings are as in the picture below, especially:
Compiler "v0.8.18"
Optimization "Yes"
Also check the section "Constructor Arguments" and if there is any text inside of the "Constructor Arguments" section, delete it.
In the Misc Settings, it should be set to 200 runs, this is a default setting. (If you have changed this parameter in the Remix, you have to set the same value here, if you haven't, keep it at 200).

Verify you're not a robot and press "Verify and Publish".

7) Important Things to be Aware of

Congratulations! If you got here, it means you have your own token with a verified contract, but there are a few more necessary things:

Your contract is complete, but it must get access to the "externalMint" function of Equivalence Protocol to be working properly. Please send us the link to your verified smart-contract on Etherscan, we will verify it (which is a paid service as written in the Basic Information). If it doesn't include any modifications that make it possible to be exploited, we will add it to the whitelist.
You can send it to our mail equivalenceprotocol@gmail.com

The users of your tokens who want to mint it in exchange for EQT will have to approve your contract to spend their EQT, this can be done by the function "approve" of the Equivalence Protocol.