1. Protocol
  2. Smart contracts

Protocol

Smart contracts

NOTE

The developer documentation is far from complete at this stage but don't hesitate to join our Discord to ask any question that is not yet answered here.

Concepts

Each project that needs to distribute and redeem credentials (for example tickets or vouchers) is a separate contract compatible with the ERC721 specifications.

A new contract/project is created as a on chain proxy by a special contract Factory to a unique singleton contract that contain the same code for all projects, thus minimizing onchain replication of code.

Data associated with a project can be stored on IPFS with some minimal replication onchain when necessary.

RougeProxyFactory

We are using the same proxy pattern as the Gnosis Safe, so deployments costs are minimized. All Rouge logic is implemented in a mastercopy which is deployed only once per version, and therefore, creating a new Rouge project requires only deploying a proxy contract to that mastercopy.

        
  event ProxyCreation(address,address)
  function calculateCreateProxyWithNonceAddress(address,bytes,uint256) returns (address)
  function createProxy(address,bytes) returns (address)
  function createProxyWithCallback(address,bytes,uint256,address) returns (address)
  function createProxyWithNonce(address,bytes,uint256) returns (address)
  function proxyCreationCode() pure returns (bytes)
  function proxyRuntimeCode() pure returns (bytes)


      

Rouge

The Rouge contract contains all core functionality required to manage a Rouge project, create different credentials "channels", and distribute them freely or against native or ERC20 tokens. The Rouge contract is a superset of a ERC721 so each credential is represented as a distinct NFT.

          event Acquired(uint48 indexed,bytes16,uint256,uint24)
  event AddedChannel(uint16 indexed,uint48,uint256)
  event Approval(address indexed,address indexed,uint256 indexed)
  event ApprovalForAll(address indexed,address indexed,bool)
  event ProjectSetup(address,address,string)
  event Redeemed(address,uint48 indexed)
  event Transfer(address indexed,address indexed,uint256 indexed)
  event UpdateAuthorization(address indexed,bytes4 indexed,uint16 indexed,bool)
  function acquire(tuple(uint16,uint16,uint256,bytes16[])[]) payable
  function addChannels(tuple(uint48,uint48,uint48,address,uint256)[])
  function approve(address,uint256)
  function approveToken(address,address,uint256)
  function balanceOf(address) view returns (uint256)
  function getApproved(uint256) view returns (address)
  function getInfos() view returns (string, tuple(uint48,uint48,uint48,address,uint256)[], uint256[])
  function getRoles(bytes4[],address) view returns (bool[][])
  function getTokenInfos(uint48) view returns (address, uint16, bytes16, bool, uint256)
  function hasRole(address,bytes4,uint16) view returns (bool)
  function isApprovedForAll(address,address) view returns (bool)
  function isEnabled(bytes4,uint16) view returns (bool)
  function isValid(tuple(address,uint48,tuple(bytes4,uint32),bytes32,bytes32,uint8)) view returns (bool)
  function isValidSignature(tuple(address,uint48,tuple(bytes4,uint32),bytes32,bytes32,uint8)) view returns (bool)
  function name() view returns (string)
  function ownerOf(uint256) view returns (address)
  function redeem(tuple(uint16,bytes32,tuple(address,uint48,tuple(bytes4,uint32),bytes32,bytes32,uint8))[])
  function safeTransferFrom(address,address,uint256)
  function safeTransferFrom(address,address,uint256,bytes)
  function setApprovalForAll(address,bool)
  function setup(address,string,tuple(uint48,uint48,uint48,address,uint256)[],tuple(address,bytes4,uint16[],bool)[])
  function supportsInterface(bytes4) view returns (bool)
  function symbol() view returns (string)
  function tokenURI(uint256) view returns (string)
  function transferFrom(address,address,uint256)
  function updateAuthorizations(tuple(address,bytes4,uint16[],bool)[])
  function validProof(bytes16,bytes32) pure returns (bool)
  function validTokenProof(uint16,bytes32) view returns (bool)
  function widthdraw(address,uint256)
  function widthdrawToken(address,address,uint256)