Verify Proxy Contract

How to Verify Proxy Contract

Please learn how to deploy an upgradable KIP20 contract

Flatten your contract

Install flattener

npm install truffle-flattener -g

Run the following command:

$ truffle-flattener KIP20TokenImplementation.sol > KIP20TokenImplementationFlattened.sol
$ truffle-flattener KIP20UpgradeableProxy.sol > KIP20UpgradeableProxyFlattened.sol"

Compile and deploy your contract with Remix

Compile Implementation contract

  • Open Remix IDE:https://remix.ethereum.org
  • Select solidity language
  • Create new contract KIP20Token.sol and copy contract code from flattened KIP20TokenImplementationFlattened.sol
  • Compile the implementation contract
  • Click on this button to switch to the compile page
  • Select “KIP20TokenImplementation” contract
  • Enable “Auto compile” and “optimization”
  • Click “ABI” to copy the contract abi and save it.

Deploy the implementation contract

  • Select “Injected Web3”
  • Select “KIP20TokenImplementation” contract
  • Click the “Deploy” button and Metamask will pop up
  • Click the “confirm” button to sign and broadcast the transaction to OKC.
  • Then, you need to initialize the token: fill in all the parameters and click on “transact” avatar
Note: Owner should be the address who send the deploy transaction before.
  • Click on the “Copy” icon to save the initializatioin data: Like the following: 0xef3ebcb800000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000f42400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000fc41d5571120442d1bb82cea0884966e543cb78b000000000000000000000000000000000000000000000000000000000000000548656c6c6f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000548454c4c4f000000000000000000000000000000000000000000000000000000
  • Confirm your transaction in MetaMask avatar

Compile Proxy Contract

  • Create new contract proxy.sol and copy contract code from flattened KIP20UpgradeableProxyFlattened.sol.
  • Compile the proxy contractClick on this button to switch to the compile page
  • Select “KIP20UpgradeableProxy” contract
  • Enable “Auto compile” and “optimization”Click “ABI” to copy the contract abi and save it.

Deploy the proxy contract

  • Select “Injected Web3”Select “KIP20UpgradeableProxy.sol” contract
  • Fill in the parameter

Logic: The address of KIP20Implementation contract Admin: admin cannot be KIP20 token owner Data: use the initialization data you saved before

  • Click the “Deploy” button and Metamask will pop up
  • Click the “confirm” button to sign and broadcast transaction to OKC.