Delegate $MATIC
Starts delegating $MATIC to NOBI to help secure Polygon PoS network.
Polygon Staking is done using the $MATIC token on the Ethereum network, not the Polygon network.
Delegating MATIC requires two steps:
- Allowance Transaction: This approves sending a specific amount of MATIC tokens to a staking contract on Ethereum.
- Delegation Transaction: This delegates MATIC to a specific validator via its associated smart contract. NOBI's
validator contract address is
0xd96f7a3759e907d1e1056b09622f2f9ae24804f8.
NOTE
Before executing this flow, please ensure that your MATIC tokens are on Ethereum mainnet or testnet. This may require you to withdraw your MATIC tokens from Polygon to Ethereum via the Polygon bridge.
There is a step-by-step guide for the withdrawal process is available from Polygon Wiki.
| Token Name | Network | Contract Address |
|---|---|---|
| $MATIC | Mainnet | 0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0 |
| $MATIC | Testnet | 0x499d11E0b6eAC7c0593d8Fb292DCBbF815Fb29Ae |
In the following guide we will illustrate how to stake MATIC tokens.
Step 1 - Initiate Flow
Endpoint : flow
Method : POST
Request
Body
service_code* -string: Service code, use service endpoint to get the servicecode.flow* -string: The operation to performdelegate.callback_url-string: Your callback url endpoint to get update ofstatefrom our systems.
Request Sample
{
"service_code": "staking-matic",
"flow": "delegate"
}
Response
id-string: Flow ID.service_code-string: Current flow service code.flow-string: Current flow name.inquiry_id-string: ID For next Request Step Inquiry.inquiry_identifier-string: Next step identifier name.staking-assign-data: Next you need to assign the staking data.
state-string: Current state of your flow.inputs-Array<Object>: Next step inputs.data-Object: Stored data of your flow.created_at-Timestamp RFC3339: Time when flow created.updated_at-Timestamp RFC3339: Last flow updated.expired_at-Timestamp RFC3339: Maximum time you have to finish the process before flow dropped by system, will always increment by your last action +2 hours.
Success Sample
{
"status": 1,
"status_service": "00",
"status_number": "F000001",
"status_code": "SSSSSS",
"message": "success",
"data": {
"id": "d25bf5c7-d307-460d-a0e5-c98b9a8cad2a",
"service_code": "staking-matic",
"flow": "delegate",
"inquiry_id": "5eaf2163-98d6-4306-bb32-3e2deab9e3e4",
"inquiry_identifier": "staking-assign-data",
"state": "initialized",
"inputs": [
{
"type": "string",
"name": "delegator_address",
"display": "Delegator Address",
"description": "Delegator address",
"validations": [
{
"type": "string",
"options": {}
}
],
"array": 0,
"default_val": null,
"visibility": 1
},
{
"type": "string",
"name": "validator_code",
"display": "Validator Code",
"description": "Validator code",
"validations": [
{
"type": "string",
"options": {}
}
],
"array": 0,
"default_val": null,
"visibility": 1
},
{
"type": "decimal",
"name": "amount",
"display": "Amount",
"description": "Amount",
"validations": [
{
"type": "presence",
"options": {}
},
{
"type": "numericality",
"options": {
"greater_than": "0"
}
}
],
"array": 0,
"default_val": null,
"visibility": 1
},
{
"type": "integer",
"name": "minimum_shares_to_mint",
"display": "Minimum Shares To Mint",
"description": "Minimum shares to mint",
"validations": [
{
"type": "numericality",
"options": {
"allow_nil": "1",
"greater_than_or_equal_to": "0"
}
}
],
"array": 0,
"default_val": null,
"visibility": 1
},
{
"type": "integer",
"name": "max_slippage_percentage",
"display": "Max Slippage Percentage",
"description": "Max slippage percentage",
"validations": [
{
"type": "numericality",
"options": {
"allow_nil": "1",
"greater_than_or_equal_to": "0",
"less_than_or_equal_to": "100",
"only_integer": "1"
}
}
],
"array": 0,
"default_val": null,
"visibility": 1
}
],
"data": {
"allowance_address": "",
"allowance_tx": "",
"amount": "",
"callback_url": "",
"delegate_tx": "",
"delegator_address": "",
"exchange_rate": "",
"exchange_rate_precision": "",
"gas_limit": "",
"gas_price": "",
"max_slippage_percentage": "",
"minimum_shares_to_mint": "",
"validator_address": "",
"validator_code": ""
},
"created_at": "2024-03-12T16:55:37Z",
"updated_at": "2024-03-12T16:55:37Z",
"expired_at": "2024-03-12T18:55:37Z"
}
}
Step 2 - Assign Data
Endpoint : flow/{:id}/next
Method : POST
Request
Body
inquiry_id* -string: Your inquiry id from step 1data-object* : Wrapped data objectvalidator_code-string: Validator code, use validator endpoint to get the validatorcode, we will set it automatically if you not send it.delegator_address* -string: Address which you want to use to delegate.amount* -float64: Amount of Matic Token you want to delegate.minimum_shares_to_mint-string: The minimum number of shares of the delegation pool to be minted. If the exchange rate results in fewer shares being minted, the transaction will fail.max_slippage_percentage-float64: The maximum slippage you are willing to accept.
Sample Endpoint Request : flow/d25bf5c7-d307-460d-a0e5-c98b9a8cad2a/next
Request Sample
{
"inquiry_id":"5eaf2163-98d6-4306-bb32-3e2deab9e3e4",
"data": {
"delegator_address": "0xC5933308625306c2dAB7602b52b80dceEa133532",
"validator_code": "NOBIMMT01",
"amount": 2.5
}
}
Response
id-string: Flow ID.service_code-string: Current flow service code.flow-string: Current flow name.inquiry_id-string: ID For next Request Step Inquiry.inquiry_identifier-string: Next step identifier name.staking-allowance-tx: If your address need more allowance of matic token to stake.staking-delegate-tx: If your address allowance ok, then you can skip allowance process.
state-string: Current state of your flow.inputs-Array<Object>: Next step inputs.data-Object: Stored data of your flow.created_at-Timestamp RFC3339: Time when flow created.updated_at-Timestamp RFC3339: Last flow updated.expired_at-Timestamp RFC3339: Maximum time you have to finish the process before flow dropped by system, will always increment by your last action +2 hours.
Success Sample - Need Allowance
{
"status": 1,
"status_service": "00",
"status_number": "F000001",
"status_code": "SSSSSS",
"message": "success create data",
"data": {
"id": "d25bf5c7-d307-460d-a0e5-c98b9a8cad2a",
"service_code": "staking-matic",
"flow": "delegate",
"inquiry_id": "d680ca35-d777-4d54-abd5-67a1d25eedf4",
"inquiry_identifier": "staking-allowance-tx",
"state": "initialized",
"inputs": [
{
"type": "string",
"name": "gas_limit",
"display": "Gas Limit",
"description": "Gas limit",
"validations": [
{
"type": "numericality",
"options": {
"allow_blank": "1",
"greater_than": "0",
"only_integer": "1"
}
}
],
"array": 0,
"default_val": null,
"visibility": 1
},
{
"type": "string",
"name": "gas_price",
"display": "Gas Price",
"description": "Gas price in Gwei",
"validations": [
{
"type": "numericality",
"options": {
"allow_blank": "1",
"greater_than": "0"
}
},
{
"type": "precision",
"options": {
"allow_blank": "1",
"max": "9"
}
}
],
"array": 0,
"default_val": null,
"visibility": 1
}
],
"data": {
"allowance_address": "",
"allowance_tx": "",
"amount": "2.5",
"callback_url": "",
"delegate_tx": "",
"delegator_address": "0xC5933308625306c2dAB7602b52b80dceEa133532",
"exchange_rate": "",
"exchange_rate_precision": "",
"gas_limit": "",
"gas_price": "",
"max_slippage_percentage": "",
"minimum_shares_to_mint": "",
"validator_address": "0xb929B89153fC2eEd442e81E5A1add4e2fa39028f",
"validator_code": "NOBIMMT01"
},
"created_at": "2024-03-12T16:55:37Z",
"updated_at": "2024-03-12T16:55:37Z",
"expired_at": "2024-03-12T18:55:37Z"
}
}
Success Sample - Doesn't need allowance (Skip step 3 and go to step 4)
{
"status": 1,
"status_service": "00",
"status_number": "F000001",
"status_code": "SSSSSS",
"message": "success create data",
"data": {
"id": "d25bf5c7-d307-460d-a0e5-c98b9a8cad2a",
"service_code": "staking-matic",
"flow": "delegate",
"inquiry_id": "d31ce56b-de13-410b-bf52-883459802508",
"inquiry_identifier": "staking-delegate-tx",
"state": "initialized",
"inputs": [
{
"type": "string",
"name": "gas_limit",
"display": "Gas Limit",
"description": "Gas limit",
"validations": [
{
"type": "numericality",
"options": {
"allow_blank": "1",
"greater_than": "0",
"only_integer": "1"
}
}
],
"array": 0,
"default_val": null,
"visibility": 1
},
{
"type": "string",
"name": "gas_price",
"display": "Gas Price",
"description": "Gas price in Gwei",
"validations": [
{
"type": "numericality",
"options": {
"allow_blank": "1",
"greater_than": "0"
}
},
{
"type": "precision",
"options": {
"allow_blank": "1",
"max": "9"
}
}
],
"array": 0,
"default_val": null,
"visibility": 1
}
],
"data": {
"allowance_address": "",
"allowance_tx": "",
"amount": "2.5",
"callback_url": "",
"delegate_tx": "",
"delegator_address": "0xC5933308625306c2dAB7602b52b80dceEa133532",
"exchange_rate": "",
"exchange_rate_precision": "",
"gas_limit": "",
"gas_price": "",
"max_slippage_percentage": "",
"minimum_shares_to_mint": "",
"validator_address": "0xb929B89153fC2eEd442e81E5A1add4e2fa39028f",
"validator_code": "NOBIMMT01"
},
"created_at": "2024-03-12T16:55:37Z",
"updated_at": "2024-03-12T16:55:37Z",
"expired_at": "2024-03-12T18:55:37Z"
}
}
Step 3 - Create Allowance
Endpoint : flow/{:id}/next
Method : POST
Request
Body
inquiry_id* -string: Your inquiry id from step 1data-object: Wrapped data objectgas_limit-float64: Set Gas Limit for transaction, if not provided, we will us onchain suggested price.gas_price-float64: Set Gas Price for transaction, if not provided, we will us onchain suggested price.
Sample Endpoint Request : flow/d25bf5c7-d307-460d-a0e5-c98b9a8cad2a/next
Request Sample
{
"inquiry_id":"d680ca35-d777-4d54-abd5-67a1d25eedf4",
"data": {}
}
To refresh the allowance transaction, just resubmit the inquiry.
Response
id-string: Flow ID.service_code-string: Current flow service code.flow-string: Current flow name.inquiry_id-string: ID For next Request Step Inquiry.inquiry_identifier-string: Next step identifier name.staking-allowance-sign: Next flow will be signing and broadcast tx.
state-string: Current state of your flow.inputs-Array<Object>: Next step inputs.data-Object: Stored data of your flow.created_at-Timestamp RFC3339: Time when flow created.updated_at-Timestamp RFC3339: Last flow updated.expired_at-Timestamp RFC3339: Maximum time you have to finish the process before flow dropped by system, will always increment by your last action +2 hours.
Success Sample
{
"status": 1,
"status_service": "00",
"status_number": "F000001",
"status_code": "SSSSSS",
"message": "success create data",
"data": {
"id": "d25bf5c7-d307-460d-a0e5-c98b9a8cad2a",
"service_code": "staking-matic",
"flow": "delegate",
"inquiry_id": "0cd6fa5e-36bd-4508-97e0-3a5b7334470c",
"inquiry_identifier": "staking-allowance-sign",
"state": "initialized",
"inputs": [
{
"type": "string",
"name": "signed_tx_payload",
"display": "Signed Tx Payload",
"description": "Signed transaction payload",
"validations": [
{
"type": "presence",
"options": {}
},
{
"type": "signed_transaction",
"options": {}
}
],
"array": 0,
"default_val": null,
"visibility": 1
}
],
"data": {
"allowance_address": "0x5e3ef299fddf15eaa0432e6e66473ace8c13d908",
"allowance_tx": "0x02f867801d800282bd44947d1afa7b718fb893db30a3abc0cfc608aacfebb080b844095ea7b30000000000000000000000005e3ef299fddf15eaa0432e6e66473ace8c13d90800000000000000000000000000000000000000000000000022b1c8c1227a0000c0808080",
"amount": "2.5",
"callback_url": "",
"delegate_tx": "",
"delegator_address": "0xC5933308625306c2dAB7602b52b80dceEa133532",
"exchange_rate": "",
"exchange_rate_precision": "",
"gas_limit": "",
"gas_price": "",
"max_slippage_percentage": "",
"minimum_shares_to_mint": "",
"validator_address": "0xb929B89153fC2eEd442e81E5A1add4e2fa39028f",
"validator_code": "NOBIMMT01"
},
"created_at": "2024-03-12T16:55:37Z",
"updated_at": "2024-03-12T16:55:37Z",
"expired_at": "2024-03-12T18:55:37Z"
}
}
Step 3.1 - Submit Signed Allowance Transaction
Endpoint : flow/{:id}/next
Method : POST
Request
Body
inquiry_id* -string: Your inquiry id from step 1data* -object: Wrapped data objectsigned_tx* -string: Signed transaction payload
Sample Endpoint Request : flow/d25bf5c7-d307-460d-a0e5-c98b9a8cad2a/next
Request Sample
{
"inquiry_id":"0cd6fa5e-36bd-4508-97e0-3a5b7334470c",
"data": {
"signed_tx_payload": "0x02f8a7011d800282bd44947d1afa7b718fb893db30a3abc0cfc608aacfebb080b844095ea7b30000000000000000000000005e3ef299fddf15eaa0432e6e66473ace8c13d90800000000000000000000000000000000000000000000000022b1c8c1227a0000c080a0fe0bc1fffe92cf5e13f390ebcc679daba2225687dddae3870e6bd49132e1951fa02d24e4678447f5121c359e3bad0ffb2619a8fd2629f5c0c207e47a572348b314"
}
}
To retry the allowance signing transaction, just resubmit the inquiry.
Response
id-string: Flow ID.service_code-string: Current flow service code.flow-string: Current flow name.inquiry_id-string: ID For next Request Step Inquiry.inquiry_identifier-string: Next step identifier name.staking-delegate-tx: Next flow will be generating delegate tx.
state-string: Current state of your flow.inputs-Array<Object>: Next step inputs.data-Object: Stored data of your flow.created_at-Timestamp RFC3339: Time when flow created.updated_at-Timestamp RFC3339: Last flow updated.expired_at-Timestamp RFC3339: Maximum time you have to finish the process before flow dropped by system, will always increment by your last action +2 hours.
Success Sample
{
"status": 1,
"status_service": "00",
"status_number": "F000001",
"status_code": "SSSSSS",
"message": "success create data",
"data": {
"id": "d25bf5c7-d307-460d-a0e5-c98b9a8cad2a",
"service_code": "staking-matic",
"flow": "delegate",
"inquiry_id": "d31ce56b-de13-410b-bf52-883459802508",
"inquiry_identifier": "staking-delegate-tx",
"state": "initialized",
"inputs": [
{
"type": "string",
"name": "gas_limit",
"display": "Gas Limit",
"description": "Gas limit",
"validations": [
{
"type": "numericality",
"options": {
"allow_blank": "1",
"greater_than": "0",
"only_integer": "1"
}
}
],
"array": 0,
"default_val": null,
"visibility": 1
},
{
"type": "string",
"name": "gas_price",
"display": "Gas Price",
"description": "Gas price in Gwei",
"validations": [
{
"type": "numericality",
"options": {
"allow_blank": "1",
"greater_than": "0"
}
},
{
"type": "precision",
"options": {
"allow_blank": "1",
"max": "9"
}
}
],
"array": 0,
"default_val": null,
"visibility": 1
}
],
"data": {
"allowance_address": "0x5e3ef299fddf15eaa0432e6e66473ace8c13d908",
"allowance_tx": "0x02f867801d800282bd44947d1afa7b718fb893db30a3abc0cfc608aacfebb080b844095ea7b30000000000000000000000005e3ef299fddf15eaa0432e6e66473ace8c13d90800000000000000000000000000000000000000000000000022b1c8c1227a0000c0808080",
"amount": "2.5",
"callback_url": "",
"delegate_tx": "",
"delegator_address": "0xC5933308625306c2dAB7602b52b80dceEa133532",
"exchange_rate": "",
"exchange_rate_precision": "",
"gas_limit": "",
"gas_price": "",
"max_slippage_percentage": "",
"minimum_shares_to_mint": "",
"validator_address": "0xb929B89153fC2eEd442e81E5A1add4e2fa39028f",
"validator_code": "NOBIMMT01"
},
"created_at": "2024-03-12T16:55:37Z",
"updated_at": "2024-03-12T16:55:37Z",
"expired_at": "2024-03-12T18:55:37Z"
}
}
Step 4 - Create Delegate Transaction
Endpoint : flow/{:id}/next
Method : POST
Request
Body
inquiry_id* -string: Your inquiry id from step 1data-object: Wrapped data objectgas_limit-float64: Set Gas Limit for transaction, if not provided, we will us onchain suggested price.gas_price-float64: Set Gas Price for transaction, if not provided, we will us onchain suggested price.
Sample Endpoint Request : flow/d25bf5c7-d307-460d-a0e5-c98b9a8cad2a/next
Request Sample
{
"inquiry_id":"d31ce56b-de13-410b-bf52-883459802508",
"data": {}
}
To refresh the delegate transaction, just resubmit the inquiry.
Response
id-string: Flow ID.service_code-string: Current flow service code.flow-string: Current flow name.inquiry_id-string: ID For next Request Step Inquiry.inquiry_identifier-string: Next step identifier name.staking-delegate-sign: Next flow will be signing and broadcast tx.
state-string: Current state of your flow.inputs-Array<Object>: Next step inputs.data-Object: Stored data of your flow.created_at-Timestamp RFC3339: Time when flow created.updated_at-Timestamp RFC3339: Last flow updated.expired_at-Timestamp RFC3339: Maximum time you have to finish the process before flow dropped by system, will always increment by your last action +2 hours.
Success Sample
{
"status": 1,
"status_service": "00",
"status_number": "F000001",
"status_code": "SSSSSS",
"message": "success create data",
"data": {
"id": "d25bf5c7-d307-460d-a0e5-c98b9a8cad2a",
"service_code": "staking-matic",
"flow": "delegate",
"inquiry_id": "0fc140bb-ee3a-48ee-9f46-b2824442b8ed",
"inquiry_identifier": "staking-delegate-sign",
"state": "initialized",
"inputs": [
{
"type": "string",
"name": "signed_tx_payload",
"display": "Signed Tx Payload",
"description": "Signed transaction payload",
"validations": [
{
"type": "presence",
"options": {}
},
{
"type": "signed_transaction",
"options": {}
}
],
"array": 0,
"default_val": null,
"visibility": 1
}
],
"data": {
"allowance_address": "0x5e3ef299fddf15eaa0432e6e66473ace8c13d908",
"allowance_tx": "0x02f867801d800282bd44947d1afa7b718fb893db30a3abc0cfc608aacfebb080b844095ea7b30000000000000000000000005e3ef299fddf15eaa0432e6e66473ace8c13d90800000000000000000000000000000000000000000000000022b1c8c1227a0000c0808080",
"amount": "2.5",
"callback_url": "",
"delegate_tx": "0x02f868801e8002830493e094b929b89153fc2eed442e81e5a1add4e2fa39028f80b8446ab1507100000000000000000000000000000000000000000000000022b1c8c1227a00000000000000000000000000000000000000000000000000000000000000000000c0808080",
"delegator_address": "0xC5933308625306c2dAB7602b52b80dceEa133532",
"exchange_rate": "",
"exchange_rate_precision": "",
"gas_limit": "",
"gas_price": "",
"max_slippage_percentage": "",
"minimum_shares_to_mint": "",
"validator_address": "0xb929B89153fC2eEd442e81E5A1add4e2fa39028f",
"validator_code": "NOBIMMT01"
},
"created_at": "2024-03-12T16:55:37Z",
"updated_at": "2024-03-12T16:55:37Z",
"expired_at": "2024-03-12T18:55:37Z"
}
}
Step 4.1 - Submit Signed Delegate Transaction
Endpoint : flow/{:id}/next
Method : POST
Request
Body
inquiry_id* -string: Your inquiry id from step 1data* -object: Wrapped data objectsigned_tx* -string: Signed transaction payload
Sample Endpoint Request : flow/d25bf5c7-d307-460d-a0e5-c98b9a8cad2a/next
Request Sample
{
"inquiry_id":"0fc140bb-ee3a-48ee-9f46-b2824442b8ed",
"data": {
"signed_tx_payload": "0x02f8a8011e8002830493e094b929b89153fc2eed442e81e5a1add4e2fa39028f80b8446ab1507100000000000000000000000000000000000000000000000022b1c8c1227a00000000000000000000000000000000000000000000000000000000000000000000c001a059dbf954735442f1de42134b82ae792d6e3e22c6d51f72c8cf3610b0097d7815a0351c907ec48faff70ee3ba999e4419268ecf818cb40ad61ef176d914423f4eb7"
}
}
To retry the delegate signing transaction, just resubmit the inquiry.
Response
id-string: Flow ID.service_code-string: Current flow service code.flow-string: Current flow name.state-string: Current state of your flow.data-Object: Stored data of your flow.created_at-Timestamp RFC3339: Time when flow created.updated_at-Timestamp RFC3339: Last flow updated.expired_at-Timestamp RFC3339: Maximum time you have to finish the process before flow dropped by system, will always increment by your last action +2 hours.
Success Sample
{
"status": 1,
"status_service": "00",
"status_number": "F000001",
"status_code": "SSSSSS",
"message": "success create data",
"data": {
"id": "d25bf5c7-d307-460d-a0e5-c98b9a8cad2a",
"service_code": "staking-matic",
"flow": "delegate",
"state": "initialized",
"data": {
"allowance_address": "0x5e3ef299fddf15eaa0432e6e66473ace8c13d908",
"allowance_tx": "0x02f867801d800282bd44947d1afa7b718fb893db30a3abc0cfc608aacfebb080b844095ea7b30000000000000000000000005e3ef299fddf15eaa0432e6e66473ace8c13d90800000000000000000000000000000000000000000000000022b1c8c1227a0000c0808080",
"amount": "2.5",
"callback_url": "",
"delegate_tx": "0x02f868801e8002830493e094b929b89153fc2eed442e81e5a1add4e2fa39028f80b8446ab1507100000000000000000000000000000000000000000000000022b1c8c1227a00000000000000000000000000000000000000000000000000000000000000000000c0808080",
"delegator_address": "0xC5933308625306c2dAB7602b52b80dceEa133532",
"exchange_rate": "",
"exchange_rate_precision": "",
"gas_limit": "",
"gas_price": "",
"max_slippage_percentage": "",
"minimum_shares_to_mint": "",
"validator_address": "0xb929B89153fC2eEd442e81E5A1add4e2fa39028f",
"validator_code": "NOBIMMT01"
},
"created_at": "2024-03-12T16:55:37Z",
"updated_at": "2024-03-12T16:55:37Z",
"expired_at": "2024-03-12T18:55:37Z"
}
}