☁️Common

Ownership transfer logic for Astroport contracts

1. Summary

The Common file defines the struct used when a contract owner proposes a change of ownership as well as the logic to propose and transfer contract ownership.

2. Variables and Functions

Structs

Name
Description
Contains

OwnershipProposal

This struct holds parameters used for a contract ownership transfer request.

  • owner - the newly proposed owner

  • ttl - time until the proposal to change ownership expires

Functions

Name
Params
Description

propose_new_owner

(deps: DepsMut, info: MessageInfo, env: Env, new_owner: String, expires_in: u64, owner: Addr, proposal: Item<OwnershipProposal>) -> StdResult<Response>

Creates a new request to change contract ownership

drop_ownership_proposal

(deps: DepsMut, info: MessageInfo, owner: Addr, proposal: Item) -> StdResult<Response>

Removes a request to change contract ownership

claim_ownership

(deps: DepsMut, info: MessageInfo, env: Env, proposal: Item<OwnershipProposal>, cb: fn(DepsMut, Addr) -> StdResult<()>) -> StdResult<Response>

Claims ownership over the contract. cb is a callback function that returns the result of the claim to a specific contract

Last updated

Was this helpful?