I am learning/playing around with some concepts of the blockchain, smart contracts and Ethereum. I have created my own "toy" cryptocurency ("myCoin") by forking a coin using the CryptoNote algo.

I want to use the Ethereum platform, to write smart contracts which are "denoted" using "myCoin" currency (i.e. tokens), instead of ether.

So for example a contract might state (pseudocode):

Definition of Event A
Definition of Event B

When Event A is raised by a user
Pay user X units of myCoin

When Event B is raised by a user
Request user Y units of myCoin from user

Can someone outline the steps needed to write such smart contracts that are decoupled from ETH and instead rely on my alt coin?

1 Answer 1


You can provide your token smart contract-extensibility by 'wrapping your token' by something that can interact with the contracts, i.e., ERC-20 tokens.

Here is a detailed article on how to go about it. The sample Weth interface provided:

contract IWETH is ERC20 {
  event Deposit(address indexed sender, uint256 amount);
  event Withdrawal(address indexed recipient, uint256 amount);

  function deposit() public payable;

  function withdraw(uint256 amount) public;

  function withdraw(uint256 amount, address user) public;

The Weth contract implementation:

contract WETH is IWETH {
  string public name = "Wrapped Ether";
  string public symbol = "WETH";
  uint8  public decimals = 18;

  function deposit() public payable {
    _mint(msg.sender, msg.value);
    emit Deposit(msg.sender, msg.value);

  function withdraw(uint amount) public {
    require(balanceOf(msg.sender) >= amount);
    address payable recipient = msg.sender;
    _burn(msg.sender, amount);
    emit Withdrawal(recipient, amount);

  function withdraw(uint amount, address payable recipient) public {
    require(balanceOf(msg.sender) >= amount);
    _burn(msg.sender, amount);
    emit Withdrawal(recipient, amount);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.