Stake Granularity in solana - solana

Hello Can anyone please explain why is stake granularity important in solana? and also if I change all the stakers to one single address my total supply varies significantly,any explanation for this?
pub const CREATOR_STAKER_INFOS: &[StakerInfo] = &[
StakerInfo {
name: "impossible pizza",
staker: "uE3TVEffRp69mrgknYr71M18GDqL7GxCNGYYRjb3oUt",
lamports: 100_000_000 * LAMPORTS_PER_SOL,
withdrawer: Some("59SLqk4ete5QttM1WmjfMA7uNJnJVFLQqXJSy9rvuj7c"),
},
];
pub const SERVICE_STAKER_INFOS: &[StakerInfo] = &[
StakerInfo {
name: "wretched texture",
staker: "uE3TVEffRp69mrgknYr71M18GDqL7GxCNGYYRjb3oUt",
lamports: 5_000_000 * LAMPORTS_PER_SOL,
withdrawer: Some("HWzeqw1Yk5uiLgT2uGUim5ocFJNCwYUFbeCtDVpx9yUb"),
},
];
pub const FOUNDATION_STAKER_INFOS: &[StakerInfo] = &[
StakerInfo {
name: "lyrical supermarket",
staker: "uE3TVEffRp69mrgknYr71M18GDqL7GxCNGYYRjb3oUt",
lamports: 5_000_000 * LAMPORTS_PER_SOL,
withdrawer: Some("C7WS9ic7KN9XNcLsNoMvzTvbzURM3rFGDEQN7qJMWNLn"),
},
];
pub const GRANTS_STAKER_INFOS: &[StakerInfo] = &[
StakerInfo {
name: "rightful agreement",
staker: "uE3TVEffRp69mrgknYr71M18GDqL7GxCNGYYRjb3oUt",
lamports: 5_000_000 * LAMPORTS_PER_SOL,
withdrawer: Some("EDwSQShtUWQtmFfN9SpUUd6hgonL7tRdxngAsNKv9Pe6"),
},
];
pub const COMMUNITY_STAKER_INFOS: &[StakerInfo] = &[
StakerInfo {
name: "shrill charity",
staker: "uE3TVEffRp69mrgknYr71M18GDqL7GxCNGYYRjb3oUt",
lamports: 5_000_000 * LAMPORTS_PER_SOL,
withdrawer: Some("8CUUMKYNGxdgYio5CLHRHyzMEhhVRMcqefgE6dLqnVRK"),
},
];

Related

amcharts get object on inited event

amcharts v4 code
am4core.useTheme(am4themes_animated);
let chart = am4core.create("region-map", am4maps.MapChart);
let interfaceColors = new am4core.InterfaceColorSet();
// Set map definition
chart.geodata = am4geodata_worldLow;
// Set projection
chart.projection = new am4maps.projections.Mercator();
// Export
// Data for general and map use
let originCities = [
{
id: "london",
title: "London",
destinations: [
"vilnius",
"reykjavik",
"lisbon",
"moscow",
"belgrade",
"ljublana",
"madrid",
"stockholm",
"bern",
"kiev",
"new york",
],
latitude: 51.5002,
longitude: -0.1262,
scale: 1.5,
zoomLevel: 2.74,
zoomLongitude: -20.1341,
zoomLatitude: 49.1712,
},
];
let destinationCities = [
{
id: "brussels",
title: "Brussels",
latitude: 50.8371,
longitude: 4.3676,
},
{
id: "prague",
title: "Prague",
latitude: 50.0878,
longitude: 14.4205,
},
{
id: "athens",
title: "Athens",
latitude: 37.9792,
longitude: 23.7166,
},
{
id: "reykjavik",
title: "Reykjavik",
latitude: 64.1353,
longitude: -21.8952,
},
{
id: "dublin",
title: "Dublin",
latitude: 53.3441,
longitude: -6.2675,
},
{
id: "oslo",
title: "Oslo",
latitude: 59.9138,
longitude: 10.7387,
},
{
id: "lisbon",
title: "Lisbon",
latitude: 38.7072,
longitude: -9.1355,
},
{
id: "moscow",
title: "Moscow",
latitude: 55.7558,
longitude: 37.6176,
},
{
id: "belgrade",
title: "Belgrade",
latitude: 44.8048,
longitude: 20.4781,
},
{
id: "bratislava",
title: "Bratislava",
latitude: 48.2116,
longitude: 17.1547,
},
{
id: "ljublana",
title: "Ljubljana",
latitude: 46.0514,
longitude: 14.506,
},
{
id: "madrid",
title: "Madrid",
latitude: 40.4167,
longitude: -3.7033,
},
{
id: "stockholm",
title: "Stockholm",
latitude: 59.3328,
longitude: 18.0645,
},
{
id: "bern",
title: "Bern",
latitude: 46.948,
longitude: 7.4481,
},
{
id: "kiev",
title: "Kiev",
latitude: 50.4422,
longitude: 30.5367,
},
{
id: "paris",
title: "Paris",
latitude: 48.8567,
longitude: 2.351,
},
{
id: "new york",
title: "New York",
latitude: 40.43,
longitude: -74,
},
];
// Default to London view
//chart.homeGeoPoint = { "longitude": originCities[0].zoomLongitude, "latitude": originCities[0].zoomLatitude };
//chart.homeZoomLevel = originCities[0].zoomLevel;
let targetSVG =
"M9,0C4.029,0,0,4.029,0,9s4.029,9,9,9s9-4.029,9-9S13.971,0,9,0z M9,15.93 c-3.83,0-6.93-3.1-6.93-6.93S5.17,2.07,9,2.07s6.93,3.1,6.93,6.93S12.83,15.93,9,15.93 M12.5,9c0,1.933-1.567,3.5-3.5,3.5S5.5,10.933,5.5,9S7.067,5.5,9,5.5 S12.5,7.067,12.5,9z";
// Texts
let labelsContainer = chart.createChild(am4core.Container);
labelsContainer.isMeasured = false;
labelsContainer.x = 80;
labelsContainer.y = 27;
labelsContainer.layout = "horizontal";
labelsContainer.zIndex = 10;
// let plane = labelsContainer.createChild(am4core.Sprite);
// plane.scale = 0.15;
// plane.path = planeSVG;
// plane.fill = am4core.color("#cc0000");
// let title = labelsContainer.createChild(am4core.Label);
// title.text = "Flights from London";
// title.fill = am4core.color("#cc0000");
// title.fontSize = 20;
// title.valign = "middle";
// title.dy = 2;
// title.marginLeft = 15;
// let changeLink = chart.createChild(am4core.TextLink);
// changeLink.text = "Click to change origin city";
// changeLink.isMeasured = false;
// changeLink.events.on("hit", function () {
// if (currentOrigin == originImageSeries.dataItems.getIndex(0)) {
// showLines(originImageSeries.dataItems.getIndex(1));
// } else {
// showLines(originImageSeries.dataItems.getIndex(0));
// }
// });
// changeLink.x = 142;
// changeLink.y = 72;
// changeLink.fontSize = 13;
// The world
let worldPolygonSeries = chart.series.push(new am4maps.MapPolygonSeries());
worldPolygonSeries.useGeodata = true;
worldPolygonSeries.fillOpacity = 0.6;
worldPolygonSeries.exclude = ["AQ"];
// Origin series (big targets, London and Vilnius)
let originImageSeries = chart.series.push(new am4maps.MapImageSeries());
let originImageTemplate = originImageSeries.mapImages.template;
originImageTemplate.propertyFields.latitude = "latitude";
originImageTemplate.propertyFields.longitude = "longitude";
originImageTemplate.propertyFields.id = "id";
originImageTemplate.cursorOverStyle = am4core.MouseCursorStyle.pointer;
originImageTemplate.nonScaling = true;
originImageTemplate.tooltipText = "{title}";
originImageTemplate.setStateOnChildren = true;
originImageTemplate.states.create("hover");
originImageTemplate.horizontalCenter = "middle";
originImageTemplate.verticalCenter = "middle";
let originHitCircle = originImageTemplate.createChild(am4core.Circle);
originHitCircle.radius = 11;
originHitCircle.fill = interfaceColors.getFor("background");
let originTargetIcon = originImageTemplate.createChild(am4core.Sprite);
originTargetIcon.fill = interfaceColors.getFor("alternativeBackground");
originTargetIcon.strokeWidth = 0;
originTargetIcon.scale = 1.3;
originTargetIcon.horizontalCenter = "middle";
originTargetIcon.verticalCenter = "middle";
originTargetIcon.path = targetSVG;
let originHoverState = originTargetIcon.states.create("hover");
originHoverState.properties.fill = chart.colors.getIndex(1);
// when hit on city, change lines
originImageTemplate.events.on("hit", function (event) {
showLines(event.target.dataItem);
});
// destination series (small targets)
let destinationImageSeries = chart.series.push(
new am4maps.MapImageSeries()
);
let destinationImageTemplate = destinationImageSeries.mapImages.template;
destinationImageTemplate.nonScaling = true;
destinationImageTemplate.tooltipText = "{title}";
destinationImageTemplate.fill = interfaceColors.getFor(
"alternativeBackground"
);
destinationImageTemplate.setStateOnChildren = true;
destinationImageTemplate.states.create("hover");
destinationImageTemplate.propertyFields.latitude = "latitude";
destinationImageTemplate.propertyFields.longitude = "longitude";
destinationImageTemplate.propertyFields.id = "id";
let destinationHitCircle = destinationImageTemplate.createChild(
am4core.Circle
);
destinationHitCircle.radius = 7;
destinationHitCircle.fillOpacity = 1;
destinationHitCircle.fill = interfaceColors.getFor("background");
let destinationTargetIcon = destinationImageTemplate.createChild(
am4core.Sprite
);
destinationTargetIcon.scale = 0.7;
destinationTargetIcon.path = targetSVG;
destinationTargetIcon.horizontalCenter = "middle";
destinationTargetIcon.verticalCenter = "middle";
originImageSeries.data = originCities;
destinationImageSeries.data = destinationCities;
// Line series
let lineSeries = chart.series.push(new am4maps.MapLineSeries());
lineSeries.mapLines.template.line.strokeOpacity = 0.5;
lineSeries.mapLines.template.line.strokeDasharray = "1,1";
worldPolygonSeries.events.on("inited", function (ev) {
console.log(ev.target.dataItems.dataContext);
console.log(ev.target._dataItem.dataContext);
console.log(ev.target._dataFields);
});
lineSeries.events.on("inited", function (ev) {
console.log(ev.target.dataItems.dataContext);
console.log(ev.target._dataItem.dataContext);
console.log(ev.target._dataFields);
});
chart.events.on("ready", function (ev) {
showLines(originImageSeries.dataItems.getIndex(0));
});
I have amchart v4 code.Here i am trying to get the object when inited so that i can change the line color and make it dotted.But it is coming undefined.Please take a look how can i solve this.
I have tried logging above in 3 different ways but none working.
Do i need to make inited on charts or any series to get that data ?
Thanks

How get discriminator from anchor account?

I have the contract
use anchor_lang::prelude::*;
declare_id!("kek");
#[constant]
pub const MEDIA_TAG: &[u8] = b"MEDIA_STATE";
#[account]
#[derive(Default)]
pub struct MediaState {
pub authority: Pubkey,
pub name: String,
}
#[program]
pub mod publisher {
use super::*;
pub fn create_media(ctx: Context<CreateMedia>, name: String) -> Result<()> {
msg!("Media name: {}", name);
let media_state = &mut ctx.accounts.media_state;
media_state.authority = ctx.accounts.authority.key();
media_state.name = name;
msg!("Media created");
Ok(())
}
}
#[derive(Accounts)]
#[instruction()]
pub struct CreateMedia<'info> {
#[account(mut)]
pub authority: Signer<'info>,
#[account(
init,
seeds = [MEDIA_TAG, authority.key().as_ref()],
bump,
payer = authority,
space = 8 + std::mem::size_of::<MediaState>(),
)]
pub media_state: Box<Account<'info, MediaState>>,
pub system_program: Program<'info, System>,
}
and I`d like to get the MediaState/CreateMedia discriminator in my javascript code
const publisher = new web3.PublicKey(
"kek"
);
const connection = new web3.Connection(web3.clusterApiUrl("devnet"));
const accounts = await connection.getProgramAccounts(publisher, {
filters: [{ memcmp: { offset: 0, bytes: ?????????? } }],
});
I don`t want use anchor in my js code bc i need only the getProgramAccounts
Thanks
filters: [{ memcmp: { offset: 0, bytes: "FtoqZ3bt1he" } }] - it works. But I don`t know how I can get "FtoqZ3bt1he".
I stole it from SolanaPlayground (network devtools)
const name = 'MediaState';
const discriminator = Buffer.from(sha256.digest("account:" + name)).slice(
0,
8
);
const publisher = new web3.PublicKey(
"kek"
);
const connection = new web3.Connection(web3.clusterApiUrl("devnet"));
const accounts = await connection.getProgramAccounts(publisher, {
filters: [{ memcmp: { offset: 0, bytes: base58.encode(discriminator) } }],
});

The program expected this account to be already initialized (anchor solana)

When I do anchor build, the compiler return this error caused by mint, ownerTokenAccount and buyerTokenAccount. Here is my code:
let minter = await splToken.createMint(connection, wallet.payer, wallet.publicKey, null, 1)
const tokenAccount = // create token account
// minted 1 nft
const buyer: anchor.web3.Keypair = // get keypair from file
const buyerTokenAddress = await anchor.utils.token.associatedAddress({
mint: minter,
owner: buyer.publicKey,
});
await program.methods.buyNft(
new anchor.BN(saleAmount)
)
.accounts({
mint: minter,
ownerTokenAccount: tokenAccount.address,
ownerAuthority: wallet.publicKey,
buyerTokenAccount: buyerTokenAddress,
buyerAuthority: buyer.publicKey,
}).signers([buyer]).rpc();
and this is the code in my contract:
pub fn buy_nft(
ctx: Context<BuyNft>,
// amount: Option<u64>,
lamports: Option<u64>,
) -> Result<()> {
system_program::transfer(
CpiContext::new(
ctx.accounts.system_program.to_account_info(),
system_program::Transfer {
from: ctx.accounts.buyer_authority.to_account_info(),
to: ctx.accounts.owner_authority.to_account_info(),
},
),
lamports.unwrap(),
)?;
associated_token::create(CpiContext::new(
ctx.accounts.owner_token_account.to_account_info(),
associated_token::Create {
payer: ctx.accounts.buyer_authority.to_account_info(),
associated_token: ctx.accounts.buyer_token_account.to_account_info(),
authority: ctx.accounts.buyer_authority.to_account_info(),
mint: ctx.accounts.mint.to_account_info(),
system_program: ctx.accounts.system_program.to_account_info(),
token_program: ctx.accounts.token_program.to_account_info(),
},
))?;
token::transfer(
CpiContext::new(
ctx.accounts.token_program.to_account_info(),
token::Transfer {
from: ctx.accounts.owner_token_account.to_account_info(),
to: ctx.accounts.buyer_token_account.to_account_info(),
authority: ctx.accounts.owner_authority.to_account_info(),
},
),
1,
)?;
Ok(())
}
#[derive(Accounts)]
pub struct BuyNft<'info> {
#[account(mut)]
pub mint: Account<'info, token::Mint>,
#[account(mut)]
pub owner_token_account: Account<'info, token::TokenAccount>,
#[account(mut)]
pub owner_authority: Signer<'info>,
#[account(mut)]
pub buyer_token_account: Account<'info, token::TokenAccount>,
#[account(mut)]
pub buyer_authority: Signer<'info>,
pub system_program: Program<'info, System>,
pub token_program: Program<'info, token::Token>,
}
In my version, the rent param in associated_token::Create is not existed so I remove it. So can you help me fixing this bug? Thanks

websocket subscription server not working. unable to reach subscription server graphql-ws ws

i follow the [same documentation code][1] for creating subscription server using websocket graphql, put it doesn't work with graphql-ws and ws
the code worked when i removed the serverCleanup definition, and it also woks well for older subscription library "subscription-transport-ws"
my index.js
const { ApolloServer } = require('apollo-server-express')
const { ApolloServerPluginDrainHttpServer } = require('apollo-server-core')
const express = require('express')
const http = require('http')
const { makeExecutableSchema } = require('#graphql-tools/schema')
const { upperDirectiveTransformer } = require('./directives/uppercase')
const { WebSocketServer } = require ('ws');
const { useServer } = require('graphql-ws/lib/use/ws');
const { typeDefs } = require('./typeDefs')
const { resolvers } = require('./resolvers')
const jwt = require('jsonwebtoken');
const JWT_SECRET = 'f1BtnWgD3VKY';
const users = [
{
"id":1,
"name":"Magdalena",
"email":"mgrewes0#chronoengine.com",
"gender":"male",
"mobile":"734-324-1043",
"cumulativeGPA":92.1,
"isGraduated":true,
"friends":[
{
"name":"Magdalena",
"email":"mgrewes0#chronoengine.com",
"gender":"male",
"mobile":"734-324-1043",
"cumulativeGPA":92.1
},
{
"name":"Harman",
"email":"hgaspero2#1688.com",
"gender":"male",
"mobile":"158-265-8979",
"cumulativeGPA":87.9
},
{
"name":"Oliver",
"email":"ocourtliff4#spotify.com",
"gender":"female",
"mobile":"500-958-5193",
"cumulativeGPA":67.9
}
],
"age":28,
"image" : {"name":"ghklk.png", "height": 50 , "width":30},
"idea": "auction",
"grantedAmount": 12000
},
{
"id":2,
"name":"Lyndell",
"email":"lgilbee1#google.com.br",
"gender":"male",
"mobile":"165-705-3521",
"cumulativeGPA":90.6,
"isGraduated":false,
"friends":[
{
"name":"Magdalena",
"email":"mgrewes0#chronoengine.com",
"gender":"male",
"mobile":"734-324-1043",
"cumulativeGPA":92.1
},
{
"name":"Harman",
"email":"hgaspero2#1688.com",
"gender":"male",
"mobile":"158-265-8979",
"cumulativeGPA":87.9
},
{
"name":"Oliver",
"email":"ocourtliff4#spotify.com",
"gender":"female",
"mobile":"500-958-5193",
"cumulativeGPA":67.9
}
],
"age":23,
"image" : {"name":"ghklk.png", "height": 50, "width":30},
"idea": "e-collage",
"grantedAmount": 0
},
]
async function startApolloServer(typeDefs, resolvers) {
const app = express()
const httpServer = http.createServer(app)
let schema = makeExecutableSchema({
typeDefs,
resolvers
})
schema = upperDirectiveTransformer(schema, 'upper')
const wsServer = new WebSocketServer({
server: httpServer,
path: '/graphql'
})
const serverCleanup = useServer({ schema }, wsServer);
const server = new ApolloServer({
schema,
plugins: [
ApolloServerPluginDrainHttpServer({ httpServer }),
{
async serverWillStart() {
return {
async drainServer() {
serverCleanup.dispose();
}
}
}
}
],
context: ({ req }) => {
const auth = req ? req.headers.authorization : null
try{
const decodedToken = jwt.verify(auth.slice(4), JWT_SECRET)
const user = users.find(user => user.id == decodedToken.id)
return { user }
}catch(err){
return null
}
}
})
await server.start()
server.applyMiddleware({ app })
await new Promise(resolve => httpServer.listen({ port: 4000 }, resolve))
console.log(`🚀 Server ready at http://localhost:4000${server.graphqlPath}`);
return { server, app }
}
startApolloServer(typeDefs, resolvers)
my resolvers.js
const users = [
{
"id":1,
"name":"Magdalena",
"email":"mgrewes0#chronoengine.com",
"gender":"male",
"mobile":"734-324-1043",
"cumulativeGPA":92.1,
"isGraduated":true,
"friends":[
{
"name":"Magdalena",
"email":"mgrewes0#chronoengine.com",
"gender":"male",
"mobile":"734-324-1043",
"cumulativeGPA":92.1
},
{
"name":"Harman",
"email":"hgaspero2#1688.com",
"gender":"male",
"mobile":"158-265-8979",
"cumulativeGPA":87.9
},
{
"name":"Oliver",
"email":"ocourtliff4#spotify.com",
"gender":"female",
"mobile":"500-958-5193",
"cumulativeGPA":67.9
}
],
"age":28,
"image" : {"name":"ghklk.png", "height": 50 , "width":30},
"idea": "auction",
"grantedAmount": 12000
},
{
"id":2,
"name":"Lyndell",
"email":"lgilbee1#google.com.br",
"gender":"male",
"mobile":"165-705-3521",
"cumulativeGPA":90.6,
"isGraduated":false,
"friends":[
{
"name":"Magdalena",
"email":"mgrewes0#chronoengine.com",
"gender":"male",
"mobile":"734-324-1043",
"cumulativeGPA":92.1
},
{
"name":"Harman",
"email":"hgaspero2#1688.com",
"gender":"male",
"mobile":"158-265-8979",
"cumulativeGPA":87.9
},
{
"name":"Oliver",
"email":"ocourtliff4#spotify.com",
"gender":"female",
"mobile":"500-958-5193",
"cumulativeGPA":67.9
}
],
"age":23,
"image" : {"name":"ghklk.png", "height": 50, "width":30},
"idea": "e-collage",
"grantedAmount": 0
}]
const { PubSub } = require('graphql-subscriptions')
const pubSub = new PubSub()
const resolvers = {
Gender: {
MALE: 'male',
FEMALE: 'female',
},
Query: {
getUserByID: (_, {id}) => users.find(user => user.id == id),
users: () => users,
},
Mutation: {
createUser: async (_, args) => {
if (users.find(user => user.email === args.email)) {
throw new Error('user already exist')
}
const user = { ...args, id: users.length + 1 };
users = users.concat(user);
pubSub.publish('USER_ADDED', { userAdded: user })
return user
}
},
Subscription: {
userAdded: {
subscribe: () => pubSub.asyncIterator(['USER_ADDED']),
}
}
};
module.exports = { resolvers };
typeDefs.js
const { gql } = require('apollo-server-express');
const typeDefs = gql`
type User {
id: ID!
name: String!
email: String!
gender: Gender!
mobile: String!
cumulativeGPA:Float!
isGraduated: Boolean
friends: [Friend]!
age: Int!
image: Image
}
enum Gender {
MALE
FEMALE
}
type Friend{
name: String!
email: String!
gender: Gender!
mobile: String!
cumulativeGPA:Float!
}
type Image{
name: String!
height: Int!
width: Int!
}
type Query {
users: [User]
getUserByID(id: ID!): User
}
type Mutation {
createUser(
name: String!
email: String!
gender: Gender!
mobile: String!
cumulativeGPA:Float!
isGraduated: Boolean
friends: [FriendInput]!
age: Int!
image: ImageInput
): User
}
type Subscription {
userAdded: User
}
input ImageInput{
name: String!
height: Int!
width: Int!
}
input FriendInput{
name: String!
email: String!
gender: Gender!
mobile: String!
cumulativeGPA:Float!
}
`;
module.exports = { typeDefs };
ther is no client, just i need to try subscriptions from server-side on apollo-sandbox
[1]: https://www.apollographql.com/docs/apollo-server/data/subscriptions/
I encountered a similar problem and what worked for me was the following:
Go into the "Explorer Settings" (the cog icon) in the Apollo Studio sandbox.
Click "Edit"
Set your "Subscriptions" endpoint to "ws://localhost:4000/graphql"
Change your "Implementation" to "graphql-ws"
Save and try your subscription operation again

Why is this GraphQL query returning null? [duplicate]

This question already has answers here:
Why does a GraphQL query return null?
(6 answers)
Closed 3 years ago.
Schema:
const graphql = require('graphql');
const _ = require('lodash');
const {
GraphQLObjectType,
GraphQLString,
GraphQLInt,
GraphQLSchema
} = graphql;
const users = [
{ id: '23', firstName: 'Bill', age: 20 },
{ id: '47', firstName: 'Samantha', age: 21 }
]
const UserType = new GraphQLObjectType({
name: 'User',
fields: {
id: { type: GraphQLString },
firstName: { type: GraphQLString },
age: {type: GraphQLInt },
}
});
const RootQueryType = new GraphQLObjectType({
name: 'RootQuery',
fields: {
user: {
type: UserType,
args: { id: {type: GraphQLString} },
resolve(parentValue, args) {
return _.find(users, args.id);
}
}
}
});
module.exports = new GraphQLSchema({
query: RootQueryType,
});
Express:
const express = require('express');
const expressGraphQL = require('express-graphql');
const schema = require('./schema/schema')
const app = express();
app.use('/graphql', expressGraphQL({
schema,
graphiql: true,
}));
app.listen(4000, () => {
console.log('Listening');
});
Query:
{
user(id:"23") {
id,
firstName,
age
}
}
Trying to learn GraphQL and can't for the life of me figure out what's wrong with my query/schema.
You just need to change how you're calling lodash's find:
return _.find(users, { id: args.id });

Resources