Skip to content

Mainnet Block Tax withdrawal and distribution

Kosta Korenkov edited this page Oct 3, 2019 · 5 revisions

Withdraw tax from the SwapRegistry contract

Use claimRewards script like this:

SWAP_ADDR=<SwapRegistry contract address> \
FROM_HEIGHT=<Root network block to start from> \
TO_HEIGHT=<root network block to end at> \
OP_CONTRACT_ADDR=<Plasma Operator contract address> \
VALIDATOR_PRIV=<Plasma Validator private key> \
PROVIDER_URL=<root network provider URL e.g. Infura> \
node scripts/claimRewards.js

Take SWAP_ADDR and OP_CONTRACT_ADDR from the mainnet config. Use the height of the previous claim to deduce FROM_HEIGHT. See Reputation tab of LEAP Treasury sheet to get the last claim height.

You may need to adjust gas price in the script according to current network conditions.

Withdraw collected tax from the Governance contract

Once tax is collected from the SwapRegistry it ends up in a MinGov contract. Execute a withdrawTax transaction on a multisig to withdraw it into LeapDAO Escrow.

MinGov address: see the mainnet config

MinGov ABI
[
  {
    "constant": true,
    "inputs": [
      {
        "name": "",
        "type": "uint256"
      }
    ],
    "name": "proposals",
    "outputs": [
      {
        "name": "subject",
        "type": "address"
      },
      {
        "name": "created",
        "type": "uint32"
      },
      {
        "name": "canceled",
        "type": "bool"
      },
      {
        "name": "msgData",
        "type": "bytes"
      }
    ],
    "payable": false,
    "stateMutability": "view",
    "type": "function"
  },
  {
    "constant": true,
    "inputs": [],
    "name": "proposalTime",
    "outputs": [
      {
        "name": "",
        "type": "uint256"
      }
    ],
    "payable": false,
    "stateMutability": "view",
    "type": "function"
  },
  {
    "constant": true,
    "inputs": [],
    "name": "first",
    "outputs": [
      {
        "name": "",
        "type": "uint256"
      }
    ],
    "payable": false,
    "stateMutability": "view",
    "type": "function"
  },
  {
    "constant": false,
    "inputs": [],
    "name": "renounceOwnership",
    "outputs": [],
    "payable": false,
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "constant": true,
    "inputs": [],
    "name": "owner",
    "outputs": [
      {
        "name": "",
        "type": "address"
      }
    ],
    "payable": false,
    "stateMutability": "view",
    "type": "function"
  },
  {
    "constant": true,
    "inputs": [],
    "name": "isOwner",
    "outputs": [
      {
        "name": "",
        "type": "bool"
      }
    ],
    "payable": false,
    "stateMutability": "view",
    "type": "function"
  },
  {
    "constant": true,
    "inputs": [],
    "name": "size",
    "outputs": [
      {
        "name": "",
        "type": "uint256"
      }
    ],
    "payable": false,
    "stateMutability": "view",
    "type": "function"
  },
  {
    "constant": false,
    "inputs": [
      {
        "name": "newOwner",
        "type": "address"
      }
    ],
    "name": "transferOwnership",
    "outputs": [],
    "payable": false,
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "name": "_proposalTime",
        "type": "uint256"
      }
    ],
    "payable": false,
    "stateMutability": "nonpayable",
    "type": "constructor"
  },
  {
    "payable": true,
    "stateMutability": "payable",
    "type": "fallback"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "name": "proposalId",
        "type": "uint256"
      },
      {
        "indexed": true,
        "name": "subject",
        "type": "address"
      },
      {
        "indexed": false,
        "name": "msgData",
        "type": "bytes"
      }
    ],
    "name": "NewProposal",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "name": "proposalId",
        "type": "uint256"
      },
      {
        "indexed": true,
        "name": "subject",
        "type": "address"
      },
      {
        "indexed": false,
        "name": "msgData",
        "type": "bytes"
      }
    ],
    "name": "Execution",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "name": "previousOwner",
        "type": "address"
      },
      {
        "indexed": true,
        "name": "newOwner",
        "type": "address"
      }
    ],
    "name": "OwnershipTransferred",
    "type": "event"
  },
  {
    "constant": false,
    "inputs": [
      {
        "name": "_subject",
        "type": "address"
      },
      {
        "name": "_msgData",
        "type": "bytes"
      }
    ],
    "name": "propose",
    "outputs": [],
    "payable": false,
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "constant": false,
    "inputs": [
      {
        "name": "_proposalId",
        "type": "uint256"
      }
    ],
    "name": "cancel",
    "outputs": [],
    "payable": false,
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "constant": false,
    "inputs": [
      {
        "name": "_token",
        "type": "address",
        "$$hashKey": "object:195"
      }
    ],
    "name": "withdrawTax",
    "outputs": [],
    "payable": false,
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "constant": false,
    "inputs": [],
    "name": "finalize",
    "outputs": [],
    "payable": false,
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "constant": false,
    "inputs": [
      {
        "name": "_slotId",
        "type": "uint256"
      },
      {
        "name": "",
        "type": "address"
      },
      {
        "name": "",
        "type": "bytes32"
      }
    ],
    "name": "setSlot",
    "outputs": [],
    "payable": false,
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "constant": false,
    "inputs": [
      {
        "name": "_subject",
        "type": "address"
      },
      {
        "name": "_token",
        "type": "address"
      },
      {
        "name": "_type",
        "type": "uint256"
      }
    ],
    "name": "registerToken",
    "outputs": [],
    "payable": false,
    "stateMutability": "nonpayable",
    "type": "function"
  }
]

Calculate tax distribution according to Tax Policy

Policy: https://app.glassfrog.com/organizations/14849/orgnav/policies/10919328

Short summary: 15% goes to Status.im, 6.5% of the rest goes to the team

Calculation is semi-automated in the Reputation tab of the LEAP Treasury

Distribute tax

There is a handy ERC20PaymentSplitter contract deployed for Escrow Multisig.

Address: 0xC072b9E095A8Ae1306199A6d85857c98E0761Cfc

ABI
[
  {
    "constant": true,
    "inputs": [],
    "name": "payerAddr",
    "outputs": [
      {
        "name": "",
        "type": "address"
      }
    ],
    "payable": false,
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "name": "_payerAddr",
        "type": "address"
      }
    ],
    "payable": false,
    "stateMutability": "nonpayable",
    "type": "constructor"
  },
  {
    "constant": false,
    "inputs": [
      {
        "name": "_recipients",
        "type": "address[]",
        "$$hashKey": "object:282"
      },
      {
        "name": "_splits",
        "type": "uint256[]",
        "$$hashKey": "object:283"
      },
      {
        "name": "_tokenAddr",
        "type": "address",
        "$$hashKey": "object:284"
      }
    ],
    "name": "split",
    "outputs": [],
    "payable": false,
    "stateMutability": "nonpayable",
    "type": "function"
  }
]
  1. Set allowance for 0xc072b9e095a8ae1306199a6d85857c98e0761cfc to transfer LEAP from Multisig.
  2. Send split tx with args: array of recipients, array of amounts and LEAP token address.