Skip to content

Fabrica Smartcontracts, including ERC1155 (NFT) contract, Fabrica validator and registry.

Notifications You must be signed in to change notification settings

fabrica-land/fabrica-contracts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fabrica-contracts

Contract Addresses

Ethereum Mainnet Contracts

Sepolia Contracts

Common

  • Null address: 0x0000000000000000000000000000000000000000

Deploying Initial Contracts and Proxies

  1. yarn && yarn rebuild
  2. Copy and paste the files in folder custom_flatten/ to Remix.
  3. Use compiler version v0.8.28+commit.7893614a with optimization enabled and runs set to 1.
  4. Validator:
    1. Deploy the FabricaValidator contract and verify the source code on Etherscan (be sure to set optimize to true and runs to 1); copy address
    2. Deploy the FabricaProxy contract with these constructor arguments, and verify the source code on Etherscan (optimize, 1 run):
      1. _logic set to the pasted validator implementation address
      2. _admin set to the deployment-account address, or 0x0000000000000000000000000000000000000000 (same effect)
      3. _data set to 0x8129fc1c (which is an ABI-packed call to intitialize with no arguments)
    3. After deploying the token proxy (next step), call setBaseUri in Write as Proxy on the validator proxy in Etherscan to set the value to https://metadata.fabrica.land/<network_name>/<token_proxy_address>/. The trailing slash is mandatory.
  5. ERC-1155 token:
    1. Deploy the FabricaToken contract and verify the source code on Etherscan; copy address
    2. Deploy the FabricaProxy contract with these constructor arguments:
      1. _logic set to the pasted token implementation address
      2. _admin set to the deployment-account address, or 0x0000000000000000000000000000000000000000 (same effect)
      3. _data set to 0x8129fc1c (which is an ABI-packed call to intitialize with no arguments)
    3. Verify the source of the proxy on Etherscan (optimize, 1 run). Use the following tool to generate an ABI packing of the constructor arguments: https://abi.hashex.org/ and add 0x to the front of it. Paste this into Etherscan.
    4. Call setDefaultValidator in "Write as Proxy" on Etherscan: set the value to the validator proxy address

Upgrading Implementations

There are two cases: the simple case (no new initializer), and the complex case, where you implement a new initializer. In the simple case, you can simply call upgradeTo in "Write as Proxy" on the proxy address in Etherscan, passing in the address of the newly-deployed implementation contract as newImplementation.

The complex case comes into play if you add an inheritance to a contract that has a constructor. You need to instead inherit from the upgradeable version of the contract (node_modules/@openzeppelin/contract-upgradeable), and add its __ClassName_init(); method to a new initializer in your contract. Initializers can only be called once, so the new initializer is added and the initial initialize method is left alone. The new initializer has a new name (e.g. initializeV2) and carries the reinitializer modifier (instead of initializer), which accepts an integer. So take the next integer that hasn't been implemented and pass it in, e.g. function initializeV2() public reinitialize(2) {

In the complex case, you need to call upgradeToAndCall in "Write as Proxy" on the proxy contract on Etherscan. Pass 0 ETH for the payableAmount, the new implementation address in newImplementation, and in data you need to pass in ABI-packed bytes of the name of the new initializer and any arguments. You can generate the ABI-packed string using this tool: https://abi.hashex.org/ and don't forget to add 0x in front of the result.

In either case, first deploy the new implementation and verify its source. Then call upgradeTo or upgradeToAndCall as indicated above.

Make sure:

  • Constructor is not changed (it invalidates initializers)
  • Old initializers are not changed
  • Any new initialization logic is in a new initializer with the reinitialize(nextVersionNumber) modifier
  • New initializer calls __ClassName_init(); on any new upgradeable contracts that are inherited
  • New initializer is passed to upgradeToAndCall as a packed ABI call (see above)

Onchain Traits Deployment

  • Deploy and verify the validator-registry contract
  • Deploy and verify the validator-registry proxy, setting the initial implementation and calling initialize in the data
  • Add the Fabrica v3 Validator name, pointing to the validator proxy
  • Test the name method
  • Deploy and verify the new validator implementation
  • Call upgradeTo on the validator proxy
  • Add the trust names for each of our operating-agreement versions
  • Test the operatingAgreementName method
  • Set and test the default operating agreement
  • Deploy and verify the new token implementation
  • Call upgradeToAndCall on the token proxy, calling initializeV3
  • Call setValidatorRegistry with the address of the registry proxy
  • Call updateValidator and updateOperatingAgreement on a token
  • Test getTraitValue with each, and test getTraitValues with both

Archived

Previous Mainnet Contracts

  • 1155 Token Proxy: 0xd8A38b46D8cF9813c7c9233B844DD0eC7D7e8750
  • 1155 Token Implementations:
    • 0x8E9d55A4cA3EdF7Bf3263F746AF404A2c985EdF7
    • 0x58fe23aeb6e7768457fbc1c89f303835a9de2956
    • 0x43c6eE9D5B2369C5484f69E2Eb3361466855beDd
    • 0xAc060b48bdd8680b7fCcB8563D78e1B85219485B
  • Validator Proxy: 0x6fA2Ee5C9841163E88c85a40B70a90FCD5FBB68b
  • Validator Implementations:
    • 0x236fcc678E28e7eE97d83ae926087DC880D1D40D
    • 0x7dEd932Ff0AD55F1D12436A29bCAE846C2115A7C

Previous Sepolia Contracts

Previous Goerli Contracts (Goerli is completely deprecated)

About

Fabrica Smartcontracts, including ERC1155 (NFT) contract, Fabrica validator and registry.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published