Skip to content

Instantly share code, notes, and snippets.

@talkol
Last active February 18, 2025 10:49
Show Gist options
  • Select an option

  • Save talkol/b9ec715b1947fd832bd7b1bdbc1f1f5c to your computer and use it in GitHub Desktop.

Select an option

Save talkol/b9ec715b1947fd832bd7b1bdbc1f1f5c to your computer and use it in GitHub Desktop.
Single Nominator Integration for Copper

Single Nominator Integration for Copper

Overview

This document explains how to integrate Copper's UI with Single Nominator TON smart contract that allows staking TON coins in a secure way. We assume that some other party is running the validator node and has already deployed the single nominator smart contract. Such party is for example Kiln.

Single Nominator Roles

  • Single-Nominator - The single-nominator contract we are sending opcodes to, example: Ef9P..W1sl
  • Owner - The Copper custodian wallet that is sending the opcodes, example: UQA6..SXYf
  • Validator - The validator wallet operated by Kiln, example: Uf_a..xFa0

Operations (Op Codes) for Staking

1. Deposit

This operation does not require any special integration by Copper. Deposit is just a simple transfer of TON coins from the Copper custodian wallet (Owner) to the contract (Single-Nominator).

2. Withdraw All

This operation is extremely easy to integrate because it's just a simple transfer of 0.1 TON with the comment "w" from the Copper custodian wallet (Owner) to the contract (Single-Nominator).

3. Withdraw Partial

This operation is not mandatory and only nice to have. It's a little harder to integrate because it requires an input argument (the withdraw amount) and requires crafting a custom message. The custom op is 0x1000 and it needs to be sent with a message containing 0.1 TON from the Copper custodian wallet (Owner) to the contract (Single-Nominator).

const WITHDRAW = 0x1000;
const payload = beginCell()
    .storeUint(WITHDRAW, 32)
    .storeUint(0, 64)
    .storeCoins(toNano(amount.toFixed(2)))
    .endCell();

You can see a JavaScript example of sending this message in the official Single Nominator client.

Technical Support

If you need any technical support with this integration, please contact Doron, email: doron@orbs.com, telegram: d0xni. He worked on implementing the single-nominator contract itself, so he is an expert.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment