Genesis 4:6-7

Genesis 4:6-7

[6] And the LORD  said  unto Cain,  Why art thou wroth?  and why is thy countenance  fallen?  [7] If  thou doest well,  shalt thou not be accepted?  and if thou doest not well,  sin  lieth  at the door.  And unto thee shall be his desire,  and thou shalt rule  over him.

What is the context of Genesis 4:6-7?