@@ -60,28 +60,28 @@ The Band Oracle contract maintains a decentralized price feed system with three
6060Price data is stored using the ` RefData ` struct:
6161
6262``` cadence
63- pub struct RefData {
63+ access(all) struct RefData {
6464 // USD-rate, multiplied by 1e9
65- pub var rate: UInt64
65+ access(all) var rate: UInt64
6666 // UNIX epoch when data was last resolved
67- pub var timestamp: UInt64
67+ access(all) var timestamp: UInt64
6868 // BandChain request identifier for this data
69- pub var requestID: UInt64
69+ access(all) var requestID: UInt64
7070}
7171```
7272
7373When querying prices, you receive a ` ReferenceData ` struct:
7474
7575``` cadence
76- pub struct ReferenceData {
76+ access(all) struct ReferenceData {
7777 // Rate as integer multiplied by 1e18
78- pub var integerE18Rate: UInt256
78+ access(all) var integerE18Rate: UInt256
7979 // Rate as a fixed-point decimal
80- pub var fixedPointRate: UFix64
80+ access(all) var fixedPointRate: UFix64
8181 // Timestamp of base symbol data
82- pub var baseTimestamp: UInt64
82+ access(all) var baseTimestamp: UInt64
8383 // Timestamp of quote symbol data
84- pub var quoteTimestamp: UInt64
84+ access(all) var quoteTimestamp: UInt64
8585}
8686```
8787
@@ -107,14 +107,14 @@ The contract emits events to notify applications of updates:
107107
108108``` cadence
109109// Emitted when symbol prices are updated
110- pub event BandOracleSymbolsUpdated(
110+ access(all) event BandOracleSymbolsUpdated(
111111 symbols: [String],
112112 relayerID: UInt64,
113113 requestID: UInt64
114114)
115115
116116// Emitted when a symbol is removed
117- pub event BandOracleSymbolRemoved(symbol: String)
117+ access(all) event BandOracleSymbolRemoved(symbol: String)
118118```
119119
120120## Usage Guide
@@ -189,12 +189,12 @@ import "BandOracle"
189189import "FlowToken"
190190import "FungibleToken"
191191
192- pub contract MyDeFiContract {
192+ access(all) contract MyDeFiContract {
193193
194194 // Store a vault to pay for oracle fees
195195 access(self) let oracleFeeVault: @{FungibleToken.Vault}
196196
197- pub fun getTokenPriceInUSD(tokenSymbol: String): UFix64 {
197+ access(all) fun getTokenPriceInUSD(tokenSymbol: String): UFix64 {
198198 // Withdraw payment for oracle
199199 let payment <- self.oracleFeeVault.withdraw(
200200 amount: BandOracle.getFee()
@@ -210,7 +210,7 @@ pub contract MyDeFiContract {
210210 return priceData.fixedPointRate
211211 }
212212
213- pub fun swapTokens(amount: UFix64, maxPrice: UFix64) {
213+ access(all) fun swapTokens(amount: UFix64, maxPrice: UFix64) {
214214 // Get current price
215215 let currentPrice = self.getTokenPriceInUSD(tokenSymbol: "ETH")
216216
@@ -239,7 +239,7 @@ Monitor the `BandOracleSymbolsUpdated` event to keep your contract's stored pric
239239
240240``` cadence
241241// Listen for this event in your application
242- pub event BandOracleSymbolsUpdated(
242+ access(all) event BandOracleSymbolsUpdated(
243243 symbols: [String],
244244 relayerID: UInt64,
245245 requestID: UInt64
0 commit comments