Point

Introduction

The Point ADO allows users to store the coordinates for one point. This ADO can then be referenced in the Graph ADO to save this coordinate for the user.

The Point ADO can be set to one of the following:

  • Private: Only accessible by the contract owner of the ADO.

  • Public: Accessible by anyone.

  • Restricted: Only accessible to the address that set the point the first time.

Ado_type: point

Version: 0.1.0

InstantiateMsg

pub struct InstantiateMsg {
    pub restriction:PointRestriction,
    pub kernel_address: String,
    pub owner: Option<String>
}
Name
Type
Description

restriction

Specifies who has access specify the point coordiantes

kernel_address

String

owner

Option<String>

Optional address to specify as the owner of the ADO being created. Defaults to the sender if not specified.

PointRestriction

An enum defining the different types of restrictions that can be set.

pub enum PointRestriction {
    Private,
    Public,
    Restricted,
}
  • Private: Only accessible by the contract owner of the ADO.

  • Public: Accessible by anyone.

  • Restricted: Only accessible to the key owner (The address that first set the point).

ExecuteMsg

SetPoint

Sets the point coordinates.

Authorization for this message depends on the set PointRestriction.

pub enum ExecuteMsg {
SetPoint {
   point: PointCoordinate 
    },
  }
Name
Type
Description

point

The coordinates of the point to save.

PointCoordinate

pub struct PointCoordinate {
    pub x_coordinate: String,
    pub y_coordinate: String,
    pub z_coordinate: Option<String>,
}
Name
Type
Description

x_coordinate

String

The x coordinate for the point.

y_coordinate

String

The y coordinate for the point.

z_coordinate

Option<String>

The z coordinate for the point. Do not specify in case the graph is 2D.

DeletePoint

Deletes the data attached to set point.

Authorization for this message depends on the set PointRestriction.

pub enum ExecuteMsg{
   DeletePoint {},
}

UpdateRestriction

Changes the restriction set on the Point ADO.

Only available to the contract owner.

pub enum ExecuteMsg {
 UpdateRestriction {
        restriction: PointRestriction,
    },
}
Name
Type
Description

restriction

The new restriction type to use for the Point ADO.

Base Executes

The rest of the execute messages can be found in the ADO Base section.

QueryMsg

GetPoint

Gets the coordinates of the stored point.

pub enum QueryMsg { 
    #[returns(PointCoordinate)]
    GetPoint {},
    }

GetValueResponse

#[cw_serde]
pub struct PointCoordinate {
    pub x_coordinate: String,
    pub y_coordinate: String,
    pub z_coordinate: Option<String>,
}
Name
Type
Description

x_coordinate

String

The x coordinate for the point.

y_coordinate

String

The y coordinate for the point.

z_coordinate

Option<String>

The z coordinate for the point.

GetDataOwner

Queries the address of the user who set the point coordinates.

pub enum QueryMsg {
#[returns(GetDataOwnerResponse)]
    GetDataOwner {},
    }

GetDataOwnerResponse

#[cw_serde]
pub struct GetDataOwnerResponse {
    pub owner: AndrAddr,
}
Name
Type
Description

owner

AndrAddr

The address that set the point coordinates.

Base Queries

The rest of the query messages can be found in the ADO Base section.

Last updated