# How to use as tuple[] parameter in Remix interface (solidity, smart-contract)

Contract - RaribleUserToken

Function: mint

I have problem with "fees" argument

My attempts: ['0x0000000000000000000000000000000000000001', 34] ["0x0000000000000000000000000000000000000001", 34] '0x0000000000000000000000000000000000000001', 34 "0x0000000000000000000000000000000000000001", 34 0x0000000000000000000000000000000000000001, 34 etc

I only get errors...

Error encoding arguments: Error: invalid tuple value (argument="tuple", value="0x0000000000000000000000000000000000000001", code=INVALID_ARGUMENT, version=abi/5.1.2)

transact to RaribleUserToken.mint errored: Error encoding arguments: Error: expected array value (argument=null, value="['0x0000000000000000000000000000000000000001', 34]", code=INVALID_ARGUMENT, version=abi/5.1.2)

Contract

``````pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;

library SafeMath {

function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {

if (a == 0) {
return 0;
}

c = a * b;
assert(c / a == b);
return c;
}

/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}

function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}

function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}

contract CommonConstants {

}

}

interface IERC165 {

function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

contract IERC1155 is IERC165 {

event URI(string _value, uint256 indexed _id);

function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _value, bytes calldata _data) external;

function safeBatchTransferFrom(address _from, address _to, uint256[] calldata _ids, uint256[] calldata _values, bytes calldata _data) external;

function balanceOf(address _owner, uint256 _id) external view returns (uint256);

function balanceOfBatch(address[] calldata _owners, uint256[] calldata _ids) external view returns (uint256[] memory);

function setApprovalForAll(address _operator, bool _approved) external;

}

contract ERC165 is IERC165 {
/*
* bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
*/
bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;

/**
* @dev Mapping of interface ids to whether or not it's supported.
*/
mapping(bytes4 => bool) private _supportedInterfaces;

constructor () internal {
// Derived contracts need only register support for their own interfaces,
// we register support for ERC165 itself here
_registerInterface(_INTERFACE_ID_ERC165);
}

function supportsInterface(bytes4 interfaceId) external view returns (bool) {
return _supportedInterfaces[interfaceId];
}

function _registerInterface(bytes4 interfaceId) internal {
require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
_supportedInterfaces[interfaceId] = true;
}
}

function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}

}

function sendValue(address payable recipient, uint256 amount) internal {

// solhint-disable-next-line avoid-call-value
(bool success, ) = recipient.call.value(amount)("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}

// A sample implementation of core ERC1155 function.
contract ERC1155 is IERC1155, ERC165, CommonConstants
{
using SafeMath for uint256;

// id => (owner => balance)
mapping (uint256 => mapping(address => uint256)) internal balances;

// owner => (operator => approved)

/////////////////////////////////////////// ERC165 //////////////////////////////////////////////

/*
*/
bytes4 constant private INTERFACE_SIGNATURE_ERC1155 = 0xd9b67a26;

/////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////

constructor() public {
_registerInterface(INTERFACE_SIGNATURE_ERC1155);
}

/////////////////////////////////////////// ERC1155 //////////////////////////////////////////////

function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _value, bytes calldata _data) external {

require(_to != address(0x0), "_to must be non-zero.");
require(_from == msg.sender || operatorApproval[_from][msg.sender] == true, "Need operator approval for 3rd party transfers.");

// SafeMath will throw with insuficient funds _from
// or if _id is not valid (balance will be 0)
balances[_id][_from] = balances[_id][_from].sub(_value);

// MUST emit event
emit TransferSingle(msg.sender, _from, _to, _id, _value);

// Now that the balance is updated and the event was emitted,
// call onERC1155Received if the destination is a contract.
if (_to.isContract()) {
_doSafeTransferAcceptanceCheck(msg.sender, _from, _to, _id, _value, _data);
}
}

function safeBatchTransferFrom(address _from, address _to, uint256[] calldata _ids, uint256[] calldata _values, bytes calldata _data) external {

// MUST Throw on errors
require(_ids.length == _values.length, "_ids and _values array lenght must match.");
require(_from == msg.sender || operatorApproval[_from][msg.sender] == true, "Need operator approval for 3rd party transfers.");

for (uint256 i = 0; i < _ids.length; ++i) {
uint256 id = _ids[i];
uint256 value = _values[i];

// SafeMath will throw with insuficient funds _from
// or if _id is not valid (balance will be 0)
balances[id][_from] = balances[id][_from].sub(value);
}

// Note: instead of the below batch versions of event and acceptance check you MAY have emitted a TransferSingle
// event and a subsequent call to _doSafeTransferAcceptanceCheck in above loop for each balance change instead.
// Or emitted a TransferSingle event for each in the loop and then the single _doSafeBatchTransferAcceptanceCheck below.
// However it is implemented the balance changes and events MUST match when a check (i.e. calling an external contract) is done.

// MUST emit event
emit TransferBatch(msg.sender, _from, _to, _ids, _values);

// Now that the balances are updated and the events are emitted,
// call onERC1155BatchReceived if the destination is a contract.
if (_to.isContract()) {
_doSafeBatchTransferAcceptanceCheck(msg.sender, _from, _to, _ids, _values, _data);
}
}

function balanceOf(address _owner, uint256 _id) external view returns (uint256) {
// The balance of any account can be calculated from the Transfer events history.
// However, since we need to keep the balances to validate transfer request,
// there is no extra cost to also privide a querry function.
return balances[_id][_owner];
}

function balanceOfBatch(address[] calldata _owners, uint256[] calldata _ids) external view returns (uint256[] memory) {

require(_owners.length == _ids.length);

uint256[] memory balances_ = new uint256[](_owners.length);

for (uint256 i = 0; i < _owners.length; ++i) {
balances_[i] = balances[_ids[i]][_owners[i]];
}

return balances_;
}

function setApprovalForAll(address _operator, bool _approved) external {
operatorApproval[msg.sender][_operator] = _approved;
emit ApprovalForAll(msg.sender, _operator, _approved);
}

return operatorApproval[_owner][_operator];
}

/////////////////////////////////////////// Internal //////////////////////////////////////////////

}

function _doSafeBatchTransferAcceptanceCheck(address _operator, address _from, address _to, uint256[] memory _ids, uint256[] memory _values, bytes memory _data) internal {

}
}

library UintLibrary {
function toString(uint256 _i) internal pure returns (string memory) {
if (_i == 0) {
return "0";
}
uint j = _i;
uint len;
while (j != 0) {
len++;
j /= 10;
}
bytes memory bstr = new bytes(len);
uint k = len - 1;
while (_i != 0) {
bstr[k--] = byte(uint8(48 + _i % 10));
_i /= 10;
}
return string(bstr);
}
}

library StringLibrary {
using UintLibrary for uint256;

function append(string memory _a, string memory _b) internal pure returns (string memory) {
bytes memory _ba = bytes(_a);
bytes memory _bb = bytes(_b);
bytes memory bab = new bytes(_ba.length + _bb.length);
uint k = 0;
for (uint i = 0; i < _ba.length; i++) bab[k++] = _ba[i];
for (uint i = 0; i < _bb.length; i++) bab[k++] = _bb[i];
return string(bab);
}

function append(string memory _a, string memory _b, string memory _c) internal pure returns (string memory) {
bytes memory _ba = bytes(_a);
bytes memory _bb = bytes(_b);
bytes memory _bc = bytes(_c);
bytes memory bbb = new bytes(_ba.length + _bb.length + _bc.length);
uint k = 0;
for (uint i = 0; i < _ba.length; i++) bbb[k++] = _ba[i];
for (uint i = 0; i < _bb.length; i++) bbb[k++] = _bb[i];
for (uint i = 0; i < _bc.length; i++) bbb[k++] = _bc[i];
return string(bbb);
}

function recover(string memory message, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
bytes memory msgBytes = bytes(message);
bytes memory fullMessage = concat(
bytes("\x19Ethereum Signed Message:\n"),
bytes(msgBytes.length.toString()),
msgBytes,
new bytes(0), new bytes(0), new bytes(0), new bytes(0)
);
return ecrecover(keccak256(fullMessage), v, r, s);
}

function concat(bytes memory _ba, bytes memory _bb, bytes memory _bc, bytes memory _bd, bytes memory _be, bytes memory _bf, bytes memory _bg) internal pure returns (bytes memory) {
bytes memory resultBytes = new bytes(_ba.length + _bb.length + _bc.length + _bd.length + _be.length + _bf.length + _bg.length);
uint k = 0;
for (uint i = 0; i < _ba.length; i++) resultBytes[k++] = _ba[i];
for (uint i = 0; i < _bb.length; i++) resultBytes[k++] = _bb[i];
for (uint i = 0; i < _bc.length; i++) resultBytes[k++] = _bc[i];
for (uint i = 0; i < _bd.length; i++) resultBytes[k++] = _bd[i];
for (uint i = 0; i < _be.length; i++) resultBytes[k++] = _be[i];
for (uint i = 0; i < _bf.length; i++) resultBytes[k++] = _bf[i];
for (uint i = 0; i < _bg.length; i++) resultBytes[k++] = _bg[i];
return resultBytes;
}
}

contract HasContractURI is ERC165 {

string public contractURI;

/*
* bytes4(keccak256('contractURI()')) == 0xe8a3d485
*/
bytes4 private constant _INTERFACE_ID_CONTRACT_URI = 0xe8a3d485;

constructor(string memory _contractURI) public {
contractURI = _contractURI;
_registerInterface(_INTERFACE_ID_CONTRACT_URI);
}

/**
* @dev Internal function to set the contract URI
* @param _contractURI string URI prefix to assign
*/
function _setContractURI(string memory _contractURI) internal {
contractURI = _contractURI;
}
}

contract HasTokenURI {
using StringLibrary for string;

//Token URI prefix
string public tokenURIPrefix;

// Optional mapping for token URIs
mapping(uint256 => string) private _tokenURIs;

constructor(string memory _tokenURIPrefix) public {
tokenURIPrefix = _tokenURIPrefix;
}

function _tokenURI(uint256 tokenId) internal view returns (string memory) {
}

function _setTokenURI(uint256 tokenId, string memory uri) internal {
_tokenURIs[tokenId] = uri;
}

/**
* @dev Internal function to set the token URI prefix.
* @param _tokenURIPrefix string URI prefix to assign
*/
function _setTokenURIPrefix(string memory _tokenURIPrefix) internal {
tokenURIPrefix = _tokenURIPrefix;
}

function _clearTokenURI(uint256 tokenId) internal {
if (bytes(_tokenURIs[tokenId]).length != 0) {
delete _tokenURIs[tokenId];
}
}
}

contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks

function _msgSender() internal view returns (address payable) {
return msg.sender;
}

function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}

contract Ownable is Context {

/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
_owner = msgSender;
}

/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}

/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}

/**
* @dev Returns true if the caller is the current owner.
*/
function isOwner() public view returns (bool) {
return _msgSender() == _owner;
}

function renounceOwnership() public onlyOwner {
}

function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}

/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}

/**
Note: The ERC-165 identifier for this interface is 0x0e89341c.
*/

function uri(uint256 _id) external view returns (string memory);
}

/**
Note: The ERC-165 identifier for this interface is 0x0e89341c.
*/

constructor(string memory _tokenURIPrefix) HasTokenURI(_tokenURIPrefix) public {

}

function uri(uint256 _id) external view returns (string memory) {
return _tokenURI(_id);
}
}

contract HasSecondarySaleFees is ERC165 {

event SecondarySaleFees(uint256 tokenId, address[] recipients, uint[] bps);

bytes4 private constant _INTERFACE_ID_FEES = 0xb7799584;

constructor() public {
_registerInterface(_INTERFACE_ID_FEES);
}

function getFeeRecipients(uint256 id) public view returns (address payable[] memory);
function getFeeBps(uint256 id) public view returns (uint[] memory);
}

contract ERC1155Base is HasSecondarySaleFees, Ownable, ERC1155Metadata_URI, HasContractURI, ERC1155 {

struct Fee {
uint256 value;
}

// id => creator
mapping (uint256 => address) public creators;
// id => fees
mapping (uint256 => Fee[]) public fees;

constructor(string memory contractURI, string memory tokenURIPrefix) HasContractURI(contractURI) ERC1155Metadata_URI(tokenURIPrefix) public {

}

function getFeeRecipients(uint256 id) public view returns (address payable[] memory) {
Fee[] memory _fees = fees[id];
for (uint i = 0; i < _fees.length; i++) {
result[i] = _fees[i].recipient;
}
return result;
}

function getFeeBps(uint256 id) public view returns (uint[] memory) {
Fee[] memory _fees = fees[id];
uint[] memory result = new uint[](_fees.length);
for (uint i = 0; i < _fees.length; i++) {
result[i] = _fees[i].value;
}
return result;
}

// Creates a new token type and assings _initialSupply to minter
function _mint(uint256 _id, Fee[] memory _fees, uint256 _supply, string memory _uri) internal {
require(_supply != 0, "Supply should be positive");
require(bytes(_uri).length > 0, "uri should be set");

creators[_id] = msg.sender;
uint[] memory bps = new uint[](_fees.length);
for (uint i = 0; i < _fees.length; i++) {
require(_fees[i].recipient != address(0x0), "Recipient should be present");
require(_fees[i].value != 0, "Fee value should be positive");
fees[_id].push(_fees[i]);
recipients[i] = _fees[i].recipient;
bps[i] = _fees[i].value;
}
if (_fees.length > 0) {
emit SecondarySaleFees(_id, recipients, bps);
}
balances[_id][msg.sender] = _supply;
_setTokenURI(_id, _uri);

// Transfer event with mint semantic
emit TransferSingle(msg.sender, address(0x0), msg.sender, _id, _supply);
emit URI(_uri, _id);
}

function burn(address _owner, uint256 _id, uint256 _value) external {

require(_owner == msg.sender || operatorApproval[_owner][msg.sender] == true, "Need operator approval for 3rd party burns.");

// SafeMath will throw with insuficient funds _owner
// or if _id is not valid (balance will be 0)
balances[_id][_owner] = balances[_id][_owner].sub(_value);

// MUST emit event
emit TransferSingle(msg.sender, _owner, address(0x0), _id, _value);
}

function _setTokenURI(uint256 tokenId, string memory uri) internal {
require(creators[tokenId] != address(0x0), "_setTokenURI: Token should exist");
super._setTokenURI(tokenId, uri);
}

function setTokenURIPrefix(string memory tokenURIPrefix) public onlyOwner {
_setTokenURIPrefix(tokenURIPrefix);
}

function setContractURI(string memory contractURI) public onlyOwner {
_setContractURI(contractURI);
}
}

/**
* @title Roles
* @dev Library for managing addresses assigned to a Role.
*/
library Roles {
struct Role {
}

/**
*/
require(!has(role, account), "Roles: account already has role");
role.bearer[account] = true;
}

/**
*/
function remove(Role storage role, address account) internal {
require(has(role, account), "Roles: account does not have role");
role.bearer[account] = false;
}

function has(Role storage role, address account) internal view returns (bool) {
return role.bearer[account];
}
}

contract SignerRole is Context {
using Roles for Roles.Role;

Roles.Role private _signers;

constructor () internal {
}

modifier onlySigner() {
require(isSigner(_msgSender()), "SignerRole: caller does not have the Signer role");
_;
}

function isSigner(address account) public view returns (bool) {
return _signers.has(account);
}

}

function renounceSigner() public {
_removeSigner(_msgSender());
}

}

_signers.remove(account);
emit SignerRemoved(account);
}
}

contract RaribleToken is Ownable, SignerRole, ERC1155Base {
string public name;
string public symbol;

constructor(string memory _name, string memory _symbol, address signer, string memory contractURI, string memory tokenURIPrefix) ERC1155Base(contractURI, tokenURIPrefix) public {
name = _name;
symbol = _symbol;

}

}

function removeSigner(address account) public onlyOwner {
_removeSigner(account);
}

function mint(uint256 id, Fee[] memory fees, uint256 supply, string memory uri) onlyOwner public {

_mint(id, fees, supply, uri);
}
}

contract RaribleUserToken is RaribleToken {
event CreateERC1155_v1(address indexed creator, string name, string symbol);

constructor(string memory name, string memory symbol, string memory contractURI, string memory tokenURIPrefix, address signer) RaribleToken(name, symbol, signer, contractURI, tokenURIPrefix) public {
emit CreateERC1155_v1(msg.sender, name, symbol);
}

}
``````

`Fee` is of type struct-

``````struct Fee {
uint256 value;
}
``````

And `mint` expects an array of `Fee` objects... try constructing your Fee argument like this?

``````[
{
"recipient": "0x0000000000000000000000000000000000000001",
"value": 34
}
]
``````

I had the same problem and fixed it using "[" brackets instead of regular brackets "(" for wrapping a struct. So if you have arrays of tuple like (string, bool) then send data like:

``````[["firstTuple", true], ["secondTuple", false]]
``````

I had the same problem and I solved it with this using double brackets, example:

you have:

``````[
{
"recipient": "0x0000000000000000000000000000000000000001",
"value": 34
}
]
``````

use it this way in `Remix`:

``````[["0x0000000000000000000000000000000000000001", 34]]
``````

and it will work for you!