Skip to content

Bondly Contract v0.4 πŸŒ™ - Eth Argentina Main Event - πŸ‡¦πŸ‡· πŸ‡²πŸ‡½

Notifications You must be signed in to change notification settings

josemariasosa/bondly-contracts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

35 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Bondly Contract

Buenos Aires - Guadalajara

Modular Hackathon

Bondly was deployed on Avalanche πŸ”ΊπŸ”»πŸ”Ί Fuji testnet:

Addresses of the deployed contracts:
 - Bondly Address:  0xb734eb2e370735d2e27e4E133534B6b848e7fBa1
 - USDT dummy:      0x9fea0ED05e44A6b759fa1f9C5228b464Bf31C1cB

Introduction

The backend for the Bondly app is composed by two blocks:

  1. The Bondly smart contract.
  2. The Cedalio database.

In order to relate the information between the two backends we are using the ids in UUID created by Cedalio. An example looks:

{
  "id": "207760f2-fdd3-4397-80cc-a51093ccbf18"
}

Test the smart contract

Run the contract tests.

$ npx hardhat test

  Bondly App - Test Suite for Modular Hackathon 🐷
    Deployment
      βœ” Should be deployed with the correct params. (949ms)
      βœ” Should have a correct initial setup. (200ms)
    Create, approve and reject Movements
      βœ” Should create a movement. (61ms)
      βœ” Should approve a movement. (113ms)
      βœ” Should reject a movement, but after 2nd approval, send the funds. (141ms)
      βœ” Should reject a movement altogether and return the funds to the Organization. (126ms)


  6 passing (2s)

Test the database

Complile the schema.

cedalio compile --schema-file data/schema.graphql

Run a local hardhat node. The configuration force mining 1 block per second.

npx hardhat node --config ./hardhat.config.cedalio-node.js

Deploy.

cedalio deploy --fresh --schema-file data/schema.graphql --network hardhat

## IMPORTANT: The prompt will ask you to give a name to the schema.

cedalio serve --schema-name schema

Create the principal objects to generate an ID the users could use in the smart contract.

# Create an Organization
mutation {
  createOrganization(organization: {
    name: "My First Organization"
    owners: ["alice.address", "bob.address", "carl.address"]
  }) {
    txHash
    organization {
      id
    }
  }
}

After running the mutation, this is what you expect to see after running the query.

{
  "data": {
    "createOrganization": {
      "organization": {
        "id": "c9dfdef5-4977-4467-80b9-82453be07ec1"
      }
    }
  }
}

Now, is time to create a new project.

mutation {
  createProject(project: {
    name: "Podcast Event"
    description: "This is an event for a Web3 podcast."
    start_datetime: "2023-04-04"
    end_datetime: "2023-04-04"
    budget: 300
    organization: "c9dfdef5-4977-4467-80b9-82453be07ec1"
  }) {
    txHash
    project {
      id
    }
  }
}

And last, create a new movement, to be submited to approval.

mutation {
  createMovement(movement: {
    title: "Pagar Pizzas"
    description: "Las pizzas mas ricas del mundo"
    amount: 199
    token: "USDT"
    content: "link/to/online/content"
    pay_to_address: "pizzaShop.address"
    tag: "comida"
    organization: "c9dfdef5-4977-4467-80b9-82453be07ec1"
    project: "fe2f8dfa-0c6e-4d60-ba62-efc1c1dcd712"
  }) {
    txHash
    movement {
      id
    }
  }
}

Deployment

Smart contract was deployed in ETH Goerli.

Addresses of the deployed contracts:
 - OrganizationVault:  0x9fea0ED05e44A6b759fa1f9C5228b464Bf31C1cB
 - Goerli USDT Token:  0x509ee0d083ddf8ac028f2a56731412edd63223b9

Deployment transaction: https://goerli.etherscan.io/tx/0xe1de38996e9cf488e1832bda680b192e1542259ac0fb8e9d2143c85a1323ddec

About

Bondly Contract v0.4 πŸŒ™ - Eth Argentina Main Event - πŸ‡¦πŸ‡· πŸ‡²πŸ‡½

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published